arkgate 4.8.14 → 4.8.15

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 (97) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/README.md +13 -5
  3. package/bin/ark-check-runtime.mjs +17 -49
  4. package/bin/ark-mcp-runtime.mjs +111 -2
  5. package/bin/ark-shared.mjs +140 -11
  6. package/bin/ark.mjs +7 -25
  7. package/bin/lib/adr-presence.mjs +97 -0
  8. package/bin/lib/agent-skills-package.mjs +179 -1
  9. package/bin/lib/analysis-completeness.mjs +38 -2
  10. package/bin/lib/analysis-engine.mjs +6 -6
  11. package/bin/lib/architecture-scan.mjs +26 -4
  12. package/bin/lib/ark-run-doctor.mjs +6 -0
  13. package/bin/lib/ark-run-report.mjs +6 -2
  14. package/bin/lib/arkrules-sensors.mjs +81 -0
  15. package/bin/lib/baseline-key.mjs +4 -1
  16. package/bin/lib/check-args.mjs +52 -2
  17. package/bin/lib/config-contract.mjs +64 -1
  18. package/bin/lib/diagnostic-catalog.mjs +3 -1
  19. package/bin/lib/doctor-advisories.mjs +94 -10
  20. package/bin/lib/doctor-human.mjs +18 -5
  21. package/bin/lib/doctor-next-actions.mjs +14 -0
  22. package/bin/lib/doctor-plan.mjs +32 -2
  23. package/bin/lib/enforcement-honesty.mjs +47 -2
  24. package/bin/lib/first-run-help.mjs +8 -1
  25. package/bin/lib/host-support-matrix.mjs +9 -1
  26. package/bin/lib/html-report-depth.mjs +2 -0
  27. package/bin/lib/html-report.mjs +13 -2
  28. package/bin/lib/import-resolve.mjs +74 -13
  29. package/bin/lib/improvement-compass-doctor.mjs +6 -1
  30. package/bin/lib/improvement-compass-map.mjs +3 -1
  31. package/bin/lib/layer-description.mjs +90 -8
  32. package/bin/lib/mcp-hook-payload.mjs +56 -0
  33. package/bin/lib/no-domain-frontend.mjs +91 -0
  34. package/bin/lib/presets.mjs +3 -4
  35. package/bin/lib/product-copy.mjs +15 -0
  36. package/bin/lib/projected-governed-coverage.mjs +114 -0
  37. package/bin/lib/recommend-cli.mjs +54 -0
  38. package/bin/lib/remediation.mjs +4 -0
  39. package/bin/lib/resolved-candidate-facts.mjs +83 -66
  40. package/bin/lib/rules-under-contract.mjs +117 -2
  41. package/bin/lib/snippet-analysis.mjs +14 -8
  42. package/bin/lib/start-preview.mjs +5 -2
  43. package/bin/lib/states-transitions-presence.mjs +212 -0
  44. package/bin/lib/status-command.mjs +2 -0
  45. package/bin/lib/status-transition-catalog.mjs +410 -0
  46. package/bin/lib/team-parliament-io.mjs +10 -0
  47. package/bin/lib/violations.mjs +13 -1
  48. package/bin/lib/write-path-capabilities.mjs +20 -5
  49. package/bin/lib/write-path-detect.mjs +27 -2
  50. package/dist/{configTypes-j7so8B4O.d.ts → configTypes-Dt3DpVbd.d.ts} +19 -0
  51. package/dist/{diagnosticCatalog-DVx_2RmF.d.ts → diagnosticCatalog-BEg85XlE.d.ts} +3 -3
  52. package/dist/eslint/index.cjs +4 -4
  53. package/dist/eslint/index.d.ts +1 -1
  54. package/dist/eslint/index.js +4 -4
  55. package/dist/index.cjs +31 -31
  56. package/dist/index.d.ts +70 -9
  57. package/dist/index.js +31 -31
  58. package/dist/nestjs/index.cjs +5 -5
  59. package/dist/nestjs/index.d.ts +3 -3
  60. package/dist/nestjs/index.js +5 -5
  61. package/dist/runtime/index.cjs +15 -15
  62. package/dist/runtime/index.d.ts +6 -6
  63. package/dist/runtime/index.js +15 -15
  64. package/dist/{types-Djbs3KjE.d.ts → types-CN9tVMPz.d.ts} +3 -1
  65. package/dist/{types-tGhZUiGX.d.ts → types-TBiv0WHL.d.ts} +1 -1
  66. package/docs/README.md +1 -1
  67. package/docs/agent-guide.md +6 -4
  68. package/docs/ai-gates.md +10 -3
  69. package/docs/brownfield-adoption.md +4 -1
  70. package/docs/configuration.md +55 -7
  71. package/docs/develop.md +1 -0
  72. package/docs/diagnostics.md +23 -3
  73. package/docs/enthusiast/how-to-agent-gates.md +5 -0
  74. package/docs/enthusiast/how-to-pick-shape.md +1 -1
  75. package/docs/package-surface.md +7 -5
  76. package/docs/use.md +5 -0
  77. package/package.json +1 -1
  78. package/schemas/ark.config.schema.json +23 -2
  79. package/server.json +2 -2
  80. package/templates/agent-skills/README.md +1 -1
  81. package/templates/agent-skills/ark-adopt/SKILL.md +82 -1
  82. package/templates/agent-skills/ark-autopilot/SKILL.md +6 -2
  83. package/templates/agent-skills/ark-coverage/SKILL.md +1 -1
  84. package/templates/agent-skills/ark-explain/SKILL.md +4 -2
  85. package/templates/agent-skills/ark-explore/SKILL.md +14 -1
  86. package/templates/agent-skills/ark-place/SKILL.md +38 -3
  87. package/templates/agent-skills/ark-runtime/SKILL.md +4 -2
  88. package/templates/agent-skills/ark-upgrade/SKILL.md +1 -1
  89. package/templates/arkrules/DomainModel.json +14 -1
  90. package/templates/skills/ark-adopt.md +82 -1
  91. package/templates/skills/ark-autopilot.md +6 -2
  92. package/templates/skills/ark-coverage.md +1 -1
  93. package/templates/skills/ark-explain.md +4 -2
  94. package/templates/skills/ark-explore.md +14 -1
  95. package/templates/skills/ark-place.md +38 -3
  96. package/templates/skills/ark-runtime.md +4 -2
  97. package/templates/skills/ark-upgrade.md +1 -1
