arkgate 2.9.1 → 2.10.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 (43) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +14 -2
  3. package/bin/ark-mcp.mjs +282 -102
  4. package/bin/lib/agent-gates.mjs +181 -6
  5. package/bin/lib/architecture-scan.mjs +19 -0
  6. package/bin/lib/auto-patch.mjs +264 -0
  7. package/bin/lib/doctor-plan.mjs +54 -0
  8. package/bin/lib/port-proof.mjs +309 -0
  9. package/bin/lib/prepare-write.mjs +130 -0
  10. package/bin/lib/remediation.mjs +21 -0
  11. package/dist/index.cjs +13 -4
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +1 -1
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.js +13 -4
  16. package/dist/index.js.map +1 -1
  17. package/dist/nestjs/index.cjs +1 -1
  18. package/dist/nestjs/index.cjs.map +1 -1
  19. package/dist/nestjs/index.js +1 -1
  20. package/dist/nestjs/index.js.map +1 -1
  21. package/dist/runtime/index.cjs +13 -4
  22. package/dist/runtime/index.cjs.map +1 -1
  23. package/dist/runtime/index.js +13 -4
  24. package/dist/runtime/index.js.map +1 -1
  25. package/docs/agent-guide.md +14 -0
  26. package/docs/ai-gates.md +43 -3
  27. package/docs/enthusiast/how-to-agent-gates.md +8 -0
  28. package/docs/enthusiast/reference-commands.md +1 -1
  29. package/package.json +2 -1
  30. package/server.json +2 -2
  31. package/templates/skills/ark-adopt.md +57 -10
  32. package/templates/skills/ark-architect.md +33 -2
  33. package/templates/skills/ark-autopilot.md +75 -20
  34. package/templates/skills/ark-contract.md +36 -0
  35. package/templates/skills/ark-coverage.md +81 -27
  36. package/templates/skills/ark-explain.md +35 -2
  37. package/templates/skills/ark-explore.md +119 -0
  38. package/templates/skills/ark-fix.md +47 -2
  39. package/templates/skills/ark-loop.md +50 -3
  40. package/templates/skills/ark-place.md +36 -0
  41. package/templates/skills/ark-runtime.md +36 -0
  42. package/templates/skills/ark-think.md +63 -12
  43. package/templates/skills/ark-upgrade.md +33 -1
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ark-think
3
- description: "Host-side architectural reasoning within the Ark contract trade-offs, evolution, design options. No gate bypass. No package LLM call."
3
+ description: "Host-side architectural reasoning exploratory options from real code + contract, trade-offs, evolution paths. No gate bypass. No package LLM call."
4
4
  ---
5
5
 
6
6
  # /ark-think — Architectural reasoning (host LLM only)
@@ -9,35 +9,86 @@ You are the user's architecture thinking partner **inside** the project's Ark co
9
9
  This skill does **not** call any LLM API from the arkgate package. **You** (the host agent)
10
10
  reason; the write-gate and CI remain deterministic.
11
11
 
12
+
13
+ ## Dual engine (mandatory)
14
+
15
+ | Engine | Role |
16
+ |--------|------|
17
+ | **Deterministic** | What the contract and doctor *prove* today (layers, rules, governed%, gaps) |
18
+ | **Exploratory** | What *this* codebase wants to become — options grounded in files you open |
19
+
20
+ Never reason only from abstract hexagons. Open real modules before recommending a shape.
21
+
22
+
23
+ ## Subagent fan-out (optional, host-dependent)
24
+
25
+ When the user asks to go faster **or** the work naturally splits (multiple packages,
26
+ feature dirs, plan clusters), you **may** dispatch **subagents**:
27
+
28
+ | Host capability | Behavior |
29
+ |-----------------|----------|
30
+ | **Parallel subagents supported** (e.g. multi-agent / `spawn_subagent` / concurrent Agent tools) | Launch **2–N** agents in **one wave** with **disjoint path scopes**. Prefer **read-only** explore agents for mapping; at most **one writer** unless the host gives isolated worktrees. Parent merges findings, then runs `ark-check` once. |
31
+ | **Not supported** (single agent only) | **Fall back to sequential** — same checklist, one cluster/step at a time. Never claim parallel work you did not run. |
32
+
33
+ **Rules:**
34
+ 1. Give each subagent a **tight brief**: paths in scope, sensor commands allowed, deliverable shape (paths opened + findings JSON or bullets).
35
+ 2. **No shared mutable files** across parallel writers.
36
+ 3. STOP handoffs and dual-engine rules still apply in every agent.
37
+ 4. Parent owns the **### Completion** block (union of **Opened**, single **Handoff**).
38
+ 5. Do **not** use subagents to weaken the gate or invent `mechanical-safe` kinds.
39
+
12
40
  ## When to use
