arkgate 4.5.0 → 4.5.6

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 (48) hide show
  1. package/CHANGELOG.md +69 -2
  2. package/README.md +5 -4
  3. package/bin/ark-check-runtime.mjs +4 -0
  4. package/bin/ark-mcp-runtime.mjs +49 -0
  5. package/bin/ark-shared.mjs +8 -29
  6. package/bin/ark.mjs +7 -3
  7. package/bin/lib/adapter-contract.mjs +5 -5
  8. package/bin/lib/analysis-engine.mjs +1 -1
  9. package/bin/lib/ci-and-commands.mjs +5 -0
  10. package/bin/lib/deep-module-coach.mjs +177 -0
  11. package/bin/lib/deepening-coach.mjs +177 -0
  12. package/bin/lib/doctor-plan.mjs +14 -0
  13. package/bin/lib/html-report-advisories.mjs +33 -0
  14. package/bin/lib/html-report-depth.mjs +9 -0
  15. package/bin/lib/managed-upgrade.mjs +215 -1
  16. package/bin/lib/remediation.mjs +5 -5
  17. package/bin/lib/rules-inventory.mjs +23 -0
  18. package/bin/lib/upgrade-command.mjs +132 -11
  19. package/bin/lib/upgrade-package-decision.mjs +241 -0
  20. package/bin/lib/upgrade-whats-new.mjs +135 -0
  21. package/dist/eslint/index.cjs +1 -1
  22. package/dist/eslint/index.js +1 -1
  23. package/dist/index.cjs +27 -27
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.js +29 -29
  26. package/docs/README.md +4 -5
  27. package/docs/agent-guide.md +36 -0
  28. package/docs/brownfield-adoption.md +12 -0
  29. package/docs/package-surface.md +6 -3
  30. package/docs/product-voice.md +21 -0
  31. package/docs/use.md +3 -0
  32. package/package.json +1 -1
  33. package/server.json +2 -2
  34. package/templates/agent-skills/README.md +2 -2
  35. package/templates/agent-skills/ark-adopt/SKILL.md +13 -0
  36. package/templates/agent-skills/ark-explore/SKILL.md +21 -0
  37. package/templates/agent-skills/ark-fix/SKILL.md +7 -0
  38. package/templates/agent-skills/ark-loop/SKILL.md +7 -0
  39. package/templates/agent-skills/ark-place/SKILL.md +7 -0
  40. package/templates/agent-skills/ark-think/SKILL.md +7 -0
  41. package/templates/agent-skills/ark-upgrade/SKILL.md +61 -15
  42. package/templates/skills/ark-adopt.md +13 -0
  43. package/templates/skills/ark-explore.md +21 -0
  44. package/templates/skills/ark-fix.md +7 -0
  45. package/templates/skills/ark-loop.md +7 -0
  46. package/templates/skills/ark-place.md +7 -0
  47. package/templates/skills/ark-think.md +7 -0
  48. package/templates/skills/ark-upgrade.md +61 -15
@@ -28,6 +28,12 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
28
28
 
29
29
  **2–3 options labeled by lens impact** (what residual improves / what stays out-of-scope).
30
30
 
31
+ ## Deep modules (process)
32
+
33
+ - Prefer **deep modules** (small interface, hidden complexity). Never invent a depth score.
34
+ - Label the **seam** on each option that introduces a port/adapter; apply the **deletion test** before pass-through extracts “for testability.”
35
+ - Recommend tests **at the public interface** of the chosen seam.
36
+
31
37
  ## When / not when
32
38
 
33
39
  | Use `/ark-think` when… | Do **not** use it when… |
@@ -146,6 +152,7 @@ End with **exactly** these headings (markdown `###`):
146
152
  - **Result:** one-line outcome
147
153
  - **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
148
154
  - **Compass:** top residual lenses | `n/a`
155
+ - **Done axes:** architecture residual (status/doctor/compass) | feature/ticket residual (outside package). Enforce green ≠ feature done
149
156
  - **Handoff:** `/ark-…` / CLI / `none`
150
157
  - **Incomplete?** `no` | `yes — <what is missing>`
151
158
 
