arkgate 4.6.7 → 4.7.0
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 +109 -0
- package/README.md +20 -9
- package/SECURITY.md +1 -1
- package/bin/ark-check-runtime.mjs +13 -1
- package/bin/ark-mcp-runtime.mjs +65 -3
- package/bin/lib/adapter-contract.mjs +17 -36
- package/bin/lib/analysis-engine.mjs +6 -6
- package/bin/lib/ark-run-doctor.mjs +144 -0
- package/bin/lib/ark-run-facts.mjs +472 -0
- package/bin/lib/ark-run-report.mjs +57 -0
- package/bin/lib/ark-run-sensors.mjs +309 -0
- package/bin/lib/config-contract.mjs +86 -11
- package/bin/lib/diagnostic-catalog.mjs +8 -0
- package/bin/lib/doctor-advisories.mjs +45 -8
- package/bin/lib/doctor-human.mjs +10 -0
- package/bin/lib/doctor-plan.mjs +20 -16
- package/bin/lib/extra-merge-teeth.mjs +187 -0
- package/bin/lib/html-report-advisories.mjs +2 -0
- package/bin/lib/html-report-depth.mjs +22 -2
- package/bin/lib/html-report.mjs +16 -0
- package/bin/lib/remediation.mjs +132 -0
- package/bin/lib/resolved-candidate-facts.mjs +67 -2
- package/bin/lib/rules-under-contract.mjs +37 -89
- package/bin/lib/snippet-analysis.mjs +43 -2
- package/bin/lib/status-command.mjs +28 -0
- package/bin/lib/status-manifest.mjs +23 -0
- package/dist/{configTypes-l6XiwiC1.d.ts → configTypes-CgJimx9o.d.ts} +17 -3
- package/dist/eslint/index.cjs +6 -2
- package/dist/eslint/index.d.ts +70 -2
- package/dist/eslint/index.js +6 -2
- package/dist/index.cjs +35 -35
- package/dist/index.d.ts +787 -272
- package/dist/index.js +35 -35
- package/docs/README.md +2 -1
- package/docs/agent-guide.md +21 -15
- package/docs/ai-gates.md +13 -0
- package/docs/configuration.md +24 -11
- package/docs/develop.md +12 -3
- package/docs/diagnostics.md +75 -0
- package/docs/enthusiast/README.md +4 -3
- package/docs/package-surface.md +16 -13
- package/docs/product-voice.md +6 -3
- package/docs/threat-model.md +1 -1
- package/docs/use.md +5 -4
- package/package.json +1 -1
- package/schemas/ark.config.schema.json +41 -2
- package/schemas/ark.resolved-candidate-facts.schema.json +1 -1
- package/schemas/ark.status-manifest.schema.json +47 -0
- package/server.json +2 -2
- package/templates/agent-skills/README.md +1 -1
- package/templates/agent-skills/ark-adopt/SKILL.md +23 -2
- package/templates/agent-skills/ark-place/SKILL.md +26 -2
- package/templates/agent-skills/ark-runtime/SKILL.md +66 -24
- package/templates/skills/ark-adopt.md +23 -2
- package/templates/skills/ark-place.md +26 -2
- package/templates/skills/ark-runtime.md +66 -24
|
@@ -19,6 +19,9 @@ description: "Where does new code go? Names the layer, directory, and naming for
|
|
|
19
19
|
- `filePath` is known before the call. Description alone is not a path.
|
|
20
20
|
- Golden pattern is load-bearing when present. Adopt generates it.
|
|
21
21
|
- Do not default a repository to Presentation.
|
|
22
|
+
- When `arkRun` is on: scaffold through the kernel (no `new` of managed types; declare
|
|
23
|
+
`uses` / `reactsTo` / `raises` / `sends`). Extra off → do not introduce the kernel. Enable it
|
|
24
|
+
via `/ark-adopt`. Skills never enforce.
|
|
22
25
|
|
|
23
26
|
## Autonomy contract
|
|
24
27
|
|
|
@@ -62,6 +65,7 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
|
|
|
62
65
|
|------------------------|-------------------------|
|
|
63
66
|
| New artifact: where + **write** under the config | Existing violation cluster → `/ark-autopilot` |
|
|
64
67
|
| Naming / directory for a known kind | Session 0 / config missing or lying → `/ark-adopt` (then come back) |
|
|
68
|
+
| Kernel-managed artifact when `arkRun` is already on | Extra not chosen yet → `/ark-adopt` (advisory `arkRun`); evaluate / migrate a hand-rolled bus → `/ark-runtime` |
|
|
65
69
|
|
|
66
70
|
The user describes something they need to build (a saga, a background job, an
|
|
67
71
|
event handler, a repository, an HTTP client, a use case, a projection, …).
|
|
@@ -104,19 +108,32 @@ ArkGate has **two opt-in planes**. The user chooses which to use; you **always l
|
|
|
104
108
|
|-------|------------------|----------------|-----------------|
|
|
105
109
|
| **Layers** (inter-layer) | Who may import whom, capabilities, pure/forbiddenGlobals, peerIsolation | `ark.config.json` → `layers[]`, `rules[]` | graph check, baseline edges, doctor coverage % |
|
|
106
110
|
| **ArkRules** (intra-layer) | Structure inside a layer + domain invariants as data | `arkRules` map + `arkrules/<ExactLayerName>.json` | structure sensors, invariant coverage, `--rules-inventory`, doctor `rulesUnderContract` |
|
|
111
|
+
| **ArkRun** (extra) | Kernel usage + complete declarations | `arkRun` on `ark.config.json` (schema `1.2+`) + companion `@arkgate/runtime` | `ARKRUN_*`, doctor `arkRun` (`notAScore`) |
|
|
107
112
|
|
|
108
113
|
**Rules for every report / answer:**
|
|
109
|
-
1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** (or a two-column table with those headers).
|
|
114
|
+
1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** or **`[ArkRun]`** (or a two-column table with those headers).
|
|
110
115
|
2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
|
|
111
116
|
3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
|
|
112
117
|
4. Missing layer home: add it via **`/ark-adopt`** in this session if needed, then write the file; never invent `mechanical-safe`.
|
|
113
118
|
5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
|
|
119
|
+
6. Absence of `arkRun` is **valid**. Do not introduce the kernel speculatively. Skills never enforce this extra.
|
|
114
120
|
|
|
115
121
|
|
|
116
122
|
### Place + ArkRules
|
|
117
123
|
- Choose layer from contract **and** check structure sensors for that layer (private state, factory, thin adapter).
|
|
118
124
|
- Scaffold to satisfy **[ArkRules]** when present; state which sensors apply.
|
|
119
125
|
|
|
126
|
+
### Place + ArkRun
|
|
127
|
+
When `arkRun` is present on the architecture config:
|
|
128
|
+
- Scaffold kernel-managed artifacts **through the kernel**, not `new` of an admitted type (`ARKRUN_DIRECT_NEW`).
|
|
129
|
+
- Call `createStrictArkKernel` (or an admission sibling) only inside `arkRun.compositionRoots`. Each call is a new instance — no process-wide `getKernel()`.
|
|
130
|
+
- Domain-role files stay kernel-free (`ARKRUN_KERNEL_IN_DOMAIN`). Import from `@arkgate/runtime` (or `/nestjs`), never a removed `arkgate/runtime` shim.
|
|
131
|
+
- List `uses` / `reactsTo` / `raises` / `sends` when `requireDeclarations` is on. Adding an existing call-site literal to the declaration list is the only mechanical-safe ArkRun edit; inventing a new emit / handle / depend is judgment.
|
|
132
|
+
- Do not import a homemade bus (`EventEmitter`, queue clients) in `managedLayers` — send on the kernel transport (`local` / `localBlocking` / `broker`; `ephemeral` defaults true). No shipped cloud SDKs.
|
|
133
|
+
- In-memory stores are **not** production durability. Doctor `arkRun` is `notAScore`.
|
|
134
|
+
- Absence of the extra: place with **[Layer]** + **[ArkRules]** only. Enable advisory extra via `/ark-adopt`; evaluate a hand-rolled bus via `/ark-runtime`. Do not invent `/ark-run`.
|
|
135
|
+
- Skills never enforce.
|
|
136
|
+
|
|
120
137
|
## Subagent fan-out (optional, host-dependent)
|
|
121
138
|
|
|
122
139
|
If the host supports **parallel subagents** and the task splits cleanly (e.g. multiple
|
|
@@ -148,6 +165,10 @@ the same files or weaken the gate.
|
|
|
148
165
|
that matches the direction (driven/persistence vs driving/http).
|
|
149
166
|
- Reacts to events, long-running coordination (saga/workflow), scheduled
|
|
150
167
|
jobs, projections → the event/workflow layers if the config declares them.
|
|
168
|
+
When `arkRun` is on, wire those through the kernel (register + declarations),
|
|
169
|
+
not a homemade emitter.
|
|
170
|
+
- Kernel-managed application service when `arkRun` is on → composition-root factory
|
|
171
|
+
+ `register({ uses, reactsTo, raises, sends })`; never `new` of the admitted type.
|
|
151
172
|
- **`vertical-slice` contract:** put co-located feature code under
|
|
152
173
|
`src/features/<slice>/…` (never import a sibling slice); shared primitives
|
|
153
174
|
under `src/shared/`; infra under `src/lib/`; shell under `src/app/`.
|
|
@@ -175,6 +196,9 @@ the same files or weaken the gate.
|
|
|
175
196
|
(not place one new artifact): place only the new file under the golden/contract home, then
|
|
176
197
|
hand off **one** pilot via `pilotLoop.nextPilot` / `/ark-explore` shape-focus — never multi-pilot
|
|
177
198
|
batch reshape from this skill.
|
|
199
|
+
- If `arkRun` is on and the user is grinding skip violations (`new` of managed types, homemade
|
|
200
|
+
bus) across many files: place this artifact through the kernel, then leftover `/ark-fix` /
|
|
201
|
+
`/ark-autopilot`. Extra not on → `/ark-adopt` (advisory) or `/ark-runtime` (evaluate).
|
|
178
202
|
|
|
179
203
|
## Operating rules
|
|
180
204
|
|
|
@@ -207,7 +231,7 @@ End with **exactly** these headings (markdown `###`):
|
|
|
207
231
|
- **Sensor:** commands/tools run
|
|
208
232
|
- **Opened:** real paths read (or `n/a` only if pure install/upgrade with no source analysis)
|
|
209
233
|
- **Result:** one-line outcome
|
|
210
|
-
- **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
|
|
234
|
+
- **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** vs **[ArkRun]** (or `n/a` if unused)
|
|
211
235
|
- **Compass:** top residual lenses | `n/a`
|
|
212
236
|
- **Done axes:** architecture residual (status/doctor/compass) | feature/ticket residual (outside package). Enforce green ≠ feature done
|
|
213
237
|
- **Handoff:** `/ark-…` / CLI / `none`
|
|
@@ -1,25 +1,36 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ark-runtime
|
|
3
|
-
description: Evaluate the experimental
|
|
3
|
+
description: Evaluate and wire the experimental ArkRun companion (@arkgate/runtime) against hand-rolled event bus, outbox, saga, projection, policy, or NestJS code. One candidate. Extra on via /ark-adopt; new files via /ark-place. Skills never enforce.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# /ark-runtime — Evaluate
|
|
6
|
+
# /ark-runtime — Evaluate and wire ArkRun (experimental opt-in)
|
|
7
7
|
|
|
8
|
-
The runtime
|
|
9
|
-
|
|
8
|
+
The ArkRun companion (`@arkgate/runtime`) is currently **experimental**. It is **not** required
|
|
9
|
+
for ArkGate enforcement and is **not** production durability. Use this skill when the user wants
|
|
10
|
+
to evaluate or wire the kernel. **This skill never enforces** — the write / CI / ESLint plane
|
|
11
|
+
does when the `arkRun` extra is on. Do **not** invent `/ark-run`.
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
**When:** evaluate a hand-rolled bus / outbox / saga / projection / policy / Nest adapter against
|
|
14
|
+
the companion, or wire an extra that is already on (composition root, declarations, transport).
|
|
15
|
+
**Not when:** session 0 / extra not chosen (`/ark-adopt`); one new file (`/ark-place`); skip-violation
|
|
16
|
+
grind (`/ark-autopilot` / leftover `/ark-fix`).
|
|
17
|
+
|
|
18
|
+
## Extra vs companion (mandatory)
|
|
19
|
+
|
|
20
|
+
| Piece | What it is | What it is not |
|
|
21
|
+
|-------|------------|----------------|
|
|
22
|
+
| **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` |
|
|
23
|
+
| **Companion** `@arkgate/runtime` | Kernel you construct with `createStrictArkKernel` (one instance per call) | Bundled in the `arkgate` tarball; a process-wide `getKernel()`; shipped cloud broker SDKs |
|
|
24
|
+
|
|
25
|
+
Absence of the extra is **silent** — Layers and ArkRules verdicts stay identical. Doctor / status
|
|
26
|
+
`arkRun` is always `notAScore`. Never invent 0–10 scores or pass/fail from this skill.
|
|
17
27
|
|
|
18
28
|
## Improvement compass note
|
|
19
29
|
|
|
20
30
|
This skill is **experimental runtime** only. Do **not** treat runtime adoption as residual on the
|
|
21
31
|
resilience lens unless the user explicitly opts into the experimental kernel. Prefer doctor compass
|
|
22
32
|
for static architecture residual; hand static residual to `/ark-explore` / `/ark-autopilot`.
|
|
33
|
+
Doctor `arkRun` residual is a finding-id count (`ARKRUN_*`), never a compass score.
|
|
23
34
|
|
|
24
35
|
## Dual engine (mandatory)
|
|
25
36
|
|
|
@@ -41,7 +52,7 @@ restart/retargeting is required. `ark://manifest` never satisfies this preflight
|
|
|
41
52
|
|
|
42
53
|
## Out of scope for ArkRules
|
|
43
54
|
|
|
44
|
-
This skill is **runtime-kernel only**. Do not mix ArkRules structure/invariants here; hand off to `/ark-contract` / `/ark-adopt` / `/ark-explore` for static contract planes.
|
|
55
|
+
This skill is **runtime-kernel only**. Do not mix ArkRules structure/invariants here; hand off to `/ark-contract` / `/ark-adopt` / `/ark-explore` for static contract planes. Label kernel-usage residual **`[ArkRun]`** so it never blurs with **`[Layer]`** or **`[ArkRules]`**.
|
|
45
56
|
|
|
46
57
|
## Subagent fan-out (optional, host-dependent)
|
|
47
58
|
|
|
@@ -62,23 +73,45 @@ the same files or weaken the gate.
|
|
|
62
73
|
- policy/authorization checks scattered across use cases
|
|
63
74
|
Also check whether `@nestjs/common` is present → the `@arkgate/runtime/nestjs`
|
|
64
75
|
adapters apply.
|
|
65
|
-
2. **
|
|
76
|
+
2. **Read the extra** — open `ark.config.json`. If `arkRun` is absent and the user wants the extra,
|
|
77
|
+
**STOP — do not continue this skill as complete.** Handoff **`/ark-adopt`** to write **advisory**
|
|
78
|
+
`arkRun` (schema `1.2+`; `compositionRoots`, `managedLayers`, `requireDeclarations`). Do not
|
|
79
|
+
invent the extra here. If the extra is present, note `mode`, roots, managed layers, and
|
|
80
|
+
`requireDeclarations`; doctor `arkRun` is `notAScore`.
|
|
81
|
+
3. **Pick ONE target** — the smallest, most self-contained candidate (fewest
|
|
66
82
|
call sites). Migrating everything at once is how adoptions die. List the
|
|
67
|
-
rest as follow-ups in the report.
|
|
68
|
-
|
|
83
|
+
rest as follow-ups in the report. New files after the extra is on go through **`/ark-place`**.
|
|
84
|
+
4. **Resolve availability** — run `npm view @arkgate/runtime dist-tags --json`. If an
|
|
69
85
|
`experimental` tag exists, install that exact companion. Otherwise continue only from an
|
|
70
86
|
ArkGate source checkout: run `npm run build:runtime` at its root and install its local
|
|
71
87
|
`packages/runtime` folder into the target. Outside a source checkout, stop and report that the
|
|
72
88
|
runtime is unavailable; never fall back to the deprecated root shims as if they contained it.
|
|
73
|
-
|
|
89
|
+
Import from `@arkgate/runtime` (or `@arkgate/runtime/nestjs`) — never a removed `arkgate/runtime`
|
|
90
|
+
shim.
|
|
91
|
+
5. **Wire through the kernel** — read the
|
|
74
92
|
[runtime package guide](https://github.com/pedroknigge/arkgate/blob/main/packages/runtime/README.md)
|
|
75
93
|
plus the [experimental surface policy](https://github.com/pedroknigge/arkgate/blob/main/docs/package-surface.md#experimental-opt-in-surfaces) before
|
|
76
|
-
writing code.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
94
|
+
writing code.
|
|
95
|
+
- Call `createStrictArkKernel` (or an admission sibling: `createArkKernel`, `*FromConfig`) **only**
|
|
96
|
+
inside `arkRun.compositionRoots`. Each call is a new instance — no process-wide singleton.
|
|
97
|
+
- Keep Domain-role layers kernel-free (`ARKRUN_KERNEL_IN_DOMAIN`).
|
|
98
|
+
- Resolve managed types from the kernel; do not construct admitted types with `new`
|
|
99
|
+
(`ARKRUN_DIRECT_NEW`).
|
|
100
|
+
- On `register()`, declare `uses` / `reactsTo` / `raises` / `sends`. `extendedInfo` is
|
|
101
|
+
tooling-only and is **not** a gate verdict. Adding an existing call-site literal to the
|
|
102
|
+
declaration list is the only mechanical-safe ArkRun edit; inventing a new emit / handle /
|
|
103
|
+
depend is judgment.
|
|
104
|
+
- Send on kernel transport: `local` / `localBlocking` / `broker`. `ephemeral` defaults **true**.
|
|
105
|
+
Broker adapters are ports you inject — this package does not ship cloud SDKs. Unbound
|
|
106
|
+
`broker` falls back in-process local. Do not import `EventEmitter` or a homemade bus in
|
|
107
|
+
`managedLayers` (`ARKRUN_TRANSPORT_BYPASS`).
|
|
108
|
+
- Optional inspector: `startInspector()` on `127.0.0.1`, refuses `NODE_ENV=production`, no
|
|
109
|
+
public bind. Snapshots / `requestGraph` (process or technical + Mermaid) are tooling, not a
|
|
110
|
+
score. `getDependencyInformationPackage()` never includes factories, live instances, or
|
|
111
|
+
input DTOs.
|
|
112
|
+
- In-memory stores lose state on restart — **not** production durability. Note bounded history
|
|
113
|
+
(`maxHistorySize` 1000) if the hand-rolled version retained everything.
|
|
114
|
+
6. **Delete the hand-rolled version** once call sites are moved — the point is
|
|
82
115
|
less code, not a second parallel system. Deleting code is a destructive move:
|
|
83
116
|
confirm with the user before removing the old implementation, and never delete
|
|
84
117
|
something the inventory only *suspects* is dead (a misclassified load-bearing
|
|
@@ -87,6 +120,8 @@ the same files or weaken the gate.
|
|
|
87
120
|
## Critical handoffs
|
|
88
121
|
|
|
89
122
|
- No static gates yet: **STOP — do not continue this skill as complete.** Run `/ark-adopt` first (`ark-check --recommend` / leftover `/ark-architect`).
|
|
123
|
+
- Extra absent and the user wants it: **STOP — do not continue this skill as complete.** **`/ark-adopt`** writes advisory `arkRun`.
|
|
124
|
+
- Skip cluster (`new` of managed types, homemade bus, kernel in Domain) after the extra is on: leftover **`/ark-fix`** / **`/ark-loop`** or **`/ark-autopilot`** — this skill still wires one candidate.
|
|
90
125
|
- Runtime companion unavailable from npm and no ArkGate source checkout: **STOP** and report the distribution boundary.
|
|
91
126
|
- Inventory finds nothing: stop; do not introduce kernel speculatively.
|
|
92
127
|
|
|
@@ -96,20 +131,26 @@ the same files or weaken the gate.
|
|
|
96
131
|
introduce the runtime kernel speculatively. Static enforcement alone is a
|
|
97
132
|
complete, valid use of Ark.
|
|
98
133
|
- Keep the migration diff reviewable: one feature per invocation.
|
|
134
|
+
- Skills never enforce; never weaken `ark.config.json` to skip `ARKRUN_*`.
|
|
135
|
+
- Never a process-wide kernel singleton. Never shipped cloud broker SDKs.
|
|
136
|
+
- Never claim in-memory stores are production-durable.
|
|
99
137
|
- Plain-language reporting: one sentence per concept ("outbox = events are
|
|
100
138
|
saved in the same transaction as your data, then published — so you never
|
|
101
139
|
publish something that didn't commit").
|
|
102
140
|
|
|
103
141
|
## Related onboarding
|
|
104
142
|
|
|
105
|
-
- Adopt static gates and application shape **first** (`/ark-adopt`).
|
|
106
|
-
|
|
143
|
+
- Adopt static gates and application shape **first** (`/ark-adopt`). Brownfield: same door —
|
|
144
|
+
advisory extra only until the team promotes; absence is valid.
|
|
145
|
+
- Runtime kernel is optional and separate from enthusiast onboarding. Do not put `arkRun` on the
|
|
146
|
+
compact starter.
|
|
107
147
|
|
|
108
148
|
## Verify and report
|
|
109
149
|
|
|
110
150
|
Run the project's tests plus `ark-check --root . --config ark.config.json
|
|
111
151
|
--strict-config`. Report: what was migrated, lines deleted vs added, remaining
|
|
112
|
-
candidates ranked,
|
|
152
|
+
candidates ranked, behavior differences (e.g. bounded history), and **`[ArkRun]`** residual
|
|
153
|
+
(`ARKRUN_*` / doctor `arkRun`, `notAScore`) separately from Layers / ArkRules.
|
|
113
154
|
|
|
114
155
|
## Completion contract (skill incomplete if missing)
|
|
115
156
|
|
|
@@ -119,6 +160,7 @@ End with **exactly** these headings (markdown `###`):
|
|
|
119
160
|
- **Sensor:** commands/tools run
|
|
120
161
|
- **Opened:** real paths read (or `n/a` only if pure install/upgrade with no source analysis)
|
|
121
162
|
- **Result:** one-line outcome
|
|
163
|
+
- **Planes:** **`[ArkRun]`** residual (or `n/a` if extra absent) — do not mix with `[Layer]` / `[ArkRules]`
|
|
122
164
|
- **Compass:** `n/a` (runtime skill; static residual → explore/fix) | top residual if doctor was run
|
|
123
165
|
- **Handoff:** `/ark-…` / CLI / `none`
|
|
124
166
|
- **Incomplete?** `no` | `yes — <what is missing>`
|