novahiz 0.3.7 → 0.4.0

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 (150) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/NOTICE.md +12 -7
  3. package/README.md +400 -392
  4. package/adapters/README.md +2 -2
  5. package/adapters/opencode/agent/novahiz.md +1 -1
  6. package/adapters/opencode/instructions.md +1 -1
  7. package/adapters/opencode/novahiz-plugin.ts +1716 -0
  8. package/catalog/providers.json +40 -28
  9. package/catalog/rules.json +8 -4
  10. package/dist/classify.js +7 -1
  11. package/dist/cli.js +16 -8
  12. package/dist/commands/doctor.js +218 -93
  13. package/dist/commands/gate.js +37 -7
  14. package/dist/commands/graph.js +321 -0
  15. package/dist/commands/inspect.js +44 -7
  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 +27 -8
  20. package/dist/db.js +32 -6
  21. package/dist/exec.js +6 -2
  22. package/dist/gate-repair.js +6 -5
  23. package/dist/gate.js +24 -5
  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 +150 -26
  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 +30 -22
  50. package/install/bootstrap.mjs +63 -24
  51. package/install/install.mjs +592 -631
  52. package/install/lib.mjs +57 -11
  53. package/mcp/argus/IMPLEMENTATION-SUMMARY.md +122 -0
  54. package/mcp/argus/README.md +156 -0
  55. package/mcp/argus/package.json +25 -0
  56. package/mcp/argus/src/analysis/ruleEngine.mjs +330 -0
  57. package/mcp/argus/src/analysis/scanner.mjs +189 -0
  58. package/mcp/argus/src/cli.mjs +335 -0
  59. package/mcp/argus/src/commands/test.mjs +348 -0
  60. package/mcp/argus/src/config.mjs +31 -0
  61. package/mcp/argus/src/test/test_hardcoded.php +18 -0
  62. package/mcp/argus/src/test/test_injection.sh +16 -0
  63. package/mcp/argus/src/test/test_vulnerable.py +19 -0
  64. package/mcp/argus/src/test/test_xss.js +17 -0
  65. package/mcp/argus/src/tools/createRuleTool.mjs +75 -0
  66. package/mcp/argus/src/tools/exportResultsTool.mjs +213 -0
  67. package/mcp/argus/src/tools/listRulesTool.mjs +52 -0
  68. package/mcp/argus/src/tools/scanTool.mjs +74 -0
  69. package/mcp/argus/src/tools/tool.mjs +45 -0
  70. package/mcp/argus/src/tools/toolManager.mjs +57 -0
  71. package/mcp/argus/tmp/argus/argus-results-1791138636150.json +83 -0
  72. package/mcp/clepsydre/index.mjs +76 -0
  73. package/mcp/clepsydre/src/cron.ts +414 -0
  74. package/mcp/clepsydre/src/executors.ts +183 -0
  75. package/mcp/clepsydre/src/protocol.ts +125 -0
  76. package/mcp/clepsydre/src/scheduler.ts +330 -0
  77. package/mcp/clepsydre/src/store.ts +221 -0
  78. package/mcp/clepsydre/src/tools.ts +533 -0
  79. package/mcp/lodestone/index.mjs +61 -0
  80. package/mcp/lodestone/src/handle.ts +330 -0
  81. package/mcp/novahiz-docs/COMPARE.md +96 -0
  82. package/mcp/novahiz-docs/data/catalog.json +57 -0
  83. package/mcp/novahiz-docs/data/index.sqlite +0 -0
  84. package/mcp/novahiz-docs/index.mjs +53 -0
  85. package/mcp/novahiz-docs/src/catalog.ts +85 -0
  86. package/mcp/novahiz-docs/src/chunk.ts +266 -0
  87. package/mcp/novahiz-docs/src/ingest.ts +482 -0
  88. package/mcp/novahiz-docs/src/proto.ts +237 -0
  89. package/mcp/novahiz-docs/src/query.ts +199 -0
  90. package/mcp/novahiz-docs/src/resolve.ts +103 -0
  91. package/mcp/novahiz-docs/src/store.ts +225 -0
  92. package/mcp/novahiz-docs/tests/fixtures/query-client.md +46 -0
  93. package/mcp/novahiz-docs/tests/fixtures/react-state.md +37 -0
  94. package/mcp/novahiz-gate/README.md +30 -0
  95. package/mcp/novahiz-gate/index.mjs +322 -0
  96. package/mcp/novahiz-tools/README.md +26 -7
  97. package/mcp/novahiz-tools/index.mjs +688 -170
  98. package/novahiz.config.example.json +3 -3
  99. package/package.json +8 -6
  100. package/scripts/ci-local.mjs +71 -0
  101. package/skills/gate/SKILL.md +4 -4
  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/inspect.ts +46 -7
  115. package/src/commands/memory.ts +816 -0
  116. package/src/commands/second-memory.ts +1115 -0
  117. package/src/commands/snap.ts +378 -0
  118. package/src/commands/task.ts +24 -8
  119. package/src/db.ts +31 -6
  120. package/src/exec.ts +6 -2
  121. package/src/gate-repair.ts +6 -5
  122. package/src/gate.ts +24 -5
  123. package/src/git.ts +189 -0
  124. package/src/graph/extract.ts +1155 -0
  125. package/src/graph/lexer.ts +283 -0
  126. package/src/graph/query.ts +481 -0
  127. package/src/graph/resolve.ts +409 -0
  128. package/src/graph/store.ts +332 -0
  129. package/src/impeccable.ts +1 -1
  130. package/src/ledger.ts +169 -36
  131. package/src/memory-fts.ts +255 -0
  132. package/src/memory.ts +851 -52
  133. package/src/providers.ts +6 -3
  134. package/src/relevance.ts +63 -0
  135. package/src/search/query.ts +186 -0
  136. package/src/search/store.ts +425 -0
  137. package/src/search/tokenize.ts +105 -0
  138. package/src/snap.ts +759 -0
  139. package/src/spec.ts +105 -4
  140. package/adapters/claude/agent/novahiz.md +0 -23
  141. package/adapters/opencode/novahiz.ts +0 -895
  142. package/dist/commands/graft.js +0 -146
  143. package/dist/commands/hook.js +0 -204
  144. package/dist/graft.js +0 -257
  145. package/dist/hook.js +0 -176
  146. package/install/hooks.mjs +0 -171
  147. package/src/commands/graft.ts +0 -165
  148. package/src/commands/hook.ts +0 -238
  149. package/src/graft.ts +0 -254
  150. package/src/hook.ts +0 -203
