@mwillbanks/ast-mcp 0.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.
- package/CONTRIBUTING.md +60 -0
- package/LICENSE +21 -0
- package/README.md +109 -0
- package/dist/ast-mcp-hook.js +7 -0
- package/dist/ast-mcp-hook.js.map +11 -0
- package/dist/ast-mcp-install.js +22 -0
- package/dist/ast-mcp-install.js.map +12 -0
- package/dist/ast-mcp.js +115 -0
- package/dist/ast-mcp.js.map +89 -0
- package/dprint.json +37 -0
- package/logo.svg +1 -0
- package/package.json +89 -0
- package/src/ast-bro/capability.ts +21 -0
- package/src/ast-bro/client.ts +47 -0
- package/src/ast-bro/result.ts +42 -0
- package/src/ast-bro/rewrite-capability.ts +9 -0
- package/src/ast-bro/tools.json +603 -0
- package/src/hook.ts +79 -0
- package/src/http-entry.ts +3 -0
- package/src/http.ts +138 -0
- package/src/index.ts +8 -0
- package/src/installer.ts +501 -0
- package/src/lifecycle.ts +10 -0
- package/src/managed-hook.ts +4 -0
- package/src/patch/aider.ts +224 -0
- package/src/patch/engine.ts +446 -0
- package/src/patch/languages.ts +36 -0
- package/src/runtime/atomic.ts +26 -0
- package/src/runtime/attributes.ts +70 -0
- package/src/runtime/file-delete.ts +96 -0
- package/src/runtime/file-read.ts +178 -0
- package/src/runtime/format.ts +56 -0
- package/src/runtime/hash.ts +11 -0
- package/src/runtime/locks.ts +87 -0
- package/src/runtime/paths.ts +73 -0
- package/src/runtime/process-input.ts +25 -0
- package/src/runtime/signals.ts +47 -0
- package/src/server.ts +13 -0
- package/src/stdio.ts +154 -0
- package/src/tools/ast-bro.ts +172 -0
- package/src/tools/files.ts +173 -0
- package/src/tools/index.ts +11 -0
- package/src/tools/lifecycle.ts +124 -0
- package/templates/AGENTS.md +56 -0
- package/templates/skills/ast-mcp/SKILL.md +96 -0
- package/templates/skills/ast-mcp/agents/openai.yaml +4 -0
- package/templates/skills/ast-mcp/evals/batch.evals.json +274 -0
- package/templates/skills/ast-mcp/evals/evals.json +1209 -0
- package/templates/skills/ast-mcp/evals/file-hash.evals.json +50 -0
- package/templates/skills/ast-mcp/evals/measure.ts +18 -0
- package/templates/skills/ast-mcp/evals/results.md +17 -0
- package/templates/skills/ast-mcp/evals/score.ts +417 -0
- package/templates/skills/ast-mcp/evals/semantic.ts +332 -0
- package/templates/skills/ast-mcp/evals/trigger-queries.json +22 -0
- package/templates/skills/ast-mcp/evals/validate.ts +99 -0
- package/templates/skills/ast-mcp/references/installation.md +40 -0
- package/templates/skills/ast-mcp/references/managed-hook.ts +3 -0
- package/templates/skills/ast-mcp/references/patch-state-machine.md +39 -0
- package/templates/skills/ast-mcp/references/tool-catalog.md +46 -0
- package/templates/skills/ast-mcp/scripts/check-install.ts +269 -0
- package/templates/skills/ast-mcp/scripts/managed-hook.ts +22 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ast-mcp
|
|
3
|
+
description: Use ast-mcp when exploring unfamiliar code, tracing symbols or dependencies, reading and hashing files, creating files, or editing existing code under AST-isolated write rules. Also use when ast-mcp tools are missing and the MCP, hooks, or skill need local or global installation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AST MCP
|
|
7
|
+
|
|
8
|
+
Treat ast-mcp as the only code-intelligence and filesystem boundary. Do not call direct editors, `apply_patch`, shell mutation utilities, or interpreter write scripts.
|
|
9
|
+
|
|
10
|
+
## Start with availability
|
|
11
|
+
|
|
12
|
+
1. Confirm that `file_hash`, `file_read`, `file_write`, `file_patch`, and the direct intelligence tools are callable.
|
|
13
|
+
2. If any are unavailable, stop mutation and follow [installation.md](references/installation.md). Run `scripts/check-install.ts` to diagnose the configured host when Bun and this skill directory are available.
|
|
14
|
+
3. After installation, ask the host to reconnect or restart MCP servers, then list tools again. Never fall back to another writer.
|
|
15
|
+
|
|
16
|
+
## Explore before editing
|
|
17
|
+
|
|
18
|
+
- AST-capable files must be inspected with AST intelligence, never `file_read`: start unfamiliar work with `digest`, use `map` for one file's shape, and use `show` for exact symbols.
|
|
19
|
+
- Use `search` when names are unknown and `find_related` for code similar to a known location.
|
|
20
|
+
- Use `context` for a symbol plus nearby calls; use `impact` before changing a public or shared symbol.
|
|
21
|
+
- Use `deps`, `reverse_deps`, `graph`, or `cycles` for module relationships.
|
|
22
|
+
- Use `callers`, `callees`, or `trace` for execution flow; use `implements` for type hierarchies.
|
|
23
|
+
- Use `surface` for exported API shape, `index` for search-index maintenance, and `squeeze` only for repetitive logs or text.
|
|
24
|
+
- Use `file_read` only for unsupported non-AST content. Request explicit zero-based, end-exclusive line slices, accept the default `[0, 100]` only when sufficient, and batch multiple files in one call.
|
|
25
|
+
- Use ast-mcp intelligence as the primary repository search route. Never invoke `ast-grep` directly and never use `sed` for repository reads or edits. `rg` is permitted only as a discouraged fallback for exact literals, identifiers, non-AST formats, or discovery unavailable through ast-mcp; external transcript analysis, Git metadata, validation, and live-runtime reproduction are exceptions.
|
|
26
|
+
|
|
27
|
+
Read [tool-catalog.md](references/tool-catalog.md) for exact arguments and combinations.
|
|
28
|
+
|
|
29
|
+
## Mutate through keyed file_patch and file_write
|
|
30
|
+
|
|
31
|
+
1. Inspect AST-capable targets with `map`, `show`, `context`, or a bounded `run` search. For unsupported content, use one batched `file_read({ files: [...] })` call with narrow line ranges.
|
|
32
|
+
2. Preview every AST rule with `run({ pattern, paths: [filePath], lang?, json: true })`; inspect all matches and reject capped output before mutation. For a contract-level dry run, send the same keyed `file_patch` entry with `preview: true`; it returns the formatted bounded diff and never commits.
|
|
33
|
+
3. Call one batched `file_hash({ filePaths: [...] })` immediately before guarded edits. Keep one returned hash per keyed path.
|
|
34
|
+
4. Use one path-keyed `file_patch` batch for one or more files:
|
|
35
|
+
- AST targets: `{ expectedSha256, patchStrategy: "ast", astRules: [{ pattern, fix, expectedMatches: 1 }], preview?: boolean }`
|
|
36
|
+
- Unsupported targets: `{ expectedSha256, patchStrategy: "aider_block", aiderBlocks: [{ search, replace }], preview?: boolean }`
|
|
37
|
+
Operations in each array run in order under one file lock; preview returns without committing and normal mode commits atomically.
|
|
38
|
+
5. Use one path-keyed `file_write` batch for new files or SHA-guarded replacement of existing non-structurally-rewritable files. Supply the shared `chattr` object when chmod/chown metadata is required; missing parents are created only after a guarded `ENOENT` write and path revalidation.
|
|
39
|
+
6. Use `file_chattr` for metadata-only changes. Use hash-guarded `file_delete` for deletion; it preflights all targets and AST import references before any deletion, requires an explicit `forceReferences` override for referenced source, and removes empty ancestor directories after lock release.
|
|
40
|
+
7. Use direct `run` with `rewrite` and `write: true` only for an intentionally bounded lower-level rewrite; it is not the normal agent patch route and still rewrites only the first match per file.
|
|
41
|
+
8. Verify keyed results with `show`, `map`, `run`, or bounded `file_read` slices, then run repository validation.
|
|
42
|
+
|
|
43
|
+
Example batched AST patch:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
file_patch({
|
|
47
|
+
"/repo/src/service.ts": {
|
|
48
|
+
"expectedSha256": "<from file_hash>",
|
|
49
|
+
"patchStrategy": "ast",
|
|
50
|
+
"astRules": [
|
|
51
|
+
{ "pattern": "oldName($$$ARGS)", "fix": "newName($$$ARGS)", "expectedMatches": 1 },
|
|
52
|
+
{ "pattern": "oldFlag", "fix": "newFlag", "expectedMatches": 1 }
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Example batched Aider patch:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
file_patch({
|
|
62
|
+
"/repo/notes.md": {
|
|
63
|
+
"expectedSha256": "<from file_hash>",
|
|
64
|
+
"patchStrategy": "aider_block",
|
|
65
|
+
"aiderBlocks": [{ "search": "old paragraph", "replace": "new paragraph" }]
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Example batched file write:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
file_write({
|
|
74
|
+
"/repo/new-a.txt": { "content": "alpha\\n" },
|
|
75
|
+
"/repo/existing.txt": { "content": "beta\\n", "expectedSha256": "<from file_hash>" }
|
|
76
|
+
})
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
MCP transport requests may use a single JSON-RPC array containing requests and notifications. The stdio transport expands the array, preserves request IDs, and emits one line per request response. The live streamable HTTP transport uses SSE by default and emits one event per request response. Neither transport emits a response for notifications; do not assume that live HTTP returns a JSON array unless `enableJsonResponse` was explicitly configured.
|
|
80
|
+
|
|
81
|
+
Read [patch-state-machine.md](references/patch-state-machine.md) for routing and rejection recovery.
|
|
82
|
+
|
|
83
|
+
## Recover safely
|
|
84
|
+
|
|
85
|
+
- Stale SHA: refresh `file_hash`, re-inspect through AST or a bounded unsupported-content slice, and rebuild the patch.
|
|
86
|
+
- Zero or excess matches: narrow each AST rule; every astRules item must match exactly one node because ast-bro rewrites the first match per file, while ordered arrays let one keyed file_patch apply multiple reviewed operations.
|
|
87
|
+
- Capped direct preview: narrow paths, glob, or pattern before writing.
|
|
88
|
+
- Aider ambiguity: request a larger bounded slice and expand the search block with unique surrounding context.
|
|
89
|
+
- Dprint preflight failure: do not write that file until a configured formatter supports it.
|
|
90
|
+
- MCP loss mid-task: stop writing, restore the server, then re-inspect touched and pending files through their correct AST or non-AST routes.
|
|
91
|
+
|
|
92
|
+
## Completion check
|
|
93
|
+
|
|
94
|
+
Confirm the old structure is absent through AST search, callers are correct, touched files were verified through their proper route, dprint-backed writes succeeded, repository validation passes, and no direct-write or whole-file-read bypass was used.
|
|
95
|
+
|
|
96
|
+
Use `evals:check` for fixture-matrix integrity. `evals:measure` inventories direct MCP transcript records and statically visible `tools.mcp__ast_mcp__*` calls inside top-level Codex `exec` source. Put exactly one `ast-mcp-eval:<id>` marker in the user evaluation prompt, or in a direct record input supplied by an evaluation harness, to associate the following direct MCP records with that case. An outer `exec` result cannot prove each nested call, so marked nested calls and multi-marker evidence fail closed. Scoring validates schema-relevant inputs, transcript workspace roots, required order, expected output evidence, assertions, and successful per-call outputs. Use `evals:score --strict` only for a complete marked matrix; transcript scoring is matched task-execution evidence, not a blanket agent-quality claim.
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"assertions": [
|
|
4
|
+
"Uses one keyed batch instead of one call per file.",
|
|
5
|
+
"Uses schema-valid content values keyed by file path.",
|
|
6
|
+
"Reports each created file for verification."
|
|
7
|
+
],
|
|
8
|
+
"category": "positive",
|
|
9
|
+
"expected_output": "Uses one path-keyed file_write object whose values contain content and reports every created file.",
|
|
10
|
+
"files": ["notes/one.txt", "notes/two.txt", "notes/three.txt"],
|
|
11
|
+
"forbidden_tools": ["file_patch"],
|
|
12
|
+
"id": 74,
|
|
13
|
+
"prompt": "Create notes/one.txt, notes/two.txt, and notes/three.txt in one file_write operation.",
|
|
14
|
+
"required_tools": ["file_write"],
|
|
15
|
+
"surface": "file_write",
|
|
16
|
+
"variant": "keyed-batch"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"assertions": [
|
|
20
|
+
"Batches create and guarded non-AST replacement operations together.",
|
|
21
|
+
"Obtains a fresh file_hash before replacing existing content.",
|
|
22
|
+
"Does not route either operation through file_patch."
|
|
23
|
+
],
|
|
24
|
+
"category": "variant",
|
|
25
|
+
"expected_output": "Uses one keyed file_write batch and includes expectedSha256 only for the existing file.",
|
|
26
|
+
"files": [],
|
|
27
|
+
"forbidden_tools": ["file_patch"],
|
|
28
|
+
"id": 75,
|
|
29
|
+
"prompt": "Create one new text file and replace one existing non-AST file in a single file_write batch using a fresh hash for the existing file.",
|
|
30
|
+
"required_tools": ["file_hash", "file_write"],
|
|
31
|
+
"surface": "file_write",
|
|
32
|
+
"variant": "mixed-create-and-replace"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"assertions": [
|
|
36
|
+
"Does not use file_write for an existing structurally rewritable file.",
|
|
37
|
+
"Selects file_patch with patchStrategy ast.",
|
|
38
|
+
"Preserves the fresh-hash and preview requirements."
|
|
39
|
+
],
|
|
40
|
+
"category": "negative",
|
|
41
|
+
"expected_output": "Selects file_patch with an AST rule and does not call file_write.",
|
|
42
|
+
"files": [],
|
|
43
|
+
"forbidden_tools": ["file_write"],
|
|
44
|
+
"id": 76,
|
|
45
|
+
"prompt": "Replace an existing TypeScript implementation.",
|
|
46
|
+
"required_tools": ["file_patch"],
|
|
47
|
+
"surface": "file_write",
|
|
48
|
+
"variant": "ast-existing-near-miss"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"assertions": [
|
|
52
|
+
"Batches multiple files in one file_patch call.",
|
|
53
|
+
"Keeps multiple AST rules for one file in their declared order under one hash guard.",
|
|
54
|
+
"Uses run only to preview or verify and sends the mutation through file_patch."
|
|
55
|
+
],
|
|
56
|
+
"category": "positive",
|
|
57
|
+
"expected_output": "Uses one path-keyed file_patch object with ordered astRules arrays and one expectedSha256 per file; run is used only for preview and verification.",
|
|
58
|
+
"files": [],
|
|
59
|
+
"forbidden_tools": ["file_write"],
|
|
60
|
+
"id": 77,
|
|
61
|
+
"prompt": "Apply two reviewed AST rules to one TypeScript file and patch two other files in the same operation.",
|
|
62
|
+
"required_tools": ["file_hash", "run", "file_patch"],
|
|
63
|
+
"surface": "file_patch",
|
|
64
|
+
"variant": "ordered-ast-rules"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"assertions": [
|
|
68
|
+
"Batches repeated edits to the same file instead of making repeated patch calls.",
|
|
69
|
+
"Uses one fresh expectedSha256 for the complete operation.",
|
|
70
|
+
"Preserves Aider ambiguity and atomic-commit safeguards."
|
|
71
|
+
],
|
|
72
|
+
"category": "variant",
|
|
73
|
+
"expected_output": "Uses one path-keyed file_patch entry with patchStrategy aider_block and an ordered aiderBlocks array.",
|
|
74
|
+
"files": [],
|
|
75
|
+
"forbidden_tools": ["file_write"],
|
|
76
|
+
"id": 78,
|
|
77
|
+
"prompt": "Apply three unique Aider blocks to one unsupported document in one guarded patch.",
|
|
78
|
+
"required_tools": ["file_hash", "file_patch"],
|
|
79
|
+
"surface": "file_patch",
|
|
80
|
+
"variant": "ordered-aider-blocks"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"assertions": [
|
|
84
|
+
"Refuses to treat a batch shape as permission to skip inspection.",
|
|
85
|
+
"Obtains a separate fresh hash for every keyed file.",
|
|
86
|
+
"Previews every ordered rule before the single batch mutation."
|
|
87
|
+
],
|
|
88
|
+
"category": "negative",
|
|
89
|
+
"expected_output": "Does not call file_patch until AST or bounded non-AST inspection, file_hash, and previews are complete.",
|
|
90
|
+
"files": [],
|
|
91
|
+
"forbidden_tools": ["file_patch"],
|
|
92
|
+
"id": 79,
|
|
93
|
+
"prompt": "Patch four files immediately without inspecting them, hashing them, or previewing the rules.",
|
|
94
|
+
"required_tools": ["digest", "map", "show", "run", "file_hash"],
|
|
95
|
+
"surface": "file_patch",
|
|
96
|
+
"variant": "unreviewed-batch"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"assertions": [
|
|
100
|
+
"Does not use run with write:true for a normal agent mutation.",
|
|
101
|
+
"Uses file_patch with patchStrategy ast for the reviewed edit.",
|
|
102
|
+
"Previews exact AST matches before the keyed file_patch mutation."
|
|
103
|
+
],
|
|
104
|
+
"category": "negative",
|
|
105
|
+
"expected_output": "Uses run only for preview or verification and routes the mutation through keyed file_patch with astRules.",
|
|
106
|
+
"files": [],
|
|
107
|
+
"forbidden_tools": ["file_write"],
|
|
108
|
+
"id": 81,
|
|
109
|
+
"prompt": "A normal reviewed TypeScript edit could be sent directly through run with write:true; choose the correct mutation route.",
|
|
110
|
+
"required_tools": ["map", "run", "file_hash", "file_patch"],
|
|
111
|
+
"surface": "run",
|
|
112
|
+
"variant": "mutation-route-boundary"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"assertions": [
|
|
116
|
+
"Preserves JSON-RPC array framing at the transport layer.",
|
|
117
|
+
"Returns one response per request while omitting notification responses.",
|
|
118
|
+
"Keeps request IDs correlated after batching."
|
|
119
|
+
],
|
|
120
|
+
"category": "positive",
|
|
121
|
+
"expected_output": "Uses the native transport batch array and correlates one response to each request ID.",
|
|
122
|
+
"files": [],
|
|
123
|
+
"forbidden_tools": [],
|
|
124
|
+
"id": 80,
|
|
125
|
+
"prompt": "Send two JSON-RPC requests and a notification in one MCP transport payload.",
|
|
126
|
+
"required_tools": [],
|
|
127
|
+
"surface": "transport",
|
|
128
|
+
"variant": "json-rpc-batch"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"assertions": [
|
|
132
|
+
"Rejects the empty batch instead of silently dropping it.",
|
|
133
|
+
"Returns JSON-RPC error code -32600 with a null ID.",
|
|
134
|
+
"Does not dispatch a request or notification for the invalid batch."
|
|
135
|
+
],
|
|
136
|
+
"category": "negative",
|
|
137
|
+
"expected_output": "Returns one JSON-RPC Invalid Request error with a null ID and processes no request messages.",
|
|
138
|
+
"files": [],
|
|
139
|
+
"forbidden_tools": [],
|
|
140
|
+
"id": 84,
|
|
141
|
+
"prompt": "Send an empty JSON-RPC batch through the stdio MCP transport.",
|
|
142
|
+
"required_tools": [],
|
|
143
|
+
"surface": "transport",
|
|
144
|
+
"variant": "invalid-empty-batch"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"assertions": [
|
|
148
|
+
"Accepts a JSON-RPC array on the stdio transport.",
|
|
149
|
+
"Returns both request responses without emitting notification responses.",
|
|
150
|
+
"Preserves request IDs and existing stdio framing."
|
|
151
|
+
],
|
|
152
|
+
"category": "variant",
|
|
153
|
+
"expected_output": "Expands the stdio batch into individual validated messages and returns one correlated response per request.",
|
|
154
|
+
"files": [],
|
|
155
|
+
"forbidden_tools": [],
|
|
156
|
+
"id": 82,
|
|
157
|
+
"prompt": "Send two initialized ping requests as one JSON-RPC array through the stdio MCP transport.",
|
|
158
|
+
"required_tools": [],
|
|
159
|
+
"surface": "transport",
|
|
160
|
+
"variant": "stdio-json-rpc-batch"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"assertions": [
|
|
164
|
+
"Uses file_patch preview true for the end-to-end dry run.",
|
|
165
|
+
"Keeps the same patchStrategy, ordered operations, and expectedSha256 between preview and mutation.",
|
|
166
|
+
"Does not treat a preview result as a committed change."
|
|
167
|
+
],
|
|
168
|
+
"category": "variant",
|
|
169
|
+
"expected_output": "Uses the same keyed file_patch entry with preview true, a fresh hash, and the appropriate ordered astRules or aiderBlocks; it verifies the bounded diff and then sends the guarded mutation.",
|
|
170
|
+
"files": [],
|
|
171
|
+
"forbidden_tools": ["run"],
|
|
172
|
+
"id": 83,
|
|
173
|
+
"prompt": "Preview an ordered AST or Aider batch through file_patch before committing it.",
|
|
174
|
+
"required_tools": ["file_hash", "file_patch"],
|
|
175
|
+
"surface": "file_patch",
|
|
176
|
+
"variant": "contract-preview"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"assertions": [
|
|
180
|
+
"Uses the registered lifecycle surface.",
|
|
181
|
+
"Preserves root and stale-context safeguards.",
|
|
182
|
+
"Reports the per-file operation result."
|
|
183
|
+
],
|
|
184
|
+
"category": "positive",
|
|
185
|
+
"expected_output": "Uses the guarded file_chattr contract.",
|
|
186
|
+
"files": [],
|
|
187
|
+
"forbidden_tools": [],
|
|
188
|
+
"id": 85,
|
|
189
|
+
"prompt": "Apply chmod attributes to two files.",
|
|
190
|
+
"required_tools": ["file_chattr"],
|
|
191
|
+
"surface": "file_chattr",
|
|
192
|
+
"variant": "chmod"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"assertions": [
|
|
196
|
+
"Uses the registered lifecycle surface.",
|
|
197
|
+
"Preserves root and stale-context safeguards.",
|
|
198
|
+
"Reports the per-file operation result."
|
|
199
|
+
],
|
|
200
|
+
"category": "variant",
|
|
201
|
+
"expected_output": "Uses the guarded file_chattr contract.",
|
|
202
|
+
"files": [],
|
|
203
|
+
"forbidden_tools": [],
|
|
204
|
+
"id": 86,
|
|
205
|
+
"prompt": "Apply chown attributes with hash guards.",
|
|
206
|
+
"required_tools": ["file_chattr"],
|
|
207
|
+
"surface": "file_chattr",
|
|
208
|
+
"variant": "chown"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"assertions": [
|
|
212
|
+
"Uses the registered lifecycle surface.",
|
|
213
|
+
"Preserves root and stale-context safeguards.",
|
|
214
|
+
"Reports the per-file operation result."
|
|
215
|
+
],
|
|
216
|
+
"category": "negative",
|
|
217
|
+
"expected_output": "Uses the guarded file_chattr contract.",
|
|
218
|
+
"files": [],
|
|
219
|
+
"forbidden_tools": [],
|
|
220
|
+
"id": 87,
|
|
221
|
+
"prompt": "Reject invalid file attributes.",
|
|
222
|
+
"required_tools": ["file_chattr"],
|
|
223
|
+
"surface": "file_chattr",
|
|
224
|
+
"variant": "invalid"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"assertions": [
|
|
228
|
+
"Uses the registered lifecycle surface.",
|
|
229
|
+
"Preserves root and stale-context safeguards.",
|
|
230
|
+
"Reports the per-file operation result."
|
|
231
|
+
],
|
|
232
|
+
"category": "positive",
|
|
233
|
+
"expected_output": "Uses the guarded file_delete contract.",
|
|
234
|
+
"files": [],
|
|
235
|
+
"forbidden_tools": [],
|
|
236
|
+
"id": 88,
|
|
237
|
+
"prompt": "Delete two hash-guarded files and report empty directories.",
|
|
238
|
+
"required_tools": ["file_delete"],
|
|
239
|
+
"surface": "file_delete",
|
|
240
|
+
"variant": "batch"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"assertions": [
|
|
244
|
+
"Uses the registered lifecycle surface.",
|
|
245
|
+
"Preserves root and stale-context safeguards.",
|
|
246
|
+
"Reports the per-file operation result."
|
|
247
|
+
],
|
|
248
|
+
"category": "variant",
|
|
249
|
+
"expected_output": "Uses the guarded file_delete contract.",
|
|
250
|
+
"files": [],
|
|
251
|
+
"forbidden_tools": [],
|
|
252
|
+
"id": 89,
|
|
253
|
+
"prompt": "Reject stale deletion context before mutating.",
|
|
254
|
+
"required_tools": ["file_delete"],
|
|
255
|
+
"surface": "file_delete",
|
|
256
|
+
"variant": "stale"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"assertions": [
|
|
260
|
+
"Uses the registered lifecycle surface.",
|
|
261
|
+
"Preserves root and stale-context safeguards.",
|
|
262
|
+
"Reports the per-file operation result."
|
|
263
|
+
],
|
|
264
|
+
"category": "negative",
|
|
265
|
+
"expected_output": "Uses the guarded file_delete contract.",
|
|
266
|
+
"files": [],
|
|
267
|
+
"forbidden_tools": [],
|
|
268
|
+
"id": 90,
|
|
269
|
+
"prompt": "Reject non-file deletion targets.",
|
|
270
|
+
"required_tools": ["file_delete"],
|
|
271
|
+
"surface": "file_delete",
|
|
272
|
+
"variant": "directory"
|
|
273
|
+
}
|
|
274
|
+
]
|