arkgate 2.3.0 → 2.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 (39) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +26 -16
  3. package/SECURITY.md +9 -8
  4. package/bin/ark-check.mjs +599 -53
  5. package/bin/ark-shared.mjs +53 -0
  6. package/bin/ark.mjs +20 -5
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/nestjs/index.cjs +1 -1
  14. package/dist/nestjs/index.cjs.map +1 -1
  15. package/dist/nestjs/index.js +1 -1
  16. package/dist/nestjs/index.js.map +1 -1
  17. package/docs/agent-guide.md +11 -5
  18. package/docs/ai-gates.md +11 -7
  19. package/docs/brownfield-adoption.md +14 -13
  20. package/docs/demos/03-copilot-autopilot.md +5 -3
  21. package/docs/enthusiast/README.md +4 -3
  22. package/docs/enthusiast/how-to-agent-gates.md +14 -6
  23. package/docs/enthusiast/reference-commands.md +23 -8
  24. package/docs/migrate-from-ark-runtime-kernel.md +18 -0
  25. package/docs/typescript-support.md +142 -0
  26. package/package.json +12 -3
  27. package/server.json +2 -2
  28. package/templates/skills/ark-autopilot.md +6 -4
  29. package/templates/skills/ark-explain.md +7 -2
  30. package/templates/skills/ark-fix.md +16 -12
  31. package/templates/skills/ark-loop.md +14 -4
  32. package/templates/skills/ark-upgrade.md +26 -1
  33. package/templates/tests/ark-adoption-gaps.test.ts +68 -0
  34. package/tests/fixtures/ts-consumer/ark.config.json +11 -0
  35. package/tests/fixtures/ts-consumer/src/app/types.ts +1 -0
  36. package/tests/fixtures/ts-consumer/src/domain/bad.ts +1 -0
  37. package/tests/fixtures/ts-consumer/src/domain/ok.ts +1 -0
  38. package/tests/fixtures/ts-consumer/src/domain/user.ts +1 -0
  39. package/tests/fixtures/ts-consumer/tsconfig.json +16 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,50 @@
2
2
 
3
3
  All notable changes to ArkGate (`arkgate`; formerly `ark-runtime-kernel`) are documented here.
4
4
 
5
+ ## 2.4.0 — 2026-07-08
6
+
7
+ ### Added — Adoption completeness (P0–P2)
8
+
9
+ - **`collectAdoptionGaps`** shared classifier: incomplete agent hosts (detected dirs
10
+ without skills/hooks), dual-bin MCP argv, Codex home temp/wrong root, core layers
11
+ still `optional` while populated, missing origin report, baseline policy signal.
12
+ - **`--doctor` / `--doctor --json`**: Adoption section + `doctor.adoption` JSON (separate
13
+ from fitness score); fix commands on each gap.
14
+ - **Codex home fail-closed:** `wireCodexMcp` rewrites temp/`ark-upgrade` roots and stale
15
+ bins to absolute project root + single `arkgate-mcp` even without `--force`.
16
+ - **P1:** `ark start` / `ark init` nudge origin report + doctor; HTML report **Adoption**
17
+ card (hosts, MCP, origin, core optionality, baseline) distinct from score ring.
18
+ - **P2:** Educational presentation-heavy / thin-domain note in senior diagnostics;
19
+ `templates/tests/ark-adoption-gaps.test.ts` structural template for consumers.
20
+
21
+ ### Fixed — MCP dual-bin on upgrade
22
+
23
+ - **`--migrate-commands`** stripped only `ark-mcp` then re-prepended a bin while
24
+ `arkgate-mcp` could remain → `args: ["ark-mcp","arkgate-mcp",…]` broke stdio MCP.
25
+ Now strips **all** MCP bin aliases + runner noise and emits a single
26
+ **`arkgate-mcp`**. Fresh `.mcp.json` / hooks / Codex+Grok wiring use the preferred bin.
27
+ - Doctor warns when dual bins are detected; `/ark-upgrade` skill documents the check.
28
+
29
+ ### Added — TypeScript 5 / 6 / 7 compatibility bar
30
+
31
+ - **`usableTypescript` / load fallback** shared in `ark-shared.mjs`: reject modules
32
+ without classic JS host (`ts.sys` + AST + resolve). TypeScript **7.0.x** main export is
33
+ version-only — gate falls back to ArkGate’s nested **JS-API** `typescript@^5.9`
34
+ (production dependency) so teams can try project TS 7 without breaking the gate.
35
+ - **CI job `ts-compat`:** matrix `typescript@5.9.3` / `6.0.3` / `7.0.2` on
36
+ `tests/fixtures/ts-consumer` via `scripts/ts-compat-matrix.mjs`.
37
+ - **Docs:** [docs/typescript-support.md](docs/typescript-support.md) (supported ranges,
38
+ TS7 version-only entry, tsconfig 6→7, dual-install 6+7, `ARK_DEBUG_TS`).
39
+ - Optional peer `typescript: >=5 <8` (project compiler); runtime dependency pins JS-API host.
40
+
41
+ ### Docs & skills — full surface update for 2.4
42
+
43
+ - Skills (`/ark-loop`, `/ark-fix`, `/ark-autopilot`, `/ark-explain`, `/ark-upgrade`) document
44
+ all three `mechanical-safe` `remediationKind`s and TS7 fallback notes.
45
+ - README / CONTRIBUTING / SECURITY / enthusiast track: **ArkGate** branding, dual CLIs,
46
+ TS 5–7 badge; drop incorrect “zero dependencies” claim.
47
+ - Agent / AI-gates / brownfield / demos / migrate guide aligned with plan classifier + TS7.
48
+
5
49
  ## 2.3.0 — 2026-07-08