@@ -22,6 +22,18 @@ one bounded decision needs 2–3 enforceable options.
22
22
  ## Checklist
23
23
 
24
24
  - Doctor #1: if ENFORCE + empty plan A and gates are already installed → **Shape** (`/ark-explore` then `/ark-autopilot`). Do not say install-agent-gates.
25
+ - When `--require-gates` / adopted-strict is on and doctor JSON has `adrPresence`,
26
+ the next step is a short note under `docs/adr/` (or `docs/decisions/`). Soft.
27
+ Not every change. Off when require-gates is off. No `/ark-adr`.
28
+ - When doctor JSON has `statesTransitions` or `statusTransitionCatalog`, the
29
+ next step is a short states → transitions table (or one link) on the domain
30
+ doc already in play. Use catalog names when present. Soft. Silent when that
31
+ doc is absent or Domain has no status vocabulary. No `/ark-states`. Do not
32
+ invent states.
33
+ - When doctor JSON has `noDomainFrontend`, Domain is empty and the UI holds the
34
+ rules. Next: one Domain file (`/ark-place`) then one small refactor
35
+ (`/ark-autopilot`). Soft. Silent when there is no frontend or Domain already
36
+ has files. No `/ark-domain`. Do not invent a Domain house.
25
37
  - Distinguish **missing** skills vs **stale** catalog. Installed ≠ stale.
26
38
  - Hook green is not tree green (scripted edits bypass PreToolUse).
27
39
  - Bug / false green / false red / missing doc / improvable behavior **in ArkGate itself** → draft one upstream GitHub issue (`pedroknigge/arkgate` or the installed package `repository.url`), **ask the human to confirm send**, then `gh issue create`. Never auto-file. Never file ArkGate defects on the consumer product repo.
@@ -179,13 +191,14 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
179
191
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
180
192
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
181
193
  4. Editing `arkrules/*` or applying structure fixes is **`/ark-adopt`** / **`/ark-autopilot`** — explore does not write (never invent `mechanical-safe`).
182
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
194
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
183
195
  6. Never write `arkRun` or `arkOrder` from this skill. When extras are present, label residual **`[ArkRun]`** / **`[ArkOrder]`**. Wire one kernel candidate via `/ark-runtime`; one order-plane candidate via `/ark-order`. Do not invent `/ark-run`.
