@lifeaitools/rdc-skills 0.24.42 → 0.25.1
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/settings.json +15 -15
- package/.claude-plugin/marketplace.json +21 -21
- package/.claude-plugin/plugin.json +1560 -1371
- package/.github/workflows/publish.yml +34 -34
- package/.github/workflows/self-test.yml +58 -58
- package/CHANGELOG.md +322 -310
- package/LICENSE +21 -21
- package/MANIFEST.md +224 -221
- package/README.md +377 -376
- package/README.sandbox.md +3 -3
- package/assets/watcher/viewer.html +164 -164
- package/bin/rdc-skills-mcp.mjs +316 -316
- package/commands/build.md +183 -183
- package/commands/collab.md +180 -180
- package/commands/deploy.md +152 -152
- package/commands/design.md +31 -31
- package/commands/edit.md +28 -28
- package/commands/fixit.md +150 -124
- package/commands/handoff.md +173 -173
- package/commands/help.md +95 -95
- package/commands/overnight.md +220 -220
- package/commands/plan.md +158 -158
- package/commands/preplan.md +131 -131
- package/commands/prototype.md +145 -145
- package/commands/release.md +49 -49
- package/commands/report.md +99 -99
- package/commands/review.md +120 -120
- package/commands/self-test.md +113 -113
- package/commands/status.md +86 -86
- package/commands/watch.md +98 -98
- package/commands/workitems.md +137 -137
- package/git-sha.json +1 -1
- package/guides/agent-bootstrap.md +295 -295
- package/guides/agents/backend.md +104 -104
- package/guides/agents/content.md +94 -94
- package/guides/agents/cs2.md +56 -56
- package/guides/agents/data.md +87 -87
- package/guides/agents/design.md +77 -77
- package/guides/agents/frontend.md +92 -92
- package/guides/agents/infrastructure.md +81 -81
- package/guides/agents/setup.md +281 -281
- package/guides/agents/verify.md +151 -151
- package/guides/agents/viz.md +106 -106
- package/guides/backend.md +146 -146
- package/guides/content.md +147 -147
- package/guides/cs2.md +190 -190
- package/guides/data.md +123 -123
- package/guides/design.md +116 -116
- package/guides/engineering-behavior.md +43 -43
- package/guides/escalation-protocol.md +125 -125
- package/guides/frontend.md +151 -151
- package/guides/history-md-spec.md +297 -297
- package/guides/infrastructure.md +179 -179
- package/guides/lessons-learned-spec.md +145 -151
- package/guides/output-contract.md +108 -108
- package/guides/publish-md-spec.md +289 -289
- package/guides/rdc-skills-startup.md +30 -30
- package/guides/verify.md +11 -11
- package/hooks/check-cwd.js +31 -31
- package/hooks/check-rdc-environment.js +164 -164
- package/hooks/check-services.js +6 -6
- package/hooks/check-stale-work-items.js +19 -19
- package/hooks/foreground-process-gate.js +128 -128
- package/hooks/gate-watchdog-selfcheck.js +257 -257
- package/hooks/hook-logger.js +25 -25
- package/hooks/lib/run-evidence-gate.mjs +241 -241
- package/hooks/no-stop-open-epics.js +127 -127
- package/hooks/post-tool-batch-gate.js +203 -203
- package/hooks/post-work-check.js +21 -21
- package/hooks/postcompact-log.js +13 -13
- package/hooks/precompact-log.js +13 -13
- package/hooks/rate-limit-retry.js +46 -46
- package/hooks/rdc-invocation-marker.js +157 -157
- package/hooks/rdc-output-contract-gate.js +94 -94
- package/hooks/require-work-item-on-commit.js +294 -294
- package/hooks/restart-brief.js +19 -19
- package/hooks/run-hidden-hook.ps1 +47 -47
- package/hooks/task-completed-gate.js +274 -274
- package/hooks/work-item-exit-gate.js +944 -944
- package/lib/catalog.mjs +236 -236
- package/lib/cloud-rewrite.mjs +155 -155
- package/package.json +57 -57
- package/rules/work-items-rpc.md +520 -520
- package/scaffold/templates/HISTORY.md.template +39 -39
- package/scaffold/templates/PUBLISH.md.template +21 -21
- package/scaffold/templates/brochure-studio-default.html +70 -70
- package/scripts/acceptance.mjs +502 -502
- package/scripts/fixtures/guides/bad-guide.md +15 -15
- package/scripts/fixtures/guides-clean/good-guide.md +16 -16
- package/scripts/install-rdc-skills.js +1401 -1289
- package/scripts/install.ps1 +202 -202
- package/scripts/install.sh +132 -132
- package/scripts/lib/assertions.mjs +287 -287
- package/scripts/lib/manifest-schema.mjs +754 -754
- package/scripts/lib/runner.mjs +465 -465
- package/scripts/lib/sandbox.mjs +435 -435
- package/scripts/prepack.mjs +32 -32
- package/scripts/rdc-brochure.mjs +482 -482
- package/scripts/rdc-design-cli.mjs +134 -134
- package/scripts/rebuild-mcp.mjs +107 -107
- package/scripts/self-test.mjs +1460 -1460
- package/scripts/stamp-git-sha.mjs +29 -29
- package/scripts/test-guide-validator.mjs +196 -196
- package/scripts/test-rdc-hooks.mjs +145 -145
- package/scripts/uninstall.ps1 +77 -77
- package/scripts/uninstall.sh +69 -69
- package/scripts/update.ps1 +43 -43
- package/scripts/update.sh +43 -43
- package/scripts/validate-place-histories.js +461 -461
- package/scripts/validate-publish-manifests.js +502 -424
- package/scripts/watch-init.mjs +100 -100
- package/skills/brochure/SKILL.md +107 -107
- package/skills/build/SKILL.md +578 -563
- package/skills/channel-formatter/SKILL.md +538 -533
- package/skills/co-develop/SKILL.md +196 -196
- package/skills/collab/SKILL.md +239 -239
- package/skills/convert/SKILL.md +167 -140
- package/skills/deploy/SKILL.md +541 -541
- package/skills/design/SKILL.md +211 -211
- package/skills/design/reference/ownership.md +16 -16
- package/skills/design/reference/rampa.md +92 -92
- package/skills/design/reference/studio-model.md +153 -153
- package/skills/edit/SKILL.md +98 -98
- package/skills/env/SKILL.md +141 -0
- package/skills/fixit/SKILL.md +203 -165
- package/skills/fs-mcp/SKILL.md +183 -148
- package/skills/handoff/SKILL.md +236 -236
- package/skills/help/SKILL.md +143 -143
- package/skills/housekeeping/SKILL.md +160 -219
- package/skills/lifeai-brochure-author/SKILL.md +340 -340
- package/skills/new-model/SKILL.md +49 -0
- package/skills/onramp/SKILL.md +1459 -0
- package/skills/overnight/SKILL.md +251 -251
- package/skills/plan/SKILL.md +345 -345
- package/skills/preplan/SKILL.md +90 -90
- package/skills/prototype/SKILL.md +150 -150
- package/skills/rdc-brochurify/SKILL.md +245 -245
- package/skills/rdc-extract-verifier-rules/SKILL.md +191 -191
- package/skills/regen-media/SKILL.md +94 -0
- package/skills/release/SKILL.md +140 -140
- package/skills/report/SKILL.md +100 -100
- package/skills/review/SKILL.md +160 -152
- package/skills/rpms-filemap/SKILL.cloud.md +111 -111
- package/skills/rpms-filemap/SKILL.md +111 -111
- package/skills/self-test/SKILL.md +132 -132
- package/skills/status/SKILL.md +99 -99
- package/skills/terminal-config/SKILL.md +62 -62
- package/skills/tests/MATRIX.md +55 -54
- package/skills/tests/README.md +47 -47
- package/skills/tests/onramp.test.json +87 -0
- package/skills/tests/rdc-brochure.test.json +34 -34
- package/skills/tests/rdc-build.test.json +36 -36
- package/skills/tests/rdc-channel-formatter.test.json +45 -45
- package/skills/tests/rdc-co-develop.test.json +29 -29
- package/skills/tests/rdc-collab.test.json +29 -29
- package/skills/tests/rdc-convert.test.json +35 -35
- package/skills/tests/rdc-deploy.test.json +30 -30
- package/skills/tests/rdc-design.test.json +27 -27
- package/skills/tests/rdc-edit.test.json +29 -29
- package/skills/tests/rdc-fixit.test.json +36 -36
- package/skills/tests/rdc-fs-mcp.test.json +36 -36
- package/skills/tests/rdc-handoff.test.json +28 -28
- package/skills/tests/rdc-help.test.json +29 -29
- package/skills/tests/rdc-housekeeping.test.json +28 -32
- package/skills/tests/rdc-lifeai-brochure-author.test.json +35 -35
- package/skills/tests/rdc-overnight.test.json +37 -37
- package/skills/tests/rdc-plan.test.json +27 -27
- package/skills/tests/rdc-preplan.test.json +31 -31
- package/skills/tests/rdc-prototype.test.json +28 -28
- package/skills/tests/rdc-rdc-brochurify.test.json +23 -23
- package/skills/tests/rdc-rdc-extract-verifier-rules.test.json +34 -34
- package/skills/tests/rdc-regen-media.test.json +29 -0
- package/skills/tests/rdc-release.test.json +29 -29
- package/skills/tests/rdc-report.test.json +28 -28
- package/skills/tests/rdc-review.test.json +29 -29
- package/skills/tests/rdc-rpms-filemap.test.json +28 -28
- package/skills/tests/rdc-self-test.test.json +24 -24
- package/skills/tests/rdc-status.test.json +29 -29
- package/skills/tests/rdc-terminal-config.test.json +29 -29
- package/skills/tests/rdc-watch.test.json +24 -24
- package/skills/tests/rdc-workitems.test.json +27 -27
- package/skills/watch/SKILL.md +97 -97
- package/skills/workitems/SKILL.md +151 -151
- package/tests/acceptance.test.mjs +59 -59
- package/tests/channel-formatter.contract.test.mjs +251 -251
- package/tests/curl-surface.test.mjs +289 -289
- package/tests/harness-gates.test.mjs +325 -325
- package/tests/help-surface.test.mjs +61 -61
- package/tests/install-rdc-skills.test.mjs +49 -49
- package/tests/manifest-contract-fields.test.mjs +78 -78
- package/tests/mcp.test.mjs +271 -271
- package/tests/rdc-brochure.test.mjs +125 -125
- package/tests/require-work-item-on-commit.test.mjs +162 -162
- package/tests/run-evidence-gate.test.mjs +82 -82
- package/tests/skill-test-matrix.test.mjs +66 -66
- package/tests/validate-skills.js +27 -27
- package/tests/work-item-exit-gate-l2.test.mjs +368 -368
- package/tests/work-item-exit-gate-l3.test.mjs +197 -197
- package/RELEASE.md +0 -42
- package/tests/housekeeping-lessons-triage.test.mjs +0 -49
- package/tests/lessons-pipeline-contract.test.mjs +0 -27
- package/tests/release-contract.test.mjs +0 -16
|
@@ -1,424 +1,502 @@
|
|
|
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
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} else if (a === '--
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
//
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
const
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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
|
+
* 2026-07-05: DEPLOY-block enforcement (Approved: Dave, port-from-registry).
|
|
10
|
+
* - Every deployable MUST carry a valid <!-- DEPLOY --> block (hard FAIL if absent).
|
|
11
|
+
* - `port` MUST be the literal `registry` — a hardcoded integer is a FAIL.
|
|
12
|
+
* - `port: registry` MUST resolve: if the app has a PM2 dev row, it MUST have pm2_port.
|
|
13
|
+
* - slug→dir resolves via apps.monorepo_path (fixes slug≠dir apps like zoen, rapha).
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* node scripts/validate-publish-manifests.js [--mode warn|fail] [--slug <name>] [--json] [--strict]
|
|
17
|
+
*
|
|
18
|
+
* Exit codes:
|
|
19
|
+
* 0 — all checks passed (or warn mode with only warnings)
|
|
20
|
+
* 1 — one or more FAIL lines (hard error)
|
|
21
|
+
* 2 — invocation error (bad args)
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
'use strict';
|
|
25
|
+
|
|
26
|
+
const fs = require('fs');
|
|
27
|
+
const path = require('path');
|
|
28
|
+
const https = require('https');
|
|
29
|
+
const http = require('http');
|
|
30
|
+
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// CLI argument parsing
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
const args = process.argv.slice(2);
|
|
36
|
+
let mode = 'warn'; // warn | fail
|
|
37
|
+
let slugFilter = null; // --slug <name>
|
|
38
|
+
let jsonOutput = false; // --json
|
|
39
|
+
let strict = false; // --strict (same as --mode fail)
|
|
40
|
+
|
|
41
|
+
for (let i = 0; i < args.length; i++) {
|
|
42
|
+
const a = args[i];
|
|
43
|
+
if (a === '--mode') {
|
|
44
|
+
const v = args[++i];
|
|
45
|
+
if (v !== 'warn' && v !== 'fail') {
|
|
46
|
+
console.error('ERROR: --mode must be warn or fail');
|
|
47
|
+
process.exit(2);
|
|
48
|
+
}
|
|
49
|
+
mode = v;
|
|
50
|
+
} else if (a === '--slug') {
|
|
51
|
+
slugFilter = args[++i];
|
|
52
|
+
if (!slugFilter) {
|
|
53
|
+
console.error('ERROR: --slug requires a value');
|
|
54
|
+
process.exit(2);
|
|
55
|
+
}
|
|
56
|
+
} else if (a === '--json') {
|
|
57
|
+
jsonOutput = true;
|
|
58
|
+
} else if (a === '--strict') {
|
|
59
|
+
strict = true;
|
|
60
|
+
mode = 'fail';
|
|
61
|
+
} else {
|
|
62
|
+
console.error(`ERROR: unknown argument: ${a}`);
|
|
63
|
+
process.exit(2);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
// Constants
|
|
69
|
+
// ---------------------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
const MONOREPO_ROOT = 'C:/Dev/regen-root';
|
|
72
|
+
const CLAUTH_BASE = 'http://127.0.0.1:52437';
|
|
73
|
+
|
|
74
|
+
// Ordered list of root-relative prefixes to probe when looking for app source
|
|
75
|
+
const MONOREPO_SEARCH_DIRS = ['apps', 'sites', 'models', 'mcp-servers', 'packages'];
|
|
76
|
+
|
|
77
|
+
const REQUIRED_FRONTMATTER_FIELDS = ['schema_version', 'entity_slug', 'artifact_type', 'environments', 'status'];
|
|
78
|
+
const ALLOWED_ARTIFACT_TYPES = ['website', 'api', 'package', 'worker', 'mcp-server'];
|
|
79
|
+
const ALLOWED_STATUSES = ['active', 'draft', 'deprecated'];
|
|
80
|
+
const ALLOWED_ENVIRONMENTS = ['dev', 'prod'];
|
|
81
|
+
const ALLOWED_SCHEMA_VERSIONS = ['1.0'];
|
|
82
|
+
|
|
83
|
+
// Supabase project and REST base
|
|
84
|
+
const SUPABASE_PROJECT_HOST = 'uvojezuorjgqzmhhgluu.supabase.co';
|
|
85
|
+
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
// Result tracking
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
|
|
90
|
+
const results = [];
|
|
91
|
+
let hasHardFail = false;
|
|
92
|
+
|
|
93
|
+
// Populated in main() from the registry (apps + app_deployments).
|
|
94
|
+
const dirBySlug = new Map(); // slug -> monorepo_path (root-relative)
|
|
95
|
+
const rowsBySlug = new Map(); // slug -> [app_deployments rows]
|
|
96
|
+
|
|
97
|
+
function emit(level, slug, message, detail) {
|
|
98
|
+
const entry = { level, slug, message, detail: detail || null };
|
|
99
|
+
results.push(entry);
|
|
100
|
+
if (level === 'FAIL') hasHardFail = true;
|
|
101
|
+
if (!jsonOutput) {
|
|
102
|
+
const prefix = level === 'FAIL' ? '✗ FAIL' : level === 'WARN' ? '⚠ WARN' : '✓ PASS';
|
|
103
|
+
console.log(`${prefix} [${slug}] ${message}${detail ? ` — ${detail}` : ''}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ---------------------------------------------------------------------------
|
|
108
|
+
// HTTP helpers
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
|
|
111
|
+
/** Fetch plain text from clauth daemon (never prints value) */
|
|
112
|
+
function fetchClauth(service) {
|
|
113
|
+
return new Promise((resolve, reject) => {
|
|
114
|
+
const req = http.get(`${CLAUTH_BASE}/v/${service}`, (res) => {
|
|
115
|
+
let buf = '';
|
|
116
|
+
res.on('data', (c) => (buf += c));
|
|
117
|
+
res.on('end', () => {
|
|
118
|
+
if (res.statusCode !== 200) {
|
|
119
|
+
reject(new Error(`clauth /v/${service} → HTTP ${res.statusCode}`));
|
|
120
|
+
} else {
|
|
121
|
+
resolve(buf.trim());
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
req.on('error', reject);
|
|
126
|
+
req.setTimeout(5000, () => { req.destroy(); reject(new Error('clauth timeout')); });
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** REST GET against Supabase with anon key */
|
|
131
|
+
function supabaseGet(anonKey, path) {
|
|
132
|
+
return new Promise((resolve, reject) => {
|
|
133
|
+
const options = {
|
|
134
|
+
hostname: SUPABASE_PROJECT_HOST,
|
|
135
|
+
path,
|
|
136
|
+
method: 'GET',
|
|
137
|
+
headers: {
|
|
138
|
+
'apikey': anonKey,
|
|
139
|
+
'Authorization': `Bearer ${anonKey}`,
|
|
140
|
+
'Content-Type': 'application/json',
|
|
141
|
+
'Accept': 'application/json',
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
const req = https.request(options, (res) => {
|
|
145
|
+
let buf = '';
|
|
146
|
+
res.on('data', (c) => (buf += c));
|
|
147
|
+
res.on('end', () => {
|
|
148
|
+
if (res.statusCode !== 200) {
|
|
149
|
+
reject(new Error(`Supabase REST ${path} → HTTP ${res.statusCode}: ${buf.slice(0, 200)}`));
|
|
150
|
+
} else {
|
|
151
|
+
try {
|
|
152
|
+
resolve(JSON.parse(buf));
|
|
153
|
+
} catch (e) {
|
|
154
|
+
reject(new Error(`JSON parse error: ${e.message}`));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
req.on('error', reject);
|
|
160
|
+
req.setTimeout(10000, () => { req.destroy(); reject(new Error('Supabase timeout')); });
|
|
161
|
+
req.end();
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ---------------------------------------------------------------------------
|
|
166
|
+
// YAML frontmatter parser (minimal — no external dep required)
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Parse YAML frontmatter from a PUBLISH.md string.
|
|
171
|
+
* Only handles scalar values, arrays on same line ([a, b, c]), and quoted strings.
|
|
172
|
+
* Returns null if no frontmatter delimiters found.
|
|
173
|
+
*/
|
|
174
|
+
function parseFrontmatter(content) {
|
|
175
|
+
const fmMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
176
|
+
if (!fmMatch) return null;
|
|
177
|
+
|
|
178
|
+
const yaml = fmMatch[1];
|
|
179
|
+
const result = {};
|
|
180
|
+
|
|
181
|
+
for (const line of yaml.split(/\r?\n/)) {
|
|
182
|
+
const kv = line.match(/^([a-zA-Z_][a-zA-Z0-9_]*):\s*(.*)$/);
|
|
183
|
+
if (!kv) continue;
|
|
184
|
+
|
|
185
|
+
const key = kv[1];
|
|
186
|
+
let value = kv[2].trim();
|
|
187
|
+
|
|
188
|
+
// Array: [a, b, c] or [a] or []
|
|
189
|
+
if (value.startsWith('[') && value.endsWith(']')) {
|
|
190
|
+
const inner = value.slice(1, -1).trim();
|
|
191
|
+
result[key] = inner ? inner.split(',').map((s) => s.trim().replace(/^["']|["']$/g, '')) : [];
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Quoted string
|
|
196
|
+
if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
|
|
197
|
+
result[key] = value.slice(1, -1);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
result[key] = value;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return result;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Extract surface section IDs from PUBLISH.md content.
|
|
209
|
+
* Looks for <!-- SURFACE:<id> --> markers.
|
|
210
|
+
*/
|
|
211
|
+
function parseSurfaceIds(content) {
|
|
212
|
+
const ids = [];
|
|
213
|
+
const re = /<!--\s*SURFACE:([a-zA-Z0-9_-]+)\s*-->/g;
|
|
214
|
+
let m;
|
|
215
|
+
while ((m = re.exec(content)) !== null) {
|
|
216
|
+
ids.push(m[1]);
|
|
217
|
+
}
|
|
218
|
+
return ids;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Extract watch_paths from a named surface section.
|
|
223
|
+
* Returns array of watch_path strings (may be empty).
|
|
224
|
+
*/
|
|
225
|
+
function parseSurfaceWatchPaths(content, surfaceId) {
|
|
226
|
+
const re = new RegExp(`<!--\\s*SURFACE:${surfaceId}\\s*-->[\\s\\S]*?<!--\\s*/SURFACE:${surfaceId}\\s*-->`, 'i');
|
|
227
|
+
const section = content.match(re);
|
|
228
|
+
if (!section) return [];
|
|
229
|
+
|
|
230
|
+
const block = section[0];
|
|
231
|
+
const watchPathsMatch = block.match(/watch_paths:\s*\r?\n((?:\s+-\s+.+\r?\n?)*)/);
|
|
232
|
+
if (!watchPathsMatch) return [];
|
|
233
|
+
|
|
234
|
+
return watchPathsMatch[1]
|
|
235
|
+
.split(/\r?\n/)
|
|
236
|
+
.map((l) => l.replace(/^\s+-\s+/, '').trim())
|
|
237
|
+
.filter(Boolean);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// ---------------------------------------------------------------------------
|
|
241
|
+
// Path resolution
|
|
242
|
+
// ---------------------------------------------------------------------------
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Derive the local filesystem path where we'd expect PUBLISH.md for a given app_slug.
|
|
246
|
+
* Probes MONOREPO_SEARCH_DIRS in order, returning the first hit.
|
|
247
|
+
* Returns null if no directory found (standalone or unknown).
|
|
248
|
+
*/
|
|
249
|
+
function resolveAppRoot(slug) {
|
|
250
|
+
// Authoritative: apps.monorepo_path (fixes slug≠dir apps like zoen→apps/zoen-web).
|
|
251
|
+
const dir = dirBySlug.get(slug);
|
|
252
|
+
if (dir) {
|
|
253
|
+
const candidate = path.join(MONOREPO_ROOT, dir);
|
|
254
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
255
|
+
}
|
|
256
|
+
// Fallback: probe by slug name.
|
|
257
|
+
for (const d of MONOREPO_SEARCH_DIRS) {
|
|
258
|
+
const candidate = path.join(MONOREPO_ROOT, d, slug);
|
|
259
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
260
|
+
}
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// ---------------------------------------------------------------------------
|
|
265
|
+
// Validation logic for a single app row
|
|
266
|
+
// ---------------------------------------------------------------------------
|
|
267
|
+
|
|
268
|
+
function validateApp(slug) {
|
|
269
|
+
const appRoot = resolveAppRoot(slug);
|
|
270
|
+
|
|
271
|
+
if (!appRoot) {
|
|
272
|
+
// Could be standalone repo — skip with note in v1
|
|
273
|
+
emit('WARN', slug, 'app root not found in monorepo — may be standalone repo, skipping (v1 scope)');
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const publishPath = path.join(appRoot, 'PUBLISH.md');
|
|
278
|
+
|
|
279
|
+
if (!fs.existsSync(publishPath)) {
|
|
280
|
+
if (mode === 'fail') {
|
|
281
|
+
emit('FAIL', slug, 'PUBLISH.md missing', publishPath);
|
|
282
|
+
} else {
|
|
283
|
+
emit('WARN', slug, 'PUBLISH.md missing', publishPath);
|
|
284
|
+
}
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// File exists — parse and validate
|
|
289
|
+
const content = fs.readFileSync(publishPath, 'utf8');
|
|
290
|
+
const fm = parseFrontmatter(content);
|
|
291
|
+
|
|
292
|
+
if (!fm) {
|
|
293
|
+
emit('FAIL', slug, 'PUBLISH.md has no YAML frontmatter (missing --- delimiters)', publishPath);
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
let ok = true;
|
|
298
|
+
|
|
299
|
+
// Check required fields
|
|
300
|
+
for (const field of REQUIRED_FRONTMATTER_FIELDS) {
|
|
301
|
+
if (fm[field] === undefined || fm[field] === null || fm[field] === '') {
|
|
302
|
+
emit('FAIL', slug, `PUBLISH.md missing required field: ${field}`, publishPath);
|
|
303
|
+
ok = false;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// schema_version
|
|
308
|
+
if (fm.schema_version && !ALLOWED_SCHEMA_VERSIONS.includes(fm.schema_version)) {
|
|
309
|
+
emit('FAIL', slug, `PUBLISH.md schema_version "${fm.schema_version}" not in allowed set: ${ALLOWED_SCHEMA_VERSIONS.join(', ')}`, publishPath);
|
|
310
|
+
ok = false;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// artifact_type
|
|
314
|
+
if (fm.artifact_type && !ALLOWED_ARTIFACT_TYPES.includes(fm.artifact_type)) {
|
|
315
|
+
emit('FAIL', slug, `PUBLISH.md artifact_type "${fm.artifact_type}" not in allowed set: ${ALLOWED_ARTIFACT_TYPES.join(', ')}`, publishPath);
|
|
316
|
+
ok = false;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// status
|
|
320
|
+
if (fm.status && !ALLOWED_STATUSES.includes(fm.status)) {
|
|
321
|
+
emit('FAIL', slug, `PUBLISH.md status "${fm.status}" not in allowed set: ${ALLOWED_STATUSES.join(', ')}`, publishPath);
|
|
322
|
+
ok = false;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// environments — must be array, at least one, each in allowed set
|
|
326
|
+
if (fm.environments !== undefined) {
|
|
327
|
+
if (!Array.isArray(fm.environments) || fm.environments.length === 0) {
|
|
328
|
+
emit('FAIL', slug, 'PUBLISH.md environments must be a non-empty array', publishPath);
|
|
329
|
+
ok = false;
|
|
330
|
+
} else {
|
|
331
|
+
for (const env of fm.environments) {
|
|
332
|
+
if (!ALLOWED_ENVIRONMENTS.includes(env)) {
|
|
333
|
+
emit('FAIL', slug, `PUBLISH.md environments contains unknown value: "${env}"`, publishPath);
|
|
334
|
+
ok = false;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Surface sections — at least one required
|
|
341
|
+
const surfaceIds = parseSurfaceIds(content);
|
|
342
|
+
if (surfaceIds.length === 0) {
|
|
343
|
+
emit('FAIL', slug, 'PUBLISH.md has no <!-- SURFACE:<id> --> sections', publishPath);
|
|
344
|
+
ok = false;
|
|
345
|
+
} else {
|
|
346
|
+
// Each surface must have watch_paths
|
|
347
|
+
for (const sid of surfaceIds) {
|
|
348
|
+
const wp = parseSurfaceWatchPaths(content, sid);
|
|
349
|
+
if (wp.length === 0) {
|
|
350
|
+
emit('FAIL', slug, `PUBLISH.md surface "${sid}" has no watch_paths entries`, publishPath);
|
|
351
|
+
ok = false;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// DEPLOY block — mandatory as of 2026-07-05. Always a hard FAIL (not mode-gated).
|
|
357
|
+
if (!validateDeployBlock(slug, content, publishPath)) ok = false;
|
|
358
|
+
|
|
359
|
+
if (ok) {
|
|
360
|
+
emit('PASS', slug, 'PUBLISH.md valid', `${surfaceIds.length} surface(s): ${surfaceIds.join(', ')}`);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return { fm, surfaceIds, publishPath };
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Validate the <!-- DEPLOY --> block. Returns true iff valid.
|
|
368
|
+
* Contract: .claude/rules/app-deploy-manifest.md (port-from-registry, Approved 2026-07-05).
|
|
369
|
+
*/
|
|
370
|
+
function validateDeployBlock(slug, content, publishPath) {
|
|
371
|
+
const m = content.match(/<!-- DEPLOY -->([\s\S]*?)<!-- \/DEPLOY -->/);
|
|
372
|
+
if (!m) {
|
|
373
|
+
emit('FAIL', slug, 'PUBLISH.md has no <!-- DEPLOY --> block (mandatory)', publishPath);
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
const body = m[1];
|
|
377
|
+
let ok = true;
|
|
378
|
+
|
|
379
|
+
for (const field of ['runtime', 'port', 'health_path']) {
|
|
380
|
+
if (!new RegExp(`^${field}:`, 'm').test(body)) {
|
|
381
|
+
emit('FAIL', slug, `DEPLOY block missing required field: ${field}`, publishPath);
|
|
382
|
+
ok = false;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
const portLine = body.match(/^port:\s*([^\s#]+)/m);
|
|
387
|
+
if (portLine) {
|
|
388
|
+
const val = portLine[1].trim();
|
|
389
|
+
if (!/^registry$/i.test(val)) {
|
|
390
|
+
emit('FAIL', slug, `DEPLOY block port must be the literal 'registry', not '${val}' (port lives in app_deployments.pm2_port)`, publishPath);
|
|
391
|
+
ok = false;
|
|
392
|
+
} else {
|
|
393
|
+
// Resolvability: an app WITH a PM2 dev row must have a pm2_port.
|
|
394
|
+
const rows = rowsBySlug.get(slug) || [];
|
|
395
|
+
const pm2 = rows.find((r) => r.host_type === 'pm2' && r.environment === 'dev');
|
|
396
|
+
if (pm2 && !pm2.pm2_port) {
|
|
397
|
+
emit('FAIL', slug, "DEPLOY block port: registry but the PM2 dev row has no pm2_port to resolve", publishPath);
|
|
398
|
+
ok = false;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
return ok;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// ---------------------------------------------------------------------------
|
|
407
|
+
// Main
|
|
408
|
+
// ---------------------------------------------------------------------------
|
|
409
|
+
|
|
410
|
+
async function main() {
|
|
411
|
+
if (!jsonOutput) {
|
|
412
|
+
console.log(`\nvalidate-publish-manifests — mode=${mode}${slugFilter ? ` slug=${slugFilter}` : ''}\n`);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// 1. Get Supabase anon key from clauth
|
|
416
|
+
let anonKey;
|
|
417
|
+
try {
|
|
418
|
+
anonKey = await fetchClauth('supabase-anon');
|
|
419
|
+
} catch (err) {
|
|
420
|
+
console.error(`ERROR: cannot reach clauth daemon — ${err.message}`);
|
|
421
|
+
console.error('Fix: ensure clauth daemon is running at http://127.0.0.1:52437');
|
|
422
|
+
process.exit(1);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// 2. Query app_deployments for active rows (include host_type + pm2_port for
|
|
426
|
+
// port: registry resolvability).
|
|
427
|
+
let rows;
|
|
428
|
+
try {
|
|
429
|
+
let qpath = '/rest/v1/app_deployments?status=eq.active&select=app_slug,environment,url,host_type,pm2_port&order=app_slug.asc';
|
|
430
|
+
if (slugFilter) {
|
|
431
|
+
qpath += `&app_slug=eq.${encodeURIComponent(slugFilter)}`;
|
|
432
|
+
}
|
|
433
|
+
rows = await supabaseGet(anonKey, qpath);
|
|
434
|
+
} catch (err) {
|
|
435
|
+
console.error(`ERROR: Supabase query failed — ${err.message}`);
|
|
436
|
+
process.exit(1);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// 2b. Query apps for monorepo_path (authoritative slug→dir; fixes slug≠dir).
|
|
440
|
+
try {
|
|
441
|
+
const apps = await supabaseGet(anonKey, '/rest/v1/apps?select=slug,monorepo_path');
|
|
442
|
+
for (const a of apps) {
|
|
443
|
+
if (a.monorepo_path) dirBySlug.set(a.slug, a.monorepo_path);
|
|
444
|
+
}
|
|
445
|
+
} catch (err) {
|
|
446
|
+
// Non-fatal: fall back to slug-name probing in resolveAppRoot.
|
|
447
|
+
if (!jsonOutput) console.log(`(note: apps monorepo_path lookup failed — ${err.message}; using slug-name fallback)`);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// Index all deployment rows by slug for port resolvability checks.
|
|
451
|
+
for (const r of rows) {
|
|
452
|
+
if (!rowsBySlug.has(r.app_slug)) rowsBySlug.set(r.app_slug, []);
|
|
453
|
+
rowsBySlug.get(r.app_slug).push(r);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (!Array.isArray(rows) || rows.length === 0) {
|
|
457
|
+
if (!jsonOutput) {
|
|
458
|
+
console.log(slugFilter ? `No active app_deployments row found for slug: ${slugFilter}` : 'No active app_deployments rows found.');
|
|
459
|
+
}
|
|
460
|
+
process.exit(0);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// Deduplicate slugs (same app_slug may have dev + prod rows)
|
|
464
|
+
const slugsSeen = new Set();
|
|
465
|
+
const uniqueRows = rows.filter((r) => {
|
|
466
|
+
if (slugsSeen.has(r.app_slug)) return false;
|
|
467
|
+
slugsSeen.add(r.app_slug);
|
|
468
|
+
return true;
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
if (!jsonOutput) {
|
|
472
|
+
console.log(`Checking ${uniqueRows.length} unique app slug(s) from ${rows.length} active app_deployments row(s)...\n`);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// 3. Validate each slug
|
|
476
|
+
for (const row of uniqueRows) {
|
|
477
|
+
validateApp(row.app_slug);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// 4. Summary
|
|
481
|
+
const passCount = results.filter((r) => r.level === 'PASS').length;
|
|
482
|
+
const warnCount = results.filter((r) => r.level === 'WARN').length;
|
|
483
|
+
const failCount = results.filter((r) => r.level === 'FAIL').length;
|
|
484
|
+
|
|
485
|
+
if (jsonOutput) {
|
|
486
|
+
console.log(JSON.stringify({ mode, results, summary: { pass: passCount, warn: warnCount, fail: failCount } }, null, 2));
|
|
487
|
+
} else {
|
|
488
|
+
console.log(`\nSummary: ${passCount} PASS · ${warnCount} WARN · ${failCount} FAIL`);
|
|
489
|
+
if (hasHardFail) {
|
|
490
|
+
console.log('Result: FAIL\n');
|
|
491
|
+
} else {
|
|
492
|
+
console.log(warnCount > 0 ? 'Result: WARN (exit 0 in warn mode)\n' : 'Result: PASS\n');
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
process.exit(hasHardFail ? 1 : 0);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
main().catch((err) => {
|
|
500
|
+
console.error(`FATAL: ${err.message}`);
|
|
501
|
+
process.exit(1);
|
|
502
|
+
});
|