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/CHANGELOG.md CHANGED
@@ -1,9 +1,113 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to ArkGate (`arkgate`; formerly `ark-runtime-kernel`) are documented here.
3
+ All notable changes to ArkGate (`arkgate`; formerly `ark-runtime-kernel`) are documented here or
4
+ in the immutable pre-2.0 archive linked below.
4
5
 
5
6
  ## Unreleased
6
7
 
8
+ ## 3.8.0 — 2026-07-21
9
+
10
+ This corrective minor makes complete analysis fail closed, restores one resolved architecture
11
+ verdict across parity-capable adapters, hardens clean install and managed upgrade flows, and adds
12
+ an opt-in base-relative design-delta gate. **No required config migration.** Retained adoption and
13
+ independent close remain open under Z09, so this release does not claim Phase Z completion.
14
+
15
+ ### Added
16
+
17
+ - **Z10:** add the opt-in base/candidate `domain-logic-in-ui` ratchet with hook/MCP/CLI parity and
18
+ fail-closed bases. Enforcement-state `1.1` adds runtime/operation proof for `hard`; assets and MCP
19
+ alone remain non-hard.
20
+ - **Analysis completeness (Z02):** CLI, MCP, hook, and public schema/type envelopes now carry
21
+ required `complete | partial | unavailable` evidence. Incomplete analysis cannot satisfy a
22
+ remediation goal; governed parse diagnostics fail `--strict-merge`, and a missing analysis host
23
+ exits `2` instead of producing a clean-looking plan.
24
+ - **Resolved candidate facts (Z04):** the stable root API now exposes a versioned, serializable
25
+ facts contract plus `analyzeResolvedProject` and `preflightResolvedChange`. Tooling resolves one
26
+ complete virtual create/update/delete candidate; the pure Kernel and generated CLI bundle
27
+ evaluate the same policy, resolver, facts, and tree identities.
28
+ - **Differential adapter corpus (Z04):** API, generated bundle, atomic preflight, CLI, MCP,
29
+ complete-patch hook, final strict check, and ESLint within its bounded envelope are compared over
30
+ relative and configured paths, packages/workspaces, symlinks, supported import forms,
31
+ unresolved/parse evidence, exclusions, unclassified paths, and create/update/delete batches.
32
+ - **Managed-content upgrade (Z06):** `ark upgrade` is now a read-only identity preview. Package
33
+ update/re-preview and managed-file application are separate confirmations; the latter requires
34
+ the preview's SHA-256 `planDigest`. `ark.managed.json` distinguishes current, stale, missing,
35
+ customized, and conflicted assets without touching unrelated source, similar files, or global
36
+ Codex state. Recorded deletions/conflicts require explicit consent.
37
+ - **Enforcement-state contract (Z06):** doctor JSON publishes schema-backed
38
+ `writePath.enforcementState` plus stable public TypeScript types and schema subpaths. Local write,
39
+ advisory MCP, and CI merge boundaries independently report supported, analyzed, configured,
40
+ installed, active, bypassable, required, and structured evidence values.
41
+ - **Packed managed-upgrade matrix (Z06):** all 11 supported hosts install and execute one
42
+ checksum-verified candidate tarball through 132 fail-closed journey stages in CI.
43
+
44
+ ### Fixed
45
+
46
+ - **Packed TypeScript 7 analysis:** ArkGate now ships an exact, separately named TypeScript 6
47
+ JS-API host that package-manager deduplication cannot replace with TS7's version-only export.
48
+ The consumer's own TypeScript remains preferred when usable and its selected `tsc` is unchanged.
49
+ Packed Yarn cells record strict PnP for TS5/6 and the normal `node-modules` linker for native TS7.
50
+ - **One architecture verdict:** complete-candidate CLI/MCP/hook paths now consume resolved facts
51
+ instead of a compiler-free relative-only graph. A contract-allowed same-layer edge is no longer
52
+ rejected by AICodeGate's former path heuristic. Retained lexical/single-snippet compatibility
53
+ paths report `partial` and non-green, while legacy pre-Z04 cache snapshots are ignored until the
54
+ identity-keyed Z07 warm path is proven.
55
+ - **Required-status honesty:** workflow text records CI configuration only. Required merge status
56
+ remains `unverified` without opt-in provider evidence, which is read from the repository's
57
+ default branch rather than the caller's current branch.
58
+
59
+ ### Changed
60
+
61
+ - The npm changelog retains complete 2.x/current-major notes and links pre-2.0 detail to the
62
+ immutable pre-Z06 canonical history, keeping the frozen package-size ceiling while preserving
63
+ later corrections to those historical notes.
64
+
65
+ ## 3.7.0 — 2026-07-17
66
+
67
+ Phase Y turns field feedback into explicit decision memory, more honest design/parse advisories,
68
+ safer skill-driven edits, and one confirmed purity-bypass closure. **No breaking** CLI, MCP tool,
69
+ analysis IR, or `ark.config.json` changes. **No product-policy gate weakening. No automatic
70
+ reshape or codemod.**
71
+
72
+ ### Added
73
+
74
+ - **Recorded reshape decisions (Y01):** `.ark/reshape-decisions.json` can explicitly accept,
75
+ defer, or reject a physical-cohesion pilot with a required reason and optional `reviewBy`.
76
+ Current deferred/rejected decisions suppress only repeated pilot pressure; the underlying
77
+ facts remain visible. Stale, expired, malformed, duplicate, or oversized records suppress
78
+ nothing, and doctor/HTML surfaces render the lifecycle.
79
+ - **Hollow-persistence advisory (Y02):** the existing `handler-in-persistence` smell now sees
80
+ static framework HTTP imports/re-exports, route definitions, and handler shapes inside
81
+ Persistence-role modules. It stays advisory and judgment-only, with a bounded and explicit
82
+ inspection envelope.
83
+ - **Parse-health honesty (Y03):** doctor JSON/human output and the HTML report expose governed
84
+ files with parser diagnostics through additive `parseHealth` totals and a deterministic,
85
+ overflow-aware file list. The existing AST is reused; the verdict and exit code are unchanged.
86
+ - **Exact `process` module dual (Y08):** `forbiddenGlobals: ["process"]` now owns exact value
87
+ imports of `process` and `node:process` across CLI cold/warm cache, pure IR, atomic preflight,
88
+ AICodeGate/MCP, and ESLint. It emits one `FORBIDDEN_GLOBAL` voice; type-only forms within the
89
+ documented TypeScript envelope, subpaths, and `child_process` remain excluded.
90
+
91
+ ### Changed
92
+
93
+ - **Mechanical-edit hygiene (Y04):** `ark-fix`, `ark-autopilot`, and `ark-loop` now require
94
+ injected headers to merge into an existing doc block, typed `defineRoute<…>` calls to retain
95
+ their generics/shape, and convention-only placeholder modules to remain uncreated. A
96
+ deterministic eval guards all three outcomes.
97
+ - **Cycle budgets (Y05):** package and Linux hook/doctor p95 ceilings were re-measured once from
98
+ clean 3.6.1 candidates with evidence-backed headroom, preserving fixed release guardrails.
99
+ - **Confidence budget:** Y08 adds multi-form ESLint regressions while the full-suite branch floor
100
+ is recalibrated from 85% to 84.5%; statement/function/line floors and mutation gates are
101
+ unchanged.
102
+
103
+ ### Fixed
104
+
105
+ - **Portable peer isolation:** slice identities are case-normalized, so mixed-case paths do not
106
+ produce a false cross-slice violation on case-insensitive filesystems. Repositories that differ
107
+ only by path case intentionally share the portable identity.
108
+ - **Convergence remediation direction:** an unplanned removed dependency now tells the user to
109
+ restore it; an unplanned added dependency still tells the user to remove it.
110
+
7
111
  ## 3.6.1 — 2026-07-17
8
112
 
9
113
  Codex project-scoped MCP fix. **No breaking** CLI, MCP tool, or `ark.config.json` changes.
@@ -156,13 +260,15 @@ changes. **No gate weaken.**
156
260
  globals (bare `process` covers `environment` too), surface-ownership dedup rule, and the
157
261
  W02 governance-weight reconciliation. Backed by a 25-case executable fixture corpus
158
262
  (`tests/fixtures/capability-corpus/`) with a content-aware structural guard.
159
- - **Effect capabilities in the canonical analysis (U03):** `collectCapabilityUses(ts, sourceFile)`
160
- composes the existing symbol-aware collectors (shadowing / type-only / `globalThis`-alias
161
- precision; no second scanner); the Domain vocabulary ships as
162
- `CAPABILITY_IDS` / `capabilityForModuleSpecifier` / `capabilityForAmbientName` /
163
- `lowerForbiddenGlobal`; the compiler-free IR engine now populates `ir.capabilityUses` with
164
- import-based evidence (exact module/subpath matching never substring; textual
165
- `import type` / `export type` erasure). Additive within IR `1.0`; evidence only.
263
+ - **Effect capabilities in the canonical analysis (U03):** the internal
264
+ `collectCapabilityUses(ts, sourceFile)` composes the existing symbol-aware collectors
265
+ (shadowing / type-only / `globalThis`-alias precision; no second scanner); the internal Domain
266
+ vocabulary is `CAPABILITY_IDS` / `capabilityForModuleSpecifier` /
267
+ `capabilityForAmbientName` / `lowerForbiddenGlobal`. These names were never root `arkgate`
268
+ exports. The supported public surface is `analyzeProject(...).ir.capabilityUses`, populated
269
+ with import-based evidence by the compiler-free IR engine (exact module/subpath matching
270
+ never substring; textual `import type` / `export type` erasure). Additive within IR `1.0`;
271
+ evidence only.
166
272
 
167
273
  ### Changed
168
274
 
@@ -171,7 +277,7 @@ changes. **No gate weaken.**
171
277
  `src/domain/configTypes.ts` — zero consumer import changes, byte-identical generated
172
278
  config artifacts, identical hashes and verdicts (verified by execution old-vs-new). ArkGate's
173
279
  own doctor now reports **zero design smells** on this repository.
