David Santos
77c8c5519a
fix(rss): export mapFeedItems and readBoundedInt for tests
...
ai-news-writer-ci / test (pull_request) Successful in 1m5s
Unit tests require these helpers; they were module-local only.
2026-05-01 21:02:20 +01:00
David Santos
48615978b8
chore: merge main into BIT-2700 (resolve write.js conflict)
ai-news-writer-ci / test (pull_request) Successful in 1m3s
2026-05-01 20:58:40 +01:00
David Santos
5e4304c227
chore: merge main into BIT-2700-refactor-article-pipeline (regenerate package-lock)
ai-news-writer-ci / test (pull_request) Successful in 48s
2026-05-01 20:56:13 +01:00
David Santos
f15d156ef5
chore: merge main into task/BIT-5284-analytics-dashboard (resolve package-lock)
ai-news-writer-ci / test (pull_request) Successful in 59s
2026-05-01 20:55:59 +01:00
David Santos
23e45f33a8
chore(deps): npm audit fix (high-severity transitive updates)
ai-news-writer-ci / test (pull_request) Successful in 44s
2026-05-01 20:54:20 +01:00
David Santos
6f9bac9de9
chore(deps): npm audit fix (high-severity transitive updates)
ai-news-writer-ci / test (pull_request) Successful in 1m0s
2026-05-01 20:53:51 +01:00
David Santos
f8db96c28a
fix(lint): eslint --fix analytics modules; drop unused path import in analytics-api test
ai-news-writer-ci / test (pull_request) Failing after 22s
2026-05-01 20:52:39 +01:00
David Santos
690c7ee581
fix(ci,writer): sync Gitea test workflow; export OpenAI test helpers
ai-news-writer-ci / test (pull_request) Failing after 23s
2026-05-01 20:50:50 +01:00
David Santos
3999d6dcff
fix(ci,writer): sync Gitea test workflow; export OpenAI test helpers
ai-news-writer-ci / test (pull_request) Successful in 43s
2026-05-01 20:50:35 +01:00
David Santos
235cf758a9
fix(ci,writer): sync Gitea test workflow; export OpenAI test helpers
ai-news-writer-ci / test (pull_request) Failing after 22s
2026-05-01 20:50:15 +01:00
David Santos
4dd0cb05cc
fix(ci): sync test workflow with main (artifact/Codecov non-blocking)
ai-news-writer-ci / test (pull_request) Failing after 22s
2026-05-01 20:48:52 +01:00
David Santos
616f8b0f52
fix(ci): do not fail Gitea Actions on artifact/Codecov steps
...
ai-news-writer-ci / test (pull_request) Successful in 44s
act_runner often cannot complete actions/upload-artifact@v3; treat upload and
Codecov as optional. Require coverage/lcov.info after tests so quality gate stays
strict. Harden PyYAML install for workflow parse step (PEP 668 / user site).
2026-05-01 20:43:34 +01:00
David Santos
e3c21c79ca
ci: quote Gitea workflow YAML trigger keys as 'on'
ai-news-writer-ci / test (pull_request) Failing after 24s
2026-05-01 02:40:00 +01:00
David Santos
14f35d34dd
fix(ci): apply ESLint-heal fileset from task/BIT-2983-test-coverage (BIT-15735)
ai-news-writer-ci / test (pull_request) Failing after 28s
2026-05-01 01:57:22 +01:00
David Santos
49b4a87ccc
fix(ci): apply ESLint-heal fileset from task/BIT-2983-test-coverage (BIT-15735)
ai-news-writer-ci / test (pull_request) Failing after 33s
2026-05-01 01:57:20 +01:00
David Santos
d9ba5fba70
fix(ci): apply ESLint-heal fileset from task/BIT-2983-test-coverage (BIT-15735)
ai-news-writer-ci / test (pull_request) Failing after 28s
2026-05-01 01:57:17 +01:00
David Santos
c157ff22c6
fix(ci): apply ESLint-heal fileset from task/BIT-2983-test-coverage (BIT-15735)
ai-news-writer-ci / test (pull_request) Failing after 24s
2026-05-01 01:57:15 +01:00
David Santos
2026baed8b
fix(ci): ESLint green — ui-handlers auth imports, analytics style, dead code
ai-news-writer-ci / test (pull_request) Failing after 27s
2026-05-01 01:51:19 +01:00
David Santos
e97a4362bf
Merge remote-tracking branch 'origin/main' into tmp-sync-pr4
ai-news-writer-ci / test (pull_request) Failing after 28s
2026-04-22 22:52:45 +01:00
David Santos
0942f2e57d
Merge remote-tracking branch 'origin/main' into tmp-sync-pr4
ai-news-writer-ci / test (pull_request) Failing after 32s
2026-04-22 22:52:19 +01:00
David Santos
833d50f3a6
Merge remote-tracking branch 'origin/main' into tmp-sync-pr3
ai-news-writer-ci / test (pull_request) Failing after 26s
2026-04-22 22:52:16 +01:00
David Santos
d3907457c4
Merge remote-tracking branch 'origin/main' into tmp-sync-pr2
ai-news-writer-ci / test (pull_request) Failing after 32s
2026-04-22 22:52:13 +01:00
David Santos
dff063e14b
Merge remote-tracking branch 'origin/main' into tmp-sync-pr1
ai-news-writer-ci / test (pull_request) Failing after 30s
2026-04-22 22:52:11 +01:00
David Santos
628fbd4533
feat(health): wp_publish_by_transport counts on /health and ops page
Node tests / test (push) Has been cancelled
2026-03-25 04:47:15 +00:00
David Santos
5010e34a5f
feat(wp): optional XML-RPC publish (wp.newPost) and credential test
...
Node tests / test (push) Has been cancelled
- Add wp-http-options.js (shared retries) and wp-transport.js (rest vs xmlrpc).
- publishToWordPress / testConnection branch on wp_transport site field or WP_TRANSPORT.
- xmlrpc-client: publishArticleXmlRpc, testConnectionXmlRpc, extractScalarParam.
- UI publishers table shows transport; wp:test JSON includes wp_transport.
- Tests: wp-transport + XML-RPC publish stub.
REST remains default; link fallback uses ?p=<id> for XML-RPC posts.
Made-with: Cursor
2026-03-25 04:34:19 +00:00
David Santos
495143690f
feat(wp): XML-RPC connectivity probe (system.listMethods)
...
Node tests / test (push) Has been cancelled
Add xmlrpc-client with serializer/parser (fast-xml-parser), local stub tests,
and npm run wp:probe-xmlrpc for each configured site wp_url. Reuses WP retry
env and exports wpRetryOpts from wordpress.js. Optional OPS_CHECK_XMLRPC=1 in
ops-check.sh after wp:test. Publish path remains REST-only; probe validates
BIT-353 XML-RPC surface for hosts that disable or restrict REST.
Made-with: Cursor
2026-03-25 04:19:15 +00:00
David Santos
3daaf43088
refactor(config): single source for AUTO_CRON default
...
Node tests / test (push) Has been cancelled
- config/listen-defaults: DEFAULT_AUTO_CRON + resolveAutoCronExpression()
- index.js and status-server /health use resolver (no duplicated */30 string)
- rss-listener fallback uses same default (was */15; aligned with listen mode)
- listen-defaults.test.js
Made-with: Cursor
2026-03-25 04:04:30 +00:00
David Santos
2b14db7304
feat(health): expose listen_auto_cron (AUTO_CRON)
...
Node tests / test (push) Has been cancelled
Same default as src/index.js listen mode (*/30 * * * *). Shown on /health,
ops landing RSS line, and verify-deploy.sh.
Made-with: Cursor
2026-03-25 03:52:52 +00:00
David Santos
0780e68279
fix(ui): 415 for non-form Content-Type on POST /ui/*
...
Node tests / test (push) Has been cancelled
Admin saves parse the body as URLSearchParams (x-www-form-urlencoded).
Reject application/json, multipart, etc. before collectBody; log WARN.
Add ui-form-post helper + tests; README note.
Made-with: Cursor
2026-03-25 03:41:14 +00:00
David Santos
953ea7d482
fix(ui): timeout reading POST bodies + /health field
...
Node tests / test (push) Has been cancelled
- body-read-timeout: parse HTTP_BODY_READ_TIMEOUT_MS (default 120s; 0 = no limit)
- collectBody: destroy socket and reject on timeout; warn log
- /health: http_body_read_timeout_ms (null when unlimited)
- verify-deploy + .env.example; unit tests for parser
Made-with: Cursor
2026-03-25 03:29:11 +00:00
David Santos
7211716e40
fix(http): reject TRACE/TRACK/CONNECT; 405 for wrong methods on ops routes
...
Node tests / test (push) Has been cancelled
- Block TRACE, TRACK, CONNECT before any handler (Allow: GET, HEAD, POST)
- /health and / landing: only GET/HEAD; otherwise 405 with correct Allow
- HEAD / and /dashboard supported (same as /health pattern)
- security-headers: writeMethodNotAllowed helper + unit test
- Ops HTML endpoint list updated
Made-with: Cursor
2026-03-25 03:16:25 +00:00
David Santos
bd27b446a5
feat(tools): deploy-lxc.sh for git pull + npm ci + PM2 reload
...
Node tests / test (push) Has been cancelled
- tools/deploy-lxc.sh: ff-only pull, production npm ci, pm2 startOrReload
ecosystem.config.cjs --update-env; optional --with-ops-check
- package.json: npm run deploy:lxc
- README: commands table + deploy section note
Made-with: Cursor
2026-03-25 03:03:09 +00:00
David Santos
7f941e3cf7
chore(pm2): auto DEPLOY_REVISION from git in ecosystem
...
Node tests / test (push) Has been cancelled
When DEPLOY_REVISION/GIT_REVISION are unset, ecosystem.config.cjs runs
git rev-parse --short HEAD at pm2 start so /health deploy_revision matches
the checkout. Documented in README and .env.example.
Made-with: Cursor
2026-03-25 02:50:38 +00:00
David Santos
20b94eadf9
feat(http): security headers, deploy_revision on /health
...
Node tests / test (push) Has been cancelled
- security-headers: mergeResponseHeaders (nosniff + referrer-policy)
- status-server + ui-handlers: all responses use merged headers
- /health: Cache-Control no-store; deploy_revision from DEPLOY_REVISION or GIT_REVISION
- verify-deploy + .env.example: document deploy revision envs
- security-headers.test.js
Made-with: Cursor
2026-03-25 02:37:54 +00:00
David Santos
c29b05e6a3
feat(store): bound article JSONL growth + /health size
...
Node tests / test (push) Has been cancelled
- article-log: trim oldest lines when file exceeds ARTICLE_LOG_TRIM_AT_BYTES
and line count > ARTICLE_LOG_MAX_LINES (defaults 2MiB / 10000)
- Optional ARTICLE_LOG_PATH (absolute or relative to repo root)
- getArticleLogPath(), getArticleLogHealthFields(); LOG_FILE getter kept
- /health: article_log_bytes; verify-deploy echoes it
- test: trim behaviour with temp log path
Made-with: Cursor
2026-03-25 02:24:37 +00:00
David Santos
5ef4fd9605
feat(listen): CRON_TIMEZONE (IANA) + idle HTTP close on shutdown
...
Node tests / test (push) Has been cancelled
- util/iana-timezone: shared Intl validation for node-cron + /health
- rss-listener: pass timezone into cron.schedule when valid; warn if invalid
- status-server: rss_cron_timezone on /health (null when unset/invalid)
- HTTP close(): closeIdleConnections() when available (Node 18+)
- verify-deploy + .env.example: document CRON_TIMEZONE
- tests: iana-timezone.test.js
Made-with: Cursor
2026-03-25 01:58:06 +00:00
David Santos
ee05af933a
feat(ops): process diagnostics, /health pid+node, cron option
...
Node tests / test (push) Has been cancelled
- runtime/process-diagnostics: log unhandledRejection; uncaughtException + exit 1
- index: install once at startup (all CLI modes)
- status-server /health: pid, node_version
- verify-deploy: print pid and node version
- rss-listener: explicit recoverMissedExecutions: false (default; documented in code)
Made-with: Cursor
2026-03-25 01:38:47 +00:00
David Santos
2b4725424b
fix(rss): no-overlap cron ticks + overlap counter in /health
...
Node tests / test (push) Has been cancelled
Long-running auto mode (detect → write → WP) could overlap the next cron
fire and stack work. Skip overlapping runs with a warn log; expose
rss_listener_overlap_skips in listen-state for /health and verify-deploy.
Made-with: Cursor
2026-03-25 01:25:44 +00:00
David Santos
451853b03e
feat(http): inbound timeouts, /health exposure, PM2 kill_timeout
...
Node tests / test (push) Has been cancelled
- status-server: set requestTimeout/headersTimeout (defaults 120s/125s; env
HTTP_REQUEST_TIMEOUT_MS / HTTP_HEADERS_TIMEOUT_MS; auto-fix headers ≤ request)
- /health + verify-deploy: echo http_*_timeout_ms for ops
- ecosystem.config.cjs: kill_timeout 15s for graceful SIGTERM path
- .env.example: document timeout vars
Made-with: Cursor
2026-03-25 01:12:44 +00:00
David Santos
632c3177ce
fix(listen): graceful shutdown on SIGTERM and SIGINT
...
Node tests / test (push) Has been cancelled
PM2 and systemd send SIGTERM on stop/restart; only handling SIGINT left
cron and HTTP listening after process exit. Consolidate shutdown: guard
re-entry, stop cron, clear rss_listener_active, close HTTP server.
Made-with: Cursor
2026-03-25 00:57:48 +00:00
David Santos
82f905d730
test(ops): listen-state unit tests; ops-check runs npm test
...
Node tests / test (push) Has been cancelled
Add src/runtime/listen-state.test.js (fresh module load per case).
ops-check.sh runs npm test before rss:test. verify-deploy.sh prints RSS
tick fields when present. README ops:check row updated.
Made-with: Cursor
2026-03-25 00:42:49 +00:00
David Santos
d13a1706c7
feat(health): expose RSS listener last cron tick on /health
...
Node tests / test (push) Has been cancelled
Record each listener iteration in listen-state; JSON adds
rss_listener_last_tick_at, rss_listener_last_tick_ok,
rss_listener_last_tick_error. Ops HTML shows tick summary when listener
is active.
Made-with: Cursor
2026-03-25 00:29:01 +00:00
David Santos
c87d221995
feat(x): retry recent-search via http-retry; add Gitea Actions test job
...
Node tests / test (push) Has been cancelled
X API v2 search uses axiosGetWithRetry (429, 502–504, transient network).
New env: X_HTTP_MAX_ATTEMPTS (default 3), X_RETRY_BASE_MS (default 1000ms).
Add .gitea/workflows/test.yml to run npm ci && npm test on push/PR.
Made-with: Cursor
2026-03-25 00:14:50 +00:00
David Santos
11350b2f3e
feat(rss): use shared http-retry for feed GET; add unit tests
...
RSS fetch uses axiosGetWithRetry + parseString so transient policy matches
WP/scraper. New env: RSS_HTTP_MAX_ATTEMPTS, RSS_RETRY_BASE_MS.
Add http-retry policy tests; fix npm test to discover *.test.js via find.
Made-with: Cursor
2026-03-25 00:01:37 +00:00
David Santos
aef941f367
refactor: centralize HTTP retry in util/http-retry
...
Extract shared transient-error detection and exponential backoff for
axios GET/POST. WordPress publisher and article scraper now call
axiosGetWithRetry / axiosPostWithRetry with existing env knobs unchanged.
Made-with: Cursor
2026-03-24 23:43:44 +00:00
David Santos
07880405d3
feat(scraper): retry article GET on transient HTTP/network errors
...
Align with WP/OpenAI: 429 and 5xx gateway, common socket errors, timeout
message. Env SCRAPER_HTTP_MAX_ATTEMPTS and SCRAPER_RETRY_BASE_MS.
Made-with: Cursor
2026-03-24 23:30:03 +00:00
David Santos
8f2ad454e9
feat(ui): simple admin pages /ui for titles, sources, social, theme
...
- Append generated article metadata to data/article-index.jsonl for listing
- HTML UI: /ui, /ui/sources, /ui/social, /ui/publishers, /ui/theme
- Saves require ADMIN_TOKEN; optional Bearer for future API use
- GET /api/ui/articles JSON; config/ui-theme.example.json for accents
- README and .env.example document access control expectations
Made-with: Cursor
2026-03-24 23:17:53 +00:00
David Santos
77024a71d4
feat(http): expose OpenAI config flags on /health and ops page
...
Add openai_api_key_configured and ai_model to JSON; show on landing HTML.
Made-with: Cursor
2026-03-24 23:10:01 +00:00
David Santos
8e239cbe3d
fix(listen): keep HTTP up if RSS listener fails; document NPM 502
...
- loadSources/loadSocial: tolerate invalid JSON (log + safe fallback)
- runAutoMode: catch listener startup errors so the status server stays
bound for probes and NPM debugging
- /health + ops page: rss_listener_active flag for degraded state
- README: 502 checklist (PM2, port, NPM upstream, firewall, curl from NPM)
Made-with: Cursor
2026-03-24 23:06:05 +00:00
David Santos
574e6a5ddd
feat(ai): retry OpenAI chat completions on transient errors
...
chatCompletionWithRetry for generateArticle and detectTopics; env
OPENAI_MAX_ATTEMPTS and OPENAI_RETRY_BASE_MS.
Made-with: Cursor
2026-03-24 22:55:45 +00:00
David Santos
fa0818ff7c
feat(http): ops landing page at / and /dashboard for listen mode
...
Adds a read-only HTML page (PT) explaining where to open the service,
which endpoints exist, and that the editorial dashboard is still
out of scope. Reuses existing config probes for RSS/X/WP flags.
Documents HTTP surface in README.
Made-with: Cursor
2026-03-24 22:53:22 +00:00
David Santos
34faf38911
feat(wp): configurable retries for all REST calls
...
Add axiosGetWithRetry; use for tag search, tag create, and users/me.
WP_HTTP_MAX_ATTEMPTS and WP_RETRY_BASE_MS env vars (documented).
Guard tag search when response body is not an array.
Made-with: Cursor
2026-03-24 22:41:42 +00:00
David Santos
ee330c8319
fix(wp): retry REST post create on transient failures
...
Up to 3 attempts with exponential backoff for 429, 502-504, and common
network errors before surfacing publish failure.
Made-with: Cursor
2026-03-24 22:29:30 +00:00
David Santos
63dbe77249
refactor(crawler): centralize RSS+X merge in merge-sources.js
...
fetchMergedSourceArticles used by manual write and rss-listener; single
log line on X aggregate failure.
Made-with: Cursor
2026-03-24 22:17:26 +00:00
David Santos
c5e197d707
feat(write): merge optional X tweets into manual write sources
...
Align manual mode with listen: RSS + social.json recent search, sorted by
time. Skip HTTP scrape for source=x (tweet text stays in summary).
Made-with: Cursor
2026-03-24 22:05:16 +00:00
David Santos
86421a202a
feat(http): extend /health with listen feature flags
...
Expose rss_feed_count, x_queries_configured, x_listening, and
wp_credentials_configured (no secrets, no network) for NPM/ops probes.
Made-with: Cursor
2026-03-24 21:53:42 +00:00
David Santos
560ad9716f
feat(x): optional X API v2 recent search in listen mode
...
- config/social.example.json + loadSocialConfig; social.json gitignored.
- fetchXAsArticles merges tweets with RSS before keyword filter.
- x:test / npm run x:test probes queries + bearer token.
Made-with: Cursor
2026-03-24 21:41:35 +00:00
David Santos
d31e158b84
feat(crawler): bounded RSS concurrency + env HTTP tuning
...
fetchAllFeeds processes feeds in chunks (RSS_FETCH_CONCURRENCY, default 3).
RSS timeout and User-Agent from env; scraper shares HTTP_USER_AGENT and
SCRAPER_TIMEOUT_MS. Document in .env.example and README.
Made-with: Cursor
2026-03-24 21:27:28 +00:00
David Santos
2ebab7e2bc
docs(tools): clarify ops-check wp:test preconditions
...
Made-with: Cursor
2026-03-24 21:15:01 +00:00
David Santos
d6b819cf28
feat(tools): add ops:check for post-clone smoke tests
...
Runs rss:test always; wp:test only when WP env or real site JSON exists.
Document in README commands table and LXC deploy steps.
Made-with: Cursor
2026-03-24 21:14:54 +00:00
David Santos
3b35420053
fix(config): replace dead RSS feeds in default sources
...
Reuters (deprecated host), A Bola 404, and malformed UEFA XML broke
rss:test and reduced crawler yield. Use Guardian + RTP Notícias feeds
verified with rss-parser; refresh trusted_domains.
Made-with: Cursor
2026-03-24 21:02:35 +00:00
David Santos
8b71437c8d
feat(rss): retries + rss:test feed probe
...
- fetchFeed: up to 3 attempts with exponential backoff (500ms base).
- fetchFeedWithResult for structured outcomes; rss:test prints JSON per feed.
Made-with: Cursor
2026-03-24 20:48:26 +00:00
David Santos
c80d44dfda
feat(cli): wp:test validates all site configs
...
When multiple config/sites/*.json exist, probe each via REST users/me;
aggregate { ok, sites } on stdout. Incomplete site files fail fast.
Made-with: Cursor
2026-03-24 20:35:31 +00:00
David Santos
bd23f10250
feat(cli): add wp:test for WordPress REST credential check
...
Uses existing testConnection (users/me). Exits non-zero on failure;
prints one-line JSON on success for scripting.
Made-with: Cursor
2026-03-24 20:23:58 +00:00
David Santos
f68b5cda7f
feat(tools): add verify-deploy.sh for LXC/NPM smoke tests
...
Validates /health returns ok + mode listen with non-zero exit on failure.
Document npm run verify:deploy in README.
Made-with: Cursor
2026-03-24 20:12:46 +00:00
David Santos
cd84efe0b8
chore(deploy): add PM2 ecosystem.config.cjs for listen mode
...
Single command `pm2 start ecosystem.config.cjs` avoids forgetting `-- listen`.
Document npm script, README deploy path, and Proxmox post-create hints.
Made-with: Cursor
2026-03-24 20:01:22 +00:00
David Santos
6e70fbe1b3
feat(http): enrich /health with version, mode, and HEAD support
...
Helps ops verify NPM/LXC deployments are running listen mode and the
expected package version, not a one-shot write process.
Made-with: Cursor
2026-03-24 19:59:45 +00:00
David Santos
297649b5f9
docs(deploy): clarify LXC is manual on Proxmox; fix PM2 echo in script
...
README explains that CT 223 is not created by the repo alone, adds
verification commands and a PT note for NPM/IP alignment. Proxmox helper
echo now matches the full pm2 listen command. CLI usage text documents
the HTTP surface in listen mode.
Made-with: Cursor
2026-03-24 19:48:16 +00:00
David Santos
d6248c3f8b
fix(deploy): serve HTTP on PORT in listen mode for NPM proxy
...
The domain pointed at :3200 had no listener: the app was CLI-only and
default PM2 start ran write mode (exits). Listen mode now starts a small
HTTP server on HOST:PORT (defaults 0.0.0.0:3200) with / and /health.
README and Proxmox script document pm2 "listen" and LXC verification.
Ref: BIT-353 board feedback on ainews.bitreport.pt.
Made-with: Cursor
2026-03-24 19:30:55 +00:00
David Santos and Paperclip
d48dc3b87c
feat: initial AI News Writer system (BIT-353)
...
Standalone autonomous news writing system — RSS crawler, journalist AI,
WordPress export, social listening, and LXC provisioning script.
- src/crawler/rss.js: fetch + normalize RSS feeds; keyword filter
- src/crawler/scraper.js: cheerio-based full article scraper
- src/writer/ai.js: OpenAI journalist AI (article generation + topic detection)
- src/publisher/wordpress.js: WP REST API export (tags auto-created)
- src/listener/rss-listener.js: cron-based live RSS monitoring
- src/config/loader.js: sources + site config loader
- src/index.js: manual write + auto listener entry points
- config/sources.json: RSS feeds (Record, A Bola, BBC, ESPN, Reuters...)
- config/sites/example.json: WP site config template
- tools/proxmox/create_ai_news_writer_lxc.sh: LXC provisioning (CT 223, Ubuntu 24, 2C/4GB/20GB)
- .env.example, README.md, package.json
RSS crawler validated: 158 articles from 9 feeds, 18 keyword-matched (live test 2026-03-23).
Paperclip-Issue: BIT-353
Paperclip-Run: 0c1d51c2-8394-475c-bced-e0ae237f4314
Co-Authored-By: Paperclip <[email protected] >
Made-with: Cursor
2026-03-23 15:52:38 +00:00