arkgate 2.5.0 → 2.6.1

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,93 @@
2
2
 
3
3
  All notable changes to ArkGate (`arkgate`; formerly `ark-runtime-kernel`) are documented here.
4
4
 
5
+ ## 2.6.1 — 2026-07-09
6
+
7
+ Field-test release: Next/monorepo honesty (deer-flow-style hosts), simplified **one-flow** UX for
8
+ humans and autonomous agents, and skills that require real source remediation—not CLI paraphrase.
9
+
10
+ ### Fixed — false greens & strict CI noise (Next / monorepo)
11
+
12
+ - **Next application bag:** framework overlay classifies `src/core/**` and `**/core/**` as
13
+ ApplicationOrchestration so monorepos like `frontend/src/core` are governed on day one
14
+ (not left as dark matter under a “clean” plan).
15
+ - **Nested Next detection:** `collectAggregatedDeps` + scan of `frontend/`/`web`/`client` so
16
+ `next` only under `frontend/package.json` (root arkgate-only) still enables the Next overlay
17
+ and `app/page.tsx` path matching (middle segment optional).
18
+ - **Next noise excludes:** public assets, tool configs, and scripts are excluded by default on
19
+ Next detection so demo JS does not pollute coverage.
20
+ - **Domain `**/types.ts` trap removed** from monorepo and ui-surface presets. Bare
21
+ `core/**/types.ts` no longer becomes Domain and invents Domain→Application edges.
22
+ - **`CONFIG_LAYER_PATTERN_NO_MATCHES` is advisory** (`failsStrict: false`). Dead preset globs
23
+ (`app/**`, `src/layouts/**` when `include` is `frontend`) no longer fail `--strict-config`
24
+ alone while architecture edges are clean.
25
+ - **Empty baseline policy:** `--update-baseline` with zero violations **deletes** an existing
26
+ empty `.ark-baseline.json` instead of leaving an orphan “is the ratchet on?” file.
27
+ - **Monorepo CI install:** generated workflow `npm install` also installs `frontend/` when
28
+ `frontend/package.json` exists (root-only arkgate + app under frontend).
29
+
30
+ ### Changed — one-flow UX (humans + agents)
31
+
32
+ - **README:** leads with **The only flow** — `ark start` → `/ark-autopilot` → `doctor`. Skills
33
+ are escapes, not a flat curriculum. Operating modes documented as **status lights**, not
34
+ settings.
35
+ - **`ark start` wrap-up:** always ends with the three next steps (agent autopilot, doctor,
36
+ strict check) instead of a long mode-specific essay.
37
+ - **Generated `AGENTS.md`:** “Default agent flow (if unsure, do only this)” — autopilot first;
38
+ other `/ark-*` skills are optional escapes.
39
+ - **Doctor operating mode copy:** plain-language Setup / Align / Guard and “you do not pick
40
+ this mode”.
41
+
42
+ ### Changed — skills (deep co-pilot, not CLI wrappers)
43
+
44
+ Templates under `templates/skills/` (and project `.grok/skills` copies) for at least:
45
+
46
+ `ark-coverage`, `ark-autopilot`, `ark-loop`, `ark-adopt`, `ark-fix`, `ark-contract`
47
+
48
+ - **Anti-wrapper rule:** must read real source; CLI is a sensor.
49
+ - **“Así te lo re-soluciono”** remediation deliverable (file-level plans).
50
+ - **Adopt / contract:** mine loose business rules into the Ark **manifest** (layers,
51
+ `intentPrefixes`, Domain placement, intent naming)—not config vibes only.
52
+
53
+ ### Tests
54
+
55
+ - Fixture-style unit tests drive real `bin/ark-check.mjs`: Next core governance; deer-flow-like
56
+ monorepo (`frontend` + `core/**/types.ts` not Domain); strict-config with dead globs;
57
+ empty baseline removal.
58
+
59
+ ### Also in 2.6.1 train (from Unreleased product priorities)
60
+
61
+ - Empty-scope honesty, auto-include TS packages, AGENTS non-clobber, `--adopt-contract`,
62
+ UI surface preset, MCP place/suggest-include, Codex multi-project, deploy-path adoption
63
+ gaps, soft cycle policy, Rush/Lerna monorepo roots, type-only cycle graph, default skip
64
+ `*.gen.ts` / `*.generated.ts`.
65
+
66
+ ## 2.6.0 — 2026-07-09
67
+
68
+ ### Changed — maintainability hygiene (#11 / #12)
69
+
70
+ - **`bin/ark-check.mjs` modularized** (~5.8k → ~2.1k lines of orchestration):
71
+ `bin/lib/agent-gates.mjs`, `html-report.mjs`, `doctor-plan.mjs`, `violations.mjs`,
72
+ `suggestions.mjs`, `presets.mjs`. Entry owns scan/CLI only.
73
+ - **Layer matching single algorithm:** pure matcher in `bin/ark-layer-match.mjs` (CLI) and
74
+ `src/domain/layerMatch.ts` (eslint). Tooling may import DomainModel for that pure helper.
75
+ `tests/unit/static-check/layerMatchParity.test.ts` locks both implementations.
76
+ - Dual-driver ESLint/CI tests retained.
77
+
78
+ ### Fixed — field test (Codex + Grok on random repos)
79
+
80
+ - **`--report` path display:** absolute report paths no longer print as brittle
81
+ `../../../../tmp/...` relatives; paths outside the project root print absolute.
82
+ - **`ark-check --help`:** documents dual bins `arkgate-check | ark-check`.
83
+ - **`ark-check --version` / `-V`:** prints package version (no longer runs a full check).
84
+ - **Doctor thin-coverage honesty:** when there are zero violations but governed < 50%
85
+ (or empty scope), doctor no longer claims “code matches the contract”; it warns that
86
+ green is not yet honest enforcement.
87
+ - **Grok write-gate hooks:** root env
88
+ `${GROK_WORKSPACE_ROOT:-${CLAUDE_PROJECT_DIR:-.}}` (Grok → Claude alias → cwd).
89
+ - **AGENTS / package / Cursor check command:** if `.ark-baseline.json` exists, emitted
90
+ `ark-check` commands include `--baseline .ark-baseline.json` (same ratchet as CI).
91
+
5
92
  ## 2.5.0 — 2026-07-09
