ark-runtime-kernel 1.3.0 → 1.5.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/README.md +97 -7
- package/bin/ark-check.mjs +244 -42
- package/bin/ark-mcp.mjs +105 -2
- package/bin/ark-shared.mjs +51 -0
- package/dist/eslint/index.cjs +49 -1
- package/dist/eslint/index.cjs.map +1 -1
- package/dist/eslint/index.d.cts +4 -1
- package/dist/eslint/index.d.ts +4 -1
- package/dist/eslint/index.js +49 -2
- package/dist/eslint/index.js.map +1 -1
- package/dist/index.cjs +48 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +48 -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.js +1 -1
- package/dist/nestjs/index.js.map +1 -1
- package/docs/agent-guide.md +9 -4
- package/docs/ai-gates.md +68 -0
- package/package.json +8 -2
- package/server.json +7 -7
package/docs/agent-guide.md
CHANGED
|
@@ -188,10 +188,15 @@ Example config:
|
|
|
188
188
|
`tsconfig.json` — relative, path-alias (e.g. `@infra/db`), package imports, dynamic
|
|
189
189
|
`import()`, and `require()` — plus string intent references. It also flags raw
|
|
190
190
|
`publish()` calls, publish calls without `metadata.source`, and source intent literals
|
|
191
|
-
whose resolved layer differs from the publishing file layer. Pass `--tsconfig <path>` to
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
whose resolved layer differs from the publishing file layer. Pass `--tsconfig <path>` to force one config
|
|
192
|
+
for every file; otherwise each source file uses the nearest `tsconfig.json` above it (like
|
|
193
|
+
`tsc`), so monorepos with per-package alias maps work under a single `--root`. It resolves
|
|
194
|
+
modules the way your build does, but is intentionally not yet a full type-graph analyzer
|
|
195
|
+
(cross-layer type-only references beyond the import specifier are out of scope).
|
|
196
|
+
|
|
197
|
+
Repeat runs are cached in `node_modules/.cache/ark-check.json` — unchanged files skip the
|
|
198
|
+
parse, while import edges always re-resolve against the live filesystem so the cache can
|
|
199
|
+
never hide a new violation. `--no-cache` disables it.
|
|
195
200
|
|
|
196
201
|
`ark-check --json` also reports `warnings` for incomplete governance coverage: missing
|
|
197
202
|
layers, unclassified included files, unmatched layer patterns, duplicate layers, and rules
|
package/docs/ai-gates.md
CHANGED
|
@@ -39,6 +39,11 @@ writes code; that is the fast path to avoiding architecture drift during generat
|
|
|
39
39
|
|
|
40
40
|
`ark-mcp --hook` is a one-shot PreToolUse gate: it reads the hook payload from stdin, computes the **post-edit** file content, validates it, and exits `2` (block, violations on stderr) or `0` (allow). The agent sees the violations and self-corrects.
|
|
41
41
|
|
|
42
|
+
Like `ark-check --baseline`, the hook ratchets: an edit is blocked only when it **adds**
|
|
43
|
+
violations relative to the file's current on-disk state, so files with pre-existing
|
|
44
|
+
(baselined) violations stay editable — they just can't get worse. New files block on
|
|
45
|
+
every violation.
|
|
46
|
+
|
|
42
47
|
Add to your project's `.claude/settings.json`:
|
|
43
48
|
|
|
44
49
|
```json
|
|
@@ -68,6 +73,47 @@ Ark architecture gate blocked this write to src/domain/order.ts (layer: DomainMo
|
|
|
68
73
|
Fix the violations and retry. The architecture contract is available as the ark://manifest MCP resource.
|
|
69
74
|
```
|
|
70
75
|
|
|
76
|
+
## Claude Code — SessionStart context injection (know the rules before the first token)
|
|
77
|
+
|
|
78
|
+
The write gate teaches by rejection; the SessionStart hook teaches up front.
|
|
79
|
+
`ark-mcp --session-context` prints a compact contract summary — layers, forbidden
|
|
80
|
+
globals, denied-edge count, baseline state, and the check command — which Claude Code
|
|
81
|
+
injects into the agent's context at session start:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"hooks": {
|
|
86
|
+
"SessionStart": [
|
|
87
|
+
{
|
|
88
|
+
"hooks": [
|
|
89
|
+
{
|
|
90
|
+
"type": "command",
|
|
91
|
+
"command": "npx ark-mcp --session-context --root \"$CLAUDE_PROJECT_DIR\" --config ark.config.json"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
What the agent sees:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
Ark architecture contract governs this project (ark.config.json is authoritative).
|
|
104
|
+
Layers:
|
|
105
|
+
- DomainModel: src/domain/** — forbidden globals: fetch, process, Date.now, Math.random
|
|
106
|
+
- PersistenceAdapters: src/adapters/persistence/**
|
|
107
|
+
Rules: 10 denied layer edge(s). Full contract: ark://manifest MCP resource.
|
|
108
|
+
Baseline: 3 frozen violation(s) — only NEW violations fail; do not add to them.
|
|
109
|
+
After edits run: npx ark-check --root . --config ark.config.json --strict-config
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The hook belongs in the **project's** `.claude/settings.json` (that's what
|
|
113
|
+
`--install-agent-gates` generates). It is also safe by construction if you prefer it in
|
|
114
|
+
your global settings: without an `ark.config.json` in the project, `--session-context`
|
|
115
|
+
prints nothing and exits 0, so non-Ark projects are untouched.
|
|
116
|
+
|
|
71
117
|
## Claude Code — MCP server (contract discovery + on-demand validation)
|
|
72
118
|
|
|
73
119
|
The MCP server exposes two things agents can use proactively:
|
|
@@ -142,6 +188,28 @@ Same model as Cursor: MCP for discovery/validation, `ark-check` in CI as the har
|
|
|
142
188
|
For Ark projects, register the MCP server as soon as the repo is adopted so the agent
|
|
143
189
|
has the contract available from the first edit.
|
|
144
190
|
|
|
191
|
+
## Instruction-tier agents: Windsurf, Cline, GitHub Copilot, Kiro, Gemini CLI
|
|
192
|
+
|
|
193
|
+
Agents without MCP or hook support still follow the contract through an always-on
|
|
194
|
+
project rule file. `ark-check --install-agent-gates` generates them (auto-detected
|
|
195
|
+
from `.windsurf/`, `.clinerules/`, `.kiro/`; Copilot is explicit-only):
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
npx ark-check --install-agent-gates --tools windsurf,cline,copilot,kiro
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
| Tool | File written |
|
|
202
|
+
|------|--------------|
|
|
203
|
+
| Windsurf | `.windsurf/rules/ark.md` |
|
|
204
|
+
| Cline | `.clinerules/ark.md` |
|
|
205
|
+
| GitHub Copilot | `.github/copilot-instructions.md` |
|
|
206
|
+
| Kiro | `.kiro/steering/ark.md` |
|
|
207
|
+
| Gemini CLI | none needed — it reads the generated `AGENTS.md` |
|
|
208
|
+
|
|
209
|
+
All of them derive from the same contract as `AGENTS.md` and the Cursor rule, so the
|
|
210
|
+
steps cannot drift. These are advisory (the agent reads rules; nothing blocks the
|
|
211
|
+
write) — keep `ark-check` in CI as the hard gate.
|
|
212
|
+
|
|
145
213
|
## Any other agent runtime with shell hooks
|
|
146
214
|
|
|
147
215
|
If your runtime can run a shell command before file writes and pass the tool payload on stdin (Claude Code's PreToolUse contract), `ark-mcp --hook` works as-is. The contract:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ark-runtime-kernel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Architectural Runtime Kernel — governance for Hexagonal + Event-Driven + DDD systems",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -82,7 +82,13 @@
|
|
|
82
82
|
"ai-agents",
|
|
83
83
|
"mcp",
|
|
84
84
|
"lint",
|
|
85
|
-
"architecture-fitness"
|
|
85
|
+
"architecture-fitness",
|
|
86
|
+
"architecture-enforcement",
|
|
87
|
+
"import-rules",
|
|
88
|
+
"dependency-rules",
|
|
89
|
+
"boundaries",
|
|
90
|
+
"layered-architecture",
|
|
91
|
+
"ai-code-gate"
|
|
86
92
|
],
|
|
87
93
|
"license": "MIT",
|
|
88
94
|
"repository": {
|
package/server.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
3
|
"name": "io.github.pedroknigge/ark",
|
|
4
|
-
"description": "Architecture write-gate for AI agents:
|
|
4
|
+
"description": "Architecture write-gate for AI agents: blocks code that violates your Hexagonal/DDD layer rules.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/pedroknigge/ark-runtime-kernel",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.5.0",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
|
-
"
|
|
12
|
+
"registryType": "npm",
|
|
13
13
|
"identifier": "ark-runtime-kernel",
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.5.0",
|
|
15
|
+
"runtimeHint": "npx",
|
|
15
16
|
"transport": {
|
|
16
17
|
"type": "stdio"
|
|
17
18
|
},
|
|
18
|
-
"
|
|
19
|
-
"package_arguments": [
|
|
19
|
+
"packageArguments": [
|
|
20
20
|
{ "type": "positional", "value": "ark-mcp" },
|
|
21
21
|
{ "type": "named", "name": "--root", "value": ".", "description": "Project root" },
|
|
22
22
|
{
|