arkgate 2.12.0 → 2.13.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 +83 -0
- package/README.md +55 -31
- package/bin/ark-check.mjs +95 -36
- package/bin/ark-mcp.mjs +11 -5
- package/bin/ark-shared.mjs +88 -56
- package/bin/ark.mjs +45 -10
- package/bin/lib/agent-gates.mjs +12 -0
- package/bin/lib/architecture-scan.mjs +8 -0
- package/bin/lib/ci-and-commands.mjs +9 -3
- package/bin/lib/codex-home.mjs +7 -0
- package/bin/lib/config-contract.mjs +331 -0
- package/bin/lib/doctor-plan.mjs +43 -16
- package/bin/lib/enforcement-profiles.mjs +97 -0
- package/bin/lib/host-support-matrix.mjs +77 -0
- package/bin/lib/install-migrate.mjs +45 -14
- package/bin/lib/mcp-adoption.mjs +35 -3
- package/bin/lib/open-html.mjs +75 -0
- package/bin/lib/presets.mjs +3 -2
- package/bin/lib/safety-diagnostics.mjs +31 -11
- package/bin/lib/skill-install.mjs +64 -0
- package/bin/lib/ts-resolve.mjs +2 -1
- package/bin/lib/weakest-link.mjs +417 -0
- package/bin/lib/write-path-capabilities.mjs +182 -0
- package/bin/lib/write-path-detect.mjs +62 -99
- package/dist/configContract-iBLxx5Tz.d.cts +53 -0
- package/dist/configContract-iBLxx5Tz.d.ts +53 -0
- package/dist/eslint/index.cjs +375 -13
- package/dist/eslint/index.cjs.map +1 -1
- package/dist/eslint/index.d.cts +30 -20
- package/dist/eslint/index.d.ts +30 -20
- package/dist/eslint/index.js +375 -13
- package/dist/eslint/index.js.map +1 -1
- package/dist/index.cjs +723 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +95 -5
- package/dist/index.d.ts +95 -5
- package/dist/index.js +716 -61
- package/dist/index.js.map +1 -1
- package/dist/nestjs/index.cjs +150 -42
- package/dist/nestjs/index.cjs.map +1 -1
- package/dist/nestjs/index.d.cts +2 -1
- package/dist/nestjs/index.d.ts +2 -1
- package/dist/nestjs/index.js +150 -42
- package/dist/nestjs/index.js.map +1 -1
- package/dist/runtime/index.cjs +723 -61
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.d.cts +3 -2
- package/dist/runtime/index.d.ts +3 -2
- package/dist/runtime/index.js +716 -61
- package/dist/runtime/index.js.map +1 -1
- package/dist/{types-BZ17b9i5.d.cts → types-BxBwnBpC.d.cts} +9 -36
- package/dist/{types-BZ17b9i5.d.ts → types-Wcs_l1_J.d.ts} +9 -36
- package/docs/agent-guide.md +32 -20
- package/docs/ai-gates.md +53 -18
- package/docs/configuration.md +97 -0
- package/docs/enthusiast/README.md +3 -3
- package/docs/enthusiast/how-to-agent-gates.md +7 -3
- package/docs/migrate-from-ark-runtime-kernel.md +3 -0
- package/docs/package-surface.md +14 -9
- package/docs/production-hardening.md +15 -2
- package/docs/threat-model.md +65 -0
- package/docs/typescript-support.md +3 -3
- package/package.json +15 -2
- package/schemas/ark.config.schema.json +750 -0
- package/server.json +2 -2
- package/templates/hooks/pre-commit-ark +37 -0
- package/templates/skills/ark-coverage.md +2 -2
- package/templates/skills/ark-runtime.md +8 -5
- package/templates/skills/ark-upgrade.md +36 -16
- package/tests/fixtures/ts-consumer/ark.config.json +2 -0
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/pedroknigge/arkgate",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "2.
|
|
9
|
+
"version": "2.13.0",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "arkgate",
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.13.0",
|
|
15
15
|
"runtimeHint": "npx",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Maintained by ArkGate (Q3) — human-edit architecture gate.
|
|
3
|
+
# Install (git hooks):
|
|
4
|
+
# cp templates/hooks/pre-commit-ark .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
|
|
5
|
+
# Or with husky:
|
|
6
|
+
# cp templates/hooks/pre-commit-ark .husky/pre-commit && chmod +x .husky/pre-commit
|
|
7
|
+
#
|
|
8
|
+
# Blocks commit when ark-check fails. Does not replace CI branch protection.
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
|
|
12
|
+
cd "$ROOT"
|
|
13
|
+
|
|
14
|
+
run_check() {
|
|
15
|
+
if [ -f package.json ] && node -e "const p=require('./package.json');process.exit(p.scripts&&p.scripts['check:architecture']?0:1)" 2>/dev/null; then
|
|
16
|
+
npm run -s check:architecture
|
|
17
|
+
return $?
|
|
18
|
+
fi
|
|
19
|
+
if [ -f bin/ark-check.mjs ]; then
|
|
20
|
+
node bin/ark-check.mjs --root . --config ark.config.json --strict-config
|
|
21
|
+
return $?
|
|
22
|
+
fi
|
|
23
|
+
if command -v arkgate-check >/dev/null 2>&1; then
|
|
24
|
+
arkgate-check --root . --config ark.config.json --strict-config
|
|
25
|
+
return $?
|
|
26
|
+
fi
|
|
27
|
+
if command -v npx >/dev/null 2>&1; then
|
|
28
|
+
# --yes: pre-commit is non-interactive; never hang on npx install prompts
|
|
29
|
+
npx --yes --no-install arkgate-check --root . --config ark.config.json --strict-config 2>/dev/null \
|
|
30
|
+
|| npx --yes arkgate-check --root . --config ark.config.json --strict-config
|
|
31
|
+
return $?
|
|
32
|
+
fi
|
|
33
|
+
echo "ark-check not found — install arkgate or add check:architecture script" >&2
|
|
34
|
+
return 1
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
run_check
|
|
@@ -56,7 +56,7 @@ feature dirs, plan clusters), you **may** dispatch **subagents**:
|
|
|
56
56
|
|------|----------------|--------------------|
|
|
57
57
|
| **Suggest / Setup** | Thin or new tree | “Ark will propose a starting shape — you don’t switch a mode.” |
|
|
58
58
|
| **Adapt / Align** | Contract ≠ folders or open debt | “Gates don’t fully protect you yet — classify + fix plan.” |
|
|
59
|
-
| **Enforce / Guard** | Coverage + clean edges + honest cores | “You arrived here — keep
|
|
59
|
+
| **Enforce / Guard** | Coverage + clean edges + honest cores | “You arrived here — keep the host-appropriate write path and CI check on.” |
|
|
60
60
|
|
|
61
61
|
Never say “your architecture is guarded” while `goal.met` is false, governed% is low,
|
|
62
62
|
or false-green doctor gaps are open.
|
|
@@ -73,7 +73,7 @@ or false-green doctor gaps are open.
|
|
|
73
73
|
|
|
74
74
|
1. Config + `ark-check --strict-config` (dead preset globs advisory; unclassified files still fail strict).
|
|
75
75
|
2. Baseline policy (orphan empty file? wire or delete).
|
|
76
|
-
3.
|
|
76
|
+
3. Host-appropriate write path + `/ark-*` skills per detected agent.
|
|
77
77
|
4. CI workflow + monorepo install reality (`frontend/package.json`?).
|
|
78
78
|
5. ESLint `arkgate/eslint` if ESLint exists.
|
|
79
79
|
6. Domain `forbiddenGlobals`.
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ark-runtime
|
|
3
|
-
description:
|
|
3
|
+
description: Evaluate the experimental Ark runtime kernel against hand-rolled event bus, outbox, audit, saga, projection, policy, or NestJS code. Finds one candidate, wires one, verifies.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# /ark-runtime —
|
|
6
|
+
# /ark-runtime — Evaluate the runtime kernel (experimental opt-in)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
The runtime kernel is currently **experimental** and is not required for ArkGate enforcement or
|
|
9
|
+
presented as production-ready. Use this skill only when the user explicitly wants to evaluate it.
|
|
10
|
+
|
|
11
|
+
`arkgate` ships the experimental runtime kernel
|
|
9
12
|
(`createArkKernel`) with an event bus, event contracts, outbox, audit trail,
|
|
10
13
|
policy engine, workflow/saga coordination, projections, observability hooks,
|
|
11
14
|
and NestJS adapters. This skill migrates hand-rolled versions of those to the
|
|
@@ -43,12 +46,12 @@ the same files or weaken the gate.
|
|
|
43
46
|
2. **Pick ONE target** — the smallest, most self-contained candidate (fewest
|
|
44
47
|
call sites). Migrating everything at once is how adoptions die. List the
|
|
45
48
|
rest as follow-ups in the report.
|
|
46
|
-
3. **Migrate** — import from `arkgate` (
|
|
49
|
+
3. **Migrate** — import from `arkgate/runtime` (preferred experimental subpath) or
|
|
47
50
|
`arkgate/nestjs`, and read the package's `docs/agent-guide.md`
|
|
48
51
|
(in `node_modules/arkgate/docs/`) for the runtime API before
|
|
49
52
|
writing code. Wire the kernel at the composition root; keep the domain
|
|
50
53
|
ignorant of it (handlers/ports, not kernel imports inside domain code —
|
|
51
|
-
the
|
|
54
|
+
the architecture check enforces this; Claude/Grok hooks can block it earlier). Note: the kernel bounds in-memory
|
|
52
55
|
history by default (`maxHistorySize` 1000); mention this if the hand-rolled
|
|
53
56
|
version retained everything.
|
|
54
57
|
4. **Delete the hand-rolled version** once call sites are moved — the point is
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ark-upgrade
|
|
3
|
-
description: Update arkgate to the latest published version, then refresh gates and /ark-* skills for
|
|
3
|
+
description: Update arkgate to the latest published version, then refresh gates and /ark-* skills for the active agent host (defer inactive hosts like Codex when not in use) and re-verify the architecture check. Autonomous.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# /ark-upgrade — Update ArkGate and refresh its gates
|
|
@@ -38,6 +38,13 @@ read the **Adoption** section — host gaps, Codex home temp paths, optional-but
|
|
|
38
38
|
core layers, missing origin snapshot, baseline policy. Fix commands are printed per gap.
|
|
39
39
|
HTML reports include the same Adoption card (separate from the 0–100 fitness score).
|
|
40
40
|
|
|
41
|
+
**Active host vs deferred hosts:** green the **session host** (Grok, Claude, Cursor, …)
|
|
42
|
+
and repo gates first. Codex home (`$CODEX_HOME` prompts + `config.toml` MCP multi-project)
|
|
43
|
+
is **deferred** unless this session is Codex or the user asked to fix Codex. Doctor marks
|
|
44
|
+
those gaps `deferred` / info and does not put them in Top actions. A temp/upgrade MCP
|
|
45
|
+
`--root` stays urgent (fail-closed rewrite). Never set **Incomplete?** because of deferred
|
|
46
|
+
Codex debt.
|
|
47
|
+
|
|
41
48
|
## Dual engine (mandatory)
|
|
42
49
|
|
|
43
50
|
| Engine | Role |
|
|
@@ -58,7 +65,8 @@ the same files or weaken the gate.
|
|
|
58
65
|
## Fast path
|
|
59
66
|
|
|
60
67
|
One command does the whole flow — update the package, refresh gates + `/ark-*` skills
|
|
61
|
-
(and Codex home prompts), migrate command runners,
|
|
68
|
+
(and best-effort Codex home prompts when `~/.codex` exists), migrate command runners,
|
|
69
|
+
and run the strict check:
|
|
62
70
|
|
|
63
71
|
```
|
|
64
72
|
arkgate upgrade
|
|
@@ -112,13 +120,18 @@ npx arkgate-check --install-agent-gates --skills-only --force
|
|
|
112
120
|
losing customizations. If the changelog says a GATE file changed, report the
|
|
113
121
|
diff and let the user decide; never rewrite settings/CI/AGENTS.md without
|
|
114
122
|
explicit approval.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
(
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
**Active host first.** Refresh skills for the host running this skill (e.g.
|
|
124
|
+
`.grok/skills/`, `.claude/skills/`, `.cursor/commands/`). Repo-local copies for
|
|
125
|
+
other detected hosts are fine to refresh in the same pass when cheap.
|
|
126
|
+
**Codex is deferred when you are not on Codex.** Prompts live in
|
|
127
|
+
`$CODEX_HOME/prompts` (`~/.codex/prompts`), not the repo. `ark upgrade` may
|
|
128
|
+
best-effort refresh that home when it exists; still list Codex under
|
|
129
|
+
**Deferred hosts** and do **not** chase MCP multi-project / stale home skills
|
|
130
|
+
until the user is on Codex (or asks). Fix command when needed:
|
|
131
|
+
`ark-check --install-agent-gates --skills-only --codex-home --force`
|
|
132
|
+
(and `--tools codex` / `--force` for primary MCP rebind). Exception: temp or
|
|
133
|
+
`ark-upgrade` MCP `--root` paths — leave fail-closed rewrite to the CLI; do not
|
|
134
|
+
block completion on multi-project noise.
|
|
122
135
|
**Migrate stale command runners.** The package-manager-aware command templates
|
|
123
136
|
(`pnpm exec` / `yarn` / `npx`) only apply to NEWLY written files, so a repo that adopted
|
|
124
137
|
Ark before they shipped keeps a stale `npx` in its EXISTING gate files
|
|
@@ -138,10 +151,14 @@ npx arkgate-check --install-agent-gates --skills-only --force
|
|
|
138
151
|
|
|
139
152
|
## Operating rules
|
|
140
153
|
|
|
141
|
-
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
154
|
+
- **Must green:** the **active session host** (skills + gates that host uses) and
|
|
155
|
+
shared repo surfaces (`.mcp.json` dual-bin, command runners, architecture check).
|
|
156
|
+
- **May defer:** other hosts not used in this session. Always list them under
|
|
157
|
+
**Deferred hosts** with the fix command — do not treat them as Incomplete.
|
|
158
|
+
Codex home (global `$CODEX_HOME`) is the common case on Grok/Claude.
|
|
159
|
+
- **Optional sync:** if other repo-local tool dirs already exist (`.cursor/`,
|
|
160
|
+
`.claude/`, …), refreshing their `/ark-*` skills is good hygiene when cheap;
|
|
161
|
+
it is not a reason to fail the skill when the active host is already current.
|
|
145
162
|
- Never run `--force` blindly; customized files are the user's.
|
|
146
163
|
- Stop only if the changelog documents a breaking config change with two valid
|
|
147
164
|
migration paths — then present both with a recommendation.
|
|
@@ -158,8 +175,8 @@ npx arkgate-check --install-agent-gates --skills-only --force
|
|
|
158
175
|
|
|
159
176
|
End with a passing check. Report: latest published version, old → new version
|
|
160
177
|
(or "already latest"), changelog entries that mattered here (plain language),
|
|
161
|
-
files written/refreshed
|
|
162
|
-
look, and the final check status.
|
|
178
|
+
files written/refreshed for the **active host**, deferred hosts (if any),
|
|
179
|
+
skipped customized files needing a manual look, and the final check status.
|
|
163
180
|
|
|
164
181
|
## Completion contract (skill incomplete if missing)
|
|
165
182
|
|
|
@@ -168,9 +185,12 @@ End with **exactly** these headings (markdown `###`):
|
|
|
168
185
|
### Completion
|
|
169
186
|
- **Sensor:** commands/tools run
|
|
170
187
|
- **Opened:** real paths read (or `n/a` only if pure install/upgrade with no source analysis)
|
|
188
|
+
- **Active host:** e.g. `grok` / `claude` / `cursor` / `codex` (skills/gates OK or note)
|
|
189
|
+
- **Deferred hosts:** `none` | e.g. `codex — home MCP/prompts; fix when using Codex`
|
|
171
190
|
- **Result:** one-line outcome
|
|
172
191
|
- **Handoff:** `/ark-…` / CLI / `none`
|
|
173
192
|
- **Incomplete?** `no` | `yes — <what is missing>`
|
|
174
193
|
|
|
175
194
|
If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
|
|
176
|
-
**
|
|
195
|
+
**Deferred hosts (including Codex when not on Codex) never make Incomplete? yes.**
|
|
196
|
+
**Skill incomplete if missing** any of the bullets above (use `none` for Deferred hosts when empty).
|