arkgate 2.3.0 → 2.5.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 (45) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +28 -17
  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/eslint/index.cjs +258 -23
  8. package/dist/eslint/index.cjs.map +1 -1
  9. package/dist/eslint/index.d.cts +38 -1
  10. package/dist/eslint/index.d.ts +38 -1
  11. package/dist/eslint/index.js +240 -22
  12. package/dist/eslint/index.js.map +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/nestjs/index.cjs +1 -1
  20. package/dist/nestjs/index.cjs.map +1 -1
  21. package/dist/nestjs/index.js +1 -1
  22. package/dist/nestjs/index.js.map +1 -1
  23. package/docs/agent-guide.md +15 -8
  24. package/docs/ai-gates.md +26 -36
  25. package/docs/brownfield-adoption.md +14 -13
  26. package/docs/demos/03-copilot-autopilot.md +5 -3
  27. package/docs/enthusiast/README.md +4 -3
  28. package/docs/enthusiast/how-to-agent-gates.md +14 -6
  29. package/docs/enthusiast/reference-commands.md +23 -8
  30. package/docs/migrate-from-ark-runtime-kernel.md +18 -0
  31. package/docs/typescript-support.md +142 -0
  32. package/package.json +12 -3
  33. package/server.json +2 -2
  34. package/templates/skills/ark-autopilot.md +6 -4
  35. package/templates/skills/ark-explain.md +7 -2
  36. package/templates/skills/ark-fix.md +16 -12
  37. package/templates/skills/ark-loop.md +14 -4
  38. package/templates/skills/ark-upgrade.md +26 -1
  39. package/templates/tests/ark-adoption-gaps.test.ts +68 -0
  40. package/tests/fixtures/ts-consumer/ark.config.json +11 -0
  41. package/tests/fixtures/ts-consumer/src/app/types.ts +1 -0
  42. package/tests/fixtures/ts-consumer/src/domain/bad.ts +1 -0
  43. package/tests/fixtures/ts-consumer/src/domain/ok.ts +1 -0
  44. package/tests/fixtures/ts-consumer/src/domain/user.ts +1 -0
  45. package/tests/fixtures/ts-consumer/tsconfig.json +16 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,70 @@
2
2
 
3
3
  All notable changes to ArkGate (`arkgate`; formerly `ark-runtime-kernel`) are documented here.
4
4
 
5
+ ## 2.5.0 — 2026-07-09
6
+
7
+ ### Added — ESLint ↔ CI layer parity
8
+
9
+ - **`arkgate/eslint`** `no-domain-infra-imports` is **config-driven**: loads
10
+ `ark.config.json` (walk-up from the linted file), classifies layers with the same
11
+ glob specificity + `exclude` semantics as `arkgate-check`, and denies edges from
12
+ `rules[]` — not path-token “domain/infra” heuristics alone.
13
+ - Relative imports resolve to on-disk TS/JS targets; type-only and value imports both
14
+ fail when the edge is denied (same pass/fail as CI).
15
+ - **`no-forbidden-globals`** reads `forbiddenGlobals` from the matched layer in
16
+ `ark.config.json` (no invented defaults for layers without a purity list). Optional
17
+ rule option `globals` still overrides. Domain path heuristic + defaults only when
18
+ no config is found.
19
+ - Dual-driver tests: same fixtures → ESLint rule + `ark-check --json` agree.
20
+ - Recommended config enables `ark/no-forbidden-globals`.
21
+ - Without `ark.config.json`, legacy domain→infra path heuristic remains for bare trees.
22
+ - **ESLint 8–10 filename API:** rules read `physicalFilename` → `filename` → `getFilename()`
23
+ so config walk-up works on ESLint 10 (where `getFilename` was removed).
24
+
25
+ ## 2.4.0 — 2026-07-08
26
+
27
+ ### Added — Adoption completeness (P0–P2)
28
+
29
+ - **`collectAdoptionGaps`** shared classifier: incomplete agent hosts (detected dirs
30
+ without skills/hooks), dual-bin MCP argv, Codex home temp/wrong root, core layers
31
+ still `optional` while populated, missing origin report, baseline policy signal.
32
+ - **`--doctor` / `--doctor --json`**: Adoption section + `doctor.adoption` JSON (separate
33
+ from fitness score); fix commands on each gap.
34
+ - **Codex home fail-closed:** `wireCodexMcp` rewrites temp/`ark-upgrade` roots and stale
35
+ bins to absolute project root + single `arkgate-mcp` even without `--force`.
36
+ - **P1:** `ark start` / `ark init` nudge origin report + doctor; HTML report **Adoption**
37
+ card (hosts, MCP, origin, core optionality, baseline) distinct from score ring.
38
+ - **P2:** Educational presentation-heavy / thin-domain note in senior diagnostics;
39
+ `templates/tests/ark-adoption-gaps.test.ts` structural template for consumers.
40
+
41
+ ### Fixed — MCP dual-bin on upgrade
42
+
43
+ - **`--migrate-commands`** stripped only `ark-mcp` then re-prepended a bin while
44
+ `arkgate-mcp` could remain → `args: ["ark-mcp","arkgate-mcp",…]` broke stdio MCP.
45
+ Now strips **all** MCP bin aliases + runner noise and emits a single
46
+ **`arkgate-mcp`**. Fresh `.mcp.json` / hooks / Codex+Grok wiring use the preferred bin.
47
+ - Doctor warns when dual bins are detected; `/ark-upgrade` skill documents the check.
48
+
49
+ ### Added — TypeScript 5 / 6 / 7 compatibility bar
50
+
51
+ - **`usableTypescript` / load fallback** shared in `ark-shared.mjs`: reject modules
52
+ without classic JS host (`ts.sys` + AST + resolve). TypeScript **7.0.x** main export is
53
+ version-only — gate falls back to ArkGate’s nested **JS-API** `typescript@^5.9`
54
+ (production dependency) so teams can try project TS 7 without breaking the gate.
55
+ - **CI job `ts-compat`:** matrix `typescript@5.9.3` / `6.0.3` / `7.0.2` on
56
+ `tests/fixtures/ts-consumer` via `scripts/ts-compat-matrix.mjs`.
57
+ - **Docs:** [docs/typescript-support.md](docs/typescript-support.md) (supported ranges,
58
+ TS7 version-only entry, tsconfig 6→7, dual-install 6+7, `ARK_DEBUG_TS`).
59
+ - Optional peer `typescript: >=5 <8` (project compiler); runtime dependency pins JS-API host.
60
+
61
+ ### Docs & skills — full surface update for 2.4
62
+
63
+ - Skills (`/ark-loop`, `/ark-fix`, `/ark-autopilot`, `/ark-explain`, `/ark-upgrade`) document
64
+ all three `mechanical-safe` `remediationKind`s and TS7 fallback notes.
65
+ - README / CONTRIBUTING / SECURITY / enthusiast track: **ArkGate** branding, dual CLIs,
66
+ TS 5–7 badge; drop incorrect “zero dependencies” claim.
67
+ - Agent / AI-gates / brownfield / demos / migrate guide aligned with plan classifier + TS7.
68
+
5
69
  ## 2.3.0 — 2026-07-08
