arkgate 3.6.1 → 3.8.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 (83) hide show
  1. package/CHANGELOG.md +122 -1145
  2. package/README.md +59 -19
  3. package/bin/ark-check-runtime.mjs +1598 -0
  4. package/bin/ark-check.mjs +32 -1565
  5. package/bin/ark-layer-match.mjs +2 -1
  6. package/bin/ark-mcp-runtime.mjs +1976 -0
  7. package/bin/ark-mcp.mjs +84 -1495
  8. package/bin/ark-shared.mjs +34 -38
  9. package/bin/ark.mjs +33 -66
  10. package/bin/lib/adapter-contract.mjs +161 -9
  11. package/bin/lib/agent-gates.mjs +1 -0
  12. package/bin/lib/analysis-completeness.mjs +28 -0
  13. package/bin/lib/analysis-engine.mjs +8 -8
  14. package/bin/lib/analysis-policy.mjs +27 -0
  15. package/bin/lib/architecture-scan.mjs +70 -304
  16. package/bin/lib/auto-patch.mjs +76 -8
  17. package/bin/lib/ci-and-commands.mjs +1 -1
  18. package/bin/lib/codex-home.mjs +43 -16
  19. package/bin/lib/design-delta.mjs +4 -0
  20. package/bin/lib/design-smells.mjs +67 -14
  21. package/bin/lib/doctor-advisories.mjs +23 -7
  22. package/bin/lib/doctor-plan.mjs +44 -47
  23. package/bin/lib/enforcement-state.mjs +2 -0
  24. package/bin/lib/github-enforcement.mjs +443 -0
  25. package/bin/lib/hook-templates.mjs +12 -148
  26. package/bin/lib/html-report-advisories.mjs +59 -0
  27. package/bin/lib/html-report-depth.mjs +9 -0
  28. package/bin/lib/html-report.mjs +5 -5
  29. package/bin/lib/install-migrate.mjs +83 -79
  30. package/bin/lib/managed-upgrade.mjs +622 -0
  31. package/bin/lib/mcp-adoption.mjs +3 -1
  32. package/bin/lib/parse-health.mjs +75 -0
  33. package/bin/lib/port-proof.mjs +2 -2
  34. package/bin/lib/prepare-change.mjs +68 -38
  35. package/bin/lib/prepare-write.mjs +7 -1
  36. package/bin/lib/reshape-decisions.mjs +284 -0
  37. package/bin/lib/resident-doctor-client.mjs +55 -0
  38. package/bin/lib/resident-hook.mjs +247 -0
  39. package/bin/lib/resolved-candidate-facts.mjs +1160 -0
  40. package/bin/lib/scan-files.mjs +19 -6
  41. package/bin/lib/snippet-analysis.mjs +119 -0
  42. package/bin/lib/source-policy.mjs +24 -0
  43. package/bin/lib/typescript-host.mjs +15 -18
  44. package/bin/lib/unavailable-analysis.mjs +76 -0
  45. package/bin/lib/upgrade-command.mjs +115 -0
  46. package/bin/lib/weakest-link.mjs +21 -179
  47. package/bin/lib/write-path-capabilities.mjs +167 -16
  48. package/bin/lib/write-path-detect.mjs +3 -2
  49. package/dist/eslint/index.cjs +3 -3
  50. package/dist/eslint/index.d.ts +3 -0
  51. package/dist/eslint/index.js +3 -3
  52. package/dist/index.cjs +7 -7
  53. package/dist/index.d.ts +1073 -141
  54. package/dist/index.js +7 -7
  55. package/docs/agent-guide.md +127 -52
  56. package/docs/ai-gates.md +100 -18
  57. package/docs/configuration.md +6 -0
  58. package/docs/demos/01-write-gate-self-correction.md +2 -2
  59. package/docs/enthusiast/README.md +10 -10
  60. package/docs/enthusiast/how-to-gallery-starter.md +2 -2
  61. package/docs/enthusiast/reference-commands.md +18 -1
  62. package/docs/enthusiast/tutorial-first-project.md +2 -2
  63. package/docs/package-surface.md +101 -14
  64. package/docs/typescript-support.md +118 -37
  65. package/package.json +33 -4
  66. package/schemas/ark.analysis-result.schema.json +159 -2
  67. package/schemas/ark.design-delta.schema.json +1 -0
  68. package/schemas/ark.enforcement-state.schema.json +84 -0
  69. package/schemas/ark.resolved-candidate-facts.schema.json +1 -0
  70. package/server.json +2 -2
  71. package/templates/skills/ark-autopilot.md +12 -0
  72. package/templates/skills/ark-explore.md +12 -5
  73. package/templates/skills/ark-fix.md +12 -2
  74. package/templates/skills/ark-loop.md +14 -1
  75. package/templates/skills/ark-runtime.md +15 -8
  76. package/templates/skills/ark-upgrade.md +122 -182
  77. package/bin/lib/ai-velocity.mjs +0 -293
  78. package/bin/lib/graph-cycles.mjs +0 -6
  79. package/bin/lib/safety-diagnostics.mjs +0 -284
  80. package/bin/lib/ts-resolve.mjs +0 -227
  81. package/dist/configTypes-DAPvBqK6.d.cts +0 -61
  82. package/dist/eslint/index.d.cts +0 -146
  83. package/dist/index.d.cts +0 -986