@@ -32,6 +32,38 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
32
32
 
33
33
  **After upgrade:** refresh projection; re-doctor; compass residual still drives process, not scores.
34
34
 
35
+ ## Suggested improvements (what to try next)
36
+
37
+ After `ark upgrade` (preview or apply), read JSON **`whatsNew`** or the human **Suggested improvements**
38
+ block (also on preview when nothing to apply). It lists concrete try/inspect actions for this package
39
+ line (advisory only — not a score):
40
+
41
+ 1. **Deep-module coach** — `ark-check --doctor` → `doctor.deepModuleCoach` (hot paths + deepening)
42
+ 2. **Improvement compass** — residual lenses on doctor/HTML (not a score)
43
+ 3. **Session recipe** — `ark status --json` honesty modes; doctor when mode is not full
44
+ 4. **Two-axis done** — architecture residual vs feature/ticket residual (Enforce green ≠ feature done)
45
+ 5. **Self-service honesty** — upgrade `selfService` write-path labels + customized preserve
46
+ 6. **Registry-aware upgrade** — `reasonCode` / `suggestedInstallCmd` when package install is skipped or needed
47
+ 7. **Skill drift + refresh** — `skillDrift`; opt-in `--refresh-skills` for customized skill rewrite
48
+ 8. **Multi-project MCP** — `processPackage` mismatch/stale on every MCP tool; restart after package bump
49
+
50
+ Never invent gate verdicts from these suggestions. Missing residual is honest empty, not green.
51
+
52
+ ## Field truth (package install + skills + multi-project MCP)
53
+
54
+ | Situation | Honest product behavior |
55
+ |-----------|-------------------------|
56
+ | CLI version == `node_modules` but npm registry is ahead | `--apply` **installs** (does not false-skip). Inspect `reasonCode: BEHIND_REGISTRY`. |
57
+ | Offline / `npm view` failed | May skip with `REGISTRY_UNAVAILABLE` + `suggestedInstallCmd` — do not invent a version. |
58
+ | Skills customized after install | Preserved by default. Preview `skillDrift` shows counts. **`--refresh-skills`** rewrites customized *skills* only with consent. |
59
+ | Conflicted managed assets | Still need `--accept-conflicts`. Never silent overwrite of true edits. |
60
+ | Multiple checkouts / monorepo packages | One `expectedRoot` per project; upgrade **each** pin; restart MCP after bump; prefer project-local CLI until identity matched **and** process version aligns. |
61
+ | Active host not in `--tools` / manifest | Preview `hostSelection` notes it and suggests `--tools` expansion. |
62
+
63
+ **Post-apply:** read `postUpgradeChecks` (advisory). Confirm pin↔CLI, run doctor (compass + deepModuleCoach),
64
+ `agents-md --check`, `ark status --json`, and MCP version note if MCP was used.
65
+
66
+
35
67
  ## Dual engine (mandatory)
36
68
 
