novahiz 0.3.8 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/NOTICE.md +12 -7
  3. package/README.md +417 -394
  4. package/adapters/README.md +2 -2
  5. package/adapters/opencode/agent/novahiz.md +1 -0
  6. package/adapters/opencode/instructions.md +1 -1
  7. package/adapters/opencode/novahiz-plugin.ts +1716 -0
  8. package/bin/novahiz.mjs +31 -1
  9. package/catalog/providers.json +40 -28
  10. package/catalog/rules.json +8 -4
  11. package/dist/classify.js +7 -1
  12. package/dist/cli.js +16 -8
  13. package/dist/commands/doctor.js +218 -93
  14. package/dist/commands/gate.js +37 -7
  15. package/dist/commands/graph.js +321 -0
  16. package/dist/commands/memory.js +774 -0
  17. package/dist/commands/second-memory.js +1070 -0
  18. package/dist/commands/snap.js +339 -0
  19. package/dist/commands/task.js +12 -6
  20. package/dist/db.js +27 -5
  21. package/dist/exec.js +6 -2
  22. package/dist/gate-repair.js +2 -1
  23. package/dist/gate.js +3 -3
  24. package/dist/git.js +152 -0
  25. package/dist/graph/extract.js +1149 -0
  26. package/dist/graph/lexer.js +257 -0
  27. package/dist/graph/query.js +338 -0
  28. package/dist/graph/resolve.js +330 -0
  29. package/dist/graph/store.js +279 -0
  30. package/dist/impeccable.js +1 -1
  31. package/dist/ledger.js +125 -20
  32. package/dist/memory-fts.js +219 -0
  33. package/dist/memory.js +750 -53
  34. package/dist/providers.js +6 -2
  35. package/dist/relevance.js +51 -0
  36. package/dist/search/query.js +141 -0
  37. package/dist/search/store.js +377 -0
  38. package/dist/search/tokenize.js +96 -0
  39. package/dist/snap.js +669 -0
  40. package/dist/spec.js +66 -4
  41. package/docs/ARCHITECTURE.md +6 -6
  42. package/docs/CATALOG.md +5 -5
  43. package/docs/CLI.md +75 -0
  44. package/docs/CONFIGURATION.md +5 -5
  45. package/docs/GRAPH.md +115 -0
  46. package/docs/HARNESSES.md +8 -25
  47. package/docs/INSTALL.md +8 -5
  48. package/docs/PLUGIN.md +47 -39
  49. package/docs/PROVIDERS.md +24 -18
  50. package/install/bootstrap.mjs +43 -20
  51. package/install/install.mjs +591 -630
  52. package/install/install.mjs.novahiz-bak +592 -0
  53. package/install/lib.mjs +20 -6
  54. package/mcp/argus/IMPLEMENTATION-SUMMARY.md +122 -0
  55. package/mcp/argus/README.md +156 -0
  56. package/mcp/argus/package.json +25 -0
  57. package/mcp/argus/src/analysis/ruleEngine.mjs +330 -0
  58. package/mcp/argus/src/analysis/scanner.mjs +189 -0
  59. package/mcp/argus/src/cli.mjs +335 -0
  60. package/mcp/argus/src/commands/test.mjs +348 -0
  61. package/mcp/argus/src/config.mjs +31 -0
  62. package/mcp/argus/src/test/test_hardcoded.php +18 -0
  63. package/mcp/argus/src/test/test_injection.sh +16 -0
  64. package/mcp/argus/src/test/test_vulnerable.py +19 -0
  65. package/mcp/argus/src/test/test_xss.js +17 -0
  66. package/mcp/argus/src/tools/createRuleTool.mjs +75 -0
  67. package/mcp/argus/src/tools/exportResultsTool.mjs +213 -0
  68. package/mcp/argus/src/tools/listRulesTool.mjs +52 -0
  69. package/mcp/argus/src/tools/scanTool.mjs +74 -0
  70. package/mcp/argus/src/tools/tool.mjs +45 -0
  71. package/mcp/argus/src/tools/toolManager.mjs +57 -0
  72. package/mcp/argus/tmp/argus/argus-results-1791138636150.json +83 -0
  73. package/mcp/clepsydre/index.mjs +76 -0
  74. package/mcp/clepsydre/src/cron.ts +414 -0
  75. package/mcp/clepsydre/src/executors.ts +183 -0
  76. package/mcp/clepsydre/src/protocol.ts +125 -0
  77. package/mcp/clepsydre/src/scheduler.ts +330 -0
  78. package/mcp/clepsydre/src/store.ts +221 -0
  79. package/mcp/clepsydre/src/tools.ts +533 -0
  80. package/mcp/lodestone/index.mjs +61 -0
  81. package/mcp/lodestone/src/handle.ts +330 -0
  82. package/mcp/novahiz-docs/COMPARE.md +96 -0
  83. package/mcp/novahiz-docs/data/catalog.json +57 -0
  84. package/mcp/novahiz-docs/data/index.sqlite +0 -0
  85. package/mcp/novahiz-docs/index.mjs +53 -0
  86. package/mcp/novahiz-docs/src/catalog.ts +85 -0
  87. package/mcp/novahiz-docs/src/chunk.ts +266 -0
  88. package/mcp/novahiz-docs/src/ingest.ts +482 -0
  89. package/mcp/novahiz-docs/src/proto.ts +237 -0
  90. package/mcp/novahiz-docs/src/query.ts +199 -0
  91. package/mcp/novahiz-docs/src/resolve.ts +103 -0
  92. package/mcp/novahiz-docs/src/store.ts +225 -0
  93. package/mcp/novahiz-docs/tests/fixtures/query-client.md +46 -0
  94. package/mcp/novahiz-docs/tests/fixtures/react-state.md +37 -0
  95. package/mcp/novahiz-gate/README.md +30 -0
  96. package/mcp/novahiz-gate/index.mjs +322 -0
  97. package/mcp/novahiz-tools/README.md +26 -7
  98. package/mcp/novahiz-tools/index.mjs +679 -170
  99. package/novahiz.config.example.json +3 -3
  100. package/package.json +9 -7
  101. package/scripts/ci-local.mjs +71 -0
  102. package/skills/novahiz-analyse/SKILL.md +1 -1
  103. package/skills/novahiz-delta-review/SKILL.md +1 -1
  104. package/skills/novahiz-gate/SKILL.md +1 -1
  105. package/skills/novahiz-implement/SKILL.md +18 -1
  106. package/skills/novahiz-memory/SKILL.md +6 -0
  107. package/skills/novahiz-second-memory/SKILL.md +355 -0
  108. package/skills/prompt-rewriter/SKILL.md +2 -2
  109. package/src/classify.ts +10 -1
  110. package/src/cli.ts +16 -8
  111. package/src/commands/doctor.ts +856 -736
  112. package/src/commands/gate.ts +36 -7
  113. package/src/commands/graph.ts +342 -0
  114. package/src/commands/memory.ts +816 -0
  115. package/src/commands/second-memory.ts +1115 -0
  116. package/src/commands/snap.ts +378 -0
  117. package/src/commands/task.ts +11 -6
  118. package/src/db.ts +26 -5
  119. package/src/exec.ts +6 -2
  120. package/src/gate-repair.ts +2 -1
  121. package/src/gate.ts +3 -3
  122. package/src/git.ts +189 -0
  123. package/src/graph/extract.ts +1155 -0
  124. package/src/graph/lexer.ts +283 -0
  125. package/src/graph/query.ts +481 -0
  126. package/src/graph/resolve.ts +409 -0
  127. package/src/graph/store.ts +332 -0
  128. package/src/impeccable.ts +1 -1
  129. package/src/ledger.ts +138 -27
  130. package/src/memory-fts.ts +255 -0
  131. package/src/memory.ts +851 -52
  132. package/src/providers.ts +6 -3
  133. package/src/relevance.ts +63 -0
  134. package/src/search/query.ts +186 -0
  135. package/src/search/store.ts +425 -0
  136. package/src/search/tokenize.ts +105 -0
  137. package/src/snap.ts +759 -0
  138. package/src/spec.ts +105 -4
  139. package/adapters/claude/agent/novahiz.md +0 -23
  140. package/adapters/opencode/novahiz.ts +0 -895
  141. package/dist/commands/graft.js +0 -150
  142. package/dist/commands/hook.js +0 -211
  143. package/dist/graft.js +0 -257
  144. package/dist/hook.js +0 -176
  145. package/install/hooks.mjs +0 -171
  146. package/src/commands/graft.ts +0 -169
  147. package/src/commands/hook.ts +0 -245
  148. package/src/graft.ts +0 -254
  149. package/src/hook.ts +0 -203
