conductor-install 0.1.1 → 0.1.2
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/package.json +3 -3
- package/dist/conductor/.github/workflows/release-please.yml +0 -47
- package/dist/conductor/conductor/.github/workflows/release-please.yml +0 -47
- package/dist/conductor/conductor/.release-please-manifest.json +0 -3
- package/dist/conductor/conductor/CHANGELOG.md +0 -39
- package/dist/conductor/conductor/CONTRIBUTING.md +0 -33
- package/dist/conductor/conductor/GEMINI.md +0 -41
- package/dist/conductor/conductor/LICENSE +0 -202
- package/dist/conductor/conductor/README.md +0 -128
- package/dist/conductor/conductor/commands/conductor/implement.toml +0 -179
- package/dist/conductor/conductor/commands/conductor/newTrack.toml +0 -154
- package/dist/conductor/conductor/commands/conductor/revert.toml +0 -130
- package/dist/conductor/conductor/commands/conductor/review.toml +0 -158
- package/dist/conductor/conductor/commands/conductor/setup.toml +0 -456
- package/dist/conductor/conductor/commands/conductor/status.toml +0 -57
- package/dist/conductor/conductor/gemini-extension.json +0 -5
- package/dist/conductor/conductor/release-please-config.json +0 -11
- package/dist/conductor/conductor/templates/code_styleguides/cpp.md +0 -113
- package/dist/conductor/conductor/templates/code_styleguides/csharp.md +0 -115
- package/dist/conductor/conductor/templates/code_styleguides/dart.md +0 -238
- package/dist/conductor/conductor/templates/code_styleguides/general.md +0 -23
- package/dist/conductor/conductor/templates/code_styleguides/go.md +0 -48
- package/dist/conductor/conductor/templates/code_styleguides/html-css.md +0 -49
- package/dist/conductor/conductor/templates/code_styleguides/javascript.md +0 -51
- package/dist/conductor/conductor/templates/code_styleguides/python.md +0 -37
- package/dist/conductor/conductor/templates/code_styleguides/typescript.md +0 -43
- package/dist/conductor/conductor/templates/workflow.md +0 -333
- package/dist/conductor-install.cjs +0 -779
- package/dist/index.cjs +0 -774
- package/dist/templates/.github/workflows/release-please.yml +0 -47
- package/dist/templates/.release-please-manifest.json +0 -3
- package/dist/templates/templates/.github/workflows/release-please.yml +0 -47
- package/dist/templates/templates/.release-please-manifest.json +0 -3
|
@@ -1,779 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
-
mod
|
|
24
|
-
));
|
|
25
|
-
|
|
26
|
-
// node_modules/tsup/assets/cjs_shims.js
|
|
27
|
-
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
|
|
28
|
-
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
29
|
-
|
|
30
|
-
// src/conductor-install.ts
|
|
31
|
-
var import_yargs = __toESM(require("yargs"), 1);
|
|
32
|
-
var import_helpers = require("yargs/helpers");
|
|
33
|
-
|
|
34
|
-
// src/cli/prompt.ts
|
|
35
|
-
var import_select = __toESM(require("@inquirer/select"), 1);
|
|
36
|
-
|
|
37
|
-
// src/generators/opencode/config.ts
|
|
38
|
-
var opencodeConfig = {
|
|
39
|
-
agentType: "opencode",
|
|
40
|
-
agentDir: ".opencode",
|
|
41
|
-
commandsDir: "commands",
|
|
42
|
-
displayName: "OpenCode",
|
|
43
|
-
protocolFilename: "AGENTS.md",
|
|
44
|
-
description: "The open source AI coding agent"
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// src/generators/claude-code/config.ts
|
|
48
|
-
var claudeCodeConfig = {
|
|
49
|
-
agentType: "claude-code",
|
|
50
|
-
agentDir: ".claude",
|
|
51
|
-
commandsDir: "commands",
|
|
52
|
-
displayName: "Claude Code",
|
|
53
|
-
protocolFilename: "CLAUDE.md",
|
|
54
|
-
description: "Anthropic's coding assistant"
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// src/generators/antigravity/config.ts
|
|
58
|
-
var antigravityConfig = {
|
|
59
|
-
agentType: "antigravity",
|
|
60
|
-
agentDir: ".agent",
|
|
61
|
-
commandsDir: "workflows",
|
|
62
|
-
displayName: "Antigravity",
|
|
63
|
-
protocolFilename: "GEMINI.md",
|
|
64
|
-
description: "Google's agentic coding assistant"
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// src/generators/cursor/config.ts
|
|
68
|
-
var cursorConfig = {
|
|
69
|
-
agentType: "cursor",
|
|
70
|
-
agentDir: ".cursor",
|
|
71
|
-
commandsDir: "commands",
|
|
72
|
-
displayName: "Cursor",
|
|
73
|
-
protocolFilename: "AGENTS.md",
|
|
74
|
-
description: "Cursor IDE's AI agent"
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// src/generators/vscode-copilot/strategy.ts
|
|
78
|
-
var import_smol_toml = require("smol-toml");
|
|
79
|
-
|
|
80
|
-
// src/utils/template.ts
|
|
81
|
-
var import_promises = require("fs/promises");
|
|
82
|
-
var import_path = require("path");
|
|
83
|
-
var import_url = require("url");
|
|
84
|
-
var import_os = require("os");
|
|
85
|
-
var import_child_process = require("child_process");
|
|
86
|
-
var import_crypto = require("crypto");
|
|
87
|
-
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
88
|
-
var __dirname = (0, import_url.fileURLToPath)(new URL(".", importMetaUrl));
|
|
89
|
-
var DEFAULT_REPO = "https://github.com/gemini-cli-extensions/conductor";
|
|
90
|
-
var DEFAULT_BRANCH = "main";
|
|
91
|
-
function getCacheDir(repo = DEFAULT_REPO, branch = DEFAULT_BRANCH) {
|
|
92
|
-
const hash = (0, import_crypto.createHash)("md5").update(`${repo}#${branch}`).digest("hex");
|
|
93
|
-
return (0, import_path.join)((0, import_os.homedir)(), ".gemini/cache/conductor", hash);
|
|
94
|
-
}
|
|
95
|
-
async function ensureTemplates(repo = DEFAULT_REPO, branch = DEFAULT_BRANCH) {
|
|
96
|
-
const cacheDir = getCacheDir(repo, branch);
|
|
97
|
-
if (!import_fs_extra.default.existsSync(cacheDir)) {
|
|
98
|
-
await import_fs_extra.default.ensureDir(cacheDir);
|
|
99
|
-
console.log(`Downloading templates from ${repo} [${branch}]...`);
|
|
100
|
-
try {
|
|
101
|
-
(0, import_child_process.execSync)(`git clone ${repo} --branch ${branch} --depth 1 .`, {
|
|
102
|
-
cwd: cacheDir,
|
|
103
|
-
stdio: ["ignore", "ignore", "pipe"]
|
|
104
|
-
});
|
|
105
|
-
} catch (e) {
|
|
106
|
-
await import_fs_extra.default.remove(cacheDir);
|
|
107
|
-
throw new Error(
|
|
108
|
-
`Failed to clone templates: ${e instanceof Error ? e.message : String(e)}`
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
} else {
|
|
112
|
-
try {
|
|
113
|
-
console.log(`Updating templates from ${repo} [${branch}]...`);
|
|
114
|
-
(0, import_child_process.execSync)("git pull --rebase", {
|
|
115
|
-
cwd: cacheDir,
|
|
116
|
-
stdio: ["ignore", "ignore", "pipe"]
|
|
117
|
-
});
|
|
118
|
-
} catch (e) {
|
|
119
|
-
console.warn(
|
|
120
|
-
`Failed to update templates (using cached version): ${e instanceof Error ? e.message : String(e)}`
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function substituteVariables(template, variables) {
|
|
126
|
-
return template.replace(/\{(\w+)\}/g, (match, key) => {
|
|
127
|
-
if (Object.prototype.hasOwnProperty.call(variables, key)) {
|
|
128
|
-
return variables[key];
|
|
129
|
-
}
|
|
130
|
-
return match;
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
function getBundledTemplateRoot() {
|
|
134
|
-
const prodDest = (0, import_path.resolve)(__dirname, "conductor");
|
|
135
|
-
if (import_fs_extra.default.existsSync(prodDest)) {
|
|
136
|
-
return prodDest;
|
|
137
|
-
}
|
|
138
|
-
return (0, import_path.resolve)(__dirname, "../conductor");
|
|
139
|
-
}
|
|
140
|
-
async function getTemplateRoot(repo, branch) {
|
|
141
|
-
if (!repo && !branch) {
|
|
142
|
-
const bundledRoot = getBundledTemplateRoot();
|
|
143
|
-
if (await import_fs_extra.default.pathExists(bundledRoot)) {
|
|
144
|
-
return bundledRoot;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
await ensureTemplates(repo, branch);
|
|
148
|
-
return getCacheDir(repo, branch);
|
|
149
|
-
}
|
|
150
|
-
async function loadTemplate(templatePath, repo, branch) {
|
|
151
|
-
if (!repo && !branch) {
|
|
152
|
-
const bundledPath = (0, import_path.resolve)(getBundledTemplateRoot(), templatePath);
|
|
153
|
-
if (await import_fs_extra.default.pathExists(bundledPath)) {
|
|
154
|
-
return (0, import_promises.readFile)(bundledPath, "utf-8");
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (!repo && !branch) {
|
|
158
|
-
console.log(
|
|
159
|
-
`Bundled template not found: ${templatePath}, falling back to remote repository...`
|
|
160
|
-
);
|
|
161
|
-
await ensureTemplates(repo, branch);
|
|
162
|
-
}
|
|
163
|
-
const rootDir = await getTemplateRoot(repo, branch);
|
|
164
|
-
const fullPath = (0, import_path.join)(rootDir, templatePath);
|
|
165
|
-
return (0, import_promises.readFile)(fullPath, "utf-8");
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// src/generators/vscode-copilot/strategy.ts
|
|
169
|
-
var VsCodeCopilotContentStrategy = class {
|
|
170
|
-
process(templateContent, options) {
|
|
171
|
-
const { installPath, agentType, fixedAgent } = options;
|
|
172
|
-
const parsed = (0, import_smol_toml.parse)(templateContent);
|
|
173
|
-
if (!parsed.prompt) {
|
|
174
|
-
return null;
|
|
175
|
-
}
|
|
176
|
-
let prompt = parsed.prompt;
|
|
177
|
-
prompt = prompt.replace(/__\$\$CODE_AGENT_INSTALL_PATH\$\$__/g, installPath);
|
|
178
|
-
const finalContent = substituteVariables(prompt, { agent_type: agentType });
|
|
179
|
-
return `---
|
|
180
|
-
description: ${parsed.description || ""}
|
|
181
|
-
agent: ${fixedAgent}
|
|
182
|
-
---
|
|
183
|
-
${finalContent}`;
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
var vscodeCopilotContentStrategy = new VsCodeCopilotContentStrategy();
|
|
187
|
-
|
|
188
|
-
// src/generators/vscode-copilot/config.ts
|
|
189
|
-
var vscodeCopilotConfig = {
|
|
190
|
-
agentType: "vscode-copilot",
|
|
191
|
-
agentDir: ".github",
|
|
192
|
-
commandsDir: "prompts",
|
|
193
|
-
displayName: "VS Code Copilot",
|
|
194
|
-
protocolFilename: "AGENTS.md",
|
|
195
|
-
description: "VS Code Copilot's Prompt Files",
|
|
196
|
-
extension: ".prompt.md",
|
|
197
|
-
fixedAgent: "agent",
|
|
198
|
-
strategy: {
|
|
199
|
-
content: vscodeCopilotContentStrategy
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
// src/generators/codex/config.ts
|
|
204
|
-
var codexConfig = {
|
|
205
|
-
agentType: "codex",
|
|
206
|
-
agentDir: ".codex",
|
|
207
|
-
commandsDir: "prompts",
|
|
208
|
-
displayName: "Codex",
|
|
209
|
-
protocolFilename: "AGENTS.md",
|
|
210
|
-
description: "OpenAI Codex Agent",
|
|
211
|
-
extension: ".md"
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
// src/generators/windsurf/config.ts
|
|
215
|
-
var windsurfConfig = {
|
|
216
|
-
agentType: "windsurf",
|
|
217
|
-
agentDir: ".windsurf",
|
|
218
|
-
commandsDir: "workflows",
|
|
219
|
-
displayName: "Windsurf",
|
|
220
|
-
protocolFilename: "AGENTS.md",
|
|
221
|
-
description: "Windsurf Cascade AI Agent"
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
// src/generators/cline/strategy.ts
|
|
225
|
-
var import_smol_toml2 = require("smol-toml");
|
|
226
|
-
var ClineContentStrategy = class {
|
|
227
|
-
process(templateContent, options) {
|
|
228
|
-
const { installPath, agentType, commandName } = options;
|
|
229
|
-
const parsed = (0, import_smol_toml2.parse)(templateContent);
|
|
230
|
-
if (!parsed.prompt) {
|
|
231
|
-
return null;
|
|
232
|
-
}
|
|
233
|
-
let prompt = parsed.prompt;
|
|
234
|
-
prompt = prompt.replace(/__\$\$CODE_AGENT_INSTALL_PATH\$\$__/g, installPath);
|
|
235
|
-
const finalContent = substituteVariables(prompt, { agent_type: agentType });
|
|
236
|
-
const title = commandName ? commandName.charAt(0).toUpperCase() + commandName.slice(1) : "Command";
|
|
237
|
-
return `# Conductor ${title}${parsed.description ? "\n\n" + parsed.description + "\n\n" : "\n\n"}${finalContent}`;
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
var clineContentStrategy = new ClineContentStrategy();
|
|
241
|
-
|
|
242
|
-
// src/generators/cline/config.ts
|
|
243
|
-
var clineConfig = {
|
|
244
|
-
agentType: "cline",
|
|
245
|
-
agentDir: ".clinerules",
|
|
246
|
-
commandsDir: "workflows",
|
|
247
|
-
displayName: "Cline",
|
|
248
|
-
protocolFilename: "AGENTS.md",
|
|
249
|
-
description: "Cline AI coding assistant",
|
|
250
|
-
strategy: {
|
|
251
|
-
content: clineContentStrategy
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
// src/generators/gemini/strategy.ts
|
|
256
|
-
var import_path2 = require("path");
|
|
257
|
-
var import_fs_extra2 = __toESM(require("fs-extra"), 1);
|
|
258
|
-
var import_smol_toml3 = require("smol-toml");
|
|
259
|
-
var { writeFile } = import_fs_extra2.default;
|
|
260
|
-
var GeminiContentStrategy = class {
|
|
261
|
-
process(templateContent, options) {
|
|
262
|
-
const { installPath, agentType } = options;
|
|
263
|
-
const parsed = (0, import_smol_toml3.parse)(templateContent);
|
|
264
|
-
if (!parsed.prompt) {
|
|
265
|
-
return null;
|
|
266
|
-
}
|
|
267
|
-
const content = templateContent.replace(/__\$\$CODE_AGENT_INSTALL_PATH\$\$__/g, installPath);
|
|
268
|
-
return substituteVariables(content, { agent_type: agentType });
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
var GeminiFileStrategy = class {
|
|
272
|
-
async write(options) {
|
|
273
|
-
const { targetDir, agentDir, commandsDir, commandName, extension, content } = options;
|
|
274
|
-
const fileName = `${commandName}${extension}`;
|
|
275
|
-
await writeFile((0, import_path2.join)(targetDir, agentDir, commandsDir, fileName), content);
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
var geminiContentStrategy = new GeminiContentStrategy();
|
|
279
|
-
var geminiFileStrategy = new GeminiFileStrategy();
|
|
280
|
-
|
|
281
|
-
// src/generators/gemini/config.ts
|
|
282
|
-
var geminiConfig = {
|
|
283
|
-
agentType: "gemini",
|
|
284
|
-
agentDir: ".gemini",
|
|
285
|
-
commandsDir: "commands/conductor",
|
|
286
|
-
displayName: "Gemini CLI",
|
|
287
|
-
protocolFilename: "GEMINI.md",
|
|
288
|
-
description: "Google Gemini CLI agent",
|
|
289
|
-
extension: ".toml",
|
|
290
|
-
usesPrefix: false,
|
|
291
|
-
strategy: {
|
|
292
|
-
content: geminiContentStrategy,
|
|
293
|
-
file: geminiFileStrategy
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
// src/generators/registry.ts
|
|
298
|
-
var ALL_AGENT_CONFIGS = [
|
|
299
|
-
opencodeConfig,
|
|
300
|
-
claudeCodeConfig,
|
|
301
|
-
antigravityConfig,
|
|
302
|
-
cursorConfig,
|
|
303
|
-
vscodeCopilotConfig,
|
|
304
|
-
codexConfig,
|
|
305
|
-
windsurfConfig,
|
|
306
|
-
clineConfig,
|
|
307
|
-
geminiConfig
|
|
308
|
-
];
|
|
309
|
-
|
|
310
|
-
// src/cli/prompt.ts
|
|
311
|
-
async function promptForInstallScope(agent) {
|
|
312
|
-
const isCodex = agent === "codex";
|
|
313
|
-
const isCline = agent === "cline";
|
|
314
|
-
const choices = isCodex ? [{ name: "Global (User Home Directory)", value: "global" }] : [{ name: "Project (Current Directory)", value: "project" }];
|
|
315
|
-
const answer = await (0, import_select.default)({
|
|
316
|
-
message: "Select installation method:",
|
|
317
|
-
choices,
|
|
318
|
-
default: isCodex ? "global" : "project"
|
|
319
|
-
});
|
|
320
|
-
return answer;
|
|
321
|
-
}
|
|
322
|
-
async function promptForAgent() {
|
|
323
|
-
const choices = ALL_AGENT_CONFIGS.map((config) => {
|
|
324
|
-
const {
|
|
325
|
-
displayName,
|
|
326
|
-
agentType,
|
|
327
|
-
protocolFilename,
|
|
328
|
-
agentDir,
|
|
329
|
-
commandsDir,
|
|
330
|
-
description
|
|
331
|
-
} = config;
|
|
332
|
-
const finalDescription = description || `${displayName} agent`;
|
|
333
|
-
const pathInfo = `\x1B[90m(${protocolFilename}, ${agentDir}/${commandsDir})\x1B[0m`;
|
|
334
|
-
return {
|
|
335
|
-
name: `${displayName} ${pathInfo}`,
|
|
336
|
-
value: agentType,
|
|
337
|
-
description: finalDescription
|
|
338
|
-
};
|
|
339
|
-
});
|
|
340
|
-
const answer = await (0, import_select.default)({
|
|
341
|
-
message: "Select your coding agent:",
|
|
342
|
-
choices,
|
|
343
|
-
default: "opencode",
|
|
344
|
-
loop: true
|
|
345
|
-
});
|
|
346
|
-
return answer;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
// src/generators/default/strategy.ts
|
|
350
|
-
var import_path3 = require("path");
|
|
351
|
-
var import_fs_extra3 = __toESM(require("fs-extra"), 1);
|
|
352
|
-
var import_smol_toml4 = require("smol-toml");
|
|
353
|
-
var { writeFile: writeFile2 } = import_fs_extra3.default;
|
|
354
|
-
var DefaultContentStrategy = class {
|
|
355
|
-
process(templateContent, options) {
|
|
356
|
-
const { installPath, agentType } = options;
|
|
357
|
-
const parsed = (0, import_smol_toml4.parse)(templateContent);
|
|
358
|
-
if (!parsed.prompt) {
|
|
359
|
-
return null;
|
|
360
|
-
}
|
|
361
|
-
let prompt = parsed.prompt;
|
|
362
|
-
prompt = prompt.replace(/__\$\$CODE_AGENT_INSTALL_PATH\$\$__/g, installPath);
|
|
363
|
-
const finalContent = substituteVariables(prompt, { agent_type: agentType });
|
|
364
|
-
if (parsed.description) {
|
|
365
|
-
return `---
|
|
366
|
-
description: ${parsed.description}
|
|
367
|
-
---
|
|
368
|
-
${finalContent}`;
|
|
369
|
-
}
|
|
370
|
-
return finalContent;
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
var DefaultFileStrategy = class {
|
|
374
|
-
async write(options) {
|
|
375
|
-
const { targetDir, agentDir, commandsDir, commandName, extension, content } = options;
|
|
376
|
-
const fileName = `conductor:${commandName}${extension}`;
|
|
377
|
-
await writeFile2((0, import_path3.join)(targetDir, agentDir, commandsDir, fileName), content);
|
|
378
|
-
}
|
|
379
|
-
};
|
|
380
|
-
var defaultContentStrategy = new DefaultContentStrategy();
|
|
381
|
-
var defaultFileStrategy = new DefaultFileStrategy();
|
|
382
|
-
|
|
383
|
-
// src/generators/ConfigurableGenerator.ts
|
|
384
|
-
var import_path4 = require("path");
|
|
385
|
-
var import_select2 = __toESM(require("@inquirer/select"), 1);
|
|
386
|
-
var import_fs_extra4 = __toESM(require("fs-extra"), 1);
|
|
387
|
-
var { existsSync, ensureDir, writeFile: writeFile3, copy } = import_fs_extra4.default;
|
|
388
|
-
var ConfigurableGenerator = class {
|
|
389
|
-
constructor(config) {
|
|
390
|
-
this.config = config;
|
|
391
|
-
}
|
|
392
|
-
async validate(targetDir, scope) {
|
|
393
|
-
if (!existsSync(targetDir)) {
|
|
394
|
-
throw new Error(`Target directory does not exist: ${targetDir}`);
|
|
395
|
-
}
|
|
396
|
-
const { agentDir, commandsDir, displayName, extension, usesPrefix } = this.config;
|
|
397
|
-
const ext = extension || ".md";
|
|
398
|
-
const prefix = usesPrefix !== false ? "conductor:" : "";
|
|
399
|
-
const setupFileName = `${prefix}setup${ext}`;
|
|
400
|
-
const setupFile = (0, import_path4.join)(targetDir, agentDir, commandsDir, setupFileName);
|
|
401
|
-
const conductorPath = (0, import_path4.join)(targetDir, agentDir, "conductor");
|
|
402
|
-
if (existsSync(conductorPath) && existsSync(setupFile)) {
|
|
403
|
-
throw new Error(
|
|
404
|
-
`Conductor (${displayName}) is already installed in: ${targetDir}`
|
|
405
|
-
);
|
|
406
|
-
}
|
|
407
|
-
return targetDir;
|
|
408
|
-
}
|
|
409
|
-
async generate(targetDir, scope, repo, branch, force) {
|
|
410
|
-
const { agentDir, commandsDir, agentType } = this.config;
|
|
411
|
-
const agentPath = (0, import_path4.join)(targetDir, agentDir);
|
|
412
|
-
const targetCommandsDir = (0, import_path4.join)(agentPath, commandsDir);
|
|
413
|
-
let installPath = (0, import_path4.join)(agentDir, "conductor");
|
|
414
|
-
if (scope === "global") {
|
|
415
|
-
installPath = `~/${agentDir}/conductor`;
|
|
416
|
-
}
|
|
417
|
-
await ensureDir(targetCommandsDir);
|
|
418
|
-
await ensureDir((0, import_path4.join)(agentPath, "conductor"));
|
|
419
|
-
const templateRoot = await getTemplateRoot(repo, branch);
|
|
420
|
-
try {
|
|
421
|
-
const templateSource = (0, import_path4.join)(templateRoot, "templates");
|
|
422
|
-
const templateDest = (0, import_path4.join)(agentPath, "conductor", "templates");
|
|
423
|
-
await copy(templateSource, templateDest);
|
|
424
|
-
} catch (e) {
|
|
425
|
-
console.warn("Failed to copy templates directory:", e);
|
|
426
|
-
}
|
|
427
|
-
const { protocolFilename } = this.config;
|
|
428
|
-
if (protocolFilename) {
|
|
429
|
-
try {
|
|
430
|
-
const protocolSource = (0, import_path4.join)(templateRoot, "GEMINI.md");
|
|
431
|
-
const protocolDest = (0, import_path4.join)(targetDir, protocolFilename);
|
|
432
|
-
if (existsSync(protocolSource)) {
|
|
433
|
-
let shouldCopy = true;
|
|
434
|
-
if (existsSync(protocolDest) && !force) {
|
|
435
|
-
shouldCopy = await (0, import_select2.default)({
|
|
436
|
-
message: `The protocol file '${protocolFilename}' already exists. Do you want to overwrite it?`,
|
|
437
|
-
choices: [
|
|
438
|
-
{ value: true, name: "Overwrite" },
|
|
439
|
-
{ value: false, name: "Skip" }
|
|
440
|
-
]
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
if (shouldCopy) {
|
|
444
|
-
await copy(protocolSource, protocolDest);
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
} catch (e) {
|
|
448
|
-
console.warn("Failed to handle protocol file:", e);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
const commands = [
|
|
452
|
-
"setup",
|
|
453
|
-
"newTrack",
|
|
454
|
-
"implement",
|
|
455
|
-
"status",
|
|
456
|
-
"revert",
|
|
457
|
-
"review"
|
|
458
|
-
];
|
|
459
|
-
const extension = this.config.extension || ".md";
|
|
460
|
-
const fixedAgent = this.config.fixedAgent;
|
|
461
|
-
for (const cmd of commands) {
|
|
462
|
-
try {
|
|
463
|
-
const tomlContent = await loadTemplate(
|
|
464
|
-
`commands/conductor/${cmd}.toml`,
|
|
465
|
-
repo,
|
|
466
|
-
branch
|
|
467
|
-
);
|
|
468
|
-
const contentStrategy = this.config.strategy?.content || defaultContentStrategy;
|
|
469
|
-
const finalContent = contentStrategy.process(tomlContent, {
|
|
470
|
-
installPath,
|
|
471
|
-
agentType,
|
|
472
|
-
fixedAgent,
|
|
473
|
-
commandName: cmd
|
|
474
|
-
});
|
|
475
|
-
if (finalContent) {
|
|
476
|
-
const fileStrategy = this.config.strategy?.file || defaultFileStrategy;
|
|
477
|
-
await fileStrategy.write({
|
|
478
|
-
targetDir,
|
|
479
|
-
agentDir,
|
|
480
|
-
commandsDir,
|
|
481
|
-
commandName: cmd,
|
|
482
|
-
extension,
|
|
483
|
-
content: finalContent
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
} catch (e) {
|
|
487
|
-
console.warn(`Failed to process ${cmd}:`, e);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
};
|
|
492
|
-
|
|
493
|
-
// src/generators/factory.ts
|
|
494
|
-
function createGenerator(config) {
|
|
495
|
-
return new ConfigurableGenerator(config);
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
// src/generators/opencode/generator.ts
|
|
499
|
-
var OpenCodeGenerator = class {
|
|
500
|
-
generator = createGenerator(opencodeConfig);
|
|
501
|
-
validate(targetDir, scope) {
|
|
502
|
-
return this.generator.validate(targetDir, scope);
|
|
503
|
-
}
|
|
504
|
-
generate(targetDir, scope, repo, branch) {
|
|
505
|
-
return this.generator.generate(targetDir, scope, repo, branch);
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
// src/generators/claude-code/generator.ts
|
|
510
|
-
var ClaudeCodeGenerator = class {
|
|
511
|
-
generator = createGenerator(claudeCodeConfig);
|
|
512
|
-
validate(targetDir, scope) {
|
|
513
|
-
return this.generator.validate(targetDir, scope);
|
|
514
|
-
}
|
|
515
|
-
generate(targetDir, scope, repo, branch) {
|
|
516
|
-
return this.generator.generate(targetDir, scope, repo, branch);
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
|
|
520
|
-
// src/generators/antigravity/generator.ts
|
|
521
|
-
var AntigravityGenerator = class {
|
|
522
|
-
generator = createGenerator(antigravityConfig);
|
|
523
|
-
validate(targetDir, scope) {
|
|
524
|
-
return this.generator.validate(targetDir, scope);
|
|
525
|
-
}
|
|
526
|
-
generate(targetDir, scope, repo, branch) {
|
|
527
|
-
return this.generator.generate(targetDir, scope, repo, branch);
|
|
528
|
-
}
|
|
529
|
-
};
|
|
530
|
-
|
|
531
|
-
// src/generators/cursor/generator.ts
|
|
532
|
-
var CursorGenerator = class {
|
|
533
|
-
generator = createGenerator(cursorConfig);
|
|
534
|
-
validate(targetDir, scope) {
|
|
535
|
-
return this.generator.validate(targetDir, scope);
|
|
536
|
-
}
|
|
537
|
-
generate(targetDir, scope, repo, branch) {
|
|
538
|
-
return this.generator.generate(targetDir, scope, repo, branch);
|
|
539
|
-
}
|
|
540
|
-
};
|
|
541
|
-
|
|
542
|
-
// src/generators/vscode-copilot/generator.ts
|
|
543
|
-
var VSCodeCopilotGenerator = class {
|
|
544
|
-
generator = createGenerator(vscodeCopilotConfig);
|
|
545
|
-
validate(targetDir, scope) {
|
|
546
|
-
return this.generator.validate(targetDir, scope);
|
|
547
|
-
}
|
|
548
|
-
generate(targetDir, scope, repo, branch) {
|
|
549
|
-
return this.generator.generate(targetDir, scope, repo, branch);
|
|
550
|
-
}
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
// src/generators/codex/generator.ts
|
|
554
|
-
var import_os2 = require("os");
|
|
555
|
-
var CodexGenerator = class {
|
|
556
|
-
generator = createGenerator(codexConfig);
|
|
557
|
-
validate(targetDir, scope) {
|
|
558
|
-
if (scope === "global") {
|
|
559
|
-
targetDir = (0, import_os2.homedir)();
|
|
560
|
-
}
|
|
561
|
-
return this.generator.validate(targetDir, scope);
|
|
562
|
-
}
|
|
563
|
-
generate(targetDir, scope, repo, branch) {
|
|
564
|
-
if (scope === "global") {
|
|
565
|
-
targetDir = (0, import_os2.homedir)();
|
|
566
|
-
}
|
|
567
|
-
return this.generator.generate(targetDir, scope, repo, branch);
|
|
568
|
-
}
|
|
569
|
-
};
|
|
570
|
-
|
|
571
|
-
// src/generators/windsurf/generator.ts
|
|
572
|
-
var WindsurfGenerator = class {
|
|
573
|
-
generator = createGenerator(windsurfConfig);
|
|
574
|
-
validate(targetDir, scope) {
|
|
575
|
-
return this.generator.validate(targetDir, scope);
|
|
576
|
-
}
|
|
577
|
-
generate(targetDir, scope, repo, branch) {
|
|
578
|
-
return this.generator.generate(targetDir, scope, repo, branch);
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
|
-
|
|
582
|
-
// src/generators/cline/generator.ts
|
|
583
|
-
var ClineGenerator = class {
|
|
584
|
-
generator = createGenerator(clineConfig);
|
|
585
|
-
validate(targetDir, scope) {
|
|
586
|
-
return this.generator.validate(targetDir, scope);
|
|
587
|
-
}
|
|
588
|
-
generate(targetDir, scope, repo, branch) {
|
|
589
|
-
return this.generator.generate(targetDir, scope, repo, branch);
|
|
590
|
-
}
|
|
591
|
-
};
|
|
592
|
-
|
|
593
|
-
// src/generators/gemini/generator.ts
|
|
594
|
-
var GeminiGenerator = class {
|
|
595
|
-
generator = createGenerator(geminiConfig);
|
|
596
|
-
async validate(targetDir, scope) {
|
|
597
|
-
if (scope === "global") {
|
|
598
|
-
throw new Error("Gemini CLI agent only supports project-level installation");
|
|
599
|
-
}
|
|
600
|
-
return this.generator.validate(targetDir, scope);
|
|
601
|
-
}
|
|
602
|
-
async generate(targetDir, scope, repo, branch) {
|
|
603
|
-
if (scope === "global") {
|
|
604
|
-
throw new Error("Gemini CLI agent only supports project-level installation");
|
|
605
|
-
}
|
|
606
|
-
return this.generator.generate(targetDir, scope, repo, branch);
|
|
607
|
-
}
|
|
608
|
-
};
|
|
609
|
-
|
|
610
|
-
// src/generators/index.ts
|
|
611
|
-
function getGenerator(agentType) {
|
|
612
|
-
switch (agentType) {
|
|
613
|
-
case "claude-code":
|
|
614
|
-
return new ClaudeCodeGenerator();
|
|
615
|
-
case "antigravity":
|
|
616
|
-
return new AntigravityGenerator();
|
|
617
|
-
case "cursor":
|
|
618
|
-
return new CursorGenerator();
|
|
619
|
-
case "vscode-copilot":
|
|
620
|
-
return new VSCodeCopilotGenerator();
|
|
621
|
-
case "codex":
|
|
622
|
-
return new CodexGenerator();
|
|
623
|
-
case "windsurf":
|
|
624
|
-
return new WindsurfGenerator();
|
|
625
|
-
case "cline":
|
|
626
|
-
return new ClineGenerator();
|
|
627
|
-
case "gemini":
|
|
628
|
-
return new GeminiGenerator();
|
|
629
|
-
case "opencode":
|
|
630
|
-
default:
|
|
631
|
-
return new OpenCodeGenerator();
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
// src/commands/install.ts
|
|
636
|
-
var import_path5 = require("path");
|
|
637
|
-
var import_select3 = __toESM(require("@inquirer/select"), 1);
|
|
638
|
-
async function installHandler(argv) {
|
|
639
|
-
const targetDir = (0, import_path5.resolve)(process.cwd(), argv.path);
|
|
640
|
-
const force = argv.force ?? false;
|
|
641
|
-
try {
|
|
642
|
-
console.log(`Initializing Conductor in: ${targetDir}`);
|
|
643
|
-
let agent;
|
|
644
|
-
if (argv.agent) {
|
|
645
|
-
agent = argv.agent;
|
|
646
|
-
console.log(`Using provided agent: ${agent}`);
|
|
647
|
-
} else {
|
|
648
|
-
console.log("Step 1: Prompting for agent selection...");
|
|
649
|
-
agent = await promptForAgent();
|
|
650
|
-
console.log(`\u2714 Selected agent: ${agent}`);
|
|
651
|
-
}
|
|
652
|
-
let scope;
|
|
653
|
-
if (argv.scope) {
|
|
654
|
-
scope = argv.scope;
|
|
655
|
-
console.log(`Using provided scope: ${scope}`);
|
|
656
|
-
} else {
|
|
657
|
-
scope = await promptForInstallScope(agent);
|
|
658
|
-
}
|
|
659
|
-
console.log(`\u2714 Selected scope: ${scope}`);
|
|
660
|
-
const generator = getGenerator(agent);
|
|
661
|
-
console.log("\nStep 3: Validating project directory...");
|
|
662
|
-
let validatedPath;
|
|
663
|
-
try {
|
|
664
|
-
validatedPath = await generator.validate(targetDir, scope);
|
|
665
|
-
} catch (err) {
|
|
666
|
-
if (err instanceof Error && err.message.includes("already installed")) {
|
|
667
|
-
if (force) {
|
|
668
|
-
console.log("\u26A0 Force mode: Overwriting existing installation");
|
|
669
|
-
validatedPath = targetDir;
|
|
670
|
-
} else {
|
|
671
|
-
const shouldOverwrite = await (0, import_select3.default)({
|
|
672
|
-
message: `${err.message}
|
|
673
|
-
Do you want to overwrite the existing installation?`,
|
|
674
|
-
choices: [
|
|
675
|
-
{ value: true, name: "Yes, overwrite" },
|
|
676
|
-
{ value: false, name: "No, cancel" }
|
|
677
|
-
]
|
|
678
|
-
});
|
|
679
|
-
if (shouldOverwrite) {
|
|
680
|
-
console.log("Overwriting existing installation...");
|
|
681
|
-
validatedPath = targetDir;
|
|
682
|
-
} else {
|
|
683
|
-
console.log("Installation cancelled.");
|
|
684
|
-
return;
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
} else {
|
|
688
|
-
throw err;
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
console.log(`\u2714 Validation complete: ${validatedPath}`);
|
|
692
|
-
console.log("\nStep 4: Generating files...");
|
|
693
|
-
await generator.generate(
|
|
694
|
-
validatedPath,
|
|
695
|
-
scope,
|
|
696
|
-
argv.repo,
|
|
697
|
-
argv.branch,
|
|
698
|
-
force
|
|
699
|
-
);
|
|
700
|
-
console.log("\u2714 Files generated");
|
|
701
|
-
console.log("\n\u2714 Conductor initialized successfully!");
|
|
702
|
-
} catch (err) {
|
|
703
|
-
console.error(
|
|
704
|
-
"\n\u2718 Installation failed:",
|
|
705
|
-
err instanceof Error ? err.message : err
|
|
706
|
-
);
|
|
707
|
-
process.exit(1);
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
// src/utils/banner.ts
|
|
712
|
-
var import_gradient_string = __toESM(require("gradient-string"), 1);
|
|
713
|
-
var CONDUCTOR_INSTALL_BANNER = `
|
|
714
|
-
__________ _ ______ __ __________________ ____ _____ _______________ __ __
|
|
715
|
-
/ ____/ __ \\/ | / / __ \\/ / / / ____/_ __/ __ \\/ __ \\ / _/ | / / ___/_ __/ |/ / / /
|
|
716
|
-
/ / / / / / |/ / / / / / / / / / / / / / / /_/ / / // |/ /\\__ \\ / / / /| / / / /
|
|
717
|
-
/ /___/ /_/ / /| / /_/ / /_/ / /___ / / / /_/ / _, _/ _/ // /| /___/ // / / ___ / /___/ /___
|
|
718
|
-
\\____/\\____/_/ |_/_____/\\____/\\____/ /_/ \\____/_/ |_| /___/_/ |_//____//_/ /_/ |_/_____/_____/
|
|
719
|
-
|
|
720
|
-
`;
|
|
721
|
-
function printInstallBanner() {
|
|
722
|
-
console.log((0, import_gradient_string.default)("green", "cyan")(CONDUCTOR_INSTALL_BANNER));
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
// src/conductor-install.ts
|
|
726
|
-
async function main() {
|
|
727
|
-
printInstallBanner();
|
|
728
|
-
const argv = await (0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).scriptName("conductor-install").usage("$0 [path] [options]").positional("path", {
|
|
729
|
-
describe: "Directory to install Conductor",
|
|
730
|
-
default: ".",
|
|
731
|
-
type: "string"
|
|
732
|
-
}).option("agent", {
|
|
733
|
-
alias: "a",
|
|
734
|
-
describe: "Specify the coding agent",
|
|
735
|
-
type: "string",
|
|
736
|
-
choices: [
|
|
737
|
-
"opencode",
|
|
738
|
-
"claude-code",
|
|
739
|
-
"antigravity",
|
|
740
|
-
"cursor",
|
|
741
|
-
"vscode-copilot",
|
|
742
|
-
"codex",
|
|
743
|
-
"windsurf",
|
|
744
|
-
"cline",
|
|
745
|
-
"gemini"
|
|
746
|
-
]
|
|
747
|
-
}).option("repo", {
|
|
748
|
-
alias: "r",
|
|
749
|
-
describe: "Git repository URL for conductor",
|
|
750
|
-
type: "string",
|
|
751
|
-
default: DEFAULT_REPO
|
|
752
|
-
}).option("branch", {
|
|
753
|
-
alias: "b",
|
|
754
|
-
describe: "Branch name for conductor repository",
|
|
755
|
-
type: "string",
|
|
756
|
-
default: DEFAULT_BRANCH
|
|
757
|
-
}).option("scope", {
|
|
758
|
-
alias: "s",
|
|
759
|
-
describe: "Installation scope (project or global)",
|
|
760
|
-
type: "string",
|
|
761
|
-
choices: ["project", "global"]
|
|
762
|
-
}).option("force", {
|
|
763
|
-
alias: "f",
|
|
764
|
-
describe: "Force overwrite existing installation",
|
|
765
|
-
type: "boolean",
|
|
766
|
-
default: false
|
|
767
|
-
}).help().alias("h", "help").version().alias("v", "version").parseAsync();
|
|
768
|
-
const pathArg = argv._[0];
|
|
769
|
-
await installHandler({
|
|
770
|
-
...argv,
|
|
771
|
-
path: pathArg || argv.path || ".",
|
|
772
|
-
$0: "conductor-install",
|
|
773
|
-
_: argv._
|
|
774
|
-
});
|
|
775
|
-
}
|
|
776
|
-
main().catch((err) => {
|
|
777
|
-
console.error("Error:", err instanceof Error ? err.message : err);
|
|
778
|
-
process.exit(1);
|
|
779
|
-
});
|