@lifeaitools/rdc-skills 0.24.8 → 0.24.9

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rdc",
3
- "version": "0.24.8",
3
+ "version": "0.24.9",
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
@@ -1,3 +1,3 @@
1
1
  {
2
- "sha": "f6df094e61e5c0ece0ac8149e97142c78d04a21c"
2
+ "sha": "f5ae61c0f6b40783d69bb93f6c75a46ceeff6acc"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifeaitools/rdc-skills",
3
- "version": "0.24.8",
3
+ "version": "0.24.9",
4
4
  "description": "RDC typed-agent dispatch skill suite for Claude Code - plan, build, review, overnight builds",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -37,6 +37,8 @@
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
38
  "test:mcp": "node tests/mcp.test.mjs",
39
39
  "test:mcp:remote": "node tests/mcp.test.mjs --remote",
40
+ "test:channel-formatter": "node tests/channel-formatter.contract.test.mjs",
41
+ "test:channel-formatter:remote": "node tests/channel-formatter.contract.test.mjs --remote",
40
42
  "mcp": "node bin/rdc-skills-mcp.mjs",
41
43
  "rebuild-mcp": "node scripts/rebuild-mcp.mjs",
42
44
  "prepack": "node scripts/prepack.mjs"
@@ -107,6 +107,12 @@ skills named in the scope boundary.
107
107
  > doc" → **`rdc:convert`**. "format this content the Word way / write it for LinkedIn" →
108
108
  > this skill. The Word/DOCX and PDF sections below describe target structure only; producing
109
109
  > the actual `.docx`/`.pdf` artifact is `rdc:convert` / `rdc:brochure`, not channel-formatter.
110
+ >
111
+ > Specialist routing:
112
+ > - Office/Markdown file conversion → `rdc:convert`
113
+ > - HTML/folder/zip/URL to PDF brochure rendering → `rdc:brochure`
114
+ > - Brochurify orchestration jobs → `rdc:brochurify`
115
+ > - Brochure JSX using `@lifeai/brochure-kit` → `lifeai-brochure-author`
110
116
 
111
117
  ---
112
118
 
@@ -0,0 +1,251 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Contract/system test for rdc:channel-formatter content repurposing.
4
+ *
5
+ * This does not test LLM prose generation. rdc:channel-formatter is an
6
+ * instruction skill served by the MCP, not an executable formatter function.
7
+ * What this test proves is that local and live MCP discovery return the
8
+ * expected skill and that the served skill body contains the required
9
+ * social-pack, campaign-pack, and source-fidelity contracts an agent must obey.
10
+ *
11
+ * Every MCP call is written to a JSONL audit log under .rdc/reports/.
12
+ */
13
+
14
+ import { spawn } from 'node:child_process';
15
+ import fs from 'node:fs';
16
+ import path from 'node:path';
17
+ import { fileURLToPath } from 'node:url';
18
+
19
+ import { getSkillBody, listSkills, searchSkills } from '../lib/catalog.mjs';
20
+
21
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
22
+ const REPO_ROOT = path.resolve(__dirname, '..');
23
+ const BIN = path.join(REPO_ROOT, 'bin', 'rdc-skills-mcp.mjs');
24
+ const TEST_PORT = parseInt(process.env.TEST_PORT || '3198', 10);
25
+ const LOCAL = `http://127.0.0.1:${TEST_PORT}/mcp`;
26
+ const LOCAL_HEALTH = `http://127.0.0.1:${TEST_PORT}/health`;
27
+ const REMOTE = 'https://rdc-skills.regendevcorp.com/mcp';
28
+ const REPORT_DIR = path.join(REPO_ROOT, '.rdc', 'reports');
29
+ const REPORT_FILE = path.join(
30
+ REPORT_DIR,
31
+ `channel-formatter-contract-${new Date().toISOString().replace(/[:.]/g, '-')}.jsonl`,
32
+ );
33
+
34
+ fs.mkdirSync(REPORT_DIR, { recursive: true });
35
+
36
+ let pass = 0;
37
+ let fail = 0;
38
+ const failures = [];
39
+
40
+ function log(event) {
41
+ fs.appendFileSync(REPORT_FILE, `${JSON.stringify({ ts: new Date().toISOString(), ...event })}\n`);
42
+ }
43
+
44
+ function check(name, condition, detail = '') {
45
+ if (condition) {
46
+ pass++;
47
+ log({ kind: 'assertion', name, status: 'pass', detail });
48
+ } else {
49
+ fail++;
50
+ failures.push(`${name}${detail ? ` - ${detail}` : ''}`);
51
+ log({ kind: 'assertion', name, status: 'fail', detail });
52
+ }
53
+ }
54
+
55
+ function resultText(json) {
56
+ return json?.result?.content?.[0]?.text || '';
57
+ }
58
+
59
+ function summarizeText(text) {
60
+ return {
61
+ length: text.length,
62
+ hasChannelFormatter: text.includes('channel-formatter'),
63
+ hasSocialPack: text.includes('social-pack'),
64
+ hasCampaignPack: text.includes('campaign-pack'),
65
+ hasStrictFormat: text.includes('strict-format'),
66
+ hasSourceFidelity: text.includes('Source-Fidelity'),
67
+ hasUnsupportedClaims: text.includes('unsupported claims') || text.includes('Do not invent statistics'),
68
+ hasChannelPackUsage: text.includes('<channel|pack>'),
69
+ hasLinkedIn: text.includes('LinkedIn'),
70
+ hasTwitterThread: text.includes('Twitter/X thread'),
71
+ hasSlack: text.includes('Slack/Teams'),
72
+ };
73
+ }
74
+
75
+ async function mcp(url, label, body) {
76
+ const request = {
77
+ method: body.method,
78
+ tool: body.params?.name || null,
79
+ arguments: body.params?.arguments || null,
80
+ };
81
+ const res = await fetch(url, {
82
+ method: 'POST',
83
+ headers: {
84
+ 'Content-Type': 'application/json',
85
+ Accept: 'application/json, text/event-stream',
86
+ 'User-Agent': 'rdc-channel-formatter-contract-test',
87
+ },
88
+ body: JSON.stringify(body),
89
+ });
90
+ const raw = await res.text();
91
+ let json = null;
92
+ if (raw.includes('data:')) {
93
+ for (const line of raw.split('\n')) {
94
+ if (line.startsWith('data:')) json = JSON.parse(line.slice(5).trim());
95
+ }
96
+ } else if (raw.trim()) {
97
+ json = JSON.parse(raw);
98
+ }
99
+ const text = resultText(json);
100
+ log({
101
+ kind: 'mcp_call',
102
+ label,
103
+ url,
104
+ request,
105
+ status: res.status,
106
+ response: {
107
+ hasError: Boolean(json?.error),
108
+ text: summarizeText(text),
109
+ resultKeys: json?.result ? Object.keys(json.result) : [],
110
+ },
111
+ });
112
+ return { status: res.status, json, text };
113
+ }
114
+
115
+ async function waitHealth(url) {
116
+ for (let i = 0; i < 40; i++) {
117
+ try {
118
+ const res = await fetch(url);
119
+ if (res.ok) return await res.json();
120
+ } catch {
121
+ // wait and retry
122
+ }
123
+ await new Promise((resolve) => setTimeout(resolve, 150));
124
+ }
125
+ throw new Error(`health check timed out: ${url}`);
126
+ }
127
+
128
+ function inspectFormatterBody(body, prefix) {
129
+ const required = [
130
+ ['usage <channel|pack>', '<channel|pack>'],
131
+ ['social-pack mode', 'social-pack'],
132
+ ['campaign-pack mode', 'campaign-pack'],
133
+ ['exec-pack mode', 'exec-pack'],
134
+ ['launch-pack mode', 'launch-pack'],
135
+ ['strict-format mode', 'strict-format'],
136
+ ['long-source extraction', 'Long-Source Extraction'],
137
+ ['source-fidelity rules', 'Source-Fidelity'],
138
+ ['unsupported-claims guard', 'unsupported claims'],
139
+ ['LinkedIn pack output', 'LinkedIn thought-leadership post'],
140
+ ['Twitter thread pack output', 'Twitter/X thread'],
141
+ ['Slack pack output', 'Slack/Teams internal share'],
142
+ ['convert delegate', 'rdc:convert'],
143
+ ['brochure delegate', 'rdc:brochure'],
144
+ ['brochurify delegate', 'rdc:brochurify'],
145
+ ['brochure author delegate', 'lifeai-brochure-author'],
146
+ ];
147
+ for (const [name, needle] of required) {
148
+ check(`${prefix}: body contains ${name}`, body.includes(needle), needle);
149
+ }
150
+ }
151
+
152
+ function unitChecks() {
153
+ const names = listSkills().map((skill) => skill.name);
154
+ check('unit: channel-formatter in local catalog', names.includes('channel-formatter'));
155
+ for (const specialist of ['convert', 'brochure', 'rdc-brochurify', 'lifeai-brochure-author']) {
156
+ check(`unit: specialist present ${specialist}`, names.includes(specialist));
157
+ }
158
+ const results = searchSkills('turn this article into social posts');
159
+ check('unit: search top hit is channel-formatter', results[0]?.name === 'channel-formatter', results[0]?.name || 'none');
160
+ inspectFormatterBody(getSkillBody('channel-formatter') || '', 'unit');
161
+ }
162
+
163
+ async function endpointChecks(url, label) {
164
+ await mcp(url, label, {
165
+ jsonrpc: '2.0',
166
+ id: `${label}-init`,
167
+ method: 'initialize',
168
+ params: {
169
+ protocolVersion: '2024-11-05',
170
+ capabilities: {},
171
+ clientInfo: { name: 'rdc-channel-formatter-contract-test', version: '1' },
172
+ },
173
+ });
174
+
175
+ const list = await mcp(url, label, {
176
+ jsonrpc: '2.0',
177
+ id: `${label}-list`,
178
+ method: 'tools/call',
179
+ params: { name: 'rdc_skill_list', arguments: {} },
180
+ });
181
+ const catalog = JSON.parse(list.text || '{"skills":[]}');
182
+ const names = catalog.skills.map((skill) => skill.name);
183
+ check(`${label}: list includes channel-formatter`, names.includes('channel-formatter'));
184
+ for (const specialist of ['convert', 'brochure', 'rdc-brochurify', 'lifeai-brochure-author']) {
185
+ check(`${label}: list includes ${specialist}`, names.includes(specialist));
186
+ }
187
+
188
+ const search = await mcp(url, label, {
189
+ jsonrpc: '2.0',
190
+ id: `${label}-search-social`,
191
+ method: 'tools/call',
192
+ params: { name: 'rdc_skill_search', arguments: { query: 'turn this article into social posts' } },
193
+ });
194
+ const searchPayload = JSON.parse(search.text || '{"results":[]}');
195
+ check(
196
+ `${label}: article-to-social search routes to channel-formatter`,
197
+ searchPayload.results[0]?.name === 'channel-formatter',
198
+ searchPayload.results[0]?.name || 'none',
199
+ );
200
+
201
+ const get = await mcp(url, label, {
202
+ jsonrpc: '2.0',
203
+ id: `${label}-get-formatter`,
204
+ method: 'tools/call',
205
+ params: { name: 'rdc_skill_get', arguments: { name: 'channel-formatter', variant: 'cli' } },
206
+ });
207
+ inspectFormatterBody(get.text, label);
208
+ }
209
+
210
+ async function main() {
211
+ log({ kind: 'test_start', reportFile: REPORT_FILE });
212
+ unitChecks();
213
+
214
+ const proc = spawn('node', [BIN], {
215
+ env: { ...process.env, PORT: String(TEST_PORT) },
216
+ stdio: 'ignore',
217
+ });
218
+ try {
219
+ const health = await waitHealth(LOCAL_HEALTH);
220
+ log({ kind: 'health', label: 'integration', health });
221
+ check('integration: local test server healthy', health.status === 'ok');
222
+ await endpointChecks(LOCAL, 'integration');
223
+ } finally {
224
+ proc.kill();
225
+ }
226
+
227
+ if (process.env.REMOTE || process.argv.includes('--remote')) {
228
+ const health = await (await fetch('https://rdc-skills.regendevcorp.com/health')).json();
229
+ log({ kind: 'health', label: 'systems', health });
230
+ check('systems: remote version is at least 0.24.8', /^0\.(2[4-9]|[3-9]\d)\./.test(health.version), health.version);
231
+ check('systems: remote skill count includes full catalog', health.skills >= 29, String(health.skills));
232
+ await endpointChecks(REMOTE, 'systems');
233
+ } else {
234
+ log({ kind: 'systems_skipped', reason: 'set REMOTE=1 or pass --remote' });
235
+ }
236
+
237
+ log({ kind: 'test_end', pass, fail, failures });
238
+ console.log(`channel-formatter contract: ${pass} passed, ${fail} failed`);
239
+ console.log(`audit log: ${REPORT_FILE}`);
240
+ if (fail) {
241
+ for (const failure of failures) console.log(`FAIL: ${failure}`);
242
+ process.exit(1);
243
+ }
244
+ }
245
+
246
+ main().catch((error) => {
247
+ log({ kind: 'fatal', message: error?.message || String(error), stack: error?.stack || '' });
248
+ console.error(error);
249
+ process.exit(1);
250
+ });
251
+