174
- - The experimental `@arkgate/runtime` distribution is minified with `keepNames` (stable
280
+ - The experimental `@arkgate/runtime` built distribution artifact is minified with `keepNames` (stable
175
281
  class/function names for reflection and Nest diagnostics) and stays well inside its
176
282
  release-artifact budget.
177
283
 
@@ -1088,7 +1194,7 @@ Templates under `templates/skills/` (and project `.grok/skills` copies) for at l
1088
1194
  ### Documentation
1089
1195
 
1090
1196
  - **Migration guide** for the ~4.5k installs still on `ark-runtime-kernel`:
1091
- [docs/migrate-from-ark-runtime-kernel.md](docs/migrate-from-ark-runtime-kernel.md)
1197
+ [docs/migrate-from-ark-runtime-kernel.md](https://github.com/pedroknigge/arkgate/blob/main/docs/migrate-from-ark-runtime-kernel.md)
1092
1198
  + README section *Upgrading from ark-runtime-kernel?*
1093
1199
  - `/ark-upgrade` skill points rename-aware projects at `arkgate`.
1094
1200
 
@@ -1109,7 +1215,7 @@ Templates under `templates/skills/` (and project `.grok/skills` copies) for at l
1109
1215
 
1110
1216
  ### Migration
1111
1217
 
1112
- Full guide: [docs/migrate-from-ark-runtime-kernel.md](docs/migrate-from-ark-runtime-kernel.md).
1218
+ Full guide: [docs/migrate-from-ark-runtime-kernel.md](https://github.com/pedroknigge/arkgate/blob/main/docs/migrate-from-ark-runtime-kernel.md).
1113
1219
 
1114
1220
  ```bash
1115
1221
  npm uninstall ark-runtime-kernel && npm install -D arkgate
@@ -1204,1138 +1310,9 @@ are **retained** to avoid surprising consumers. Upgrade with `npx ark upgrade`.
1204
1310
  - The intermittent CI "onTaskUpdate" vitest flake is fixed (single-fork test run).
1205
1311
  - Field matrix harness (not shipped in the package): `../beta-field-test/run-matrix.mjs`.
1206
1312
 
1207
- ## 1.19.0 2026-07-08
1208
-
1209
- Co-pilot Phase H — the safe apply loop (the `loop` primitive).
1210
-
1211
- ### Added
1212
-
1213
- - **`/ark-loop` skill** — drives the remediation plan toward the goal, one step at a time, in a
1214
- discardable git worktree: auto-applies only the changes Ark classed `mechanical-safe`
1215
- (validating each with `ark-check` and rolling back any regression), PROPOSES the `judgment`
1216
- ones for a human decision, and never weakens the gate. Loops until the goal is met or a round
1217
- makes no progress, then reports what was auto-applied vs proposed vs deferred. Honors the
1218
- principle: the agent edits, Ark validates — code only, never DB/schema. Installed for every
1219
- detected agent CLI like the other `/ark-*` skills.
1220
- - **`goal.met`** in `ark-check --plan --json` — the loop's termination signal (true when there
1221
- are no active violations left). **Note (2.0.0):** `goal.met` was tightened to also require
1222
- meaningful governed coverage — see 2.0 field-hardening above.
1223
-
1224
- ## 1.18.0 — 2026-07-08
1225
-
1226
- Co-pilot Phase G — a guided front door for newcomers (`ark start`).
1227
-
1228
- ### Added
1229
-
1230
- - **`ark start`** — one guided command that takes a newcomer from "I have a project" to
1231
- "governed, with a plan," in plain language and without knowing any preset or skill name. It
1232
- looks at the repo and describes the shape in everyday terms, sets up the config + agent/CI
1233
- gates, and finishes with the classified plan (`safe to auto-fix` vs `your call`) plus plain
1234
- next steps. On an established codebase (≥150 files) it adopts your real structure via
1235
- detection instead of imposing a preset; on a fresh project it uses the recommended shape.
1236
- Interactive by default; `--yes` runs non-interactively. It only orchestrates existing steps
1237
- (recommend → init → `--plan`) and changes no source code. This is the co-pilot's guided-entry
1238
- and plain-language layer (Phase G).
1239
-
1240
- ## 1.17.0 — 2026-07-08
1241
-
1242
- Co-pilot Phase F — a classified remediation plan (the `plan` + `goal` primitives).
1243
-
1244
- ### Added
1245
-
1246
- - **`ark-check --plan [--json]`** — reads your active violations and sorts each into
1247
- `mechanical-safe` (behavior-preserving and gate-verifiable — safe for an agent to auto-apply),
1248
- `judgment` (real coupling or a design choice — Ark proposes, you decide), or `deferred`, with a
1249
- `confidence` and a plain-language `rationale`, ordered auto-first, wrapped in a `goal` block
1250
- (active violations → 0 without weakening the contract). Report-only — it changes no files.
1251
- This is the **plan** primitive of Ark's co-pilot; the coming worktree-safe apply-loop consumes
1252
- it. The classifier (`classifyRemediation`) is shared in `ark-shared.mjs` so the CLI, the MCP
1253
- gate, and the future loop classify identically. `--doctor` now points at it. The v1 classifier
1254
- is biased toward `judgment` — only a provably-safe type-only import move earns `mechanical-safe`.
1255
-
1256
- ## 1.16.0 — 2026-07-08
1257
-
1258
- One command to update Ark.
1259
-
1260
- ### Added
1261
-
1262
- - **`ark upgrade`** (alias **`ark update`**) — a single command that replaces the multi-step
1263
- update chain: bumps the package to `@latest` (via the detected package manager), refreshes
1264
- gate templates + `/ark-*` skills (and Codex home prompts when `~/.codex` exists), migrates
1265
- command runners to the project's package manager, and runs the strict architecture check.
1266
- `--no-install` refreshes gates/skills against the installed version; `--no-strict` skips the
1267
- final check. Each step reruns as a fresh process, so the refresh runs from the freshly
1268
- installed version. The `/ark-upgrade` skill and README now point at it.
1269
-
1270
- ## 1.15.1 — 2026-07-08
1271
-
1272
- Fix package-manager detection so a stray lockfile can't hijack a project's commands.
1273
-
1274
- ### Fixed
1275
-
1276
- - **A leftover `pnpm-lock.yaml` (or `yarn.lock`) no longer hijacks an npm project.** Detection
1277
- now honors the `package.json` `packageManager` field first, and on a lockfile conflict a
1278
- present `package-lock.json` wins — because `npx` runs fine in a pnpm/yarn repo, but
1279
- `pnpm exec` / `yarn` in an npm repo breaks (`ERR_PNPM_OUTDATED_LOCKFILE`,
1280
- `ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY`, a spurious pnpm lock). Previously any
1281
- `pnpm-lock.yaml` was preferred over `package-lock.json`, so `--migrate-commands` rewrote the
1282
- `check:architecture` script (and every emitted command) to `pnpm exec`, and `npm run
1283
- check:architecture` then failed. All emitted commands, the CI workflow, the install hints,
1284
- and the stale-runner advisory share the one detector.
1285
- - **Multiple-lockfile warning.** `--install-agent-gates` and `--migrate-commands` now say which
1286
- package manager they picked when more than one lockfile is present, and how to override it
1287
- (set `packageManager`, or remove the stray lockfile).
1288
-
1289
- ## 1.15.0 — 2026-07-08
1290
-
1291
- Brownfield install & onboarding hardening + layer `exclude` — from a real install session
1292
- on a mature repo.
1293
-
1294
- ### Changed
1295
-
1296
- - **No install lifecycle scripts.** Removed the `postinstall` banner (and `bin/ark-postinstall.mjs`).
1297
- It was a pure `console.log`, but its mere presence tripped pnpm's build-script approval gate;
1298
- in a hardened repo (blocked build scripts + `minimumReleaseAge`) that left `pnpm install` at
1299
- exit 1 and could take down a dev server. Ark now installs with zero prompts and never runs code
1300
- on install. The "run `ark init`" guidance lives in the README and npm page instead.
1301
- - **`ark init` / `ark-check --recommend` route mature repos to adoption.** On an established
1302
- codebase (≥150 source files) where a starter contract governs a thin slice, both now steer to
1303
- `ark-check --recommend --write-plan` + `/ark-adopt` — which align the contract to the repo's
1304
- real structure — instead of leaving a thin or false-red gate from aspirational DDD wildcards.
1305
-
1306
- ### Fixed
1307
-
1308
- - **`ark --help` / `ark -h` / `ark help`** now print usage and exit 0 (a flag in the command
1309
- position was reported as `Unknown command: --help`).
1310
- - **Generated CI** enables corepack **before** `actions/setup-node`, so `cache: pnpm|yarn` can
1311
- resolve the package manager on a fresh runner instead of failing.
1312
-
1313
- ### Added
1314
-
1315
- - **Layer `exclude` globs.** A layer may declare `exclude: [...]` to carve subtrees out of a
1316
- broad `patterns` glob. An excluded file is ungoverned by that layer — removed from its rules
1317
- and `forbiddenGlobals` too. Resolved in the single `layerForFile` matcher shared by the
1318
- ark-check CI gate and the ark-mcp write gate, so both classify identically. The wildcard
1319
- starter presets (hexagonal, layered) now ship `"exclude": ["**/kernel/**"]` on every layer,
1320
- so `src/**/domain/**` no longer mis-flags framework internals under `src/kernel/domain/`.
1321
- - **`"./package.json"` export** — tooling can read the installed version without an exports error.
1322
-
1323
- ## 1.14.0 — 2026-07-07
1324
-
1325
- Architect onboarding Phases A–E: enthusiast-first path from application shape to gated adoption.
1326
-
1327
- ### Added
1328
-
1329
- - **`templates/architecture-playbook.json`** — ten tool-agnostic application archetypes.
1330
- - **`ark-check --recommend`** (+ `--json`, **`--write-plan`** → `ark-adoption-plan.json`).
1331
- - **`ark init` enthusiast wizard** and **`ark init --archetype <id> --yes`**.
1332
- - **MCP `ark_recommend`**, skill **`/ark-architect`**, session-context enthusiast hint.
1333
- - **Terminal UX**: doctor "New here?", fix-class / `enthusiastHint`, `--watch`, `--report --beginner`.
1334
- - **Example gallery** (`examples/*-starter/`), comparative eval (30 prompts), nightly workflow, three public demo scripts.
1335
- - **Enthusiast policy packs** — `ark-check --list-policy-packs`, `--apply-policy-pack enthusiast-<preset>`.
1336
- - **Diátaxis enthusiast track** — `docs/enthusiast/`.
1337
-
1338
- ### Fixed
1339
-
1340
- - **`collectRepoShapeSignals`** — skip unreadable directories instead of crashing `--recommend`.
1341
- - **Policy pack ids** — reject path-like ids; only canonical `templates/policy-packs/` entries apply.
1342
-
1343
- ## 1.13.0 — 2026-07-06
1344
-
1345
- ### Added
1346
-
1347
- - **`ark-check --doctor`** — one consolidated adoption health view: governed %, ungoverned
1348
- directories, empty layers, weak rule coverage, the violation summary (value vs type-only +
1349
- concentration verdict), installed gates, installed skills, baseline health, and stale command
1350
- runners — each with the exact fix command, plus a ranked "Top actions" list. `--doctor --json`
1351
- for tooling.
1352
- - **Brownfield burn-down playbook** ([docs/brownfield-adoption.md](docs/brownfield-adoption.md))
1353
- — the end-to-end sequence for a large pre-existing codebase (diagnose → classify → facade
1354
- split → freeze only real debt → burn down), plus a matching `/ark-fix` fix class for
1355
- relocating raw infrastructure access (SQL or a DB client imported into a route) **verbatim**
1356
- into a repository/adapter — the value-import counterpart to the type-only inversion pattern.
1357
-
1358
- ### Changed
1359
-
1360
- - `/ark-upgrade` now handles the pnpm `minimumReleaseAge` cooling-off: when a freshly-cut
1361
- version is inside the window, add it to `minimumReleaseAgeExclude` before installing so a
1362
- loose-mode `pnpm add` can't leave a lockfile that `--frozen-lockfile` (CI) rejects.
1363
-
1364
- ## 1.12.0 — 2026-07-06
1365
-
1366
- Makes `ark.config.json` authoritative on BOTH gates, and closes the upgrade gap where the
1367
- package-manager-aware commands didn't reach a repo's existing gate files.
1368
-
1369
- ### Changed
1370
-
1371
- - **The AI write gate honors the contract over its infra heuristic.** A cross-layer import
1372
- that resolves to a declared layer is now judged by the config's layer RULES — exactly like
1373
- `ark-check` — so the write gate and CI can't disagree on a governed edge. An edge the
1374
- contract allows (a route calling a repository, a repository importing the DB) is no longer
1375
- blocked, and a denied edge is reported as `LAYER_IMPORT_VIOLATION`. The infrastructure
1376
- path-heuristic (and `mayImportInfrastructure`) now applies only to **ungoverned** targets —
1377
- external packages, or paths no declared layer covers. `ark-mcp` resolves the target layer
1378
- from the config's layer globs + tsconfig path aliases (a barrel import is classified by its
1379
- directory). Backward-compatible: with no resolver supplied, the gate's behavior is unchanged.
1380
-
1381
- ### Added
1382
-
1383
- - **`ark-check --install-agent-gates --migrate-commands`** — rewrites only the Ark command
1384
- runner (`npx` / `pnpm exec` / `yarn`) in existing gate files (`.claude/settings.json`,
1385
- `.mcp.json`, `AGENTS.md`, rule files, the `check:architecture` script) to match the
1386
- project's package manager, preserving every customization (no `--force` clobber). For repos
1387
- that adopted Ark before its emitted commands became package-manager-aware. A normal
1388
- `ark-check` now advises when a gate file's runner doesn't match the package manager, and
1389
- `/ark-upgrade` runs the migration as part of its refresh flow.
1390
-
1391
- ## 1.11.0 — 2026-07-06
1392
-
1393
- Sharpens Ark from "enforce a clean architecture" to **helping a team organize a messy,
1394
- pre-existing codebase — without presenting a false-green.** The tool now reports what it
1395
- actually governs, separates real debt from false positives, and guides the cleanup in order.
1396
-
1397
- ### Added
1398
-
1399
- - **Package-manager-aware commands.** Every command Ark emits — the AGENTS.md contract,
1400
- `.mcp.json`, the Claude/Codex hooks, the `check:architecture` script, the postinstall hints,
1401
- the "install TypeScript" hint — now follows the project's package manager
1402
- (`pnpm exec` / `yarn` / `npx`), not just the CI workflow. A pnpm/yarn repo is never handed
1403
- an `npx` instruction.
1404
- - **Honest coverage + layer proposals.** `ark-check --coverage` leads with `Governed: N%`,
1405
- warns loudly when Ark governs a minority of the tree, and proposes a canonical layer for
1406
- each ungoverned directory (harvested from the 11-layer profile and the named presets;
1407
- unrecognized directories are flagged, never guessed). `--init` prints the same proposals.
1408
- New additive `governed` and `suggestions` fields in `--coverage --json`.
1409
- - **Violation diagnosis.** `ark-check` groups violations by layer edge and target subtree,
1410
- ranked (the burn-down order), with a concentration verdict. New additive `summary` field in
1411
- the check `--json`.
1412
- - **Type-only vs value violations.** Each `LAYER_IMPORT_VIOLATION` is tagged `typeOnly`
1413
- (via the TypeScript AST); the summary splits `valueCount` (real runtime coupling) from
1414
- `typeOnlyCount` (type placement), so a burn-down attacks real coupling first.
1415
- - **`/ark-*` skills reoriented to organize** around the "protect the border around a
1416
- framework, not its internals" principle: the facade split (surface/internals + re-export
1417
- barrel) in `/ark-contract`, the type-only inversion pattern in `/ark-fix`, and honest
1418
- coverage in `/ark-coverage` and `/ark-explain`.
1419
-
1420
- ### Changed
1421
-
1422
- - **`--update-baseline` refuses a lopsided freeze.** When a single edge dominates the
1423
- violations (a likely contract bug, not debt), the freeze is refused with a diagnosis and a
1424
- pointer to the fix, unless `--force` is passed — so adoption can't bury a wrong contract as
1425
- frozen "debt".
1426
- - **Overlapping layer globs resolve by most-specific pattern**, not declaration order, so a
1427
- facade split (`kernel/app/**` as a public surface over a `kernel/**` catch-all) resolves
1428
- correctly regardless of layer order. A new `CONFIG_AMBIGUOUS_LAYERS` warning flags genuine
1429
- equal-specificity overlaps.
1430
-
1431
- ### Fixed
1432
-
1433
- - **Scan cache invalidates when the cached shape changes** (schema tag v1 → v2). A warm cache
1434
- written by an older Ark was reused by the new binary, so `typeOnly` reported false for every
1435
- violation after an upgrade until files changed; the cache now invalidates exactly once on
1436
- upgrade and re-populates.
1437
-
1438
- ## 1.10.1 — 2026-07-06
1439
-
1440
- ### Fixed — Codex MCP wiring
1441
-
1442
- - `ark-check --install-agent-gates` now auto-merges the `[mcp_servers.ark]` table into
1443
- Codex's `$CODEX_HOME/config.toml` (default `~/.codex/config.toml`) whenever Codex is a
1444
- target (`--tools codex` or `--codex-home`), so `ark://manifest` and the AI write gate are
1445
- live from the first edit. Previously Codex only received a copy-me sample at
1446
- `docs/ark-codex-config.toml` — unlike Claude and Cursor, which got machine-readable
1447
- registrations — so an agent that never hand-merged it fell back to the static
1448
- `ark.config.json` and the MCP server never started. The merge is idempotent (an existing
1449
- `ark` table is left untouched unless `--force` replaces it) and preserves other tables.
1450
- - The Codex `[mcp_servers.ark]` block now uses **absolute** `--root`/`--config` paths
1451
- (properly escaped for TOML). Because `config.toml` is a global file loaded without the
1452
- project as the working directory, a relative `--root .` would resolve against Codex's
1453
- launch directory — this also fixes projects whose path contains spaces. The install
1454
- output now states the required Codex restart and the expected result (`ark://manifest`
1455
- plus the `validate_code`, `ark_check`, `ark_coverage`, `ark_place` tools).
1456
-
1457
- ## 1.10.0 — 2026-07-06
1458
-
1459
- ### Added — GitHub-first release hardening
1460
-
1461
- - Added a manual `Publish npm` GitHub workflow that verifies a signed annotated
1462
- `vX.Y.Z` tag, requires the GitHub Release to exist first, runs the full release
1463
- verification suite, publishes to npm with provenance, and uploads the npm tarball
1464
- SHA-256 checksum back to the GitHub Release.
1465
- - Added `scripts/verify-release-tag.mjs` so release automation fails before npm when
1466
- the tag does not match `package.json` or is not annotated; signed-tag enforcement can
1467
- be enabled with `ARK_REQUIRE_SIGNED_RELEASE_TAG=true` once release signing is configured.
1468
- - Local `npm run release:npm` now defaults to dry-run/local verification. Real local
1469
- publish requires `--allow-local`; the normal release path is GitHub Actions provenance.
1470
-
1471
- ### Added — security scanning gates
1472
-
1473
- - Added a dedicated `Security` workflow with CodeQL, Dependabot dependency review on
1474
- pull requests, and Semgrep CE scanning on push, PR, schedule, and manual dispatch.
1475
- - Fixed the CodeQL alerts surfaced by that workflow: removed vulnerable built-in regex
1476
- heuristics from the AI write gate and replaced shell-interpolated pack test commands
1477
- with argument-vector process execution.
1478
-
1479
- ### Added — runtime profile from `ark.config.json`
1480
-
1481
- - Added `createArchitectureProfileFromArkConfig` plus `createArkKernelFromConfig`,
1482
- `createStrictArkKernelFromConfig`, and `createLenientArkKernelFromConfig` so runtime
1483
- observed layer-flow enforcement can use the same layer prefixes and rules as the
1484
- static architecture gate.
1485
- - `ArchitectureLayerConfig.intentPrefixes` is now optional in the public type, matching
1486
- real Ark configs where file-only layers do not participate in runtime intent naming.
1487
-
1488
- ### Changed — packaging polish
1489
-
1490
- - Repositioned package metadata and README around Ark as an AI architecture gate for
1491
- TypeScript, with the runtime presented as optional.
1492
- - Removed the CJS build warning for the ESLint subpath while preserving its existing
1493
- default and named exports.
1494
-
1495
- ## 1.9.1 — 2026-07-06
1496
-
1497
- ### Fixed — custom CI workflows count as installed gates
1498
-
1499
- - `ark-check --require-gates` no longer requires the generated workflow filename
1500
- `.github/workflows/ark-check.yml`. It now accepts any GitHub Actions workflow that
1501
- runs `ark-check` or the `check:architecture` npm script, so projects can keep their
1502
- existing `ci.yml` while still enforcing gate presence.
1503
-
1504
- ### Added — security policy and runtime audit gate
1505
-
1506
- - Added `SECURITY.md` with private vulnerability reporting guidance and release
1507
- verification notes.
1508
- - Added `npm run security:audit`, currently scoped to the published/runtime surface via
1509
- `npm audit --omit=dev --audit-level=high`, and wired it into CI.
1510
-
1511
- ### Changed — public roadmap and npm package contents
1512
-
1513
- - Reworked `ROADMAP.md` into a public `Now / Next / Later` roadmap focused on Ark as an
1514
- AI architecture gate for TypeScript.
1515
- - Narrowed the npm `files` list for docs so internal planning notes cannot be packed
1516
- accidentally, while explicitly including `SECURITY.md`.
1517
-
1518
- ## 1.9.0 — 2026-07-05
1519
-
1520
- ### Added — read-side MCP tools for AI agents
1521
-
1522
- The MCP server (`ark-mcp`) now exposes three read-side tools alongside `validate_code`,
1523
- so an agent can query the contract instead of shelling out and parsing:
1524
-
1525
- - **`ark_place`** — given a target file path, returns its layer, forbidden globals, and
1526
- which layers it may / must not import. Call it before writing a new file so generated
1527
- code lands in a governed location. Computed in-process from the contract.
1528
- - **`ark_check`** — the full architecture check as structured JSON (baseline-aware; a
1529
- `strict` argument toggles config-warning failures).
1530
- - **`ark_coverage`** — per-layer file counts, the full list of unclassified (ungoverned)
1531
- files, layers whose patterns match nothing, and layers with no rule edge.
1532
-
1533
- `ark_check` and `ark_coverage` reuse the canonical `ark-check` engine (no duplicated
1534
- logic). Tools appear in the agent's tool list automatically — no skill or doc-reading
1535
- needed. `/ark-place` and `/ark-coverage` skills now reference the tools (with a CLI fallback).
1536
-
1537
- ### Added — `ark-check --coverage`
1538
-
1539
- New report mode: per-layer matched-file counts plus the **full** unclassified-file list
1540
- (vs the 5-sample cap on the config warning), `emptyLayers` (patterns matching nothing),
1541
- and `layersWithoutRules`. Human-readable, or `--json`. Report-only — always exits 0.
1542
-
1543
- ### Added — monorepo-aware `ark init`
1544
-
1545
- `ark init` now auto-detects workspace monorepos (npm/yarn/bun `workspaces` and
1546
- `pnpm-workspace.yaml`) and writes a cross-package profile anchored at the real workspace
1547
- roots, instead of the `src/**` 11-layer starter that matches nothing in a monorepo. A
1548
- new `--preset monorepo` does the same explicitly; its layer patterns match by directory
1549
- name in any package (`**/domain/**`, …).
1550
-
1551
- ### Added — three more agent gates
1552
-
1553
- `--install-agent-gates` now knows **Roo Code** (`.roo/rules/ark.md`), **Continue**
1554
- (`.continue/rules/ark.md`), and **Gemini CLI** (`GEMINI.md`), auto-detected from their
1555
- config dirs — instruction-tier rule files derived from the same contract. `ark init`
1556
- gained a `--tools` passthrough, and gate installation now prints which tools it targeted
1557
- and why (detected / from --tools / default).
1558
-
1559
- ### Added — ESLint flat-config recipe
1560
-
1561
- `docs/ai-gates.md` now documents `ark.configs.recommended` plus a domain-scoped block for
1562
- `ark/no-forbidden-globals` (which `recommended` deliberately omits, since it needs
1563
- per-path scoping).
1564
-
1565
- ## 1.8.3 — 2026-07-05
1566
-
1567
- ### Fixed — Codex-home refresh guidance no longer clobbers customized gate files
1568
-
1569
- - 1.8.2's stale-skill advisory and the `/ark-upgrade` skill recommended
1570
- `--install-agent-gates --codex-home --force`. Without `--skills-only`, that `--force`
1571
- also rewrites customized gate files (AGENTS.md, CI workflow, settings, rules) — the exact
1572
- clobbering `--skills-only` exists to prevent. Both now recommend
1573
- `--install-agent-gates --skills-only --codex-home --force`, which refreshes the repo skills
1574
- and the Codex-home prompts while leaving customized gate files untouched. The flag behavior
1575
- is unchanged; only the recommended command (and skill guidance) is corrected.
1576
-
1577
- ## 1.8.2 — 2026-07-05
1578
-
1579
- ### Added — refresh `/ark-*` skills in the Codex home dir
1580
-
1581
- - Codex loads slash-command prompts from `$CODEX_HOME/prompts` (`~/.codex/prompts`), not the
1582
- repo, so a repo refresh never updated them and they silently drifted behind. New:
1583
- `ark-check --install-agent-gates --codex-home` writes the skills there directly (works even
1584
- when the repo has no `.codex/`), and a normal `ark-check` now flags stale/missing skills in
1585
- the Codex home dir by their `arkVersion` stamp — but only when copies already exist, so it
1586
- never introduces Codex to someone who doesn't use it. `--json` gains `codexHomeGap`.
1587
-
1588
- ### Improved — richer, clearer HTML report
1589
-
1590
- - `--report` was reworked: layers are ordered innermost → outermost with a **purpose** column
1591
- and per-layer tags; a readable **dependency-direction** view (what each layer may import)
1592
- sits above the precise matrix (now in a collapsible `<details>`); violations are grouped by
1593
- rule with a fix hint each; enforcement points name the file they found; and a stats band and
1594
- footer show layer/rule counts, gate coverage, the Ark version, and the config path.
1595
- - Layers accept an optional `"description"` in `ark.config.json`, surfaced as the report's
1596
- purpose column. The named presets seed sensible descriptions so `ark init --preset` produces
1597
- a self-documenting config.
1598
- - After writing a report, ark-check reminds you to add it to `.gitignore` (only when a
1599
- `.gitignore` exists and doesn't already list it) — it's a generated artifact.
1600
-
1601
- ### Docs — architectural security invariants
1602
-
1603
- - New README section on using layer rules + `forbiddenGlobals` to enforce security invariants
1604
- that are architectural (confining secret/env access, outbound network, and weak randomness to
1605
- the right layers) — without pretending to be a security scanner.
1606
-
1607
- ## 1.8.1 — 2026-07-05
1608
-
1609
- ### Changed — tighter `/ark-*` skill descriptions
1610
-
1611
- - The eight skill descriptions were trimmed (~30 → ~20 words each), leading with the
1612
- skill's key concept. Skill descriptions load into an agent's context budget; on
1613
- hosts with many installed skills the longer descriptions could push some skills out
1614
- of the model-visible list. Behavior is unchanged — only the frontmatter descriptions.
1615
- Refresh installed copies with `npx ark-check --install-agent-gates --skills-only --force`.
1616
-
1617
- ## 1.8.0 — 2026-07-05
1618
-
1619
- ### Added — circular dependency detection
1620
-
1621
- - `ark-check` now reports `CIRCULAR_DEPENDENCY`: files that transitively import each
1622
- other. The check runs over the import graph Ark already resolves, so it costs
1623
- almost nothing. One violation per cycle (anchored at the alphabetically-first
1624
- member, so the baseline key is stable), with a fix hint. Cycles participate in the
1625
- `--baseline` ratchet like every other rule and appear in the HTML report.
1626
-
1627
- ### Added — named architecture presets
1628
-
1629
- - `ark init --preset hexagonal|layered|feature-sliced` writes a canonical
1630
- `ark.config.json` for a known architecture instead of relying on directory
1631
- detection. Globs use `**` so they fit flat (`src/domain/**`) and modular
1632
- (`src/modules/x/domain/**`) layouts; every layer is `optional`, so the strict check
1633
- passes on a greenfield repo and each layer switches on as its directory gains files.
1634
- `hexagonal` inverts the domain→persistence dependency; `layered` is a relaxed n-tier
1635
- stack; `feature-sliced` is the FSD import ladder.
1636
-
1637
- ### Added — HTML architecture report
1638
-
1639
- - `ark-check --report [file.html]` writes a self-contained HTML report (no external
1640
- assets, works offline, light/dark): the layer map with a real example file per
1641
- layer, a who-may-import-whom matrix, current violations with fix hints, and which
1642
- gates are live. A shareable artifact for PRs and onboarding.
1643
-
1644
- ### Added — agent-behavior eval harness
1645
-
1646
- - `eval/` (dev-only, not shipped in the npm package): runs a live coding agent against
1647
- seeded architecture violations using Ark's own gate messages, and grades whether the
1648
- agent resolves the violation *without weakening the contract* (editing config,
1649
- baseline, CI, or deleting the feature counts as a failure). Run with
1650
- `npm run eval:agent`.
1651
-
1652
- ## 1.7.6 — 2026-07-05
1653
-
1654
- _From downstream consumer feedback after a real upgrade + CI-failure session._
1655
-
1656
- ### Changed — generated CI follows the project's Node version
1657
-
1658
- - The generated GitHub workflow hard-coded `node-version: 20`. If a developer's
1659
- local npm is newer than the npm that Node ships (e.g. Node 24 / npm 11), CI's
1660
- `npm ci` fails with "missing from lock file" — the lockfile was written by a
1661
- newer npm — a red CI unrelated to architecture that blocks the gate before
1662
- `ark-check` even runs. The workflow now picks the Node version in order:
1663
- `node-version-file: .nvmrc`/`.node-version` when the project pins one (CI locks
1664
- to the dev's exact toolchain), else the major from `package.json` `engines.node`,
1665
- else a current-LTS default (bumped `20` → `22`; defaulting high avoids the
1666
- "CI npm older than the lockfile" class). Survives regeneration like `--baseline`.
1667
-
1668
- ### Changed — CI steps are named so install failures read correctly
1669
-
1670
- - The generated workflow's steps were unnamed, so an `npm ci` failure surfaced
1671
- under the "Ark architecture gate" job with no clear cause — it looked like an
1672
- architecture violation when it was a dependency/lockfile problem. Steps are now
1673
- named (`Checkout`, `Setup Node`, `Install dependencies`, `Ark architecture
1674
- check`), so a red lands on `Install dependencies` and points at the real cause.
1675
-
1676
- ### Changed — `--install-agent-gates` says WHY a skill was skipped
1677
-
1678
- - A skipped skill printed a bare `skipped <path>`, indistinguishable from "up to
1679
- date". Skipped skills are now annotated `(up to date)` or `(stale: <old> <
1680
- <current>)`, and a trailing note gives the exact safe refresh command
1681
- (`--install-agent-gates --skills-only --force`) — so the user isn't left
1682
- guessing or reaching for a bare `--force` that would clobber customized gates.
1683
-
1684
- ## 1.7.5 — 2026-07-05
1685
-
1686
- ### Added — outdated-skill detection (version-stamped skills)
1687
-
1688
- - `--install-agent-gates` now stamps each installed `/ark-*` skill with an
1689
- `arkVersion:` line in its frontmatter. A normal `ark-check` run then flags
1690
- skills left behind by an older Ark (stamp behind the current version, or no
1691
- stamp at all) and points at the refresh command below — distinct from the
1692
- "not installed" notice, which uses a plain install. The stamp moves with the
1693
- package, so editing a skill's body does not make it look outdated; only a
1694
- version gap does. `--json` `skillGaps` entries now carry `{ tool, missing, stale }`.
1695
- - New `--skills-only` flag for `--install-agent-gates`: restricts the write to
1696
- just the canonical `/ark-*` skills, so `--install-agent-gates --skills-only
1697
- --force` refreshes skills to the current version WITHOUT overwriting a
1698
- customized `AGENTS.md`, `.claude/settings.json`, or CI workflow — which a bare
1699
- `--force` clobbers with the generic templates. The stale-skill notice and
1700
- `/ark-upgrade` now recommend this scoped command.
1701
-
1702
- ### Changed — /ark-contract verifies a file move before recommending it
1703
-
1704
- - `/ark-contract` could suggest moving a file to a more fitting layer (e.g. an
1705
- HTTP client into an integration layer) without checking that the file's own
1706
- imports are legal there. If the file also imports a layer the target may not
1707
- (a client that reads a persistence-layer cache, `Integration → Persistence`
1708
- denied), the "clean config change" actually breaks the contract. The skill now
1709
- resolves the file's imports against the target layer's rules first and, when
1710
- they don't fit, reports it as a refactor (split the file), not a config edit.
1711
-
1712
- ### Fixed — regenerating CI keeps `--baseline`
1713
-
1714
- - The generated GitHub workflow (and the `--require-gates` command it runs)
1715
- hard-coded `--strict-config --require-gates`. Re-running `--install-agent-gates
1716
- --force` on a project that had added `--baseline .ark-baseline.json` silently
1717
- dropped the flag, so CI would start failing on frozen violations instead of
1718
- ratcheting. The workflow now includes `--baseline .ark-baseline.json` whenever
1719
- the project has a baseline file, so regeneration preserves the ratchet.
1720
-
1721
- ## 1.7.4 — 2026-07-05
1722
-
1723
- ### Fixed — `include` accepts single files, not just directories
1724
-
1725
- - `ark-check` walked every `include` entry with `scandir`, so listing a
1726
- root-level source file (e.g. Next.js `middleware.ts`, `instrumentation.ts`)
1727
- crashed with `ENOTDIR: not a directory`. `walk()` now governs a file entry
1728
- directly (subject to the same source-extension filter) and still recurses into
1729
- directory entries. This makes `/ark-coverage`'s "govern middleware.ts"
1730
- recommendation actually applicable.
1731
-
1732
- ### Changed — skill polish
1733
-
1734
- - `/ark-coverage` now instructs reading files with the Read tool and targeted
1735
- commands instead of `cat`-ing whole configs to the terminal, so the audit run
1736
- stays readable.
1737
- - `/ark-place` and `/ark-contract` document their no-argument path: when invoked
1738
- with nothing to place / no change described, print the placement map or the
1739
- contract snapshot + evolution options (derived from the live config) and ask,
1740
- instead of erroring or guessing. Makes the helpful behavior guaranteed, not
1741
- emergent.
1742
-
1743
- ## 1.7.3 — 2026-07-05
1744
-
1745
- ### Fixed — /ark-upgrade now checks the registry, and the package ships its CHANGELOG
1746
-
1747
- - The `/ark-upgrade` skill only read the version already in `node_modules`, so a
1748
- repo with a pinned lockfile reported "no update available" while a newer
1749
- version was published. It now checks `npm view ark-runtime-kernel version`,
1750
- updates the dependency (`npm install -D …@latest` or the project's package
1751
- manager) so the lockfile moves too, and still refreshes gates/skills when
1752
- already on the latest (a prior version may have shipped skills the repo never
1753
- installed).
1754
- - `CHANGELOG.md` is now included in the published package (`files`). The
1755
- `/ark-upgrade` changelog-triage step referenced it, but it wasn't shipped, so
1756
- consumers had to `npm pack` and diff tarballs to see what changed. The skill
1757
- falls back to `npm view` / GitHub release notes if an older release is missing it.
1758
-
1759
- ## 1.7.2 — 2026-07-05
1760
-
1761
- ### Changed — blocked infra imports point at the exemption
1762
-
1763
- - When the write-gate blocks an infrastructure import and the file has a known
1764
- layer, the fix hint now names the escape hatch: mark the layer in
1765
- `ark.config.json` with `"mayImportInfrastructure": true` (or name it with an
1766
- infra token). Previously the message only said "remove the import", so a
1767
- legitimately-infra layer with an unconventional name looked like a hard block
1768
- and required reading internals to discover the exemption. Zero-config
1769
- projects (no layer context) keep the plain hint — the flag doesn't apply there.
1770
- - The PreToolUse hook (`ark-mcp --hook`) now prints the gate's fix hints under a
1771
- `fix:` block. It was building the block message from the rule id and message
1772
- only, silently dropping every `suggestion` — so the port/adapter guidance and
1773
- the new infra-layer escape hatch never reached the agent. Hints are deduped.
1774
-
1775
- ### Added — `ark-check` surfaces uninstalled skills
1776
-
1777
- - A normal `ark-check` run now advises when a project that has adopted Ark agent
1778
- gates (`AGENTS.md` present) is missing `/ark-*` skills this version ships for a
1779
- detected tool (`.claude/`, `.cursor/`, `.codex/`, `.windsurf/`, `.clinerules/`),
1780
- pointing at `--install-agent-gates`. The `--json` output gains a `skillGaps`
1781
- field. Rationale: the postinstall message was the only discovery path for new
1782
- skills, and modern npm blocks postinstall scripts by default — so the most
1783
- careful users (and CI) never saw it. `ark-check` runs everywhere, so the notice
1784
- now actually lands. Advisory only; never affects the exit code.
1785
-
1786
- ## 1.7.1 — 2026-07-05
1787
-
1788
- ### Fixed — write-gate infra heuristics now respect the layer's role
1789
-
1790
- - The AI write-gate's built-in infrastructure-import heuristics
1791
- (`FORBIDDEN_PATTERN` / `FORBIDDEN_IMPORT` for `/infra`, `/adapters`,
1792
- `/persistence`, `/db`, and ORMs) fired on **every** file regardless of its
1793
- layer. A persistence- or adapter-layer file that legitimately imports the
1794
- database was blocked by the PreToolUse hook even though `ark-check` (CI)
1795
- passed it — the gate contradicted the project's own `ark.config.json`.
1796
- - The heuristics are now suppressed for layers whose name declares an
1797
- infrastructure role (`adapter`, `infra`, `persistence`, `repository`,
1798
- `integration`, `database`), so those layers may import infrastructure as the
1799
- contract intends. The pure core (domain/application) and zero-config projects
1800
- (no layer context) are unchanged — infra imports there are still blocked.
1801
- User-supplied `forbiddenPatterns` are an explicit opt-in and always apply,
1802
- in every layer.
1803
- - For an infrastructure layer with an unconventional name (`Storage`, `Gateway`,
1804
- …), flag it in `ark.config.json` with `"mayImportInfrastructure": true` and the
1805
- gate exempts it too. `createAICodeGate` gained an `infrastructureLayers` option
1806
- carrying these names. This makes the fix universal: any project, any layer
1807
- naming, without losing domain-purity protection.
1808
-
1809
- ## 1.7.0 — 2026-07-05
1810
-
1811
- ### Added — /ark-* agent skills, installed for every detected CLI
1812
-
1813
- - New `templates/skills/` set of eight autonomous slash-command skills:
1814
- `ark-coverage` (audit which Ark capabilities the project is NOT using, ranked
1815
- with the exact command to enable each), `ark-fix` (resolve violations at the
1816
- root cause — ports/moves, never weaken the contract), `ark-adopt` (baseline
1817
- freeze + ratchet onboarding), `ark-place` ("where does X go?" answered from
1818
- the contract), `ark-contract` (safe `ark.config.json` evolution), `ark-explain`
1819
- (plain-language architecture tour for newcomers), `ark-runtime` (migrate
1820
- hand-rolled event bus/outbox/sagas to the runtime kernel), and `ark-upgrade`
1821
- (refresh gates + skills after a package update).
1822
- - `ark-check --install-agent-gates` now installs the skills into each detected
1823
- tool's command location: `.claude/skills/<name>/SKILL.md`,
1824
- `.cursor/commands/`, `.codex/prompts/`, `.windsurf/workflows/`, and
1825
- `.clinerules/workflows/` (plus `.github/prompts/` for Copilot, which is
1826
- explicit-only via `--tools copilot`). Kiro has no command mechanism, so it
1827
- keeps only its steering rule file. One canonical markdown per skill; existing
1828
- files are never overwritten without `--force`, so re-running after an update
1829
- only adds what's missing.
1830
- - The skills are written to work unattended: they gather everything from the
1831
- repo, take documented defaults instead of asking, finish with a strict
1832
- `ark-check`, and report what they did — usable both by advanced users and by
1833
- developers new to architecture governance (plain-language explanations are
1834
- part of each skill's contract).
1835
- - Postinstall message now tells existing Ark projects to re-run
1836
- `npx ark-check --install-agent-gates` after updating, so new templates and
1837
- skills reach every configured agent CLI, not just one.
1838
-
1839
- ## 1.6.0 — 2026-07-04
1840
-
1841
- ### Changed — bounded in-memory retention by default
1842
-
1843
- - `createArkKernel` now defaults `maxHistorySize` to `DEFAULT_MAX_HISTORY_SIZE`
1844
- (1000), capping event history, trace, and audit records with oldest-first
1845
- eviction. Previously these grew without bound in long-running processes.
1846
- Pass `maxHistorySize: Infinity` to restore the old unbounded behavior.
1847
-
1848
- ### Added — custom layer matchers
1849
-
1850
- - `ArchitectureLayer` accepts an optional `match: (name) => boolean` for teams
1851
- whose intent names don't follow prefix conventions. Matchers are checked
1852
- before prefixes, in layer declaration order, and can be combined with or
1853
- replace `prefixes` (use `prefixes: []` for match-only layers).
1854
-
1855
- ## 1.5.0 — 2026-07-04
1856
-
1857
- ### Added — ark-check scan cache
1858
-
1859
- - `ark-check` caches per-file scan results in `node_modules/.cache/ark-check.json`,
1860
- keyed by each file's mtime+size and the config/manifest contents. Only unchanged
1861
- files skip the TypeScript parse; import edges are ALWAYS re-resolved against the
1862
- live filesystem, so the cache can never hide a violation introduced by adding,
1863
- moving, or deleting other files. `--no-cache` disables it.
1864
-
1865
- ### Added — monorepo per-package tsconfig resolution
1866
-
1867
- - Without `--tsconfig`, `ark-check` now resolves each file's path aliases against the
1868
- NEAREST `tsconfig.json` above it (like `tsc`), so a monorepo can run under a single
1869
- `--root` with per-package alias maps. `--tsconfig` still forces one config for all files.
1870
-
1871
- ### Deprecations (removal planned for 2.0)
1872
-
1873
- - `AIGateViolation.code` (`src/kernel/ai-gate/types.ts`) — use `ruleId`.
1874
- - `layeredArchitectureRules()` (`src/kernel/policy/builtins.ts`) — use `cleanArchitectureMatrix()`.
1875
-
1876
- ## 1.4.0 — 2026-07-03
1877
-
1878
- ### Changed — the write gate now ratchets like the CI gate
1879
-
1880
- - `ark-mcp --hook` blocks an edit only when it ADDS violations relative to the file's
1881
- current on-disk state. Previously any pre-existing violation (frozen in a baseline or
1882
- predating Ark adoption) made every subsequent edit to that file un-writable while CI
1883
- passed — with the new auto-seeded `forbiddenGlobals`, that would have hit ordinary
1884
- brownfield upgrades. New files still block on every violation.
1885
-
1886
- ### Added — SessionStart contract injection (`ark-mcp --session-context`)
1887
-
1888
- - `ark-mcp --session-context` prints a compact contract summary — layers, forbidden
1889
- globals, denied-edge count, baseline state, and the check command — for a Claude Code
1890
- `SessionStart` hook, so the agent knows the architecture from the first token instead
1891
- of learning it by rejection. `--install-agent-gates` now includes the hook in the
1892
- generated `.claude/settings.json`.
1893
- - Project-scoped by design and safe even in global settings: without an
1894
- `ark.config.json`, `--session-context` prints nothing and exits 0 (before loading
1895
- `dist/`), so non-Ark projects are untouched.
1896
-
1897
- ### Added — instruction-tier agent gates (Windsurf, Cline, Copilot, Kiro)
1898
-
1899
- - `ark-check --install-agent-gates` now knows four more tools: `windsurf`
1900
- (`.windsurf/rules/ark.md`), `cline` (`.clinerules/ark.md`), `copilot`
1901
- (`.github/copilot-instructions.md`), and `kiro` (`.kiro/steering/ark.md`).
1902
- All derive from the same canonical agent contract as `AGENTS.md` and the
1903
- Cursor rule, so the steps cannot drift between hosts.
1904
- - Windsurf, Cline, and Kiro are auto-detected from their config directories;
1905
- Copilot is explicit-only via `--tools` (`.github/` is too weak a signal).
1906
- Gemini CLI needs no template — it reads the generated `AGENTS.md`.
1907
-
1908
- ### Added — forbidden ambient globals per layer (`forbiddenGlobals`)
1909
-
1910
- - Layers in `ark.config.json` can declare `forbiddenGlobals` (e.g.
1911
- `["fetch", "process", "Date.now", "Math.random"]`). Import rules can't see code that
1912
- reaches for an ambient global; this closes that hole for domain purity.
1913
- - Enforced identically at all three moments: `ark-check` reports `FORBIDDEN_GLOBAL`
1914
- in CI (baseline-ratchet compatible), the `ark-mcp` write gate blocks the write, and
1915
- the new `ark/no-forbidden-globals` ESLint rule gives in-editor feedback (scope it to
1916
- layer directories via `files`; it takes a `{ globals: [...] }` option).
1917
- - Detection is positional, not scope-aware: dotted entries (`"Date.now"`) flag that
1918
- property access; bare entries (`"console"`) flag member access, calls, and
1919
- constructions. Types, import names, and shadowed locals are never flagged.
1920
- - `ark init` and `ark-check --init` seed the DomainModel layer with
1921
- `["fetch", "process", "Date.now", "Math.random"]`.
1922
- - The `ark://manifest` MCP resource now exposes the configured `forbiddenGlobals`
1923
- map so agents see the constraint before generating code.
1924
- - `createAICodeGate` accepts a `forbiddenGlobals` option (layer → globals), checked
1925
- when a `typescript` module is provided.
1926
-
1927
- ## 1.3.0 — 2026-07-03
1928
-
1929
- ### Added — the 11-layer division is now suggested, to humans and agents
1930
-
1931
- - `ark-check --init` on a project with no conventional layer directories now generates
1932
- the complete 11-layer starter profile (all layers `optional`) instead of failing:
1933
- the strict check passes immediately and each layer starts being enforced as soon as
1934
- its directory gains source files.
1935
- - `ark-check --init` on a partially-layered project prints the undetected profile
1936
- layers with their conventional directories, so the full division is visible before
1937
- deciding what to adopt.
1938
- - The `ark://manifest` MCP resource now includes `suggestedLayers` (undeclared default
1939
- layers with intent prefixes and conventional directories), so agents know where a
1940
- new saga, job, or read model belongs before improvising an ungoverned location.
1941
- - The generated `AGENTS.md` includes a "Where new code belongs" placement table for
1942
- the same purpose in runtimes without MCP.
1943
-
1944
- ### Added — gate presence enforcement (`ark-check --require-gates`)
1945
-
1946
- - `ark-check --require-gates` fails the check when `AGENTS.md`, `.mcp.json`, or the
1947
- generated CI workflow is missing, so "installed but never configured" is a red CI.
1948
- JSON mode reports `{ ok: false, error: 'missing-gates', missing: [...] }`.
1949
- - `--install-agent-gates --tools claude,cursor,codex` selects which tool templates to
1950
- write; without the flag, tools are auto-detected from `.claude/`, `.cursor/`, and
1951
- `.codex/` (all templates are written when nothing is detected).
1952
-
1953
- ### Changed
1954
-
1955
- - The generated CI workflow now runs `ark-check` with `--require-gates`.
1956
- - AGENTS.md and the Cursor rule derive from a single agent contract, so the
1957
- enforcement steps can no longer drift between the two files.
1958
-
1959
- ### Fixed
1960
-
1961
- - `--install-agent-gates` now reports failed template writes and exits non-zero
1962
- instead of always claiming success.
1963
- - `--tools` no longer swallows a following flag as a tool name (`--tools --force`),
1964
- and rejects empty or unknown tool names with exit 2 instead of silently ignoring them.
1965
- - `suggestedLayers` skips default layers whose intent prefixes the project already
1966
- claims under another name (e.g. a `core` layer owning `Domain.`), so agents are never
1967
- told to create a second layer for an already-governed prefix.
1968
- - Greenfield `--init` warns when existing source files live outside `src/` (and are
1969
- therefore not governed by the generated starter config) instead of staying silent.
1970
- - The suggested `check:architecture` npm alias now uses `npx ark-check` (the previous
1971
- snippet only worked inside Ark's own repository).
1972
- - `createElevenLayerArkConfig({ rootDir: '.' })` no longer emits broken `./`-prefixed
1973
- patterns that matched nothing.
1974
-
1975
- ## 1.2.0 — 2026-07-03
1976
-
1977
- ### Added — agent gate installer (`ark-check --install-agent-gates`)
1978
-
1979
- - One command writes the agent-enforcement starter set: `AGENTS.md`, `.mcp.json`,
1980
- Cursor rule + MCP config, Claude settings, a Codex config snippet, and a GitHub
1981
- Actions workflow that runs `ark-check --strict-config`. Existing files are
1982
- skipped unless `--force` is passed.
1983
- - The generated workflow detects the project's package manager (npm / pnpm / yarn)
1984
- from its lockfile and uses matching setup, cache, and run commands.
1985
-
1986
- ### CI
1987
-
1988
- - Workflows updated to the node24 runtime; MCP tests isolated from concurrent builds.
1989
-
1990
- ## 1.1.0
1991
-
1992
- ### Added — baseline ratchet for existing codebases (`ark-check --baseline`)
1993
-
1994
- - `ark-check --update-baseline [file]` freezes the current violations into
1995
- `.ark-baseline.json` (line-insensitive keys, so unrelated edits don't resurrect them).
1996
- - `ark-check --baseline [file]` suppresses frozen violations: only NEW violations fail,
1997
- and stale baseline entries are reported so the ratchet can be tightened with a re-run
1998
- of `--update-baseline`. JSON output gains `suppressedViolations` and `staleBaselineKeys`.
1999
-
2000
- ### Added — Standard Schema support in event contracts
2001
-
2002
- - `EventContract.standardSchema` accepts any [Standard Schema](https://standardschema.dev)
2003
- validator (zod, valibot, arktype, ...) alongside — or instead of — Ark's own schema
2004
- format. Issues (including paths) map to regular contract issues. Validation stays
2005
- synchronous; async validators produce an explicit contract issue. Ark remains
2006
- zero-dependency: the spec interface is vendored as types only.
2007
-
2008
- ### Added — NestJS adapter (`ark-runtime-kernel/nestjs`)
2009
-
2010
- - `ArkModule.forRoot()` / `forRoot(kernel | options)` / `forRootAsync({ useFactory })`
2011
- register a global kernel under the `ARK_KERNEL` token; `@InjectArk()` injects it.
2012
- - `@nestjs/common` is an optional peer dependency; the core stays zero-dependency.
2013
-
2014
- ### Added — GitHub Action
2015
-
2016
- - Composite action at the repo root: `uses: pedroknigge/arkgate@main` runs
2017
- `ark-check`, writes the result to the step summary, and (with `github-token`) comments
2018
- violations on the PR. Inputs: `root`, `config`, `strict-config`, `baseline`, `version`.
2019
-
2020
- ### Added — docs, examples, and distribution
2021
-
2022
- - `docs/ai-gates.md`: copy-paste write-gate setups for Claude Code (hook + MCP), Cursor,
2023
- OpenAI Codex, any hook-capable runtime, plus the CI backstop.
2024
- - `examples/hexagonal-order-api/`: a full hexagonal order API governed by Ark with a
2025
- "break it on purpose" walkthrough.
2026
- - `server.json` for the official MCP registry; `CONTRIBUTING.md`; `ROADMAP.md`.
2027
- - README rewritten adoption-first: 2-minute CI setup, honest comparison vs
2028
- dependency-cruiser / eslint-plugin-boundaries / Nx boundaries, write-gate demo, and the
2029
- runtime kernel repositioned as the opt-in layer.
2030
-
2031
- ### Changed — actionable ark-check output
2032
-
2033
- - Human output now shows the rule, `file:line`, the layer edge with the resolved target,
2034
- and a fix hint per rule, with color when attached to a TTY (`NO_COLOR` respected).
2035
- `--json` output is unchanged (plus the new baseline fields).
2036
-
2037
- ### Changed — single package.json
2038
-
2039
- - Removed the `package.dev.json` / `package.publish.json` swap workflow and its scripts;
2040
- the checked-in `package.json` is the only manifest and `npm publish` ships it as-is
2041
- (`prepack` builds). Internal working documents removed from `docs/`.
2042
-
2043
- ## 1.0.0 — 2026-07-02 (as published to npm)
2044
-
2045
- ### Added — working pre-write hook mode (`ark-mcp --hook`)
2046
-
2047
- - `ark-mcp --hook` runs one-shot instead of serving: it reads a Claude Code PreToolUse
2048
- payload from stdin, validates the file content a Write/Edit/MultiEdit is about to
2049
- produce, and exits `2` with the violations on stderr to block the write (`0` to allow).
2050
- - Edits are validated against the post-edit file state (current file with the edit applied
2051
- in memory), not the edit snippet in isolation.
2052
- - Fail-open plumbing: non-source files, other tools, files outside `--root`, and malformed
2053
- payloads never block the agent.
2054
- - Fixed the Claude Code integration examples in README and the agent guide: they showed a
2055
- hook `"type": "mcp"` that does not exist in Claude Code. The documented configuration now
2056
- uses a real `"type": "command"` hook running `ark-mcp --hook`, plus `.mcp.json` for the
2057
- manifest resource and `validate_code` tool.
2058
-
2059
- ### Added — one-command onboarding (`ark-check --init`)
2060
-
2061
- - `ark-check --init` scans the project for the built-in layer directory conventions
2062
- (`src/domain`, `src/application`, `src/adapters/persistence`, ...) and writes an
2063
- `ark.config.json` covering only the layers that actually contain source files, with the
2064
- default rule matrix filtered to those layers.
2065
- - The generated config passes `--strict-config` out of the box; `--init` also lists the
2066
- top-level directories left uncovered so governance gaps are explicit from day one.
2067
- - `--init` refuses to overwrite an existing config unless `--force` is passed, and fails
2068
- with guidance (instead of writing a useless config) when no conventional directories
2069
- are found.
2070
-
2071
- ### Changed — real dogfooding and less warning noise
2072
-
2073
- - Ark's own `ark.config.json` now classifies 100% of `src/` (DomainModel, Kernel, and
2074
- Tooling layers with real boundary rules) instead of a symbolic two-layer config, and
2075
- `npm run check:architecture` / CI run with `--strict-config` so coverage can never
2076
- silently rot.
2077
- - Removed the `CONFIG_PARTIAL_LAYER_MAP` warning: it flagged every project with fewer
2078
- than 11 layers even at 100% file coverage. `CONFIG_UNCLASSIFIED_FILES` already reports
2079
- the real coverage gap.
2080
-
2081
- ### Added — broader static governance checks
2082
-
2083
- - `ark-check` now checks dynamic `import()` and `require()` module edges against configured
2084
- layer rules.
2085
- - `ark-check` now flags raw `publish()` calls that pass an intent string or raw event
2086
- object.
2087
- - `ark-check` now flags publish calls missing `metadata.source`.
2088
- - `ark-check` now flags source intent literals whose resolved layer does not match the
2089
- publishing file's configured layer.
2090
-
2091
- ### Added — source-bound publishers
2092
-
2093
- - Event buses now expose `createPublisher(sourceIntent)` to create a source-bound
2094
- publishing capability.
2095
- - Ark kernels expose `ark.publisher(sourceIntent)` as the recommended strict runtime path.
2096
- - Source-bound publishers stamp `metadata.source` internally and throw
2097
- `SourceMetadataOverrideError` when callers try to publish as a different source.
2098
-
2099
- ### Added — operational 11-layer profile config
2100
-
2101
- - Added `createElevenLayerArkConfig()` to generate an `ark-check` configuration from the
2102
- built-in runtime 11-layer profile.
2103
- - Added `ark-check --print-config eleven-layer` for CLI bootstrap of `ark.config.json`.
2104
- - Generated layers are optional by default so teams can adopt the full profile
2105
- incrementally without warnings for unused folders.
2106
-
2107
- ### Added — AST-backed AI publish checks
2108
-
2109
- - `createAICodeGate()` can now run built-in TypeScript AST checks when the caller passes
2110
- the `typescript` module.
2111
- - AST checks flag raw publish calls, publish calls missing `metadata.source`, and source
2112
- intent literals whose layer differs from the target file layer.
2113
- - `ark-mcp` passes TypeScript into AICodeGate when available so the write-path gate blocks
2114
- the same publish misuse patterns earlier.
2115
-
2116
- ### Added — ports and adapters governance metadata
2117
-
2118
- - `definePort()` now accepts optional ownership metadata, intent identity, and an
2119
- `allowedAdapters` list.
2120
- - `createAdapter()` accepts adapter metadata and rejects adapters that are not allowed by
2121
- the port.
2122
- - Added `checkAdapterGovernance()` for non-throwing adapter allowlist checks.
2123
-
2124
- ### Added — production hardening
2125
-
2126
- - Event contracts now support nested object fields, typed array items, and enum values.
2127
- - Added `docs/production-hardening.md` with store-interface guidance for durable audit,
2128
- outbox, projection, and workflow implementations.
2129
-
2130
- ## 1.0.0 — 2026-07-01
2131
-
2132
- ### Changed — strict runtime baseline and governance roadmap
2133
-
2134
- - `createArkKernel()` now uses hardened defaults: strict event contracts, known-source
2135
- enforcement, and hard observed layer-flow enforcement unless explicitly relaxed.
2136
- - Added `createLenientArkKernel()` for migration and legacy paths that need the previous
2137
- relaxed behavior.
2138
- - The built-in 11-layer profile now uses a strict cross-layer deny matrix with explicit
2139
- allowed flows.
2140
- - `ark-check` reports advisory config warnings for missing/partial layer maps,
2141
- unclassified included files, unmatched layer patterns, duplicate layers, and rules that
2142
- reference unknown layers. `--strict-config` turns those warnings into a failing check.
2143
- - Documentation now states the runtime/static/AI governance boundaries explicitly and
2144
- tracks the seven-phase roadmap for expanding Ark's enforcement scope.
2145
-
2146
- ## 0.8.4 — 2026-07-01
2147
-
2148
- ### Fixed — CI/MCP intent-classification parity
2149
-
2150
- `ark-check` classified intent names with declaration-order first-match + raw `startsWith`,
2151
- while the MCP write-gate classifies via the library's `ArchitectureProfile.resolveLayer`
2152
- (longest-prefix-first + prefixes normalized to a trailing `.`). For configs with
2153
- overlapping prefixes (`Adapter.` vs `Adapter.Persistence.`) or dotless prefixes (`Domain`),
2154
- the two gates disagreed. Both now share `resolveIntentLayer` (in `bin/ark-shared.mjs`),
2155
- which mirrors the library semantics exactly — a regression test asserts the shared resolver
2156
- and `profile.resolveLayer` return identical results across overlapping/dotless configs.
2157
-
2158
- ## 0.8.3 — 2026-07-01
2159
-
2160
- ### Fixed — third code-review pass (glob robustness + latent fallback bug)
2161
-
2162
- - **Unbalanced-brace crash.** A glob with an unbalanced `{` produced an invalid regex, so
2163
- `new RegExp` threw — crashing the CI gate (exit 2) and every MCP `validate_code` call.
2164
- `globToRegExp` now only treats braces as alternation when they're balanced, otherwise
2165
- literal; it also honors backslash-escaped braces (`\{` → literal).
2166
- - **`layerForIntent` default fallback (latent since v0.4).** The `DEFAULT_INTENT_PREFIXES`
2167
- fallback read `item.prefix` (singular) off `{ layer, prefixes: [...] }` entries, so it
2168
- matched nothing — a project with layers but no `intentPrefixes` got no intent-reference
2169
- enforcement in CI while the MCP gate blocked the same reference. Now flattened to the
2170
- right shape; the two gates agree.
2171
- - **Out-of-root over-reach.** After dropping the hard root boundary in 0.8.1, a relative
2172
- import escaping `--root` (`../../…`) could be classified by a catch-all pattern and
2173
- false-flagged. `resolveImport` now skips targets whose root-relative path leads with `..`
2174
- (and still skips `node_modules` segments) — projects under a `node_modules` segment stay
2175
- governed; monorepos should run ark-check per package.
2176
- - **Accurate MCP warning.** The "no layers configured" stderr note no longer claims layer
2177
- checks are disabled; with no config layers the gate uses the default 11-layer profile and
2178
- layer-reference checks still run when the caller passes an explicit `layer`.
2179
-
2180
- ## 0.8.2 — 2026-07-01
2181
-
2182
- ### Fixed — second code-review pass (parity + glob correctness)
2183
-
2184
- A re-review of the v0.8.1 fixes found that a couple of them introduced new divergences.
2185
- This closes them and unifies the two gates so they provably can't disagree:
2186
-
2187
- - **ark-mcp / ark-check rule parity.** The write-path gate built its profile with
2188
- `rules: config.rules ?? []`, so a config that declared layers but omitted `rules` got
2189
- zero enforcement while CI still applied the default matrix. Both CLIs now share
2190
- `DEFAULT_RULES` + `DEFAULT_INTENT_PREFIXES` (in `bin/ark-shared.mjs`) and the gate uses
2191
- `config.rules ?? DEFAULT_RULES` with the same intent-prefix fallback ark-check uses. No
2192
- layer is built with empty prefixes (which had made it unresolvable).
2193
- - **node_modules exclusion, done right.** `ark-check` now excludes a resolved target only
2194
- when its path *relative to root* contains a `node_modules` segment — so a broad catch-all
2195
- pattern (`**`) no longer false-flags third-party imports, while projects living under a
2196
- `node_modules` segment and monorepo siblings are still governed.
2197
- - **Resolver directory shadowing.** The `.mts`/`.cts` relative fallback now requires the
2198
- candidate to be a file (`statSync().isFile()`), so a directory named like the specifier
2199
- can't shadow the real module file.
2200
- - **Brace globs.** `globToRegExp` now supports `{ts,tsx}` alternation (previously treated
2201
- as literals, silently matching nothing) and caches each compiled pattern.
2202
- - **Docs/CI polish.** Corrected the observed-flow enforcement comment (edge is recorded
2203
- *after* the check now); scoped the CI `push` trigger to `main` so PR branches don't run
2204
- the job twice (all PRs are still gated via `pull_request`, any base branch).
2205
-
2206
- ## 0.8.1 — 2026-07-01
2207
-
2208
- ### Fixed — enforcement-defeating bugs found in the v0.8 code review
2209
-
2210
- A workflow-backed review of v0.6–v0.8 surfaced a cluster of bugs that silently defeated the
2211
- very gates they added. All fixed with regression tests (including a nested-directory fixture
2212
- so the gate can never be vacuously green again):
2213
-
2214
- - **Broken `**` glob (critical).** A chained `.replace()` corrupted `**` into `.[^/]*`, so
2215
- `src/kernel/**` stopped matching nested paths — every file in a subdirectory was silently
2216
- unclassified and skipped. This neutered both `ark-check` (CI) and `ark-mcp` layer
2217
- inference for any real project. Fixed with a single-pass glob compiler shared by both
2218
- CLIs (`bin/ark-shared.mjs`), removing the duplicated (and independently buggy) copies.
2219
- - **`ark-check` import filters.** Replaced the `node_modules` path-substring test (which
2220
- discarded an entire project living under a `node_modules` segment) with TS's own
2221
- `isExternalLibraryImport` flag; removed the out-of-root filter so monorepo cross-package
2222
- imports are governed; restored `.mts`/`.cts` extensionless resolution via a relative
2223
- fallback.
2224
- - **`ark-mcp` write-path gate.** It now builds the enforcement profile from the project's
2225
- `ark.config.json` (layer names **and** rules), so it agrees with `ark-check` instead of
2226
- always using the built-in `elevenLayerProfile` — projects with custom layer names/rules
2227
- were getting zero layer enforcement. Malformed config now throws instead of silently
2228
- falling back to a no-op; empty-layer configs warn on stderr. Manifest resource reflects
2229
- the effective profile. Guarded a null-intent crash and gave a clear message on broken
2230
- builds. Notifications never receive a response.
2231
- - **EventBus phantom edge.** In `enforceObservedLayerFlow: 'hard'`, a rejected event no
2232
- longer records an `observed` graph edge (the check now runs before `registerEventFlow`),
2233
- so drift/manifest/observability reports don't show flows that never happened.
2234
- - **CI gate coverage.** The workflow now triggers on every push and pull request, not only
2235
- those based on `main`, so non-main PR topologies can't bypass the gate.
2236
-
2237
- ## 0.8.0 — 2026-07-01
2238
-
2239
- ### Added — mandatory CI architecture gate + AI write-path gate (MCP)
2240
-
2241
- Two chokepoints that make Ark's enforcement unavoidable where it matters, closing the last
2242
- two "kernel-earning" gaps from the strategic audit.
2243
-
2244
- **1. Mandatory CI gate.**
2245
- - `.github/workflows/ci.yml` runs typecheck, tests, build, and `ark-check` on every push/PR.
2246
- `ark-check` exits non-zero on any layer violation, so a violation **fails the job and
2247
- blocks the merge** — the honest architecture chokepoint for TypeScript.
2248
- - `ark.config.json` dogfoods Ark on itself: `src/domain/**` must not import the kernel
2249
- (a real, currently-green invariant — Ark's domain types are dependency-free).
2250
- - `check:architecture` script now runs the gate explicitly with the config.
2251
-
2252
- **2. AI write-path gate — `ark-mcp` MCP server (new `bin`).**
2253
- - A **zero-dependency** MCP server (hand-rolled JSON-RPC 2.0 over stdio — no SDK dependency,
2254
- honoring the zero-dep rule) exposing:
2255
- - resource `ark://manifest` — the architectural contract (layers + rules, or a project
2256
- manifest via `--manifest`) for agent contract discovery.
2257
- - tool `validate_code` — runs Ark's AI code gate on a source snippet and returns
2258
- `{ valid, violations }`, setting `isError` when invalid.
2259
- - Designed to bind to `PreToolUse` on Write/Edit so architecturally-invalid generated code
2260
- is blocked **before it lands** — turning the manifest + AI gate from an ignorable library
2261
- into an enforced checkpoint on the operation that matters for AI agents.
2262
- - Run with `npx ark-mcp` (or `npm run mcp`). See `docs/agent-guide.md` for wiring.
2263
-
2264
- ## 0.7.0 — 2026-07-01
2265
-
2266
- ### Changed — `ark-check` resolves all imports, not just relative ones
2267
-
2268
- `ark-check` previously resolved only relative (`./`, `../`) import specifiers, so
2269
- path-alias and package imports — the majority in real TypeScript repos — were invisible
2270
- to it. It now resolves every import specifier through the TypeScript module resolver
2271
- (`ts.resolveModuleName`) using the project's `tsconfig.json`, so:
2272
-
2273
- - **tsconfig path aliases** (e.g. `@domain/*`, `@infra/db`) resolve to their real files and
2274
- cross-layer violations through aliases are now caught.
2275
- - **package/absolute imports** resolve via node resolution; external `node_modules` and
2276
- `.d.ts`-only targets are correctly ignored.
2277
- - **relative imports** keep working exactly as before.
2278
-
2279
- New `--tsconfig <path>` flag (defaults to the nearest `tsconfig.json` from `--root`). When
2280
- no tsconfig is found, aliases are unavailable but relative/package imports still resolve.
2281
- Layer identity is still derived from file location (glob `patterns`), per the audit's
2282
- "derive layer from code, not just the intent-name prefix" recommendation.
2283
-
2284
- This closes the top-ranked remaining gap from both the v0.5 strategic audit and the
2285
- external v0.6 review: the honest chokepoint for TypeScript architecture enforcement is the
2286
- CI merge gate, and it must see the imports that actually exist.
2287
-
2288
- ## 0.6.0 — 2026-07-01
2289
-
2290
- ### Added — runtime enforcement of observed layer flows
2291
-
2292
- Ark now enforces architecture over **what the system actually does**, not only over what
2293
- was declared. On every publish, the event bus already recorded the real producer→event
2294
- flow (`metadata.source → intent`); v0.6 wires that observed edge into enforcement.
2295
-
2296
- - `EventBusOptions.enforceObservedLayerFlow: 'off' | 'soft' | 'hard'` (with
2297
- `architectureProfile`) checks the resolved producer layer → event layer against the
2298
- profile's rule matrix at publish time.
2299
- - `hard` throws `ObservedLayerFlowViolationError` **before** the event reaches history,
2300
- outbox, or subscribers.
2301
- - `soft` records a `layer.observedViolation` trace + audit record and proceeds.
2302
- - `off` (default for `createEventBus`/`createArkKernel`) preserves prior behavior.
2303
- - `createStrictArkKernel()` defaults `enforceObservedLayerFlow` to `hard`. The recommended
2304
- strict path now rejects, e.g., a persistence adapter driving a Domain event
2305
- (PersistenceAdapters → DomainModel) or a Domain source emitting an Application event.
2306
- - New exports: `ObservedLayerFlowViolationError`, `ObservedLayerFlowMode`.
2307
- - New trace/audit record type: `layer.observedViolation`.
2308
-
2309
- This closes the highest-leverage gap identified in the v0.5 strategic audit: the observed
2310
- flow was previously collected only for the drift *report*, never for enforcement — making
2311
- "runtime layer governance" a check over the declared model rather than the running system.
2312
-
2313
- ### Docs
2314
-
2315
- - README now states the enforcement scope explicitly (hard-failed / observable / out of
2316
- runtime scope) and frames Ark as the runtime kernel for the event/intent layer plus a
2317
- machine-readable contract, not an OS-style choke point over all code.
2318
-
2319
- ## 0.5.0
2320
-
2321
- Add-only event interceptors, interceptor audit/trace records, contract-safe interceptor
2322
- failure behavior, kernel instance id stamping, observability drift report (declared vs
2323
- observed), runtime graph observed flows, `createArkTestHarness()`, and the
2324
- `ark-runtime-kernel/eslint` plugin.
2325
-
2326
- ## 0.4.0
2327
-
2328
- `createStrictArkKernel()`, event contract registry, known-source enforcement, basic
2329
- outbox store, `ark-check` CLI (AST import + intent-string checks), and policy lifecycle
2330
- metadata.
2331
-
2332
- ## 0.3.0
2333
-
2334
- 11-layer architecture profile, `createArkKernel()`, native audit trail, workflow/saga
2335
- engine, projection/read-model registry, metadata validation, and layer-grouped graph views.
1313
+ ## 1.19.0 and earlier
2336
1314
 
2337
- ## 0.2.0
2338
-
2339
- `ArkManifest` export, `syncRegistryToGraph`, `PolicyViolationError` + observability hooks,
2340
- bounded history + trace format, layer policies, strict registry publish/subscribe
2341
- validation, and the package rename to `ark-runtime-kernel`.
1315
+ Detailed 0.x/1.x history remains available in the immutable
1316
+ [`1.x` CHANGELOG](https://github.com/pedroknigge/arkgate/blob/5e9d6745170a7b144015e718d0aed854c4bcd662/CHANGELOG.md#1190--2026-07-08).
1317
+ The published package keeps complete 2.x and current-major notes so upgrade triage stays local
1318
+ without making every install carry the full pre-2.0 development log.