6
70
 
7
71
  ### 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,44 @@ 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) | ✅ | ❌ |
170
+ | **Editor ESLint same layer contract as CI** | ✅ (`arkgate/eslint`) | varies |
164
171
 
165
172
  ---
166
173
 
167
174
  ## Common commands
168
175
 
169
176
  ```bash
170
- npx arkgate start # guided setup + plan
171
- npx arkgate-check --doctor # health + operating mode
177
+ npx arkgate start # guided setup + plan + origin report
178
+ npx arkgate-check --doctor # health + Adoption gaps (not just fitness)
179
+ npx arkgate-check --doctor --json # machine-readable doctor.adoption
172
180
  npx arkgate-check --plan # safe-to-auto-fix vs your call
173
181
  npx arkgate-check --coverage # Governed: N%
174
- npx arkgate-check --report ark-report.html # showcase HTML + origin/latest snapshots
182
+ npx arkgate-check --report ark-report.html # showcase HTML + Adoption card + origin/latest
175
183
  npx arkgate-check --baseline # only NEW violations fail
176
- npx arkgate upgrade # update package + refresh gates/skills
184
+ npx arkgate upgrade # package + gates/skills + MCP/Codex normalize
177
185
  ```
178
186
 
179
187
  CI (example):
@@ -203,7 +211,9 @@ NestJS: `arkgate/nestjs` (optional peer `@nestjs/common`).
203
211
  | Audience | Link |
204
212
  |----------|------|
205
213
  | New builders (plain language) | [docs/enthusiast/](docs/enthusiast/README.md) |
206
- | Wire Claude / Cursor / Codex / Grok | [docs/ai-gates.md](docs/ai-gates.md) |
214
+ | Wire Claude / Cursor / Codex / Grok + **ESLint (CI-parity)** | [docs/ai-gates.md](docs/ai-gates.md) |
215
+ | **TypeScript 5 / 6 / 7 support** | [docs/typescript-support.md](docs/typescript-support.md) |
216
+ | Migrate from `ark-runtime-kernel` | [docs/migrate-from-ark-runtime-kernel.md](docs/migrate-from-ark-runtime-kernel.md) |
207
217
  | Messy existing repo | [docs/brownfield-adoption.md](docs/brownfield-adoption.md) |
208
218
  | Agent / MCP tools | [docs/agent-guide.md](docs/agent-guide.md) |
209
219
  | Demos | [docs/demos/](docs/demos/) |
@@ -223,7 +233,8 @@ npm run check:architecture # Ark gates itself
223
233
 
224
234
  **npm:** [`arkgate`](https://www.npmjs.com/package/arkgate) · formerly `ark-runtime-kernel`
225
235
  **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).
236
+ CLI: `arkgate` · `arkgate-check` · `arkgate-mcp` (aliases `ark` / `ark-check` / `ark-mcp` still work for one major).
237
+ MCP registry: `io.github.pedroknigge/arkgate`.
227
238
 
228
239
  Node ≥ 18 · **MIT**.
229
240
 
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.