269 Commits

Author SHA1 Message Date
xiaoju ef40512977 refactor(daemon): reflex-scheduler reads from sense config with legacy fallback
- Scheduler iterates config.senses directly for interval/on
- Falls back to config.reflexes when sense has no inline triggers
- kernel.ts uses senseTriggerLabelsWithFallback for display
- New core export: senseTriggerLabelsWithFallback
- All 166 daemon tests pass

Fixes #194
2026-04-27 10:46:12 +00:00
xiaoju d0cc8c0840 feat(core): backward-compat parsing for legacy reflexes array
- Merge top-level reflexes into sense-level interval/on fields
- Emit deprecation warning when legacy reflexes detected
- Deduplicate on[] triggers, detect interval conflicts
- Add tests for compat parsing, merge, and conflict cases

Fixes #193
2026-04-27 10:40:46 +00:00
xiaoju 453294a465 fix(daemon): guard against undefined in sense signal persistence
Use loose equality (!=) to catch both null and undefined from compute(),
preventing undefined values from being persisted to SQLite.

Fixes #192
2026-04-27 10:35:26 +00:00
xiaoju 81663ad524 fix(core): remove stale import process breaking core build
Fixes #191
2026-04-27 10:33:36 +00:00
xingyue 5899a858ac refactor(cli): unify validateResourceName, rename WORKFLOW_NAME_RE → RESOURCE_NAME_RE
Address review feedback: merge validateWorkflowName and
validateSenseName into a single validateResourceName(name, type).

Closes #188
2026-04-27 18:23:43 +08:00
xingyue d13fbe08db refactor(cli): add nerve create command, remove init workflow
- Add top-level `nerve create` with `workflow` and `sense` subcommands
- Move workflow scaffold from `init workflow` to `nerve create workflow`
- Add `nerve create sense <name>` to scaffold sense boilerplate
- Keep `nerve init` for workspace initialization only
- Add tests for create workflow, create sense, and e2e

Closes #188
2026-04-27 18:16:57 +08:00
xiaoju c6c3e0142d chore: bump version to 0.5.0
小橘 🍊(NEKO Team)
2026-04-27 09:40:34 +00:00
xiaoju 03e103d400 refactor: move experimental-warning-suppression from core to daemon
core package should remain platform-agnostic without direct process access.
The suppression module belongs in daemon where Node.js APIs are expected.

