arkgate 3.9.2 → 4.0.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 +125 -0
- package/README.md +16 -4
- package/bin/ark-check-runtime.mjs +75 -3
- package/bin/ark-mcp-runtime.mjs +94 -0
- package/bin/lib/adapter-contract.mjs +14 -1
- package/bin/lib/analysis-engine.mjs +8 -8
- package/bin/lib/architecture-scan.mjs +35 -2
- package/bin/lib/arkrule-file-hints.mjs +71 -0
- package/bin/lib/arkrules-contract.mjs +382 -0
- package/bin/lib/arkrules-sensors.mjs +411 -0
- package/bin/lib/config-contract.mjs +85 -6
- package/bin/lib/doctor-advisories.mjs +14 -1
- package/bin/lib/doctor-plan.mjs +21 -0
- package/bin/lib/effective-contract-load.mjs +116 -0
- package/bin/lib/field-install.mjs +104 -0
- package/bin/lib/graph-blind.mjs +20 -1
- package/bin/lib/html-report-advisories.mjs +12 -5
- package/bin/lib/install-migrate.mjs +20 -2
- package/bin/lib/invariant-coverage-io.mjs +157 -0
- package/bin/lib/invariant-coverage.mjs +127 -0
- package/bin/lib/managed-upgrade.mjs +1 -1
- package/bin/lib/policy-delta-io.mjs +33 -0
- package/bin/lib/presets.mjs +241 -1
- package/bin/lib/remediation.mjs +28 -0
- package/bin/lib/resolved-candidate-facts.mjs +14 -1
- package/bin/lib/rules-inventory.mjs +144 -0
- package/bin/lib/rules-under-contract.mjs +320 -0
- package/bin/lib/start-preview.mjs +24 -7
- package/bin/lib/upgrade-command.mjs +373 -16
- package/dist/{configTypes-DAPvBqK6.d.ts → configTypes-CC0FEXoF.d.ts} +16 -3
- package/dist/eslint/index.cjs +2 -2
- package/dist/eslint/index.d.ts +1 -1
- package/dist/eslint/index.js +2 -2
- package/dist/index.cjs +14 -7
- package/dist/index.d.ts +615 -20
- package/dist/index.js +13 -6
- package/docs/README.md +5 -3
- package/docs/agent-guide.md +7 -3
- package/docs/ai-gates.md +6 -1
- package/docs/brownfield-adoption.md +22 -0
- package/docs/configuration.md +53 -4
- package/docs/develop.md +8 -2
- package/docs/enthusiast/README.md +11 -0
- package/docs/package-surface.md +13 -10
- package/docs/product-voice.md +11 -2
- package/docs/use.md +11 -0
- package/package.json +4 -17
- package/schemas/ark.analysis-result.schema.json +9 -1
- package/schemas/ark.arkrules.schema.json +141 -0
- package/schemas/ark.config.schema.json +10 -2
- package/schemas/ark.resolved-candidate-facts.schema.json +1 -1
- package/server.json +2 -2
- package/templates/arkrules/ApplicationOrchestration.json +14 -0
- package/templates/arkrules/DomainModel.json +32 -0
- package/templates/arkrules/PersistenceAdapters.json +14 -0
- package/templates/arkrules/PresentationAdapters.json +14 -0
- package/templates/skills/ark-adopt.md +28 -1
- package/templates/skills/ark-architect.md +23 -0
- package/templates/skills/ark-autopilot.md +27 -1
- package/templates/skills/ark-contract.md +27 -1
- package/templates/skills/ark-coverage.md +23 -0
- package/templates/skills/ark-explain.md +39 -3
- package/templates/skills/ark-explore.md +26 -1
- package/templates/skills/ark-fix.md +23 -0
- package/templates/skills/ark-loop.md +23 -0
- package/templates/skills/ark-place.md +26 -0
- package/templates/skills/ark-runtime.md +4 -0
- package/templates/skills/ark-think.md +24 -1
- package/templates/skills/ark-upgrade.md +80 -11
- package/compat/nestjs.cjs +0 -2
- package/compat/nestjs.d.ts +0 -2
- package/compat/nestjs.js +0 -1
- package/compat/runtime.cjs +0 -2
- package/compat/runtime.d.ts +0 -2
- package/compat/runtime.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ark-think
|
|
3
|
-
description: Host-side architectural reasoning — 2–3 enforceable options
|
|
3
|
+
description: Host-side architectural reasoning — 2–3 enforceable options on layer and/or ArkRules planes for ONE decision. Not full recon (use /ark-explore). No gate bypass. No package LLM call.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# /ark-think — Architectural reasoning (host LLM only)
|
|
@@ -30,6 +30,28 @@ If you lack a product map and the tree is messy: run a **compressed** explore pa
|
|
|
30
30
|
|
|
31
31
|
Never reason only from abstract hexagons. Open real modules before recommending a shape.
|
|
32
32
|
|
|
33
|
+
|
|
34
|
+
## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
|
|
35
|
+
|
|
36
|
+
ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
|
|
37
|
+
|
|
38
|
+
| Plane | What it protects | Where it lives | Sensors / tools |
|
|
39
|
+
|-------|------------------|----------------|-----------------|
|
|
40
|
+
| **Layers** (inter-layer) | Who may import whom, capabilities, pure/forbiddenGlobals, peerIsolation | `ark.config.json` → `layers[]`, `rules[]` | graph check, baseline edges, doctor coverage % |
|
|
41
|
+
| **ArkRules** (intra-layer) | Structure inside a layer + domain invariants as data | `arkRules` map + `arkrules/<ExactLayerName>.json` | structure sensors, invariant coverage, `--rules-inventory`, doctor `rulesUnderContract` |
|
|
42
|
+
|
|
43
|
+
**Rules for every report / answer:**
|
|
44
|
+
1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** (or a two-column table with those headers).
|
|
45
|
+
2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
|
|
46
|
+
3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
|
|
47
|
+
4. Editing `arkrules/*` or promoting modes is **`/ark-contract`**; fixing code under a structure sensor is **`/ark-fix`** / **`/ark-loop`** (judgment, never invent mechanical-safe).
|
|
48
|
+
5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Think + ArkRules
|
|
52
|
+
- For ONE decision, consider options on **both** planes when relevant: e.g. new layer wall **vs** structure sensor **vs** invariant catalog entry.
|
|
53
|
+
- Every option must state enforceability: which plane holds it after the change.
|
|
54
|
+
|
|
33
55
|
## Subagent fan-out (optional, host-dependent)
|
|
34
56
|
|
|
35
57
|
When the user asks to go faster **or** the work naturally splits (multiple packages,
|
|
@@ -91,6 +113,7 @@ End with **exactly** these headings (markdown `###`):
|
|
|
91
113
|
- **Sensor:** commands/tools run
|
|
92
114
|
- **Opened:** real paths read (or `n/a` only if pure install/upgrade with no source analysis)
|
|
93
115
|
- **Result:** one-line outcome
|
|
116
|
+
- **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
|
|
94
117
|
- **Handoff:** `/ark-…` / CLI / `none`
|
|
95
118
|
- **Incomplete?** `no` | `yes — <what is missing>`
|
|
96
119
|
|
|
@@ -19,9 +19,34 @@ Use the semantic sensor (`ark-check --doctor --json` plus the strict contract
|
|
|
19
19
|
check) and direct inspection of every managed file the preview will change.
|
|
20
20
|
Neither signal replaces the other.
|
|
21
21
|
|
|
22
|
+
|
|
23
|
+
## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
|
|
24
|
+
|
|
25
|
+
ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
|
|
26
|
+
|
|
27
|
+
| Plane | What it protects | Where it lives | Sensors / tools |
|
|
28
|
+
|-------|------------------|----------------|-----------------|
|
|
29
|
+
| **Layers** (inter-layer) | Who may import whom, capabilities, pure/forbiddenGlobals, peerIsolation | `ark.config.json` → `layers[]`, `rules[]` | graph check, baseline edges, doctor coverage % |
|
|
30
|
+
| **ArkRules** (intra-layer) | Structure inside a layer + domain invariants as data | `arkRules` map + `arkrules/<ExactLayerName>.json` | structure sensors, invariant coverage, `--rules-inventory`, doctor `rulesUnderContract` |
|
|
31
|
+
|
|
32
|
+
**Rules for every report / answer:**
|
|
33
|
+
1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** (or a two-column table with those headers).
|
|
34
|
+
2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
|
|
35
|
+
3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
|
|
36
|
+
4. Editing `arkrules/*` or promoting modes is **`/ark-contract`**; fixing code under a structure sensor is **`/ark-fix`** / **`/ark-loop`** (judgment, never invent mechanical-safe).
|
|
37
|
+
5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Upgrade + ArkRules
|
|
41
|
+
- Refresh skills + note if templates gained ArkRules deepen; do not force consumers to adopt `arkRules`.
|
|
42
|
+
- After upgrade: doctor `rulesUnderContract` if map exists; dual-truth note if `--no-install` left package pin old.
|
|
43
|
+
|
|
22
44
|
## Safety contract
|
|
23
45
|
|
|
24
|
-
-
|
|
46
|
+
- Always invoke the **project-local** CLI (`npx arkgate` /
|
|
47
|
+
`node node_modules/arkgate/bin/ark.mjs`). Bare PATH `ark` / `arkgate` is unsafe
|
|
48
|
+
when a global 2.x install shadows the project (mutative legacy upgrade).
|
|
49
|
+
- `ark upgrade` (managed era) is read-only. It reports the selected profile and hosts, every
|
|
25
50
|
managed asset, its content state, and the exact next command.
|
|
26
51
|
- The first `ark upgrade --apply` updates the dependency and lockfile, then runs
|
|
27
52
|
the newly installed CLI to produce another read-only preview. It does **not**
|
|
@@ -50,16 +75,54 @@ Neither signal replaces the other.
|
|
|
50
75
|
|
|
51
76
|
## Procedure
|
|
52
77
|
|
|
53
|
-
1. **
|
|
78
|
+
1. **Resolve the project CLI (mandatory before any upgrade command).** Prefer the
|
|
79
|
+
**project-local** binary — never bare `ark` / `arkgate` from PATH unless you
|
|
80
|
+
prove it is this project's install.
|
|
81
|
+
|
|
82
|
+
Resolution order:
|
|
83
|
+
|
|
84
|
+
1. `node node_modules/arkgate/bin/ark.mjs` from the repository root (both `arkgate`
|
|
85
|
+
and `ark` package bins map to this file).
|
|
86
|
+
2. Package-manager exec from the project: `npx arkgate`, `pnpm exec arkgate`,
|
|
87
|
+
`yarn arkgate`, etc.
|
|
88
|
+
|
|
89
|
+
**Do not** use bare `ark` / `arkgate` from PATH unless `which ark` (or the
|
|
90
|
+
resolved realpath) is under this project's `node_modules/arkgate`, or the
|
|
91
|
+
binary reports the **same** version as `node_modules/arkgate/package.json` and
|
|
92
|
+
supports managed upgrade.
|
|
93
|
+
|
|
94
|
+
**Capability probe (abort if missing):** run
|
|
95
|
+
`node node_modules/arkgate/bin/ark.mjs upgrade --help` (or the resolved local
|
|
96
|
+
equivalent) and require a **managed upgrade** surface — help text must mention
|
|
97
|
+
`--plan-digest` (and read-only `upgrade --json` preview). If the only available
|
|
98
|
+
CLI is old (global Homebrew / npm global 2.x, or any binary whose help lacks
|
|
99
|
+
`--plan-digest`), **stop**: skill incomplete; do **not** preview or apply.
|
|
100
|
+
Global 2.x `ark upgrade` is mutative and can rewrite managed skills, forcing a
|
|
101
|
+
later `--accept-conflicts` recovery.
|
|
102
|
+
|
|
103
|
+
**Recovery (preferred → optional):**
|
|
104
|
+
|
|
105
|
+
- Preferred: package-manager runner from project / `--root`
|
|
106
|
+
(`npx arkgate upgrade …` / `pnpm exec arkgate upgrade …` / `yarn arkgate upgrade …`).
|
|
107
|
+
This works when arkgate is **hoisted** and a nested package has no shallow
|
|
108
|
+
`node_modules/arkgate`.
|
|
109
|
+
- Secondary: `node node_modules/arkgate/bin/ark.mjs upgrade …` from the
|
|
110
|
+
**workspace install root** (not a nested package lacking a local install).
|
|
111
|
+
- Optional: refresh a global install with `npm i -g arkgate@latest` only if the
|
|
112
|
+
user wants a global binary; still prefer project-local for this procedure.
|
|
113
|
+
|
|
114
|
+
Record the resolved CLI path/version, read
|
|
54
115
|
`node_modules/arkgate/package.json`, query `npm view arkgate version`, identify
|
|
55
116
|
the repository package manager, and open the intervening entries in the
|
|
56
117
|
shipped `CHANGELOG.md` (fall back to registry or release notes and name that
|
|
57
118
|
source). Do not infer “latest” from `node_modules` alone.
|
|
58
119
|
|
|
59
|
-
2. **Preview managed content.**
|
|
120
|
+
2. **Preview managed content.** Using the **project-local** CLI from step 1
|
|
121
|
+
(never a bare PATH `ark` that failed the probe), run:
|
|
60
122
|
|
|
61
123
|
```bash
|
|
62
|
-
|
|
124
|
+
npx arkgate upgrade --json
|
|
125
|
+
# or: node node_modules/arkgate/bin/ark.mjs upgrade --json
|
|
63
126
|
```
|
|
64
127
|
|
|
65
128
|
Pass `--root <path>` and `--tools <active-host>` when selection would otherwise
|
|
@@ -67,10 +130,10 @@ Neither signal replaces the other.
|
|
|
67
130
|
that customized files remain non-applying and that any deletion/conflict is
|
|
68
131
|
blocked.
|
|
69
132
|
|
|
70
|
-
3. **Update and re-preview.** If the registry is newer, run:
|
|
133
|
+
3. **Update and re-preview.** If the registry is newer, run (project-local CLI):
|
|
71
134
|
|
|
72
135
|
```bash
|
|
73
|
-
|
|
136
|
+
npx arkgate upgrade --apply
|
|
74
137
|
```
|
|
75
138
|
|
|
76
139
|
This updates through the detected package manager and hands control to the new
|
|
@@ -83,20 +146,25 @@ Neither signal replaces the other.
|
|
|
83
146
|
off, and prove `pnpm install --frozen-lockfile` succeeds.
|
|
84
147
|
|
|
85
148
|
4. **Apply only the reviewed candidate.** When there are no blocked assets, run
|
|
86
|
-
the preview's exact `nextCommand
|
|
149
|
+
the preview's **exact** `nextCommand` as emitted (JSON field / human “Apply the
|
|
150
|
+
exact preview with: …”). That command is already **project-local**
|
|
151
|
+
(`npx arkgate` / `pnpm exec arkgate` / `yarn arkgate` — never bare PATH `ark`).
|
|
152
|
+
Do **not** rewrite it to bare `ark upgrade`; pasting through a global 2.x PATH
|
|
153
|
+
reintroduces the mutative footgun. Shape:
|
|
87
154
|
|
|
88
155
|
```bash
|
|
89
|
-
|
|
156
|
+
npx arkgate upgrade --apply --no-install --plan-digest <preview-digest>
|
|
90
157
|
```
|
|
91
158
|
|
|
92
159
|
If recorded deletion/conflict recovery is desired, ask first and then add
|
|
93
160
|
`--accept-conflicts`. Never add it merely to make the run green. Run a second
|
|
94
161
|
preview and require `summary.changed: 0`.
|
|
95
162
|
|
|
96
|
-
5. **Verify enforcement and architecture.** Run
|
|
163
|
+
5. **Verify enforcement and architecture.** Run
|
|
164
|
+
`npx arkgate-check --doctor --json` (or the project-local `ark-check`) and
|
|
97
165
|
the same fail-closed architecture command used by managed apply (normally
|
|
98
|
-
`
|
|
99
|
-
`completeness: "complete"` and `ok: true`. Treat provider-unavailable CI
|
|
166
|
+
`npx arkgate-check --root . --config ark.config.json --strict-merge --json`).
|
|
167
|
+
Require `completeness: "complete"` and `ok: true`. Treat provider-unavailable CI
|
|
100
168
|
required-check evidence as `unverified`, never as proof that merges are
|
|
101
169
|
blocked. If new violations appear, hand off to `/ark-fix` for a small set or
|
|
102
170
|
`/ark-loop` / `/ark-autopilot` for residual debt; do not regenerate a baseline
|
|
@@ -133,6 +201,7 @@ End with exactly this structure:
|
|
|
133
201
|
- **Active host:** host and verified status
|
|
134
202
|
- **Deferred hosts:** `none` or host plus future action
|
|
135
203
|
- **Result:** old → new version and managed-upgrade outcome
|
|
204
|
+
- **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
|
|
136
205
|
- **Handoff:** `/ark-…`, CLI action, or `none`
|
|
137
206
|
- **Incomplete?** `no` or `yes — <missing work>`
|
|
138
207
|
|
package/compat/nestjs.cjs
DELETED
package/compat/nestjs.d.ts
DELETED
package/compat/nestjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@arkgate/runtime/nestjs';
|
package/compat/runtime.cjs
DELETED
package/compat/runtime.d.ts
DELETED
package/compat/runtime.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@arkgate/runtime';
|