184
196
 
185
197
 
186
198
  ### Explore + ArkRules
187
199
  - Always run sensors for **both** planes when present: coverage/doctor **and** `--rules-inventory` if `arkRules` exists or brownfield may hide spaghetti rules.
188
200
  - Ranked table kinds may include `arkrules-opportunity` and `invariant-gap`.
201
+ - Empty `invariants[]` on a populated Domain while `arkRules` is on is residual (`INVARIANT_CATALOG_EMPTY`), not done. Point at `arkrules/<Domain>.json`.
189
202
  - Dual-plan **B** may include: place advisory structure rules, extract one inventory candidate to Domain + `arkrules` entry, promote one covered invariant.
190
203
  - Field path: note whether starters emit `arkrules/*`.
191
204
 
@@ -22,9 +22,21 @@ right house. Skills never enforce — CLI / hooks / CI do.
22
22
 
23
23
  - `filePath` is known before the call. Description alone is not a path.
24
24
  - Golden pattern is load-bearing when present. Adopt generates it.
25
+ - An included file that matches no layer is not a pass. The write gate denies it
26
+ (`CONFIG_UNCLASSIFIED_FILES`). Place it in a layer folder, or send include/layer
27
+ drift to `/ark-adopt`. Do not write into a loose include gap.
25
28
  - Do not default a repository to Presentation.
29
+ - When doctor JSON has `noDomainFrontend`, the new file is a Domain rule — not
30
+ another UI helper. Soft. Silent when Domain already has files or there is no
31
+ frontend. No `/ark-domain`.
26
32
  - When the matched layer has `layers[].description`, print that caption next to the
27
33
  layer name and globs. Omit when absent — do not invent a caption or `/ark-describe`.
34
+ - When the matched layer has `layers[].trustBoundary`, print `trust: <tag>` next
35
+ to the layer name and globs. Omit when absent — do not invent a tag or `/ark-trust`.
36
+ - When the matched layer has `layers[].owners`, print `owner: @handle` next
37
+ to the layer name and globs. Omit when absent — do not invent a person or `/ark-owners`.
38
+ When `requireLayerOwners` is on and the house has no owners, send that gap to
39
+ `/ark-adopt` before writing.
28
40
  - When `arkRun` is on: scaffold through the kernel (no `new` of managed types; declare
29
41
  `uses` / `reactsTo` / `raises` / `sends`; factory only in `arkRun.kernelRoots`,
30
42
  `compositionRoots` alias). Extra off → do not introduce the kernel. Enable it
@@ -69,6 +81,21 @@ When `ark_place` / the contract includes `layers[].description`, print that capt
69
81
  next to the layer name and globs. Omit it when the field is absent. Do **not** invent
70
82
  a caption or `/ark-describe`.
71
83
 
84
+ ## Layer trust (process)
85
+
86
+ When the matched layer has `layers[].trustBoundary` (`public` | `auth` |
87
+ `admin` | `internal`), print `trust: <tag>` next to the layer name and globs.
88
+ Omit it when the field is absent. Do **not** invent a tag or `/ark-trust`.
89
+ The tag is guidance, not an import-rule deny.
90
+
91
+ ## Layer owners (process)
92
+
93
+ When the matched layer has `layers[].owners`, print `owner: @handle` (or
94
+ `owner: name@host`) next to the layer name and globs. Omit when absent.
95
+ Do **not** invent a person or `/ark-owners`. When `requireLayerOwners` is
96
+ on and this house has no owners, do not write — hand off `/ark-adopt` to
97
+ name who owns the folder.
98
+
72
99
  ## Deep modules (process)
73
100
 
74
101
  - Place so new code stays **deep**: one small public surface per concern; hide implementation details.
@@ -92,7 +119,9 @@ and — if they asked to build it — scaffold it there correctly.
92
119
  **No artifact given?** If the skill is invoked with nothing to place, don't error
93
120
  and don't guess — the artifact is the one thing only the user knows. Read the
94
121
  contract (step 1) and print the placement map from it: one row per declared layer
95
- with layer name, globs, and `layers[].description` when present (omit when absent),
122
+ with layer name, globs, `layers[].description` when present,
123
+ `layers[].trustBoundary` when present, and `layers[].owners` when present
124
+ (omit any when absent),
96
125
  what belongs there, its directory, and which layers it may/may not import,
