arkgate 2.10.0 → 2.11.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 +43 -0
  2. package/README.md +6 -2
  3. package/SECURITY.md +3 -4
  4. package/bin/ark-check.mjs +41 -16
  5. package/bin/ark-mcp.mjs +54 -10
  6. package/bin/ark.mjs +35 -5
  7. package/bin/lib/agent-gates.mjs +9 -5
  8. package/bin/lib/architecture-scan.mjs +4 -1
  9. package/bin/lib/baseline-key.mjs +17 -0
  10. package/bin/lib/config-warnings.mjs +22 -0
  11. package/bin/lib/core-layers.mjs +7 -0
  12. package/bin/lib/core-ratchet.mjs +3 -7
  13. package/bin/lib/doctor-plan.mjs +29 -5
  14. package/bin/lib/safety-diagnostics.mjs +263 -0
  15. package/bin/lib/scan-files.mjs +51 -6
  16. package/bin/lib/violations.mjs +3 -3
  17. package/dist/index.cjs +103 -8
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +5 -3
  20. package/dist/index.d.ts +5 -3
  21. package/dist/index.js +103 -8
  22. package/dist/index.js.map +1 -1
  23. package/dist/nestjs/index.cjs +18 -5
  24. package/dist/nestjs/index.cjs.map +1 -1
  25. package/dist/nestjs/index.d.cts +1 -1
  26. package/dist/nestjs/index.d.ts +1 -1
  27. package/dist/nestjs/index.js +18 -5
  28. package/dist/nestjs/index.js.map +1 -1
  29. package/dist/runtime/index.cjs +103 -8
  30. package/dist/runtime/index.cjs.map +1 -1
  31. package/dist/runtime/index.d.cts +1 -1
  32. package/dist/runtime/index.d.ts +1 -1
  33. package/dist/runtime/index.js +103 -8
  34. package/dist/runtime/index.js.map +1 -1
  35. package/dist/{types-D6Q8WHes.d.cts → types-BZ17b9i5.d.cts} +5 -1
  36. package/dist/{types-D6Q8WHes.d.ts → types-BZ17b9i5.d.ts} +5 -1
  37. package/docs/agent-guide.md +1 -1
  38. package/docs/ai-gates.md +20 -2
  39. package/docs/package-surface.md +2 -2
  40. package/docs/production-hardening.md +5 -0
  41. package/package.json +5 -2
  42. package/server.json +2 -2
@@ -941,7 +941,11 @@ interface WorkflowStep<P extends SagaContext = SagaContext> {
941
941
  onEvent?: IntentName;
942
942
  retry?: RetryPolicy;
943
943
  timeoutMs?: number;
944
- execute: (payload: P, bus: EventBus) => MaybePromise<Partial<P> | void>;
944
+ /**
945
+ * Execute one step. The signal is aborted when `timeoutMs` elapses; implementations
946
+ * performing I/O must pass it to the underlying client for cooperative cancellation.
947
+ */
948
+ execute: (payload: P, bus: EventBus, signal: AbortSignal) => MaybePromise<Partial<P> | void>;
945
949
  compensate?: (payload: P, bus: EventBus, error?: unknown) => MaybePromise<void>;
946
950
  }
