arkgate 3.0.4 → 3.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +82 -1
  2. package/README.md +29 -9
  3. package/bin/ark-check.mjs +69 -54
  4. package/bin/ark-mcp.mjs +267 -26
  5. package/bin/ark.mjs +50 -3
  6. package/bin/lib/adapter-contract.mjs +27 -1
  7. package/bin/lib/agent-gates.mjs +9 -0
  8. package/bin/lib/analysis-engine.mjs +7 -1169
  9. package/bin/lib/ci-and-commands.mjs +4 -0
  10. package/bin/lib/codex-home.mjs +10 -1
  11. package/bin/lib/doctor-plan.mjs +37 -9
  12. package/bin/lib/host-support-matrix.mjs +6 -2
  13. package/bin/lib/install-migrate.mjs +81 -25
  14. package/bin/lib/mcp-adoption.mjs +8 -0
  15. package/bin/lib/policy-delta-io.mjs +161 -0
  16. package/bin/lib/prepare-change.mjs +186 -0
  17. package/bin/lib/remediation.mjs +24 -0
  18. package/bin/lib/skill-install.mjs +302 -22
  19. package/bin/lib/violations.mjs +2 -2
  20. package/bin/lib/weakest-link.mjs +61 -12
  21. package/bin/lib/write-path-capabilities.mjs +70 -2
  22. package/bin/lib/write-path-detect.mjs +18 -11
  23. package/dist/eslint/index.cjs +3 -977
  24. package/dist/eslint/index.js +3 -931
  25. package/dist/index.cjs +6 -1960
  26. package/dist/index.d.cts +152 -5
  27. package/dist/index.d.ts +152 -5
  28. package/dist/index.js +6 -1908
  29. package/docs/agent-guide.md +16 -2
  30. package/docs/ai-gates.md +35 -3
  31. package/docs/configuration.md +44 -0
  32. package/docs/package-surface.md +8 -1
  33. package/docs/threat-model.md +7 -4
  34. package/package.json +6 -5
  35. package/schemas/ark.analysis-result.schema.json +5 -1
  36. package/schemas/ark.change-map.schema.json +77 -0
  37. package/server.json +2 -2
  38. package/templates/skills/ark-upgrade.md +9 -5
  39. package/docs/ark-check-example.json +0 -87
  40. package/docs/demos/03-copilot-autopilot.md +0 -93
  41. package/docs/migrate-from-ark-runtime-kernel.md +0 -174
  42. package/docs/production-hardening.md +0 -100
