@lifeaitools/rdc-skills 0.24.19 → 0.24.20

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.19",
3
+ "version": "0.24.20",
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": "9c73b2cb3e0d6caedfd64996cc3ce587344d5859"
2
+ "sha": "6c11154723bb4894e223f36cce8f0aac8e651a67"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifeaitools/rdc-skills",
3
- "version": "0.24.19",
3
+ "version": "0.24.20",
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,10 +35,12 @@
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 && node tests/install-rdc-skills.test.mjs && node tests/help-surface.test.mjs && node tests/manifest-contract-fields.test.mjs",
38
+ "test:acceptance": "node tests/acceptance.test.mjs && node tests/install-rdc-skills.test.mjs && node tests/help-surface.test.mjs && node tests/manifest-contract-fields.test.mjs && node tests/curl-surface.test.mjs",
39
39
  "acceptance": "node scripts/acceptance.mjs --changed",
40
40
  "test:mcp": "node tests/mcp.test.mjs",
41
41
  "test:mcp:remote": "node tests/mcp.test.mjs --remote",
42
+ "test:curl-surface": "node tests/curl-surface.test.mjs",
43
+ "test:curl-surface:remote": "node tests/curl-surface.test.mjs --remote",
42
44
  "test:channel-formatter": "node tests/channel-formatter.contract.test.mjs",
43
45
  "test:channel-formatter:remote": "node tests/channel-formatter.contract.test.mjs --remote",
44
46
  "mcp": "node bin/rdc-skills-mcp.mjs",
