dlw-machine-setup 0.5.0 → 0.5.7
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/bin/installer.js +66 -12
- package/package.json +1 -1
package/bin/installer.js
CHANGED
|
@@ -3801,8 +3801,8 @@ async function fetchFactory(options) {
|
|
|
3801
3801
|
const factoryDir = (0, import_path3.join)(targetDir, "factory");
|
|
3802
3802
|
const agentsSrc = (0, import_path3.join)(extractedPath, "agents");
|
|
3803
3803
|
if ((0, import_fs3.existsSync)(agentsSrc)) {
|
|
3804
|
-
copyDirectory2(agentsSrc, (0, import_path3.join)(claudeDir, "agents"));
|
|
3805
3804
|
copyDirectory2(agentsSrc, (0, import_path3.join)(factoryDir, "agents"));
|
|
3805
|
+
copyAgentStubs(agentsSrc, (0, import_path3.join)(claudeDir, "agents"));
|
|
3806
3806
|
result.filesInstalled.push(".claude/agents/", "factory/agents/");
|
|
3807
3807
|
}
|
|
3808
3808
|
const hooksSrc = (0, import_path3.join)(extractedPath, "hooks");
|
|
@@ -3847,13 +3847,13 @@ function configureSettings(claudeDir) {
|
|
|
3847
3847
|
if (!settings.hooks) settings.hooks = {};
|
|
3848
3848
|
const stateAdvanceHook = {
|
|
3849
3849
|
matcher: "Write|Edit",
|
|
3850
|
-
hooks: [{ type: "command", command: "node .claude/hooks/factory-state-advance.
|
|
3850
|
+
hooks: [{ type: "command", command: "node .claude/hooks/factory-state-advance.cjs" }]
|
|
3851
3851
|
};
|
|
3852
3852
|
const contextMonitorHook = {
|
|
3853
|
-
hooks: [{ type: "command", command: "node .claude/hooks/factory-context-monitor.
|
|
3853
|
+
hooks: [{ type: "command", command: "node .claude/hooks/factory-context-monitor.cjs" }]
|
|
3854
3854
|
};
|
|
3855
3855
|
const stateGuardHook = {
|
|
3856
|
-
hooks: [{ type: "command", command: "node .claude/hooks/factory-state-guard.
|
|
3856
|
+
hooks: [{ type: "command", command: "node .claude/hooks/factory-state-guard.cjs" }]
|
|
3857
3857
|
};
|
|
3858
3858
|
for (const event of ["PostToolUse", "UserPromptSubmit"]) {
|
|
3859
3859
|
if (settings.hooks[event]) {
|
|
@@ -3879,12 +3879,28 @@ function configureSettings(claudeDir) {
|
|
|
3879
3879
|
);
|
|
3880
3880
|
if (!hasMonitor) settings.hooks.UserPromptSubmit.push(contextMonitorHook);
|
|
3881
3881
|
}
|
|
3882
|
-
settings.statusLine = { type: "command", command: "node .claude/hooks/factory-statusline.
|
|
3882
|
+
settings.statusLine = { type: "command", command: "node .claude/hooks/factory-statusline.cjs" };
|
|
3883
3883
|
if (!(0, import_fs3.existsSync)(claudeDir)) {
|
|
3884
3884
|
(0, import_fs3.mkdirSync)(claudeDir, { recursive: true });
|
|
3885
3885
|
}
|
|
3886
3886
|
(0, import_fs3.writeFileSync)(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
3887
3887
|
}
|
|
3888
|
+
function copyAgentStubs(source, target) {
|
|
3889
|
+
if (!(0, import_fs3.existsSync)(target)) {
|
|
3890
|
+
(0, import_fs3.mkdirSync)(target, { recursive: true });
|
|
3891
|
+
}
|
|
3892
|
+
const entries = (0, import_fs3.readdirSync)(source, { withFileTypes: true });
|
|
3893
|
+
for (const entry of entries) {
|
|
3894
|
+
if (entry.isDirectory()) continue;
|
|
3895
|
+
if (!entry.name.endsWith(".md")) continue;
|
|
3896
|
+
const content = (0, import_fs3.readFileSync)((0, import_path3.join)(source, entry.name), "utf8");
|
|
3897
|
+
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?\r?\n)---/);
|
|
3898
|
+
if (frontmatterMatch) {
|
|
3899
|
+
(0, import_fs3.writeFileSync)((0, import_path3.join)(target, entry.name), frontmatterMatch[0] + "\n");
|
|
3900
|
+
} else {
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
}
|
|
3888
3904
|
function copyDirectory2(source, target) {
|
|
3889
3905
|
if (!(0, import_fs3.existsSync)(target)) {
|
|
3890
3906
|
(0, import_fs3.mkdirSync)(target, { recursive: true });
|
|
@@ -4288,7 +4304,7 @@ async function loadWizardOptions(token, repo) {
|
|
|
4288
4304
|
}
|
|
4289
4305
|
|
|
4290
4306
|
// src/index.ts
|
|
4291
|
-
var INSTALLER_VERSION = "0.5.
|
|
4307
|
+
var INSTALLER_VERSION = "0.5.7";
|
|
4292
4308
|
function getInstructionFilePath(agent) {
|
|
4293
4309
|
switch (agent) {
|
|
4294
4310
|
case "claude-code":
|
|
@@ -4317,6 +4333,25 @@ function formatMCPCommand(server) {
|
|
|
4317
4333
|
if (server.command) return `${server.command} ${(server.args ?? []).join(" ")}`.trimEnd();
|
|
4318
4334
|
return "";
|
|
4319
4335
|
}
|
|
4336
|
+
var dim = (text) => `\x1B[2m${text}\x1B[0m`;
|
|
4337
|
+
var yellow = (text) => `\x1B[33m${text}\x1B[0m`;
|
|
4338
|
+
var green = (text) => `\x1B[32m${text}\x1B[0m`;
|
|
4339
|
+
function detectMarkerFileMode(filePath, markerStart) {
|
|
4340
|
+
if (!(0, import_fs7.existsSync)(filePath)) return green("create");
|
|
4341
|
+
const content = (0, import_fs7.readFileSync)(filePath, "utf-8");
|
|
4342
|
+
if (content.includes(markerStart)) return yellow("update");
|
|
4343
|
+
return yellow("append");
|
|
4344
|
+
}
|
|
4345
|
+
function detectMCPFileMode(filePath) {
|
|
4346
|
+
if (!(0, import_fs7.existsSync)(filePath)) return green("create");
|
|
4347
|
+
return yellow("merge");
|
|
4348
|
+
}
|
|
4349
|
+
function detectContextMode(projectPath, domain) {
|
|
4350
|
+
const contextDir = (0, import_path7.join)(projectPath, "_ai-context", domain.toUpperCase());
|
|
4351
|
+
const contextDirLower = (0, import_path7.join)(projectPath, "_ai-context", domain);
|
|
4352
|
+
if ((0, import_fs7.existsSync)(contextDir) || (0, import_fs7.existsSync)(contextDirLower)) return yellow("overwrite");
|
|
4353
|
+
return green("create");
|
|
4354
|
+
}
|
|
4320
4355
|
function waitForEnter() {
|
|
4321
4356
|
const rl = (0, import_readline.createInterface)({ input: process.stdin, output: process.stdout });
|
|
4322
4357
|
return new Promise((resolve4) => {
|
|
@@ -4411,6 +4446,17 @@ async function previewAndConfirm(config, options) {
|
|
|
4411
4446
|
const instructionFile = getInstructionFilePath(config.agent);
|
|
4412
4447
|
const mcpConfigFile = getMCPConfigPath(config.agent);
|
|
4413
4448
|
const serverEntries = Object.entries(config.mcpConfig);
|
|
4449
|
+
const instructionFilePath = (0, import_path7.join)(config.projectPath, instructionFile);
|
|
4450
|
+
const mcpConfigFilePath = (0, import_path7.join)(config.projectPath, mcpConfigFile);
|
|
4451
|
+
const gitignorePath = (0, import_path7.join)(config.projectPath, ".gitignore");
|
|
4452
|
+
const instructionMode = detectMarkerFileMode(instructionFilePath, "<!-- one-shot-installer:start -->");
|
|
4453
|
+
const mcpMode = detectMCPFileMode(mcpConfigFilePath);
|
|
4454
|
+
const gitignoreMode = detectMarkerFileMode(gitignorePath, "# one-shot-installer:start");
|
|
4455
|
+
const uniqueDomains = [...new Set(config.personas.flatMap((p) => p.domains))];
|
|
4456
|
+
const domainModes = uniqueDomains.map((d) => ({
|
|
4457
|
+
domain: d,
|
|
4458
|
+
mode: detectContextMode(config.projectPath, d)
|
|
4459
|
+
}));
|
|
4414
4460
|
console.log("\n" + "\u2500".repeat(48));
|
|
4415
4461
|
console.log(" Ready to install");
|
|
4416
4462
|
console.log("\u2500".repeat(48) + "\n");
|
|
@@ -4419,14 +4465,22 @@ async function previewAndConfirm(config, options) {
|
|
|
4419
4465
|
console.log(` Factory ${config.installFactory ? "yes" : "no"}`);
|
|
4420
4466
|
console.log(` Directory ${config.projectPath}`);
|
|
4421
4467
|
console.log("");
|
|
4422
|
-
console.log(`
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4468
|
+
console.log(` ${dim("File actions:")}`);
|
|
4469
|
+
const domainColWidth = Math.max(...domainModes.map((d) => d.domain.length), 6) + 2;
|
|
4470
|
+
for (const { domain, mode } of domainModes) {
|
|
4471
|
+
console.log(` _ai-context/${domain.padEnd(domainColWidth)}${mode}`);
|
|
4472
|
+
}
|
|
4473
|
+
console.log(` ${instructionFile.padEnd(domainColWidth + 14)}${instructionMode}`);
|
|
4474
|
+
console.log(` ${mcpConfigFile.padEnd(domainColWidth + 14)}${mcpMode}`);
|
|
4475
|
+
console.log(` ${".gitignore".padEnd(domainColWidth + 14)}${gitignoreMode}`);
|
|
4476
|
+
if (config.installFactory) {
|
|
4477
|
+
const factoryExists = (0, import_fs7.existsSync)((0, import_path7.join)(config.projectPath, "factory"));
|
|
4478
|
+
const factoryMode = factoryExists ? yellow("overwrite") : green("create");
|
|
4479
|
+
console.log(` ${"factory/".padEnd(domainColWidth + 14)}${factoryMode}`);
|
|
4480
|
+
}
|
|
4427
4481
|
if (serverEntries.length > 0) {
|
|
4428
4482
|
console.log("");
|
|
4429
|
-
console.log("
|
|
4483
|
+
console.log(` ${dim("MCP servers:")}`);
|
|
4430
4484
|
const maxLen = Math.max(...serverEntries.map(([name]) => name.length));
|
|
4431
4485
|
for (const [name, server] of serverEntries) {
|
|
4432
4486
|
const cmd = formatMCPCommand(server);
|