@@ -1,174 +0,0 @@
1
- # Migrate from `ark-runtime-kernel` → **ArkGate** (`arkgate`)
2
-
3
- **Same product.** Only the npm name and primary CLI names changed.
4
- Config, baselines, and `/ark-*` skills stay.
5
-
6
- | | Before | After |
7
- |--|--------|--------|
8
- | Package | `ark-runtime-kernel` | **`arkgate`** |
9
- | Product name | Ark | **ArkGate** |
10
- | Check CLI | `ark-check` | **`arkgate-check`** (alias `ark-check` still works) |
11
- | MCP CLI | `ark-mcp` | **`arkgate-mcp`** (alias `ark-mcp` still works) |
12
- | Setup CLI | `ark` | **`arkgate`** (alias `ark` still works) |
13
- | Config | `ark.config.json` | **unchanged** |
14
- | Baseline | `.ark-baseline.json` | **unchanged** |
15
- | Skills | `/ark-autopilot`, … | **unchanged** |
16
- | GitHub | `pedroknigge/ark-runtime-kernel` | **`pedroknigge/arkgate`** (old URL redirects) |
17
-
18
- ---
19
-
20
- ## Fast path (recommended)
21
-
22
- ```bash
23
- # 1) Swap the dependency
24
- npm uninstall ark-runtime-kernel
25
- npm install -D arkgate
26
- # pnpm: pnpm remove ark-runtime-kernel && pnpm add -D arkgate
27
- # yarn: yarn remove ark-runtime-kernel && yarn add -D arkgate
28
-
29
- # 2) Refresh gates, skills, MCP templates
30
- npx arkgate-check --install-agent-gates --force
31
-
32
- # 3) Verify
33
- npx arkgate-check --doctor
34
- npx arkgate-check --root . --config ark.config.json --strict-config
35
- ```
36
-
37
- One-liner if the old bin is still on the path after installing `arkgate`:
38
-
39
- ```bash
40
- npx arkgate upgrade
41
- ```
42
-
43
- (`ark upgrade` works too — both install `arkgate@latest` and refresh gates.)
44
-
45
- ### TypeScript 7
46
-
47
- If the project uses **TypeScript 7** as `tsc`, the gate still works: ArkGate embeds a JS-API
48
- TypeScript host and falls back when `require('typescript')` is version-only. See
49
- [typescript-support.md](typescript-support.md). Optional dual-install (TS 6 for tools + TS 7
50
- CLI) is documented there.
51
-
52
- ### MCP args (avoid double binary)
53
-
54
- `.mcp.json` / `.cursor/mcp.json` must look like:
55
-
56
- ```json
57
- "args": ["arkgate-mcp", "--root", ".", "--config", "ark.config.json"]
58
- ```
59
-
60
- **Not** `["ark-mcp", "arkgate-mcp", …]` — that breaks MCP stdio. Fixed by
61
- `npx arkgate-check --install-agent-gates --migrate-commands` (ArkGate ≥ 2.4.0).
62
-
63
- ---
64
-
65
- ## What to change in your repo
66
-
67
- ### `package.json`
68
-
69
- ```diff
70
- - "ark-runtime-kernel": "^2.0.1"
71
- + "arkgate": "^2.1.0"
72
- ```
73
-
74
- Scripts:
75
-
76
- ```diff
77
- - "check:architecture": "ark-check --root . --config ark.config.json --strict-config"
78
- + "check:architecture": "arkgate-check --root . --config ark.config.json --strict-config"
79
- ```
80
-
81
- (`ark-check` still works as a compat alias for one major.)
82
-
83
- ### CI / GitHub Actions
84
-
85
- ```diff
86
- - run: npx ark-check --root . --config ark.config.json --strict-config
87
- + run: npx arkgate-check --root . --config ark.config.json --strict-config
88
- ```
89
-
90
- Composite action:
91
-
92
- ```diff
93
- - uses: pedroknigge/ark-runtime-kernel@main
94
- + uses: pedroknigge/arkgate@main
95
- ```
96
-
97
- ### MCP (Claude / Cursor / `.mcp.json`)
98
-
99
- ```json
100
- {
101
- "mcpServers": {
102
- "ark": {
103
- "command": "npx",
104
- "args": ["arkgate-mcp", "--root", ".", "--config", "ark.config.json"]
105
- }
106
- }
107
- }
108
- ```
109
-
110
- Then restart the agent / reload MCP.
111
-
112
- ### Codex
113
-
114
- Re-register so home MCP points at this project with the new bin:
115
-
116
- ```bash
117
- npx arkgate-check --install-agent-gates --tools codex --force
118
- # optional home skills:
119
- npx arkgate-check --install-agent-gates --codex-home --force
120
- ```
121
-
122
- ### Grok
123
-
124
- ```bash
125
- npx arkgate-check --install-agent-gates --tools grok --force
126
- ```
127
-
128
- Or edit `.grok/config.toml` → `args` use `arkgate-mcp`.
129
-
130
- ### TypeScript imports (runtime / Nest / ESLint only)
131
-
132
- The runtime and Nest surfaces are currently **experimental**; migrating the package name does not
133
- require adopting them. Static CLI/MCP enforcement remains the supported product path.
134
-
135
- ```diff
136
- - import { createStrictArkKernelFromConfig } from 'ark-runtime-kernel';
137
- + import { createStrictArkKernelFromConfig } from '@arkgate/runtime';
138
-
139
- - import { ArkModule } from 'ark-runtime-kernel/nestjs';
140
- + import { ArkModule } from '@arkgate/runtime/nestjs';
141
-
142
- - import ark from 'ark-runtime-kernel/eslint';
143
- + import ark from 'arkgate/eslint';
144
- ```
145
-
146
- If you only used the CLI + MCP (most projects), **no import changes**.
147
- Surface policy: [package-surface.md](package-surface.md).
148
-
149
- ---
150
-
151
- ## What you can ignore
152
-
153
- - Renaming `ark.config.json` — not required
154
- - Renaming `/ark-*` skills — not required
155
- - Re-running full adopt/architect — not required unless you want a fresh plan
156
-
157
- ---
158
-
159
- ## Troubleshooting
160
-
161
- | Symptom | Fix |
162
- |---------|-----|
163
- | `npm warn deprecated ark-runtime-kernel` | Swap dep to `arkgate` (this guide) |
164
- | `ark-check: not found` after uninstall | Use `npx arkgate-check` or reinstall `arkgate` |
165
- | MCP still launches old package | Update `.mcp.json` / Codex / Grok config; restart agent |
166
- | pnpm blocks new package age | Wait for cooling-off or pin exact version `arkgate@2.1.0` |
167
-
168
- ---
169
-
170
- ## Why the rename
171
-
172
- `ark-runtime-kernel` suggested a runtime framework. The product is the **architecture co-pilot / write+CI gate** for AI TypeScript. npm name is now **`arkgate`**.
173
-
174
- Questions: [github.com/pedroknigge/arkgate](https://github.com/pedroknigge/arkgate)
@@ -1,100 +0,0 @@
1
- # Production Hardening
2
-
3
- The optional runtime kernel is currently **experimental**. This page is a requirements checklist
4
- for teams evaluating **`@arkgate/runtime`**, not a claim that the runtime is production-ready.
5
- Static ArkGate adoption does not require it. See [package-surface.md](package-surface.md).
6
-
7
- ## Durability stance (R9)
8
-
9
- **ArkGate does not ship production-durable adapters.** Built-in stores are **reference
10
- InMemory-only** — appropriate for tests, local development, examples, and single-process
11
- demos. They lose all state on process restart. Production systems **must** inject their
12
- own implementations of the store interfaces (or accept that data is ephemeral).
13
-
14
- Ark's built-in stores are intentionally in-memory defaults. Production systems should provide
15
- stores that match their durability, ordering, retention, and operational requirements.
16
-
17
- ## In-Memory Defaults (reference only — not production durability)
18
-
19
- These defaults do not survive process restarts:
20
-
21
- - `InMemoryAuditStore`
22
- - `InMemoryEventBuffer` (`InMemoryOutboxStore` is a deprecated compatibility alias)
23
- - `InMemoryReadModelStore`
24
- - `InMemoryWorkflowStore`
25
-
26
- Use them only when losing state is acceptable. JSDoc on `EventBufferStore`, `AuditStore`,
27
- `ReadModelStore`, and `WorkflowStore` restates this stance at the type level.
28
-
29
- ## Production Store Checklist
30
-
31
- When implementing Ark store interfaces in production, cover these guarantees explicitly:
32
-
33
- - Durability: records survive process restarts and deploys.
34
- - Idempotency: repeated writes or dispatch attempts do not corrupt state.
35
- - Ordering: event/outbox ordering is defined where consumers depend on it.
36
- - Concurrency: simultaneous publishers/workers cannot race checkpoints or workflow state.
37
- - Retention: audit and trace records have an explicit retention policy.
38
- - Observability: failed writes and dispatches are visible to operators.
39
- - Migration: schema changes for stored records are versioned.
40
-
41
- Workflow `timeoutMs` uses cooperative cancellation: ArkGate aborts the `AbortSignal`
42
- passed as the third `execute` argument, but JavaScript cannot stop an operation that
43
- ignores that signal. Production steps must pass it to network/database clients and keep
44
- external effects idempotent; otherwise work may finish after the workflow was marked failed.
45
-
46
- ### Workflow retry boundary
47
-
48
- `RetryPolicy` applies only while `step.execute` is running, including a timeout from that
49
- execution. Once `execute` resolves, ArkGate marks the step completed before saving the
50
- snapshot and recording `workflow.step.completed`. If either post-effect operation fails, the
51
- workflow enters its failure/compensation path; it does not execute the completed step again.
52
-
53
- The same fail-closed rule applies when the final `workflow.completed` audit record fails:
54
- completed steps are compensated when handlers exist, and the workflow ends failed. Production
55
- effects and compensations must therefore be idempotent, and audit/snapshot stores must be
56
- operational dependencies rather than best-effort telemetry.
57
-
58
- ### Required recovery semantics (not implemented by built-ins)
59
-
60
- | Contract | Required definition before a production claim |
61
- |----------|-----------------------------------------------|
62
- | Workflow recovery | Persist the last committed step and effect id; restart resumes only from that checkpoint and never assumes an in-flight effect failed or succeeded without reconciliation. |
63
- | Optimistic versioning | Every snapshot write carries the previously read version; conflicting writes fail without overwriting and the caller reloads before retrying. |
64
- | Dispatcher leases | A claim records owner and expiry atomically; only the owner may acknowledge it, and takeover is allowed only after expiry. |
65
- | Idempotent delivery | Every message/effect has a stable idempotency key retained for the full retry window; duplicate attempts return the prior outcome without repeating the effect. |
66
- | Atomic handoff | Application state and dispatch record commit in one transaction. Without this guarantee the API must be called an event buffer, not an outbox. |
67
-
68
- The experimental package supplies none of these persistence guarantees. Fault/restart matrices
69
- must cover crashes before and after every transaction, effect, checkpoint, lease, and acknowledgement.
70
-
71
- ## Interface Targets
72
-
73
- | Concern | Interface |
74
- |---------|-----------|
75
- | Audit records | `AuditStore` |
76
- | Non-atomic dispatch buffer | `EventBufferStore` |
77
- | Projection state | `ReadModelStore` |
78
- | Workflow snapshots | `WorkflowStore` |
79
-
80
- ## Example Shape
81
-
82
- ```ts
83
- class DurableAuditStore implements AuditStore {
84
- async append(record: AuditRecord): Promise<void> {
85
- // Insert into your database with an idempotent key.
86
- }
87
-
88
- async query(query: AuditQuery = {}): Promise<AuditRecord[]> {
89
- // Apply query filters and retention-aware ordering.
90
- return [];
91
- }
92
-
93
- async clear(): Promise<void> {
94
- // Usually only enabled in tests or isolated maintenance jobs.
95
- }
96
- }
97
- ```
98
-
99
- Ark does not ship a database adapter in core because storage choice is operationally
100
- specific. Keep those adapters in the application or a separate integration package.