package/CHANGELOG.md ADDED
@@ -0,0 +1,140 @@
1
+ # Changelog
2
+
3
+ All notable changes to Novahiz are documented in this file.
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [0.4.1] - 2026-10-05
9
+
10
+ ### Fixed
11
+
12
+ - **`npm install -g novahiz` works on npm 11.16+**, where install scripts no
13
+ longer count as approved unless they appear in `allowScripts` and a global
14
+ install has no `package.json` to record that approval in — npm prints
15
+ `npm warn allow-scripts novahiz (...)` and, depending on the version, skips
16
+ the postinstall so nothing gets configured. The recommended command is
17
+ `npm install -g --allow-scripts=novahiz novahiz`;
18
+ `npm config set allow-scripts=novahiz --location=user` makes it permanent so
19
+ plain `npm install -g novahiz` works afterwards.
20
+ - **The published 0.4.0 tarball still carried the dry-run postinstall**
21
+ (`node install/install.mjs --dry-run`) — the `--yes` republish never reached
22
+ the registry, so even an allowed postinstall only printed the next step
23
+ instead of installing. 0.4.1 publishes `postinstall: node install/install.mjs
24
+ --yes`.
25
+ - **`novahiz` finishes the setup itself when npm skipped the postinstall**: the
26
+ first run of the CLI finds no `~/.config/novahiz/.novahiz-install.json`
27
+ manifest and executes `install/install.mjs --yes` once before the command
28
+ runs. `-v`, `--version`, `--help`, `-h` and `NOVAHIZ_AUTOINSTALL=0` skip the
29
+ bootstrap; a repo checkout (outside `node_modules`) is never touched.
30
+
31
+ ### Docs
32
+
33
+ - README quick start rewritten: the one-liner carries `--allow-scripts`, both
34
+ fallbacks are listed, and the `ENOENT: package.json` trap of running the flag
35
+ without a package name is called out.
36
+
37
+ ## [0.4.0] - 2026-10-05
38
+
39
+ ### Added
40
+
41
+ - **Zero-friction install for the community** - `providers.autoInstall` now
42
+ defaults to `true` (the official skill packs impeccable, flutter, dart and
43
+ expo install with `novahiz-install`, so gate rule R14 never blocks a fresh
44
+ setup); Playwright MCP installs globally using the catalog pin instead of an
45
+ on-demand npx download; the postinstall dry-run prints the exact next step;
46
+ `files` ships `CHANGELOG.md` and `scripts/` so `npm run ci:local` works from
47
+ the published package. Version 0.4.0 (breaking renames: plugin
48
+ `novahiz-plugin.ts`, MCP `novahiz-<function>` ids).
49
+ - **clepsydre** - a local scheduling MCP server (`mcp/clepsydre`) written in
50
+ this repository with zero npm dependency: 5-field cron expressions plus
51
+ macros, `every Ns/Nm` intervals, one-shot ISO dates, IANA timezones, an
52
+ atomic JSON store with a JSONL execution journal, and 14 `clepsydre_*` tools
53
+ (CRUD, enable/disable, detached manual runs, history, schedule validation).
54
+ Both MCP protocol eras are supported (`initialize` legacy and the 2026-07-28
55
+ `server/discover` era). The stdio transport, protocol layer, parser,
56
+ scheduler, and executors are original code — no third-party scheduler code
57
+ is used or vendored.
58
+ - `clepsydre-mcp` bin entry in `package.json`; `mcp-clepsydre-probe` check in
59
+ `novahiz doctor --deep`.
60
+ - `novahiz-gate` — the rule gate extracted from the core server into its own
61
+ stdio MCP server (`mcp/novahiz-gate`, tool `novahiz_gate`, same `src/gate.ts`
62
+ core as the CLI), with `mcp-gate` and `mcp-gate-probe` checks in
63
+ `novahiz doctor` (the probe runs with `--deep`).
64
+
65
+ ### Changed
66
+
67
+ - Plugin file renamed to the same `novahiz-<function>` convention:
68
+ `adapters/opencode/novahiz.ts` → `novahiz-plugin.ts`, in the source tree and
69
+ in `~/.config/opencode/plugins/` (installer scripts, doctor `adapter` check,
70
+ tests, and docs follow).
71
+ - MCP server ids renamed to the `novahiz-<function>` convention:
72
+ `lodestone` → `novahiz-search`, `clepsydre` → `novahiz-scheduler`, `argus` →
73
+ `novahiz-scan`, `novahiz` → `novahiz-core`. Updated in
74
+ `catalog/providers.json`, `opencode.jsonc`, the installer templates, the
75
+ plugin fallback and the docs; tool names (`lodestone_*`, `clepsydre_*`,
76
+ `novahiz_*`) and file paths are unchanged.
77
+
78
+ - The external scheduler providers are replaced by the local `clepsydre`
79
+ server: `opencode.jsonc` now launches `node mcp/clepsydre/index.mjs`
80
+ instead of the former `mcp-cron` command, `catalog/providers.json` lists
81
+ `clepsydre` (local, Apache-2.0) in place of the `cron` venv-clone entry,
82
+ and the `cron_*` gate tools were renamed to their `clepsydre_*`
83
+ equivalents across `src/spec.ts`, `install/lib.mjs`, the adapter, the
84
+ configs, and `docs/CONFIGURATION.md`.
85
+ - `providers.disabled` defaults to `[]`: every bundled server now runs
86
+ locally with no setup step.
87
+
88
+ ### Removed
89
+
90
+ - The `cron` provider entry (third-party scheduler clone) and its
91
+ documentation. Replaced by `clepsydre`; no third-party scheduler
92
+ dependency remains. See `NOTICE.md` for provenance.
93
+ - The `security` provider (`security-mcp`) and every installation vector for
94
+ it: the entry is gone from `catalog/providers.json`, and `install.mjs` /
95
+ `bootstrap.mjs` keep an empty MCP install list while purging any trace of
96
+ `security-mcp` or `mcp-cron` (shim and global package) on every run — never
97
+ reinstall, per explicit user decision. `providers.disabled` in
98
+ `novahiz.config.json` keeps the id out of the registry; the `audit` category
99
+ stays served by `novahiz-scan`.
100
+
101
+ ### Fixed
102
+
103
+ - **Default-path skill packs installed again** - `providers.autoInstall` runs
104
+ `deps --install` on every fresh setup, which exposed a latent guard refusal:
105
+ `refused unsafe token: *` on the `--skill *` commands of flutter-skills and
106
+ dart-skills (expo and impeccable listed their skills explicitly and passed).
107
+ `SAFE_TOKEN` in `src/exec.ts` now admits `*` with the rationale on the spot:
108
+ cmd.exe does not glob and the POSIX branch spawns without a shell, so the
109
+ glob reaches the skills CLI, which expands it. Verified 4/4 `ok`.
110
+ - **Audit 2026-09-25 follow-up — every P0→P3 finding resolved in one batch.**
111
+ - **P0 (secret exposure)** — the Stitch API key left `opencode.jsonc`: the
112
+ header now references `{env:NOVAHIZ_STITCH_API_KEY}` and the value lives in
113
+ the user environment (never logged, never printed). Rotating the key in the
114
+ Google Cloud console is the one manual step remaining.
115
+ - **P1 (gate hardening)** — the CLI accepts `--tools` (the plugin passes its
116
+ frozen snapshot, so a live `gate.tools` edit cannot weaken enforcement
117
+ before the required restart) and `--prompt` (the last prompt seeds the
118
+ tier); it classifies the seed itself when `--categories` is empty instead
119
+ of evaluating unscoped, failing closed only when classification breaks.
120
+ The MCP gate follows: tool case normalized, DB-recorded skills unioned
121
+ like the CLI, warn/audit mode reports `wouldBlock` instead of blocking
122
+ silently, and only block mode fails closed on DB errors.
123
+ - **P2 (robustness)** — the plugin runner is async: a CLI/MCP call can no
124
+ longer freeze OpenCode's event loop for up to 30 s, and a deterministic
125
+ timeout flag replaced the status/signal heuristic. `novahiz-scan` joined
126
+ the hard-coded MCP fallbacks and every catalog server registers with a
127
+ structured 120 s timeout. `snap_restore` and `clepsydre_enable_task` joined
128
+ `gate.tools` across all six copies; R8 covers the docs tree,
129
+ README/CHANGELOG and docs-writing prompts; R13/R14 skip sub-200-char
130
+ touch-ups (`minChange: 200`; the doctor's operational probe now carries a
131
+ real CSS payload and asserts the trivial case stays allowed); classify's
132
+ lite tier only advertises skills the gate enforces; the inline gate-repair
133
+ text gained its step 3; `writeState` writes through a temp file + rename;
134
+ the dirty-path marker rejects cross-drive absolute paths; prompt text is
135
+ no longer logged (language + size only); doctor flags missing script
136
+ arguments (R1) and version-drifted installed copies (R6).
137
+ - **P3 (hygiene)** — purged 63 `*.novahiz-bak`/`*.pre-v2` files, the stale
138
+ `opencode.jsonc.bak`, and the dead `mcp-cron`/`security-mcp` global shims
139
+ (with two orphaned `mcp-cron` processes); repaired three memory slots
140
+ (addendum heading, duplicated review block, comma-split tags).
package/NOTICE.md CHANGED
@@ -24,14 +24,19 @@ If you hold rights to a skill and want a different attribution or a removal, ope
24
24
 
