@testmuai/rook-skill 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/LICENSE +201 -0
- package/README.md +48 -0
- package/cli.js +46 -0
- package/lib/installer.js +162 -0
- package/package.json +39 -0
- package/skills/SKILL.md +89 -0
- package/skills/references/ci.md +73 -0
- package/skills/references/headless-contract.md +81 -0
- package/skills/references/mcp.md +27 -0
- package/skills/references/profiles.md +52 -0
- package/skills/references/scenarios.md +67 -0
- package/skills/references/troubleshooting.md +85 -0
- package/skills/references/verdicts.md +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Rook skill installer
|
|
2
|
+
|
|
3
|
+
Install the Rook skill for Claude Code, Codex and Gemini CLI. Requires Node.js
|
|
4
|
+
22+ and npm. Install the [Rook CLI](https://github.com/LambdaTest/rook#install)
|
|
5
|
+
separately. The skill supports compatible CLI releases and has its own package
|
|
6
|
+
version; a CLI version bump alone does not require a skill-package release.
|
|
7
|
+
The npm commands below work after maintainers publish the first package.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @testmuai/rook-skill
|
|
11
|
+
npx @testmuai/rook-skill@latest update
|
|
12
|
+
npx @testmuai/rook-skill uninstall
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
By default, all three clients receive the skill beneath your home directory:
|
|
16
|
+
|
|
17
|
+
| Client | Destination |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| Claude Code | `~/.claude/skills/rook/` |
|
|
20
|
+
| Codex | `~/.agents/skills/rook/` |
|
|
21
|
+
| Gemini CLI | `~/.gemini/skills/rook/` |
|
|
22
|
+
|
|
23
|
+
Use `--agent claude-code`, `--agent codex` or `--agent gemini-cli` to select
|
|
24
|
+
clients; repeat the flag for multiple clients. Install/update uses the executed
|
|
25
|
+
package's bundle; `@latest` fetches the current release. `--prefix` replaces the
|
|
26
|
+
home root. Preview an unpublished checkout without changing your home skills:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
node skill-installer/cli.js install --agent codex --prefix /tmp/rook-skill-preview
|
|
30
|
+
node skill-installer/cli.js uninstall --agent codex --prefix /tmp/rook-skill-preview
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Updates and uninstall require unchanged installer-owned files. Unowned skills,
|
|
34
|
+
local edits, added/missing files or directories, and symlinks beneath the resolved
|
|
35
|
+
prefix stop the operation. Back up or move custom skills first; there is no force
|
|
36
|
+
option. Replacements roll back on failure; inspect any reported backup path.
|
|
37
|
+
Before removing a stale `.installer-lock`, verify no installer is running.
|
|
38
|
+
Uninstall preserves parent directories and unrelated skills.
|
|
39
|
+
|
|
40
|
+
## Release
|
|
41
|
+
|
|
42
|
+
After merging, run **Publish rook-skill** on `main` in `LambdaTest/rook` with a
|
|
43
|
+
new stable version such as `0.1.0`. Configure `NPM_TOKEN` with publish access to
|
|
44
|
+
`@testmuai/rook-skill` first. The manual workflow validates the version, runs
|
|
45
|
+
package and mirror tests, stamps, packs and publishes. It creates no Git tag or
|
|
46
|
+
version commit; retain the run and source commit as release provenance.
|
|
47
|
+
Before release, run `bash scripts/test-skill-installer.sh`; keep the canonical
|
|
48
|
+
skill and mirrors aligned when commands, workflows or output contracts change.
|
package/cli.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { dirname, resolve } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { manageSkills, AGENTS } from './lib/installer.js';
|
|
7
|
+
|
|
8
|
+
const help = `Usage: rook-skill [install|update|uninstall] [options]
|
|
9
|
+
|
|
10
|
+
Install is the default. Install/update uses the skill bundled with this package;
|
|
11
|
+
use npx @testmuai/rook-skill@latest update to fetch the latest package.
|
|
12
|
+
|
|
13
|
+
--agent <name> Select claude-code, codex, or gemini-cli (repeatable).
|
|
14
|
+
Default: all three.
|
|
15
|
+
--prefix <dir> Root containing the client directories. Default: your home.
|
|
16
|
+
--help Show this help.
|
|
17
|
+
|
|
18
|
+
Destinations: .claude/skills/rook, .agents/skills/rook, .gemini/skills/rook.
|
|
19
|
+
Existing unowned or locally modified skills are preserved; move or back them up
|
|
20
|
+
before replacing them. Uninstall removes only unchanged installer-owned copies.
|
|
21
|
+
This installs skill files, not the Rook CLI. Node.js 22 or newer is required.
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
if (Number(process.versions.node.split('.')[0]) < 22) throw new Error('Node.js 22 or newer is required.');
|
|
26
|
+
const { values, positionals } = parseArgs({
|
|
27
|
+
options: { agent: { type: 'string', multiple: true }, prefix: { type: 'string' }, help: { type: 'boolean' } },
|
|
28
|
+
allowPositionals: true,
|
|
29
|
+
});
|
|
30
|
+
if (values.help) {
|
|
31
|
+
process.stdout.write(help);
|
|
32
|
+
} else {
|
|
33
|
+
const action = positionals[0] ?? 'install';
|
|
34
|
+
if (positionals.length > 1 || !['install', 'update', 'uninstall'].includes(action)) {
|
|
35
|
+
throw new Error('Expected install, update, or uninstall. Use --help for usage.');
|
|
36
|
+
}
|
|
37
|
+
const agents = values.agent ?? Object.keys(AGENTS);
|
|
38
|
+
for (const name of agents) if (!Object.hasOwn(AGENTS, name)) throw new Error(`Unknown agent: ${name}`);
|
|
39
|
+
const results = manageSkills({ action, agents: [...new Set(agents)],
|
|
40
|
+
prefix: resolve(values.prefix ?? homedir()), packageRoot: dirname(fileURLToPath(import.meta.url)) });
|
|
41
|
+
for (const result of results) process.stdout.write(`${result.message}: ${result.agent} → ${result.target}\n`);
|
|
42
|
+
}
|
|
43
|
+
} catch (error) {
|
|
44
|
+
process.stderr.write(`rook-skill: ${error.message}\n`);
|
|
45
|
+
process.exitCode = 1;
|
|
46
|
+
}
|
package/lib/installer.js
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { cpSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync,
|
|
3
|
+
realpathSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
5
|
+
|
|
6
|
+
export const AGENTS = { 'claude-code': '.claude', codex: '.agents', 'gemini-cli': '.gemini' };
|
|
7
|
+
const PACKAGE = '@testmuai/rook-skill';
|
|
8
|
+
const MARKER = '.rook-skill-install.json';
|
|
9
|
+
|
|
10
|
+
function present(path) {
|
|
11
|
+
try { return lstatSync(path); } catch (error) {
|
|
12
|
+
if (error.code === 'ENOENT') return null;
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Include empty directories and reject links; ownership never authorizes following
|
|
18
|
+
// a skill symlink or removing files that were added after installation.
|
|
19
|
+
function inventory(root, relative = '') {
|
|
20
|
+
const result = Object.create(null);
|
|
21
|
+
for (const name of readdirSync(join(root, relative)).sort()) {
|
|
22
|
+
if (!relative && name === MARKER) continue;
|
|
23
|
+
const key = relative ? `${relative}/${name}` : name;
|
|
24
|
+
const path = join(root, key);
|
|
25
|
+
const st = lstatSync(path);
|
|
26
|
+
if (st.isSymbolicLink()) throw new Error(`Refusing symlink in skill: ${path}`);
|
|
27
|
+
if (st.isDirectory()) {
|
|
28
|
+
result[`${key}/`] = 'directory';
|
|
29
|
+
Object.assign(result, inventory(root, key));
|
|
30
|
+
} else if (st.isFile()) {
|
|
31
|
+
result[key] = `sha256:${createHash('sha256').update(readFileSync(path)).digest('hex')}`;
|
|
32
|
+
} else throw new Error(`Unsupported file type: ${path}`);
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function stable(value) { return JSON.stringify(Object.entries(value).sort(([a], [b]) => a.localeCompare(b))); }
|
|
38
|
+
|
|
39
|
+
function assertOwned(target) {
|
|
40
|
+
const st = present(target);
|
|
41
|
+
if (!st) return false;
|
|
42
|
+
if (!st.isDirectory() || st.isSymbolicLink()) throw new Error(`Refusing non-directory or symlink target: ${target}`);
|
|
43
|
+
const markerPath = join(target, MARKER);
|
|
44
|
+
const markerStat = present(markerPath);
|
|
45
|
+
if (!markerStat?.isFile() || markerStat.isSymbolicLink()) {
|
|
46
|
+
throw new Error(`Existing skill is not owned by this installer: ${target}. Back it up or move it first.`);
|
|
47
|
+
}
|
|
48
|
+
let marker;
|
|
49
|
+
try { marker = JSON.parse(readFileSync(markerPath, 'utf8')); } catch {
|
|
50
|
+
throw new Error(`Invalid ownership record: ${markerPath}. Existing files were preserved.`);
|
|
51
|
+
}
|
|
52
|
+
if (marker?.schema !== 1 || marker.package !== PACKAGE || !marker.files ||
|
|
53
|
+
typeof marker.files !== 'object' || Array.isArray(marker.files)) {
|
|
54
|
+
throw new Error(`Unrecognized ownership record: ${markerPath}`);
|
|
55
|
+
}
|
|
56
|
+
if (stable(inventory(target)) !== stable(marker.files)) {
|
|
57
|
+
throw new Error(`Locally modified skill: ${target}. Back up or move your edits before updating or uninstalling.`);
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function canonicalPrefix(prefix) {
|
|
63
|
+
let current = resolve(prefix);
|
|
64
|
+
const missing = [];
|
|
65
|
+
while (!present(current)) {
|
|
66
|
+
missing.unshift(basename(current));
|
|
67
|
+
current = dirname(current);
|
|
68
|
+
}
|
|
69
|
+
if (!statSync(current).isDirectory()) throw new Error(`Prefix is not a directory: ${current}`);
|
|
70
|
+
return join(realpathSync(current), ...missing);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function assertParents(path, prefix) {
|
|
74
|
+
for (let current = path;; current = dirname(current)) {
|
|
75
|
+
const st = present(current);
|
|
76
|
+
if (st?.isSymbolicLink()) throw new Error(`Refusing symlinked client or skills directory: ${current}`);
|
|
77
|
+
if (st && !st.isDirectory()) throw new Error(`Parent is not a directory: ${current}`);
|
|
78
|
+
if (current === prefix) break;
|
|
79
|
+
if (dirname(current) === current) throw new Error('Target is outside the selected prefix.');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function manageSkills({ action, agents, prefix, packageRoot }) {
|
|
84
|
+
// Resolve an explicitly selected prefix (including aliases such as /tmp),
|
|
85
|
+
// then reject links below it rather than following client-directory links.
|
|
86
|
+
prefix = canonicalPrefix(prefix);
|
|
87
|
+
const metadata = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8'));
|
|
88
|
+
if (metadata.name !== PACKAGE || typeof metadata.version !== 'string') throw new Error('Invalid skill package metadata.');
|
|
89
|
+
const source = join(packageRoot, 'skills');
|
|
90
|
+
if (action !== 'uninstall') {
|
|
91
|
+
const st = present(source);
|
|
92
|
+
if (!st?.isDirectory() || st.isSymbolicLink()) throw new Error('The packaged skills directory is missing or is a symlink.');
|
|
93
|
+
inventory(source);
|
|
94
|
+
if (!/^name:\s*rook\s*$/m.test(readFileSync(join(source, 'SKILL.md'), 'utf8'))) throw new Error('The packaged Rook SKILL.md is invalid.');
|
|
95
|
+
if (present(join(source, MARKER)) || present(join(source, 'VERSION'))) throw new Error('The skill bundle contains reserved installer files.');
|
|
96
|
+
}
|
|
97
|
+
const plans = agents.map((agent) => {
|
|
98
|
+
const target = join(prefix, AGENTS[agent], 'skills', 'rook');
|
|
99
|
+
assertParents(dirname(target), prefix);
|
|
100
|
+
return { agent, target, owned: assertOwned(target), lock: `${target}.installer-lock` };
|
|
101
|
+
});
|
|
102
|
+
const locked = [];
|
|
103
|
+
let committed = false;
|
|
104
|
+
try {
|
|
105
|
+
for (const plan of plans) {
|
|
106
|
+
if (action === 'uninstall' && !plan.owned) continue;
|
|
107
|
+
assertParents(dirname(plan.target), prefix);
|
|
108
|
+
mkdirSync(dirname(plan.target), { recursive: true });
|
|
109
|
+
try { mkdirSync(plan.lock); } catch (error) {
|
|
110
|
+
if (error.code === 'EEXIST') throw new Error(`Another operation or a stale lock exists: ${plan.lock}. Check it before retrying.`);
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
locked.push(plan.lock);
|
|
114
|
+
plan.owned = assertOwned(plan.target);
|
|
115
|
+
if (action !== 'uninstall') {
|
|
116
|
+
plan.stage = mkdtempSync(join(dirname(plan.target), '.rook-skill-stage-'));
|
|
117
|
+
cpSync(source, plan.stage, { recursive: true });
|
|
118
|
+
writeFileSync(join(plan.stage, 'VERSION'), `${metadata.version}\n`);
|
|
119
|
+
writeFileSync(join(plan.stage, MARKER), `${JSON.stringify({ schema: 1, package: PACKAGE,
|
|
120
|
+
version: metadata.version, files: inventory(plan.stage) }, null, 2)}\n`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// Keep old copies until every replacement succeeds, so a rename failure can
|
|
124
|
+
// roll back earlier targets. Staging never merges with an existing skill.
|
|
125
|
+
for (const plan of plans) {
|
|
126
|
+
if (action === 'uninstall' && !plan.owned) continue;
|
|
127
|
+
assertParents(dirname(plan.target), prefix);
|
|
128
|
+
assertOwned(plan.target);
|
|
129
|
+
if (present(plan.target)) {
|
|
130
|
+
plan.backupRoot = mkdtempSync(join(dirname(plan.target), '.rook-skill-backup-'));
|
|
131
|
+
plan.backup = join(plan.backupRoot, 'previous');
|
|
132
|
+
renameSync(plan.target, plan.backup);
|
|
133
|
+
plan.moved = true;
|
|
134
|
+
}
|
|
135
|
+
if (plan.stage) {
|
|
136
|
+
renameSync(plan.stage, plan.target);
|
|
137
|
+
plan.stage = null;
|
|
138
|
+
plan.installed = true;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
committed = true;
|
|
142
|
+
} catch (error) {
|
|
143
|
+
const failures = [];
|
|
144
|
+
for (const plan of [...plans].reverse()) {
|
|
145
|
+
try {
|
|
146
|
+
if (plan.installed) rmSync(plan.target, { recursive: true });
|
|
147
|
+
if (plan.moved) { renameSync(plan.backup, plan.target); plan.moved = false; }
|
|
148
|
+
} catch (rollbackError) { failures.push(`${plan.target}: ${rollbackError.message}; backup: ${plan.backup}`); }
|
|
149
|
+
}
|
|
150
|
+
if (failures.length) error.message += `\nRollback needs attention:\n${failures.join('\n')}`;
|
|
151
|
+
throw error;
|
|
152
|
+
} finally {
|
|
153
|
+
for (const plan of plans) {
|
|
154
|
+
if (plan.stage) rmSync(plan.stage, { recursive: true, force: true });
|
|
155
|
+
// Preserve a backup if rollback failed; it may be the only remaining copy.
|
|
156
|
+
if (plan.backupRoot && (committed || !plan.moved)) rmSync(plan.backupRoot, { recursive: true, force: true });
|
|
157
|
+
}
|
|
158
|
+
for (const lock of locked) rmSync(lock, { recursive: true, force: true });
|
|
159
|
+
}
|
|
160
|
+
return plans.map(({ agent, target, owned }) => ({ agent, target,
|
|
161
|
+
message: action === 'uninstall' ? (owned ? 'Removed' : 'Not installed') : `Installed v${metadata.version}` }));
|
|
162
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@testmuai/rook-skill",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Install the Rook agent-testing skill for Claude Code, Codex and Gemini CLI",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"rook-skill": "./cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"cli.js",
|
|
11
|
+
"lib",
|
|
12
|
+
"skills",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "node --test test/*.test.mjs"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22"
|
|
20
|
+
},
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"homepage": "https://github.com/LambdaTest/rook",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/LambdaTest/rook.git",
|
|
26
|
+
"directory": "skill-installer"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"rook",
|
|
33
|
+
"agent-skills",
|
|
34
|
+
"agent-testing",
|
|
35
|
+
"claude-code",
|
|
36
|
+
"codex",
|
|
37
|
+
"gemini-cli"
|
|
38
|
+
]
|
|
39
|
+
}
|
package/skills/SKILL.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rook
|
|
3
|
+
license: Apache-2.0
|
|
4
|
+
compatibility: Live testing requires the Rook CLI, network access and a TestMu AI account; CI examples require bash and jq.
|
|
5
|
+
description: Use rook to test, evaluate, red-team or regression-check an AI agent the user owns, or to interpret saved Rook results. Does not apply to ordinary unit tests, browser automation or web UI checks without an AI agent under test.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Test agents with Rook
|
|
9
|
+
|
|
10
|
+
Use Rook to derive scenarios, invoke the target and grade the evidence. Respect
|
|
11
|
+
requests to use another tool. For saved-result requests, read the supplied files
|
|
12
|
+
without starting setup, a new run or paid analysis.
|
|
13
|
+
|
|
14
|
+
## Setup and execution
|
|
15
|
+
|
|
16
|
+
Check `rook --version` and use `rook help <command>` for the installed CLI's
|
|
17
|
+
options. If Rook is missing, use the
|
|
18
|
+
[installation instructions](https://github.com/LambdaTest/rook#install).
|
|
19
|
+
Use this workflow across compatible releases; a different version alone is not
|
|
20
|
+
a reason to stop or change the installation. If a command or output differs,
|
|
21
|
+
consult its help and release notes before adapting that step. Keep completion
|
|
22
|
+
and evidence checks intact; do not guess missing fields or retry paid work to
|
|
23
|
+
probe compatibility. Installation changes still require authorization.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
rook doctor
|
|
27
|
+
rook status --json
|
|
28
|
+
rook plan --json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Use the next command needed by the current state:
|
|
32
|
+
|
|
33
|
+
| Need | Command |
|
|
34
|
+
| --- | --- |
|
|
35
|
+
| Sign in | `rook login`, or `rook login --username <u> --access-key <k>` for CI |
|
|
36
|
+
| Select a project | `rook project use <id>` or `rook project create <name>` |
|
|
37
|
+
| Discover agents | `rook explore . --json` |
|
|
38
|
+
| Select an agent | `rook agent use <id>` |
|
|
39
|
+
| Generate scenarios | `rook generate --json` |
|
|
40
|
+
| Create/test a profile | `rook profile add <name> --from <file>` or `--command '<argv>'`; then `rook profile test --goal "<reply-only goal>"` |
|
|
41
|
+
| Run | `rook sync --yes` before `rook run --json`, or `rook run --test --json` for a local result |
|
|
42
|
+
| Read results | `rook report <run-id> --json` |
|
|
43
|
+
|
|
44
|
+
Choose the profile's transport and command from the target's source or the
|
|
45
|
+
user's invocation details; ask when unknown. See [profiles](references/profiles.md).
|
|
46
|
+
Use `rook help <command>` for flags and [scenarios](references/scenarios.md) to
|
|
47
|
+
scope a run with `--only`, classes, categories or tags.
|
|
48
|
+
|
|
49
|
+
## Authorization and credits
|
|
50
|
+
|
|
51
|
+
Before `profile add`, `profile fix`, `profile test` or `run`, inspect the target's
|
|
52
|
+
`agent.yaml` for `calls[]` entries with `write: true`. Those commands can reach
|
|
53
|
+
the real agent. Use staging and obtain any missing authorization for its effects;
|
|
54
|
+
Rook cannot undo them; do not rely on a per-target headless confirmation.
|
|
55
|
+
Verify effects through read-only interfaces; inspect available read tools before
|
|
56
|
+
concluding that an effect is unverifiable. Keep secrets as `${VAR}` references through
|
|
57
|
+
`rook env set`, outside profiles and transcripts.
|
|
58
|
+
|
|
59
|
+
Announce spending before `explore`, `generate`, `run`, `profile add|fix`, `ask`
|
|
60
|
+
and `report --rca`. `profile test` invokes the target without Rook model credits.
|
|
61
|
+
Use paid RCA only with user authorization. Track the user's budget across
|
|
62
|
+
commands; do not assume the CLI enforces an aggregate task cap. Check its help
|
|
63
|
+
for available limits. A null balance means unknown.
|
|
64
|
+
Prefer scoped `--allow` grants; use `--yes` only within the authorized scope.
|
|
65
|
+
See [headless contracts](references/headless-contract.md) for output, grants and
|
|
66
|
+
credit accounting.
|
|
67
|
+
|
|
68
|
+
## Report the evidence
|
|
69
|
+
|
|
70
|
+
Check the exit status and `discarded`/`halted` fields before claiming completion.
|
|
71
|
+
A finished run exits 0 even when scenarios fail; `ok: true` can also describe a
|
|
72
|
+
refused run. Parse JSON only when a document exists, otherwise use stderr.
|
|
73
|
+
Read the report by this invocation's run ID, not an old default report.
|
|
74
|
+
|
|
75
|
+
Follow [verdicts](references/verdicts.md): show **Pass**, **Fail** and **Unable to
|
|
76
|
+
Verify** separately, quote criterion evidence, identify gaps and compare prior
|
|
77
|
+
runs only when their evidence is available. Preserve incomplete results and
|
|
78
|
+
unknown metadata; do not invent evidence or replace Rook's verdict with your
|
|
79
|
+
own reading of the agent reply.
|
|
80
|
+
|
|
81
|
+
## References
|
|
82
|
+
|
|
83
|
+
- [CI](references/ci.md): complete pipeline and verdict gating.
|
|
84
|
+
- [MCP](references/mcp.md): server discovery, approval and configuration.
|
|
85
|
+
- [Troubleshooting](references/troubleshooting.md): setup failures and version-specific verification limitations.
|
|
86
|
+
- [Headless contracts](references/headless-contract.md): JSON shapes and saved-file locations.
|
|
87
|
+
|
|
88
|
+
Project evidence lives under `.testmuai/rook/`. Credentials and session state
|
|
89
|
+
live under `~/.testmuai/rook/`; do not commit that home directory.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# In CI
|
|
2
|
+
|
|
3
|
+
Requires bash, jq, the Rook CLI, a committed `.testmuai/rook/` tree containing
|
|
4
|
+
`ROOK_AGENT_ID` and a selected, configured profile. Supply the profile's declared
|
|
5
|
+
environment variables through CI secrets, alongside `LT_USERNAME`, `LT_ACCESS_KEY`
|
|
6
|
+
and `ROOK_PROJECT_ID`. Set `GITHUB_RUN_ID` to a job label outside GitHub Actions.
|
|
7
|
+
A person must review the target, its real writes, credit spend and tool grants
|
|
8
|
+
before enabling this workflow. Install the CLI before this recipe; pin its
|
|
9
|
+
version in your own CI for reproducibility. Compatibility is checked through required output fields, not
|
|
10
|
+
an exact version string. Recheck changed commands with `rook help <command>`.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
set -euo pipefail
|
|
14
|
+
printf 'Rook CLI: %s\n' "$(rook --version)" >&2
|
|
15
|
+
rook login --username "$LT_USERNAME" --access-key "$LT_ACCESS_KEY"
|
|
16
|
+
rook project use "$ROOK_PROJECT_ID"
|
|
17
|
+
rook agent use "$ROOK_AGENT_ID"
|
|
18
|
+
rook explore . --yes
|
|
19
|
+
rook generate --yes --json
|
|
20
|
+
# A committed tree is not an upstream record. Publish the profile/scenarios first.
|
|
21
|
+
rook sync --yes
|
|
22
|
+
run_code=0
|
|
23
|
+
rook run --concurrency 3 --name "ci-$GITHUB_RUN_ID" --yes --json > run.json || run_code=$?
|
|
24
|
+
if [ "$run_code" -ne 0 ]; then
|
|
25
|
+
jq -r '.error // .reason // "rook failed; inspect stderr"' run.json >&2 || true
|
|
26
|
+
echo "rook run exited $run_code; inspect stderr if no diagnostic was returned" >&2
|
|
27
|
+
exit "$run_code"
|
|
28
|
+
fi
|
|
29
|
+
# A declined or interrupted run can exit 0; neither is a completed suite.
|
|
30
|
+
jq -e '.ok == true and .discarded == null and .halted == false
|
|
31
|
+
and (.run_id | type == "string" and length > 0)
|
|
32
|
+
and (.report | type == "object") and (.credits | type == "number")' run.json >/dev/null
|
|
33
|
+
run_id=$(jq -er '.run_id' run.json)
|
|
34
|
+
rook report "$run_id" --json > report.json
|
|
35
|
+
# Missing/malformed counts or a mismatched report must not become a green build.
|
|
36
|
+
jq -e --arg id "$run_id" '.run_id == $id and .report.run_id == $id
|
|
37
|
+
and (.dir | type == "string" and length > 0)
|
|
38
|
+
and (.report.totals | [.planned, .executed, .passed, .failed, .unverifiable,
|
|
39
|
+
.unjudged, .not_run, .unrunnable] | all(.[]; type == "number" and . >= 0 and floor == .))
|
|
40
|
+
and (.report.totals | .planned == (.executed + .not_run)
|
|
41
|
+
and .executed == (.passed + .failed + .unverifiable + .unjudged))
|
|
42
|
+
and (.report.clusters | type == "array")' report.json >/dev/null
|
|
43
|
+
jq -r '.report.totals | "Pass: \(.passed) · Fail: \(.failed) · Unable to Verify: \(.unverifiable)",
|
|
44
|
+
"Unjudged: \(.unjudged) · Not run: \(.not_run) · Unrunnable: \(.unrunnable)"' report.json
|
|
45
|
+
jq -r '"Total credits: \(.credits)"' run.json
|
|
46
|
+
jq -r '"Evidence: \(.dir)/", (.report.clusters[] |
|
|
47
|
+
"\(.kind): \(.why) [\([.scenarios[].scenario_id] | join(", "))]")' report.json
|
|
48
|
+
jq -e '.report.totals.failed == 0 and .report.totals.unjudged == 0
|
|
49
|
+
and .report.totals.not_run == 0 and .report.totals.executed > 0
|
|
50
|
+
and ([.report.clusters[] | select(.kind == "compromised")] | length == 0)' report.json >/dev/null
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Gate on both command completion and verdicts: a finished run exits 0 even when
|
|
54
|
+
scenarios failed. A refused run can exit 1 with `ok: true, discarded: "refused"`;
|
|
55
|
+
its diagnostic is `reason`. Read the report by the ID from this invocation,
|
|
56
|
+
never by the default “latest” after an error. An interrupted run retains evidence
|
|
57
|
+
worth reading but is not a completed suite.
|
|
58
|
+
|
|
59
|
+
Fail the job on any Fail or compromised scenario, command error, or incomplete
|
|
60
|
+
run. Do not fail on Unable to Verify alone; print its count and reasons. For
|
|
61
|
+
per-criterion evidence, read the verdicts under the returned run directory as
|
|
62
|
+
shown in `verdicts.md`. Unrunnable scenarios are printed as an assurance gap;
|
|
63
|
+
this recipe does not fail on that gap alone. Optional summary fields are not
|
|
64
|
+
required for the gate.
|
|
65
|
+
|
|
66
|
+
`rook sync --yes` records the scenarios/profile upstream. If the requested CI
|
|
67
|
+
result should remain local instead, omit sync and use `rook run --test` with the
|
|
68
|
+
same flags and result checks. Do not silently switch between these policies.
|
|
69
|
+
|
|
70
|
+
Cache the project `.testmuai/rook/` for history and comparisons. Never cache or
|
|
71
|
+
commit `~/.testmuai/rook/`. `--yes` supplies broad command-scoped tool consent;
|
|
72
|
+
existing deny policy still applies. Rook uses headless mode when stdin is not a
|
|
73
|
+
TTY or a supported CI environment variable is set.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Headless output contracts
|
|
2
|
+
|
|
3
|
+
Use `rook help <command>` for installed command flags. The shapes below describe
|
|
4
|
+
the outputs used by this workflow. Validate required fields in actual responses;
|
|
5
|
+
if they differ, consult the installed CLI's documentation before adapting the
|
|
6
|
+
parser. Extra fields need not block a run; missing completion or verdict fields
|
|
7
|
+
must not be treated as success.
|
|
8
|
+
|
|
9
|
+
## Completion and output
|
|
10
|
+
|
|
11
|
+
Exit 0 means command completion, including a finished run with failed scenarios.
|
|
12
|
+
Exit 1 covers failures; there are no separate authorization/budget exit codes.
|
|
13
|
+
Check run verdicts as well as command status.
|
|
14
|
+
|
|
15
|
+
Commands that emit JSON write one document to stdout and prose to stderr.
|
|
16
|
+
`--verbose` writes text events to stderr, not a machine-readable event stream.
|
|
17
|
+
|
|
18
|
+
| Command with `--json` | Output |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| `plan` | `{ username, user_id, org_name, org_id, subscription, credits }`; null credits means the balance could not be read |
|
|
21
|
+
| `run` | `{ ok, error?, run_id?, halted, reason?, discarded?, unrunnable?, flag_problems?, credits, report? }` |
|
|
22
|
+
| `report` | `{ run_id, name?, dir, report }`; `dir` is the evidence folder |
|
|
23
|
+
| `scenarios list` | `{ agent_id, profile_id, total, runnable, scenarios: [{ scenario_id, title, feature_id, class, category?, state, excluded, unrunnable, multi_turn, repeat, criteria }] }` |
|
|
24
|
+
| `scenarios exclude/include/delete` | `{ ok: true, verb, ... }` |
|
|
25
|
+
| `status` | `{ project_id, offline, agents: [{ local_id, name, tree, offline, features, scenarios, profiles, unfinished_runs, owed_runs }], runs? }` |
|
|
26
|
+
| `mcp list` | `{ errors, servers: [{ name, origin, transport, state, source, changed_since_approval, shadowed_by }] }` |
|
|
27
|
+
| Other `mcp` operations | `{ ok, lines: string[] }`, with configuration inside `lines` |
|
|
28
|
+
| `ask` | `{ answer, command?, blocked_by?, summary? }`; the suggested command is not executed |
|
|
29
|
+
| `update auto` | `{ ok, pinned }`; changes the update-notice preference |
|
|
30
|
+
|
|
31
|
+
`status.agents[].tree` is `unsynced`, `clean`, `ahead`, `diverged`, `behind` or
|
|
32
|
+
`unknown`. Unknown means offline, not clean.
|
|
33
|
+
|
|
34
|
+
Some releases emit text despite accepting `--json` on `explore`, `generate`,
|
|
35
|
+
`sync`, `profile add/fix/test`, `report --rca` and `update` without `auto`.
|
|
36
|
+
Check for a JSON document before parsing; otherwise inspect exit status and
|
|
37
|
+
saved files. After authorized RCA, use `rook report <run-id> --json` to read the result.
|
|
38
|
+
`rook update` may replace the CLI; check its version afterward.
|
|
39
|
+
|
|
40
|
+
## Errors and partial runs
|
|
41
|
+
|
|
42
|
+
An error document can contain `{ "ok": false, "error": "...", "remedy": "..." }`.
|
|
43
|
+
Use `error`, or `reason` when present. Translate remedy tokens with
|
|
44
|
+
[troubleshooting](troubleshooting.md).
|
|
45
|
+
|
|
46
|
+
- `discarded: "refused"` can accompany `ok: true` and exit 1. Nothing ran.
|
|
47
|
+
- `discarded: "declined"` can exit 0 without a run.
|
|
48
|
+
- `halted: true` can retain a report and exit 0. Present it as incomplete.
|
|
49
|
+
- Gate refusals on `report`, `status` and `ask`, and parser errors, may leave
|
|
50
|
+
stdout empty. Use the stderr diagnostic rather than inventing an error object.
|
|
51
|
+
|
|
52
|
+
## Grants and accounting
|
|
53
|
+
|
|
54
|
+
`--allow 'bash(npm test)'` grants one call shape; repeat it for more grants or use
|
|
55
|
+
`'bash(git *)@explore'` to scope a grant to one phase. `--yes` grants broadly for
|
|
56
|
+
that command without changing stored settings. Existing deny policy still applies.
|
|
57
|
+
Stored/session grants can authorize calls even when neither flag is present;
|
|
58
|
+
omitting flags is not a read-only guarantee.
|
|
59
|
+
|
|
60
|
+
Record reported spend when available. `profile add` may print no total. A change
|
|
61
|
+
in `rook plan --json` balance reflects the whole account, possibly including
|
|
62
|
+
other activity. Keep it distinct from a command receipt, and retain both figures
|
|
63
|
+
when they differ without inventing a billing explanation. A free command can
|
|
64
|
+
still use the network, change state or invoke the target.
|
|
65
|
+
|
|
66
|
+
## On disk
|
|
67
|
+
|
|
68
|
+
`.testmuai/rook/settings.json` selects the project. Under
|
|
69
|
+
`.testmuai/rook/projects/<project-id>/agents/<agent-id>/`:
|
|
70
|
+
|
|
71
|
+
| Path | Contents |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| `agent.yaml`, `features/`, `findings.yaml` | Agent specification, capabilities and findings |
|
|
74
|
+
| `profiles/`, `scenarios/` | Invocation profiles and current scenarios |
|
|
75
|
+
| `runs/<run-id>/run.yaml` | Run manifest and pinned profile revision |
|
|
76
|
+
| `runs/<run-id>/` | Snapshots: `agent.yaml`, `features.yaml`, `profile.yaml` |
|
|
77
|
+
| `runs/<run-id>/report.yaml` | Report returned by `report --json` |
|
|
78
|
+
| `runs/<run-id>/scenarios/<scenario-id>/` | `snapshot.yaml`, `request.json`, `response.json`, artifacts and `verdict.yaml` |
|
|
79
|
+
|
|
80
|
+
Home state at `~/.testmuai/rook/` includes credentials, grants and session
|
|
81
|
+
transcripts. Keep it outside commits and shared evidence.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# MCP servers
|
|
2
|
+
|
|
3
|
+
Servers rook itself, and the agents under test, may reach. Flags mirror
|
|
4
|
+
`claude mcp`.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
rook mcp list --json
|
|
8
|
+
rook mcp get <name> --json
|
|
9
|
+
rook mcp add <name> -- <command> [args...]
|
|
10
|
+
rook mcp add <name> -t http --url https://host/mcp -H 'Authorization: Bearer ${TOKEN}'
|
|
11
|
+
rook mcp add <name> -s project -e KEY=VALUE -- <command>
|
|
12
|
+
rook mcp remove <name> -s project
|
|
13
|
+
rook mcp enable <name>
|
|
14
|
+
rook mcp disable <name>
|
|
15
|
+
rook mcp approve <name> --origin discovered
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Scopes: `user`, `project`, `local` (default). `project` scope is
|
|
19
|
+
`.testmuai/rook/mcp.json`, a file rook itself writes — a different thing from
|
|
20
|
+
a server `explore` finds already declared in the target. `approve` trusts a
|
|
21
|
+
`project` or `discovered` server after rook has read what it runs; those are
|
|
22
|
+
the only two origins that wait for it. A `user` or `local` server is used as
|
|
23
|
+
declared, with no approval step.
|
|
24
|
+
|
|
25
|
+
When `explore` finds `.mcp.json` in the target, those servers appear with
|
|
26
|
+
origin `discovered` and need `approve` before a scenario can exercise them.
|
|
27
|
+
Values stay `${VAR}` references in `get` output.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Profiles: how rook reaches the agent
|
|
2
|
+
|
|
3
|
+
A profile is a script rook wrote plus the environment-variable names it
|
|
4
|
+
needs. The `execute` hook receives the goal on stdin and returns one JSON
|
|
5
|
+
object with a nonempty `agent_reply`. Values live in `rook env`, referenced
|
|
6
|
+
as `${VAR}`, so a profile is safe to commit.
|
|
7
|
+
|
|
8
|
+
Three kinds of target:
|
|
9
|
+
|
|
10
|
+
| Kind | Give rook | Example |
|
|
11
|
+
| ------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------- |
|
|
12
|
+
| HTTP | a curl | `curl http://127.0.0.1:9110/v1/triage -H 'content-type: application/json' -d '{"input":"look at T-1043"}'` |
|
|
13
|
+
| command | a command line with `{{goal}}` | `claude -p "{{goal}}"` |
|
|
14
|
+
| MCP | a tool on a declared server | see `mcp.md` |
|
|
15
|
+
|
|
16
|
+
## Authoring headlessly
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
printf '%s\n' "curl http://127.0.0.1:9110/v1/triage -H 'content-type: application/json' -d '{\"input\":\"{{goal}}\"}'" > /tmp/profile.txt
|
|
20
|
+
rook profile add triage-http --from /tmp/profile.txt --yes
|
|
21
|
+
rook profile add refund-cli --command 'claude -p "{{goal}}"' --yes
|
|
22
|
+
rook profile test --goal "Say hello and nothing else."
|
|
23
|
+
rook profile use <id>
|
|
24
|
+
rook profile show <id>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`profile add` writes the script, runs it once against the agent (the goal is
|
|
28
|
+
"Say hello and nothing else."), and corrects it. It is costed,
|
|
29
|
+
may emit text despite `--json`, and uses `--yes` (or `--allow` rules) to
|
|
30
|
+
run its own test call without a prompt. With neither `--from` nor
|
|
31
|
+
`--command`, it reads the material from stdin.
|
|
32
|
+
|
|
33
|
+
`profile test` calls the agent once with `--goal` and says what came back.
|
|
34
|
+
Run it before the first `rook run` and after any change to the agent's URL,
|
|
35
|
+
auth, or command. The call is real: read `agent.yaml` for `write: true` calls
|
|
36
|
+
before it, as before a run, and give it a goal that asks for nothing but a
|
|
37
|
+
reply.
|
|
38
|
+
|
|
39
|
+
`profile fix [id] --what "<what is wrong>"` diagnoses and repairs; without
|
|
40
|
+
`--what` it runs the profile and finds out.
|
|
41
|
+
|
|
42
|
+
## Secrets
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
rook env set '{"API_KEY":"…","BASE_URL":"https://staging.example.com"}'
|
|
46
|
+
rook env list # masked
|
|
47
|
+
rook env show API_KEY
|
|
48
|
+
rook env rm API_KEY
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Never paste a value into a profile, a scenario, a transcript, or a commit.
|
|
52
|
+
Reference it as `${API_KEY}` and set it with `rook env set`.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Scenarios
|
|
2
|
+
|
|
3
|
+
## Classes and categories
|
|
4
|
+
|
|
5
|
+
`--class` takes `functional`, `non_functional`, `adversarial` (comma-separated;
|
|
6
|
+
`generate` defaults to `functional,adversarial`).
|
|
7
|
+
|
|
8
|
+
`--category` takes, comma-separated:
|
|
9
|
+
|
|
10
|
+
| Class | Categories |
|
|
11
|
+
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
12
|
+
| functional | `happy_path`, `negative`, `boundary`, `integration`, `state_context` |
|
|
13
|
+
| non_functional | `performance`, `token_economy`, `reliability`, `quality` |
|
|
14
|
+
| adversarial | `prompt_injection`, `jailbreak`, `data_exfiltration`, `pii_leakage`, `harmful_content`, `hallucination`, `hijacking`, `policy_violation` |
|
|
15
|
+
|
|
16
|
+
`technical_injection` is a valid `--category` value.
|
|
17
|
+
|
|
18
|
+
Every scenario also carries free-form tags; `run --tag <names>` selects on them.
|
|
19
|
+
|
|
20
|
+
## Generating
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
rook generate --json # functional + adversarial, rook picks the count
|
|
24
|
+
rook generate --total 20 --class functional --json
|
|
25
|
+
rook generate --category prompt_injection,jailbreak --json
|
|
26
|
+
rook generate -- focus on the refund limits and the identity check
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`generate` derives scenarios per feature and pins them; a second `generate`
|
|
30
|
+
only refreshes features whose pins are stale. `--force` re-derives everything.
|
|
31
|
+
It may emit text despite `--json`; check the exit code, then read
|
|
32
|
+
`rook scenarios list --json`.
|
|
33
|
+
|
|
34
|
+
## Listing and curating
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
rook scenarios list --json
|
|
38
|
+
rook scenarios exclude SC-004 SC-009 --json # kept on disk, left out of runs
|
|
39
|
+
rook scenarios include SC-004 --json
|
|
40
|
+
rook scenarios delete SC-021 --json # permanent
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
IDs are separate arguments here, unlike `run --only SC-004,SC-009`. A
|
|
44
|
+
comma-joined string is one unknown ID: nothing changes, and the document still
|
|
45
|
+
says `ok: true` with the string under `unknown`. Check `changed` in the reply.
|
|
46
|
+
|
|
47
|
+
`list` recomputes `unrunnable` against the profile as it is now: a scenario
|
|
48
|
+
that needs a capability the profile lacks (a file, an image, an MCP server)
|
|
49
|
+
says so and is skipped by `run`, and counts toward the assurance gap, not
|
|
50
|
+
toward Fail.
|
|
51
|
+
|
|
52
|
+
## Scoping a run
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
rook run --only SC-001,SC-002 --json
|
|
56
|
+
rook run --class adversarial --json
|
|
57
|
+
rook run --category pii_leakage --tag refunds --json
|
|
58
|
+
rook run --concurrency 3 --name "pre-release" --json
|
|
59
|
+
rook run --test --json # against the tree as it is; kept out of the timeline
|
|
60
|
+
rook run --phases prepare,open,execute,close --json # run the agent now
|
|
61
|
+
rook run --run <id> --phases collect,judge --json # collect evidence that lands later, judge then
|
|
62
|
+
rook run --resume <id> --json # carry finished work into a new run
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`--only` takes one comma-separated argument; repeating the flag keeps only
|
|
66
|
+
the last occurrence, and a space-separated second id is read as instruction
|
|
67
|
+
text.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
Start with the environment, it is free and safe:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
rook doctor
|
|
7
|
+
rook auth status
|
|
8
|
+
rook plan --json
|
|
9
|
+
rook status --json
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`doctor` prints version, node, workspace, environment, controller and api
|
|
13
|
+
reachability, identity, auth state, project, mode (`headless` or `tui`),
|
|
14
|
+
tty, and state.
|
|
15
|
+
|
|
16
|
+
## Failure documents
|
|
17
|
+
|
|
18
|
+
Parse stdout only when it contains JSON. A refused run can exit 1 with
|
|
19
|
+
`ok: true, discarded: "refused"`: use `reason`, not a missing `error` field.
|
|
20
|
+
Gate refusals on `report`, `status` and `ask`, and parser errors, may have no
|
|
21
|
+
JSON document; use the stderr diagnostic. Do not infer successful execution
|
|
22
|
+
from `ok: true` or from an old report on disk.
|
|
23
|
+
|
|
24
|
+
| `error` says | Do |
|
|
25
|
+
| ------------------------ | ----------------------------------------------------------------------------------------------- |
|
|
26
|
+
| `remedy: login` | you are not signed in — `rook login`; in CI, `rook login --username <u> --access-key <k>` |
|
|
27
|
+
| `remedy: new_session` | that session has been used up — run the command again |
|
|
28
|
+
| `remedy: retry` | could not reach rook-api — it may be down, or the network; wait and try again, or `rook doctor` |
|
|
29
|
+
| `remedy: request_access` | you do not have access to this project — ask the org admin for access |
|
|
30
|
+
| `remedy: create_project` | this org has no projects yet — `rook project create <name>` |
|
|
31
|
+
| `remedy: pick_project` | no project selected — `rook project use <id>` |
|
|
32
|
+
| `remedy: agent_missing` | the active agent is gone — `rook agent use <id>` |
|
|
33
|
+
| `remedy: explore_agents` | no agents registered — `rook explore` |
|
|
34
|
+
| `remedy: pick_agent` | no agent selected — `rook agent use <id>` |
|
|
35
|
+
| `remedy: topup` | you are out of credits — check `rook plan` and add credits |
|
|
36
|
+
| `remedy: reconcile` | this agent has diverged from upstream — `rook sync` |
|
|
37
|
+
| `remedy: update` | this version is too old to be served — announce that `rook update` may install a newer version, then recheck skill compatibility |
|
|
38
|
+
| no active agent | `rook agent use <id>` after `rook explore` |
|
|
39
|
+
| no project selected | `rook project use <id>` or `rook project create <name>` |
|
|
40
|
+
| could not reach rook-api | check the network; `doctor` shows both endpoints |
|
|
41
|
+
|
|
42
|
+
## Discovery succeeds but registers no agents
|
|
43
|
+
|
|
44
|
+
An exit-zero `explore` with `0 analysed` does not establish that the target is
|
|
45
|
+
ready for generation. Check `rook status --json` and the saved agent tree.
|
|
46
|
+
Inspect whether the source was indexed and whether it contains the agent or
|
|
47
|
+
only a deterministic simulator. When the source supports it and the user's
|
|
48
|
+
scope/budget permits, retry once on the relevant file or directory with a
|
|
49
|
+
truthful description of the target; `--force` re-derives cached analysis.
|
|
50
|
+
Do not claim a simulator has an LLM backend, manufacture a declaration to hide
|
|
51
|
+
the discovery gap, or keep repeating paid discovery without new evidence.
|
|
52
|
+
|
|
53
|
+
## Unable to Verify everywhere
|
|
54
|
+
|
|
55
|
+
`unverifiable_reason: agent_never_ran` on every scenario means the profile
|
|
56
|
+
does not reach the agent. `rook profile test --goal "hello"` shows the raw
|
|
57
|
+
exchange; `rook profile fix` repairs it. `not_observable` means the criteria
|
|
58
|
+
are about something rook cannot see (a tool call the agent made off-record,
|
|
59
|
+
an image); that is a gap to report, not a failure to fix.
|
|
60
|
+
|
|
61
|
+
Inspect the saved raw response and hook records before concluding that the
|
|
62
|
+
target omitted evidence. Two limitations observed in 0.1.1 can hide evidence already saved:
|
|
63
|
+
an explicitly empty execute `calls` array is omitted from the hook record, and
|
|
64
|
+
`json_path` checks do not decode a JSON string in `raw_response` before traversing
|
|
65
|
+
it. A recorded `calls: []` or a field visible inside that string therefore does
|
|
66
|
+
not guarantee a conclusive check. Report the limitation and retain the verdict;
|
|
67
|
+
do not invent calls or change scenario criteria just to obtain a pass. On another
|
|
68
|
+
release, verify whether the limitation still applies before attributing the gap
|
|
69
|
+
to it.
|
|
70
|
+
|
|
71
|
+
## A verdict you disagree with
|
|
72
|
+
|
|
73
|
+
Quote the criterion and the evidence it cited, and open an issue with the
|
|
74
|
+
repo's "verdict dispute" template. Those are the most useful reports rook
|
|
75
|
+
gets.
|
|
76
|
+
|
|
77
|
+
## Bug reports
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
rook export logs --out ./rook-logs
|
|
81
|
+
rook export logs --out ./rook-logs.zip --all-sessions
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Include `rook --version`, the OS, and the scenario and run ids. Never paste a
|
|
85
|
+
transcript, a credential, or the contents of `~/.testmuai/rook/`.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Verdicts and reporting
|
|
2
|
+
|
|
3
|
+
Read `report` from `rook run --json` or `rook report <run-id> --json`. For
|
|
4
|
+
criterion details, read `runs/<run-id>/scenarios/<scenario-id>/verdict.yaml`.
|
|
5
|
+
|
|
6
|
+
## Fields needed for a summary
|
|
7
|
+
|
|
8
|
+
| Record | Fields |
|
|
9
|
+
| --- | --- |
|
|
10
|
+
| Scenario verdict | `scenario_id`, `status`, `criteria[]`, `unverifiable_reason`, `compromised`, `forbidden_hits[]` |
|
|
11
|
+
| Criterion | `criterion_id`, `criterion`, `expected`, `achieved`, `status`, quoted `evidence`, `confidence` |
|
|
12
|
+
| Report | `run_id`, `agent_id`, `agent_version_id?`, `generated`, `headline`, optional `narrative` and `next[]`, `totals`, `metrics`, `clusters[]`, `credits` |
|
|
13
|
+
| Totals | `planned`, `executed`, `passed`, `failed`, `unverifiable`, `unjudged`, `not_run`, `unrunnable`, `decided`, `pass_rate`, `carried_forward` |
|
|
14
|
+
| Cluster | `id`, `why`, `kind` (`failed`, `unverifiable`, `compromised`), `scenarios[]`; RCA may add `cause`, `remedy`, `confidence`, `fault`, `where`, `summary` |
|
|
15
|
+
|
|
16
|
+
Statuses are **Pass**, **Fail**, and **Unable to Verify**. Unverifiable reasons:
|
|
17
|
+
`agent_never_ran`, `not_observable`, or `undecidable`. A scenario that never ran
|
|
18
|
+
has no verdict; do not turn its absence into a failure.
|
|
19
|
+
|
|
20
|
+
## Presenting results
|
|
21
|
+
|
|
22
|
+
Use a table like this, populated from the records:
|
|
23
|
+
|
|
24
|
+
| Field | Result |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| Agent / run | Name, agent ID and run ID |
|
|
27
|
+
| Scope | Planned/executed counts; incomplete, unjudged and not-run work |
|
|
28
|
+
| Pass / Fail / Unable to Verify | Separate counts, with reasons for unverifiables |
|
|
29
|
+
| Compromised | Observed adversarial compromises; unknown when evidence is absent |
|
|
30
|
+
| Credits | Total command spend when supplied |
|
|
31
|
+
| Evidence | The returned `dir`, or state that no directory was supplied |
|
|
32
|
+
|
|
33
|
+
For each failed or compromised scenario, include its ID/title, criterion,
|
|
34
|
+
expected versus achieved result and an evidence quote. Group unverifiables by
|
|
35
|
+
reason and explain what observation would make them checkable. Distinguish a
|
|
36
|
+
recorded verdict from a suspected problem in its criterion or verification.
|
|
37
|
+
|
|
38
|
+
Report a refused/declined invocation as no run and a halted invocation as
|
|
39
|
+
incomplete. Preserve recorded planned/executed counts; a halt does not prove
|
|
40
|
+
that scenarios were skipped. Read `error` or `reason`, translate a supplied
|
|
41
|
+
`remedy`, and use stderr when there is no JSON error document.
|
|
42
|
+
|
|
43
|
+
Use only supplied metadata. Missing summary/RCA fields do not establish which
|
|
44
|
+
flags or roles ran. An empty compromised cluster list does not establish that
|
|
45
|
+
no adversarial scenarios ran. Identify missing criterion evidence instead of
|
|
46
|
+
inventing quotes; label any example path as unverified.
|
|
47
|
+
|
|
48
|
+
## Credits and comparisons
|
|
49
|
+
|
|
50
|
+
Top-level `credits` from `run --json` includes report generation.
|
|
51
|
+
`report.metrics.credits` covers execution/judging, while `report.credits` covers
|
|
52
|
+
that report's generation. If only a saved report is available, show those two
|
|
53
|
+
amounts separately: later RCA can rewrite the report spend, so their sum is not
|
|
54
|
+
necessarily the command's cumulative billing history.
|
|
55
|
+
|
|
56
|
+
For comparisons, use each scenario's `snapshot.yaml` and verdicts from both
|
|
57
|
+
runs. Distinguish newly failing, fixed, flaky (flips on an unchanged scenario)
|
|
58
|
+
and redefined (scenario text changed). Find prior runs under the agent's `runs/`
|
|
59
|
+
folder or in `rook status --agent <id> --json`. Omit comparisons when the prior
|
|
60
|
+
evidence is unavailable.
|