@mmerterden/multi-agent-pipeline 23.7.0 → 24.0.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 +38 -1
- package/README.md +57 -24
- package/README.tr.md +41 -8
- package/SECURITY.md +3 -3
- package/docs/architecture.md +41 -4
- package/docs/ecosystem.md +15 -13
- package/docs/facts.json +5 -4
- package/docs/features.md +59 -15
- package/install/_codex-agents.mjs +13 -8
- package/install/_common.mjs +24 -0
- package/install/_dev-only-files.mjs +4 -0
- package/install/_mcp-register.mjs +6 -2
- package/install/_rewrite-tree.mjs +197 -0
- package/install/codex.mjs +96 -180
- package/install/copilot.mjs +24 -54
- package/install/index.mjs +29 -11
- package/install/templates/codex-instructions.md +21 -5
- package/install/templates/copilot-instructions.md +21 -14
- package/manifest.json +2082 -0
- package/package.json +6 -2
- package/pipeline/commands/multi-agent/SKILL.md +5 -4
- package/pipeline/commands/multi-agent/analysis/SKILL.md +4 -0
- package/pipeline/commands/multi-agent/autopilot-on/SKILL.md +31 -3
- package/pipeline/commands/multi-agent/autopilot-status/SKILL.md +5 -1
- package/pipeline/commands/multi-agent/channels/SKILL.md +16 -8
- package/pipeline/commands/multi-agent/log/SKILL.md +2 -0
- package/pipeline/commands/multi-agent/stack/SKILL.md +1 -1
- package/pipeline/contract/manifest.json +1 -1
- package/pipeline/contract/types/index.d.ts +1 -0
- package/pipeline/lib/_jira-auth.sh +50 -78
- package/pipeline/lib/_service-account.sh +191 -0
- package/pipeline/lib/credential-inventory.sh +49 -37
- package/pipeline/lib/credential-store.sh +48 -3
- package/pipeline/lib/fetch-confluence.sh +76 -92
- package/pipeline/lib/fetch-crashlytics.sh +30 -59
- package/pipeline/lib/fetch-figma-annotations.sh +9 -9
- package/pipeline/lib/fetch-fortify.sh +77 -81
- package/pipeline/lib/fetch-graylog.sh +38 -77
- package/pipeline/lib/figma-mcp-refresh.sh +23 -4
- package/pipeline/lib/figma-screenshot.sh +7 -8
- package/pipeline/lib/figma-token.sh +39 -46
- package/pipeline/lib/host.mjs +138 -0
- package/pipeline/lib/host.sh +48 -0
- package/pipeline/lib/issue-fetcher.sh +25 -41
- package/pipeline/lib/jira-publish.sh +23 -21
- package/pipeline/lib/local-model.mjs +93 -0
- package/pipeline/lib/md2confluence-v3.py +37 -30
- package/pipeline/lib/model-dispatch.sh +41 -4
- package/pipeline/lib/model-resolve.mjs +58 -0
- package/pipeline/lib/post-pr-review.sh +38 -53
- package/pipeline/lib/reviewer-families.mjs +70 -0
- package/pipeline/lib/service-account.mjs +2131 -0
- package/pipeline/lib/service-account.sh +35 -0
- package/pipeline/lib/usage-token.mjs +64 -24
- package/pipeline/lib/usage-vocab.mjs +1 -1
- package/pipeline/lib/user-facing.mjs +11 -3
- package/pipeline/lib/vercel-deploy.sh +17 -26
- package/pipeline/multi-agent-refs/_entry-picker.md +62 -0
- package/pipeline/multi-agent-refs/analysis/intake.md +2 -0
- package/pipeline/multi-agent-refs/analysis/reusable-refs.md +1 -0
- package/pipeline/multi-agent-refs/analysis/unattended.md +135 -0
- package/pipeline/multi-agent-refs/autopilot-on/details.md +16 -0
- package/pipeline/multi-agent-refs/channels/generator.md +10 -2
- package/pipeline/multi-agent-refs/channels/menu.md +3 -1
- package/pipeline/multi-agent-refs/channels/preview.md +3 -1
- package/pipeline/multi-agent-refs/channels/reference.md +16 -2
- package/pipeline/multi-agent-refs/channels/report-file.md +188 -0
- package/pipeline/multi-agent-refs/cross-cli-contract.md +35 -27
- package/pipeline/multi-agent-refs/features/doctor.md +37 -11
- package/pipeline/multi-agent-refs/features/free-models.md +3 -3
- package/pipeline/multi-agent-refs/features/local-model.md +87 -0
- package/pipeline/multi-agent-refs/features/model-fallback.md +25 -10
- package/pipeline/multi-agent-refs/features/product-context.md +6 -5
- package/pipeline/multi-agent-refs/features/service-accounts.md +233 -0
- package/pipeline/multi-agent-refs/features/unattended-security.md +10 -1
- package/pipeline/multi-agent-refs/help/en.md +28 -1
- package/pipeline/multi-agent-refs/help/tr.md +28 -1
- package/pipeline/multi-agent-refs/orchestrator/copilot-pipeline.md +2 -1
- package/pipeline/multi-agent-refs/orchestrator/dispatcher.md +2 -1
- package/pipeline/multi-agent-refs/phases/modes.md +20 -1
- package/pipeline/multi-agent-refs/phases/phase-5-report.md +12 -10
- package/pipeline/multi-agent-refs/phases.md +4 -3
- package/pipeline/multi-agent-refs/review/panel.md +30 -18
- package/pipeline/multi-agent-refs/setup/discovery.md +17 -5
- package/pipeline/multi-agent-refs/setup/token-save-flow.md +21 -2
- package/pipeline/multi-agent-refs/sync/overview.md +11 -5
- package/pipeline/multi-agent-refs/tracker-contract.md +28 -10
- package/pipeline/office/index.html +3 -3
- package/pipeline/schemas/autopilot-config.schema.json +29 -4
- package/pipeline/schemas/hosts.json +512 -0
- package/pipeline/schemas/hosts.schema.json +310 -0
- package/pipeline/schemas/launch.json +22 -2
- package/pipeline/schemas/launch.schema.json +2 -1
- package/pipeline/schemas/phases.json +19 -1
- package/pipeline/schemas/phases.schema.json +8 -0
- package/pipeline/schemas/prefs.schema.json +331 -4
- package/pipeline/scripts/.doctor-mut.47076.mjs +2253 -0
- package/pipeline/scripts/_autopilot-config.mjs +67 -4
- package/pipeline/scripts/_autopilot-item.mjs +67 -0
- package/pipeline/scripts/_autopilot-outcomes.mjs +6 -0
- package/pipeline/scripts/_cost.mjs +75 -3
- package/pipeline/scripts/analysis-sources.mjs +22 -5
- package/pipeline/scripts/analysis-unattended.mjs +360 -0
- package/pipeline/scripts/anonymize-findings.mjs +3 -7
- package/pipeline/scripts/autopilot-arming.mjs +19 -10
- package/pipeline/scripts/autopilot-intake.mjs +124 -27
- package/pipeline/scripts/autopilot-menubar.swift +7 -0
- package/pipeline/scripts/autopilot-runner.mjs +77 -48
- package/pipeline/scripts/autopilot-status.sh +32 -9
- package/pipeline/scripts/bulk-read.sh +37 -5
- package/pipeline/scripts/confluence-readback.mjs +15 -7
- package/pipeline/scripts/cost-table.json +65 -25
- package/pipeline/scripts/doctor.mjs +119 -32
- package/pipeline/scripts/entry-mode.mjs +101 -0
- package/pipeline/scripts/estimate.mjs +30 -16
- package/pipeline/scripts/feedback-send.mjs +11 -8
- package/pipeline/scripts/gen-facts.mjs +7 -9
- package/pipeline/scripts/jira-attach.sh +23 -28
- package/pipeline/scripts/jira-search.sh +5 -21
- package/pipeline/scripts/launch-request.mjs +15 -9
- package/pipeline/scripts/migrate-prefs.mjs +56 -0
- package/pipeline/scripts/phase-tracker.sh +146 -38
- package/pipeline/scripts/priority-review.mjs +14 -7
- package/pipeline/scripts/product-context.mjs +26 -7
- package/pipeline/scripts/prune-logs.sh +4 -2
- package/pipeline/scripts/report-file.mjs +285 -0
- package/pipeline/scripts/rework-escalation.mjs +19 -4
- package/pipeline/scripts/service-read.mjs +19 -17
- package/pipeline/scripts/skill-siblings.mjs +17 -1
- package/pipeline/scripts/status-overview.mjs +20 -10
- package/pipeline/scripts/uninstall.mjs +145 -57
- package/pipeline/scripts/usage-register.mjs +34 -11
- package/pipeline/scripts/usage-report.mjs +31 -26
- package/pipeline/scripts/validate-triage.mjs +11 -1
- package/pipeline/scripts/work-items.mjs +25 -28
- package/pipeline/scripts/write-store-config.mjs +37 -11
- package/pipeline/skills/.skill-manifest.json +4 -4
- package/pipeline/skills/.skills-index.json +1 -1
- package/pipeline/skills/shared/core/multi-agent/SKILL.md +11 -3
- package/pipeline/skills/shared/core/multi-agent-analysis/SKILL.md +2 -0
- package/pipeline/skills/shared/core/multi-agent-channels/SKILL.md +11 -8
- package/pipeline/lib/credential-resolve.mjs +0 -75
package/install/codex.mjs
CHANGED
|
@@ -22,11 +22,11 @@ import { dirname, join } from "path";
|
|
|
22
22
|
|
|
23
23
|
import {
|
|
24
24
|
copyDir,
|
|
25
|
-
copyFile,
|
|
26
25
|
copySkillsIndex,
|
|
27
26
|
countFiles,
|
|
28
27
|
ensureDir,
|
|
29
28
|
ensureRealDir,
|
|
29
|
+
ensureSharedPreferences,
|
|
30
30
|
isCopyJunk,
|
|
31
31
|
isDryRun,
|
|
32
32
|
wipeDir,
|
|
@@ -36,6 +36,15 @@ import { DEV_ONLY_SCRIPTS, countDevOnlyFiles } from "./_dev-only-files.mjs";
|
|
|
36
36
|
import { registerMcpServer } from "./_mcp-register.mjs";
|
|
37
37
|
import { deliverXcodeSkills } from "./_xcode-skills.mjs";
|
|
38
38
|
import { installCodexAgents } from "./_codex-agents.mjs";
|
|
39
|
+
import {
|
|
40
|
+
applyPathRewrites,
|
|
41
|
+
buildPathRewrites,
|
|
42
|
+
installRefs,
|
|
43
|
+
makeCopyTreeRewritten,
|
|
44
|
+
} from "./_rewrite-tree.mjs";
|
|
45
|
+
import { REGISTRY } from "../pipeline/lib/host.mjs";
|
|
46
|
+
import { localModelName } from "../pipeline/lib/local-model.mjs";
|
|
47
|
+
import { prefsFileIn } from "../pipeline/lib/prefs-value.mjs";
|
|
39
48
|
import {
|
|
40
49
|
installAuthoredPluginSkills,
|
|
41
50
|
pipelineOwnedSkillNames,
|
|
@@ -47,7 +56,6 @@ import {
|
|
|
47
56
|
} from "./_platform-filter.mjs";
|
|
48
57
|
import { generateCodexInstructions } from "./_codex-instructions.mjs";
|
|
49
58
|
import { mergeManagedBlock } from "./_managed-block.mjs";
|
|
50
|
-
import { prefsFileIn } from "../pipeline/lib/prefs-value.mjs";
|
|
51
59
|
|
|
52
60
|
/** Start of the pipeline-managed span in `~/.codex/AGENTS.md`. */
|
|
53
61
|
export const AGENTS_MD_START_MARKER = "# Multi-Agent Development Pipeline";
|
|
@@ -74,66 +82,7 @@ export const AGENTS_MD_END_MARKER = "<!-- multi-agent-pipeline:codex-instruction
|
|
|
74
82
|
*
|
|
75
83
|
* @type {ReadonlyArray<{from: RegExp, to: string}>}
|
|
76
84
|
*/
|
|
77
|
-
export const CODEX_PATH_REWRITES =
|
|
78
|
-
// The dispatcher itself. MUST come first: the rules below match the bare
|
|
79
|
-
// `commands/multi-agent` prefix, and `\b` treats the `.` in `multi-agent.md`
|
|
80
|
-
// as a boundary - so a later-ordered rule rewrites this filename into
|
|
81
|
-
// `multi-agent-refs/commands.md`, a path that does not exist. On Codex the
|
|
82
|
-
// dispatcher is the router skill.
|
|
83
|
-
{
|
|
84
|
-
from: /\$HOME\/\.claude\/commands\/multi-agent\.md/g,
|
|
85
|
-
to: "$HOME/.codex/skills/multi-agent/SKILL.md",
|
|
86
|
-
},
|
|
87
|
-
{ from: /~\/\.claude\/commands\/multi-agent\.md/g, to: "~/.codex/skills/multi-agent/SKILL.md" },
|
|
88
|
-
// Current dispatcher spelling (directory layout). MUST also precede the
|
|
89
|
-
// sub-command rule: `commands/multi-agent/SKILL.md` would otherwise become
|
|
90
|
-
// `multi-agent-refs/commands/SKILL.md`, which installRefs deliberately never
|
|
91
|
-
// writes (the top-level SKILL.md ships as the router skill instead).
|
|
92
|
-
{
|
|
93
|
-
from: /\$HOME\/\.claude\/commands\/multi-agent\/SKILL\.md/g,
|
|
94
|
-
to: "$HOME/.codex/skills/multi-agent/SKILL.md",
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
from: /~\/\.claude\/commands\/multi-agent\/SKILL\.md/g,
|
|
98
|
-
to: "~/.codex/skills/multi-agent/SKILL.md",
|
|
99
|
-
},
|
|
100
|
-
// Sub-command specs become reference files under the Codex refs tree.
|
|
101
|
-
{
|
|
102
|
-
from: /\$HOME\/\.claude\/commands\/multi-agent\b/g,
|
|
103
|
-
to: "$HOME/.codex/multi-agent-refs/commands",
|
|
104
|
-
},
|
|
105
|
-
{ from: /~\/\.claude\/commands\/multi-agent\b/g, to: "~/.codex/multi-agent-refs/commands" },
|
|
106
|
-
// Standalone command specs (sim-test.md, deploy.md, ...) land in the same
|
|
107
|
-
// refs/commands dir, so these generic rules follow the multi-agent ones.
|
|
108
|
-
{ from: /\$HOME\/\.claude\/commands\b/g, to: "$HOME/.codex/multi-agent-refs/commands" },
|
|
109
|
-
{ from: /~\/\.claude\/commands\b/g, to: "~/.codex/multi-agent-refs/commands" },
|
|
110
|
-
// Skills live under the refs tree on this host, so a skill referenced by path
|
|
111
|
-
// (the compliance pair, humanizer, the xcode-build family) has to point there.
|
|
112
|
-
// MUST precede the bare `multi-agent-refs` rule below, which would otherwise
|
|
113
|
-
// leave the `/skills` segment pointing at the Claude tree.
|
|
114
|
-
{ from: /\$HOME\/\.claude\/skills\b/g, to: "$HOME/.codex/multi-agent-refs/skills" },
|
|
115
|
-
{ from: /~\/\.claude\/skills\b/g, to: "~/.codex/multi-agent-refs/skills" },
|
|
116
|
-
{ from: /\$HOME\/\.claude\/multi-agent-refs\b/g, to: "$HOME/.codex/multi-agent-refs" },
|
|
117
|
-
{ from: /~\/\.claude\/multi-agent-refs\b/g, to: "~/.codex/multi-agent-refs" },
|
|
118
|
-
{ from: /\$HOME\/\.claude\/agents\b/g, to: "$HOME/.codex/agents" },
|
|
119
|
-
{ from: /~\/\.claude\/agents\b/g, to: "~/.codex/agents" },
|
|
120
|
-
{ from: /\$HOME\/\.claude\/scripts\b/g, to: "$HOME/.codex/scripts" },
|
|
121
|
-
{ from: /~\/\.claude\/scripts\b/g, to: "~/.codex/scripts" },
|
|
122
|
-
{ from: /\$HOME\/\.claude\/lib\b/g, to: "$HOME/.codex/lib" },
|
|
123
|
-
{ from: /~\/\.claude\/lib\b/g, to: "~/.codex/lib" },
|
|
124
|
-
{ from: /\$HOME\/\.claude\/schemas\b/g, to: "$HOME/.codex/schemas" },
|
|
125
|
-
{ from: /~\/\.claude\/schemas\b/g, to: "~/.codex/schemas" },
|
|
126
|
-
// The convention rules the analysis phase falls back to when a project ships
|
|
127
|
-
// no standards file. Dangling here means that fallback silently yields
|
|
128
|
-
// nothing, so the tree is installed on Codex too.
|
|
129
|
-
{ from: /\$HOME\/\.claude\/rules\b/g, to: "$HOME/.codex/rules" },
|
|
130
|
-
{ from: /~\/\.claude\/rules\b/g, to: "~/.codex/rules" },
|
|
131
|
-
// Personas are Markdown on Claude Code and generated TOML on Codex, so the
|
|
132
|
-
// directory rewrite above is not enough: `agents/code-reviewer.md` has to
|
|
133
|
-
// become `agents/code-reviewer.toml` or every persona reference in the refs
|
|
134
|
-
// resolves to nothing. Runs last, after the directory rules.
|
|
135
|
-
{ from: /(\$HOME|~)\/\.codex\/agents\/([a-z0-9-]+)\.md\b/g, to: "$1/.codex/agents/$2.toml" },
|
|
136
|
-
]);
|
|
85
|
+
export const CODEX_PATH_REWRITES = buildPathRewrites("codex");
|
|
137
86
|
|
|
138
87
|
/**
|
|
139
88
|
* Apply the Codex path map to a file's text.
|
|
@@ -142,9 +91,7 @@ export const CODEX_PATH_REWRITES = Object.freeze([
|
|
|
142
91
|
* @returns {string}
|
|
143
92
|
*/
|
|
144
93
|
export function rewriteCodexPaths(text) {
|
|
145
|
-
|
|
146
|
-
for (const { from, to } of CODEX_PATH_REWRITES) out = out.replace(from, to);
|
|
147
|
-
return out;
|
|
94
|
+
return applyPathRewrites(CODEX_PATH_REWRITES, text);
|
|
148
95
|
}
|
|
149
96
|
|
|
150
97
|
/**
|
|
@@ -201,7 +148,18 @@ export function installCodex(ctx) {
|
|
|
201
148
|
// it selects which stack plugin's authored skills are delivered.
|
|
202
149
|
const { home, pipelineSrc, useSymlinks, platformFlag } = ctx;
|
|
203
150
|
|
|
204
|
-
|
|
151
|
+
// Two hosts share this installer: Codex CLI itself, and the local-model host,
|
|
152
|
+
// which is the same engine pointed at a model served from this machine and
|
|
153
|
+
// given a tree of its own. Everything that differs between them is a field on
|
|
154
|
+
// the registry record, so nothing below names either one.
|
|
155
|
+
const hostId = ctx.hostId ?? "codex";
|
|
156
|
+
const host = REGISTRY.hosts[hostId];
|
|
157
|
+
const label = host.label;
|
|
158
|
+
const copyTree = makeCopyTreeRewritten((text) =>
|
|
159
|
+
applyPathRewrites(buildPathRewrites(hostId), text),
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
const CODEX_DIR = join(home, host.install.root);
|
|
205
163
|
const CODEX_SKILLS = join(CODEX_DIR, "skills");
|
|
206
164
|
const CODEX_MA_REFS = join(CODEX_DIR, "multi-agent-refs");
|
|
207
165
|
const CODEX_AGENTS = join(CODEX_DIR, "agents");
|
|
@@ -214,24 +172,24 @@ export function installCodex(ctx) {
|
|
|
214
172
|
const CODEX_RULES = join(CODEX_DIR, "rules");
|
|
215
173
|
const CODEX_SKILL_REFS = join(CODEX_MA_REFS, "skills");
|
|
216
174
|
|
|
217
|
-
console.log(
|
|
175
|
+
console.log(` [${label}] Installing pipeline orchestrator...`);
|
|
218
176
|
ensureDir(CODEX_DIR);
|
|
219
177
|
|
|
220
|
-
installRouterSkill(pipelineSrc, CODEX_SKILLS);
|
|
221
|
-
installRefs(pipelineSrc, CODEX_MA_REFS);
|
|
222
|
-
installPersonas(pipelineSrc, CODEX_AGENTS);
|
|
223
|
-
installPrompt(CODEX_PROMPTS);
|
|
224
|
-
installUserOnlyPrompts(pipelineSrc, CODEX_PROMPTS);
|
|
225
|
-
installSkillRefs(pipelineSrc, CODEX_SKILL_REFS, home, platformFlag);
|
|
178
|
+
installRouterSkill(pipelineSrc, CODEX_SKILLS, copyTree, hostId);
|
|
179
|
+
installRefs(pipelineSrc, CODEX_MA_REFS, copyTree);
|
|
180
|
+
installPersonas(pipelineSrc, CODEX_AGENTS, hostId, home);
|
|
181
|
+
installPrompt(CODEX_PROMPTS, hostId);
|
|
182
|
+
installUserOnlyPrompts(pipelineSrc, CODEX_PROMPTS, hostId);
|
|
183
|
+
installSkillRefs(pipelineSrc, CODEX_SKILL_REFS, home, platformFlag, copyTree);
|
|
226
184
|
installScripts(pipelineSrc, CODEX_SCRIPTS, useSymlinks);
|
|
227
|
-
installTree("lib", pipelineSrc, CODEX_LIB, useSymlinks);
|
|
228
|
-
installTree("schemas", pipelineSrc, CODEX_SCHEMAS, useSymlinks);
|
|
229
|
-
installTree("office", pipelineSrc, CODEX_OFFICE, useSymlinks);
|
|
230
|
-
installTree("rules", pipelineSrc, CODEX_RULES, useSymlinks);
|
|
185
|
+
installTree("lib", pipelineSrc, CODEX_LIB, useSymlinks, copyTree);
|
|
186
|
+
installTree("schemas", pipelineSrc, CODEX_SCHEMAS, useSymlinks, copyTree);
|
|
187
|
+
installTree("office", pipelineSrc, CODEX_OFFICE, useSymlinks, copyTree);
|
|
188
|
+
installTree("rules", pipelineSrc, CODEX_RULES, useSymlinks, copyTree);
|
|
231
189
|
installTemplates(pipelineSrc, CODEX_TEMPLATES, useSymlinks);
|
|
232
|
-
writeAgentsMd(join(CODEX_DIR, "AGENTS.md"));
|
|
190
|
+
writeAgentsMd(join(CODEX_DIR, "AGENTS.md"), hostId);
|
|
233
191
|
ensureSharedPreferences(home, pipelineSrc);
|
|
234
|
-
registerMcpServer("codex", "
|
|
192
|
+
registerMcpServer("codex", label, { codexHome: hostId === "codex" ? null : CODEX_DIR });
|
|
235
193
|
|
|
236
194
|
console.log("");
|
|
237
195
|
}
|
|
@@ -240,7 +198,7 @@ export function installCodex(ctx) {
|
|
|
240
198
|
* Write the single router skill, and prune per-command skill dirs left by any
|
|
241
199
|
* install that predates the one-skill layout.
|
|
242
200
|
*/
|
|
243
|
-
function installRouterSkill(pipelineSrc, skillsDir) {
|
|
201
|
+
function installRouterSkill(pipelineSrc, skillsDir, copyTree, hostId = "codex") {
|
|
244
202
|
const dispatcherSrc = join(pipelineSrc, "commands", "multi-agent", "SKILL.md");
|
|
245
203
|
if (!existsSync(dispatcherSrc)) return;
|
|
246
204
|
|
|
@@ -251,7 +209,8 @@ function installRouterSkill(pipelineSrc, skillsDir) {
|
|
|
251
209
|
pruneLegacyCommandSkills(skillsDir);
|
|
252
210
|
|
|
253
211
|
const raw = readFileSync(dispatcherSrc, "utf-8");
|
|
254
|
-
const
|
|
212
|
+
const rewrite = (text) => applyPathRewrites(buildPathRewrites(hostId), text);
|
|
213
|
+
const skill = rewrite(toCodexSkill(raw, "multi-agent"));
|
|
255
214
|
const dest = join(skillsDir, "multi-agent");
|
|
256
215
|
ensureDir(dest);
|
|
257
216
|
writeFile(join(dest, "SKILL.md"), skill);
|
|
@@ -294,82 +253,50 @@ function pruneLegacyCommandSkills(skillsDir) {
|
|
|
294
253
|
}
|
|
295
254
|
|
|
296
255
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
256
|
+
* Copy a tree into the Codex install, retargeting every `$HOME/.claude/...`
|
|
257
|
+
* path it carries. The machinery is shared with the other hosts; only the path
|
|
258
|
+
* map is this host's.
|
|
259
|
+
*
|
|
260
|
+
* @type {(src: string, dest: string, filter?: (rel: string) => boolean) => number}
|
|
300
261
|
*/
|
|
301
|
-
|
|
302
|
-
const refsSrc = join(pipelineSrc, "multi-agent-refs");
|
|
303
|
-
const commandsSrc = join(pipelineSrc, "commands", "multi-agent");
|
|
304
|
-
|
|
305
|
-
if (ensureRealDir(dest) === null) return;
|
|
306
|
-
ensureDir(dest);
|
|
307
|
-
wipeDir(dest);
|
|
262
|
+
const copyTreeRewritten = makeCopyTreeRewritten(rewriteCodexPaths);
|
|
308
263
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
// The sub-command specs. Skip ONLY the top-level dispatcher SKILL.md -
|
|
313
|
-
// it already shipped as the router skill. The filter is on the path relative
|
|
314
|
-
// to the copy root, not the basename: every sub-command spec is itself named
|
|
315
|
-
// SKILL.md, so a basename filter would copy N empty directories and leave
|
|
316
|
-
// the orchestrator with nothing to read.
|
|
317
|
-
if (existsSync(commandsSrc)) {
|
|
318
|
-
count += copyTreeRewritten(commandsSrc, join(dest, "commands"), (rel) => rel !== "SKILL.md");
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// Standalone Claude Code command specs (sim-test, deploy, archive-guard, ...).
|
|
322
|
-
// The router delegates to these by path, so a Codex install that omits them
|
|
323
|
-
// leaves those routes dangling.
|
|
324
|
-
const standaloneSrc = join(pipelineSrc, "commands");
|
|
325
|
-
if (existsSync(standaloneSrc)) {
|
|
326
|
-
count += copyTreeRewritten(standaloneSrc, join(dest, "commands"), (rel) =>
|
|
327
|
-
/^[^/]+\.md$/.test(rel),
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
console.log(` -> ${count} reference file(s) copied to ${dest}`);
|
|
332
|
-
}
|
|
264
|
+
/** The copier a helper uses when its caller passed none (the Codex host). */
|
|
265
|
+
const orDefault = (copyTree) => copyTree ?? copyTreeRewritten;
|
|
333
266
|
|
|
334
267
|
/**
|
|
335
|
-
*
|
|
268
|
+
* Persona rung -> the model and effort this host writes into an agent TOML.
|
|
336
269
|
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
270
|
+
* Codex CLI's rungs are fixed model ids and come straight off the registry.
|
|
271
|
+
* The local host's are a placeholder: which model answers is the user's choice,
|
|
272
|
+
* so it is read from preferences at install time and validated there. Without a
|
|
273
|
+
* choice recorded, no agent is bound to a model at all and the children inherit
|
|
274
|
+
* whatever the session was started on, which is the one answer that cannot be
|
|
275
|
+
* wrong.
|
|
339
276
|
*
|
|
340
|
-
* @param {string}
|
|
341
|
-
* @param {string}
|
|
342
|
-
* @param {(relPath: string) => boolean} [filter] - receives the path relative to
|
|
343
|
-
* the copy root (POSIX-separated), not the basename. Return false to skip.
|
|
344
|
-
* @param {string} [relBase] - internal: accumulated relative path
|
|
345
|
-
* @returns {number} files written
|
|
277
|
+
* @param {string} hostId
|
|
278
|
+
* @param {string|null} home
|
|
346
279
|
*/
|
|
347
|
-
function
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
if (!entry.isFile()) continue;
|
|
359
|
-
if (filter && !filter(rel)) continue;
|
|
360
|
-
ensureDir(dest);
|
|
361
|
-
const raw = readFileSync(from, TEXT.test(entry.name) ? "utf-8" : null);
|
|
362
|
-
writeFile(to, TEXT.test(entry.name) ? rewriteCodexPaths(raw) : raw);
|
|
363
|
-
n++;
|
|
280
|
+
function tierMapFor(hostId, home) {
|
|
281
|
+
const rungs = REGISTRY.hosts[hostId].models.rungs;
|
|
282
|
+
const placeholder = REGISTRY.hosts[hostId].pricing.ceilingKey === "local";
|
|
283
|
+
if (!placeholder) {
|
|
284
|
+
return Object.fromEntries(
|
|
285
|
+
Object.entries(rungs).map(([rung, slot]) => [
|
|
286
|
+
rung,
|
|
287
|
+
{ model: slot.model, reasoning_effort: slot.effort },
|
|
288
|
+
]),
|
|
289
|
+
);
|
|
364
290
|
}
|
|
365
|
-
|
|
291
|
+
const chosen = home ? localModelName(prefsFileIn(home)) : null;
|
|
292
|
+
return Object.fromEntries(Object.keys(rungs).map((rung) => [rung, { model: chosen }]));
|
|
366
293
|
}
|
|
367
294
|
|
|
368
|
-
function installPersonas(pipelineSrc, dest) {
|
|
295
|
+
function installPersonas(pipelineSrc, dest, hostId = "codex", home = null) {
|
|
369
296
|
const agentsSrc = join(pipelineSrc, "agents");
|
|
370
297
|
if (!existsSync(agentsSrc)) return;
|
|
371
|
-
const written = installCodexAgents(agentsSrc, dest);
|
|
372
|
-
console.log(` -> ${written} persona(s) generated as
|
|
298
|
+
const written = installCodexAgents(agentsSrc, dest, { tierMap: tierMapFor(hostId, home) });
|
|
299
|
+
console.log(` -> ${written} persona(s) generated as agent TOML in ${dest}`);
|
|
373
300
|
}
|
|
374
301
|
|
|
375
302
|
/**
|
|
@@ -377,16 +304,17 @@ function installPersonas(pipelineSrc, dest) {
|
|
|
377
304
|
* command. It is a two-line router into the skill, not a second copy of the
|
|
378
305
|
* orchestrator - one spec, two entry points.
|
|
379
306
|
*/
|
|
380
|
-
function installPrompt(promptsDir) {
|
|
307
|
+
function installPrompt(promptsDir, hostId = "codex") {
|
|
308
|
+
const root = REGISTRY.hosts[hostId].install.root;
|
|
381
309
|
promptsDir = ensureRealDir(promptsDir, { userOwned: true });
|
|
382
310
|
ensureDir(promptsDir);
|
|
383
311
|
const body = [
|
|
384
312
|
"Run the multi-agent development pipeline.",
|
|
385
313
|
"",
|
|
386
|
-
|
|
314
|
+
`Load the orchestrator spec at \`$HOME/${root}/skills/multi-agent/SKILL.md\` and follow it`,
|
|
387
315
|
"for the input below. Sub-command specs are at",
|
|
388
|
-
|
|
389
|
-
|
|
316
|
+
`\`$HOME/${root}/multi-agent-refs/commands/<cmd>/SKILL.md\`; phase specs are at`,
|
|
317
|
+
`\`$HOME/${root}/multi-agent-refs/phases/\`. Read them on demand as the spec directs.`,
|
|
390
318
|
"",
|
|
391
319
|
"Input: $ARGUMENTS",
|
|
392
320
|
"",
|
|
@@ -426,7 +354,8 @@ export function userOnlyCommandIds(pipelineSrc) {
|
|
|
426
354
|
* @param {string} pipelineSrc
|
|
427
355
|
* @param {string} promptsDir
|
|
428
356
|
*/
|
|
429
|
-
export function installUserOnlyPrompts(pipelineSrc, promptsDir) {
|
|
357
|
+
export function installUserOnlyPrompts(pipelineSrc, promptsDir, hostId = "codex") {
|
|
358
|
+
const root = REGISTRY.hosts[hostId].install.root;
|
|
430
359
|
promptsDir = ensureRealDir(promptsDir, { userOwned: true });
|
|
431
360
|
ensureDir(promptsDir);
|
|
432
361
|
const ids = userOnlyCommandIds(pipelineSrc);
|
|
@@ -442,7 +371,7 @@ export function installUserOnlyPrompts(pipelineSrc, promptsDir) {
|
|
|
442
371
|
const body = [
|
|
443
372
|
`Run the multi-agent pipeline's \`${id}\` command. The user typed it, so it may run.`,
|
|
444
373
|
"",
|
|
445
|
-
`Read \`$HOME
|
|
374
|
+
`Read \`$HOME/${root}/multi-agent-refs/commands/${id}/SKILL.md\` and follow it for the input below.`,
|
|
446
375
|
"",
|
|
447
376
|
"Input: $ARGUMENTS",
|
|
448
377
|
"",
|
|
@@ -469,7 +398,8 @@ export function installUserOnlyPrompts(pipelineSrc, promptsDir) {
|
|
|
469
398
|
* - the pipeline's own `skills/shared/external` (what `~/.claude/skills` receives)
|
|
470
399
|
* - the enabled stack plugin's authored skills (what the marketplace provides)
|
|
471
400
|
*/
|
|
472
|
-
function installSkillRefs(pipelineSrc, dest, home, platformFlag) {
|
|
401
|
+
function installSkillRefs(pipelineSrc, dest, home, platformFlag, copyTree) {
|
|
402
|
+
copyTree = orDefault(copyTree);
|
|
473
403
|
const externalSrc = join(pipelineSrc, "skills", "shared", "external");
|
|
474
404
|
const coreSrc = join(pipelineSrc, "skills", "shared", "core");
|
|
475
405
|
|
|
@@ -487,7 +417,7 @@ function installSkillRefs(pipelineSrc, dest, home, platformFlag) {
|
|
|
487
417
|
const { names: enabled, source: selectionSource } = pluginsToDeliver(home, platformFlag);
|
|
488
418
|
const { keep, skipped } = partitionExternalSkillsByPlugins(externalSrc, enabled);
|
|
489
419
|
for (const name of keep) {
|
|
490
|
-
count +=
|
|
420
|
+
count += copyTree(join(externalSrc, name), join(dest, name));
|
|
491
421
|
}
|
|
492
422
|
writeExternalSkillsManifest(dest, keep);
|
|
493
423
|
console.log(
|
|
@@ -501,7 +431,7 @@ function installSkillRefs(pipelineSrc, dest, home, platformFlag) {
|
|
|
501
431
|
// them. The `multi-agent*` dirs stay out: those are sub-command specs, and they ship as
|
|
502
432
|
// refs under `commands/` precisely so they never enter the skills block.
|
|
503
433
|
if (existsSync(coreSrc)) {
|
|
504
|
-
count +=
|
|
434
|
+
count += copyTree(
|
|
505
435
|
coreSrc,
|
|
506
436
|
dest,
|
|
507
437
|
(rel) => !rel.startsWith("multi-agent/") && !rel.startsWith("multi-agent-"),
|
|
@@ -518,7 +448,7 @@ function installSkillRefs(pipelineSrc, dest, home, platformFlag) {
|
|
|
518
448
|
label: "Codex CLI",
|
|
519
449
|
skipNames: pipelineOwnedSkillNames(pipelineSrc),
|
|
520
450
|
copy: (from, to) => {
|
|
521
|
-
if (!isDryRun())
|
|
451
|
+
if (!isDryRun()) copyTree(from, to, (rel) => !isCopyJunk(rel));
|
|
522
452
|
},
|
|
523
453
|
});
|
|
524
454
|
|
|
@@ -529,7 +459,7 @@ function installSkillRefs(pipelineSrc, dest, home, platformFlag) {
|
|
|
529
459
|
format: "codex",
|
|
530
460
|
enabled: pluginsToDeliver(home, platformFlag).names.includes("ai-ios-toolkit"),
|
|
531
461
|
taken: new Set([...pipelineOwnedSkillNames(pipelineSrc), ...res.deliveredNames]),
|
|
532
|
-
copy: (from, to) =>
|
|
462
|
+
copy: (from, to) => copyTree(from, to, (rel) => !isCopyJunk(rel)),
|
|
533
463
|
});
|
|
534
464
|
|
|
535
465
|
// The index lands beside the refs it indexes. Codex has no skills block to feed,
|
|
@@ -593,7 +523,8 @@ function installTemplates(pipelineSrc, dest, useSymlinks) {
|
|
|
593
523
|
console.log(` -> ${countFiles(src)} template file(s) copied to ${dest}`);
|
|
594
524
|
}
|
|
595
525
|
|
|
596
|
-
function installTree(name, pipelineSrc, dest, useSymlinks) {
|
|
526
|
+
function installTree(name, pipelineSrc, dest, useSymlinks, copyTree) {
|
|
527
|
+
copyTree = orDefault(copyTree);
|
|
597
528
|
const src = join(pipelineSrc, name);
|
|
598
529
|
if (!existsSync(src)) return;
|
|
599
530
|
if (!useSymlinks) {
|
|
@@ -602,7 +533,7 @@ function installTree(name, pipelineSrc, dest, useSymlinks) {
|
|
|
602
533
|
}
|
|
603
534
|
wipeDir(dest);
|
|
604
535
|
if (!useSymlinks && REWRITTEN_TREES.has(name)) {
|
|
605
|
-
const n =
|
|
536
|
+
const n = copyTree(src, dest);
|
|
606
537
|
console.log(` -> ${n} ${name} file(s) copied to ${dest} (paths retargeted)`);
|
|
607
538
|
return;
|
|
608
539
|
}
|
|
@@ -610,10 +541,15 @@ function installTree(name, pipelineSrc, dest, useSymlinks) {
|
|
|
610
541
|
console.log(` -> ${countFiles(src)} ${name} file(s) copied to ${dest}`);
|
|
611
542
|
}
|
|
612
543
|
|
|
613
|
-
function writeAgentsMd(path) {
|
|
544
|
+
function writeAgentsMd(path, hostId = "codex") {
|
|
545
|
+
// The instructions block is authored against the engine's default tree. A
|
|
546
|
+
// second install of the same engine keeps its own, so the same rewrite the
|
|
547
|
+
// refs go through applies here: an instruction naming the other install's
|
|
548
|
+
// tree would send every run to the wrong files.
|
|
549
|
+
const rewrite = (text) => applyPathRewrites(buildPathRewrites(hostId), text);
|
|
614
550
|
const result = mergeManagedBlock({
|
|
615
551
|
path,
|
|
616
|
-
body: generateCodexInstructions(),
|
|
552
|
+
body: rewrite(generateCodexInstructions()),
|
|
617
553
|
startMarker: AGENTS_MD_START_MARKER,
|
|
618
554
|
endMarker: AGENTS_MD_END_MARKER,
|
|
619
555
|
});
|
|
@@ -626,26 +562,6 @@ function writeAgentsMd(path) {
|
|
|
626
562
|
console.log(` -> ${verb} ${path}`);
|
|
627
563
|
}
|
|
628
564
|
|
|
629
|
-
/**
|
|
630
|
-
* Seed `~/.claude/multi-agent-preferences.json` when it is absent.
|
|
631
|
-
*
|
|
632
|
-
* Preferences are cross-host state, not a Claude Code artifact: every phase
|
|
633
|
-
* reads them and the orchestrator is specified to warn and stop when they are
|
|
634
|
-
* missing. A Codex-only install would otherwise produce a complete tree that
|
|
635
|
-
* halts on the first run, because only the Claude Code target creates the file.
|
|
636
|
-
*
|
|
637
|
-
* Existing files are never overwritten.
|
|
638
|
-
*/
|
|
639
|
-
function ensureSharedPreferences(home, pipelineSrc) {
|
|
640
|
-
const prefsPath = prefsFileIn(home);
|
|
641
|
-
if (existsSync(prefsPath)) return;
|
|
642
|
-
const template = join(pipelineSrc, "preferences-template.json");
|
|
643
|
-
if (!existsSync(template)) return;
|
|
644
|
-
ensureDir(join(home, ".claude"));
|
|
645
|
-
copyFile(template, prefsPath);
|
|
646
|
-
console.log(` -> seeded shared preferences at ${prefsPath}`);
|
|
647
|
-
}
|
|
648
|
-
|
|
649
565
|
/**
|
|
650
566
|
* Register the multi-agent MCP server via the `codex` CLI.
|
|
651
567
|
*
|
package/install/copilot.mjs
CHANGED
|
@@ -19,13 +19,13 @@ import {
|
|
|
19
19
|
dirsIdentical,
|
|
20
20
|
ensureDir,
|
|
21
21
|
ensureRealDir,
|
|
22
|
+
ensureSharedPreferences,
|
|
22
23
|
isDryRun,
|
|
23
24
|
isSkillDirName,
|
|
24
25
|
pruneOrphanSkillFiles,
|
|
25
26
|
removePipelineAgentFiles,
|
|
26
27
|
symlinkDir,
|
|
27
28
|
wipeDir,
|
|
28
|
-
writeFile,
|
|
29
29
|
} from "./_common.mjs";
|
|
30
30
|
import {
|
|
31
31
|
EXTERNAL_SKILLS_MANIFEST,
|
|
@@ -41,6 +41,12 @@ import {
|
|
|
41
41
|
pluginsToDeliver,
|
|
42
42
|
} from "./_plugin-skills.mjs";
|
|
43
43
|
import { registerMcpServer } from "./_mcp-register.mjs";
|
|
44
|
+
import {
|
|
45
|
+
applyPathRewrites,
|
|
46
|
+
buildPathRewrites,
|
|
47
|
+
installRefs,
|
|
48
|
+
makeCopyTreeRewritten,
|
|
49
|
+
} from "./_rewrite-tree.mjs";
|
|
44
50
|
import { deliverXcodeSkills } from "./_xcode-skills.mjs";
|
|
45
51
|
|
|
46
52
|
/**
|
|
@@ -65,6 +71,7 @@ export function installCopilot(ctx) {
|
|
|
65
71
|
const COPILOT_LIB = join(COPILOT_DIR, "lib");
|
|
66
72
|
const COPILOT_RULES = join(COPILOT_DIR, "rules");
|
|
67
73
|
const COPILOT_TEMPLATES = join(COPILOT_DIR, "templates");
|
|
74
|
+
const COPILOT_MA_REFS = join(COPILOT_DIR, "multi-agent-refs");
|
|
68
75
|
|
|
69
76
|
console.log(" [Copilot CLI] Installing pipeline instructions...");
|
|
70
77
|
ensureDir(COPILOT_DIR);
|
|
@@ -78,6 +85,11 @@ export function installCopilot(ctx) {
|
|
|
78
85
|
installRules(pipelineSrc, COPILOT_RULES, useSymlinks);
|
|
79
86
|
installTemplates(pipelineSrc, COPILOT_TEMPLATES, useSymlinks);
|
|
80
87
|
installSkills({ home, pipelineSrc, dest: COPILOT_SKILLS, indexOnly, useSymlinks, platformFlag });
|
|
88
|
+
// Sub-command specs are skipped: this host fans the pipeline out as one skill
|
|
89
|
+
// per sub-command, so `skills/multi-agent-<sub>/SKILL.md` already holds each
|
|
90
|
+
// spec and COPILOT_PATH_REWRITES points every reference there.
|
|
91
|
+
installRefs(pipelineSrc, COPILOT_MA_REFS, copyTreeRewritten, { subCommandSpecs: false });
|
|
92
|
+
ensureSharedPreferences(home, pipelineSrc);
|
|
81
93
|
|
|
82
94
|
// Copilot never registered the companion MCP server, while Codex did from the day its
|
|
83
95
|
// installer was written. So Copilot carried every pipeline skill and could not call a
|
|
@@ -100,31 +112,17 @@ export function installCopilot(ctx) {
|
|
|
100
112
|
*
|
|
101
113
|
* - `scripts`, `lib`, `schemas`, `agents`, `rules` and `skills` are installed under
|
|
102
114
|
* `~/.copilot/`, so references must point there.
|
|
103
|
-
* - `multi-agent-refs`
|
|
104
|
-
*
|
|
105
|
-
*
|
|
115
|
+
* - `multi-agent-refs` is installed under `~/.copilot/` too, and the command
|
|
116
|
+
* specs resolve into this host's own trees: the sub-command specs into the
|
|
117
|
+
* fanned-out skills that already carry them, the standalone ones into
|
|
118
|
+
* `multi-agent-refs/commands`.
|
|
106
119
|
* - Shared state (`logs/`, `multi-agent-preferences.json`, `knowledge/`) is NOT
|
|
107
120
|
* rewritten either. `~/.claude` is the cross-host state root - that is what lets
|
|
108
121
|
* `:resume` / `:log` / `:status` see a task started from another CLI.
|
|
109
122
|
*
|
|
110
123
|
* @type {ReadonlyArray<{from: RegExp, to: string}>}
|
|
111
124
|
*/
|
|
112
|
-
export const COPILOT_PATH_REWRITES =
|
|
113
|
-
// Skills first: a skill that names a sibling skill by path (the compliance pair,
|
|
114
|
-
// humanizer, the xcode-build family) has to land inside THIS host's skills tree.
|
|
115
|
-
{ from: /\$HOME\/\.claude\/skills\b/g, to: "$HOME/.copilot/skills" },
|
|
116
|
-
{ from: /~\/\.claude\/skills\b/g, to: "~/.copilot/skills" },
|
|
117
|
-
{ from: /\$HOME\/\.claude\/scripts\b/g, to: "$HOME/.copilot/scripts" },
|
|
118
|
-
{ from: /~\/\.claude\/scripts\b/g, to: "~/.copilot/scripts" },
|
|
119
|
-
{ from: /\$HOME\/\.claude\/lib\b/g, to: "$HOME/.copilot/lib" },
|
|
120
|
-
{ from: /~\/\.claude\/lib\b/g, to: "~/.copilot/lib" },
|
|
121
|
-
{ from: /\$HOME\/\.claude\/schemas\b/g, to: "$HOME/.copilot/schemas" },
|
|
122
|
-
{ from: /~\/\.claude\/schemas\b/g, to: "~/.copilot/schemas" },
|
|
123
|
-
{ from: /\$HOME\/\.claude\/agents\b/g, to: "$HOME/.copilot/agents" },
|
|
124
|
-
{ from: /~\/\.claude\/agents\b/g, to: "~/.copilot/agents" },
|
|
125
|
-
{ from: /\$HOME\/\.claude\/rules\b/g, to: "$HOME/.copilot/rules" },
|
|
126
|
-
{ from: /~\/\.claude\/rules\b/g, to: "~/.copilot/rules" },
|
|
127
|
-
]);
|
|
125
|
+
export const COPILOT_PATH_REWRITES = buildPathRewrites("copilot");
|
|
128
126
|
|
|
129
127
|
/**
|
|
130
128
|
* Apply the Copilot path map to a file's text.
|
|
@@ -132,45 +130,17 @@ export const COPILOT_PATH_REWRITES = Object.freeze([
|
|
|
132
130
|
* @returns {string}
|
|
133
131
|
*/
|
|
134
132
|
export function rewriteCopilotPaths(text) {
|
|
135
|
-
|
|
136
|
-
for (const { from, to } of COPILOT_PATH_REWRITES) out = out.replace(from, to);
|
|
137
|
-
return out;
|
|
133
|
+
return applyPathRewrites(COPILOT_PATH_REWRITES, text);
|
|
138
134
|
}
|
|
139
135
|
|
|
140
136
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* `$HOME/.claude/...` references that have to be retargeted.
|
|
137
|
+
* Copy a tree into the Copilot install, retargeting every `$HOME/.claude/...`
|
|
138
|
+
* path it carries. The machinery is shared with the other hosts; only the path
|
|
139
|
+
* map is this host's.
|
|
145
140
|
*
|
|
146
|
-
* @
|
|
147
|
-
* @param {string} dest
|
|
148
|
-
* @param {(relPath: string) => boolean} [filter] - receives the path relative to the
|
|
149
|
-
* copy root (POSIX-separated). Return false to skip.
|
|
150
|
-
* @param {string} [relBase] - internal: accumulated relative path
|
|
151
|
-
* @returns {number} files written
|
|
141
|
+
* @type {(src: string, dest: string, filter?: (rel: string) => boolean) => number}
|
|
152
142
|
*/
|
|
153
|
-
|
|
154
|
-
const TEXT = /\.(md|json|sh|mjs|js|txt|ya?ml|toml)$/i;
|
|
155
|
-
let n = 0;
|
|
156
|
-
for (const entry of readdirSync(src, { withFileTypes: true })) {
|
|
157
|
-
const from = join(src, entry.name);
|
|
158
|
-
const to = join(dest, entry.name);
|
|
159
|
-
const rel = relBase ? `${relBase}/${entry.name}` : entry.name;
|
|
160
|
-
if (entry.isDirectory()) {
|
|
161
|
-
n += copyTreeRewritten(from, to, filter, rel);
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
if (!entry.isFile()) continue;
|
|
165
|
-
if (filter && !filter(rel)) continue;
|
|
166
|
-
ensureDir(dest);
|
|
167
|
-
const isText = TEXT.test(entry.name);
|
|
168
|
-
const raw = readFileSync(from, isText ? "utf-8" : null);
|
|
169
|
-
writeFile(to, isText ? rewriteCopilotPaths(raw) : raw);
|
|
170
|
-
n++;
|
|
171
|
-
}
|
|
172
|
-
return n;
|
|
173
|
-
}
|
|
143
|
+
const copyTreeRewritten = makeCopyTreeRewritten(rewriteCopilotPaths);
|
|
174
144
|
|
|
175
145
|
/** Start of the pipeline-managed span in copilot-instructions.md. */
|
|
176
146
|
export const INSTRUCTIONS_START_MARKER = "# Multi-Agent Development Pipeline";
|