6
93
 
7
94
  ### Added — ESLint ↔ CI layer parity
package/README.md CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  # ArkGate — Architecture Co-pilot for AI TypeScript
4
4
 
5
- **Write gate · CI gate · co-pilot** for TypeScript projects that use AI agents.
5
+ **One contract. One gate. One co-pilot.**
6
6
 
7
- Your AI writes most of the code. **ArkGate** keeps that code inside an architecture you can
8
- trust — and makes sure a “green” check means something real.
7
+ Your AI writes most of the code. ArkGate keeps that code inside an architecture you can trust —
8
+ and makes sure a “green” check means something real.
9
9
 
10
10
  [![CI](https://github.com/pedroknigge/arkgate/actions/workflows/ci.yml/badge.svg)](https://github.com/pedroknigge/arkgate/actions/workflows/ci.yml)
11
11
  [![npm](https://img.shields.io/npm/v/arkgate?color=cb3837&label=npm)](https://www.npmjs.com/package/arkgate)
@@ -17,21 +17,42 @@ trust — and makes sure a “green” check means something real.
17
17
 
18
18
  ---
19
19
 
20
- ## What it is
20
+ ## The only flow (humans and agents)
21
21
 
22
- **ArkGate** is a **machine-readable architecture contract** for TypeScript, enforced in three places:
22
+ If you remember nothing else:
23
23
 
24
- | When | Tool | What happens |
25
- |------|------|----------------|
26
- | **While the AI writes** | `arkgate-mcp` (write gate) | Blocks bad edits; agent self-corrects |
27
- | **Before merge** | `arkgate-check` (CI) | Full TypeScript import graph + rules |
28
- | **At runtime** *(optional)* | `createArkKernel()` | Event/intent governance if you opt in |
24
+ ```text
25
+ 1. npx arkgate start ← install shape + gates + origin report
26
+ 2. /ark-autopilot ← in your agent: adopt, fix, leave gates on
27
+ 3. npx arkgate-check --doctor “where am I?” anytime (one status screen)
28
+ ```
29
+
30
+ | Stuck on… | Do this |
31
+ |-----------|---------|
32
+ | Gate failed after an edit | `/ark-fix` |
33
+ | “Where does this new file go?” | `/ark-place` |
34
+ | Contract globs / layers wrong | `/ark-contract` |
35
+ | New ArkGate version | `/ark-upgrade` |
36
+
37
+ **Everything else is optional.** You do not need to learn “modes”, 11 skills, or the runtime
38
+ kernel to get value. Agents that are unsure should **only** run `/ark-autopilot` (or the three
39
+ commands above).
40
+
41
+ ---
42
+
43
+ ## What it is (30 seconds)
44
+
45
+ **ArkGate** = a machine-readable architecture file (`ark.config.json`) enforced in two places
46
+ you always care about:
47
+
48
+ | When | Tool |
49
+ |------|------|
50
+ | **While the AI writes** | `arkgate-mcp` write gate (blocks bad edits) |
51
+ | **Before merge** | `arkgate-check` CI |
29
52
 
30
- One file drives all of it: **`ark.config.json`**.
53
+ Optional later: runtime kernel (`createArkKernel`) if you want event/intent governance.
31
54
 
32
- It is **not** a web framework, ORM, or job runner — and the optional runtime kernel is not
33
- the product. The product is the **agent-native architecture gate** (write path + CI + plan/loop)
34
- plus tools agents can read *before* generating code (`ark_place`, `ark://manifest`, …).
55
+ It is **not** a web framework, ORM, or job runner.
35
56
 
36
57
  ![Write gate: agent blocked, then self-corrects](docs/assets/ark-write-gate.svg)
37
58
 
@@ -39,31 +60,30 @@ plus tools agents can read *before* generating code (`ark_place`, `ark://manifes
39
60
 
40
61
  ## Who it’s for
41
62
 
42
- | You are… | You want… | Start with |
43
- |----------|-----------|------------|
44
- | **Builder with AI** (not necessarily an architect) | Order without learning “hexagonal” first | `npx arkgate start` → `/ark-autopilot` |
45
- | **Engineer / tech lead** | A strict contract, CI, baselines, precise control | `ark init` + `ark-check` + write gate |
46
- | **Team on a messy repo** | Truth about coverage + a cleanup path, not a false green | `ark-check --coverage` → `/ark-adopt` |
63
+ Same start for almost everyone: **`npx arkgate start` `/ark-autopilot`**.
47
64
 
48
- **Not for:** projects with no TypeScript, people who only want a one-off lint rule and no agent workflow, or anyone looking for an app framework.
65
+ | You are… | Same start, then… |
66
+ |----------|-------------------|
67
+ | Builder with AI | Stay on autopilot until doctor is happy |
68
+ | Tech lead on a messy monorepo | Autopilot (or deeper `/ark-adopt` if you want a focused brownfield pass) |
69
+ | Power user | Same flow; use `ark-check --plan` / `--coverage` when you want the raw sensor |
70
+
71
+ **Not for:** no TypeScript, “just one lint rule”, or looking for an app framework.
49
72
 
50
73
  ---
51
74
 
52
- ## What you get (in plain language)
75
+ ## Status, not settings (“modes”)
53
76
 
54
- 1. **A shape** Ark looks at your repo (Nest, Next, API, library, …) and suggests how to organize it.
55
- 2. **Guardrails** — config + agent gates + CI so new code can’t quietly break layers.
56
- 3. **A plan** — what’s safe for an agent to fix vs what needs your decision (`mechanical-safe` vs judgment).
57
- 4. **Honesty** — if Ark only governs 10% of the tree, it says so. “Clean” with almost no coverage is not success.
58
- 5. **Adoption health** — `arkgate-check --doctor` checks co-pilot completeness (hosts, MCP argv, Codex home, core-layer optionality, origin report) **separately** from the 0–100 fitness score.
77
+ `ark-check --doctor` may say **Suggest / Adapt / Enforce**. That is a **status light**, not a
78
+ mode you configure:
59
79
 
60
- Three **operating modes** (not “user types”) on the same contract:
80
+ | Light | Means | Your move |
81
+ |-------|--------|-----------|
82
+ | **Suggest** | New/thin project | Finish `start` + autopilot |
83
+ | **Adapt** | Not fully protected yet | Keep autopilot / adopt until clean |
84
+ | **Enforce** | Gates can honestly protect you | Build features; fix with `/ark-fix` if blocked |
61
85
 
62
- | Mode | Meaning |
63
- |------|---------|
64
- | **Suggest** | Install a starting shape |
65
- | **Adapt** | Match the contract to real folders / raise coverage |
66
- | **Enforce** | Gates actually protect you |
86
+ You **arrive** at Enforce. You never “turn on Enforce”.
67
87
 
68
88
  ---
69
89
 
@@ -85,58 +105,61 @@ Full checklist (CI, MCP, Codex, imports): **[docs/migrate-from-ark-runtime-kerne
85
105
 
86
106
  ```bash
87
107
  npm install -D arkgate typescript
88
- npx arkgate start # look at the project → setup plan (plain language)
89
- # (aliases: ark start / ark-check / ark-mcp still work)
108
+ npx arkgate start # setup + origin report
109
+ # in agent:
110
+ # /ark-autopilot
111
+ npx arkgate-check --doctor # status light + next action
90
112
  ```
91
113
 
92
- Then, in your agent (Claude / Cursor / Codex / **Grok** / …):
114
+ Aliases `ark` / `ark-check` / `ark-mcp` still work. **npm / pnpm / yarn**. No install lifecycle scripts.
93
115
 
94
- ```text
95
- /ark-autopilot
96
- ```
116
+ <details>
117
+ <summary>What <code>/ark-autopilot</code> does under the hood (optional detail)</summary>
118
+
119
+ 1. Setup if needed (`ark start`).
120
+ 2. Origin architecture report (before picture in `.ark/reports/`).
121
+ 3. Adoption: match contract to real folders, raise governed %.
122
+ 4. Plan + safe auto-fixes; judgment when you ask for full apply.
123
+ 5. Gates on + after report (evolution vs origin).
97
124
 
98
- That is the **co-pilot**: set up → plan → apply safe fixes (validated, reversible) → propose the rest → leave gates on.
125
+ </details>
99
126
 
100
- **Prefer manual control?**
127
+ <details>
128
+ <summary>Manual / power-user CLI only</summary>
101
129
 
102
130
  ```bash
103
- npx arkgate init # config + gates
104
- npx arkgate-check # CI gate
105
- npx arkgate-check --plan # classified fix list
131
+ npx arkgate init
132
+ npx arkgate-check
133
+ npx arkgate-check --plan
106
134
  npx arkgate-check --coverage
107
135
  ```
108
136
 
109
- Works with **npm, pnpm, and yarn**. No install lifecycle scripts (safe for hardened CI).
137
+ </details>
110
138
 
111
139
  ---
112
140
 
113
- ## Agent skills (`/ark-*`)
114
-
115
- Install with agent gates:
116
-
117
- ```bash
118
- npx arkgate-check --install-agent-gates
119
- # or pick hosts: --tools claude,cursor,codex,grok
120
- ```
141
+ ## Other skills (only when you need them)
121
142
 
122
- | Skill | What it does |
123
- |-------|----------------|
124
- | **`/ark-autopilot`** | End-to-end co-pilot: setup → plan → safe auto-fixes → propose the rest → leave gates on |
125
- | **`/ark-loop`** | Drive the plan in a worktree; auto-apply only `mechanical-safe` (type-only move, pure-type file relocate, `import type` of pure-type modules) |
126
- | **`/ark-architect`** | Greenfield: pick application shape, phase-1 layers, scaffold, verify honestly |
127
- | **`/ark-adopt`** | Brownfield: match contract to reality, raise coverage, freeze only real debt |
128
- | **`/ark-contract`** | Safely edit `ark.config.json` (smallest change, strict re-check) |
129
- | **`/ark-place`** | Where does this new artifact go? Layer, path, naming — then scaffold |
130
- | **`/ark-fix`** | Fix violations at the source (no disable comments, no gate weakening) |
131
- | **`/ark-explain`** | Explain the current contract, coverage, and report in plain language |
132
- | **`/ark-coverage`** | Audit which Ark capabilities you are not using yet |
133
- | **`/ark-runtime`** | Opt-in: migrate hand-rolled bus/outbox/sagas onto the runtime kernel |
134
- | **`/ark-upgrade`** | Bump the package and refresh gates + skills for every agent host (also normalizes MCP bins + Codex home) |
143
+ Install once: `npx arkgate-check --install-agent-gates`
144
+ (`--tools claude,cursor,codex,grok` to pick hosts.)
135
145
 
136
- Supported agent hosts for full MCP/hook gates: **Claude Code**, **Cursor**, **OpenAI Codex**, **Grok Build**. Instruction-tier hosts (Windsurf, Cline, Copilot, …) get rule files. See [docs/ai-gates.md](docs/ai-gates.md).
146
+ **Default is always `/ark-autopilot`.** The rest are escapes, not a second curriculum:
137
147
 
138
- After upgrade, run **`npx arkgate-check --doctor`**: it flags incomplete hosts, dual `ark-mcp`/`arkgate-mcp` args, Codex home pointing at a temp path, core layers still `optional` while populated, and a missing origin report.
148
+ | Need | Skill |
149
+ |------|--------|
150
+ | Only the apply loop (plan already exists) | `/ark-loop` |
151
+ | Empty greenfield shape/scaffold | `/ark-architect` |
152
+ | Deep brownfield / manifest mining alone | `/ark-adopt` |
153
+ | New file placement | `/ark-place` |
154
+ | Gate violation on a change | `/ark-fix` |
155
+ | Edit `ark.config.json` safely | `/ark-contract` |
156
+ | Plain-language tour of the report | `/ark-explain` |
157
+ | Deep “what am I not using?” audit | `/ark-coverage` |
158
+ | Migrate hand-rolled bus/outbox (TS) | `/ark-runtime` |
159
+ | Bump ArkGate + refresh all agent hosts | `/ark-upgrade` |
139
160
 
161
+ Hosts with full MCP/hooks: **Claude Code**, **Cursor**, **Codex**, **Grok Build**.
162
+ More: [docs/ai-gates.md](docs/ai-gates.md). Health: **`npx arkgate-check --doctor`**.
140
163
  ---
141
164
 
142
165
  ## How it works (short)