package/README.md CHANGED
@@ -16,9 +16,14 @@ and makes sure a “green” check means something real.
16
16
 
17
17
  </div>
18
18
 
19
- > **ArkGate 3.6.1** is current stable: Codex MCP configuration is project-scoped, doctor
20
- > recognizes the effective project binding, and stale agent worktrees no longer become
21
- > permanent global MCP owners. [Release notes](docs/releases/3.6.1.md).
19
+ > **ArkGate 3.8.0** is current stable: complete analysis fails closed, complete candidates share
20
+ > one resolved architecture verdict, managed upgrades are digest-bound, and an opt-in design-delta
21
+ > ratchet blocks new or worsened UI domain logic. [Release notes](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/3.8.0.md).
22
+
23
+ > **TypeScript 7 distribution note:** ArkGate prefers a usable project compiler API, then its
24
+ > exact, physically distinct TypeScript 6 analysis host. Analysis reports required
25
+ > `complete | partial | unavailable` status; incomplete results cannot look green. See the
26
+ > [exact boundary](docs/typescript-support.md).
22
27
 
23
28
  ---
24
29
 
@@ -42,7 +47,7 @@ If you remember nothing else:
42
47
  | **Messy / spaghetti code** (even if the gate is green) | **`/ark-explore`** then **`/ark-autopilot`** — [below](#less-spaghetti-after-the-gate-is-green) |
43
48
  | New ArkGate version | `/ark-upgrade` |
44
49
 
45
- **Everything else is optional.** You do not need to learn “modes”, 11 skills, or the runtime
50
+ **Everything else is optional.** You do not need to learn “modes”, the full skill pack, or the runtime
46
51
  kernel to get value. The compact router is enough for normal work; install `/ark-autopilot` only
47
52
  when you want the full guided workflow.
48
53
 
@@ -207,6 +212,11 @@ project file is written. With `--change-map map.json` (or MCP `changeMap`), the
207
212
  classifies planned structure as satisfied, missing, contradictory, or unplanned. This is structural
208
213
  convergence only: behavioral completion is always reported as not evaluated.
209
214
 
215
+ ArkGate 3.8.0 closes the former compiler-free atomic-path divergence with versioned
216
+ resolved-candidate facts and a differential adapter corpus, including `tsconfig` aliases and
217
+ workspace edges. Strict CI remains the final merge boundary; lexical/single-snippet feedback is
218
+ explicitly partial and non-green.
219
+
210
220
  Every blocking diagnostic carries stable rule/location/evidence fields plus one deterministic
211
221
  `nextAction`; human CLI/hook text prints that same action. A complete Codex `ApplyPatch` payload is
212
222
  reconstructed and sent through the same atomic engine before per-file safety checks. Codex remains
@@ -244,6 +254,8 @@ Brownfield phases: **Align** (honest contract) → **Stabilize** (real baseline)
244
254
  This table describes the supported profile **after its files are installed and the host loads/trusts them**. A hard local boundary covers only the listed hook operations; alternate tools, direct filesystem writes, and human edits still rely on CI. MCP validation is advisory because the agent must call it. The CI check blocks a merge only when the repository makes that status required. Repair payloads never write code silently: the host must re-inject the candidate and ArkGate revalidates it. Run `arkgate-check --doctor` for the evidence actually detected in the current repository.
245
255
  <!-- arkgate-host-support:end -->
246
256
 
257
+ Assets stay non-hard without fresh covered-operation evidence; MCP stays advisory.
258
+
247
259
  #### Why the hard guarantee lives at the merge gate
248
260
 
249
261
  The split above is a deliberate trade-off, not a gap. ArkGate validates at the earliest boundary
@@ -285,17 +297,34 @@ ark.config.json
285
297
  writes those exact bytes. Full skills remain explicit via `--install-agent-gates --skills-only`;
286
298
  reports remain opt-in via `ark-check --report`.
287
299
  - **Write protocol (2.10 / Track W):** mechanical-safe **autoPatch** on the write gate (`import type`); MCP **`ark_prepare_write`** (place + validate + patch + judgmentBrief); opt-in hook **`--hook-repair`** (`ARK_REPAIR_JSON`); doctor **`writePath`** (repair vs reject-only); loop-cost eval (`npm run eval:loop-cost`). Port-proof inject is **judgment** (arity change), not silent auto-apply.
288
- - **Enforcement ladder (Phase T):** doctor JSON exposes `writePath.enforcementLadder` with separate
289
- `supported`, `installed`, `active`, `bypassable`, evidence, operation coverage, and required-status
290
- honesty. Hook repair JSON carries the operation-scoped ladder; MCP alone remains advisory.
300
+ - **Enforcement state:** doctor JSON exposes schema-backed `writePath.enforcementState` with
301
+ separate analyzed, configured, installed, runtime-observed, operation-coverage, active,
302
+ bypassable, required, and hard evidence for local write, advisory MCP, and CI merge boundaries.
303
+ Provider-unavailable required status remains `unverified`; local workflow text never proves
304
+ branch protection. The older
305
+ `enforcementLadder` projection remains for compatibility.
306
+ - **Opt-in design delta (Z10):**
307
+ `--doctor --fail-on-new-smells --base-ref <ref>` blocks only new/worsened semantic
308
+ `domain-logic-in-ui`; historical/unrelated work stays green and missing bases fail closed.
291
309
  - **Fail-closed CI (2.11):** `--strict-merge` combines config coverage, shared gate-file
292
310
  presence, and bypass diagnostics for dynamic imports, TypeScript suppressions, explicit `any`
293
311
  casts, InMemory runtime defaults, and disabled peer isolation. `--strict` is a compatibility
294
312
  alias. Neither requires an editor hook; use `--require-write-hook claude|grok` when that local
295
313
  guarantee is part of the check.
314
+ - **Resolved analysis + completeness (3.8.0):** schema 1.3 identifies
315
+ `resolved-candidate-facts` versus `lexical-compatibility`, requires structured incompleteness
316
+ reasons, and exposes policy/resolver/facts/tree identities for resolved results. Single-file
317
+ lexical checks are explicitly `partial`/non-green; governed parse diagnostics also make plan
318
+ `goal.met: false` and normal JSON `valid:false`/`ok:false`. Strict merge exits `1`; a missing
319
+ host is `unavailable` and exits `2`.
296
320
  - **Release evidence:** independent 3.0 audit baseline plus signed-tag, GitHub Release, and
297
- provenance-backed npm publication; see the [3.1.0 release notes](docs/releases/3.1.0.md).
298
- - **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)).
321
+ provenance-backed npm publication; see the [3.1.0 release notes](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/3.1.0.md).
322
+ - **TypeScript:** 3.8.0 passed all 36 packed compatibility cells for project
323
+ compilers 5.9.3 / 6.0.3 / 7.0.2 across npm, pnpm, and Yarn. ArkGate prefers a usable project
324
+ API, then its exact `typescript-ark-host@6.0.3`; the project `tsc` remains project-owned.
325
+ Yarn uses strict PnP for TS5/6 and the `node-modules` linker for native TS7; that mode is explicit
326
+ in the report. See the exact boundary in
327
+ [docs/typescript-support.md](docs/typescript-support.md).
299
328
 
