@lifeaitools/rdc-skills 0.24.10 → 0.24.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.github/workflows/self-test.yml +34 -34
  3. package/commands/build.md +181 -181
  4. package/commands/collab.md +180 -180
  5. package/commands/deploy.md +148 -148
  6. package/commands/fixit.md +105 -105
  7. package/commands/handoff.md +173 -173
  8. package/commands/overnight.md +218 -218
  9. package/commands/plan.md +158 -158
  10. package/commands/preplan.md +131 -131
  11. package/commands/prototype.md +145 -145
  12. package/commands/report.md +99 -99
  13. package/commands/review.md +120 -120
  14. package/commands/status.md +86 -86
  15. package/commands/watch.md +8 -2
  16. package/commands/workitems.md +127 -127
  17. package/git-sha.json +1 -1
  18. package/guides/agent-bootstrap.md +195 -195
  19. package/guides/agents/backend.md +102 -102
  20. package/guides/agents/content.md +94 -94
  21. package/guides/agents/cs2.md +56 -56
  22. package/guides/agents/data.md +86 -86
  23. package/guides/agents/design.md +77 -77
  24. package/guides/agents/frontend.md +91 -91
  25. package/guides/agents/infrastructure.md +81 -81
  26. package/guides/agents/setup.md +272 -272
  27. package/guides/agents/verify.md +119 -119
  28. package/guides/agents/viz.md +106 -106
  29. package/hooks/foreground-process-gate.js +22 -3
  30. package/package.json +3 -1
  31. package/scripts/acceptance.mjs +471 -0
  32. package/scripts/lib/assertions.mjs +25 -2
  33. package/scripts/lib/manifest-schema.mjs +13 -0
  34. package/scripts/self-test.mjs +1460 -1458
  35. package/scripts/test-guide-validator.mjs +2 -0
  36. package/skills/build/SKILL.md +554 -554
  37. package/skills/channel-formatter/SKILL.md +56 -6
  38. package/skills/collab/SKILL.md +239 -239
  39. package/skills/deploy/SKILL.md +541 -541
  40. package/skills/design/SKILL.md +205 -205
  41. package/skills/fixit/SKILL.md +165 -165
  42. package/skills/handoff/SKILL.md +200 -200
  43. package/skills/lifeai-brochure-author/SKILL.md +2 -0
  44. package/skills/overnight/SKILL.md +251 -251
  45. package/skills/plan/SKILL.md +314 -314
  46. package/skills/preplan/SKILL.md +90 -90
  47. package/skills/prototype/SKILL.md +150 -150
  48. package/skills/rdc-brochurify/SKILL.md +7 -0
  49. package/skills/rdc-extract-verifier-rules/SKILL.md +2 -0
  50. package/skills/release/SKILL.md +140 -140
  51. package/skills/report/SKILL.md +100 -100
  52. package/skills/review/SKILL.md +152 -152
  53. package/skills/rpms-filemap/SKILL.cloud.md +4 -0
  54. package/skills/rpms-filemap/SKILL.md +4 -0
  55. package/skills/self-test/SKILL.md +127 -123
  56. package/skills/status/SKILL.md +99 -99
  57. package/skills/tests/MATRIX.md +53 -0
  58. package/skills/tests/README.md +20 -3
  59. package/skills/tests/rdc-brochure.test.json +20 -0
  60. package/skills/tests/rdc-channel-formatter.test.json +45 -0
  61. package/skills/tests/rdc-co-develop.test.json +15 -0
  62. package/skills/tests/rdc-collab.test.json +15 -0
  63. package/skills/tests/rdc-convert.test.json +20 -0
  64. package/skills/tests/rdc-fs-mcp.test.json +21 -0
  65. package/skills/tests/rdc-help.test.json +15 -0
  66. package/skills/tests/rdc-housekeeping.test.json +15 -0
  67. package/skills/tests/rdc-lifeai-brochure-author.test.json +20 -0
  68. package/skills/tests/rdc-rdc-brochurify.test.json +23 -0
  69. package/skills/tests/rdc-rdc-extract-verifier-rules.test.json +20 -0
  70. package/skills/tests/rdc-rpms-filemap.test.json +15 -0
  71. package/skills/tests/rdc-self-test.test.json +15 -0
  72. package/skills/tests/rdc-status.test.json +0 -1
  73. package/skills/tests/rdc-terminal-config.test.json +15 -0
  74. package/skills/tests/rdc-watch.test.json +24 -0
  75. package/skills/watch/SKILL.md +96 -90
  76. package/skills/workitems/SKILL.md +151 -151
  77. package/tests/acceptance.test.mjs +42 -0
  78. package/tests/harness-gates.test.mjs +32 -2
  79. package/tests/validate-skills.js +17 -173
@@ -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: 8,
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: 9,
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}"`);