13
41
 
14
42
  - Design trade-offs before writing code
15
- - "Should this be a new layer or a feature slice?"
43
+ - Should this be a new layer or a feature slice?”
16
44
  - Evolving brownfield layout toward a named preset
17
45
  - Explaining why a peerIsolation or layer rule exists
46
+ - Choosing among 2–3 enforceable futures (not infinite diagrams)
18
47
 
19
48
  ## Steps
20
49
 
21
50
  1. **Load the contract** — `ark.config.json`, MCP `ark://manifest` if available, and
22
- `ark-check --coverage --json` / `--doctor` for honesty about governed%.
23
- 2. **Name the active shape** — which preset/archetype fits (hexagonal, vertical-slice,
24
- ddd-bounded-contexts, feature-sliced, monorepo, ). If none, run `--recommend --json`.
25
- 3. **Reason within bounds** — propose options that **stay enforceable** by the gate.
51
+ `ark-check --coverage --json` / `--doctor` for honesty about governed% and false-green.
52
+ 2. **Touch the product** — README + **≥5 source files** on the decision surface (the feature,
53
+ package, or boundary under discussion). Name paths in the answer.
54
+ 3. **Name the active shape** — which preset/archetype fits (hexagonal, vertical-slice,
55
+ ddd-bounded-contexts, feature-sliced, monorepo, …). If none, run `--recommend --json`
56
+ **and** say whether detection matches the tree you opened.
57
+ 4. **Reason within bounds** — propose options that **stay enforceable** by the gate.
26
58
  Prefer concrete paths and import rules over abstract diagrams.
27
- 4. **Surface hard lines** — never suggest: weakening `ark.config.json` to pass, silent
59
+ 5. **Explore alternatives** — for each option: coupling, testability, **AI-agent safety**
60
+ (will write-gate + skills keep humans honest?), migration cost.
61
+ 6. **Surface hard lines** — never suggest: weakening `ark.config.json` to pass, silent
28
62
  judgment auto-apply, codemod engines, or skipping write-gate/CI.
29
- 5. **Hand off** — for placement use `/ark-place`; for config edits `/ark-contract`; for
30
- bulk debt `/ark-loop` / `/ark-autopilot`; for violations `/ark-fix`.
63
+ 7. **Hand off** — placement `/ark-place`; config `/ark-contract`; bulk debt `/ark-loop` /
64
+ `/ark-autopilot`; map-only `/ark-explore`; violations `/ark-fix`.
65
+ When the user needs action not advice: **STOP — do not continue this skill as complete** — invoke the handoff skill.
31
66
 
32
67
  ## Output format
33
68
 
34
- - **Context:** 2–3 sentences on current contract + shape
35
- - **Options:** 2–3 alternatives with trade-offs (coupling, testability, AI-agent safety)
36
- - **Recommendation:** one option + why it is enforceable today
69
+ - **Context:** product + contract + what you opened (paths)
70
+ - **Options:** 2–3 alternatives with trade-offs (coupling, testability, agent safety, enforceability)
71
+ - **Recommendation:** one option + why it is enforceable **today**
72
+ - **Risks if we pick wrong:** one sentence user-visible impact
37
73
  - **Next command:** exact `ark-check` / skill to run next