947
951
  interface WorkflowStartTrigger<P extends SagaContext = SagaContext> {
@@ -941,7 +941,11 @@ interface WorkflowStep<P extends SagaContext = SagaContext> {
941
941
  onEvent?: IntentName;
942
942
  retry?: RetryPolicy;
943
943
  timeoutMs?: number;
944
- execute: (payload: P, bus: EventBus) => MaybePromise<Partial<P> | void>;
944
+ /**
945
+ * Execute one step. The signal is aborted when `timeoutMs` elapses; implementations
946
+ * performing I/O must pass it to the underlying client for cooperative cancellation.
947
+ */
948
+ execute: (payload: P, bus: EventBus, signal: AbortSignal) => MaybePromise<Partial<P> | void>;
945
949
  compensate?: (payload: P, bus: EventBus, error?: unknown) => MaybePromise<void>;
946
950
  }
947
951
  interface WorkflowStartTrigger<P extends SagaContext = SagaContext> {
@@ -176,7 +176,7 @@ reference, and explanation for the full path (recommend → init → gallery →
176
176
  3. Run `ark init --archetype <id> --yes`, `--apply-policy-pack enthusiast-<preset>`, or `ark init --preset <preset> --yes` when no `ark.config.json` exists.
177
177
  4. Optional: `--write-plan` for `ark-adoption-plan.json`; copy a gallery starter from `examples/README.md`.
178
178
  5. Use `/ark-place` or `ark_place` for individual files after the contract exists.
179
- 6. Verify with `ark-check --root . --config ark.config.json --strict-config`.
179
+ 6. Verify with `ark-check --root . --config ark.config.json --strict`.
180
180
 
181
181
  ### Write protocol (2.10+ / Track W)
182
182
 
package/docs/ai-gates.md CHANGED
@@ -153,7 +153,7 @@ Layers:
153
153
  - PersistenceAdapters: src/adapters/persistence/**
154
154
  Rules: 10 denied layer edge(s). Full contract: ark://manifest MCP resource.
155
155
  Baseline: 3 frozen violation(s) — only NEW violations fail; do not add to them.
156
- After edits run: npx ark-check --root . --config ark.config.json --strict-config
156
+ After edits run: npx ark-check --root . --config ark.config.json --strict
157
157
  ```
158
158
 
159
159
  The hook belongs in the **project's** `.claude/settings.json` (that's what
@@ -390,9 +390,27 @@ Prefer keeping editor + CI on the same `ark.config.json` — do not maintain a p
390
390
  Whatever the agent side does, gate the merge:
391
391
 
392
392
  ```yaml
393
- - run: npx ark-check --root . --config ark.config.json --strict-config
393
+ - run: npx ark-check --root . --config ark.config.json --strict
394
394
  ```
395
395
 
396
+ The `--strict` profile also requires the generated CI/write gates and fails on safety
397
+ diagnostics. Configure reviewed exceptions explicitly:
398
+
399
+ ```json
400
+ {
401
+ "dynamicImportAllowlist": ["src/plugins/loader.ts"],
402
+ "safety": {
403
+ "maxTsSuppressions": 0,
404
+ "maxAnyCasts": 0,
405
+ "allowInMemory": false,
406
+ "allowDisabledPeerIsolation": false
407
+ }
408
+ }
409
+ ```
410
+
411
+ `ark-check --doctor --json` reports counts under `doctor.safety`. An `any` cast is
412
+ reported as lost static assurance; it does not imply that a runtime schema was bypassed.
413
+
396
414
  Adopting Ark on an existing codebase with violations? Freeze them once and ratchet down:
397
415
 
398
416
  ```bash
@@ -16,10 +16,10 @@ This document is the consumer contract for **what is stable** vs **what is opt-i
16
16
  |---------|----------------|-----------------|
17
17
  | **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. |
18
18
  | **MCP tools** | `arkgate-mcp` / `ark://…` resources | Tool names and primary argument shapes are stable within a major. |
19
- | **`ark.config.json`** | Layer globs, rules, include/exclude, forbiddenGlobals, intent prefixes | Schema fields documented in playbooks/examples are stable; new optional fields may appear. |
19
+ | **`ark.config.json`** | Layer globs, rules, include/exclude, forbiddenGlobals, intent prefixes, `peerIsolation`, `dynamicImportAllowlist`, `safety` thresholds | Schema fields documented in playbooks/examples are stable; new optional fields may appear. |
20
20
  | **Agent skills** | `/ark-*` templates installed by `--install-agent-gates` | Skill *names* and “default flow” are stable; internal skill prose may evolve. |
21
21
  | **ESLint subpath** | `arkgate/eslint` | Config-driven layer/import rules; loads consumer `ark.config.json`. |
22
- | **GitHub Action** | `pedroknigge/arkgate` (see `action.yml`) | Inputs for running the check stay stable within a major. |
22
+ | **GitHub Action** | `pedroknigge/arkgate` (see `action.yml`) | The `uses:` tag/SHA selects the checker source; `version` remains an optional exact npm compatibility override. |
23
23
 
24
24
  Gates need **no application code imports**. Most projects only use the CLI + MCP + config.
25
25
 
@@ -37,6 +37,11 @@ When implementing Ark store interfaces in production, cover these guarantees exp
37
37
  - Observability: failed writes and dispatches are visible to operators.
38
38
  - Migration: schema changes for stored records are versioned.
39
39
 
40
+ Workflow `timeoutMs` uses cooperative cancellation: ArkGate aborts the `AbortSignal`
41
+ passed as the third `execute` argument, but JavaScript cannot stop an operation that
42
+ ignores that signal. Production steps must pass it to network/database clients and keep
43
+ external effects idempotent; otherwise work may finish after the workflow was marked failed.
44
+
40
45
  ## Interface Targets
41
46
 
42
47
  | Concern | Interface |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkgate",
3
- "version": "2.10.0",
3
+ "version": "2.11.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",
@@ -66,9 +66,11 @@
66
66
  "dev": "tsup --watch",
67
67
  "test": "vitest",
68
68
  "test:run": "vitest run",
69
+ "test:coverage": "vitest run --coverage --coverage.reporter=text-summary --coverage.reporter=json-summary",
69
70
  "typecheck": "tsc --noEmit",
70
71
  "security:audit": "npm audit --omit=dev --audit-level=high",
71
- "check:architecture": "node bin/ark-check.mjs --root . --config ark.config.json --strict-config",
72
+ "check:architecture": "node bin/ark-check.mjs --root . --config ark.config.json --strict",
73
+ "check:js": "node scripts/check-js-syntax.mjs",
72
74
  "generate:layer-match": "node scripts/generate-layer-match.mjs",
73
75
  "check:layer-match": "node scripts/generate-layer-match.mjs --check",
74
76
  "generate:cli-pure": "node scripts/generate-cli-pure.mjs",
@@ -111,6 +113,7 @@
111
113
  "devDependencies": {
112
114
  "@nestjs/common": "^11.1.27",
113
115
  "@types/node": "^20.14.0",
116
+ "@vitest/coverage-v8": "^3.2.6",
114
117
  "reflect-metadata": "^0.2.2",
115
118
  "rxjs": "^7.8.2",
116
119
  "tsup": "^8.1.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.10.0",
9
+ "version": "2.11.0",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "arkgate",
14
- "version": "2.10.0",
14
+ "version": "2.11.0",
15
15
  "runtimeHint": "npx",
16
16
  "transport": {
17
17
  "type": "stdio"