arkgate 2.6.1 → 2.8.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 +62 -0
- package/README.md +8 -3
- package/bin/ark-check.mjs +19 -993
- package/bin/ark-layer-match.mjs +148 -171
- package/bin/ark-shared.mjs +9 -159
- package/bin/lib/agent-gates.mjs +48 -228
- package/bin/lib/architecture-scan.mjs +299 -0
- package/bin/lib/ast-scan.mjs +427 -0
- package/bin/lib/baseline-key.mjs +23 -0
- package/bin/lib/codex-home.mjs +320 -0
- package/bin/lib/config-warnings.mjs +228 -0
- package/bin/lib/doctor-plan.mjs +2 -0
- package/bin/lib/graph-cycles.mjs +56 -0
- package/bin/lib/remediation.mjs +182 -0
- package/bin/lib/scan-files.mjs +69 -0
- package/bin/lib/ts-resolve.mjs +216 -0
- package/bin/lib/violations.mjs +3 -9
- package/dist/eslint/index.cjs +21 -3
- package/dist/eslint/index.cjs.map +1 -1
- package/dist/eslint/index.d.cts +5 -3
- package/dist/eslint/index.d.ts +5 -3
- package/dist/eslint/index.js +21 -3
- package/dist/eslint/index.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/nestjs/index.cjs +1 -1
- package/dist/nestjs/index.cjs.map +1 -1
- package/dist/nestjs/index.d.cts +1 -1
- package/dist/nestjs/index.d.ts +1 -1
- package/dist/nestjs/index.js +1 -1
- package/dist/nestjs/index.js.map +1 -1
- package/dist/runtime/index.cjs +3080 -0
- package/dist/runtime/index.cjs.map +1 -0
- package/dist/runtime/index.d.cts +2 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +2998 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/{types-DpdVN7Lm.d.cts → types-CP3KkwZt.d.cts} +1 -1
- package/dist/{types-DpdVN7Lm.d.ts → types-CP3KkwZt.d.ts} +1 -1
- package/docs/agent-guide.md +5 -2
- package/docs/ai-gates.md +41 -7
- package/docs/brownfield-adoption.md +7 -0
- package/docs/demos/03-copilot-autopilot.md +3 -2
- package/docs/enthusiast/reference-commands.md +2 -2
- package/docs/migrate-from-ark-runtime-kernel.md +4 -2
- package/docs/package-surface.md +72 -0
- package/docs/production-hardening.md +3 -0
- package/package.json +12 -1
- package/server.json +2 -2
- package/templates/skills/ark-explain.md +3 -2
- package/templates/skills/ark-loop.md +2 -1
package/docs/ai-gates.md
CHANGED
|
@@ -189,20 +189,54 @@ Your hard backstop in Cursor is CI: `ark-check` fails the PR on anything that sl
|
|
|
189
189
|
|
|
190
190
|
Recommended for Ark projects.
|
|
191
191
|
|
|
192
|
-
|
|
192
|
+
Unlike Claude/Cursor (project-local MCP files), **Codex loads MCP servers only from
|
|
193
|
+
`$CODEX_HOME/config.toml`** (default `~/.codex/config.toml`) — a **global** home file.
|
|
194
|
+
Hand-editing with relative `--root .` is wrong: Codex does not use the project as cwd, so
|
|
195
|
+
`.` resolves against the launch directory. Prefer absolute paths, or let Ark write them:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
npx ark-check --install-agent-gates --tools codex
|
|
199
|
+
# optional: install /ark-* slash prompts into $CODEX_HOME/prompts
|
|
200
|
+
npx ark-check --install-agent-gates --codex-home
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Example shape (absolute paths — also what install writes):
|
|
193
204
|
|
|
194
205
|
```toml
|
|
195
206
|
[mcp_servers.ark]
|
|
196
207
|
command = "npx"
|
|
197
|
-
args = ["
|
|
208
|
+
args = ["arkgate-mcp", "--root", "/absolute/path/to/project", "--config", "/absolute/path/to/project/ark.config.json"]
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Then **restart Codex** — it does not hot-load MCP servers. Expect resource `ark://manifest`
|
|
212
|
+
and tools `validate_code`, `ark_check`, `ark_coverage`, `ark_place`.
|
|
213
|
+
|
|
214
|
+
Same model as Cursor for enforcement: MCP for discovery/validation, `ark-check` in CI as
|
|
215
|
+
the hard gate. Register the MCP server as soon as the repo is adopted.
|
|
216
|
+
|
|
217
|
+
### Multi-project Codex (home config last-wins)
|
|
218
|
+
|
|
219
|
+
`[mcp_servers.ark]` is a **single primary** binding. If project A is already registered and
|
|
220
|
+
you install gates for project B **without** `--force`, Ark does **not** silently steal
|
|
221
|
+
primary A. It writes a **scoped secondary** table:
|
|
222
|
+
|
|
223
|
+
```toml
|
|
224
|
+
[mcp_servers.ark] # primary — still project A
|
|
225
|
+
# ...
|
|
226
|
+
|
|
227
|
+
[mcp_servers.ark_proj-b_a1b2c3d4] # secondary — basename + path hash (no slug collisions)
|
|
228
|
+
# absolute --root for B
|
|
198
229
|
```
|
|
199
230
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
231
|
+
| Goal | Command |
|
|
232
|
+
|------|---------|
|
|
233
|
+
| Add B without moving primary | `ark-check --install-agent-gates --tools codex` (no `--force`) |
|
|
234
|
+
| Make B the primary binding | `ark-check --install-agent-gates --tools codex --force` |
|
|
235
|
+
| Doctor: primary points at another permanent project | gap id `codex-home-multi-project` (warn if no secondary yet; info if scoped table already present) |
|
|
203
236
|
|
|
204
|
-
`ark-check --
|
|
205
|
-
|
|
237
|
+
`ark-check --doctor` surfaces the multi-project state so you are not left thinking B owns
|
|
238
|
+
`ark://manifest` when only a secondary table exists. Temp/upgrade primary roots are still
|
|
239
|
+
rewritten fail-closed (not multi-project).
|
|
206
240
|
|
|
207
241
|
## Grok Build (xAI)
|
|
208
242
|
|
|
@@ -71,6 +71,13 @@ violations — the ratchet only moves toward zero.
|
|
|
71
71
|
- **Value import of pure type module** (`targetTypeOnlyExports` — plan:
|
|
72
72
|
`import-type-from-pure-type-module`): convert static import to `import type`. Not safe for
|
|
73
73
|
`require()` / dynamic `import()`.
|
|
74
|
+
- **Named type exports from mixed modules** (`namedBindingsTypeOnly` — plan:
|
|
75
|
+
`import-type-of-type-exports`): value-syntax `import { Row }` / `export { Row }` where every
|
|
76
|
+
binding is an `export type` / `interface` on the target — convert to `import type` /
|
|
77
|
+
`export type`. Still **judgment** when any binding is a value, dual-space name
|
|
78
|
+
(`export type Foo` + `export const Foo`), the target has top-level side effects (including
|
|
79
|
+
impure value-export initializers like `export const db = connect()`), or the edge is
|
|
80
|
+
`require` / dynamic `import()`.
|
|
74
81
|
- **Raw infrastructure access** (value coupling — always **judgment**): relocate data-access
|
|
75
82
|
**verbatim** into a repository/adapter. Same query bytes = same behavior; do NOT rewrite the
|
|
76
83
|
query. If CODEOWNERS reserves the data layer, migrate one route as a pattern and hand bulk
|
|
@@ -40,8 +40,9 @@ npx ark-check --plan --json # { ok, plan: { goal, counts, steps } }
|
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
Each step is tagged `mechanical-safe` / `judgment` / `deferred` with a `confidence`,
|
|
43
|
-
`rationale`, and often `remediationKind`.
|
|
44
|
-
|
|
43
|
+
`rationale`, and often `remediationKind`. Auto-safe kinds: type-only type move, pure-type **file**
|
|
44
|
+
relocate, `import type` of pure-type modules, and named type-export imports from mixed modules
|
|
45
|
+
(`import-type-of-type-exports`). `goal.met` is true only when
|
|
45
46
|
there are no active violations **and** governed coverage is meaningful — so a clean plan that
|
|
46
47
|
checks almost nothing is not "done."
|
|
47
48
|
|
|
@@ -51,7 +51,7 @@ arkgate-check --watch
|
|
|
51
51
|
|
|
52
52
|
| `class` | Agent may auto-apply? | Examples (`remediationKind`) |
|
|
53
53
|
|---------|----------------------|------------------------------|
|
|
54
|
-
| `mechanical-safe` | Yes (validate + rollback) | `type-only-import-move`, `pure-type-file-relocate`, `import-type-from-pure-type-module` |
|
|
54
|
+
| `mechanical-safe` | Yes (validate + rollback) | `type-only-import-move`, `pure-type-file-relocate`, `import-type-from-pure-type-module`, `import-type-of-type-exports` |
|
|
55
55
|
| `judgment` | No — propose | value imports, ports, infra relocate, cycles |
|
|
56
56
|
| `deferred` | No | unclear shape |
|
|
57
57
|
|
|
@@ -62,4 +62,4 @@ When present on violations:
|
|
|
62
62
|
- `fixClass` — e.g. `port-inversion`, `file-move`
|
|
63
63
|
- `effort` — `small` | `medium`
|
|
64
64
|
- `enthusiastHint` — plain English fix guidance
|
|
65
|
-
- plan enrichment: `class`, `remediationKind`, `typeOnly`, `sourcePureTypeModule`, `targetTypeOnlyExports`
|
|
65
|
+
- plan enrichment: `class`, `remediationKind`, `typeOnly`, `sourcePureTypeModule`, `targetTypeOnlyExports`, `namedBindingsTypeOnly`
|
|
@@ -131,7 +131,8 @@ Or edit `.grok/config.toml` → `args` use `arkgate-mcp`.
|
|
|
131
131
|
|
|
132
132
|
```diff
|
|
133
133
|
- import { createStrictArkKernelFromConfig } from 'ark-runtime-kernel';
|
|
134
|
-
+ import { createStrictArkKernelFromConfig } from 'arkgate';
|
|
134
|
+
+ import { createStrictArkKernelFromConfig } from 'arkgate/runtime';
|
|
135
|
+
// root `arkgate` still re-exports kernel symbols this major (compat)
|
|
135
136
|
|
|
136
137
|
- import { ArkModule } from 'ark-runtime-kernel/nestjs';
|
|
137
138
|
+ import { ArkModule } from 'arkgate/nestjs';
|
|
@@ -140,7 +141,8 @@ Or edit `.grok/config.toml` → `args` use `arkgate-mcp`.
|
|
|
140
141
|
+ import ark from 'arkgate/eslint';
|
|
141
142
|
```
|
|
142
143
|
|
|
143
|
-
If you only used the CLI + MCP (most projects), **no import changes**.
|
|
144
|
+
If you only used the CLI + MCP (most projects), **no import changes**.
|
|
145
|
+
Surface policy: [package-surface.md](package-surface.md).
|
|
144
146
|
|
|
145
147
|
---
|
|
146
148
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# ArkGate package surface policy
|
|
2
|
+
|
|
3
|
+
**Product wedge:** write gate · CI gate · co-pilot (plan / loop / skills).
|
|
4
|
+
**Not the wedge:** the optional in-process runtime kernel.
|
|
5
|
+
|
|
6
|
+
This document is the consumer contract for **what is stable** vs **what is opt-in**.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Stable surfaces (semver-supported)
|
|
11
|
+
|
|
12
|
+
| Surface | How you use it | Stability notes |
|
|
13
|
+
|---------|----------------|-----------------|
|
|
14
|
+
| **CLI** | `arkgate` / `arkgate-check` (aliases `ark` / `ark-check`) | Flags and human text may improve; **JSON output shapes** for `--json` (check, doctor, plan, coverage, recommend) are stable within a major. Additive fields OK; removals/renames are major. |
|
|
15
|
+
| **MCP tools** | `arkgate-mcp` / `ark://…` resources | Tool names and primary argument shapes are stable within a major. |
|
|
16
|
+
| **`ark.config.json`** | Layer globs, rules, include/exclude, forbiddenGlobals, intent prefixes | Schema fields documented in playbooks/examples are stable; new optional fields may appear. |
|
|
17
|
+
| **Agent skills** | `/ark-*` templates installed by `--install-agent-gates` | Skill *names* and “default flow” are stable; internal skill prose may evolve. |
|
|
18
|
+
| **ESLint subpath** | `arkgate/eslint` | Config-driven layer/import rules; loads consumer `ark.config.json`. |
|
|
19
|
+
| **GitHub Action** | `pedroknigge/arkgate` (see `action.yml`) | Inputs for running the check stay stable within a major. |
|
|
20
|
+
|
|
21
|
+
Gates need **no application code imports**. Most projects only use the CLI + MCP + config.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Opt-in surfaces
|
|
26
|
+
|
|
27
|
+
| Surface | Import path | Notes |
|
|
28
|
+
|---------|-------------|--------|
|
|
29
|
+
| **Runtime kernel** | **`arkgate/runtime`** (preferred) | Event bus, intents, policies, sagas, outbox, projections, `createArkKernel` / strict helpers. Optional. Not required for architecture enforcement. |
|
|
30
|
+
| **Root package barrel** | `arkgate` | Still re-exports the runtime kernel for **compatibility**. Prefer `arkgate/runtime` for new code. Root may be thinned in a future **major**. |
|
|
31
|
+
| **NestJS adapter** | `arkgate/nestjs` | Optional peer `@nestjs/common`. Wires a kernel into Nest DI. |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Recommended imports
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
// Preferred — opt-in runtime kernel
|
|
39
|
+
import {
|
|
40
|
+
createStrictArkKernel,
|
|
41
|
+
createStrictArkKernelFromConfig,
|
|
42
|
+
} from 'arkgate/runtime';
|
|
43
|
+
|
|
44
|
+
// Still works this major (compat; not preferred for new code)
|
|
45
|
+
import { createStrictArkKernel } from 'arkgate';
|
|
46
|
+
|
|
47
|
+
// Nest adapter
|
|
48
|
+
import { ArkModule, InjectArk } from 'arkgate/nestjs';
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
See [production-hardening.md](./production-hardening.md) for runtime operational guidance.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Explicitly unstable / internal
|
|
56
|
+
|
|
57
|
+
- `bin/lib/*` module layout and private helpers
|
|
58
|
+
- Generated `bin/ark-layer-match.mjs` (edit canonical `src/domain/layerMatch.ts` only)
|
|
59
|
+
- HTML report DOM structure (unless documented as a machine contract)
|
|
60
|
+
- Internal MCP diagnostic fields not listed in agent-guide
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Versioning summary
|
|
65
|
+
|
|
66
|
+
| Change | Version bump |
|
|
67
|
+
|--------|----------------|
|
|
68
|
+
| Break CLI JSON field, MCP tool rename, or required `ark.config` field | **major** |
|
|
69
|
+
| New optional config field, new CLI flag, additive JSON | **minor** |
|
|
70
|
+
| Bugfix with no contract change | **patch** |
|
|
71
|
+
| Prefer `arkgate/runtime` over root (docs only; root still exports) | **patch/minor** |
|
|
72
|
+
| Remove root kernel re-exports | **major** (with migration notes) |
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Production Hardening
|
|
2
2
|
|
|
3
|
+
The optional runtime kernel is imported from **`arkgate/runtime`** (preferred). See
|
|
4
|
+
[package-surface.md](package-surface.md).
|
|
5
|
+
|
|
3
6
|
Ark's built-in stores are intentionally in-memory defaults. They are appropriate for tests,
|
|
4
7
|
local development, examples, and single-process demos. Production systems should provide
|
|
5
8
|
stores that match their durability, ordering, retention, and operational requirements.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arkgate",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "ArkGate — architecture co-pilot for AI TypeScript (write gate, CI gate, plan/loop)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
"import": "./dist/index.js",
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
14
|
},
|
|
15
|
+
"./runtime": {
|
|
16
|
+
"types": "./dist/runtime/index.d.ts",
|
|
17
|
+
"import": "./dist/runtime/index.js",
|
|
18
|
+
"require": "./dist/runtime/index.cjs"
|
|
19
|
+
},
|
|
15
20
|
"./eslint": {
|
|
16
21
|
"types": "./dist/eslint/index.d.ts",
|
|
17
22
|
"import": "./dist/eslint/index.js",
|
|
@@ -46,6 +51,7 @@
|
|
|
46
51
|
"docs/ark-check-example.json",
|
|
47
52
|
"docs/assets",
|
|
48
53
|
"docs/brownfield-adoption.md",
|
|
54
|
+
"docs/package-surface.md",
|
|
49
55
|
"docs/production-hardening.md",
|
|
50
56
|
"tests/fixtures/ts-consumer",
|
|
51
57
|
"templates",
|
|
@@ -63,8 +69,13 @@
|
|
|
63
69
|
"typecheck": "tsc --noEmit",
|
|
64
70
|
"security:audit": "npm audit --omit=dev --audit-level=high",
|
|
65
71
|
"check:architecture": "node bin/ark-check.mjs --root . --config ark.config.json --strict-config",
|
|
72
|
+
"generate:layer-match": "node scripts/generate-layer-match.mjs",
|
|
73
|
+
"check:layer-match": "node scripts/generate-layer-match.mjs --check",
|
|
74
|
+
"generate:cli-pure": "node scripts/generate-cli-pure.mjs",
|
|
75
|
+
"check:cli-pure": "node scripts/generate-cli-pure.mjs --check",
|
|
66
76
|
"test:ts-compat": "node scripts/ts-compat-matrix.mjs 5.9.3 && node scripts/ts-compat-matrix.mjs 6.0.3 && node scripts/ts-compat-matrix.mjs 7.0.2",
|
|
67
77
|
"eval:agent": "node eval/run.mjs",
|
|
78
|
+
"eval:corpus": "node eval/validate-corpus.mjs",
|
|
68
79
|
"eval:comparative": "node eval/comparative-run.mjs",
|
|
69
80
|
"clean": "rm -rf dist",
|
|
70
81
|
"release:npm": "node scripts/release-npm.mjs",
|
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.8.0",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "arkgate",
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.8.0",
|
|
15
15
|
"runtimeHint": "npx",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
@@ -47,8 +47,9 @@ dependency direction, matrix, violations, enforcement points, Ark fitness score,
|
|
|
47
47
|
**Senior diagnostics** block (coupling fan-in/out, deny density, purity surface, pattern
|
|
48
48
|
forensics, baseline taxonomy) for tech leads.
|
|
49
49
|
|
|
50
|
-
When explaining the **plan**, name the
|
|
51
|
-
(type-only move, pure-type file relocate, `import type` of pure-type modules
|
|
50
|
+
When explaining the **plan**, name the four `mechanical-safe` remediation kinds only
|
|
51
|
+
(type-only move, pure-type file relocate, `import type` of pure-type modules,
|
|
52
|
+
`import-type-of-type-exports` for named type exports from mixed modules) — everything
|
|
52
53
|
else is judgment/deferred and must not be auto-applied.
|
|
53
54
|
|
|
54
55
|
## Spoken / written explanation
|
|
@@ -32,8 +32,9 @@ validating every change with `ark-check` and rolling back regressions.
|
|
|
32
32
|
| `type-only-import-move` | Move type to owning layer; re-export for back-compat |
|
|
33
33
|
| `pure-type-file-relocate` | Relocate pure-type file to owning layer (or rename out of false Domain globs) |
|
|
34
34
|
| `import-type-from-pure-type-module` | Convert value import of pure-type module to `import type` |
|
|
35
|
+
| `import-type-of-type-exports` | Convert value-syntax named import/export of type-only exports from a mixed module to `import type` / `export type` |
|
|
35
36
|
|
|
36
|
-
Never auto: value imports, dynamic import/require,
|
|
37
|
+
Never auto: value imports (including mixed bindings with values), dynamic import/require, forbidden globals, cycles, infra moves.
|
|
37
38
|
|
|
38
39
|
## Steps
|
|
39
40
|
|