300
329
  ### Why not only ESLint / dependency-cruiser / Nx?
301
330
 
@@ -307,9 +336,10 @@ ark.config.json
307
336
  | Placement tools (`ark_place`, …) | ✅ | ❌ |
308
337
  | Honest governed % + adoption path | ✅ | ❌ |
309
338
  | Classified plan (`mechanical-safe` / judgment) | ✅ | ❌ |
310
- | TypeScript 5 / 6 / 7 project compilers | ✅ | varies |
339
+ | TypeScript 5.9 / 6.0 / 7.0 packed consumers | ✅ (3.8.0; 36/36 packed CI cells) | varies |
340
+ | Incomplete analysis can satisfy plan/result/strict merge | ❌ (`partial` / `unavailable` fail closed) | varies |
311
341
  | Adoption scorecard (hosts / MCP / origin) | ✅ | ❌ |
312
- | **Editor ESLint same layer contract as CI** | ✅ (`arkgate/eslint`) | varies |
342
+ | **Editor ESLint on-disk relative-import parity; resolved CI backstop** | ✅ (`arkgate/eslint`) | varies |
313
343
 
314
344
  ---
315
345
 
@@ -322,7 +352,8 @@ npx arkgate start --tools codex --apply # select the host explicitly
322
352
  npx arkgate start --install --apply # also add arkgate to package.json (explicit only)
323
353
  npx arkgate start --remove-host codex # preview compact-host removal; add --apply to confirm
324
354
  npx arkgate-check --doctor # health + Adoption gaps (not just fitness)