小橘 🍊(NEKO Team)
2026-04-27 09:30:16 +00:00
xiaomo e0a9c6a471 Merge pull request 'fix(cli): suppress ExperimentalWarning in CLI and daemon spawn' (#185) from fix/suppress-experimental-warning into main 2026-04-27 09:21:36 +00:00
xiaomo 09098ef4b2 fix(cli): suppress ExperimentalWarning in CLI and daemon spawn 2026-04-27 09:18:34 +00:00
xingyue f9c591fdf2 refactor: reduce cognitive complexity in 3 functions (#184)
Co-authored-by: 星月 <xingyue@shazhou.work>
Co-committed-by: 星月 <xingyue@shazhou.work>
2026-04-27 09:10:05 +00:00
xiaomo 8f3322bc48 Merge pull request 'fix(cli): add logs/ and nerve.pid to init gitignore template' (#182) from fix/gitignore-template into main 2026-04-27 08:40:44 +00:00
Scott Wei 57e4d992e2 fix(cli): add --skip-install flag to init, fix e2e test timeout
- Add --skip-install flag to nerve init for testing/offline use
- Use --skip-install in e2e tests to avoid real pnpm install
- Reduce e2e init test timeout from 60s to 10s

Closes #181
2026-04-27 16:38:21 +08:00
Scott Wei 0a0121d2ca fix(cli): add logs/ and nerve.pid to init gitignore template
These are runtime artifacts that should not be tracked.
2026-04-27 16:18:14 +08:00
xiaomo d70e74afde fix: suppress ExperimentalWarning for node:sqlite (#179)
Add side-effect module in @uncaged/nerve-core that filters ExperimentalWarning
from process.emit. Imported at all entry points: CLI, daemon bootstrap,
sense-worker, and workflow-worker.
2026-04-27 08:17:52 +00:00
xingyue 40accf3b7c refactor(daemon): optimize _signals prune query
Replace NOT IN subquery with OFFSET-based cutoff for better
performance at large retention values.

Ref: PR #177 review feedback from @xiaomo
2026-04-27 15:56:43 +08:00
xingyue b05225fa2a fix(daemon): fix flaky file-watcher config test on macOS
Increase settle time to 200ms and clear setup-phase events before
asserting, matching the approach from #175.
2026-04-27 15:45:58 +08:00
xingyue 63a54d4641 feat(daemon): _signals table retention policy (#152)
- Add `retention` field to SenseConfig (default 10000 max rows)
- Parse optional `retention` positive integer in nerve.yaml sense config
- Prune old _signals rows every 100 inserts for amortized performance
- Pass retention from config through sense-worker to openSenseDb
- Add unit tests for config parsing and runtime pruning
2026-04-27 15:44:33 +08:00
xiaomo 2fdb6a5edd Merge pull request 'docs: E2E test scenario specs for all CLI subcommands' (#176) from docs/e2e-scenarios into main 2026-04-27 07:33:42 +00:00
xiaoju aa88a61e80 docs: add E2E test scenario specs for all CLI subcommands
Each .md file documents existing () and planned (🔲) E2E test
scenarios per subcommand, serving as a coverage map and onboarding
reference for contributors.

Refs #153
2026-04-27 07:32:03 +00:00
xiaoju 3927411ec7 fix(daemon): fix flaky file-watcher workflow test on macOS
Use a temp dir without workflow files for the negative test case,
avoiding macOS fs.watch event coalescing from setup file creation.

Fixes #149
2026-04-27 07:24:26 +00:00
xiaoju 0241f0fd3e test(cli): add e2e test for nerve store archive
Start daemon, trigger workflow, backdate logs >30 days, verify:
- store archive exports old entries to JSONL files
- Archived rows removed from logs.db
- thread list still shows workflow_runs correctly
- --vacuum flag runs SQLite VACUUM successfully

Extends e2e-harness with store subcommand.

Fixes #163
2026-04-27 07:16:09 +00:00
xiaomo 961b657d7e Merge pull request 'test(cli): add e2e test for workflow runs / inspect / thread' (#173) from test/160-workflow-e2e into main 2026-04-27 07:06:57 +00:00
xiaonuo e9042fb403 Merge pull request 'test(e2e): nerve sense schema (closes #158)' (#168) from test/158-sense-schema into main 2026-04-27 07:05:04 +00:00
xiaoju c45a2f36d2 test(cli): add e2e test for workflow runs / inspect / thread
Start real daemon with echo workflow, trigger runs, verify:
- thread list shows active runs
- thread list --all includes completed runs
- thread inspect shows log entries
- thread show displays conversation output

Extends e2e-harness with workflow support (echo workflow config).

Fixes #160
2026-04-27 07:05:04 +00:00
xiaonuo 6076a1e5a4 Merge pull request 'test(e2e): nerve sense trigger (closes #157)' (#167) from test/157-sense-trigger into main 2026-04-27 07:05:00 +00:00
xiaonuo 035682bcea Merge pull request 'test(e2e): nerve sense list (closes #155)' (#166) from test/155-sense-list into main 2026-04-27 07:04:56 +00:00
xiaomo 7703304ae5 Merge pull request 'test(cli): add e2e test for nerve sense query' (#165) from test/156-sense-query into main 2026-04-27 07:01:38 +00:00
xingyue 8caf9d681d fix: use delete process.env.HOME per review 2026-04-27 14:58:24 +08:00
xingyue cad51d306b fix: use vi.spyOn + delete process.env.HOME per review 2026-04-27 14:58:20 +08:00
xingyue c3a03b280d fix: add comment explaining process.exit mock pattern per review 2026-04-27 14:56:26 +08:00
xiaomo aa2e7a290f Merge pull request 'test(cli): e2e logs command (#161)' (#170) from test/161-logs into main 2026-04-27 06:54:43 +00:00
xiaomo 490dfd5157 Merge pull request 'test(cli): e2e validate & init (#162)' (#171) from test/162-validate-init into main 2026-04-27 06:54:37 +00:00
xiaomo 082b83adbd fix: use delete instead of assigning undefined to process.env.HOME 2026-04-27 06:54:16 +00:00
xingyue 2f908489e1 test(e2e): nerve sense schema — SQLite table structure + JSON output (closes #158) 2026-04-27 14:41:54 +08:00
xiaomo 9b027a44f6 test(cli): add e2e logs test (#161) 2026-04-27 06:41:13 +00:00
xiaomo 991089a228 test(cli): add e2e validate and init test (#162) 2026-04-27 06:41:12 +00:00
xiaomo 0ac38c6c83 test(cli): add e2e daemon lifecycle test (#159) 2026-04-27 06:41:11 +00:00
xingyue a54cc703c9 test(e2e): nerve sense trigger — mock daemon IPC + CLI path (closes #157) 2026-04-27 14:40:22 +08:00
xingyue 4dde101515 test(e2e): nerve sense list — mock daemon IPC + full CLI path (closes #155) 2026-04-27 14:37:52 +08:00
xiaoju be8ee3cc2e test(cli): add e2e test for nerve sense query
Verifies sense query returns data after signal persistence:
- Default query returns rows (not 0 rows)
- Output contains payload columns
- --json flag returns valid JSON array with payload field
- --sql flag runs custom read-only SQL

Also adds --sql flag support to sense query CLI.

Fixes #156
2026-04-27 06:37:29 +00:00
xiaoju 44f20b3fb0 test(cli): add e2e smoke test for sense list + query
Verifies the full daemon → sense → signal → query pipeline works
end-to-end using a real kernel with a mock sense worker.

Refs #154
2026-04-27 06:23:36 +00:00
xiaomo a56dbadea2 Merge pull request 'feat(daemon): auto-persist signals to sense DB' (#150) from feat/auto-persist-signals into main 2026-04-27 05:33:29 +00:00
xiaoju 715cb8583f feat(daemon): auto-persist signals to sense DB
Every sense now gets a _signals table (id, payload, timestamp) created
automatically. When compute() returns non-null, the signal is persisted
to the sense's own SQLite DB before being sent to the Signal Bus.

This makes `nerve sense query <name>` return signal history out of the
box — no manual INSERT needed in compute functions.

CLI's pickDefaultPreviewTable now prioritizes _signals over other tables.
2026-04-27 05:29:56 +00:00
xingyue acdf244426 test(daemon): skip flaky file-watcher test (#149) 2026-04-27 12:03:42 +08:00
xingyue 62996d299b feat(cli): add nerve remote command for named daemon aliases
- Add remotes.ts with loadRemotes/saveRemotes/resolveRemote/getDefaultRemoteName
- Add remote command with add/list/show/set-url/set-token/remove/default subcommands
- Add --remote/-r global flag to cli-global.ts (priority: --host > --remote)
- Register remote command in cli.ts
- Add tests for remotes module
2026-04-27 10:03:27 +08:00
xingyue 81571b5349 refactor(cli): split workflow/thread into two top-level command groups (closes #145) 2026-04-27 09:44:54 +08:00
xingyue 624da3d3d7 refactor(cli): remove top-level start/stop/status/logs aliases
These commands are now only accessible via 'nerve daemon start|stop|status|logs'.
2026-04-27 09:02:40 +08:00
xiaomo df71c84eb4 Merge pull request 'fix(cli): repair 5 failing sense-list tests' (#142) from fix/141-sense-list-tests into main 2026-04-25 09:12:22 +00:00
xiaoju bb271e832a fix(cli): repair 5 failing sense-list tests
Mock senseTriggerLabels and isSenseInfo from @uncaged/nerve-core
to match current exports. All 22 tests pass.

Fixes #141

小橘 <xiaoju@shazhou.work>
2026-04-25 09:10:57 +00:00