@lifeaitools/rdc-skills 0.24.10 → 0.24.11
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/.claude-plugin/plugin.json +1 -1
- package/git-sha.json +1 -1
- package/hooks/foreground-process-gate.js +22 -3
- package/package.json +3 -1
- package/scripts/acceptance.mjs +471 -0
- package/scripts/lib/assertions.mjs +25 -2
- package/scripts/lib/manifest-schema.mjs +13 -0
- package/scripts/self-test.mjs +6 -4
- package/scripts/test-guide-validator.mjs +2 -0
- package/skills/channel-formatter/SKILL.md +56 -6
- package/skills/lifeai-brochure-author/SKILL.md +2 -0
- package/skills/rdc-brochurify/SKILL.md +2 -0
- package/skills/rdc-extract-verifier-rules/SKILL.md +2 -0
- package/skills/rpms-filemap/SKILL.cloud.md +4 -0
- package/skills/rpms-filemap/SKILL.md +4 -0
- package/skills/tests/README.md +5 -0
- package/skills/tests/rdc-channel-formatter.test.json +45 -0
- package/tests/acceptance.test.mjs +42 -0
- package/tests/harness-gates.test.mjs +32 -2
- package/tests/validate-skills.js +17 -173
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rdc",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.11",
|
|
4
4
|
"description": "RDC typed-agent dispatch skill suite for Claude Code — plan, build, review, overnight unattended builds with work-item tracking and TDD enforcement.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "LIFEAI",
|
package/git-sha.json
CHANGED
|
@@ -46,6 +46,24 @@ function hasHiddenIntent(command) {
|
|
|
46
46
|
/\bCI\s*=\s*(1|true)\b/i.test(command);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
function hasExplicitWindowOverride(command) {
|
|
50
|
+
return /\bRDC_ALLOW_WINDOW_FOCUS\s*=\s*(1|true)\b/i.test(command) ||
|
|
51
|
+
/\bRDC_INTERACTIVE_WINDOW\s*=\s*(1|true)\b/i.test(command);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function checkWindowFocusApi(command) {
|
|
55
|
+
if (hasExplicitWindowOverride(command)) return;
|
|
56
|
+
const focusApi = /\b(SetForegroundWindow|SwitchToThisWindow|AppActivate|SetWindowPos|ShowWindowAsync?|BringWindowToTop)\b/i;
|
|
57
|
+
const broadWindowApi = /\b(EnumWindows|Get-Process\s+\|\s*Where-Object|GetWindow|FindWindow)\b/i;
|
|
58
|
+
const windowMutation = /\b(minimi[sz]e|restore|foreground|focus|activate|collapse)\b/i;
|
|
59
|
+
if (focusApi.test(command) || (broadWindowApi.test(command) && windowMutation.test(command))) {
|
|
60
|
+
block(
|
|
61
|
+
'Window focus/restore/minimize/collapse operations are not allowed in agent-launched commands. Spawn helpers hidden/no-window instead; set RDC_ALLOW_WINDOW_FOCUS=1 only for an explicitly requested interactive recovery action.',
|
|
62
|
+
{ kind: 'window-focus-api' },
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
49
67
|
function checkPlaywright(command) {
|
|
50
68
|
if (!/\b(playwright|@playwright\/test)\b/i.test(command)) return;
|
|
51
69
|
|
|
@@ -68,16 +86,16 @@ function checkPowerShell(command) {
|
|
|
68
86
|
if (!/\bStart-Process\b/i.test(command)) return;
|
|
69
87
|
if (hasHiddenIntent(command)) return;
|
|
70
88
|
block(
|
|
71
|
-
'`Start-Process` must include `-WindowStyle Hidden` or `-WindowStyle Minimized` for agent-launched node/cmd/ps1/test processes.',
|
|
89
|
+
'`Start-Process` must include `-WindowStyle Hidden` or `-WindowStyle Minimized` for agent-launched node/cmd/ps1/test processes. Focus/restore/collapse APIs remain blocked unless explicitly requested.',
|
|
72
90
|
{ kind: 'start-process' },
|
|
73
91
|
);
|
|
74
92
|
}
|
|
75
93
|
|
|
76
94
|
function checkCmdStart(command) {
|
|
77
95
|
if (!/\bcmd(?:\.exe)?\s+\/c\s+start\b/i.test(command)) return;
|
|
78
|
-
if (/\bcmd(?:\.exe)?\s+\/c\s+start\s+(""|''|`"")?\s*\/
|
|
96
|
+
if (/\bcmd(?:\.exe)?\s+\/c\s+start\s+(""|''|`"")?\s*\/b\b/i.test(command)) return;
|
|
79
97
|
block(
|
|
80
|
-
'`cmd /c start` must use `/min` for
|
|
98
|
+
'`cmd /c start` must use `/min` or `/b` for background tools. Focus/restore/collapse APIs remain blocked unless explicitly requested.',
|
|
81
99
|
{ kind: 'cmd-start' },
|
|
82
100
|
);
|
|
83
101
|
}
|
|
@@ -98,6 +116,7 @@ async function main() {
|
|
|
98
116
|
const command = toolText(raw);
|
|
99
117
|
if (!command) pass({ reason: 'no-command' });
|
|
100
118
|
|
|
119
|
+
checkWindowFocusApi(command);
|
|
101
120
|
checkPlaywright(command);
|
|
102
121
|
checkPowerShell(command);
|
|
103
122
|
checkCmdStart(command);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifeaitools/rdc-skills",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.11",
|
|
4
4
|
"description": "RDC typed-agent dispatch skill suite for Claude Code - plan, build, review, overnight builds",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
@@ -35,6 +35,8 @@
|
|
|
35
35
|
"rdc-design": "node scripts/rdc-design-cli.mjs",
|
|
36
36
|
"test:hooks": "node scripts/test-rdc-hooks.mjs",
|
|
37
37
|
"test:truth-gate": "node tests/run-evidence-gate.test.mjs && node tests/work-item-exit-gate-l2.test.mjs && node tests/work-item-exit-gate-l3.test.mjs && node tests/require-work-item-on-commit.test.mjs && node tests/harness-gates.test.mjs",
|
|
38
|
+
"test:acceptance": "node tests/acceptance.test.mjs",
|
|
39
|
+
"acceptance": "node scripts/acceptance.mjs --changed",
|
|
38
40
|
"test:mcp": "node tests/mcp.test.mjs",
|
|
39
41
|
"test:mcp:remote": "node tests/mcp.test.mjs --remote",
|
|
40
42
|
"test:channel-formatter": "node tests/channel-formatter.contract.test.mjs",
|
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Build acceptance runner for touched rdc:* skills.
|
|
4
|
+
*
|
|
5
|
+
* Runs one sandboxed agent fixture per selected skill, records all observable
|
|
6
|
+
* engine events/tool calls to JSONL, verifies manifest assertions, and writes a
|
|
7
|
+
* Markdown report with lessons learned / next build optimizations.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { execFileSync } from 'node:child_process';
|
|
11
|
+
import { existsSync, mkdirSync, writeFileSync, appendFileSync } from 'node:fs';
|
|
12
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
14
|
+
|
|
15
|
+
import { loadAllManifests } from './lib/manifest-schema.mjs';
|
|
16
|
+
import { runManifest } from './lib/runner.mjs';
|
|
17
|
+
|
|
18
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const REPO_ROOT = resolve(__dirname, '..');
|
|
20
|
+
const REPORTS_DIR = join(REPO_ROOT, '.rdc', 'reports');
|
|
21
|
+
|
|
22
|
+
const args = process.argv.slice(2);
|
|
23
|
+
const arg = (name, fallback = null) => {
|
|
24
|
+
const i = args.indexOf(name);
|
|
25
|
+
return i >= 0 ? args[i + 1] || fallback : fallback;
|
|
26
|
+
};
|
|
27
|
+
const has = (name) => args.includes(name);
|
|
28
|
+
|
|
29
|
+
const ENGINE = arg('--engine', process.env.RDC_ACCEPTANCE_ENGINE || 'claude').toLowerCase();
|
|
30
|
+
const BASE = arg('--base', process.env.RDC_ACCEPTANCE_BASE || 'HEAD~1');
|
|
31
|
+
const PROJECT_CWD = resolve(arg('--project-root', process.env.REGEN_ROOT || process.cwd()));
|
|
32
|
+
const RUN_ID = arg('--run-id', `acceptance-${new Date().toISOString().replace(/[:.]/g, '-')}`);
|
|
33
|
+
const PARALLEL = Math.max(1, parseInt(arg('--parallel', '1'), 10) || 1);
|
|
34
|
+
const CHANGED = has('--changed');
|
|
35
|
+
const STRICT_RECORDING = has('--strict-recording');
|
|
36
|
+
const ONLY_SKILLS = args
|
|
37
|
+
.flatMap((v, i) => (v === '--skill' && args[i + 1] ? [args[i + 1]] : []))
|
|
38
|
+
.map(normalizeSkillName);
|
|
39
|
+
|
|
40
|
+
function normalizeSkillName(name) {
|
|
41
|
+
if (!name) return name;
|
|
42
|
+
return name.startsWith('rdc:') ? name : `rdc:${name.replace(/^rdc-/, '')}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function sh(cmd, cmdArgs, cwd = REPO_ROOT) {
|
|
46
|
+
return execFileSync(cmd, cmdArgs, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function changedFiles(base) {
|
|
50
|
+
try {
|
|
51
|
+
const mergeBase = sh('git', ['merge-base', base, 'HEAD']);
|
|
52
|
+
const out = sh('git', ['diff', '--name-only', `${mergeBase}..HEAD`]);
|
|
53
|
+
return out ? out.split(/\r?\n/).filter(Boolean) : [];
|
|
54
|
+
} catch {
|
|
55
|
+
const out = sh('git', ['diff', '--name-only', base]);
|
|
56
|
+
return out ? out.split(/\r?\n/).filter(Boolean) : [];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function skillFromPath(file) {
|
|
61
|
+
const p = file.replace(/\\/g, '/');
|
|
62
|
+
const m = p.match(/^skills\/([^/]+)\//);
|
|
63
|
+
if (!m || m[1] === 'tests') return null;
|
|
64
|
+
return `rdc:${m[1]}`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function touchedSkillsFromGit(base) {
|
|
68
|
+
const skills = new Set();
|
|
69
|
+
for (const file of changedFiles(base)) {
|
|
70
|
+
const skill = skillFromPath(file);
|
|
71
|
+
if (skill) skills.add(skill);
|
|
72
|
+
const test = file.replace(/\\/g, '/').match(/^skills\/tests\/rdc-(.+)\.test\.json$/);
|
|
73
|
+
if (test) skills.add(`rdc:${test[1]}`);
|
|
74
|
+
}
|
|
75
|
+
return [...skills].sort();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function parseJsonLines(text) {
|
|
79
|
+
const events = [];
|
|
80
|
+
for (const line of String(text || '').split(/\r?\n/)) {
|
|
81
|
+
const trimmed = line.trim();
|
|
82
|
+
if (!trimmed || !trimmed.startsWith('{')) continue;
|
|
83
|
+
try {
|
|
84
|
+
events.push(JSON.parse(trimmed));
|
|
85
|
+
} catch {
|
|
86
|
+
// Non-JSON output is still captured in stdout/stderr previews.
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return events;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function findToolName(value) {
|
|
93
|
+
if (!value || typeof value !== 'object') return null;
|
|
94
|
+
if (typeof value.name === 'string') return value.name;
|
|
95
|
+
if (typeof value.tool_name === 'string') return value.tool_name;
|
|
96
|
+
if (typeof value.tool === 'string') return value.tool;
|
|
97
|
+
if (typeof value.server_name === 'string' && typeof value.tool_name === 'string') {
|
|
98
|
+
return `${value.server_name}.${value.tool_name}`;
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function claudeToolCalls(stdout) {
|
|
104
|
+
const calls = [];
|
|
105
|
+
for (const event of parseJsonLines(stdout)) {
|
|
106
|
+
const type = event.type || event.event || event.kind || '';
|
|
107
|
+
const msg = event.message || event;
|
|
108
|
+
const content = Array.isArray(msg.content) ? msg.content : Array.isArray(event.content) ? event.content : [];
|
|
109
|
+
for (const item of content) {
|
|
110
|
+
if (item?.type === 'tool_use') {
|
|
111
|
+
calls.push({
|
|
112
|
+
engine: 'claude',
|
|
113
|
+
id: item.id || null,
|
|
114
|
+
name: item.name || null,
|
|
115
|
+
input: item.input || null,
|
|
116
|
+
raw_type: type || 'tool_use',
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (/tool/i.test(type)) {
|
|
121
|
+
const name = findToolName(event);
|
|
122
|
+
calls.push({
|
|
123
|
+
engine: 'claude',
|
|
124
|
+
id: event.id || event.tool_use_id || null,
|
|
125
|
+
name,
|
|
126
|
+
input: event.input || event.arguments || event.params || null,
|
|
127
|
+
raw_type: type,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return dedupeCalls(calls);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function assistantText(engine, stdout) {
|
|
135
|
+
if (engine !== 'claude') return String(stdout || '').trim();
|
|
136
|
+
const resultEvents = parseJsonLines(stdout).filter((event) => event.type === 'result' && typeof event.result === 'string');
|
|
137
|
+
if (resultEvents.length > 0) return resultEvents.at(-1).result.trim();
|
|
138
|
+
const chunks = [];
|
|
139
|
+
for (const event of parseJsonLines(stdout)) {
|
|
140
|
+
const msg = event.message || event;
|
|
141
|
+
const content = Array.isArray(msg.content) ? msg.content : Array.isArray(event.content) ? event.content : [];
|
|
142
|
+
for (const item of content) {
|
|
143
|
+
if (item?.type === 'text' && typeof item.text === 'string') chunks.push(item.text);
|
|
144
|
+
}
|
|
145
|
+
if (event.type === 'result' && typeof event.result === 'string') chunks.push(event.result);
|
|
146
|
+
}
|
|
147
|
+
return chunks.join('\n\n').trim();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function outputAssertionFailures(spec, rendered) {
|
|
151
|
+
const failures = [];
|
|
152
|
+
if (!spec || typeof spec !== 'object') return failures;
|
|
153
|
+
if (Array.isArray(spec.output_contains)) {
|
|
154
|
+
const missing = spec.output_contains.filter((s) => !rendered.includes(s));
|
|
155
|
+
if (missing.length > 0) {
|
|
156
|
+
failures.push({
|
|
157
|
+
predicate: 'acceptance.output_contains',
|
|
158
|
+
message: `missing output substrings: ${missing.map((s) => JSON.stringify(s)).join(', ')}`,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (Array.isArray(spec.output_not_contains)) {
|
|
163
|
+
const present = spec.output_not_contains.filter((s) => rendered.includes(s));
|
|
164
|
+
if (present.length > 0) {
|
|
165
|
+
failures.push({
|
|
166
|
+
predicate: 'acceptance.output_not_contains',
|
|
167
|
+
message: `forbidden output substrings present: ${present.map((s) => JSON.stringify(s)).join(', ')}`,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return failures;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function toolCallAssertionFailures(spec, toolCalls) {
|
|
175
|
+
const failures = [];
|
|
176
|
+
if (!spec || typeof spec !== 'object') return failures;
|
|
177
|
+
const names = toolCalls.map((call) => call.name).filter(Boolean);
|
|
178
|
+
if (Array.isArray(spec.tool_calls_include_any) && spec.tool_calls_include_any.length > 0) {
|
|
179
|
+
const hit = spec.tool_calls_include_any.some((expected) => names.includes(expected));
|
|
180
|
+
if (!hit) {
|
|
181
|
+
failures.push({
|
|
182
|
+
predicate: 'acceptance.tool_calls_include_any',
|
|
183
|
+
message: `expected at least one tool call from: ${spec.tool_calls_include_any.join(', ')}; saw: ${names.join(', ') || '(none)'}`,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (Array.isArray(spec.tool_calls_include_all) && spec.tool_calls_include_all.length > 0) {
|
|
188
|
+
const missing = spec.tool_calls_include_all.filter((expected) => !names.includes(expected));
|
|
189
|
+
if (missing.length > 0) {
|
|
190
|
+
failures.push({
|
|
191
|
+
predicate: 'acceptance.tool_calls_include_all',
|
|
192
|
+
message: `missing required tool calls: ${missing.join(', ')}; saw: ${names.join(', ') || '(none)'}`,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (Array.isArray(spec.tool_calls_argument_matches) && spec.tool_calls_argument_matches.length > 0) {
|
|
197
|
+
for (const matcher of spec.tool_calls_argument_matches) {
|
|
198
|
+
const tools = Array.isArray(matcher.tools) ? matcher.tools : [];
|
|
199
|
+
const pattern = typeof matcher.pattern === 'string' ? matcher.pattern : '';
|
|
200
|
+
if (tools.length === 0 || !pattern) continue;
|
|
201
|
+
let re = null;
|
|
202
|
+
try {
|
|
203
|
+
re = new RegExp(pattern, 'i');
|
|
204
|
+
} catch {
|
|
205
|
+
failures.push({
|
|
206
|
+
predicate: 'acceptance.tool_calls_argument_matches',
|
|
207
|
+
message: `invalid matcher regex: ${pattern}`,
|
|
208
|
+
});
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
const hit = toolCalls.some((call) => tools.includes(call.name) && re.test(JSON.stringify(call.input || {})));
|
|
212
|
+
if (!hit) {
|
|
213
|
+
failures.push({
|
|
214
|
+
predicate: 'acceptance.tool_calls_argument_matches',
|
|
215
|
+
message: `expected one of ${tools.join(', ')} with arguments matching /${pattern}/`,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return failures;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function codexToolCalls(stdout) {
|
|
224
|
+
const calls = [];
|
|
225
|
+
for (const event of parseJsonLines(stdout)) {
|
|
226
|
+
const type = event.type || event.event || event.kind || '';
|
|
227
|
+
const name = findToolName(event) || findToolName(event.call) || findToolName(event.item);
|
|
228
|
+
if (/tool|function/i.test(type) || name) {
|
|
229
|
+
calls.push({
|
|
230
|
+
engine: 'codex',
|
|
231
|
+
id: event.id || event.call_id || event.item_id || null,
|
|
232
|
+
name,
|
|
233
|
+
input: event.input || event.arguments || event.params || event.call?.arguments || null,
|
|
234
|
+
raw_type: type || null,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return dedupeCalls(calls);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function dedupeCalls(calls) {
|
|
242
|
+
const seen = new Set();
|
|
243
|
+
const out = [];
|
|
244
|
+
for (const call of calls) {
|
|
245
|
+
const key = JSON.stringify([call.engine, call.id, call.name, call.raw_type, call.input]);
|
|
246
|
+
if (seen.has(key)) continue;
|
|
247
|
+
seen.add(key);
|
|
248
|
+
out.push(call);
|
|
249
|
+
}
|
|
250
|
+
return out;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function extractToolCalls(engine, observed) {
|
|
254
|
+
if (engine === 'claude') return claudeToolCalls(observed?.stdout || '');
|
|
255
|
+
if (engine === 'codex') return codexToolCalls(`${observed?.stdout || ''}\n${observed?.stderr || ''}`);
|
|
256
|
+
throw new Error(`unsupported engine: ${engine}`);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function writeJsonl(file, event) {
|
|
260
|
+
appendFileSync(file, `${JSON.stringify({ ts: new Date().toISOString(), ...event })}\n`);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function markdownReport({ runId, engine, selected, results, jsonlPath, artifactDir, startedAt, durationMs }) {
|
|
264
|
+
const passed = results.filter((r) => r.pass).length;
|
|
265
|
+
const failed = results.length - passed;
|
|
266
|
+
const lines = [
|
|
267
|
+
'---',
|
|
268
|
+
'type: rdc-skill-acceptance-report',
|
|
269
|
+
`run_id: ${runId}`,
|
|
270
|
+
`engine: ${engine}`,
|
|
271
|
+
`created_at: ${new Date().toISOString()}`,
|
|
272
|
+
'---',
|
|
273
|
+
'',
|
|
274
|
+
`# RDC Skill Acceptance - ${runId}`,
|
|
275
|
+
'',
|
|
276
|
+
`Started: ${startedAt}`,
|
|
277
|
+
`Duration: ${durationMs} ms`,
|
|
278
|
+
`Evidence JSONL: ${jsonlPath}`,
|
|
279
|
+
`Artifacts: ${artifactDir}`,
|
|
280
|
+
'',
|
|
281
|
+
`Summary: ${passed} passed, ${failed} failed, ${results.length} total.`,
|
|
282
|
+
'',
|
|
283
|
+
'## Skills',
|
|
284
|
+
'',
|
|
285
|
+
];
|
|
286
|
+
for (const r of results) {
|
|
287
|
+
const status = r.pass ? 'PASS' : 'FAIL';
|
|
288
|
+
lines.push(`- ${r.skill}: ${status}; tool calls=${r.tool_calls.length}; duration=${r.duration_ms || 0} ms`);
|
|
289
|
+
if (r.artifacts?.assistant_text) lines.push(` - output: ${r.artifacts.assistant_text}`);
|
|
290
|
+
if (r.artifacts?.stdout) lines.push(` - raw stream: ${r.artifacts.stdout}`);
|
|
291
|
+
if (r.failures?.length) {
|
|
292
|
+
for (const failure of r.failures) {
|
|
293
|
+
lines.push(` - ${failure.predicate || 'failure'}: ${failure.message || JSON.stringify(failure)}`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
lines.push('', '## Lessons Learned', '');
|
|
298
|
+
const noToolCalls = results.filter((r) => r.pass && r.tool_calls.length === 0);
|
|
299
|
+
if (noToolCalls.length > 0) {
|
|
300
|
+
lines.push(`- ${noToolCalls.map((r) => r.skill).join(', ')} passed without observable tool calls. That may be valid for pure formatting/read-only skills, but build acceptance should decide whether those skills need a stricter artifact assertion.`);
|
|
301
|
+
}
|
|
302
|
+
if (failed > 0) {
|
|
303
|
+
lines.push('- Failed skill runs should generate a focused fixture or assertion update before the next build wave is accepted.');
|
|
304
|
+
}
|
|
305
|
+
if (results.every((r) => r.tool_calls.length > 0)) {
|
|
306
|
+
lines.push('- All selected skills emitted observable tool calls in the engine stream.');
|
|
307
|
+
}
|
|
308
|
+
lines.push('', '## Next Build Optimizations', '');
|
|
309
|
+
lines.push('- Keep one fast manifest per rdc:* skill touched by a PR or build wave.');
|
|
310
|
+
lines.push('- Add engine-specific parsers as new event formats appear instead of weakening the acceptance gate.');
|
|
311
|
+
lines.push('- Promote recurring failure patterns into manifest assertions rather than relying on transcript review.');
|
|
312
|
+
lines.push('', '## Selected Skills', '');
|
|
313
|
+
for (const skill of selected) lines.push(`- ${skill}`);
|
|
314
|
+
lines.push('');
|
|
315
|
+
return lines.join('\n');
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
async function runPool(items, parallel, worker) {
|
|
319
|
+
const results = new Array(items.length);
|
|
320
|
+
let next = 0;
|
|
321
|
+
async function lane() {
|
|
322
|
+
while (next < items.length) {
|
|
323
|
+
const i = next++;
|
|
324
|
+
results[i] = await worker(items[i], i);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
await Promise.all(Array.from({ length: Math.min(parallel, items.length) }, lane));
|
|
328
|
+
return results;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
async function main() {
|
|
332
|
+
if (!['claude', 'codex'].includes(ENGINE)) {
|
|
333
|
+
console.error(`unsupported --engine ${ENGINE}; expected claude or codex`);
|
|
334
|
+
process.exit(2);
|
|
335
|
+
}
|
|
336
|
+
if (ENGINE === 'codex') {
|
|
337
|
+
console.error('codex acceptance adapter can parse Codex JSONL, but live Codex agent spawning is not wired in this repo yet.');
|
|
338
|
+
process.exit(2);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
mkdirSync(REPORTS_DIR, { recursive: true });
|
|
342
|
+
const startedAt = new Date().toISOString();
|
|
343
|
+
const started = Date.now();
|
|
344
|
+
const jsonlPath = join(REPORTS_DIR, `${RUN_ID}.jsonl`);
|
|
345
|
+
const mdPath = join(REPORTS_DIR, `${RUN_ID}.md`);
|
|
346
|
+
const artifactDir = join(REPORTS_DIR, RUN_ID);
|
|
347
|
+
mkdirSync(artifactDir, { recursive: true });
|
|
348
|
+
|
|
349
|
+
const selected = new Set(ONLY_SKILLS);
|
|
350
|
+
if (CHANGED) for (const skill of touchedSkillsFromGit(BASE)) selected.add(skill);
|
|
351
|
+
if (selected.size === 0) {
|
|
352
|
+
console.error('no skills selected; pass --changed and/or --skill rdc:name');
|
|
353
|
+
process.exit(2);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
const manifests = loadAllManifests();
|
|
357
|
+
const bySkill = new Map(manifests.filter((m) => m.ok && m.manifest).map((m) => [m.manifest.skill, m]));
|
|
358
|
+
const missing = [...selected].filter((skill) => !bySkill.has(skill));
|
|
359
|
+
for (const skill of missing) {
|
|
360
|
+
writeJsonl(jsonlPath, { kind: 'missing_manifest', run_id: RUN_ID, skill });
|
|
361
|
+
}
|
|
362
|
+
if (missing.length > 0) {
|
|
363
|
+
console.error(`missing acceptance manifest(s): ${missing.join(', ')}`);
|
|
364
|
+
console.error(`evidence: ${jsonlPath}`);
|
|
365
|
+
process.exit(1);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
const selectedManifests = [...selected].sort().map((skill) => bySkill.get(skill).manifest);
|
|
369
|
+
writeJsonl(jsonlPath, {
|
|
370
|
+
kind: 'start',
|
|
371
|
+
run_id: RUN_ID,
|
|
372
|
+
engine: ENGINE,
|
|
373
|
+
selected: selectedManifests.map((m) => m.skill),
|
|
374
|
+
project_cwd: PROJECT_CWD,
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
const results = await runPool(selectedManifests, PARALLEL, async (manifest) => {
|
|
378
|
+
writeJsonl(jsonlPath, { kind: 'skill_start', run_id: RUN_ID, skill: manifest.skill, prompt: manifest.fixture?.prompt });
|
|
379
|
+
const result = await runManifest(manifest, {
|
|
380
|
+
runId: RUN_ID,
|
|
381
|
+
projectCwd: PROJECT_CWD,
|
|
382
|
+
});
|
|
383
|
+
const toolCalls = result.observed ? extractToolCalls(ENGINE, result.observed) : [];
|
|
384
|
+
const safeSkill = manifest.skill.replace(/[^a-z0-9-]+/gi, '-').replace(/^-+|-+$/g, '');
|
|
385
|
+
const stdoutPath = join(artifactDir, `${safeSkill}.stdout.jsonl`);
|
|
386
|
+
const stderrPath = join(artifactDir, `${safeSkill}.stderr.txt`);
|
|
387
|
+
const assistantPath = join(artifactDir, `${safeSkill}.assistant.md`);
|
|
388
|
+
const rendered = assistantText(ENGINE, result.observed?.stdout || '');
|
|
389
|
+
writeFileSync(stdoutPath, result.observed?.stdout || '');
|
|
390
|
+
writeFileSync(stderrPath, result.observed?.stderr || '');
|
|
391
|
+
writeFileSync(assistantPath, rendered || '');
|
|
392
|
+
const failures = [
|
|
393
|
+
...(result.failures || []),
|
|
394
|
+
...outputAssertionFailures(manifest.acceptance, rendered),
|
|
395
|
+
...toolCallAssertionFailures(manifest.acceptance, toolCalls),
|
|
396
|
+
];
|
|
397
|
+
const pass = failures.length === 0 && Boolean(result.pass) && (!STRICT_RECORDING || toolCalls.length > 0);
|
|
398
|
+
if (result.pass && STRICT_RECORDING && toolCalls.length === 0) {
|
|
399
|
+
failures.push({ predicate: 'tool_calls', message: 'strict recording requires at least one observable tool call' });
|
|
400
|
+
}
|
|
401
|
+
writeJsonl(jsonlPath, {
|
|
402
|
+
kind: 'skill_result',
|
|
403
|
+
run_id: RUN_ID,
|
|
404
|
+
skill: manifest.skill,
|
|
405
|
+
pass,
|
|
406
|
+
duration_ms: result.duration_ms,
|
|
407
|
+
tool_calls: toolCalls,
|
|
408
|
+
failures,
|
|
409
|
+
artifacts: {
|
|
410
|
+
stdout: stdoutPath,
|
|
411
|
+
stderr: stderrPath,
|
|
412
|
+
assistant_text: assistantPath,
|
|
413
|
+
},
|
|
414
|
+
assistant_preview: rendered.slice(0, 2000),
|
|
415
|
+
worktree: result.worktree || null,
|
|
416
|
+
observed: {
|
|
417
|
+
exit_code: result.observed?.exit_code,
|
|
418
|
+
timed_out: result.observed?.timed_out,
|
|
419
|
+
files_modified: result.observed?.files_modified || [],
|
|
420
|
+
commits: result.observed?.commits || [],
|
|
421
|
+
stdout_chars: result.observed?.stdout?.length || 0,
|
|
422
|
+
stderr_chars: result.observed?.stderr?.length || 0,
|
|
423
|
+
},
|
|
424
|
+
});
|
|
425
|
+
return {
|
|
426
|
+
...result,
|
|
427
|
+
pass,
|
|
428
|
+
failures,
|
|
429
|
+
tool_calls: toolCalls,
|
|
430
|
+
artifacts: {
|
|
431
|
+
stdout: stdoutPath,
|
|
432
|
+
stderr: stderrPath,
|
|
433
|
+
assistant_text: assistantPath,
|
|
434
|
+
},
|
|
435
|
+
assistant_preview: rendered.slice(0, 2000),
|
|
436
|
+
};
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
const durationMs = Date.now() - started;
|
|
440
|
+
writeJsonl(jsonlPath, {
|
|
441
|
+
kind: 'end',
|
|
442
|
+
run_id: RUN_ID,
|
|
443
|
+
duration_ms: durationMs,
|
|
444
|
+
pass: results.filter((r) => r.pass).length,
|
|
445
|
+
fail: results.filter((r) => !r.pass).length,
|
|
446
|
+
});
|
|
447
|
+
writeFileSync(mdPath, markdownReport({
|
|
448
|
+
runId: RUN_ID,
|
|
449
|
+
engine: ENGINE,
|
|
450
|
+
selected: selectedManifests.map((m) => m.skill),
|
|
451
|
+
results,
|
|
452
|
+
jsonlPath,
|
|
453
|
+
artifactDir,
|
|
454
|
+
startedAt,
|
|
455
|
+
durationMs,
|
|
456
|
+
}));
|
|
457
|
+
|
|
458
|
+
const failed = results.filter((r) => !r.pass);
|
|
459
|
+
console.log(`rdc skill acceptance: ${results.length - failed.length} passed, ${failed.length} failed`);
|
|
460
|
+
console.log(`evidence: ${jsonlPath}`);
|
|
461
|
+
console.log(`report: ${mdPath}`);
|
|
462
|
+
if (failed.length > 0) {
|
|
463
|
+
for (const r of failed) console.log(`FAIL ${r.skill}: ${r.failures?.map((f) => f.message).join('; ') || r.error || 'unknown'}`);
|
|
464
|
+
process.exit(1);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
main().catch((error) => {
|
|
469
|
+
console.error(error);
|
|
470
|
+
process.exit(1);
|
|
471
|
+
});
|
|
@@ -128,6 +128,20 @@ export function checkStdoutContains(expected, observed) {
|
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
export function checkStdoutNotContains(expected, observed) {
|
|
132
|
+
if (expected === undefined) return { pass: true };
|
|
133
|
+
if (!Array.isArray(expected)) {
|
|
134
|
+
return { pass: false, message: "stdout_not_contains assertion is not an array" };
|
|
135
|
+
}
|
|
136
|
+
const stdout = observed.stdout || "";
|
|
137
|
+
const present = expected.filter((s) => stdout.includes(s));
|
|
138
|
+
if (present.length === 0) return { pass: true };
|
|
139
|
+
return {
|
|
140
|
+
pass: false,
|
|
141
|
+
message: `stdout_not_contains: forbidden substrings present: ${present.map((s) => JSON.stringify(s)).join(", ")}`,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
131
145
|
// ─── evaluator ──────────────────────────────────────────────────────────────
|
|
132
146
|
|
|
133
147
|
const PREDICATES = [
|
|
@@ -137,6 +151,7 @@ const PREDICATES = [
|
|
|
137
151
|
["commits_made", checkCommitsMade],
|
|
138
152
|
["stderr_empty", checkStderrEmpty],
|
|
139
153
|
["stdout_contains", checkStdoutContains],
|
|
154
|
+
["stdout_not_contains", checkStdoutNotContains],
|
|
140
155
|
];
|
|
141
156
|
|
|
142
157
|
export function evaluateAssertions(assertions, observed) {
|
|
@@ -185,6 +200,7 @@ if (__isMain) {
|
|
|
185
200
|
commits_made: { min: 1, message_matches: "fix.*README" },
|
|
186
201
|
stderr_empty: true,
|
|
187
202
|
stdout_contains: ["✓", "Verdict:"],
|
|
203
|
+
stdout_not_contains: ["NOTPRESENT"],
|
|
188
204
|
},
|
|
189
205
|
observed: baseObserved,
|
|
190
206
|
expect: (r) => r.pass && r.failures.length === 0,
|
|
@@ -226,20 +242,27 @@ if (__isMain) {
|
|
|
226
242
|
},
|
|
227
243
|
{
|
|
228
244
|
n: 7,
|
|
245
|
+
desc: "stdout_not_contains catches forbidden substring",
|
|
246
|
+
assertions: { stdout_not_contains: ["Verdict:"] },
|
|
247
|
+
observed: baseObserved,
|
|
248
|
+
expect: (r) => !r.pass && r.failures.some((f) => f.predicate === "stdout_not_contains"),
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
n: 8,
|
|
229
252
|
desc: "work_items_created label filter rejects",
|
|
230
253
|
assertions: { work_items_created: { min: 1, labels_include: ["nonexistent"] } },
|
|
231
254
|
observed: baseObserved,
|
|
232
255
|
expect: (r) => !r.pass && r.failures.some((f) => f.predicate === "work_items_created"),
|
|
233
256
|
},
|
|
234
257
|
{
|
|
235
|
-
n:
|
|
258
|
+
n: 9,
|
|
236
259
|
desc: "work_items_created max exceeded",
|
|
237
260
|
assertions: { work_items_created: { max: 0 } },
|
|
238
261
|
observed: baseObserved,
|
|
239
262
|
expect: (r) => !r.pass && r.failures.some((f) => f.predicate === "work_items_created"),
|
|
240
263
|
},
|
|
241
264
|
{
|
|
242
|
-
n:
|
|
265
|
+
n: 10,
|
|
243
266
|
desc: "empty assertions → pass",
|
|
244
267
|
assertions: {},
|
|
245
268
|
observed: baseObserved,
|
|
@@ -36,6 +36,7 @@ const TOP_LEVEL_FIELDS = new Set([
|
|
|
36
36
|
"description",
|
|
37
37
|
"fixture",
|
|
38
38
|
"assertions",
|
|
39
|
+
"acceptance",
|
|
39
40
|
"teardown",
|
|
40
41
|
]);
|
|
41
42
|
|
|
@@ -48,6 +49,7 @@ const ASSERTION_FIELDS = new Set([
|
|
|
48
49
|
"commits_made",
|
|
49
50
|
"stderr_empty",
|
|
50
51
|
"stdout_contains",
|
|
52
|
+
"stdout_not_contains",
|
|
51
53
|
]);
|
|
52
54
|
|
|
53
55
|
const WIC_FIELDS = new Set(["min", "max", "status", "labels_include"]);
|
|
@@ -337,6 +339,17 @@ function validateAssertions(a, errors, warnings) {
|
|
|
337
339
|
});
|
|
338
340
|
}
|
|
339
341
|
}
|
|
342
|
+
if (a.stdout_not_contains !== undefined) {
|
|
343
|
+
if (!Array.isArray(a.stdout_not_contains)) {
|
|
344
|
+
err(errors, "assertions.stdout_not_contains", "type", "stdout_not_contains must be an array");
|
|
345
|
+
} else {
|
|
346
|
+
a.stdout_not_contains.forEach((s, i) => {
|
|
347
|
+
if (typeof s !== "string") {
|
|
348
|
+
err(errors, `assertions.stdout_not_contains[${i}]`, "type", "entry must be a string");
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
}
|
|
340
353
|
for (const k of Object.keys(a)) {
|
|
341
354
|
if (!ASSERTION_FIELDS.has(k)) {
|
|
342
355
|
warn(warnings, `assertions.${k}`, "unknown-field", `unknown assertion "${k}"`);
|
package/scripts/self-test.mjs
CHANGED
|
@@ -92,10 +92,12 @@ const KNOWN_CLAUTH_KEYS = new Set([
|
|
|
92
92
|
"coolify-api",
|
|
93
93
|
"cloudflare",
|
|
94
94
|
"npm",
|
|
95
|
-
"supabase",
|
|
96
|
-
"supabase-anon",
|
|
97
|
-
"supabase-db",
|
|
98
|
-
"
|
|
95
|
+
"supabase",
|
|
96
|
+
"supabase-anon",
|
|
97
|
+
"supabase-db",
|
|
98
|
+
"supabase-service",
|
|
99
|
+
"supabase-service-role",
|
|
100
|
+
"r2-access-key-id",
|
|
99
101
|
"r2-secret-key",
|
|
100
102
|
"anthropic",
|
|
101
103
|
"openai",
|
|
@@ -83,11 +83,33 @@ skills named in the scope boundary.
|
|
|
83
83
|
|
|
84
84
|
1. **Detect channel or pack mode** from the request using the tables above.
|
|
85
85
|
2. **Classify the source**: already-drafted copy, long article/report, transcript, notes, or brief.
|
|
86
|
-
3. **For long sources**,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
3. **For thin or under-specified long sources**, enrich before writing instead
|
|
87
|
+
of inventing context:
|
|
88
|
+
- If the source names a corpus path, read it.
|
|
89
|
+
- Otherwise search/read the approved corpus first when available. Resolve
|
|
90
|
+
`CORPUS_ROOT` (usually `H:/My Drive/global-corpus`) and
|
|
91
|
+
`LOCAL_CORPUS_ROOT` (usually `C:/Dev/local-corpus`) before searching the
|
|
92
|
+
repo. If environment variables are not visible, try those default paths.
|
|
93
|
+
- The corpus search must use an explicit corpus path in the tool arguments
|
|
94
|
+
(`H:/My Drive/global-corpus` or `C:/Dev/local-corpus`). A relative repo
|
|
95
|
+
search does not count as enrichment.
|
|
96
|
+
- Use `Grep`/`Glob`/`Read` or the environment's equivalent tools so the
|
|
97
|
+
transcript records what was consulted.
|
|
98
|
+
- Use web search only when the requested output needs current/public facts,
|
|
99
|
+
the user asks for external context, or corpus context is absent and network
|
|
100
|
+
search is allowed. Cite/use only what the search actually supports.
|
|
101
|
+
- Searching only the project repo is not enough for enrichment unless the
|
|
102
|
+
source itself points to a repo-local corpus file.
|
|
103
|
+
- If neither corpus nor web context is available, keep the output sparse and
|
|
104
|
+
mark missing context in assumptions; do not fill gaps creatively.
|
|
105
|
+
4. **For long sources**, extract thesis, audience, proof points, CTA, constraints, and factual risks before writing.
|
|
106
|
+
5. **Jump to the target channel or pack section** below and apply all rules exactly — do not rely on memory.
|
|
107
|
+
6. **Never mix** markdown conventions across channels.
|
|
108
|
+
7. If the channel or pack is ambiguous, ask once: "Is this for [Channel A] or [Channel B]?"
|
|
109
|
+
8. Produce the formatted or repurposed output directly as the deliverable.
|
|
110
|
+
9. Treat extraction notes and source-fidelity guardrails as internal scratchwork.
|
|
111
|
+
Do not print a "Long-Source Extraction Checklist", factual guardrail list, or
|
|
112
|
+
absent-topic list unless the user explicitly asks for analysis.
|
|
91
113
|
|
|
92
114
|
## Hard Rules (all channels)
|
|
93
115
|
|
|
@@ -167,7 +189,7 @@ Repurpose one source for an announcement:
|
|
|
167
189
|
- 3 CTA variants
|
|
168
190
|
|
|
169
191
|
### Long-Source Extraction Checklist
|
|
170
|
-
Before writing from a long source, identify:
|
|
192
|
+
Before writing from a long source, identify internally:
|
|
171
193
|
- **Thesis:** the central argument or announcement
|
|
172
194
|
- **Audience:** who this is for
|
|
173
195
|
- **Proof:** facts, examples, data, names, dates, or quotes explicitly present
|
|
@@ -179,13 +201,39 @@ Before writing from a long source, identify:
|
|
|
179
201
|
### Source-Fidelity Rules
|
|
180
202
|
- Do not invent statistics, dates, quotes, citations, partnerships, revenue,
|
|
181
203
|
legal claims, customer names, or outcomes.
|
|
204
|
+
- Do not infer adjacent finance/reporting concepts that sound plausible but are
|
|
205
|
+
absent from the source, such as pro forma assumptions, reporting cadence,
|
|
206
|
+
offset mechanisms, governance structures, verification status, or portfolio
|
|
207
|
+
implications.
|
|
208
|
+
- If corpus or web context was consulted, use it only for facts it directly
|
|
209
|
+
supports. Do not blend generic domain knowledge into the source as if it were
|
|
210
|
+
documented.
|
|
211
|
+
- If the source provides a theme label without an explanation, keep the theme
|
|
212
|
+
label or paraphrase it conservatively. Do not add explanatory clauses that
|
|
213
|
+
define how it works, who governs it, how it is verified, how often it reports,
|
|
214
|
+
or what financial model it opposes unless those details are explicit.
|
|
215
|
+
- Do not contrast patient capital with quarters, earnings calls, fund cycles,
|
|
216
|
+
exits, venture speed, or portfolio management unless those words or concepts
|
|
217
|
+
appear in the source or consulted corpus/web material.
|
|
182
218
|
- Do not upgrade tentative language into certainty.
|
|
183
219
|
- Do not turn illustrative examples into facts.
|
|
184
220
|
- Preserve caveats when they affect meaning.
|
|
185
221
|
- If a stronger hook needs a proof point the source does not provide, write a
|
|
186
222
|
proof-neutral hook instead.
|
|
223
|
+
- If the source says a topic is absent, excluded, or not mentioned, treat that
|
|
224
|
+
as an internal guardrail. Do not repeat the absent topic in public-facing
|
|
225
|
+
channel copy, assumptions, caveats, notes, headings, or summaries unless the
|
|
226
|
+
user explicitly asks for a contrast, compliance note, or risk disclosure.
|
|
227
|
+
Strip absent-topic lists from the deliverable entirely.
|
|
187
228
|
- When assumptions are material, include a short "Assumptions:" line before the
|
|
188
229
|
deliverable rather than burying uncertainty in polished copy.
|
|
230
|
+
- Do not output your extraction checklist. The deliverable should start with the
|
|
231
|
+
requested channel/pack output, except for a brief "Assumptions:" line when a
|
|
232
|
+
material gap affects the copy.
|
|
233
|
+
- If you include an "Assumptions:" line, limit it to missing useful inputs such
|
|
234
|
+
as org name, audience, location, date, CTA, or link. Never list absent,
|
|
235
|
+
excluded, or not-mentioned topics in the assumptions line. If the only
|
|
236
|
+
uncertainty is an absent-topic guardrail, omit the assumptions line.
|
|
189
237
|
|
|
190
238
|
---
|
|
191
239
|
|
|
@@ -231,6 +279,8 @@ channel-native. A pack is not a generic summary repeated in several lengths.
|
|
|
231
279
|
email/web, concise in Slack.
|
|
232
280
|
- Use channel-specific formatting rules from the sections below.
|
|
233
281
|
- If source proof is weak, use curiosity and framing instead of inflated claims.
|
|
282
|
+
- Do not include extraction notes, guardrail notes, or absent-topic caveats in
|
|
283
|
+
the pack. Those are reasoning aids, not channel outputs.
|
|
234
284
|
|
|
235
285
|
---
|
|
236
286
|
|
|
@@ -21,6 +21,8 @@ required_validators:
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
23
|
# LIFEAI Brochure Authoring Contract
|
|
24
|
+
> **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
|
|
25
|
+
> Return the authored JSX guidance or verification result directly; do not dump raw tool logs.
|
|
24
26
|
|
|
25
27
|
This is the contract every AI engine obeys when generating brochure JSX. The contract is non-negotiable. If you cannot generate output that complies, **stop and ask for clarification rather than emit non-compliant code.**
|
|
26
28
|
|
|
@@ -13,6 +13,8 @@ triggers:
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
# rdc:brochurify Orchestrator
|
|
16
|
+
> **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
|
|
17
|
+
> Report brochure job state, artifacts, and blockers directly; do not dump raw tool logs.
|
|
16
18
|
|
|
17
19
|
The orchestrator dispatches six waves of typed sub-agents in sequence. Each wave has a clear input contract, an output contract, and a parallelism profile.
|
|
18
20
|
|
|
@@ -13,6 +13,8 @@ triggers:
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
# rdc:extract-verifier-rules
|
|
16
|
+
> **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
|
|
17
|
+
> Return candidate rules, evidence, and PR status directly; do not dump raw tool logs.
|
|
16
18
|
|
|
17
19
|
The self-learning loop. The verifier corpus is the moat (per `DECISIONS-LOG.md` D-009). This skill is how the corpus grows.
|
|
18
20
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
+
name: rpms-filemap
|
|
2
3
|
description: "Generated RPMS file map — RULE #1, canonical homes, and Context Export pointers served from regen-root manifest."
|
|
3
4
|
slash: "rdc:rpms-filemap"
|
|
4
5
|
category: "tooling"
|
|
@@ -12,6 +13,9 @@ triggers:
|
|
|
12
13
|
- "where should pm artifacts go"
|
|
13
14
|
---
|
|
14
15
|
# RPMS File Map
|
|
16
|
+
> **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
|
|
17
|
+
> Return the requested file-map guidance directly; do not dump raw manifests or logs.
|
|
18
|
+
|
|
15
19
|
> GENERATED FILE - DO NOT HAND-EDIT.
|
|
16
20
|
> Source of truth: `docs/architecture/rpms.locations.json`
|
|
17
21
|
> Regenerate: `pnpm rpms:gen-filemap`
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
+
name: rpms-filemap
|
|
2
3
|
description: "Generated RPMS file map — RULE #1, canonical homes, and Context Export pointers served from regen-root manifest."
|
|
3
4
|
slash: "rdc:rpms-filemap"
|
|
4
5
|
category: "tooling"
|
|
@@ -12,6 +13,9 @@ triggers:
|
|
|
12
13
|
- "where should pm artifacts go"
|
|
13
14
|
---
|
|
14
15
|
# RPMS File Map
|
|
16
|
+
> **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
|
|
17
|
+
> Return the requested file-map guidance directly; do not dump raw manifests or logs.
|
|
18
|
+
|
|
15
19
|
> GENERATED FILE - DO NOT HAND-EDIT.
|
|
16
20
|
> Source of truth: `docs/architecture/rpms.locations.json`
|
|
17
21
|
> Regenerate: `pnpm rpms:gen-filemap`
|
package/skills/tests/README.md
CHANGED
|
@@ -23,6 +23,11 @@ is the source of truth. Top-level fields:
|
|
|
23
23
|
4. Run `node scripts/self-test.mjs --tier2 --skill rdc:<name>` to smoke-test
|
|
24
24
|
5. Commit manifest + any skill changes together
|
|
25
25
|
|
|
26
|
+
For content-producing skills, include both positive and negative output checks.
|
|
27
|
+
Use `stdout_contains` for expected channel-native structure and source facts;
|
|
28
|
+
use `stdout_not_contains` for source-fidelity violations or explicitly forbidden
|
|
29
|
+
claims.
|
|
30
|
+
|
|
26
31
|
## Adding a new skill
|
|
27
32
|
|
|
28
33
|
New skills MUST ship with a manifest. Tier 2 CI will block tag push if a
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 1,
|
|
3
|
+
"skill": "rdc:channel-formatter",
|
|
4
|
+
"description": "Channel formatter turns a long article into a social content pack in RDC_TEST mode without fabricating source claims.",
|
|
5
|
+
"fixture": {
|
|
6
|
+
"prompt": "rdc:channel-formatter social-pack docs/source/channel-formatter-long-article.md",
|
|
7
|
+
"precondition_files": [
|
|
8
|
+
{
|
|
9
|
+
"path": "docs/source/channel-formatter-long-article.md",
|
|
10
|
+
"content": "# Wetland Finance Article\n\nA 2026 field note from the finance team says the pilot restored 42 acres of riparian habitat, reduced annual irrigation demand by 18 percent, and produced three investor update themes: patient capital, measurable ecological return, and community operating discipline.\n\nThis is intentionally thin. Before writing, consult available corpus context for regenerative finance / wetland finance language. Use an explicit corpus-path search of `C:/Dev/local-corpus` or `H:/My Drive/global-corpus`; if neither path has support, keep claims limited to the source.\n\nThe absent-topic list below is a private guardrail only. Do not repeat these terms in assumptions, notes, caveats, headings, summaries, or public-facing output.\n\nThe source does not mention carbon credits, tokenization, celebrity partners, guaranteed returns, quarterly earnings, fund cycles, verification status, portfolio management, or governance structures."
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"env": { "RDC_TEST": "1" }
|
|
14
|
+
},
|
|
15
|
+
"assertions": {
|
|
16
|
+
"exit_code": 0,
|
|
17
|
+
"stdout_contains": ["LinkedIn", "Twitter/X", "Slack", "42 acres", "18 percent"]
|
|
18
|
+
},
|
|
19
|
+
"acceptance": {
|
|
20
|
+
"output_contains": ["LinkedIn", "Twitter/X", "Slack", "42 acres", "18%"],
|
|
21
|
+
"output_not_contains": [
|
|
22
|
+
"carbon credits",
|
|
23
|
+
"tokenization",
|
|
24
|
+
"celebrity partners",
|
|
25
|
+
"guaranteed returns",
|
|
26
|
+
"pro forma",
|
|
27
|
+
"offsets",
|
|
28
|
+
"governance",
|
|
29
|
+
"quarterly",
|
|
30
|
+
"verified",
|
|
31
|
+
"fund cycle",
|
|
32
|
+
"fund-cycle",
|
|
33
|
+
"portfolio manager",
|
|
34
|
+
"portfolio management"
|
|
35
|
+
],
|
|
36
|
+
"tool_calls_include_any": ["Grep", "Glob", "WebSearch"],
|
|
37
|
+
"tool_calls_argument_matches": [
|
|
38
|
+
{
|
|
39
|
+
"tools": ["Grep", "Glob", "WebSearch"],
|
|
40
|
+
"pattern": "global-corpus|local-corpus|CORPUS_ROOT|LOCAL_CORPUS_ROOT|web"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"teardown": { "reset_branch": true }
|
|
45
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import { mkdtempSync, rmSync } from 'node:fs';
|
|
5
|
+
import { tmpdir } from 'node:os';
|
|
6
|
+
import { join, resolve } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import { dirname } from 'node:path';
|
|
9
|
+
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const REPO_ROOT = resolve(__dirname, '..');
|
|
12
|
+
const script = join(REPO_ROOT, 'scripts', 'acceptance.mjs');
|
|
13
|
+
|
|
14
|
+
const syntax = spawnSync(process.execPath, ['--check', script], { encoding: 'utf8' });
|
|
15
|
+
assert.equal(syntax.status, 0, syntax.stderr);
|
|
16
|
+
|
|
17
|
+
const missing = spawnSync(process.execPath, [script, '--skill', 'rdc:not-a-real-skill'], {
|
|
18
|
+
cwd: REPO_ROOT,
|
|
19
|
+
encoding: 'utf8',
|
|
20
|
+
});
|
|
21
|
+
assert.equal(missing.status, 1);
|
|
22
|
+
assert.match(missing.stderr, /missing acceptance manifest/);
|
|
23
|
+
|
|
24
|
+
const codex = spawnSync(process.execPath, [script, '--engine', 'codex', '--skill', 'rdc:plan'], {
|
|
25
|
+
cwd: REPO_ROOT,
|
|
26
|
+
encoding: 'utf8',
|
|
27
|
+
});
|
|
28
|
+
assert.equal(codex.status, 2);
|
|
29
|
+
assert.match(codex.stderr, /Codex JSONL/);
|
|
30
|
+
|
|
31
|
+
const emptyProject = mkdtempSync(join(tmpdir(), 'rdc-acceptance-empty-'));
|
|
32
|
+
try {
|
|
33
|
+
const none = spawnSync(process.execPath, [script, '--changed', '--base', 'HEAD', '--project-root', emptyProject], {
|
|
34
|
+
cwd: REPO_ROOT,
|
|
35
|
+
encoding: 'utf8',
|
|
36
|
+
});
|
|
37
|
+
assert.notEqual(none.status, 0);
|
|
38
|
+
} finally {
|
|
39
|
+
rmSync(emptyProject, { recursive: true, force: true });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
console.log('acceptance tests — PASS');
|
|
@@ -146,7 +146,37 @@ const WI = 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee';
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
// ===========================================================================
|
|
149
|
-
// 2.
|
|
149
|
+
// 2. foreground-process-gate.js
|
|
150
|
+
// ===========================================================================
|
|
151
|
+
{
|
|
152
|
+
const focusPayload = {
|
|
153
|
+
tool_input: {
|
|
154
|
+
command: "powershell -NoProfile -Command \"Add-Type '[DllImport(\\\"user32.dll\\\")] public static extern bool SetForegroundWindow(System.IntPtr hWnd);'\"",
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
const r = runHook('foreground-process-gate.js', focusPayload, {});
|
|
158
|
+
assert('FPG blocks SetForegroundWindow focus API', r.status === 1, `status=${r.status} ${r.stdout}${r.stderr}`);
|
|
159
|
+
assert('FPG block mentions window focus operations', /Window focus\/restore\/minimize\/collapse/.test(r.stdout + r.stderr));
|
|
160
|
+
|
|
161
|
+
const hiddenPayload = {
|
|
162
|
+
tool_input: {
|
|
163
|
+
command: 'powershell.exe -NoProfile -NonInteractive -WindowStyle Hidden -File ".\\\\scripts\\\\helper.ps1"',
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
const h = runHook('foreground-process-gate.js', hiddenPayload, {});
|
|
167
|
+
assert('FPG allows hidden PowerShell helper', h.status === 0, `status=${h.status} ${h.stdout}${h.stderr}`);
|
|
168
|
+
|
|
169
|
+
const minimizedPayload = {
|
|
170
|
+
tool_input: {
|
|
171
|
+
command: 'Start-Process powershell.exe -WindowStyle Minimized -ArgumentList "-NoProfile"',
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
const m = runHook('foreground-process-gate.js', minimizedPayload, {});
|
|
175
|
+
assert('FPG allows minimized Start-Process without focus APIs', m.status === 0, `status=${m.status} ${m.stdout}${m.stderr}`);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// ===========================================================================
|
|
179
|
+
// 3. post-tool-batch-gate.js
|
|
150
180
|
// ===========================================================================
|
|
151
181
|
{
|
|
152
182
|
const ptb = require(join(HOOKS, 'post-tool-batch-gate.js'));
|
|
@@ -197,7 +227,7 @@ const WI = 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee';
|
|
|
197
227
|
}
|
|
198
228
|
|
|
199
229
|
// ===========================================================================
|
|
200
|
-
//
|
|
230
|
+
// 4. gate-watchdog-selfcheck.js
|
|
201
231
|
// ===========================================================================
|
|
202
232
|
{
|
|
203
233
|
const wd = require(join(HOOKS, 'gate-watchdog-selfcheck.js'));
|
package/tests/validate-skills.js
CHANGED
|
@@ -1,183 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Compatibility wrapper for the current rdc-skills validation gate.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* Exit codes:
|
|
11
|
-
* 0 = all valid
|
|
12
|
-
* 1 = validation failed
|
|
5
|
+
* The older validator required every skill to use the same "When to Use" /
|
|
6
|
+
* "Procedure" section shape. The canonical gate is now scripts/self-test.mjs,
|
|
7
|
+
* which understands the shipped skill variants, guide checks, hook behavior,
|
|
8
|
+
* plugin metadata, and strict warning policy.
|
|
13
9
|
*/
|
|
14
10
|
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const REQUIRED_FRONTMATTER = ['name', 'description'];
|
|
19
|
-
const REQUIRED_SECTIONS = [
|
|
20
|
-
'## When to Use',
|
|
21
|
-
'## Procedure' // OR '## Arguments'
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
let passed = 0;
|
|
25
|
-
let failed = 0;
|
|
26
|
-
const errors = [];
|
|
27
|
-
|
|
28
|
-
function validateFile(filePath) {
|
|
29
|
-
try {
|
|
30
|
-
const contents = fs.readFileSync(filePath, 'utf8').replace(/\r\n/g, '\n');
|
|
31
|
-
const lines = contents.split('\n');
|
|
32
|
-
|
|
33
|
-
// Check frontmatter
|
|
34
|
-
if (!lines[0].includes('---')) {
|
|
35
|
-
errors.push(`${path.basename(filePath)}: Missing YAML frontmatter start`);
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
let frontmatterEnd = -1;
|
|
40
|
-
for (let i = 1; i < lines.length; i++) {
|
|
41
|
-
if (lines[i].includes('---')) {
|
|
42
|
-
frontmatterEnd = i;
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (frontmatterEnd === -1) {
|
|
48
|
-
errors.push(`${path.basename(filePath)}: YAML frontmatter not closed`);
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
11
|
+
const { spawnSync } = require("node:child_process");
|
|
12
|
+
const { join, dirname } = require("node:path");
|
|
51
13
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const frontmatter = {};
|
|
14
|
+
const repoRoot = dirname(dirname(__filename));
|
|
15
|
+
const selfTest = join(repoRoot, "scripts", "self-test.mjs");
|
|
55
16
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
}
|
|
17
|
+
const result = spawnSync(process.execPath, [selfTest, "--strict"], {
|
|
18
|
+
cwd: repoRoot,
|
|
19
|
+
stdio: "inherit",
|
|
20
|
+
});
|
|
62
21
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
errors.push(`${path.basename(filePath)}: Missing frontmatter field '${field}'`);
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Check required sections
|
|
72
|
-
const bodyText = lines.slice(frontmatterEnd + 1).join('\n');
|
|
73
|
-
const hasWhenToUse = bodyText.includes('## When to Use');
|
|
74
|
-
const hasProcedure = bodyText.includes('## Procedure');
|
|
75
|
-
const hasArguments = bodyText.includes('## Arguments');
|
|
76
|
-
|
|
77
|
-
if (!hasWhenToUse) {
|
|
78
|
-
errors.push(`${path.basename(filePath)}: Missing '## When to Use' section`);
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (!hasProcedure && !hasArguments) {
|
|
83
|
-
errors.push(`${path.basename(filePath)}: Missing '## Procedure' or '## Arguments' section`);
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return true;
|
|
88
|
-
} catch (err) {
|
|
89
|
-
errors.push(`${path.basename(filePath)}: ${err.message}`);
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
22
|
+
if (result.error) {
|
|
23
|
+
console.error(result.error.message);
|
|
24
|
+
process.exit(2);
|
|
92
25
|
}
|
|
93
26
|
|
|
94
|
-
|
|
95
|
-
if (!fs.existsSync(dirPath)) {
|
|
96
|
-
console.log(`ℹ ${dirName}/ directory not found (will be populated later)`);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Skills are in subdirectories: skills/<name>/SKILL.md
|
|
101
|
-
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
102
|
-
const skillFiles = [];
|
|
103
|
-
|
|
104
|
-
for (const entry of entries) {
|
|
105
|
-
if (entry.isDirectory()) {
|
|
106
|
-
const skillMd = path.join(dirPath, entry.name, 'SKILL.md');
|
|
107
|
-
if (fs.existsSync(skillMd)) {
|
|
108
|
-
skillFiles.push({ label: `${entry.name}/SKILL.md`, filePath: skillMd });
|
|
109
|
-
}
|
|
110
|
-
} else if (entry.name.endsWith('.md')) {
|
|
111
|
-
skillFiles.push({ label: entry.name, filePath: path.join(dirPath, entry.name) });
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (skillFiles.length === 0) {
|
|
116
|
-
console.log(`ℹ ${dirName}/ (empty — will be populated later)`);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
console.log(`\nValidating ${dirName}/`);
|
|
121
|
-
console.log('─'.repeat(40));
|
|
122
|
-
|
|
123
|
-
for (const { label, filePath } of skillFiles) {
|
|
124
|
-
if (validateFile(filePath)) {
|
|
125
|
-
console.log(` ✓ ${label}`);
|
|
126
|
-
passed++;
|
|
127
|
-
} else {
|
|
128
|
-
console.log(` ✗ ${label}`);
|
|
129
|
-
failed++;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Main
|
|
135
|
-
console.log('rdc-skills Validator');
|
|
136
|
-
console.log('====================\n');
|
|
137
|
-
|
|
138
|
-
const repoRoot = path.dirname(path.dirname(__filename));
|
|
139
|
-
const skillsDir = path.join(repoRoot, 'skills');
|
|
140
|
-
const guidesDir = path.join(repoRoot, 'guides');
|
|
141
|
-
|
|
142
|
-
validateDirectory(skillsDir, 'skills');
|
|
143
|
-
|
|
144
|
-
// Guides are prose docs — just check they are readable markdown files
|
|
145
|
-
if (fs.existsSync(guidesDir)) {
|
|
146
|
-
const guideFiles = fs.readdirSync(guidesDir).filter(f => f.endsWith('.md'));
|
|
147
|
-
if (guideFiles.length > 0) {
|
|
148
|
-
console.log('\nValidating guides/ (readability only)');
|
|
149
|
-
console.log('─'.repeat(40));
|
|
150
|
-
for (const file of guideFiles) {
|
|
151
|
-
try {
|
|
152
|
-
fs.readFileSync(path.join(guidesDir, file), 'utf8');
|
|
153
|
-
console.log(` ✓ ${file}`);
|
|
154
|
-
passed++;
|
|
155
|
-
} catch (err) {
|
|
156
|
-
errors.push(`${file}: ${err.message}`);
|
|
157
|
-
console.log(` ✗ ${file}`);
|
|
158
|
-
failed++;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
console.log('\n' + '═'.repeat(40));
|
|
165
|
-
if (errors.length > 0) {
|
|
166
|
-
console.log('\nErrors:');
|
|
167
|
-
for (const err of errors) {
|
|
168
|
-
console.log(` • ${err}`);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
console.log(`\nResults: ${passed} passed, ${failed} failed`);
|
|
173
|
-
|
|
174
|
-
if (failed === 0 && passed > 0) {
|
|
175
|
-
console.log('✓ All files valid\n');
|
|
176
|
-
process.exit(0);
|
|
177
|
-
} else if (failed === 0 && passed === 0) {
|
|
178
|
-
console.log('ℹ No files to validate (plugin base not yet populated)\n');
|
|
179
|
-
process.exit(0);
|
|
180
|
-
} else {
|
|
181
|
-
console.log('✗ Validation failed\n');
|
|
182
|
-
process.exit(1);
|
|
183
|
-
}
|
|
27
|
+
process.exit(result.status ?? 1);
|