arkgate 4.8.20 → 4.8.21

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 (75) hide show
  1. package/CHANGELOG.md +124 -5
  2. package/README.md +107 -117
  3. package/bin/ark-check-runtime.mjs +3 -4
  4. package/bin/ark-layer-match.mjs +110 -18
  5. package/bin/lib/analysis-engine.mjs +13 -6
  6. package/bin/lib/config-contract.mjs +5 -0
  7. package/bin/lib/diagnostic-catalog.mjs +1 -0
  8. package/bin/lib/doctor-advisories.mjs +20 -0
  9. package/bin/lib/doctor-human.mjs +11 -9
  10. package/bin/lib/doctor-plan.mjs +15 -14
  11. package/bin/lib/first-run-help.mjs +7 -1
  12. package/bin/lib/html-report-advisories.mjs +8 -0
  13. package/bin/lib/html-report-depth.mjs +9 -8
  14. package/bin/lib/invariant-coverage.mjs +396 -75
  15. package/bin/lib/managed-upgrade.mjs +59 -14
  16. package/bin/lib/pilot-loop.mjs +183 -37
  17. package/bin/lib/upgrade-behavior-changes.mjs +83 -0
  18. package/bin/lib/upgrade-command.mjs +69 -31
  19. package/bin/lib/upgrade-outcome.mjs +359 -0
  20. package/bin/lib/violations.mjs +109 -0
  21. package/dist/{configTypes-VVknqcTJ.d.ts → configTypes-CTELo87-.d.ts} +7 -0
  22. package/dist/{diagnosticCatalog-BPYWNyJR.d.ts → diagnosticCatalog-B7BXlet6.d.ts} +73 -5
  23. package/dist/eslint/index.cjs +4 -4
  24. package/dist/eslint/index.d.ts +26 -3
  25. package/dist/eslint/index.js +4 -4
  26. package/dist/index.cjs +24 -17
  27. package/dist/index.d.ts +9 -4
  28. package/dist/index.js +25 -18
  29. package/dist/nestjs/index.cjs +9 -9
  30. package/dist/nestjs/index.d.ts +3 -3
  31. package/dist/nestjs/index.js +9 -9
  32. package/dist/runtime/index.cjs +18 -11
  33. package/dist/runtime/index.d.ts +6 -6
  34. package/dist/runtime/index.js +18 -11
  35. package/dist/{types-p_fCp6P-.d.ts → types-fQ9-KrBj.d.ts} +1 -1
  36. package/dist/{types-Cs-46DRu.d.ts → types-yDNEQ603.d.ts} +1 -1
  37. package/docs/README.md +4 -3
  38. package/docs/agent-guide.md +15 -7
  39. package/docs/brownfield-adoption.md +4 -3
  40. package/docs/configuration.md +34 -11
  41. package/docs/diagnostics.md +12 -2
  42. package/docs/package-surface.md +3 -2
  43. package/docs/product-voice.md +11 -3
  44. package/package.json +1 -1
  45. package/schemas/ark.config.schema.json +8 -0
  46. package/server.json +2 -2
  47. package/templates/agent-skills/README.md +1 -1
  48. package/templates/agent-skills/ark-adopt/SKILL.md +5 -2
  49. package/templates/agent-skills/ark-architect/SKILL.md +2 -0
  50. package/templates/agent-skills/ark-autopilot/SKILL.md +6 -4
  51. package/templates/agent-skills/ark-contract/SKILL.md +2 -0
  52. package/templates/agent-skills/ark-coverage/SKILL.md +2 -0
  53. package/templates/agent-skills/ark-explain/SKILL.md +2 -0
  54. package/templates/agent-skills/ark-explore/SKILL.md +4 -2
  55. package/templates/agent-skills/ark-fix/SKILL.md +2 -0
  56. package/templates/agent-skills/ark-loop/SKILL.md +2 -0
  57. package/templates/agent-skills/ark-order/SKILL.md +2 -0
  58. package/templates/agent-skills/ark-place/SKILL.md +2 -0
  59. package/templates/agent-skills/ark-runtime/SKILL.md +2 -0
  60. package/templates/agent-skills/ark-think/SKILL.md +2 -0
  61. package/templates/agent-skills/ark-upgrade/SKILL.md +20 -7
  62. package/templates/skills/ark-adopt.md +5 -2
  63. package/templates/skills/ark-architect.md +2 -0
  64. package/templates/skills/ark-autopilot.md +6 -4
  65. package/templates/skills/ark-contract.md +2 -0
  66. package/templates/skills/ark-coverage.md +2 -0
  67. package/templates/skills/ark-explain.md +2 -0
  68. package/templates/skills/ark-explore.md +4 -2
  69. package/templates/skills/ark-fix.md +2 -0
  70. package/templates/skills/ark-loop.md +2 -0
  71. package/templates/skills/ark-order.md +2 -0
  72. package/templates/skills/ark-place.md +2 -0
  73. package/templates/skills/ark-runtime.md +2 -0
  74. package/templates/skills/ark-think.md +2 -0
  75. package/templates/skills/ark-upgrade.md +20 -7