37
69
  Use the semantic sensor (`ark-check --doctor --json` plus the strict contract
@@ -48,6 +80,11 @@ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedP
48
80
  uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
49
81
  restart/retargeting is required. `ark://manifest` never satisfies this preflight.
50
82
 
83
+ **Process package honesty:** every tool response includes `processPackage` (`processArkgateVersion`,
84
+ `projectInstalledVersion`, `processPackageMismatch` / `processStale`, `nextAction`). After
85
+ `npm install arkgate@…`, **restart/retarget MCP** so process version matches install. Until then,
86
+ prefer project-local CLI and do not treat MCP analysis as fully current.
87
+
51
88
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
52
89
 
53
90
  ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
@@ -97,8 +134,8 @@ ArkGate has **two opt-in planes**. The user chooses which to use; you **always l
97
134
  | `current` | Content identity matches the candidate. | Record/adopt safely; metadata-only stamps may refresh. |
98
135
  | `stale` | Recorded managed content still matches its old identity. | Safe candidate replacement. |
99
136
  | `missing` | Candidate is absent. | Create if new; require consent if a recorded asset was deleted. |
100
- | `customized` | User content diverged without a competing managed base. | Preserve it. |
101
- | `conflicted` | Both managed base and user content diverged. | Preserve and require explicit consent. |
137
+ | `customized` | User content diverged without a competing managed base. | Preserve it. Opt-in rewrite for **skills only**: `--refresh-skills`. |
138
+ | `conflicted` | Both managed base and user content diverged. | Preserve and require explicit consent (`--accept-conflicts`). |
102
139
  | `retired` | A recorded asset is no longer selected by the candidate. | Preserve its file and manifest identity; take no action. |
103
140
 
104
141
  ## Procedure
@@ -158,16 +195,18 @@ ArkGate has **two opt-in planes**. The user chooses which to use; you **always l
158
195
  that customized files remain non-applying and that any deletion/conflict is
159
196
  blocked.
160
197
 
161
- 3. **Update and re-preview.** If the registry is newer, run (project-local CLI):
198
+ 3. **Update and re-preview.** If the registry is newer **or** CLI == pin but registry is ahead
199
+ (field false-skip is fixed), run (project-local CLI):
162
200
 
163
201
  ```bash
164
202
  npx arkgate upgrade --apply
165
203
  ```
166
204
 
167
- This updates through the detected package manager and hands control to the new
168
- package for a fresh preview. Review that new preview; do not assume the old
169
- candidate and new candidate are identical. If already on the latest package,
170
- retain the current read-only preview.
205
+ This updates through the detected package manager (registry-aware) and hands control to the new
206
+ package for a fresh preview. On skip, read `reasonCode` / `suggestedInstallCmd` agents must not
207
+ invent recovery. Review the new preview; do not assume old and new candidates are identical.
208
+ If already current (`ALREADY_CURRENT`), retain the read-only preview and still read `whatsNew`
209
+ + `skillDrift`.
171
210
 
172
211
  For pnpm repositories with `minimumReleaseAge`, use the repository's existing
173
212
  trusted first-party exception mechanism when the new release is still cooling
@@ -185,18 +224,25 @@ ArkGate has **two opt-in planes**. The user chooses which to use; you **always l
185
224
  ```
186
225
 
187
226
  If recorded deletion/conflict recovery is desired, ask first and then add
188
- `--accept-conflicts`. Never add it merely to make the run green. Run a second
189
- preview and require `summary.changed: 0`.
227
+ `--accept-conflicts`. Never add it merely to make the run green.
228
+
229
+ If customized **skills** should match package templates after pin bump, ask first and add
230
+ `--refresh-skills` on the digest-bound apply (or a new preview that includes the flag). Never
231
+ add it merely to make the run green. Run a second preview and require `summary.changed: 0`
232
+ (unless more deliberate refreshes remain).
190
233
 
191
- 5. **Verify enforcement and architecture.** Run
234
+ 5. **Verify enforcement and architecture (post-upgrade checks).** Read apply JSON
235
+ `postUpgradeChecks` when present. Also run:
192
236
  `npx arkgate-check --doctor --json` (or the project-local `ark-check`) and
193
237
  the same fail-closed architecture command used by managed apply (normally
194
238
  `npx arkgate-check --root . --config ark.config.json --strict-merge --json`).
195
- Require `completeness: "complete"` and `ok: true`. Treat provider-unavailable CI
196
- required-check evidence as `unverified`, never as proof that merges are
197
- blocked. If new violations appear, hand off to `/ark-fix` for a small set or
198
- `/ark-loop` / `/ark-autopilot` for residual debt; do not regenerate a baseline
199
- without explicit approval.
239
+ Require `completeness: "complete"` and `ok: true`. Confirm `doctor.improvementCompass` and
240
+ `doctor.deepModuleCoach` honesty. Run `npx arkgate agents-md --check` and
241
+ `npx arkgate status --json`. If MCP was used, restart MCP after package bump and re-bind
242
+ identity. Treat provider-unavailable CI required-check evidence as `unverified`, never as proof
243
+ that merges are blocked. If new violations appear, hand off to `/ark-fix` for a small set or
244
+ `/ark-loop` / `/ark-autopilot` for residual debt; do not regenerate a baseline without explicit
245
+ approval.
200
246
 
201
247
  ## Active host vs deferred hosts
202
248