arkgate 4.8.2 → 4.8.4
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 +257 -3
- package/README.md +47 -9
- package/bin/ark-check-runtime.mjs +340 -5
- package/bin/ark-layer-match.mjs +170 -13
- package/bin/ark-mcp-runtime.mjs +9 -2
- package/bin/lib/analysis-completeness.mjs +86 -0
- package/bin/lib/analysis-engine.mjs +6 -6
- package/bin/lib/architecture-scan.mjs +2 -0
- package/bin/lib/ark-order-facts.mjs +59 -0
- package/bin/lib/ark-order-sensors.mjs +31 -2
- package/bin/lib/arkrule-file-hints.mjs +6 -2
- package/bin/lib/arkrules-contract.mjs +9 -1
- package/bin/lib/arkrules-sensors.mjs +22 -2
- package/bin/lib/check-args.mjs +66 -0
- package/bin/lib/config-contract.mjs +26 -0
- package/bin/lib/config-extras.mjs +2 -0
- package/bin/lib/design-smells.mjs +85 -0
- package/bin/lib/diagnostic-catalog.mjs +8 -2
- package/bin/lib/first-run-help.mjs +12 -0
- package/bin/lib/invariant-coverage-io.mjs +175 -19
- package/bin/lib/invariant-coverage.mjs +110 -7
- package/bin/lib/literal-path-drift-io.mjs +569 -0
- package/bin/lib/literal-path-drift.mjs +761 -0
- package/bin/lib/policy-delta-io.mjs +5 -0
- package/bin/lib/remediation.mjs +24 -1
- package/bin/lib/resolved-candidate-facts.mjs +31 -0
- package/bin/lib/rules-under-contract.mjs +5 -0
- package/bin/lib/scan-files.mjs +54 -0
- package/bin/lib/sensor-promote-cli.mjs +372 -0
- package/bin/lib/sensor-promote-io.mjs +246 -0
- package/bin/lib/sensor-promotion.mjs +363 -0
- package/dist/{configTypes-BdCe_gvv.d.ts → configTypes-dy5PfTqS.d.ts} +36 -0
- package/dist/{diagnosticCatalog-CPzH-MLN.d.ts → diagnosticCatalog-DgTs0abp.d.ts} +169 -11
- package/dist/eslint/index.cjs +5 -5
- package/dist/eslint/index.d.ts +34 -1
- package/dist/eslint/index.js +5 -5
- package/dist/index.cjs +31 -31
- package/dist/index.d.ts +85 -7
- package/dist/index.js +31 -31
- package/dist/nestjs/index.cjs +5 -5
- package/dist/nestjs/index.d.ts +3 -3
- package/dist/nestjs/index.js +5 -5
- package/dist/runtime/index.cjs +13 -13
- package/dist/runtime/index.d.ts +6 -6
- package/dist/runtime/index.js +13 -13
- package/dist/{types-DCSlrRnV.d.ts → types-BuM8WNqe.d.ts} +1 -1
- package/dist/{types-C9KApBzX.d.ts → types-D95drJ3_.d.ts} +1 -1
- package/docs/README.md +4 -4
- package/docs/agent-guide.md +182 -0
- package/docs/configuration.md +89 -9
- package/docs/develop.md +24 -2
- package/docs/diagnostics.md +79 -1
- package/docs/enthusiast/README.md +6 -4
- package/docs/package-surface.md +36 -4
- package/docs/product-voice.md +15 -5
- package/docs/use.md +8 -5
- package/package.json +2 -2
- package/schemas/ark.arkrules.schema.json +1 -0
- package/schemas/ark.config.schema.json +72 -0
- package/schemas/ark.resolved-candidate-facts.schema.json +1 -1
- package/server.json +3 -3
- package/templates/agent-skills/README.md +1 -1
- package/templates/agent-skills/ark-adopt/SKILL.md +13 -3
- package/templates/agent-skills/ark-autopilot/SKILL.md +1 -1
- package/templates/agent-skills/ark-contract/SKILL.md +4 -0
- package/templates/agent-skills/ark-coverage/SKILL.md +1 -0
- package/templates/agent-skills/ark-place/SKILL.md +6 -2
- package/templates/arkrules/ApplicationOrchestration.json +6 -0
- package/templates/skills/ark-adopt.md +13 -3
- package/templates/skills/ark-autopilot.md +1 -1
- package/templates/skills/ark-contract.md +4 -0
- package/templates/skills/ark-coverage.md +1 -0
- package/templates/skills/ark-place.md +6 -2
|
@@ -142,6 +142,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
|
|
|
142
142
|
### Adopt + ArkRules
|
|
143
143
|
- After classify: emit or refresh `arkRules` for matched layers (exact names; generic mold for unknowns).
|
|
144
144
|
- Mine rules → inventory + write advisory invariants/structure into `arkrules/<Layer>.json` **in this turn**.
|
|
145
|
+
- Application / Features templates include advisory `writes-via-aggregate`: driver import + write token in a use case is the skip. Do not copy `Externals/` / `admission.ts` folder religion.
|
|
145
146
|
- Freeze baseline is **[Layer]** debt; inventory residual is **[ArkRules]** — report both.
|
|
146
147
|
|
|
147
148
|
### Adopt + ArkRun
|
|
@@ -156,8 +157,8 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
|
|
|
156
157
|
|
|
157
158
|
### Adopt + ArkOrder
|
|
158
159
|
- User asked to turn the extra on: write **advisory** `arkOrder` on `ark.config.json` (`schemaVersion` `1.3+`) **in this turn**. Default `"mode": "advisory"` — never session-0 default `enforced`.
|
|
159
|
-
- Required shape: `planeRoots` (real files; empty + enforced = `ARKORDER_MISSING_PLANE`), `managedLayers` (existing `layers[].name` only), `maxXiKeys` (default 7).
|
|
160
|
-
- Example (consumer trees — not this library's 4-layer compact)
|
|
160
|
+
- Required shape: `planeRoots` (real files; empty + enforced = `ARKORDER_MISSING_PLANE`), `managedLayers` (existing `layers[].name` only), `maxXiKeys` (default 7), **`xiKeys`** (the 3–5 slow names; empty = field-write sensor silent).
|
|
161
|
+
- Example (consumer trees — not this library's 4-layer compact). Copy billing, **rename the three keys**:
|
|
161
162
|
|
|
162
163
|
```json
|
|
163
164
|
{
|
|
@@ -166,11 +167,15 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
|
|
|
166
167
|
"mode": "advisory",
|
|
167
168
|
"planeRoots": ["src/main.ts"],
|
|
168
169
|
"managedLayers": ["Application"],
|
|
169
|
-
"maxXiKeys": 7
|
|
170
|
+
"maxXiKeys": 7,
|
|
171
|
+
"xiKeys": ["plan", "cycle", "tenancy"]
|
|
170
172
|
}
|
|
171
173
|
}
|
|
172
174
|
```
|
|
173
175
|
|
|
176
|
+
- `xiKeys` are meaning, not membership. `projectId` / `orgId` do not belong. If `proposeRelease` throws empty blast, that key does not order anything.
|
|
177
|
+
- A use-case that `prisma.*.update({ plan })` while `plan` is in `xiKeys` is **[ArkOrder]** `ARKORDER_XI_FIELD_WRITE`. Invoices and seats still flow through `ingest`.
|
|
178
|
+
|
|
174
179
|
- Do **not** put `arkOrder` on the compact starter / `ark start` scaffold. Domain stays plane-free. Import `createOrderPlane` from `arkgate/order` (same npm package).
|
|
175
180
|
- Absence is valid and **silent** — never force the extra. Do not invent `/ark-order`.
|
|
176
181
|
- Demoting enforced → advisory or deleting the extra is policy-delta **weakening**.
|
|
@@ -232,6 +237,11 @@ Ark protects the **boundary around** a framework, not its internals. Nest/DI pub
|
|
|
232
237
|
to a compact starter. Do not promote to enforced as the session-0 default.
|
|
233
238
|
2. **Check + diagnose** — `summary.concentrated` / dominant edge → fix contract first, don’t freeze.
|
|
234
239
|
Cross-slice / cross-context `peerIsolation` hits are judgment: extract shared or events.
|
|
240
|
+
The denial names its reason. `unclassifiable path` in bulk means shared code lives outside
|
|
241
|
+
the slice folders — declare those roots (`sharedRoots`) on the rule instead of treating
|
|
242
|
+
thousands of shared files as violations; `cross-slice edge a → b` is the real one, and a
|
|
243
|
+
deliberate directed edge goes in `allowedCrossSlice`. Promoting the shared slice to its own
|
|
244
|
+
layer is still the preferred fix.
|
|
235
245
|
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).
|
|
236
246
|
Empty Domain/Persistence + I/O under Application → false-green.
|
|
237
247
|
**STOP — do not continue this skill as complete.** **STOP — false-green:** fix the config **in this turn** before claiming ENFORCE. Do not claim goal.met / ENFORCE from type-only cleanup while doctor reports `contract-false-green-io-under-application`.
|
|
@@ -147,7 +147,7 @@ When `arkRun` is present:
|
|
|
147
147
|
|
|
148
148
|
### Autopilot + ArkOrder
|
|
149
149
|
When `arkOrder` is present:
|
|
150
|
-
- Grind skip clusters with judgment: `ARKORDER_MISSING_PLANE` / `ARKORDER_KERNEL_IN_DOMAIN` / `ARKORDER_GENERIC_UPDATE` / `ARKORDER_TOO_MANY_PARAMS` / `ARKORDER_INGEST_WRITES_XI`. Freeze ξ with `release()`; never `update`/`patch`/`set`.
|
|
150
|
+
- Grind skip clusters with judgment: `ARKORDER_MISSING_PLANE` / `ARKORDER_KERNEL_IN_DOMAIN` / `ARKORDER_GENERIC_UPDATE` / `ARKORDER_TOO_MANY_PARAMS` / `ARKORDER_INGEST_WRITES_XI` / `ARKORDER_XI_FIELD_WRITE`. Freeze ξ with `release()`; never `update`/`patch`/`set`. Name `xiKeys`; do not persist those keys from a use-case.
|
|
151
151
|
- Extra off → `/ark-adopt` (advisory). Do not invent `/ark-order`.
|
|
152
152
|
- Skills never enforce.
|
|
153
153
|
|
|
@@ -43,6 +43,10 @@ restart/retargeting is required. `ark://manifest` never satisfies this preflight
|
|
|
43
43
|
|
|
44
44
|
Label findings **`[Layer]`** vs **`[ArkRules]`** vs **`[ArkRun]`** vs **`[ArkOrder]`**. Absence of extras is valid and silent. First-time extra is **`/ark-adopt`** (advisory). Wire one kernel candidate with **`/ark-runtime`**. New kernel-managed / plane-root file with **`/ark-place`**. Grind skip clusters with **`/ark-autopilot`**. Do not invent `/ark-run` or `/ark-order`. Skills never enforce.
|
|
45
45
|
|
|
46
|
+
Application / Features may declare advisory **`writes-via-aggregate`**: a use-case that imports a persistence driver and calls `.insert` / `.create` / `INSERT INTO` is the skip. Persistence adapters stay the write edge. Do not add `Externals/` or `admission.ts` as contract law.
|
|
47
|
+
|
|
48
|
+
When `arkOrder` is on, name **`xiKeys`** (3–5 slow product decisions). Membership ids are not keys. A use-case that persists those keys is `ARKORDER_XI_FIELD_WRITE`. Copy [examples/arkorder-billing/](../../../examples/arkorder-billing/) and rename the three keys.
|
|
49
|
+
|
|
46
50
|
## Subagent fan-out (optional, host-dependent)
|
|
47
51
|
|
|
48
52
|
If the host supports **parallel subagents**, fan out read-only scouts; otherwise
|
|
@@ -92,6 +92,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
|
|
|
92
92
|
3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
|
|
93
93
|
4. Editing `arkrules/*` or promoting modes is **`/ark-adopt`** / leftover **`/ark-contract`**; fixing code under a structure sensor is leftover **`/ark-fix`** / **`/ark-loop`** or **`/ark-autopilot`** (judgment, never invent mechanical-safe).
|
|
94
94
|
5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
|
|
95
|
+
5b. Invariant coverage is a **text match, never an execution**: a file walk plus the invariant id in a `describe`/`it` title. Never report `INVARIANT_UNCOVERED: 0` as “the tests pass” or “the tests run” — ArkGate does not run tests and reads no runner config. When the project declares `coverage.coverageRoots`, a covering test found outside them raises the advisory `INVARIANT_COVERAGE_OUTSIDE_ROOTS`; without that declaration ArkGate makes no claim about where tests run.
|
|
95
96
|
6. Extras silent when off. Doctor `arkRun` is `notAScore`. Do not force extras. Do not invent `/ark-run` or `/ark-order`.
|
|
96
97
|
|
|
97
98
|
|
|
@@ -127,8 +127,9 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
|
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
### Place + ArkRules
|
|
130
|
-
- Choose layer from contract **and** check structure sensors for that layer (private state, factory, thin adapter).
|
|
130
|
+
- Choose layer from contract **and** check structure sensors for that layer (private state, factory, thin adapter, writes-via-aggregate).
|
|
131
131
|
- Scaffold to satisfy **[ArkRules]** when present; state which sensors apply.
|
|
132
|
+
- Persistence **writes** (insert/update/delete against a driver) go through a Domain aggregate + persistence adapter. Application/Feature files that import Prisma/pg/Supabase and call `.insert` / `.create` are **[ArkRules]** `writes-via-aggregate`. Do not invent `Externals/` or `admission.ts`.
|
|
132
133
|
|
|
133
134
|
### Place + ArkRun
|
|
134
135
|
When `arkRun` is present on the architecture config:
|
|
@@ -146,7 +147,8 @@ When `arkOrder` is present on the architecture config:
|
|
|
146
147
|
- Import `createOrderPlane` from `arkgate/order` (same npm package). Domain-role files stay plane-free.
|
|
147
148
|
- Freeze ξ with `release()`; derive s with `project()`; field `ingest()` never mints a pattern; `proposeRelease()` needs a non-empty blast. There is no `update`/`patch`/`set`.
|
|
148
149
|
- Call the factory only inside `arkOrder.planeRoots`. Empty roots in `enforced` mode is `ARKORDER_MISSING_PLANE`.
|
|
149
|
-
-
|
|
150
|
+
- Named slow keys live in `arkOrder.xiKeys`. A managed-layer Prisma/pg write of those keys is `ARKORDER_XI_FIELD_WRITE` — absorb with `ingest` or change the pattern with `proposeRelease`.
|
|
151
|
+
- Skip clusters (`ARKORDER_MISSING_PLANE` / `ARKORDER_KERNEL_IN_DOMAIN` / `ARKORDER_GENERIC_UPDATE` / `ARKORDER_TOO_MANY_PARAMS` / `ARKORDER_INGEST_WRITES_XI` / `ARKORDER_XI_FIELD_WRITE`): place this artifact, then grind via `/ark-autopilot`. Extra not on → `/ark-adopt`. Do not invent `/ark-order`.
|
|
150
152
|
- Absence of the extra is valid. Do not invent `/ark-order`. Skills never enforce.
|
|
151
153
|
|
|
152
154
|
## Subagent fan-out (optional, host-dependent)
|
|
@@ -178,6 +180,8 @@ the same files or weaken the gate.
|
|
|
178
180
|
- Orchestrates a use case, no I/O of its own → application layer.
|
|
179
181
|
- Talks to a database, queue, API, filesystem → an adapter layer on the side
|
|
180
182
|
that matches the direction (driven/persistence vs driving/http).
|
|
183
|
+
**Writes** go through a Domain aggregate that uses a persistence port; the
|
|
184
|
+
adapter implements the port. Do not put `prisma.order.create` in a use case.
|
|
181
185
|
- Reacts to events, long-running coordination (saga/workflow), scheduled
|
|
182
186
|
jobs, projections → the event/workflow layers if the config declares them.
|
|
183
187
|
When `arkRun` is on, wire those through the kernel (register + declarations),
|