package/CHANGELOG.md ADDED
@@ -0,0 +1,111 @@
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.0] - 2026-10-05
9
+
10
+ ### Added
11
+
12
+ - **Zero-friction install for the community** - `providers.autoInstall` now
13
+ defaults to `true` (the official skill packs impeccable, flutter, dart and
14
+ expo install with `novahiz-install`, so gate rule R14 never blocks a fresh
15
+ setup); Playwright MCP installs globally using the catalog pin instead of an
16
+ on-demand npx download; the postinstall dry-run prints the exact next step;
17
+ `files` ships `CHANGELOG.md` and `scripts/` so `npm run ci:local` works from
18
+ the published package. Version 0.4.0 (breaking renames: plugin
19
+ `novahiz-plugin.ts`, MCP `novahiz-<function>` ids).
20
+ - **clepsydre** - a local scheduling MCP server (`mcp/clepsydre`) written in
21
+ this repository with zero npm dependency: 5-field cron expressions plus
22
+ macros, `every Ns/Nm` intervals, one-shot ISO dates, IANA timezones, an
23
+ atomic JSON store with a JSONL execution journal, and 14 `clepsydre_*` tools
24
+ (CRUD, enable/disable, detached manual runs, history, schedule validation).
25
+ Both MCP protocol eras are supported (`initialize` legacy and the 2026-07-28
26
+ `server/discover` era). The stdio transport, protocol layer, parser,
27
+ scheduler, and executors are original code — no third-party scheduler code
28
+ is used or vendored.
29
+ - `clepsydre-mcp` bin entry in `package.json`; `mcp-clepsydre-probe` check in
30
+ `novahiz doctor --deep`.
31
+ - `novahiz-gate` — the rule gate extracted from the core server into its own
32
+ stdio MCP server (`mcp/novahiz-gate`, tool `novahiz_gate`, same `src/gate.ts`
33
+ core as the CLI), with `mcp-gate` and `mcp-gate-probe` checks in
34
+ `novahiz doctor` (the probe runs with `--deep`).
35
+
36
+ ### Changed
37
+
38
+ - Plugin file renamed to the same `novahiz-<function>` convention:
39
+ `adapters/opencode/novahiz.ts` → `novahiz-plugin.ts`, in the source tree and
40
+ in `~/.config/opencode/plugins/` (installer scripts, doctor `adapter` check,
41
+ tests, and docs follow).
42
+ - MCP server ids renamed to the `novahiz-<function>` convention:
43
+ `lodestone` → `novahiz-search`, `clepsydre` → `novahiz-scheduler`, `argus` →
44
+ `novahiz-scan`, `novahiz` → `novahiz-core`. Updated in
45
+ `catalog/providers.json`, `opencode.jsonc`, the installer templates, the
46
+ plugin fallback and the docs; tool names (`lodestone_*`, `clepsydre_*`,
47
+ `novahiz_*`) and file paths are unchanged.
48
+
49
+ - The external scheduler providers are replaced by the local `clepsydre`
50
+ server: `opencode.jsonc` now launches `node mcp/clepsydre/index.mjs`
51
+ instead of the former `mcp-cron` command, `catalog/providers.json` lists
52
+ `clepsydre` (local, Apache-2.0) in place of the `cron` venv-clone entry,
53
+ and the `cron_*` gate tools were renamed to their `clepsydre_*`
54
+ equivalents across `src/spec.ts`, `install/lib.mjs`, the adapter, the
55
+ configs, and `docs/CONFIGURATION.md`.
56
+ - `providers.disabled` defaults to `[]`: every bundled server now runs
57
+ locally with no setup step.
58
+
59
+ ### Removed
60
+
61
+ - The `cron` provider entry (third-party scheduler clone) and its
62
+ documentation. Replaced by `clepsydre`; no third-party scheduler
63
+ dependency remains. See `NOTICE.md` for provenance.
64
+ - The `security` provider (`security-mcp`) and every installation vector for
65
+ it: the entry is gone from `catalog/providers.json`, and `install.mjs` /
66
+ `bootstrap.mjs` keep an empty MCP install list while purging any trace of
67
+ `security-mcp` or `mcp-cron` (shim and global package) on every run — never
68
+ reinstall, per explicit user decision. `providers.disabled` in
69
+ `novahiz.config.json` keeps the id out of the registry; the `audit` category
70
+ stays served by `novahiz-scan`.
71
+
72
+ ### Fixed
73
+
74
+ - **Default-path skill packs installed again** - `providers.autoInstall` runs
75
+ `deps --install` on every fresh setup, which exposed a latent guard refusal:
76
+ `refused unsafe token: *` on the `--skill *` commands of flutter-skills and
77
+ dart-skills (expo and impeccable listed their skills explicitly and passed).
78
+ `SAFE_TOKEN` in `src/exec.ts` now admits `*` with the rationale on the spot:
79
+ cmd.exe does not glob and the POSIX branch spawns without a shell, so the
80
+ glob reaches the skills CLI, which expands it. Verified 4/4 `ok`.
81
+ - **Audit 2026-09-25 follow-up — every P0→P3 finding resolved in one batch.**
82
+ - **P0 (secret exposure)** — the Stitch API key left `opencode.jsonc`: the
83
+ header now references `{env:NOVAHIZ_STITCH_API_KEY}` and the value lives in
84
+ the user environment (never logged, never printed). Rotating the key in the
85
+ Google Cloud console is the one manual step remaining.
86
+ - **P1 (gate hardening)** — the CLI accepts `--tools` (the plugin passes its
87
+ frozen snapshot, so a live `gate.tools` edit cannot weaken enforcement
88
+ before the required restart) and `--prompt` (the last prompt seeds the
89
+ tier); it classifies the seed itself when `--categories` is empty instead
90
+ of evaluating unscoped, failing closed only when classification breaks.
91
+ The MCP gate follows: tool case normalized, DB-recorded skills unioned
92
+ like the CLI, warn/audit mode reports `wouldBlock` instead of blocking
93
+ silently, and only block mode fails closed on DB errors.
94
+ - **P2 (robustness)** — the plugin runner is async: a CLI/MCP call can no
95
+ longer freeze OpenCode's event loop for up to 30 s, and a deterministic
96
+ timeout flag replaced the status/signal heuristic. `novahiz-scan` joined
97
+ the hard-coded MCP fallbacks and every catalog server registers with a
98
+ structured 120 s timeout. `snap_restore` and `clepsydre_enable_task` joined
99
+ `gate.tools` across all six copies; R8 covers the docs tree,
100
+ README/CHANGELOG and docs-writing prompts; R13/R14 skip sub-200-char
101
+ touch-ups (`minChange: 200`; the doctor's operational probe now carries a
102
+ real CSS payload and asserts the trivial case stays allowed); classify's
103
+ lite tier only advertises skills the gate enforces; the inline gate-repair
104
+ text gained its step 3; `writeState` writes through a temp file + rename;
105
+ the dirty-path marker rejects cross-drive absolute paths; prompt text is
106
+ no longer logged (language + size only); doctor flags missing script
107
+ arguments (R1) and version-drifted installed copies (R6).
108
+ - **P3 (hygiene)** — purged 63 `*.novahiz-bak`/`*.pre-v2` files, the stale
109
+ `opencode.jsonc.bak`, and the dead `mcp-cron`/`security-mcp` global shims
110
+ (with two orphaned `mcp-cron` processes); repaired three memory slots
111
+ (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.