@@ -366,8 +366,9 @@ Ark protects the **boundary around** a framework, not its internals. Nest/DI pub
366
366
  `sliceFolders`: a bare name stays an unanchored one-segment match (`features` on
367
367
  `src/lib/features/projects/rfi/x.ts` is `features/projects`); a filename is never the
368
368
  child segment. A starred prefix (`lib/features/*/*`) is anchored like `sharedRoots`
369
- (offset 0 or 1) and the slice id is the directories the stars bind
370
- (`lib/features/projects/rfi`). Before trusting green, add one deliberate
369
+ (offset 0 or 1). The slice id includes the literal prefix plus the directories
370
+ the stars bind (`lib/features/projects/rfi`), so parallel trees get different ids
371
+ (tracked in #308). Before trusting green, add one deliberate
371
372
  feature-to-feature import and expect `cross-slice`.
372
373
  If one edge dominates residual debt: **STOP — do not continue this skill as complete.** **STOP — concentrated edge:** rewrite `ark.config.json` **in this turn** with source evidence (do not freeze a wrong config or grind N freezes).
373
374
  Empty Domain/Persistence + I/O under Application → false-green.
@@ -437,5 +438,7 @@ End with **exactly** these headings (markdown `###`):
437
438
  - **Handoff:** `/ark-…` / CLI / `none`
438
439
  - **Incomplete?** `no` | `yes — <what is missing>`
439
440
 
441
+ When `doctor.productHonesty.finished` is `false`, **Incomplete? no** is disallowed. Write `yes — <pilotLoop.extractionCard.move or residual>`.
442
+
440
443
  If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
441
444
  **Skill incomplete if missing** any of the bullets above.
@@ -59,3 +59,5 @@ Skill incomplete if missing any field below.
59
59
  - **Compass:** top residual lenses | `n/a`
60
60
  - **Handoff:** `/ark-adopt` / `/ark-place` / `none`
61
61
  - **Incomplete?** `no` | `yes — <what is missing>`
62
+
63
+ When `doctor.productHonesty.finished` is `false`, **Incomplete? no** is disallowed. Write `yes — <pilotLoop.extractionCard.move or residual>`.
@@ -110,10 +110,10 @@ decision-grade explore pass **and** without opening violating files.
110
110
  layout — no pilot”; never reconstruct that dead card from `findings`. When the user accepts,
111
111
  defers, or rejects a live card, persist its exact `decisionTarget` with a non-empty reason and
112
112
  optional `reviewBy` in `.ark/reshape-decisions.json`; never infer a verdict from golden prose.
113
- A cohesion residual starts one reshape judgment card, not the pattern-bet apply loop.
114
- `pilotLoop` stays inactive (`not-design-weak`) unless the tree is design-weak.
115
-
116
-
113
+ A cohesion residual starts **one** reshape judgment card on `pilotLoop.nextPilot`
114
+ (one pilot, then re-doctor). The loop is active when a pilot candidate exists,
115
+ including that reshape card when the tree is not design-weak. It does not start
116
+ a pattern-bet batch.
117
117
 
118
118
  ## MCP workspace binding (mandatory)
119
119
 
@@ -308,5 +308,7 @@ End with **exactly** these headings (markdown `###`):
308
308
  - **Handoff:** `/ark-…` / CLI / `none`
309
309
  - **Incomplete?** `no` | `yes — <what is missing>`
310
310
 
311
+ When `doctor.productHonesty.finished` is `false`, **Incomplete? no** is disallowed. Write `yes — <pilotLoop.extractionCard.move or residual>`.
312
+
311
313
  If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
312
314
  **Skill incomplete if missing** any of the bullets above.
@@ -64,3 +64,5 @@ Skill incomplete if missing any field below.
64
64
  - **Compass:** top residual lenses | `n/a`
65
65
  - **Handoff:** `/ark-adopt` / `/ark-autopilot` / `/ark-order` / `none`
66
66
  - **Incomplete?** `no` | `yes — <what is missing>`
67
+
68
+ When `doctor.productHonesty.finished` is `false`, **Incomplete? no** is disallowed. Write `yes — <pilotLoop.extractionCard.move or residual>`.
@@ -200,5 +200,7 @@ End with **exactly** these headings (markdown `###`):
200
200
  - **Handoff:** `/ark-…` / CLI / `none`
201
201
  - **Incomplete?** `no` | `yes — <what is missing>`
202
202
 
203
+ When `doctor.productHonesty.finished` is `false`, **Incomplete? no** is disallowed. Write `yes — <pilotLoop.extractionCard.move or residual>`.
204
+
203
205
  If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
204
206
  **Skill incomplete if missing** any of the bullets above.
@@ -244,6 +244,8 @@ End with **exactly** these headings (markdown `###`):
244
244
  - **Handoff:** `/ark-…` / CLI / `none`
245
245
  - **Incomplete?** `no` | `yes — <what is missing>`
246
246
 
247
+ When `doctor.productHonesty.finished` is `false`, **Incomplete? no** is disallowed. Write `yes — <pilotLoop.extractionCard.move or residual>`.
248
+
247
249
  Prefer **Incomplete?** `yes` if the showcase report was generated but the browser-open step was
248
250
  skipped without CI/headless/user-opt-out reason.
249
251
 
@@ -355,8 +355,8 @@ stays in the same layer and the same slice id. If no governed destination keeps
355
355
  `nextPilot` is null — do not invent a folder outside the contract. Success is a smaller
356
356
  cluster with the layer and slice id unchanged and the card still proposed; a green gate is
357
357
  not success. A cohesion residual (`physical-cohesion-residual`) starts that one reshape
358
- judgment card. It does not start the pattern-bet apply loop — `pilotLoop` stays inactive
359
- while design-weak is false.
358
+ judgment card as `pilotLoop.nextPilot`. It does not start the pattern-bet apply
359
+ loop. Apply that one card, then re-doctor.
360
360
 
361
361
  ### C. Coupling & debt (measure, don’t guess)
362
362
  Prefer evidence over aesthetics:
@@ -534,5 +534,7 @@ End with **exactly** these headings (markdown `###`):
534
534
  - **Handoff:** `/ark-…` / CLI / `none`
535
535
  - **Incomplete?** `no` | `yes — <what is missing>`
536
536
 
537
+ When `doctor.productHonesty.finished` is `false`, **Incomplete? no** is disallowed. Write `yes — <pilotLoop.extractionCard.move or residual>`.
538
+
537
539
  If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
538
540
  **Skill incomplete if missing** any of the bullets above.
@@ -82,3 +82,5 @@ Skill incomplete if missing any field below.
82
82
  - **Compass:** top residual lenses | `n/a`
83
83
  - **Handoff:** `/ark-autopilot` / `/ark-adopt` / `none`
84
84
  - **Incomplete?** `no` | `yes — <what is missing>`
85
+
86
+ When `doctor.productHonesty.finished` is `false`, **Incomplete? no** is disallowed. Write `yes — <pilotLoop.extractionCard.move or residual>`.
@@ -77,3 +77,5 @@ Skill incomplete if missing any field below.
77
77
  - **Compass:** top residual lenses | `n/a`
78
78
  - **Handoff:** `/ark-autopilot` / `/ark-explore` / `none`
79
79
  - **Incomplete?** `no` | `yes — <what is missing>`
80
+
81
+ When `doctor.productHonesty.finished` is `false`, **Incomplete? no** is disallowed. Write `yes — <pilotLoop.extractionCard.move or residual>`.
@@ -196,5 +196,7 @@ End with **exactly** these headings (markdown `###`):
196
196
  - **Handoff:** `/ark-…` / CLI / `none`
197
197
  - **Incomplete?** `no` | `yes — <what is missing>`
198
198
 
199
+ When `doctor.productHonesty.finished` is `false`, **Incomplete? no** is disallowed. Write `yes — <pilotLoop.extractionCard.move or residual>`.
200
+
199
201
  If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
200
202
  **Skill incomplete if missing** any of the bullets above.
@@ -317,5 +317,7 @@ End with **exactly** these headings (markdown `###`):
317
317
  - **Handoff:** `/ark-…` / CLI / `none`
318
318
  - **Incomplete?** `no` | `yes — <what is missing>`
319
319
 
320
+ When `doctor.productHonesty.finished` is `false`, **Incomplete? no** is disallowed. Write `yes — <pilotLoop.extractionCard.move or residual>`.
321
+
320
322
  If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
321
323
  **Skill incomplete if missing** any of the bullets above.
@@ -180,5 +180,7 @@ End with **exactly** these headings (markdown `###`):
180
180
  - **Handoff:** `/ark-…` / CLI / `none`
181
181
  - **Incomplete?** `no` | `yes — <what is missing>`
182
182
 
183
+ When `doctor.productHonesty.finished` is `false`, **Incomplete? no** is disallowed. Write `yes — <pilotLoop.extractionCard.move or residual>`.
184
+
183
185
  If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
184
186
  **Skill incomplete if missing** any of the bullets above.
@@ -66,3 +66,5 @@ Skill incomplete if missing any field below.
66
66
  - **Compass:** top residual lenses | `n/a`
67
67
  - **Handoff:** `/ark-explore` / `/ark-autopilot` / `none`
68
68
  - **Incomplete?** `no` | `yes — <what is missing>`
69
+
70
+ When `doctor.productHonesty.finished` is `false`, **Incomplete? no** is disallowed. Write `yes — <pilotLoop.extractionCard.move or residual>`.
@@ -40,6 +40,8 @@ Invoking this skill **is** the approval. Preview, then `--apply` **in this turn*
40
40
  Stopping at preview is incomplete unless the probe failed or a conflict needs
41
41
  `--accept-conflicts` / `--refresh-skills` consent.
42
42
 
43
+ If post-upgrade verification is red: **STOP**. Do not edit tests, titles, or config in the upgrade turn. Report `failing[]` and `behaviorChanges[]` and hand off. Incomplete? yes.
44
+
43
45
  For session 0, start with `/ark-adopt` (or `ark-check --recommend`); brownfield
44
46
  honesty is `/ark-adopt` before this upgrade flow.
45
47
 
@@ -171,7 +173,11 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
171
173
  `--plan-digest <sha256:…>` and applies only that exact candidate. A changed file
172
174
  or selection invalidates the digest instead of being overwritten.
173
175
  - Missing or conflicted assets previously recorded as managed require explicit
174
- `--accept-conflicts`. Stop and obtain user consent before using it.
176
+ `--accept-conflicts`, unless the missing file is gitignored (`absent-local`,
177
+ for example a per-machine `.mcp.json` in a fresh worktree). That file is
178
+ recreated without consent. Stop and obtain user consent before using
179
+ `--accept-conflicts` on a real deletion or conflict. Every blocked asset
180
+ carries `reason` and `nextCommand`.
175
181
  - Customized files are preserved. Unrelated source files and similar filenames
176
182
  are never adopted. The command never writes a Codex home or another global
177
183
  directory implicitly.
@@ -184,7 +190,8 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
184
190
  |---|---|---|
185
191
  | `current` | Content identity matches the candidate. | Record/adopt safely; metadata-only stamps may refresh. |
186
192
  | `stale` | Recorded managed content still matches its old identity. | Safe candidate replacement. |
187
- | `missing` | Candidate is absent. | Create if new; require consent if a recorded asset was deleted. |
193
+ | `missing` | Candidate is absent and is not a gitignored local file. | Create if new; require consent if a recorded asset was deleted. Read `reason` and `nextCommand`. |
194
+ | `absent-local` | Recorded file is missing and gitignored (per-machine file in a fresh worktree). | Recreate it. No consent. |
188
195
  | `customized` | User content diverged without a competing managed base. | Preserve it. Opt-in rewrite for **skills only**: `--refresh-skills`. |
189
196
  | `conflicted` | Both managed base and user content diverged. | Preserve and require explicit consent (`--accept-conflicts`). |
190
197
  | `retired` | A recorded asset is no longer selected by the candidate. | Preserve its file and manifest identity; take no action. |
@@ -285,16 +292,19 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
285
292
  (unless more deliberate refreshes remain).
286
293
 
287
294
  5. **Verify enforcement and architecture (post-upgrade checks).** Read apply JSON
288
- `postUpgradeChecks` when present. Also run:
295
+ `postUpgrade` (`verdict`, `failing`, `behaviorChanges`) and `postUpgradeChecks` when present.
296
+ Exit 3 means the files were applied and the architecture check is red. Also run:
289
297
  `npx arkgate-check --doctor --json` (or the project-local `ark-check`) and
290
298
  the same fail-closed architecture command used by managed apply (normally
291
299
  `npx arkgate-check --root . --config ark.config.json --strict-merge --json`).
292
- Require `completeness: "complete"` and `ok: true`. Confirm `doctor.improvementCompass` and
300
+ Require `completeness: "complete"` and `ok: true` before calling the upgrade done.
301
+ If post-upgrade verification is red: **STOP**. Do not edit tests, titles, or config in the upgrade turn. Report `failing[]` and `behaviorChanges[]` and hand off. Incomplete? yes.
302
+ Handoff is `/ark-autopilot` after the report; do not regenerate a baseline without
303
+ explicit approval. Confirm `doctor.improvementCompass` and
293
304
  `doctor.deepModuleCoach` honesty. Run `npx arkgate agents-md --check` and
294
305
  `npx arkgate status --json`. If MCP was used, restart MCP after package bump and re-bind
295
306
  identity. Treat provider-unavailable CI required-check evidence as `unverified`, never as proof
296
- that merges are blocked. If new violations appear, hand off to `/ark-autopilot`; do not regenerate a baseline without
297
- explicit approval.
307
+ that merges are blocked.
298
308
 
299
309
  ## Active host vs deferred hosts
300
310
 
@@ -332,5 +342,8 @@ End with exactly this structure:
332
342
  - **Handoff:** `/ark-…`, CLI action, or `none`
333
343
  - **Incomplete?** `no` or `yes — <missing work>`
334
344
 
345
+ When `doctor.productHonesty.finished` is `false`, **Incomplete? no** is disallowed. Write `yes — <pilotLoop.extractionCard.move or residual>`.
346
+
335
347
  If a required verification did not run or a conflict remains blocked, report the
336
- task incomplete. Deferred hosts (including Codex when inactive) never make Incomplete? yes.
348
+ task incomplete. If post-upgrade verification is red: **STOP**. Do not edit tests, titles, or config in the upgrade turn. Report `failing[]` and `behaviorChanges[]` and hand off. Incomplete? yes.
349
+ Deferred hosts (including Codex when inactive) never make Incomplete? yes.