38
74
 
39
75
  ## Related
40
76
 
41
77
  - Greenfield shape: `/ark-architect`
42
78
  - Brownfield: `/ark-adopt`
79
+ - Full recon: `/ark-explore`
43
80
  - Explain existing: `/ark-explain`
81
+
82
+ ## Completion contract (skill incomplete if missing)
83
+
84
+ End with **exactly** these headings (markdown `###`):
85
+
86
+ ### Completion
87
+ - **Sensor:** commands/tools run
88
+ - **Opened:** real paths read (or `n/a` only if pure install/upgrade with no source analysis)
89
+ - **Result:** one-line outcome
90
+ - **Handoff:** `/ark-…` / CLI / `none`
91
+ - **Incomplete?** `no` | `yes — <what is missing>`
92
+
93
+ If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
94
+ **Skill incomplete if missing** any of the bullets above.
@@ -38,6 +38,23 @@ read the **Adoption** section — host gaps, Codex home temp paths, optional-but
38
38
  core layers, missing origin snapshot, baseline policy. Fix commands are printed per gap.
39
39
  HTML reports include the same Adoption card (separate from the 0–100 fitness score).
40
40
 
41
+ ## Dual engine (mandatory)
42
+
43
+ | Engine | Role |
44
+ |--------|------|
45
+ | **Deterministic** | CLI / MCP / contract sensors — exit codes, plan kinds, coverage numbers, install status |
46
+ | **Exploratory** | You open **this** repo's real files and product surface before concluding |
47
+
48
+ The CLI is a **sensor**, never the whole job. Claiming done without the exploratory bar for this skill is **incomplete**.
49
+
50
+
51
+ ## Subagent fan-out (optional, host-dependent)
52
+
53
+ If the host supports **parallel subagents** and the task splits cleanly (e.g. multiple
54
+ dirs to sample), fan out read-only scouts; otherwise **fall back to sequential**.
55
+ Parent merges and still emits the **### Completion** contract. Never parallel-write
56
+ the same files or weaken the gate.
57
+
41
58
  ## Fast path
42
59
 
43
60
  One command does the whole flow — update the package, refresh gates + `/ark-*` skills
@@ -113,7 +130,8 @@ npx arkgate-check --install-agent-gates --skills-only --force
113
130
  4. **Re-verify** — `ark-check --root . --config ark.config.json
114
131
  --strict-config` (with `--baseline .ark-baseline.json` if present). A new
115
132
  version may detect violations the old one missed: if new violations appear,
116
- apply `/ark-fix` reasoning to resolve them. If they are too numerous to fix
133
+ **STOP do not continue this skill as complete.** **STOP bulk residual debt: invoke /ark-loop or /ark-autopilot**
134
+ (or `/ark-fix` for a small set). If they are too numerous to fix
117
135
  now, freezing them in the baseline (`--update-baseline`) is a valid stopgap
118
136
  but it silences NEW violations, so it requires explicit user approval first
119
137
  — never regenerate the baseline on your own to get a green check.
@@ -142,3 +160,17 @@ End with a passing check. Report: latest published version, old → new version
142
160
  (or "already latest"), changelog entries that mattered here (plain language),
143
161
  files written/refreshed per tool, skipped customized files needing a manual
144
162
  look, and the final check status.
163
+
164
+ ## Completion contract (skill incomplete if missing)
165
+
166
+ End with **exactly** these headings (markdown `###`):
167
+
168
+ ### Completion
169
+ - **Sensor:** commands/tools run
170
+ - **Opened:** real paths read (or `n/a` only if pure install/upgrade with no source analysis)
171
+ - **Result:** one-line outcome
172
+ - **Handoff:** `/ark-…` / CLI / `none`
173
+ - **Incomplete?** `no` | `yes — <what is missing>`
174
+
175
+ If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
176
+ **Skill incomplete if missing** any of the bullets above.