325
- npx arkgate-check --doctor --json # adoption + explicit writePath.enforcementLadder
355
+ npx arkgate-check --doctor --json # adoption + schema-backed writePath.enforcementState
356
+ npx arkgate-check --doctor --fail-on-new-smells --base-ref origin/main # opt-in design ratchet
326
357
  npx arkgate-check --strict # fail-closed CI + installed-gate/safety checks
327
358
  npx arkgate-check --plan # safe-to-auto-fix vs your call
328
359
  npx arkgate-check --coverage # Governed: N%
@@ -330,9 +361,15 @@ npx arkgate-check --report ark-report.html # showcase HTML (opens in browser on
330
361
  npx arkgate-check --baseline # only NEW violations fail
331
362
  npx arkgate preflight --changes changes.json --json # atomic read-only batch verdict
332
363
  npx arkgate preflight --changes changes.json --change-map map.json --json # intent hash + structural convergence
333
- npx arkgate upgrade # package + gates/skills + MCP/Codex normalize
364
+ npx arkgate upgrade --json # read-only managed-content preview + planDigest
365
+ npx arkgate upgrade --apply # update package, then re-preview with the new CLI
366
+ # run the emitted nextCommand to apply only that preview, including --plan-digest
334
367
  ```
335
368
 
369
+ Managed upgrade records content identities in `ark.managed.json`, preserves customized and
370
+ unrelated files, and requires explicit consent for recorded deletions or conflicts. It never
371
+ rewrites a Codex home or another global directory implicitly.
372
+
336
373
  CI (example):
337
374
 
338
375
  ```yaml
@@ -355,6 +392,9 @@ import { createStrictArkKernelFromConfig } from '@arkgate/runtime';
355
392
 
356
393
  The stable `arkgate` package does not bundle runtime implementation. The deprecated
357
394
  `arkgate/runtime` forwarding shim requires `@arkgate/runtime` and is removed in ArkGate 4.
395
+ The companion is not currently present in the npm registry and the root release workflow does
396
+ not publish it; the import above documents the intended boundary. Source-checkout evaluation
397
+ requires `npm run build:runtime` followed by installing the local `packages/runtime` folder.
358
398
 
359
399
  NestJS: `@arkgate/runtime/nestjs` (optional peer `@nestjs/common`).
360
400
 
@@ -374,16 +414,16 @@ for real systems. Details: [production-hardening.md](https://github.com/pedrokni
374
414
  |----------|------|
375
415
  | New builders (plain language) | [docs/enthusiast/](docs/enthusiast/README.md) |
376
416
  | **Package surface and configuration** | [package policy](docs/package-surface.md) · [contract](docs/configuration.md) |
377
- | Wire agents + **ESLint (CI-parity)** | [docs/ai-gates.md](docs/ai-gates.md) · [threat model](docs/threat-model.md) |
378
- | **TypeScript 5 / 6 / 7 support** | [docs/typescript-support.md](docs/typescript-support.md) |
417
+ | Wire agents + **ESLint (bounded parity)** | [docs/ai-gates.md](docs/ai-gates.md) · [threat model](docs/threat-model.md) |
418
+ | **TypeScript 5 / 6 / 7 support + analysis completeness** | [docs/typescript-support.md](docs/typescript-support.md) |
379
419
  | Migrate from `ark-runtime-kernel` | [docs/migrate-from-ark-runtime-kernel.md](https://github.com/pedroknigge/arkgate/blob/main/docs/migrate-from-ark-runtime-kernel.md) |
380
420
  | Messy existing repo | [docs/brownfield-adoption.md](docs/brownfield-adoption.md) |
381
421
  | Agent / MCP tools | [docs/agent-guide.md](docs/agent-guide.md) |
382
422
  | Security reporting | [SECURITY.md](SECURITY.md) |
383
- | Demos | [docs/demos/](docs/demos/) |
384
- | Examples | [examples/](examples/README.md) |
385
- | Latest release (3.6.1) | [release notes](docs/releases/3.6.1.md) · [3.0.0 baseline](docs/releases/3.0.0.md) |
386
- | Roadmap and decisions | [ROADMAP.md](ROADMAP.md) · [ADRs](docs/adr/) · [Changelog](CHANGELOG.md) |
423
+ | Demos | [docs/demos/](https://github.com/pedroknigge/arkgate/tree/main/docs/demos) |
424
+ | Examples | [examples/](https://github.com/pedroknigge/arkgate/blob/main/examples/README.md) |
425
+ | Latest release (3.8.0) | [release notes](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/3.8.0.md) · [3.0.0 baseline](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/3.0.0.md) |
426
+ | Roadmap and decisions | [ROADMAP.md](https://github.com/pedroknigge/arkgate/blob/main/ROADMAP.md) · [ADRs](https://github.com/pedroknigge/arkgate/tree/main/docs/adr) · [Changelog](CHANGELOG.md) |
387
427
 
388
428
  ---
389
429