25
25
  Providers are referenced by install command, never vendored. Each lists its upstream package, repository, and SPDX license in `catalog/providers.json`.
26
26
 
27
+ ### novahiz-scheduler (local scheduler)
28
+
29
+ `mcp/clepsydre` is written entirely in this repository: cron parser, persistence, scheduler, executors, tool layer, and MCP protocol layer are original code with zero npm dependency. No code, algorithm transcription, or copied text comes from the AGPL `mcp-cron` package (github.com/jolks/mcp-cron) or from any other third-party scheduler; both are referenced by name only, as replacements. The implementation was designed from the MCP specification and this project's own requirements, and is licensed Apache-2.0 like the rest of Novahiz.
30
+
27
31
  | Id | Upstream package | Repository | License |
28
32
  | --- | --- | --- | --- |
29
33
  | `playwright` | `@playwright/mcp` | https://github.com/microsoft/playwright-mcp | Apache-2.0 |
30
- | `security` | `security-mcp` | https://github.com/AbrahamOO/security-mcp | MIT |
31
- | `narsil` | `narsil-mcp` | https://github.com/postrv/narsil-mcp | MIT OR Apache-2.0 |
32
- | `context7` | `@upstash/context7-mcp` | https://github.com/upstash/context7 | MIT |
33
- | `cron` | `scheduler-mcp` (local venv clone) | https://github.com/PhialsBasement/scheduler-mcp | MIT |
34
- | `novahiz` | local Novahiz MCP | https://github.com/novahiz/novahiz | Apache-2.0 |
34
+ | `novahiz-search` | local Novahiz Search MCP (house, clean-room) | https://github.com/novahiz/novahiz | Apache-2.0 |
35
+ | `novahiz-docs` | local novahiz-docs MCP | https://github.com/novahiz/novahiz | Apache-2.0 |
36
+ | `novahiz-scheduler` | local Novahiz scheduler MCP (house, clean-room, zero npm dependency) | https://github.com/novahiz/novahiz | Apache-2.0 |
37
+ | `novahiz-core` | local Novahiz core MCP | https://github.com/novahiz/novahiz | Apache-2.0 |
38
+ | `novahiz-gate` | local Novahiz gate MCP | https://github.com/novahiz/novahiz | Apache-2.0 |
39
+ | `novahiz-scan` | local static-analysis MCP (house, clean-room) | https://github.com/novahiz/novahiz | MIT |
35
40
  | `dart` | Dart SDK (`dart mcp-server`) | https://github.com/dart-lang/ai (pkgs/dart_mcp_server) | BSD-3-Clause |
36
41
 
37
42
  ## Skill packs (upstream, not vendored)
@@ -54,8 +59,8 @@ Installed on demand with `npx skills add` (or an upstream tarball when git trans
54
59
  | `@mohak34/opencode-notifier` | https://github.com/mohak34/opencode-notifier | MIT | removed 2026-09-26 |
55
60
  | `@tarquinen/opencode-dcp` | https://github.com/Opencode-DCP/opencode-dynamic-context-pruning | AGPL-3.0-or-later | removed 2026-09-26 |
56
61
 
57
- The Novahiz adapter (`adapters/opencode/novahiz.ts`) is first-party under Apache-2.0.
62
+ The Novahiz adapter (`adapters/opencode/novahiz-plugin.ts`) is first-party under Apache-2.0.
58
63
 
59
64
  ## Dependencies
60
65
 
61
- The core and the MCP server use Node.js built-ins only. The opencode adapter imports only Node.js built-ins and the `@opencode-ai/plugin` types, which the harness provides.
66
+ The core and the MCP server use Node.js built-ins only. The opencode adapter imports only Node.js built-ins and the `@opencode/plugin` types, which the harness provides.