arkgate 2.11.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +147 -0
  2. package/README.md +70 -41
  3. package/bin/ark-check.mjs +95 -36
  4. package/bin/ark-mcp.mjs +11 -5
  5. package/bin/ark-shared.mjs +88 -56
  6. package/bin/ark.mjs +97 -29
  7. package/bin/lib/agent-gates.mjs +79 -2093
  8. package/bin/lib/architecture-scan.mjs +8 -0
  9. package/bin/lib/ci-and-commands.mjs +392 -0
  10. package/bin/lib/codex-home.mjs +7 -0
  11. package/bin/lib/config-contract.mjs +331 -0
  12. package/bin/lib/deploy-path.mjs +205 -0
  13. package/bin/lib/doctor-plan.mjs +43 -16
  14. package/bin/lib/enforcement-profiles.mjs +97 -0
  15. package/bin/lib/gate-files.mjs +223 -0
  16. package/bin/lib/hook-templates.mjs +99 -0
  17. package/bin/lib/host-support-matrix.mjs +77 -0
  18. package/bin/lib/install-migrate.mjs +473 -0
  19. package/bin/lib/mcp-adoption.mjs +455 -0
  20. package/bin/lib/open-html.mjs +75 -0
  21. package/bin/lib/presets.mjs +6 -2
  22. package/bin/lib/safety-diagnostics.mjs +31 -11
  23. package/bin/lib/skill-install.mjs +323 -0
  24. package/bin/lib/ts-resolve.mjs +2 -1
  25. package/bin/lib/typescript-host.mjs +88 -0
  26. package/bin/lib/weakest-link.mjs +417 -0
  27. package/bin/lib/write-path-capabilities.mjs +182 -0
  28. package/bin/lib/write-path-detect.mjs +101 -0
  29. package/dist/configContract-iBLxx5Tz.d.cts +53 -0
  30. package/dist/configContract-iBLxx5Tz.d.ts +53 -0
  31. package/dist/eslint/index.cjs +375 -13
  32. package/dist/eslint/index.cjs.map +1 -1
  33. package/dist/eslint/index.d.cts +30 -20
  34. package/dist/eslint/index.d.ts +30 -20
  35. package/dist/eslint/index.js +375 -13
  36. package/dist/eslint/index.js.map +1 -1
  37. package/dist/index.cjs +723 -61
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.d.cts +95 -5
  40. package/dist/index.d.ts +95 -5
  41. package/dist/index.js +716 -61
  42. package/dist/index.js.map +1 -1
  43. package/dist/nestjs/index.cjs +150 -42
  44. package/dist/nestjs/index.cjs.map +1 -1
  45. package/dist/nestjs/index.d.cts +2 -1
  46. package/dist/nestjs/index.d.ts +2 -1
  47. package/dist/nestjs/index.js +150 -42
  48. package/dist/nestjs/index.js.map +1 -1
  49. package/dist/runtime/index.cjs +723 -61
  50. package/dist/runtime/index.cjs.map +1 -1
  51. package/dist/runtime/index.d.cts +3 -2
  52. package/dist/runtime/index.d.ts +3 -2
  53. package/dist/runtime/index.js +716 -61
  54. package/dist/runtime/index.js.map +1 -1
  55. package/dist/{types-BZ17b9i5.d.cts → types-BxBwnBpC.d.cts} +9 -36
  56. package/dist/{types-BZ17b9i5.d.ts → types-Wcs_l1_J.d.ts} +9 -36
  57. package/docs/agent-guide.md +43 -21
  58. package/docs/ai-gates.md +53 -18
  59. package/docs/configuration.md +97 -0
  60. package/docs/enthusiast/README.md +3 -3
  61. package/docs/enthusiast/how-to-agent-gates.md +7 -3
  62. package/docs/migrate-from-ark-runtime-kernel.md +3 -0
  63. package/docs/package-surface.md +22 -10
  64. package/docs/production-hardening.md +15 -2
  65. package/docs/threat-model.md +65 -0
  66. package/docs/typescript-support.md +3 -3
  67. package/package.json +15 -2
  68. package/schemas/ark.config.schema.json +750 -0
  69. package/server.json +2 -2
  70. package/templates/hooks/pre-commit-ark +37 -0
  71. package/templates/skills/ark-autopilot.md +77 -45
  72. package/templates/skills/ark-coverage.md +2 -2
  73. package/templates/skills/ark-explain.md +2 -1
  74. package/templates/skills/ark-explore.md +135 -34
  75. package/templates/skills/ark-runtime.md +8 -5
  76. package/templates/skills/ark-upgrade.md +36 -16
  77. package/tests/fixtures/ts-consumer/ark.config.json +2 -0
@@ -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 every agent CLI and re-verify the architecture check. Autonomous.
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, and run the strict check:
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
- If you use Codex, its prompts live in `$CODEX_HOME/prompts` (`~/.codex/prompts`),
116
- not the repo, so a repo refresh never updates them. Refresh them there too:
117
- `ark-check --install-agent-gates --skills-only --codex-home --force`. Keep
118
- `--skills-only` without it, `--force` also rewrites customized gate files
119
- (AGENTS.md, CI, settings). This writes to the user's home dir — say so. (A normal
120
- `ark-check` now flags stale Codex-home skills when copies exist, so you don't have
121
- to remember.)
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
- - Cover EVERY detected agent CLI (`.claude/`, `.cursor/`, `.codex/`,
142
- `.windsurf/`, `.clinerules/`, `.kiro/`), not just the one running this skill —
143
- gates and skills must stay in sync across tools or the weakest tool becomes
144
- the hole in the fence.
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 per tool, skipped customized files needing a manual
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
- **Skill incomplete if missing** any of the bullets above.
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).
@@ -1,4 +1,6 @@
1
1
  {
2
+ "$schema": "https://unpkg.com/arkgate@2/schemas/ark.config.schema.json",
3
+ "schemaVersion": "1.0",
2
4
  "include": ["src"],
3
5
  "layers": [
4
6
  { "name": "DomainModel", "patterns": ["src/domain/**"], "forbiddenGlobals": ["fetch"] },