6
50
 
7
51
  ### Added — P0 complete (mechanical-safe depth + release-trust)
package/README.md CHANGED
@@ -11,7 +11,7 @@ trust — and makes sure a “green” check means something real.
11
11
  [![npm](https://img.shields.io/npm/v/arkgate?color=cb3837&label=npm)](https://www.npmjs.com/package/arkgate)
12
12
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
13
13
  ![Node](https://img.shields.io/badge/node-%3E%3D18-339933?logo=node.js)
14
- ![Zero deps](https://img.shields.io/badge/dependencies-0-success)
14
+ ![TS 5–7](https://img.shields.io/badge/TypeScript-5%20%7C%206%20%7C%207-3178c6?logo=typescript)
15
15
 
16
16
  </div>
17
17
 
@@ -53,8 +53,9 @@ plus tools agents can read *before* generating code (`ark_place`, `ark://manifes
53
53
 
54
54
  1. **A shape** — Ark looks at your repo (Nest, Next, API, library, …) and suggests how to organize it.
55
55
  2. **Guardrails** — config + agent gates + CI so new code can’t quietly break layers.
56
- 3. **A plan** — what’s safe for an agent to fix vs what needs your decision.
56
+ 3. **A plan** — what’s safe for an agent to fix vs what needs your decision (`mechanical-safe` vs judgment).
57
57
  4. **Honesty** — if Ark only governs 10% of the tree, it says so. “Clean” with almost no coverage is not success.
58
+ 5. **Adoption health** — `arkgate-check --doctor` checks co-pilot completeness (hosts, MCP argv, Codex home, core-layer optionality, origin report) **separately** from the 0–100 fitness score.
58
59
 
59
60
  Three **operating modes** (not “user types”) on the same contract:
60
61
 
@@ -121,7 +122,7 @@ npx arkgate-check --install-agent-gates
121
122
  | Skill | What it does |
122
123
  |-------|----------------|
123
124
  | **`/ark-autopilot`** | End-to-end co-pilot: setup → plan → safe auto-fixes → propose the rest → leave gates on |
124
- | **`/ark-loop`** | Drive the remediation plan in a discardable worktree; only `mechanical-safe` steps auto-apply |
125
+ | **`/ark-loop`** | Drive the plan in a worktree; auto-apply only `mechanical-safe` (type-only move, pure-type file relocate, `import type` of pure-type modules) |
125
126
  | **`/ark-architect`** | Greenfield: pick application shape, phase-1 layers, scaffold, verify honestly |
126
127
  | **`/ark-adopt`** | Brownfield: match contract to reality, raise coverage, freeze only real debt |
127
128
  | **`/ark-contract`** | Safely edit `ark.config.json` (smallest change, strict re-check) |
@@ -130,10 +131,12 @@ npx arkgate-check --install-agent-gates
130
131
  | **`/ark-explain`** | Explain the current contract, coverage, and report in plain language |
131
132
  | **`/ark-coverage`** | Audit which Ark capabilities you are not using yet |
132
133
  | **`/ark-runtime`** | Opt-in: migrate hand-rolled bus/outbox/sagas onto the runtime kernel |
133
- | **`/ark-upgrade`** | Bump the package and refresh gates + skills for every agent host |
134
+ | **`/ark-upgrade`** | Bump the package and refresh gates + skills for every agent host (also normalizes MCP bins + Codex home) |
134
135
 
135
136
  Supported agent hosts for full MCP/hook gates: **Claude Code**, **Cursor**, **OpenAI Codex**, **Grok Build**. Instruction-tier hosts (Windsurf, Cline, Copilot, …) get rule files. See [docs/ai-gates.md](docs/ai-gates.md).
136
137
 
138
+ After upgrade, run **`npx arkgate-check --doctor`**: it flags incomplete hosts, dual `ark-mcp`/`arkgate-mcp` args, Codex home pointing at a temp path, core layers still `optional` while populated, and a missing origin report.
139
+
137
140
  ---
138
141
 
139
142
  ## How it works (short)
@@ -141,39 +144,43 @@ Supported agent hosts for full MCP/hook gates: **Claude Code**, **Cursor**, **Op
141
144
  ```
142
145
  ark.config.json
143
146
 
144
- ├─► Write gate (ark-mcp) — agent PreToolUse / MCP tools
145
- ├─► CI gate (ark-check) — PR / main
146
- └─► Runtime kernel (opt-in) — only if you call it
147
+ ├─► Write gate (arkgate-mcp) — agent PreToolUse / MCP tools
148
+ ├─► CI gate (arkgate-check) — PR / main
149
+ └─► Runtime kernel (opt-in) — only if you call it
147
150
  ```
148
151
 
149
- - **Presets:** hexagonal, layered, feature-sliced, monorepo (all layers optional).
152
+ - **Presets:** hexagonal, layered, feature-sliced, monorepo (layers start optional; doctor suggests tightening populated cores).
150
153
  - **Frameworks:** Nest / Next / express / library layouts get sensible globs on init so day-one coverage is real.
151
154
  - **Brownfield:** baseline ratchet, refuse to freeze a wrong contract, `/ark-adopt` for mature trees.
152
- - **Agents:** skills above install into Claude / Cursor / Codex / Grok command locations.
155
+ - **Agents:** skills install into Claude / Cursor / Codex / Grok; `ark start` freezes an origin report under `.ark/reports/`.
156
+ - **TypeScript:** project compilers 5.x / 6.x / 7.x — gate falls back to a nested JS-API TypeScript when TS 7’s main export is version-only ([docs/typescript-support.md](docs/typescript-support.md)).
153
157
 
154
158
  ### Why not only ESLint / dependency-cruiser / Nx?
155
159
 
156
- | | Ark | Typical boundary linter |
160
+ | | ArkGate | Typical boundary linter |
157
161
  |--|:---:|:---:|
158
162
  | CI import rules | ✅ | ✅ |
159
163
  | Block **AI writes** before they land | ✅ | ❌ |
160
164
  | Contract agents can read (`ark://manifest`) | ✅ | ❌ |
161
165
  | Placement tools (`ark_place`, …) | ✅ | ❌ |
162
166
  | Honest governed % + adoption path | ✅ | ❌ |
163
- | Zero runtime dependencies | ✅ | varies |
167
+ | Classified plan (`mechanical-safe` / judgment) | ✅ | |
168
+ | TypeScript 5 / 6 / 7 project compilers | ✅ | varies |
169
+ | Adoption scorecard (hosts / MCP / origin) | ✅ | ❌ |
164
170
 
165
171
  ---
166
172
 
167
173
  ## Common commands
168
174
 
169
175
  ```bash
170
- npx arkgate start # guided setup + plan
171
- npx arkgate-check --doctor # health + operating mode
176
+ npx arkgate start # guided setup + plan + origin report
177
+ npx arkgate-check --doctor # health + Adoption gaps (not just fitness)
178
+ npx arkgate-check --doctor --json # machine-readable doctor.adoption
172
179
  npx arkgate-check --plan # safe-to-auto-fix vs your call
173
180
  npx arkgate-check --coverage # Governed: N%
174
- npx arkgate-check --report ark-report.html # showcase HTML + origin/latest snapshots
181
+ npx arkgate-check --report ark-report.html # showcase HTML + Adoption card + origin/latest
175
182
  npx arkgate-check --baseline # only NEW violations fail
176
- npx arkgate upgrade # update package + refresh gates/skills
183
+ npx arkgate upgrade # package + gates/skills + MCP/Codex normalize
177
184
  ```
178
185
 
179
186
  CI (example):
@@ -204,6 +211,8 @@ NestJS: `arkgate/nestjs` (optional peer `@nestjs/common`).
204
211
  |----------|------|
205
212
  | New builders (plain language) | [docs/enthusiast/](docs/enthusiast/README.md) |
206
213
  | Wire Claude / Cursor / Codex / Grok | [docs/ai-gates.md](docs/ai-gates.md) |
214
+ | **TypeScript 5 / 6 / 7 support** | [docs/typescript-support.md](docs/typescript-support.md) |
215
+ | Migrate from `ark-runtime-kernel` | [docs/migrate-from-ark-runtime-kernel.md](docs/migrate-from-ark-runtime-kernel.md) |
207
216
  | Messy existing repo | [docs/brownfield-adoption.md](docs/brownfield-adoption.md) |
208
217
  | Agent / MCP tools | [docs/agent-guide.md](docs/agent-guide.md) |
209
218
  | Demos | [docs/demos/](docs/demos/) |
@@ -223,7 +232,8 @@ npm run check:architecture # Ark gates itself
223
232
 
224
233
  **npm:** [`arkgate`](https://www.npmjs.com/package/arkgate) · formerly `ark-runtime-kernel`
225
234
  **Product:** **ArkGate** — architecture co-pilot / gate for AI TypeScript (not a runtime kernel).
226
- CLI: `arkgate` · `arkgate-check` · `arkgate-mcp` (aliases `ark` / `ark-check` / `ark-mcp` still work).
235
+ CLI: `arkgate` · `arkgate-check` · `arkgate-mcp` (aliases `ark` / `ark-check` / `ark-mcp` still work for one major).
236
+ MCP registry: `io.github.pedroknigge/arkgate`.
227
237
 
228
238
  Node ≥ 18 · **MIT**.
229
239
 
package/SECURITY.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Security Policy
2
2
 
3
- Ark runs in developer machines, CI, and agent tooling paths, so security reports are
4
- treated as high priority.
3
+ **ArkGate** (`arkgate`) runs on developer machines, in CI, and in agent tooling paths, so
4
+ security reports are treated as high priority.
5
5
 
6
6
  ## Supported Versions
7
7
 
@@ -17,20 +17,21 @@ Preferred path: use GitHub's private vulnerability reporting for this repository
17
17
  - affected version or commit
18
18
  - reproduction steps
19
19
  - expected impact
20
- - whether the issue affects `ark-check`, `ark-mcp`, generated agent gates, the GitHub
21
- Action, or the optional runtime kernel
20
+ - whether the issue affects `arkgate-check` / `ark-check`, `arkgate-mcp` / `ark-mcp`,
21
+ generated agent gates, the GitHub Action, or the optional runtime kernel
22
22
 
23
23
  If private vulnerability reporting is unavailable, open a minimal public issue asking for
24
24
  a private security contact without including exploit details.
25
25
 
26
26
  ## Release Verification
27
27
 
28
- Ark releases are GitHub-first:
28
+ ArkGate releases are GitHub-first:
29
29
 
30
30
  1. Changes land on GitHub and must pass CI plus the dedicated security workflow.
31
- 2. A GitHub Release is created from an annotated `vX.Y.Z` tag. Signed tags are
32
- supported and can be made mandatory by setting `ARK_REQUIRE_SIGNED_RELEASE_TAG=true`
33
- in the publish workflow once release signing is configured.
31
+ 2. A GitHub Release is created from an annotated `vX.Y.Z` tag. Tag verification is
32
+ **fail-closed** by default for unsigned tags unless
33
+ `ARK_ALLOW_UNSIGNED_RELEASE_TAG=true` is set (CI publish sets this until GPG signing is
34
+ wired). Signed tags can later require `ARK_REQUIRE_SIGNED_RELEASE_TAG=true`.
34
35
  3. The manual `Publish npm` workflow verifies the tag, requires the GitHub Release to
35
36
  exist, reruns release checks, publishes npm with provenance, and uploads a SHA-256
36
37
  checksum for the npm tarball to the GitHub Release.