@mmerterden/multi-agent-pipeline 23.4.0 → 23.6.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/CHANGELOG.md +47 -6
- package/README.md +4 -4
- package/README.tr.md +4 -4
- package/SECURITY.md +16 -0
- package/docs/architecture.md +1 -1
- package/docs/ecosystem.md +9 -9
- package/docs/facts.json +10 -10
- package/docs/features.md +1 -1
- package/install/_platform-filter.mjs +2 -55
- package/install/codex.mjs +1 -3
- package/install/copilot.mjs +4 -8
- package/package.json +2 -2
- package/pipeline/commands/multi-agent/design-check/SKILL.md +1 -0
- package/pipeline/contract/CHANGELOG.md +14 -0
- package/pipeline/contract/README.md +1 -0
- package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
- package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
- package/pipeline/contract/manifest.json +14 -1
- package/pipeline/contract/types/index.d.ts +28 -2
- package/pipeline/lib/stack-detect.sh +1 -1
- package/pipeline/lib/usage-names.generated.mjs +9 -1
- package/pipeline/multi-agent-refs/design-check/init-inventory.md +11 -1
- package/pipeline/multi-agent-refs/features/remote-control.md +2 -1
- package/pipeline/multi-agent-refs/features/usage-reporting.md +5 -5
- package/pipeline/multi-agent-refs/help/en.md +1 -1
- package/pipeline/multi-agent-refs/help/tr.md +1 -1
- package/pipeline/multi-agent-refs/orchestrator/dispatcher.md +1 -1
- package/pipeline/multi-agent-refs/outside-the-pipeline.md +2 -1
- package/pipeline/multi-agent-refs/toolkit-tools.md +1 -0
- package/pipeline/office/index.html +104 -5
- package/pipeline/office/toolkit.json +1 -1
- package/pipeline/rules/outside-the-pipeline.md +1 -1
- package/pipeline/schemas/mcp-health.schema.json +96 -0
- package/pipeline/schemas/toolkit-path-params.json +40 -7
- package/pipeline/scripts/_contract-core.mjs +1 -1
- package/pipeline/scripts/_contract-routes-office.mjs +12 -0
- package/pipeline/scripts/_stack-routing.mjs +1 -0
- package/pipeline/scripts/build-stack-plugins.mjs +1 -47
- package/pipeline/scripts/contract-server.mjs +2 -0
- package/pipeline/scripts/design-check-config.mjs +205 -0
- package/pipeline/scripts/gen-facts.mjs +1 -2
- package/pipeline/scripts/health-report.mjs +35 -8
- package/pipeline/scripts/mcp-health.mjs +309 -0
- package/pipeline/scripts/remote/handler.mjs +19 -6
- package/pipeline/scripts/remote/store.mjs +8 -5
- package/pipeline/scripts/skill-usage.mjs +16 -5
- package/pipeline/scripts/usage-health.mjs +10 -1
- package/pipeline/skills/.skill-manifest.json +6 -2
- package/pipeline/skills/.skills-index.json +12 -1
- package/pipeline/skills/shared/README.md +4 -3
- package/pipeline/skills/shared/external/ink-animation/SKILL.md +230 -0
- package/pipeline/skills/shared/external/ink-animation/evals/evals.json +41 -0
- package/pipeline/skills/skills-index.md +2 -1
- package/manifest.json +0 -2055
- package/pipeline/scripts/_renamed-skills.mjs +0 -164
- package/pipeline/skills/renamed.json +0 -30
|
@@ -26,7 +26,7 @@ the file first; never inline it). The repo's own `.claude/skills` come first.
|
|
|
26
26
|
`ai-common-toolkit` and `ai-analyst-toolkit` are on everywhere. Nothing enabled
|
|
27
27
|
is a normal state.
|
|
28
28
|
|
|
29
|
-
**multi-agent MCP.** <!-- fact:toolCount -->
|
|
29
|
+
**multi-agent MCP.** <!-- fact:toolCount -->267<!-- /fact --> tools, most for a running app: `ios_get_ui_tree` /
|
|
30
30
|
`android_get_ui_tree`, `ios_list_crashes` / `android_list_crashes`, `design_*`,
|
|
31
31
|
`ios_app_store_audit`, `ios_testflight_validate`. Use them instead of guessing
|
|
32
32
|
about on-screen state. Not registered is a silent no-op.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/multi-agent-ecosystem/multi-agent-pipeline/pipeline/schemas/mcp-health.schema.json",
|
|
4
|
+
"title": "MCP server health",
|
|
5
|
+
"description": "What GET /v1/mcp-health returns and `mcp-health.mjs --json` prints: per MCP server and tool, the calls, the server-side failures and the minute of the last failure over the last windowDays, from the local failure log and call counter the hooks write. Successful calls are counted only while usage counting is on: callsCounted is false when it is off or no counter file exists, and then calls holds only failed calls. A call that failed is a call, so calls includes failed ones; failures leaves out the errors that say nothing about the server (invalid input, a refusal, an interrupt). A server is named only from the shipped public list, any other is `private` with one `private` tool; a tool is named only from the shipped tool list of this product's own server, any other is `other`. skipped names a source left out because it was over the size cap or could not be read. Names, counts and minutes only.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"contractVersion",
|
|
10
|
+
"generatedAt",
|
|
11
|
+
"ok",
|
|
12
|
+
"windowDays",
|
|
13
|
+
"callsCounted",
|
|
14
|
+
"servers",
|
|
15
|
+
"totals",
|
|
16
|
+
"skipped"
|
|
17
|
+
],
|
|
18
|
+
"properties": {
|
|
19
|
+
"contractVersion": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"pattern": "^1\\.[0-9]+\\.[0-9]+$",
|
|
22
|
+
"x-sensitivity": "none"
|
|
23
|
+
},
|
|
24
|
+
"generatedAt": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"format": "date-time",
|
|
27
|
+
"x-sensitivity": "none"
|
|
28
|
+
},
|
|
29
|
+
"ok": { "const": true, "x-sensitivity": "none" },
|
|
30
|
+
"windowDays": { "type": "integer", "minimum": 1, "maximum": 90, "x-sensitivity": "none" },
|
|
31
|
+
"callsCounted": { "type": "boolean", "x-sensitivity": "none" },
|
|
32
|
+
"servers": {
|
|
33
|
+
"type": "array",
|
|
34
|
+
"maxItems": 5,
|
|
35
|
+
"x-sensitivity": "none",
|
|
36
|
+
"items": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"additionalProperties": false,
|
|
39
|
+
"required": ["server", "calls", "failures", "lastFailure", "tools"],
|
|
40
|
+
"properties": {
|
|
41
|
+
"server": {
|
|
42
|
+
"enum": ["multi-agent", "claude_ai_Figma", "figma", "XcodeBuildMCP", "private"]
|
|
43
|
+
},
|
|
44
|
+
"calls": { "type": "integer", "minimum": 0 },
|
|
45
|
+
"failures": { "type": "integer", "minimum": 0 },
|
|
46
|
+
"lastFailure": {
|
|
47
|
+
"oneOf": [
|
|
48
|
+
{ "type": "null" },
|
|
49
|
+
{ "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:00Z$" }
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"tools": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"maxItems": 20,
|
|
55
|
+
"items": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"additionalProperties": false,
|
|
58
|
+
"required": ["tool", "calls", "failures", "lastFailure"],
|
|
59
|
+
"properties": {
|
|
60
|
+
"tool": { "type": "string", "pattern": "^[a-z0-9_]{1,64}$" },
|
|
61
|
+
"calls": { "type": "integer", "minimum": 0 },
|
|
62
|
+
"failures": { "type": "integer", "minimum": 0 },
|
|
63
|
+
"lastFailure": {
|
|
64
|
+
"oneOf": [
|
|
65
|
+
{ "type": "null" },
|
|
66
|
+
{
|
|
67
|
+
"type": "string",
|
|
68
|
+
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:00Z$"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"totals": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"additionalProperties": false,
|
|
81
|
+
"required": ["calls", "failures"],
|
|
82
|
+
"x-sensitivity": "none",
|
|
83
|
+
"properties": {
|
|
84
|
+
"calls": { "type": "integer", "minimum": 0 },
|
|
85
|
+
"failures": { "type": "integer", "minimum": 0 }
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"skipped": {
|
|
89
|
+
"type": "array",
|
|
90
|
+
"maxItems": 2,
|
|
91
|
+
"uniqueItems": true,
|
|
92
|
+
"x-sensitivity": "none",
|
|
93
|
+
"items": { "enum": ["calls", "failures"] }
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "Generated by pipeline/scripts/gen-toolkit-path-params.mjs from multi-agent-mcp tool-manifest.json; do not edit. Per toolkit tool: the parameters it writes to and the filesystem paths it reads, both confined by scripts/unattended_policy.py.",
|
|
3
|
-
"toolkitVersion": "4.
|
|
3
|
+
"toolkitVersion": "4.5.0",
|
|
4
4
|
"tools": {
|
|
5
5
|
"agent_query_output": {
|
|
6
6
|
"writes": [],
|
|
@@ -162,12 +162,6 @@
|
|
|
162
162
|
"writes": [],
|
|
163
163
|
"reads": []
|
|
164
164
|
},
|
|
165
|
-
"binary_analyse": {
|
|
166
|
-
"writes": [],
|
|
167
|
-
"reads": [
|
|
168
|
-
"path"
|
|
169
|
-
]
|
|
170
|
-
},
|
|
171
165
|
"binary_android": {
|
|
172
166
|
"writes": [],
|
|
173
167
|
"reads": [
|
|
@@ -654,6 +648,21 @@
|
|
|
654
648
|
"against"
|
|
655
649
|
]
|
|
656
650
|
},
|
|
651
|
+
"media_ink_check": {
|
|
652
|
+
"writes": [],
|
|
653
|
+
"reads": []
|
|
654
|
+
},
|
|
655
|
+
"media_ink_plan": {
|
|
656
|
+
"writes": [],
|
|
657
|
+
"reads": []
|
|
658
|
+
},
|
|
659
|
+
"media_ink_render": {
|
|
660
|
+
"writes": [
|
|
661
|
+
"outputPath",
|
|
662
|
+
"video.outputPath"
|
|
663
|
+
],
|
|
664
|
+
"reads": []
|
|
665
|
+
},
|
|
657
666
|
"media_music_beats": {
|
|
658
667
|
"writes": [],
|
|
659
668
|
"reads": [
|
|
@@ -1098,10 +1107,22 @@
|
|
|
1098
1107
|
"writes": [],
|
|
1099
1108
|
"reads": []
|
|
1100
1109
|
},
|
|
1110
|
+
"vphone_launch_app": {
|
|
1111
|
+
"writes": [],
|
|
1112
|
+
"reads": []
|
|
1113
|
+
},
|
|
1101
1114
|
"vphone_list": {
|
|
1102
1115
|
"writes": [],
|
|
1103
1116
|
"reads": []
|
|
1104
1117
|
},
|
|
1118
|
+
"vphone_list_apps": {
|
|
1119
|
+
"writes": [],
|
|
1120
|
+
"reads": []
|
|
1121
|
+
},
|
|
1122
|
+
"vphone_open_url": {
|
|
1123
|
+
"writes": [],
|
|
1124
|
+
"reads": []
|
|
1125
|
+
},
|
|
1105
1126
|
"vphone_rpc": {
|
|
1106
1127
|
"writes": [],
|
|
1107
1128
|
"reads": []
|
|
@@ -1132,10 +1153,22 @@
|
|
|
1132
1153
|
"writes": [],
|
|
1133
1154
|
"reads": []
|
|
1134
1155
|
},
|
|
1156
|
+
"vphone_tap_element": {
|
|
1157
|
+
"writes": [],
|
|
1158
|
+
"reads": []
|
|
1159
|
+
},
|
|
1160
|
+
"vphone_type_element": {
|
|
1161
|
+
"writes": [],
|
|
1162
|
+
"reads": []
|
|
1163
|
+
},
|
|
1135
1164
|
"vphone_ui_tree": {
|
|
1136
1165
|
"writes": [],
|
|
1137
1166
|
"reads": []
|
|
1138
1167
|
},
|
|
1168
|
+
"vphone_wait_for": {
|
|
1169
|
+
"writes": [],
|
|
1170
|
+
"reads": []
|
|
1171
|
+
},
|
|
1139
1172
|
"web_assert_aria": {
|
|
1140
1173
|
"writes": [],
|
|
1141
1174
|
"reads": []
|
|
@@ -21,7 +21,7 @@ import { launchRepoAllowed, launchRepos } from "./launch-request.mjs";
|
|
|
21
21
|
import { selectRuns } from "./runs-index.mjs";
|
|
22
22
|
|
|
23
23
|
/** The contract as a whole; pipeline/contract/manifest.json carries the same. */
|
|
24
|
-
export const CONTRACT_VERSION = "2.
|
|
24
|
+
export const CONTRACT_VERSION = "2.3.0";
|
|
25
25
|
/** Confirm tokens held at once; the oldest is dropped past this. */
|
|
26
26
|
export const MAX_CONFIRMS = 256;
|
|
27
27
|
/** How long a kill or gc confirm token stays valid. */
|
|
@@ -12,6 +12,7 @@ import { CONTRACT_VERSION as LEARNING_VERSION, cachedLearningCurve } from "./lea
|
|
|
12
12
|
import { officeLedger } from "./office-ledger.mjs";
|
|
13
13
|
import { officeMemory } from "./office-memory.mjs";
|
|
14
14
|
import { officeServerRoom } from "./office-server-room.mjs";
|
|
15
|
+
import { createMcpHealthCache } from "./mcp-health.mjs";
|
|
15
16
|
import { officeArchive } from "./office-archive.mjs";
|
|
16
17
|
import { systemStatus } from "./system-status.mjs";
|
|
17
18
|
import { reapEndedJobs } from "./job-launch.mjs";
|
|
@@ -21,6 +22,7 @@ const SESSION_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;
|
|
|
21
22
|
const AGENT_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
|
|
22
23
|
|
|
23
24
|
const activityCache = createActivityCache();
|
|
25
|
+
const mcpHealthCached = createMcpHealthCache();
|
|
24
26
|
// Each session list the floor reads once is also where the office learns a
|
|
25
27
|
// job ended: its run home and launch file are removed then.
|
|
26
28
|
let reapedFor = null;
|
|
@@ -141,6 +143,16 @@ export const officeRoutes = {
|
|
|
141
143
|
async () => officeServerRoom({ activity: await activityNow(), lang: officeLang() }),
|
|
142
144
|
),
|
|
143
145
|
},
|
|
146
|
+
mcpHealth: {
|
|
147
|
+
method: "GET",
|
|
148
|
+
path: "/v1/mcp-health",
|
|
149
|
+
query: [],
|
|
150
|
+
remote: "local-only",
|
|
151
|
+
handle: shared(
|
|
152
|
+
() => "mcp-health",
|
|
153
|
+
() => mcpHealthCached(),
|
|
154
|
+
),
|
|
155
|
+
},
|
|
144
156
|
archive: {
|
|
145
157
|
method: "GET",
|
|
146
158
|
path: "/v1/archive",
|
|
@@ -21,11 +21,6 @@
|
|
|
21
21
|
* A NOTICE file left in a plugin's knowledge/ by an earlier build is removed:
|
|
22
22
|
* the skills are written here and ship without attribution files.
|
|
23
23
|
*
|
|
24
|
-
* A skill renamed in pipeline/skills/renamed.json keeps its old name in the
|
|
25
|
-
* plugin as a one-file alias skill (see _renamed-skills.mjs), written into the
|
|
26
|
-
* plugin that carries the new name and declared in plugin.json beside it, so
|
|
27
|
-
* `/<plugin>:<old>` and references that still name the old skill keep working.
|
|
28
|
-
*
|
|
29
24
|
* Usage:
|
|
30
25
|
* node build-stack-plugins.mjs [--plugins-repo <path>] [--pipeline <path>] [--dry-run]
|
|
31
26
|
* node build-stack-plugins.mjs --check-routing
|
|
@@ -94,13 +89,6 @@ import {
|
|
|
94
89
|
STACK_ONLY,
|
|
95
90
|
STACK_PATTERNS,
|
|
96
91
|
} from "./_stack-routing.mjs";
|
|
97
|
-
import {
|
|
98
|
-
aliasSkillMarkdown,
|
|
99
|
-
aliasesFor,
|
|
100
|
-
isUserInvocableOff,
|
|
101
|
-
loadRenamed,
|
|
102
|
-
renamedProblems,
|
|
103
|
-
} from "./_renamed-skills.mjs";
|
|
104
92
|
import { exitOnHelp } from "../lib/cli-help.mjs";
|
|
105
93
|
|
|
106
94
|
exitOnHelp(import.meta.url);
|
|
@@ -155,8 +143,6 @@ if (!existsSync(EXTERNAL)) {
|
|
|
155
143
|
process.exit(args.includes("--check-routing") ? 1 : 0);
|
|
156
144
|
}
|
|
157
145
|
const allSkills = listDirs(EXTERNAL);
|
|
158
|
-
const renamed = loadRenamed(PIPE_ROOT);
|
|
159
|
-
const renameProblems = renamedProblems(renamed, new Set(allSkills), new Set(allSkills));
|
|
160
146
|
|
|
161
147
|
// --- 2. compute desired knowledge set per plugin -------------------------
|
|
162
148
|
const desired = { [COMMON_PLUGIN]: new Set(), [ANALYST_PLUGIN]: new Set() };
|
|
@@ -212,12 +198,6 @@ for (const skill of allSkills) {
|
|
|
212
198
|
if (owners.length > 1) multiRouted.push(`${skill} -> ${owners.join(" + ")}`);
|
|
213
199
|
}
|
|
214
200
|
|
|
215
|
-
if (renameProblems.length) {
|
|
216
|
-
console.error(`renamed.json: ${renameProblems.length} problem(s)`);
|
|
217
|
-
for (const p of renameProblems) console.error(` FAIL ${p}`);
|
|
218
|
-
process.exit(1);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
201
|
if (args.includes("--check-routing")) {
|
|
222
202
|
if (multiRouted.length) {
|
|
223
203
|
console.error(
|
|
@@ -248,17 +228,8 @@ for (const [plugin, want] of Object.entries(desired)) {
|
|
|
248
228
|
continue;
|
|
249
229
|
}
|
|
250
230
|
|
|
251
|
-
const aliases = new Map(
|
|
252
|
-
aliasesFor(renamed, want).map(([oldName, newName]) => [
|
|
253
|
-
oldName,
|
|
254
|
-
aliasSkillMarkdown(oldName, newName, {
|
|
255
|
-
removeIn: renamed.removeIn,
|
|
256
|
-
userInvocable: !isUserInvocableOff(join(EXTERNAL, newName, "SKILL.md")),
|
|
257
|
-
}),
|
|
258
|
-
]),
|
|
259
|
-
);
|
|
260
231
|
const have = new Set(listDirs(kdir));
|
|
261
|
-
const wanted = new Set(
|
|
232
|
+
const wanted = new Set(want);
|
|
262
233
|
const toAdd = [...wanted].filter((s) => !have.has(s)).sort();
|
|
263
234
|
const toRemove = [...have].filter((s) => !wanted.has(s)).sort();
|
|
264
235
|
const setChanged = toAdd.length > 0 || toRemove.length > 0;
|
|
@@ -282,21 +253,6 @@ for (const [plugin, want] of Object.entries(desired)) {
|
|
|
282
253
|
cpSync(from, to, { recursive: true });
|
|
283
254
|
}
|
|
284
255
|
}
|
|
285
|
-
for (const [oldName, text] of aliases) {
|
|
286
|
-
const to = join(kdir, oldName);
|
|
287
|
-
const current = existsSync(to) ? readdirSync(to) : [];
|
|
288
|
-
const same =
|
|
289
|
-
current.length === 1 &&
|
|
290
|
-
current[0] === "SKILL.md" &&
|
|
291
|
-
readFileSync(join(to, "SKILL.md"), "utf8") === text;
|
|
292
|
-
if (same) continue;
|
|
293
|
-
contentChanged = true;
|
|
294
|
-
if (!DRY) {
|
|
295
|
-
rmSync(to, { recursive: true, force: true });
|
|
296
|
-
mkdirSync(to, { recursive: true });
|
|
297
|
-
writeFileSync(join(to, "SKILL.md"), text);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
256
|
if (!DRY) {
|
|
301
257
|
for (const s of toRemove) rmSync(join(kdir, s), { recursive: true, force: true });
|
|
302
258
|
}
|
|
@@ -351,7 +307,6 @@ for (const [plugin, want] of Object.entries(desired)) {
|
|
|
351
307
|
plugin,
|
|
352
308
|
added: toAdd,
|
|
353
309
|
removed: toRemove,
|
|
354
|
-
aliases: [...aliases.keys()].sort(),
|
|
355
310
|
skillCount: newSkills.length,
|
|
356
311
|
version: oldV === newV ? oldV : `${oldV} → ${newV}`,
|
|
357
312
|
bumped: oldV !== newV,
|
|
@@ -371,7 +326,6 @@ for (const r of report) {
|
|
|
371
326
|
console.log(` ${r.plugin}: skills=${r.skillCount} version=${r.version} [${flag}]`);
|
|
372
327
|
if (r.added.length) console.log(` + ${r.added.join(", ")}`);
|
|
373
328
|
if (r.removed.length) console.log(` - ${r.removed.join(", ")}`);
|
|
374
|
-
if (r.aliases.length) console.log(` alias: ${r.aliases.join(", ")}`);
|
|
375
329
|
}
|
|
376
330
|
if (unrouted.length) {
|
|
377
331
|
console.log(` ⚠ unrouted (matched no stack, not common/apple-only) - NOT copied anywhere:`);
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
* GET /v1/credentials office-credentials.mjs --json [--probe]
|
|
48
48
|
* GET /v1/memory office-memory.mjs --json
|
|
49
49
|
* GET /v1/server-room office-server-room.mjs --json
|
|
50
|
+
* GET /v1/mcp-health mcp-health.mjs --json
|
|
50
51
|
* GET /v1/archive office-archive.mjs --json
|
|
51
52
|
* GET /v1/runs/{id}/results run-results.mjs: diff, findings, tests, evidence, analysis
|
|
52
53
|
* GET /v1/runs/{id}/evidence/{name} run-results.mjs --evidence: one screenshot
|
|
@@ -366,6 +367,7 @@ export const ROUTES = [
|
|
|
366
367
|
office.credentials,
|
|
367
368
|
office.memory,
|
|
368
369
|
office.serverRoom,
|
|
370
|
+
office.mcpHealth,
|
|
369
371
|
office.archive,
|
|
370
372
|
runs.results,
|
|
371
373
|
runs.evidence,
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @file design-check-config.mjs - hold the user's design-check config to its
|
|
4
|
+
* schema before /multi-agent:design-check uses it.
|
|
5
|
+
*
|
|
6
|
+
* The config is optional and lives at
|
|
7
|
+
* ~/.claude/projects/<project slug>/design-check-config.json, written by the
|
|
8
|
+
* user. A misspelled key or a value of the wrong type would otherwise be
|
|
9
|
+
* ignored or misread deep inside a run, after the build. This checks the file
|
|
10
|
+
* against schemas/design-check-config.schema.json and prints every problem with
|
|
11
|
+
* the dotted path of the key it is about, so the fix is one edit.
|
|
12
|
+
*
|
|
13
|
+
* The check covers the schema keywords that file uses (type, enum, const,
|
|
14
|
+
* required, properties, additionalProperties, items, minimum, maximum) and
|
|
15
|
+
* runs without a validator package. A value is never echoed back, only the key
|
|
16
|
+
* name, the expected shape and the found type. The file is read through the
|
|
17
|
+
* bounded regular-file reader: at most MAX_BYTES, never through a link.
|
|
18
|
+
*
|
|
19
|
+
* Usage:
|
|
20
|
+
* design-check-config.mjs [--repo <dir>] the project folder of that checkout
|
|
21
|
+
* design-check-config.mjs --file <path> one config file
|
|
22
|
+
*
|
|
23
|
+
* Exit: 0 valid, or no file (the defaults apply); 1 the file is invalid, not
|
|
24
|
+
* JSON or unreadable; 2 usage: an unknown flag, a missing value, a --repo
|
|
25
|
+
* path that does not resolve or a --file that does not exist.
|
|
26
|
+
*
|
|
27
|
+
* @module pipeline/scripts/design-check-config
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { readFileSync, realpathSync } from "node:fs";
|
|
31
|
+
import { homedir } from "node:os";
|
|
32
|
+
import { join, resolve } from "node:path";
|
|
33
|
+
|
|
34
|
+
import { parseArgs } from "../lib/args.mjs";
|
|
35
|
+
import { exitOnHelp } from "../lib/cli-help.mjs";
|
|
36
|
+
import { invokedDirectly } from "../lib/invoked-directly.mjs";
|
|
37
|
+
import { mainRepoRoot } from "../lib/repo-profile-root.mjs";
|
|
38
|
+
import { readRegularFile } from "../lib/regular-file.mjs";
|
|
39
|
+
import { projectSlug } from "../lib/slug.mjs";
|
|
40
|
+
|
|
41
|
+
exitOnHelp(import.meta.url);
|
|
42
|
+
|
|
43
|
+
export const CONFIG_FILE = "design-check-config.json";
|
|
44
|
+
const MAX_BYTES = 256 * 1024;
|
|
45
|
+
const MAX_PROBLEMS = 40;
|
|
46
|
+
const KEY_SHOWN = 60;
|
|
47
|
+
|
|
48
|
+
const SCHEMA = JSON.parse(
|
|
49
|
+
readFileSync(new URL("../schemas/design-check-config.schema.json", import.meta.url), "utf8"),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const kindOf = (v) => (v === null ? "null" : Array.isArray(v) ? "array" : typeof v);
|
|
53
|
+
const keyName = (k) =>
|
|
54
|
+
String(k)
|
|
55
|
+
.replace(/[^\x20-\x7e]/g, "?")
|
|
56
|
+
.slice(0, KEY_SHOWN);
|
|
57
|
+
const at = (path, key) => (path === "(root)" ? keyName(key) : `${path}.${keyName(key)}`);
|
|
58
|
+
|
|
59
|
+
function typeMatches(type, v) {
|
|
60
|
+
if (type === "integer") return Number.isInteger(v);
|
|
61
|
+
if (type === "number") return typeof v === "number" && Number.isFinite(v);
|
|
62
|
+
return kindOf(v) === type;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function report(out, message) {
|
|
66
|
+
if (out.length < MAX_PROBLEMS) out.push(message);
|
|
67
|
+
else out.dropped = (out.dropped ?? 0) + 1;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function walk(schema, value, path, out) {
|
|
71
|
+
if (!schema || typeof schema !== "object") return;
|
|
72
|
+
if (schema.type !== undefined) {
|
|
73
|
+
const types = [].concat(schema.type);
|
|
74
|
+
if (!types.some((t) => typeMatches(t, value))) {
|
|
75
|
+
const found = kindOf(value) === "number" ? "number" : kindOf(value);
|
|
76
|
+
report(out, `${path}: expected ${types.join(" or ")}, got ${found}`);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (Object.hasOwn(schema, "const") && value !== schema.const) {
|
|
81
|
+
report(out, `${path}: must be ${JSON.stringify(schema.const)}`);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (Array.isArray(schema.enum) && !schema.enum.includes(value)) {
|
|
85
|
+
report(out, `${path}: must be one of ${schema.enum.join(", ")}`);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (typeof value === "number") {
|
|
89
|
+
if (typeof schema.minimum === "number" && value < schema.minimum)
|
|
90
|
+
report(out, `${path}: must be at least ${schema.minimum}`);
|
|
91
|
+
if (typeof schema.maximum === "number" && value > schema.maximum)
|
|
92
|
+
report(out, `${path}: must be at most ${schema.maximum}`);
|
|
93
|
+
}
|
|
94
|
+
if (Array.isArray(value) && schema.items) {
|
|
95
|
+
value.forEach((item, i) => walk(schema.items, item, `${path}[${i}]`, out));
|
|
96
|
+
}
|
|
97
|
+
if (kindOf(value) === "object") {
|
|
98
|
+
const props = schema.properties ?? {};
|
|
99
|
+
for (const key of schema.required ?? []) {
|
|
100
|
+
if (!Object.hasOwn(value, key)) report(out, `${at(path, key)}: required key is missing`);
|
|
101
|
+
}
|
|
102
|
+
for (const key of Object.keys(value)) {
|
|
103
|
+
if (Object.hasOwn(props, key)) walk(props[key], value[key], at(path, key), out);
|
|
104
|
+
else if (schema.additionalProperties === false) {
|
|
105
|
+
report(out, `${at(path, key)}: unknown key (allowed: ${Object.keys(props).join(", ")})`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Every way a parsed config departs from the schema, one line each, naming the
|
|
113
|
+
* key by its dotted path. An empty list means it is valid.
|
|
114
|
+
* @param {unknown} config
|
|
115
|
+
* @returns {string[]}
|
|
116
|
+
*/
|
|
117
|
+
export function validateConfig(config) {
|
|
118
|
+
const out = [];
|
|
119
|
+
walk(SCHEMA, config, "(root)", out);
|
|
120
|
+
if (out.dropped) out.push(`and ${out.dropped} more`);
|
|
121
|
+
return out;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Where the config of the project `repo` belongs to lives: under the host's
|
|
126
|
+
* project folder, named by the main checkout's path.
|
|
127
|
+
* @param {string} repo
|
|
128
|
+
* @param {NodeJS.ProcessEnv} [env]
|
|
129
|
+
*/
|
|
130
|
+
export function configPathFor(repo, env = process.env) {
|
|
131
|
+
let root;
|
|
132
|
+
try {
|
|
133
|
+
root = mainRepoRoot(repo);
|
|
134
|
+
} catch {
|
|
135
|
+
root = realpathSync(resolve(repo));
|
|
136
|
+
}
|
|
137
|
+
return join(env.HOME || homedir(), ".claude", "projects", projectSlug(root), CONFIG_FILE);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function main(argv) {
|
|
141
|
+
let flags;
|
|
142
|
+
try {
|
|
143
|
+
({ flags } = parseArgs(argv, {
|
|
144
|
+
strings: ["file", "repo"],
|
|
145
|
+
unknown: "error",
|
|
146
|
+
positionals: false,
|
|
147
|
+
emptyIsValue: false,
|
|
148
|
+
equals: false,
|
|
149
|
+
}));
|
|
150
|
+
} catch {
|
|
151
|
+
return usage();
|
|
152
|
+
}
|
|
153
|
+
const file = flags.file === undefined ? null : resolve(flags.file);
|
|
154
|
+
const repo = flags.repo ?? null;
|
|
155
|
+
if (file && repo) return usage();
|
|
156
|
+
let path;
|
|
157
|
+
try {
|
|
158
|
+
path = file ?? configPathFor(repo ?? process.cwd());
|
|
159
|
+
} catch {
|
|
160
|
+
console.error("design-check config: the --repo path does not resolve");
|
|
161
|
+
return 2;
|
|
162
|
+
}
|
|
163
|
+
let text;
|
|
164
|
+
try {
|
|
165
|
+
text = readRegularFile(path, { maxBytes: MAX_BYTES, noFollow: true });
|
|
166
|
+
} catch (e) {
|
|
167
|
+
if (/ENOENT/.test(e?.message ?? "")) {
|
|
168
|
+
if (file) {
|
|
169
|
+
console.error(`design-check config: --file ${path} does not exist`);
|
|
170
|
+
return 2;
|
|
171
|
+
}
|
|
172
|
+
console.log(`no design-check config at ${path}; the defaults apply`);
|
|
173
|
+
return 0;
|
|
174
|
+
}
|
|
175
|
+
console.log(
|
|
176
|
+
`design-check config ${path} cannot be read: it must be a regular file under ${MAX_BYTES / 1024} KiB, not a link`,
|
|
177
|
+
);
|
|
178
|
+
return 1;
|
|
179
|
+
}
|
|
180
|
+
let config;
|
|
181
|
+
try {
|
|
182
|
+
config = JSON.parse(text);
|
|
183
|
+
} catch {
|
|
184
|
+
console.log(`design-check config ${path} is not valid JSON`);
|
|
185
|
+
return 1;
|
|
186
|
+
}
|
|
187
|
+
const problems = validateConfig(config);
|
|
188
|
+
if (problems.length === 0) {
|
|
189
|
+
console.log(`design-check config ${path} is valid`);
|
|
190
|
+
return 0;
|
|
191
|
+
}
|
|
192
|
+
console.log(`design-check config ${path} has ${problems.length} problem(s):`);
|
|
193
|
+
for (const p of problems) console.log(` ${p}`);
|
|
194
|
+
console.log(
|
|
195
|
+
`fix the keys above in ${CONFIG_FILE}; the schema is schemas/design-check-config.schema.json`,
|
|
196
|
+
);
|
|
197
|
+
return 1;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function usage() {
|
|
201
|
+
console.error("usage: design-check-config.mjs [--repo <dir> | --file <path>]");
|
|
202
|
+
return 2;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (invokedDirectly(import.meta.url)) process.exit(main(process.argv.slice(2)));
|
|
@@ -41,7 +41,6 @@ import { join, dirname } from "node:path";
|
|
|
41
41
|
import { fileURLToPath } from "node:url";
|
|
42
42
|
import { spawnSync } from "node:child_process";
|
|
43
43
|
import { siblingsParent } from "./_sibling-root.mjs";
|
|
44
|
-
import { isAliasSkill } from "./_renamed-skills.mjs";
|
|
45
44
|
import { exitOnHelp } from "../lib/cli-help.mjs";
|
|
46
45
|
import { SERVER_CHECKOUT_DIRS } from "../lib/mcp-rename.mjs";
|
|
47
46
|
|
|
@@ -198,7 +197,7 @@ if (existsSync(pluginsDir)) {
|
|
|
198
197
|
const walk = (d) => {
|
|
199
198
|
for (const e of readdirSync(d, { withFileTypes: true })) {
|
|
200
199
|
if (e.isDirectory()) walk(join(d, e.name));
|
|
201
|
-
else if (e.name === "SKILL.md"
|
|
200
|
+
else if (e.name === "SKILL.md") n += 1;
|
|
202
201
|
}
|
|
203
202
|
};
|
|
204
203
|
try {
|