arkgate 2.1.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 +1249 -0
- package/LICENSE +21 -0
- package/README.md +218 -0
- package/SECURITY.md +39 -0
- package/bin/ark-check.mjs +5204 -0
- package/bin/ark-mcp.mjs +898 -0
- package/bin/ark-shared.mjs +1520 -0
- package/bin/ark.mjs +491 -0
- package/dist/eslint/index.cjs +222 -0
- package/dist/eslint/index.cjs.map +1 -0
- package/dist/eslint/index.d.cts +42 -0
- package/dist/eslint/index.d.ts +40 -0
- package/dist/eslint/index.js +193 -0
- package/dist/eslint/index.js.map +1 -0
- package/dist/index.cjs +3080 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +577 -0
- package/dist/index.d.ts +577 -0
- package/dist/index.js +2998 -0
- package/dist/index.js.map +1 -0
- package/dist/nestjs/index.cjs +2332 -0
- package/dist/nestjs/index.cjs.map +1 -0
- package/dist/nestjs/index.d.cts +22 -0
- package/dist/nestjs/index.d.ts +22 -0
- package/dist/nestjs/index.js +2308 -0
- package/dist/nestjs/index.js.map +1 -0
- package/dist/types-DpdVN7Lm.d.cts +1023 -0
- package/dist/types-DpdVN7Lm.d.ts +1023 -0
- package/docs/agent-guide.md +490 -0
- package/docs/ai-gates.md +337 -0
- package/docs/ark-check-example.json +87 -0
- package/docs/assets/ark-write-gate.svg +28 -0
- package/docs/brownfield-adoption.md +87 -0
- package/docs/demos/01-write-gate-self-correction.md +74 -0
- package/docs/demos/02-brownfield-baseline-adoption.md +71 -0
- package/docs/demos/03-copilot-autopilot.md +83 -0
- package/docs/enthusiast/README.md +62 -0
- package/docs/enthusiast/explanation-application-shape.md +29 -0
- package/docs/enthusiast/how-to-agent-gates.md +36 -0
- package/docs/enthusiast/how-to-gallery-starter.md +27 -0
- package/docs/enthusiast/how-to-pick-shape.md +45 -0
- package/docs/enthusiast/how-to-policy-pack.md +37 -0
- package/docs/enthusiast/reference-archetypes.md +36 -0
- package/docs/enthusiast/reference-commands.md +50 -0
- package/docs/enthusiast/tutorial-first-project.md +86 -0
- package/docs/production-hardening.md +59 -0
- package/package.json +125 -0
- package/server.json +39 -0
- package/templates/architecture-playbook.json +339 -0
- package/templates/policy-packs/enthusiast-feature-sliced.json +20 -0
- package/templates/policy-packs/enthusiast-hexagonal.json +18 -0
- package/templates/policy-packs/enthusiast-layered.json +18 -0
- package/templates/policy-packs/enthusiast-monorepo.json +18 -0
- package/templates/skills/ark-adopt.md +103 -0
- package/templates/skills/ark-architect.md +90 -0
- package/templates/skills/ark-autopilot.md +95 -0
- package/templates/skills/ark-contract.md +98 -0
- package/templates/skills/ark-coverage.md +96 -0
- package/templates/skills/ark-explain.md +78 -0
- package/templates/skills/ark-fix.md +96 -0
- package/templates/skills/ark-loop.md +69 -0
- package/templates/skills/ark-place.md +68 -0
- package/templates/skills/ark-runtime.md +62 -0
- package/templates/skills/ark-upgrade.md +109 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ark-runtime
|
|
3
|
+
description: Replace hand-rolled infra with the Ark runtime kernel — event bus, outbox, audit, sagas, projections, policies, NestJS. Finds candidates, wires one, verifies.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /ark-runtime — Adopt the runtime kernel (opt-in features)
|
|
7
|
+
|
|
8
|
+
`arkgate` is not just static checking: it ships a runtime kernel
|
|
9
|
+
(`createArkKernel`) with an event bus, event contracts, outbox, audit trail,
|
|
10
|
+
policy engine, workflow/saga coordination, projections, observability hooks,
|
|
11
|
+
and NestJS adapters. This skill migrates hand-rolled versions of those to the
|
|
12
|
+
kernel, one feature at a time.
|
|
13
|
+
|
|
14
|
+
## Steps
|
|
15
|
+
|
|
16
|
+
1. **Inventory** — grep the codebase for hand-rolled equivalents:
|
|
17
|
+
- event bus / emitter used for domain events (`EventEmitter`, homemade
|
|
18
|
+
pub/sub, ad-hoc handler registries)
|
|
19
|
+
- outbox tables or "save event + publish later" code
|
|
20
|
+
- audit/history logs written manually
|
|
21
|
+
- saga/workflow orchestration (multi-step processes with compensation)
|
|
22
|
+
- read-model/projection builders
|
|
23
|
+
- policy/authorization checks scattered across use cases
|
|
24
|
+
Also check whether `@nestjs/common` is present → the `arkgate/nestjs`
|
|
25
|
+
adapters apply.
|
|
26
|
+
2. **Pick ONE target** — the smallest, most self-contained candidate (fewest
|
|
27
|
+
call sites). Migrating everything at once is how adoptions die. List the
|
|
28
|
+
rest as follow-ups in the report.
|
|
29
|
+
3. **Migrate** — import from `arkgate` (root export) or
|
|
30
|
+
`arkgate/nestjs`, and read the package's `docs/agent-guide.md`
|
|
31
|
+
(in `node_modules/arkgate/docs/`) for the runtime API before
|
|
32
|
+
writing code. Wire the kernel at the composition root; keep the domain
|
|
33
|
+
ignorant of it (handlers/ports, not kernel imports inside domain code —
|
|
34
|
+
the write gate will enforce this anyway). Note: the kernel bounds in-memory
|
|
35
|
+
history by default (`maxHistorySize` 1000); mention this if the hand-rolled
|
|
36
|
+
version retained everything.
|
|
37
|
+
4. **Delete the hand-rolled version** once call sites are moved — the point is
|
|
38
|
+
less code, not a second parallel system. Deleting code is a destructive move:
|
|
39
|
+
confirm with the user before removing the old implementation, and never delete
|
|
40
|
+
something the inventory only *suspects* is dead (a misclassified load-bearing
|
|
41
|
+
emitter must not be removed on a guess).
|
|
42
|
+
|
|
43
|
+
## Operating rules
|
|
44
|
+
|
|
45
|
+
- If the inventory finds NO hand-rolled equivalents, say so and stop — do not
|
|
46
|
+
introduce the runtime kernel speculatively. Static enforcement alone is a
|
|
47
|
+
complete, valid use of Ark.
|
|
48
|
+
- Keep the migration diff reviewable: one feature per invocation.
|
|
49
|
+
- Plain-language reporting: one sentence per concept ("outbox = events are
|
|
50
|
+
saved in the same transaction as your data, then published — so you never
|
|
51
|
+
publish something that didn't commit").
|
|
52
|
+
|
|
53
|
+
## Related onboarding
|
|
54
|
+
|
|
55
|
+
- Adopt static gates and application shape **first** (`/ark-architect`, `/ark-adopt`).
|
|
56
|
+
- Runtime kernel is optional and separate from enthusiast onboarding.
|
|
57
|
+
|
|
58
|
+
## Verify and report
|
|
59
|
+
|
|
60
|
+
Run the project's tests plus `ark-check --root . --config ark.config.json
|
|
61
|
+
--strict-config`. Report: what was migrated, lines deleted vs added, remaining
|
|
62
|
+
candidates ranked, and any behavior differences (e.g. bounded history).
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ark-upgrade
|
|
3
|
+
description: Update arkgate to the latest published version, then refresh gates and /ark-* skills for every agent CLI and re-verify the architecture check. Autonomous.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /ark-upgrade — Update Ark and refresh its gates
|
|
7
|
+
|
|
8
|
+
Update the `arkgate` dependency to the latest published version and
|
|
9
|
+
bring the repo's generated artifacts and gates in line with it. This skill
|
|
10
|
+
checks the registry itself — don't assume the copy in `node_modules` is current.
|
|
11
|
+
|
|
12
|
+
## Fast path
|
|
13
|
+
|
|
14
|
+
One command does the whole flow — update the package, refresh gates + `/ark-*` skills
|
|
15
|
+
(and Codex home prompts), migrate command runners, and run the strict check:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
ark upgrade
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Use it when the user just wants the update done. Run the detailed steps below instead when
|
|
22
|
+
you need to inspect the changelog first, handle a pnpm cooling-off window, or the one-liner
|
|
23
|
+
reports a problem to triage.
|
|
24
|
+
|
|
25
|
+
## Steps
|
|
26
|
+
|
|
27
|
+
1. **Check the registry, then update.** Compare the installed version
|
|
28
|
+
(`node_modules/arkgate/package.json`) against the latest published:
|
|
29
|
+
`npm view arkgate version`. If a newer version exists, update it —
|
|
30
|
+
`npm install -D arkgate@latest` (or the project's package manager:
|
|
31
|
+
`pnpm add -D` / `yarn add -D`) — so the lockfile moves too; a pinned lockfile
|
|
32
|
+
is exactly why "just re-run install" often stays on the old version. If the
|
|
33
|
+
installed version already equals the latest, say so and still run steps 3-4
|
|
34
|
+
(a prior version may have shipped skills/gates this repo never installed).
|
|
35
|
+
Do NOT report "no update available" from the `node_modules` version alone —
|
|
36
|
+
that reads stale.
|
|
37
|
+
**pnpm cooling-off:** if the repo enforces a pnpm `minimumReleaseAge` and the new
|
|
38
|
+
version was published inside that window (common for a freshly-cut release), a plain
|
|
39
|
+
`pnpm add` in loose mode can leave a lockfile that `pnpm install --frozen-lockfile` (what
|
|
40
|
+
CI runs) then REJECTS. Do it cleanly: add the exact `<pkg>@<version>` to
|
|
41
|
+
`minimumReleaseAgeExclude` in `pnpm-workspace.yaml` FIRST, bump the dependency spec, then
|
|
42
|
+
run a plain `pnpm install`, and verify with `pnpm install --frozen-lockfile` before moving
|
|
43
|
+
on. Only exclude a first-party package you trust.
|
|
44
|
+
2. **Changelog triage** — read `node_modules/arkgate/CHANGELOG.md`
|
|
45
|
+
(shipped in the package) for the versions between old and new, and pick out
|
|
46
|
+
only entries that affect THIS repo (new flags, changed defaults, new gate
|
|
47
|
+
templates, new skills). Summarize each in one sentence with what, if
|
|
48
|
+
anything, the repo must do about it. If the file is absent (older releases
|
|
49
|
+
didn't ship it), fall back to `npm view arkgate@<version> ...` or
|
|
50
|
+
the GitHub release notes — say which source you used.
|
|
51
|
+
3. **Refresh templates** — run `ark-check --install-agent-gates`. Without
|
|
52
|
+
`--force` it only writes missing files (new skills, new tool templates) and
|
|
53
|
+
skips existing ones. To pick up NEW versions of the `/ark-*` skills that a
|
|
54
|
+
package update shipped, run `ark-check --install-agent-gates --skills-only
|
|
55
|
+
--force`: `--skills-only` scopes the overwrite to the canonical skills and
|
|
56
|
+
leaves the gate files alone. Do NOT run a bare `--install-agent-gates --force`
|
|
57
|
+
to refresh skills — it also overwrites `AGENTS.md` (often customized with the
|
|
58
|
+
project's real layer table), `.claude/settings.json` (hooks/permissions), and
|
|
59
|
+
`.github/workflows/ark-check.yml` (CI) with the generic templates, silently
|
|
60
|
+
losing customizations. If the changelog says a GATE file changed, report the
|
|
61
|
+
diff and let the user decide; never rewrite settings/CI/AGENTS.md without
|
|
62
|
+
explicit approval.
|
|
63
|
+
If you use Codex, its prompts live in `$CODEX_HOME/prompts` (`~/.codex/prompts`),
|
|
64
|
+
not the repo, so a repo refresh never updates them. Refresh them there too:
|
|
65
|
+
`ark-check --install-agent-gates --skills-only --codex-home --force`. Keep
|
|
66
|
+
`--skills-only` — without it, `--force` also rewrites customized gate files
|
|
67
|
+
(AGENTS.md, CI, settings). This writes to the user's home dir — say so. (A normal
|
|
68
|
+
`ark-check` now flags stale Codex-home skills when copies exist, so you don't have
|
|
69
|
+
to remember.)
|
|
70
|
+
**Migrate stale command runners.** The package-manager-aware command templates
|
|
71
|
+
(`pnpm exec` / `yarn` / `npx`) only apply to NEWLY written files, so a repo that adopted
|
|
72
|
+
Ark before they shipped keeps a stale `npx` in its EXISTING gate files
|
|
73
|
+
(`.claude/settings.json` hooks, `.mcp.json`, `AGENTS.md`, the `check:architecture` script).
|
|
74
|
+
In a pnpm/yarn repo that means the write gate runs on a command the repo forbids. Run
|
|
75
|
+
`ark-check --install-agent-gates --migrate-commands`: it rewrites ONLY the command runner
|
|
76
|
+
in those files, preserving every customization (no `--force` clobber). A normal `ark-check`
|
|
77
|
+
also flags this when it detects the mismatch.
|
|
78
|
+
4. **Re-verify** — `ark-check --root . --config ark.config.json
|
|
79
|
+
--strict-config` (with `--baseline .ark-baseline.json` if present). A new
|
|
80
|
+
version may detect violations the old one missed: if new violations appear,
|
|
81
|
+
apply `/ark-fix` reasoning to resolve them. If they are too numerous to fix
|
|
82
|
+
now, freezing them in the baseline (`--update-baseline`) is a valid stopgap
|
|
83
|
+
but it silences NEW violations, so it requires explicit user approval first
|
|
84
|
+
— never regenerate the baseline on your own to get a green check.
|
|
85
|
+
|
|
86
|
+
## Operating rules
|
|
87
|
+
|
|
88
|
+
- Cover EVERY detected agent CLI (`.claude/`, `.cursor/`, `.codex/`,
|
|
89
|
+
`.windsurf/`, `.clinerules/`, `.kiro/`), not just the one running this skill —
|
|
90
|
+
gates and skills must stay in sync across tools or the weakest tool becomes
|
|
91
|
+
the hole in the fence.
|
|
92
|
+
- Never run `--force` blindly; customized files are the user's.
|
|
93
|
+
- Stop only if the changelog documents a breaking config change with two valid
|
|
94
|
+
migration paths — then present both with a recommendation.
|
|
95
|
+
|
|
96
|
+
## Related onboarding
|
|
97
|
+
|
|
98
|
+
- After upgrade, re-run `ark-check --doctor` — `/ark-architect` and `ark-check --recommend` ship
|
|
99
|
+
with the package for **greenfield** shape adoption.
|
|
100
|
+
- **Brownfield** repos: point users to `/ark-adopt` and `docs/brownfield-adoption.md`, not
|
|
101
|
+
`/ark-architect`. Demo: `docs/demos/02-brownfield-baseline-adoption.md`.
|
|
102
|
+
- Refresh gates: `ark-check --install-agent-gates --force --skills-only` if skills are stale.
|
|
103
|
+
|
|
104
|
+
## Verify and report
|
|
105
|
+
|
|
106
|
+
End with a passing check. Report: latest published version, old → new version
|
|
107
|
+
(or "already latest"), changelog entries that mattered here (plain language),
|
|
108
|
+
files written/refreshed per tool, skipped customized files needing a manual
|
|
109
|
+
look, and the final check status.
|