@lifeaitools/rdc-skills 0.9.37 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +14 -0
- package/commands/deploy.md +4 -4
- package/commands/design.md +1 -1
- package/commands/overnight.md +2 -2
- package/commands/release.md +29 -139
- package/commands/self-test.md +1 -1
- package/commands/watch.md +1 -1
- package/guides/agent-bootstrap.md +2 -2
- package/guides/history-md-spec.md +297 -0
- package/guides/publish-md-spec.md +289 -0
- package/hooks/check-cwd.js +3 -3
- package/hooks/no-stop-open-epics.js +9 -7
- package/hooks/require-work-item-on-commit.js +2 -1
- package/package.json +11 -3
- package/scaffold/templates/HISTORY.md.template +39 -0
- package/scaffold/templates/PUBLISH.md.template +21 -0
- package/scripts/install-rdc-skills.js +6 -2
- package/scripts/validate-place-histories.js +461 -0
- package/scripts/validate-publish-manifests.js +424 -0
- package/skills/build/SKILL.md +30 -3
- package/skills/co-develop/SKILL.md +1 -1
- package/skills/deploy/SKILL.md +108 -12
- package/skills/design/SKILL.md +6 -6
- package/skills/fixit/SKILL.md +26 -1
- package/skills/fs-mcp/SKILL.md +2 -2
- package/skills/overnight/SKILL.md +3 -1
- package/skills/plan/SKILL.md +2 -2
- package/skills/release/SKILL.md +64 -295
- package/skills/review/SKILL.md +27 -1
- package/skills/self-test/SKILL.md +3 -3
- package/skills/terminal-config/SKILL.md +34 -189
- package/skills/watch/SKILL.md +1 -1
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* validate-publish-manifests.js
|
|
4
|
+
* WP-6: PUBLISH.md convention validator for rdc-skills
|
|
5
|
+
*
|
|
6
|
+
* Queries app_deployments (active rows), checks PUBLISH.md presence + schema
|
|
7
|
+
* for each registered deployable target.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* node scripts/validate-publish-manifests.js [--mode warn|fail] [--slug <name>] [--json] [--strict]
|
|
11
|
+
*
|
|
12
|
+
* Exit codes:
|
|
13
|
+
* 0 — all checks passed (or warn mode with only warnings)
|
|
14
|
+
* 1 — one or more FAIL lines (hard error)
|
|
15
|
+
* 2 — invocation error (bad args)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
const fs = require('fs');
|
|
21
|
+
const path = require('path');
|
|
22
|
+
const https = require('https');
|
|
23
|
+
const http = require('http');
|
|
24
|
+
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// CLI argument parsing
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
|
|
29
|
+
const args = process.argv.slice(2);
|
|
30
|
+
let mode = 'warn'; // warn | fail
|
|
31
|
+
let slugFilter = null; // --slug <name>
|
|
32
|
+
let jsonOutput = false; // --json
|
|
33
|
+
let strict = false; // --strict (same as --mode fail)
|
|
34
|
+
|
|
35
|
+
for (let i = 0; i < args.length; i++) {
|
|
36
|
+
const a = args[i];
|
|
37
|
+
if (a === '--mode') {
|
|
38
|
+
const v = args[++i];
|
|
39
|
+
if (v !== 'warn' && v !== 'fail') {
|
|
40
|
+
console.error('ERROR: --mode must be warn or fail');
|
|
41
|
+
process.exit(2);
|
|
42
|
+
}
|
|
43
|
+
mode = v;
|
|
44
|
+
} else if (a === '--slug') {
|
|
45
|
+
slugFilter = args[++i];
|
|
46
|
+
if (!slugFilter) {
|
|
47
|
+
console.error('ERROR: --slug requires a value');
|
|
48
|
+
process.exit(2);
|
|
49
|
+
}
|
|
50
|
+
} else if (a === '--json') {
|
|
51
|
+
jsonOutput = true;
|
|
52
|
+
} else if (a === '--strict') {
|
|
53
|
+
strict = true;
|
|
54
|
+
mode = 'fail';
|
|
55
|
+
} else {
|
|
56
|
+
console.error(`ERROR: unknown argument: ${a}`);
|
|
57
|
+
process.exit(2);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
// Constants
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
|
|
65
|
+
const MONOREPO_ROOT = 'C:/Dev/regen-root';
|
|
66
|
+
const CLAUTH_BASE = 'http://127.0.0.1:52437';
|
|
67
|
+
|
|
68
|
+
// Ordered list of root-relative prefixes to probe when looking for app source
|
|
69
|
+
const MONOREPO_SEARCH_DIRS = ['apps', 'sites', 'models', 'mcp-servers', 'packages'];
|
|
70
|
+
|
|
71
|
+
const REQUIRED_FRONTMATTER_FIELDS = ['schema_version', 'entity_slug', 'artifact_type', 'environments', 'status'];
|
|
72
|
+
const ALLOWED_ARTIFACT_TYPES = ['website', 'api', 'package', 'worker', 'mcp-server'];
|
|
73
|
+
const ALLOWED_STATUSES = ['active', 'draft', 'deprecated'];
|
|
74
|
+
const ALLOWED_ENVIRONMENTS = ['dev', 'prod'];
|
|
75
|
+
const ALLOWED_SCHEMA_VERSIONS = ['1.0'];
|
|
76
|
+
|
|
77
|
+
// Supabase project and REST base
|
|
78
|
+
const SUPABASE_PROJECT_HOST = 'uvojezuorjgqzmhhgluu.supabase.co';
|
|
79
|
+
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
// Result tracking
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
|
|
84
|
+
const results = [];
|
|
85
|
+
let hasHardFail = false;
|
|
86
|
+
|
|
87
|
+
function emit(level, slug, message, detail) {
|
|
88
|
+
const entry = { level, slug, message, detail: detail || null };
|
|
89
|
+
results.push(entry);
|
|
90
|
+
if (level === 'FAIL') hasHardFail = true;
|
|
91
|
+
if (!jsonOutput) {
|
|
92
|
+
const prefix = level === 'FAIL' ? '✗ FAIL' : level === 'WARN' ? '⚠ WARN' : '✓ PASS';
|
|
93
|
+
console.log(`${prefix} [${slug}] ${message}${detail ? ` — ${detail}` : ''}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
// HTTP helpers
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
|
|
101
|
+
/** Fetch plain text from clauth daemon (never prints value) */
|
|
102
|
+
function fetchClauth(service) {
|
|
103
|
+
return new Promise((resolve, reject) => {
|
|
104
|
+
const req = http.get(`${CLAUTH_BASE}/v/${service}`, (res) => {
|
|
105
|
+
let buf = '';
|
|
106
|
+
res.on('data', (c) => (buf += c));
|
|
107
|
+
res.on('end', () => {
|
|
108
|
+
if (res.statusCode !== 200) {
|
|
109
|
+
reject(new Error(`clauth /v/${service} → HTTP ${res.statusCode}`));
|
|
110
|
+
} else {
|
|
111
|
+
resolve(buf.trim());
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
req.on('error', reject);
|
|
116
|
+
req.setTimeout(5000, () => { req.destroy(); reject(new Error('clauth timeout')); });
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** REST GET against Supabase with anon key */
|
|
121
|
+
function supabaseGet(anonKey, path) {
|
|
122
|
+
return new Promise((resolve, reject) => {
|
|
123
|
+
const options = {
|
|
124
|
+
hostname: SUPABASE_PROJECT_HOST,
|
|
125
|
+
path,
|
|
126
|
+
method: 'GET',
|
|
127
|
+
headers: {
|
|
128
|
+
'apikey': anonKey,
|
|
129
|
+
'Authorization': `Bearer ${anonKey}`,
|
|
130
|
+
'Content-Type': 'application/json',
|
|
131
|
+
'Accept': 'application/json',
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
const req = https.request(options, (res) => {
|
|
135
|
+
let buf = '';
|
|
136
|
+
res.on('data', (c) => (buf += c));
|
|
137
|
+
res.on('end', () => {
|
|
138
|
+
if (res.statusCode !== 200) {
|
|
139
|
+
reject(new Error(`Supabase REST ${path} → HTTP ${res.statusCode}: ${buf.slice(0, 200)}`));
|
|
140
|
+
} else {
|
|
141
|
+
try {
|
|
142
|
+
resolve(JSON.parse(buf));
|
|
143
|
+
} catch (e) {
|
|
144
|
+
reject(new Error(`JSON parse error: ${e.message}`));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
req.on('error', reject);
|
|
150
|
+
req.setTimeout(10000, () => { req.destroy(); reject(new Error('Supabase timeout')); });
|
|
151
|
+
req.end();
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// ---------------------------------------------------------------------------
|
|
156
|
+
// YAML frontmatter parser (minimal — no external dep required)
|
|
157
|
+
// ---------------------------------------------------------------------------
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Parse YAML frontmatter from a PUBLISH.md string.
|
|
161
|
+
* Only handles scalar values, arrays on same line ([a, b, c]), and quoted strings.
|
|
162
|
+
* Returns null if no frontmatter delimiters found.
|
|
163
|
+
*/
|
|
164
|
+
function parseFrontmatter(content) {
|
|
165
|
+
const fmMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
166
|
+
if (!fmMatch) return null;
|
|
167
|
+
|
|
168
|
+
const yaml = fmMatch[1];
|
|
169
|
+
const result = {};
|
|
170
|
+
|
|
171
|
+
for (const line of yaml.split(/\r?\n/)) {
|
|
172
|
+
const kv = line.match(/^([a-zA-Z_][a-zA-Z0-9_]*):\s*(.*)$/);
|
|
173
|
+
if (!kv) continue;
|
|
174
|
+
|
|
175
|
+
const key = kv[1];
|
|
176
|
+
let value = kv[2].trim();
|
|
177
|
+
|
|
178
|
+
// Array: [a, b, c] or [a] or []
|
|
179
|
+
if (value.startsWith('[') && value.endsWith(']')) {
|
|
180
|
+
const inner = value.slice(1, -1).trim();
|
|
181
|
+
result[key] = inner ? inner.split(',').map((s) => s.trim().replace(/^["']|["']$/g, '')) : [];
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Quoted string
|
|
186
|
+
if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
|
|
187
|
+
result[key] = value.slice(1, -1);
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
result[key] = value;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return result;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Extract surface section IDs from PUBLISH.md content.
|
|
199
|
+
* Looks for <!-- SURFACE:<id> --> markers.
|
|
200
|
+
*/
|
|
201
|
+
function parseSurfaceIds(content) {
|
|
202
|
+
const ids = [];
|
|
203
|
+
const re = /<!--\s*SURFACE:([a-zA-Z0-9_-]+)\s*-->/g;
|
|
204
|
+
let m;
|
|
205
|
+
while ((m = re.exec(content)) !== null) {
|
|
206
|
+
ids.push(m[1]);
|
|
207
|
+
}
|
|
208
|
+
return ids;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Extract watch_paths from a named surface section.
|
|
213
|
+
* Returns array of watch_path strings (may be empty).
|
|
214
|
+
*/
|
|
215
|
+
function parseSurfaceWatchPaths(content, surfaceId) {
|
|
216
|
+
const re = new RegExp(`<!--\\s*SURFACE:${surfaceId}\\s*-->[\\s\\S]*?<!--\\s*/SURFACE:${surfaceId}\\s*-->`, 'i');
|
|
217
|
+
const section = content.match(re);
|
|
218
|
+
if (!section) return [];
|
|
219
|
+
|
|
220
|
+
const block = section[0];
|
|
221
|
+
const watchPathsMatch = block.match(/watch_paths:\s*\r?\n((?:\s+-\s+.+\r?\n?)*)/);
|
|
222
|
+
if (!watchPathsMatch) return [];
|
|
223
|
+
|
|
224
|
+
return watchPathsMatch[1]
|
|
225
|
+
.split(/\r?\n/)
|
|
226
|
+
.map((l) => l.replace(/^\s+-\s+/, '').trim())
|
|
227
|
+
.filter(Boolean);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// ---------------------------------------------------------------------------
|
|
231
|
+
// Path resolution
|
|
232
|
+
// ---------------------------------------------------------------------------
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Derive the local filesystem path where we'd expect PUBLISH.md for a given app_slug.
|
|
236
|
+
* Probes MONOREPO_SEARCH_DIRS in order, returning the first hit.
|
|
237
|
+
* Returns null if no directory found (standalone or unknown).
|
|
238
|
+
*/
|
|
239
|
+
function resolveAppRoot(slug) {
|
|
240
|
+
for (const dir of MONOREPO_SEARCH_DIRS) {
|
|
241
|
+
const candidate = path.join(MONOREPO_ROOT, dir, slug);
|
|
242
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
243
|
+
}
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// ---------------------------------------------------------------------------
|
|
248
|
+
// Validation logic for a single app row
|
|
249
|
+
// ---------------------------------------------------------------------------
|
|
250
|
+
|
|
251
|
+
function validateApp(slug) {
|
|
252
|
+
const appRoot = resolveAppRoot(slug);
|
|
253
|
+
|
|
254
|
+
if (!appRoot) {
|
|
255
|
+
// Could be standalone repo — skip with note in v1
|
|
256
|
+
emit('WARN', slug, 'app root not found in monorepo — may be standalone repo, skipping (v1 scope)');
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const publishPath = path.join(appRoot, 'PUBLISH.md');
|
|
261
|
+
|
|
262
|
+
if (!fs.existsSync(publishPath)) {
|
|
263
|
+
if (mode === 'fail') {
|
|
264
|
+
emit('FAIL', slug, 'PUBLISH.md missing', publishPath);
|
|
265
|
+
} else {
|
|
266
|
+
emit('WARN', slug, 'PUBLISH.md missing', publishPath);
|
|
267
|
+
}
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// File exists — parse and validate
|
|
272
|
+
const content = fs.readFileSync(publishPath, 'utf8');
|
|
273
|
+
const fm = parseFrontmatter(content);
|
|
274
|
+
|
|
275
|
+
if (!fm) {
|
|
276
|
+
emit('FAIL', slug, 'PUBLISH.md has no YAML frontmatter (missing --- delimiters)', publishPath);
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
let ok = true;
|
|
281
|
+
|
|
282
|
+
// Check required fields
|
|
283
|
+
for (const field of REQUIRED_FRONTMATTER_FIELDS) {
|
|
284
|
+
if (fm[field] === undefined || fm[field] === null || fm[field] === '') {
|
|
285
|
+
emit('FAIL', slug, `PUBLISH.md missing required field: ${field}`, publishPath);
|
|
286
|
+
ok = false;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// schema_version
|
|
291
|
+
if (fm.schema_version && !ALLOWED_SCHEMA_VERSIONS.includes(fm.schema_version)) {
|
|
292
|
+
emit('FAIL', slug, `PUBLISH.md schema_version "${fm.schema_version}" not in allowed set: ${ALLOWED_SCHEMA_VERSIONS.join(', ')}`, publishPath);
|
|
293
|
+
ok = false;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// artifact_type
|
|
297
|
+
if (fm.artifact_type && !ALLOWED_ARTIFACT_TYPES.includes(fm.artifact_type)) {
|
|
298
|
+
emit('FAIL', slug, `PUBLISH.md artifact_type "${fm.artifact_type}" not in allowed set: ${ALLOWED_ARTIFACT_TYPES.join(', ')}`, publishPath);
|
|
299
|
+
ok = false;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// status
|
|
303
|
+
if (fm.status && !ALLOWED_STATUSES.includes(fm.status)) {
|
|
304
|
+
emit('FAIL', slug, `PUBLISH.md status "${fm.status}" not in allowed set: ${ALLOWED_STATUSES.join(', ')}`, publishPath);
|
|
305
|
+
ok = false;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// environments — must be array, at least one, each in allowed set
|
|
309
|
+
if (fm.environments !== undefined) {
|
|
310
|
+
if (!Array.isArray(fm.environments) || fm.environments.length === 0) {
|
|
311
|
+
emit('FAIL', slug, 'PUBLISH.md environments must be a non-empty array', publishPath);
|
|
312
|
+
ok = false;
|
|
313
|
+
} else {
|
|
314
|
+
for (const env of fm.environments) {
|
|
315
|
+
if (!ALLOWED_ENVIRONMENTS.includes(env)) {
|
|
316
|
+
emit('FAIL', slug, `PUBLISH.md environments contains unknown value: "${env}"`, publishPath);
|
|
317
|
+
ok = false;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// Surface sections — at least one required
|
|
324
|
+
const surfaceIds = parseSurfaceIds(content);
|
|
325
|
+
if (surfaceIds.length === 0) {
|
|
326
|
+
emit('FAIL', slug, 'PUBLISH.md has no <!-- SURFACE:<id> --> sections', publishPath);
|
|
327
|
+
ok = false;
|
|
328
|
+
} else {
|
|
329
|
+
// Each surface must have watch_paths
|
|
330
|
+
for (const sid of surfaceIds) {
|
|
331
|
+
const wp = parseSurfaceWatchPaths(content, sid);
|
|
332
|
+
if (wp.length === 0) {
|
|
333
|
+
emit('FAIL', slug, `PUBLISH.md surface "${sid}" has no watch_paths entries`, publishPath);
|
|
334
|
+
ok = false;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (ok) {
|
|
340
|
+
emit('PASS', slug, 'PUBLISH.md valid', `${surfaceIds.length} surface(s): ${surfaceIds.join(', ')}`);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return { fm, surfaceIds, publishPath };
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// ---------------------------------------------------------------------------
|
|
347
|
+
// Main
|
|
348
|
+
// ---------------------------------------------------------------------------
|
|
349
|
+
|
|
350
|
+
async function main() {
|
|
351
|
+
if (!jsonOutput) {
|
|
352
|
+
console.log(`\nvalidate-publish-manifests — mode=${mode}${slugFilter ? ` slug=${slugFilter}` : ''}\n`);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// 1. Get Supabase anon key from clauth
|
|
356
|
+
let anonKey;
|
|
357
|
+
try {
|
|
358
|
+
anonKey = await fetchClauth('supabase-anon');
|
|
359
|
+
} catch (err) {
|
|
360
|
+
console.error(`ERROR: cannot reach clauth daemon — ${err.message}`);
|
|
361
|
+
console.error('Fix: ensure clauth daemon is running at http://127.0.0.1:52437');
|
|
362
|
+
process.exit(1);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// 2. Query app_deployments for active rows
|
|
366
|
+
let rows;
|
|
367
|
+
try {
|
|
368
|
+
let qpath = '/rest/v1/app_deployments?status=eq.active&select=app_slug,environment,url&order=app_slug.asc';
|
|
369
|
+
if (slugFilter) {
|
|
370
|
+
qpath += `&app_slug=eq.${encodeURIComponent(slugFilter)}`;
|
|
371
|
+
}
|
|
372
|
+
rows = await supabaseGet(anonKey, qpath);
|
|
373
|
+
} catch (err) {
|
|
374
|
+
console.error(`ERROR: Supabase query failed — ${err.message}`);
|
|
375
|
+
process.exit(1);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
if (!Array.isArray(rows) || rows.length === 0) {
|
|
379
|
+
if (!jsonOutput) {
|
|
380
|
+
console.log(slugFilter ? `No active app_deployments row found for slug: ${slugFilter}` : 'No active app_deployments rows found.');
|
|
381
|
+
}
|
|
382
|
+
process.exit(0);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// Deduplicate slugs (same app_slug may have dev + prod rows)
|
|
386
|
+
const slugsSeen = new Set();
|
|
387
|
+
const uniqueRows = rows.filter((r) => {
|
|
388
|
+
if (slugsSeen.has(r.app_slug)) return false;
|
|
389
|
+
slugsSeen.add(r.app_slug);
|
|
390
|
+
return true;
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
if (!jsonOutput) {
|
|
394
|
+
console.log(`Checking ${uniqueRows.length} unique app slug(s) from ${rows.length} active app_deployments row(s)...\n`);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// 3. Validate each slug
|
|
398
|
+
for (const row of uniqueRows) {
|
|
399
|
+
validateApp(row.app_slug);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// 4. Summary
|
|
403
|
+
const passCount = results.filter((r) => r.level === 'PASS').length;
|
|
404
|
+
const warnCount = results.filter((r) => r.level === 'WARN').length;
|
|
405
|
+
const failCount = results.filter((r) => r.level === 'FAIL').length;
|
|
406
|
+
|
|
407
|
+
if (jsonOutput) {
|
|
408
|
+
console.log(JSON.stringify({ mode, results, summary: { pass: passCount, warn: warnCount, fail: failCount } }, null, 2));
|
|
409
|
+
} else {
|
|
410
|
+
console.log(`\nSummary: ${passCount} PASS · ${warnCount} WARN · ${failCount} FAIL`);
|
|
411
|
+
if (hasHardFail) {
|
|
412
|
+
console.log('Result: FAIL\n');
|
|
413
|
+
} else {
|
|
414
|
+
console.log(warnCount > 0 ? 'Result: WARN (exit 0 in warn mode)\n' : 'Result: PASS\n');
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
process.exit(hasHardFail ? 1 : 0);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
main().catch((err) => {
|
|
422
|
+
console.error(`FATAL: ${err.message}`);
|
|
423
|
+
process.exit(1);
|
|
424
|
+
});
|
package/skills/build/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rdc:build
|
|
3
|
-
description: "Usage `rdc:build <epic-id>` — You have a planned epic with tasks ready to execute. Dispatches parallel typed agents, each commits atomically to develop, closes work items, and runs the validator gate. Call after rdc:plan or when told to build."
|
|
3
|
+
description: "Usage `rdc:build <epic-id>` — You have a planned epic with tasks ready to execute. Dispatches parallel typed agents, each commits atomically to develop, runs a mandatory per-wave code-review gate (pr-review-toolkit:code-reviewer), closes work items, and runs the validator gate. Call after rdc:plan or when told to build."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
> **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
|
|
@@ -284,6 +284,7 @@ Read the task title and description, then:
|
|
|
284
284
|
fi
|
|
285
285
|
```
|
|
286
286
|
- Then run the post-wave test gate (Step 8) on the merged state
|
|
287
|
+
- Then run the code-review gate (Step 9b) before the next wave dispatches
|
|
287
288
|
- Continue to next wave
|
|
288
289
|
|
|
289
290
|
**If an agent fails (returns no worktree branch):**
|
|
@@ -293,6 +294,32 @@ Read the task title and description, then:
|
|
|
293
294
|
BUILD_STATUS: { wave, tasks_done, tasks_failed, commits, escalated: true }
|
|
294
295
|
```
|
|
295
296
|
|
|
297
|
+
9b. **Mandatory per-wave code-review gate (runs after merge + test gate, BEFORE next wave dispatches):**
|
|
298
|
+
|
|
299
|
+
⛔ **NO wave may dispatch until the previous wave's code-review pass clears.** Memory `feedback_code_review_per_wave.md` — Davesend 2026-05-24 incident.
|
|
300
|
+
|
|
301
|
+
Dispatch ONE `pr-review-toolkit:code-reviewer` agent with the wave's merged diff:
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
Agent({
|
|
305
|
+
subagent_type: "pr-review-toolkit:code-reviewer",
|
|
306
|
+
description: "Wave <N> code review",
|
|
307
|
+
prompt: "Review the diff `git diff <wave-base-sha>..HEAD` on develop.
|
|
308
|
+
Focus on: bugs, logic errors, security vulnerabilities, project-convention adherence
|
|
309
|
+
(.claude/rules/*, CLAUDE.md). Apply confidence-based filtering — high-confidence
|
|
310
|
+
findings only. Report severity per finding: critical | high | medium | low.
|
|
311
|
+
Return CODE_REVIEW_COMPLETE with: { critical_count, high_count, medium_count,
|
|
312
|
+
low_count, findings: [{severity, file:line, issue, suggested_fix}] }."
|
|
313
|
+
})
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**Severity gate (default — high+ blocks):**
|
|
317
|
+
- `critical` or `high` findings → reopen affected work items to `todo` with finding text in notes; fix in a new wave before continuing
|
|
318
|
+
- `medium` or `low` findings → append to each work item's `implementation_report.flags`; do NOT reopen; validator sees them
|
|
319
|
+
- Zero findings → log `CODE_REVIEW: CLEAN` and proceed to next wave
|
|
320
|
+
|
|
321
|
+
Under `RDC_TEST=1`: echo `[RDC_TEST] skipping code-review dispatch` and proceed.
|
|
322
|
+
|
|
296
323
|
10. **Mandatory validator gate (runs after ALL waves complete — before any work item closes):**
|
|
297
324
|
|
|
298
325
|
⛔ **NO work item may be set to `done` without the validator passing it.**
|
|
@@ -301,8 +328,8 @@ Read the task title and description, then:
|
|
|
301
328
|
⚠️ The validator does NOT use `isolation: "worktree"` — it must read the fully merged develop branch. Omit the isolation parameter for this dispatch only.
|
|
302
329
|
|
|
303
330
|
```
|
|
304
|
-
"Read
|
|
305
|
-
Read
|
|
331
|
+
"Read {PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md then {PROJECT_ROOT}/.rdc/guides/verify.md.
|
|
332
|
+
Read {PROJECT_ROOT}/.rdc/guides/engineering-behavior.md before validating scope, deviations, and evidence.
|
|
306
333
|
Validate these work items: [list of IDs and titles].
|
|
307
334
|
Apps touched: [list].
|
|
308
335
|
Git diff since build start: [attach or reference].
|
|
@@ -110,7 +110,7 @@ the source of truth.
|
|
|
110
110
|
"skill": "rdc:review",
|
|
111
111
|
"task": "Audit the current diff for regressions before merge.",
|
|
112
112
|
"context": {
|
|
113
|
-
"repo": "
|
|
113
|
+
"repo": "{PROJECT_ROOT}",
|
|
114
114
|
"work_item_id": "<optional-uuid>",
|
|
115
115
|
"branch": "develop",
|
|
116
116
|
"owned_files": []
|
package/skills/deploy/SKILL.md
CHANGED
|
@@ -44,6 +44,9 @@ rdc:deploy: <slug> → <domain>
|
|
|
44
44
|
[ ] Build-id resolved (default: HEAD of watched branch)
|
|
45
45
|
[ ] Env vars present in Coolify (compare to registry)
|
|
46
46
|
[ ] Type-specific preflight (see docs/runbooks/coolify-deploy-checklist.md)
|
|
47
|
+
[ ] Mandatory pre-deploy code-review (pr-review-toolkit:code-reviewer on `git diff <last-deployed-sha>..HEAD` for this app's paths). Block deploy on `critical`/`high` findings; record `medium`/`low` and proceed.
|
|
48
|
+
[ ] PUBLISH.md read from app root (warn if absent; fail if present but invalid)
|
|
49
|
+
[ ] watch_paths derived from PUBLISH.md surfaces (union of all surface watch_paths arrays) and updated in app_deployments
|
|
47
50
|
[ ] Deploy triggered
|
|
48
51
|
[ ] Deployment reached "finished" state
|
|
49
52
|
[ ] Gate: HTTP 200
|
|
@@ -51,6 +54,7 @@ rdc:deploy: <slug> → <domain>
|
|
|
51
54
|
[ ] Gate: cache headers correct on HTML
|
|
52
55
|
[ ] Gate: container running on declared port
|
|
53
56
|
[ ] Cloudflare cache purged (if proxied)
|
|
57
|
+
[ ] artifact_registry INSERT per PUBLISH.md surface (if PUBLISH.md present)
|
|
54
58
|
[ ] deployment_registry updated (last_deploy_at, status)
|
|
55
59
|
✅ rdc:deploy: <slug> deployed in Nm Ns
|
|
56
60
|
```
|
|
@@ -66,10 +70,10 @@ Template selection:
|
|
|
66
70
|
|
|
67
71
|
```
|
|
68
72
|
rdc:deploy new: <slug>
|
|
69
|
-
[ ] .dockerignore present at
|
|
73
|
+
[ ] .dockerignore present at project root (`ls {PROJECT_ROOT}/.dockerignore` — STOP if missing)
|
|
70
74
|
[ ] Template loaded from docs/runbooks/coolify-app-templates.json (pick nextjs-app / static-site / mcp-server)
|
|
71
75
|
[ ] Required vars substituted: NAME, APP_PATH, DOMAIN, BRANCH, PROJECT_UUID, ENVIRONMENT_UUID [+ TURBO_FILTER / PORT]
|
|
72
|
-
[ ] DNS path chosen (A:
|
|
76
|
+
[ ] DNS path chosen (A: staging wildcard B: apex C: other zone)
|
|
73
77
|
[ ] DNS record verified or wildcard confirmed
|
|
74
78
|
[ ] Cloudflare proxy setting correct for DNS path
|
|
75
79
|
[ ] Application created via POST /applications/private-github-app (template payload)
|
|
@@ -117,7 +121,7 @@ rdc:deploy audit: fleet scan
|
|
|
117
121
|
[ ] Env var drift (registry.env_vars_needed vs Coolify env)
|
|
118
122
|
[ ] Branch mismatches (Coolify git_branch ≠ expected)
|
|
119
123
|
[ ] Disk space on 64.237.54.189
|
|
120
|
-
[ ]
|
|
124
|
+
[ ] DNS/proxy misconfigs on configured staging wildcard
|
|
121
125
|
[ ] Duplicate apps (same repo, multiple UUIDs)
|
|
122
126
|
|
|
123
127
|
Findings:
|
|
@@ -134,6 +138,76 @@ Severity rules:
|
|
|
134
138
|
|
|
135
139
|
`--fix` auto-remediates only: missing watch_paths, registry row updates, CF cache purges. Never touches env vars, DNS, or container config without explicit confirmation.
|
|
136
140
|
|
|
141
|
+
## PUBLISH.md Integration
|
|
142
|
+
|
|
143
|
+
Every deploy reads `PUBLISH.md` from the app's source root to derive `watch_paths` and to register surfaces in Studio `artifact_registry`.
|
|
144
|
+
|
|
145
|
+
### Step 6 — Read PUBLISH.md from the app root
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
MONOREPO_PATH=$(get_app_deployments_monorepo_path "$SLUG")
|
|
149
|
+
PUBLISH_MD="$MONOREPO_PATH/PUBLISH.md"
|
|
150
|
+
|
|
151
|
+
if [ ! -f "$PUBLISH_MD" ]; then
|
|
152
|
+
echo "WARN: PUBLISH.md missing for $SLUG — using app_deployments.watch_paths only"
|
|
153
|
+
# Deploy continues; watch_paths derivation and artifact_registry INSERT are skipped
|
|
154
|
+
fi
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
PUBLISH.md format: see `C:/Dev/rdc-skills/guides/publish-md-spec.md` (authoritative).
|
|
158
|
+
|
|
159
|
+
Required frontmatter fields: `schema_version`, `entity_slug`, `artifact_type`, `environments`, `status`.
|
|
160
|
+
One or more `<!-- SURFACE:<id> -->` … `<!-- /SURFACE:<id> -->` blocks per surface (each with `path`, `source_dir`, `build_type`, `visibility`, `cache`, `watch_paths`).
|
|
161
|
+
|
|
162
|
+
If PUBLISH.md is **present but invalid** (missing required field, bad enum, no surface blocks): abort deploy with `BLOCKED: PUBLISH.md parse error for <slug> — <reason>`.
|
|
163
|
+
|
|
164
|
+
### Step 7 — Derive watch_paths from PUBLISH.md surfaces
|
|
165
|
+
|
|
166
|
+
Union all `watch_paths` arrays across every surface section in PUBLISH.md. Update `app_deployments.watch_paths` for the app slug to this derived union before triggering the Coolify deploy.
|
|
167
|
+
|
|
168
|
+
```sql
|
|
169
|
+
UPDATE app_deployments
|
|
170
|
+
SET watch_paths = '<union-of-surface-watch_paths>'
|
|
171
|
+
WHERE app_slug = '<slug>';
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Also PATCH the Coolify application's `watch_paths` field:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
_COOLIFY=$(curl -s http://127.0.0.1:52437/v/coolify-api)
|
|
178
|
+
WATCH_PATHS_JSON=$(derive_watch_paths_union "$PUBLISH_MD")
|
|
179
|
+
curl -s -X PATCH -H "Authorization: Bearer $_COOLIFY" \
|
|
180
|
+
-H "Content-Type: application/json" \
|
|
181
|
+
-d "{\"watch_paths\":\"$WATCH_PATHS_JSON\"}" \
|
|
182
|
+
"$DEPLOY_API_BASE/api/v1/applications/<uuid>"
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Step 15 — storeArtifact per surface (after successful deploy)
|
|
186
|
+
|
|
187
|
+
After the deployment reaches "finished" state, INSERT one row into Studio `artifact_registry` for each surface declared in PUBLISH.md:
|
|
188
|
+
|
|
189
|
+
| Column | Value |
|
|
190
|
+
|--------|-------|
|
|
191
|
+
| `entity_slug` | from PUBLISH.md frontmatter `entity_slug` |
|
|
192
|
+
| `artifact_type` | from PUBLISH.md frontmatter `artifact_type` |
|
|
193
|
+
| `canonical_url` | `https://<app_deployments.url><surface.path>` |
|
|
194
|
+
| `surface_id` | surface name from `<!-- SURFACE:<id> -->` marker |
|
|
195
|
+
| `commit_sha` | HEAD SHA of the deploy |
|
|
196
|
+
| `published_at` | `now()` |
|
|
197
|
+
|
|
198
|
+
Use the Supabase MCP (`mcp__claude_ai_Supabase__execute_sql`) from the supervisor session:
|
|
199
|
+
|
|
200
|
+
```sql
|
|
201
|
+
INSERT INTO artifact_registry (entity_slug, artifact_type, canonical_url, surface_id, commit_sha, published_at)
|
|
202
|
+
VALUES ('<entity_slug>', '<artifact_type>', 'https://<url><path>', '<surface_id>', '<commit_sha>', now())
|
|
203
|
+
ON CONFLICT (entity_slug, surface_id) DO UPDATE SET
|
|
204
|
+
canonical_url = EXCLUDED.canonical_url,
|
|
205
|
+
commit_sha = EXCLUDED.commit_sha,
|
|
206
|
+
published_at = EXCLUDED.published_at;
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
If the INSERT fails, surface the failure in the deploy output but **do NOT roll back the deploy**. The artifact registry is a post-deploy record, not a deploy gate.
|
|
210
|
+
|
|
137
211
|
## Coolify Access — clauth + REST API
|
|
138
212
|
|
|
139
213
|
All Coolify operations use the clauth daemon and the Coolify REST API directly.
|
|
@@ -145,42 +219,64 @@ _COOLIFY=$(curl -s http://127.0.0.1:52437/v/coolify-api)
|
|
|
145
219
|
|
|
146
220
|
# List applications
|
|
147
221
|
curl -s -H "Authorization: Bearer $_COOLIFY" \
|
|
148
|
-
|
|
222
|
+
"$DEPLOY_API_BASE/api/v1/applications"
|
|
149
223
|
|
|
150
224
|
# Get application details
|
|
151
225
|
curl -s -H "Authorization: Bearer $_COOLIFY" \
|
|
152
|
-
|
|
226
|
+
"$DEPLOY_API_BASE/api/v1/applications/<uuid>"
|
|
153
227
|
|
|
154
228
|
# Deploy (trigger)
|
|
155
229
|
curl -s -X POST -H "Authorization: Bearer $_COOLIFY" \
|
|
156
|
-
|
|
230
|
+
"$DEPLOY_API_BASE/api/v1/applications/<uuid>/deploy"
|
|
157
231
|
|
|
158
232
|
# Get deployment logs
|
|
159
233
|
curl -s -H "Authorization: Bearer $_COOLIFY" \
|
|
160
|
-
|
|
234
|
+
"$DEPLOY_API_BASE/api/v1/deployments/<deployment-id>"
|
|
161
235
|
|
|
162
236
|
# Set env var
|
|
163
237
|
curl -s -X POST -H "Authorization: Bearer $_COOLIFY" \
|
|
164
238
|
-H "Content-Type: application/json" \
|
|
165
239
|
-d '{"key":"<KEY>","value":"<VALUE>"}' \
|
|
166
|
-
|
|
240
|
+
"$DEPLOY_API_BASE/api/v1/applications/<uuid>/envs"
|
|
167
241
|
|
|
168
242
|
# Set watch_paths
|
|
169
243
|
curl -s -X PATCH -H "Authorization: Bearer $_COOLIFY" \
|
|
170
244
|
-H "Content-Type: application/json" \
|
|
171
245
|
-d '{"watch_paths":"apps/<name>/**\npackages/**"}' \
|
|
172
|
-
|
|
246
|
+
"$DEPLOY_API_BASE/api/v1/applications/<uuid>"
|
|
173
247
|
```
|
|
174
248
|
|
|
175
249
|
**Never print `$_COOLIFY` to stdout.** Inline from clauth only — do not assign raw strings.
|
|
176
250
|
|
|
177
251
|
If clauth daemon is not responding (`curl -s http://127.0.0.1:52437/ping` fails):
|
|
178
252
|
```
|
|
179
|
-
BLOCKED:
|
|
180
|
-
Fix:
|
|
253
|
+
BLOCKED: credential provider is not responding.
|
|
254
|
+
Fix: start the project's credential provider or configure deployment credentials through env vars, then retry.
|
|
181
255
|
I cannot proceed until this is resolved.
|
|
182
256
|
```
|
|
183
257
|
|
|
258
|
+
## Deployment Event Log — `coolify_events`
|
|
259
|
+
|
|
260
|
+
Every Coolify deploy emits a webhook → `coolify_events` row. Use this for last-N-deploys queries, debugging failed deploys, and reconciling local state with Coolify state.
|
|
261
|
+
|
|
262
|
+
Query the last 5 events for an app:
|
|
263
|
+
```sql
|
|
264
|
+
SELECT created_at, event_type, status, branch, commit_hash, duration_seconds
|
|
265
|
+
FROM coolify_events
|
|
266
|
+
WHERE app_uuid = '<uuid>' OR app_name = '<slug>'
|
|
267
|
+
ORDER BY created_at DESC LIMIT 5;
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Fields:
|
|
271
|
+
- `app_uuid` — Coolify application UUID (matches `app_deployments.coolify_uuid`)
|
|
272
|
+
- `event_type` — `started | succeeded | failed | cancelled` (canonical values; consult webhook receiver for full enum)
|
|
273
|
+
- `status` — overall deploy status
|
|
274
|
+
- `branch`, `commit_hash`, `commit_message` — git context
|
|
275
|
+
- `duration_seconds` — total deploy time
|
|
276
|
+
- `payload` — full webhook payload (jsonb) for forensic debugging
|
|
277
|
+
|
|
278
|
+
When diagnosing a broken deploy in Mode 3: query `coolify_events` FIRST before re-running the deploy — the most recent event row tells you whether the previous deploy actually triggered, whether it failed, and how long it ran. Faster than checking the Coolify UI.
|
|
279
|
+
|
|
184
280
|
## References
|
|
185
281
|
|
|
186
282
|
- Type-specific checklists + DNS tree + gate commands: `docs/runbooks/coolify-deploy-checklist.md`
|
|
@@ -189,7 +285,7 @@ I cannot proceed until this is resolved.
|
|
|
189
285
|
```
|
|
190
286
|
Server UUID: ih386anenvvvn6fy1umtyow0
|
|
191
287
|
Server IP: 64.237.54.189
|
|
192
|
-
Dashboard:
|
|
288
|
+
Dashboard: <deployment-dashboard-url>
|
|
193
289
|
GitHub App UUID: xdmcy60putp5h9j7k4kwg9c3
|
|
194
290
|
```
|
|
195
291
|
|