97
126
  plus the not-yet-adopted `suggestedLayers` as a footnote. Then ask what they want
98
127
  to place. That map is derived entirely from the repo, so producing it is real work,
@@ -134,7 +163,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
134
163
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
135
164
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
136
165
  4. Missing layer home: add it via **`/ark-adopt`** in this session if needed, then write the file; never invent `mechanical-safe`.
137
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
166
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
138
167
  6. Absence of `arkRun` is **valid**. Do not introduce the kernel speculatively. Skills never enforce this extra.
139
168
  7. Absence of `arkOrder` is **valid**. When on: Domain stays plane-free; first freeze ξ with `release()`; later ξ is `proposeRelease` then `apply`; never `update`/`patch`/`set` the pattern. Import `createOrderPlane` from `arkgate/order` (same npm package). Evaluate / wire one candidate via **`/ark-order`**.
140
169
 
@@ -180,7 +209,11 @@ the same files or weaken the gate.
180
209
  its forbidden globals, and exactly which layers the file may / must not import,
181
210
  straight from the contract (no guessing). When the matched layer has
182
211
  `layers[].description`, print that caption next to the layer name and globs;
183
- omit it when absent. When present, also honor optional
212
+ omit it when absent. When the matched layer has `layers[].trustBoundary`,
213
+ print `trust: <tag>` next to the layer name and globs; omit it when absent.
214
+ When the matched layer has `layers[].owners`, print `owner: @handle`; omit
215
+ when absent.
216
+ When present, also honor optional
184
217
  **`goldenPattern`** (from `.ark/golden-pattern.json`) for **NEW code only** —
185
218
  advisory layout norm; never overrides the gate and never clears design-weak.
186
219
  Absent golden is normal. Otherwise load `ark.config.json`; after the matched preflight,
@@ -215,6 +248,8 @@ the same files or weaken the gate.
215
248
  `patterns`), intent-name prefix if the layer declares `intentPrefixes`, and
216
249
  which layers it may/may not import (from `rules`). When present, print
217
250
  `layers[].description` next to the layer name and globs; omit when absent.
251
+ Print `layers[].trustBoundary` as `trust: <tag>` when present; omit when absent.
252
+ Print `layers[].owners` as `owner: @handle` when present; omit when absent.
218
253
  4. **If the layer isn't adopted yet** (suggested but no directory): write the
219
254
  layer into `ark.config.json` (session-0 honesty — same as `/ark-adopt` for
220
255
  that glob) **then** write the file. Don't silently drop the code into a
@@ -34,8 +34,10 @@ grind (`/ark-autopilot`); wire the order plane (`/ark-order`).
34
34
  | **ArkRun extra** (`arkRun` on `ark.config.json`, schema `1.2+`) | Gate contract: kernel usage + complete declarations | A score; Layers / ArkRules replacement; merge teeth while `advisory` |
35
35
  | **Kernel** `arkgate/runtime` | Kernel you construct with `createStrictArkKernel` (one instance per call) | A process-wide `getKernel()`; shipped cloud broker SDKs; production durability |
36
36
 
37
- Absence of the extra is **silent** — Layers and ArkRules verdicts stay identical. Doctor / status
38
- `arkRun` is always `notAScore`. Never invent 0–10 scores or pass/fail from this skill.
37
+ Absence of the extra is **silent** — Layers and ArkRules verdicts stay identical. Compact
38
+ doctor names ArkRun only when the extra is on (experimental, in-memory, not Postgres;
39
+ `/ark-runtime` when residual remains). Doctor / status `arkRun` is always `notAScore`.
40
+ Never invent 0–10 scores or pass/fail from this skill.
39
41
 
40
42
  ## Improvement compass note
41
43
 
@@ -143,7 +143,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
143
143
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
144
144
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
145
145
  4. After upgrade, leftover architecture work is **`/ark-autopilot`** (never invent `mechanical-safe`).
146
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
146
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
147
147
  6. Schema `1.3` extras stay off unless already on. Pin teaches `arkgate/runtime` and `arkgate/order` (same tarball), not a second install. Wire after upgrade via `/ark-runtime` / `/ark-order`. Do not invent `/ark-run`.
148
148
 
149
149