@@ -0,0 +1,219 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Direct HTTP/curl contract for callers outside Claude/Codex.
4
+ *
5
+ * This test intentionally shells out to curl instead of using fetch so the
6
+ * documented MCP entry point is exercised through the same path a raw caller
7
+ * copies from README/help: POST /mcp, Streamable HTTP Accept header, SSE
8
+ * response, JSON-RPC envelope on data:, tool text at result.content[0].text.
9
+ */
10
+
11
+ import { spawn, spawnSync } from 'node:child_process';
12
+ import fs from 'node:fs';
13
+ import path from 'node:path';
14
+ import { fileURLToPath } from 'node:url';
15
+
16
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
17
+ const REPO_ROOT = path.resolve(__dirname, '..');
18
+ const BIN = path.join(REPO_ROOT, 'bin', 'rdc-skills-mcp.mjs');
19
+ const TEST_PORT = parseInt(process.env.TEST_PORT || '3199', 10);
20
+ const LOCAL = `http://127.0.0.1:${TEST_PORT}`;
21
+ const REMOTE = 'https://rdc-skills.regendevcorp.com';
22
+ const TARGET = process.env.REMOTE || process.argv.includes('--remote') ? REMOTE : LOCAL;
23
+ const REPORT_DIR = path.join(REPO_ROOT, '.rdc', 'reports');
24
+ const REPORT_FILE = path.join(
25
+ REPORT_DIR,
26
+ `curl-surface-${new Date().toISOString().replace(/[:.]/g, '-')}.jsonl`,
27
+ );
28
+
29
+ fs.mkdirSync(REPORT_DIR, { recursive: true });
30
+
31
+ let pass = 0;
32
+ let fail = 0;
33
+ const failures = [];
34
+
35
+ function log(event) {
36
+ fs.appendFileSync(REPORT_FILE, `${JSON.stringify({ ts: new Date().toISOString(), ...event })}\n`);
37
+ }
38
+
39
+ function check(name, condition, detail = '') {
40
+ if (condition) {
41
+ pass++;
42
+ log({ kind: 'assertion', name, status: 'pass', detail });
43
+ } else {
44
+ fail++;
45
+ failures.push(`${name}${detail ? ` - ${detail}` : ''}`);
46
+ log({ kind: 'assertion', name, status: 'fail', detail });
47
+ }
48
+ }
49
+
50
+ function curl(args, label) {
51
+ const res = spawnSync('curl', args, {
52
+ cwd: REPO_ROOT,
53
+ encoding: 'utf8',
54
+ windowsHide: true,
55
+ maxBuffer: 10 * 1024 * 1024,
56
+ });
57
+ const stdout = res.stdout || '';
58
+ const stderr = res.stderr || '';
59
+ log({
60
+ kind: 'curl_call',
61
+ label,
62
+ args,
63
+ status: res.status,
64
+ stdoutPrefix: stdout.slice(0, 500),
65
+ stderrPrefix: stderr.slice(0, 500),
66
+ });
67
+ return { status: res.status, stdout, stderr };
68
+ }
69
+
70
+ function postMcp(payload, label) {
71
+ return curl([
72
+ '-s',
73
+ '-X', 'POST',
74
+ `${TARGET}/mcp`,
75
+ '-H', 'Content-Type: application/json',
76
+ '-H', 'Accept: application/json, text/event-stream',
77
+ '-d', JSON.stringify(payload),
78
+ ], label);
79
+ }
80
+
81
+ function parseSse(raw) {
82
+ const envelopes = [];
83
+ for (const line of raw.split(/\r?\n/)) {
84
+ if (!line.startsWith('data:')) continue;
85
+ const text = line.slice(5).trim();
86
+ if (!text) continue;
87
+ envelopes.push(JSON.parse(text));
88
+ }
89
+ return envelopes;
90
+ }
91
+
92
+ function latestEnvelope(raw) {
93
+ const envelopes = parseSse(raw);
94
+ return envelopes.at(-1) || null;
95
+ }
96
+
97
+ function resultText(json) {
98
+ return json?.result?.content?.[0]?.text || '';
99
+ }
100
+
101
+ async function waitHealth() {
102
+ for (let i = 0; i < 40; i++) {
103
+ const res = curl(['-s', `${TARGET}/health`], 'health');
104
+ if (res.status === 0) {
105
+ try {
106
+ const health = JSON.parse(res.stdout);
107
+ if (health.status === 'ok') return health;
108
+ } catch {
109
+ // wait and retry
110
+ }
111
+ }
112
+ await new Promise((resolve) => setTimeout(resolve, 150));
113
+ }
114
+ throw new Error(`health check timed out: ${TARGET}/health`);
115
+ }
116
+
117
+ async function main() {
118
+ const hasCurl = spawnSync('curl', ['--version'], { encoding: 'utf8', windowsHide: true });
119
+ check('curl executable is available', hasCurl.status === 0, hasCurl.stderr || hasCurl.error?.message || '');
120
+ if (hasCurl.status !== 0) throw new Error('curl is required for direct caller surface tests');
121
+
122
+ let proc = null;
123
+ if (TARGET === LOCAL) {
124
+ proc = spawn('node', [BIN], {
125
+ cwd: REPO_ROOT,
126
+ env: { ...process.env, PORT: String(TEST_PORT) },
127
+ stdio: 'ignore',
128
+ windowsHide: true,
129
+ });
130
+ }
131
+
132
+ try {
133
+ const health = await waitHealth();
134
+ check('health reports ok', health.status === 'ok');
135
+ check('health reports 29 skills', health.skills === 29, `skills ${health.skills}`);
136
+
137
+ const init = postMcp({
138
+ jsonrpc: '2.0',
139
+ id: 1,
140
+ method: 'initialize',
141
+ params: {
142
+ protocolVersion: '2024-11-05',
143
+ capabilities: {},
144
+ clientInfo: { name: 'curl', version: '1' },
145
+ },
146
+ }, 'initialize');
147
+ check('initialize curl exits 0', init.status === 0, init.stderr);
148
+ check('initialize returns SSE data line', /^data:/m.test(init.stdout));
149
+ const initJson = latestEnvelope(init.stdout);
150
+ check('initialize serverInfo name', initJson?.result?.serverInfo?.name === 'rdc-skills');
151
+
152
+ const list = postMcp({
153
+ jsonrpc: '2.0',
154
+ id: 2,
155
+ method: 'tools/call',
156
+ params: { name: 'rdc_skill_list', arguments: {} },
157
+ }, 'rdc_skill_list');
158
+ check('rdc_skill_list curl exits 0', list.status === 0, list.stderr);
159
+ check('rdc_skill_list returns SSE data line', /^data:/m.test(list.stdout));
160
+ const listed = JSON.parse(resultText(latestEnvelope(list.stdout)));
161
+ check('rdc_skill_list exposes 29 skills', listed.count === 29, `count ${listed.count}`);
162
+ check('rdc_skill_list includes visible slash name', listed.skills.some((s) => s.slash === 'rdc:build'));
163
+
164
+ const search = postMcp({
165
+ jsonrpc: '2.0',
166
+ id: 3,
167
+ method: 'tools/call',
168
+ params: {
169
+ name: 'rdc_skill_search',
170
+ arguments: { query: 'turn this article into social posts' },
171
+ },
172
+ }, 'rdc_skill_search');
173
+ check('rdc_skill_search curl exits 0', search.status === 0, search.stderr);
174
+ const searchBody = JSON.parse(resultText(latestEnvelope(search.stdout)));
175
+ check(
176
+ 'natural language search finds channel formatter',
177
+ searchBody.results?.some((s) => s.name === 'channel-formatter' || s.slash === 'rdc:channel-formatter'),
178
+ );
179
+
180
+ const get = postMcp({
181
+ jsonrpc: '2.0',
182
+ id: 4,
183
+ method: 'tools/call',
184
+ params: {
185
+ name: 'rdc_skill_get',
186
+ arguments: { name: 'rdc:build', variant: 'cli' },
187
+ },
188
+ }, 'rdc_skill_get');
189
+ check('rdc_skill_get curl exits 0', get.status === 0, get.stderr);
190
+ const getText = resultText(latestEnvelope(get.stdout));
191
+ check('rdc_skill_get returns tool text path', getText.length > 500, `length ${getText.length}`);
192
+ check('rdc_skill_get accepts visible rdc:build alias', /rdc:build/i.test(getText));
193
+
194
+ const badAccept = curl([
195
+ '-s',
196
+ '-X', 'POST',
197
+ `${TARGET}/mcp`,
198
+ '-H', 'Content-Type: application/json',
199
+ '-d', JSON.stringify({ jsonrpc: '2.0', id: 5, method: 'tools/list' }),
200
+ ], 'missing_accept_header');
201
+ check('missing Accept header still returns inspectable response', badAccept.status === 0, badAccept.stderr);
202
+ check('missing Accept header mentions Accept or returns JSON/SSE', /Accept|data:|jsonrpc|result/i.test(badAccept.stdout));
203
+ } finally {
204
+ if (proc) proc.kill();
205
+ }
206
+
207
+ console.log(`curl surface: ${pass} passed, ${fail} failed`);
208
+ console.log(`audit log: ${REPORT_FILE}`);
209
+ if (fail) {
210
+ console.log('FAILURES:');
211
+ for (const f of failures) console.log(` - ${f}`);
212
+ process.exit(1);
213
+ }
214
+ }
215
+
216
+ main().catch((err) => {
217
+ console.error('curl surface test error:', err);
218
+ process.exit(1);
219
+ });