dlw-machine-setup 0.4.7 → 0.4.9
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 +29 -42
- package/package.json +1 -1
package/bin/installer.js
CHANGED
|
@@ -3637,7 +3637,7 @@ async function fetchContexts(options = {}) {
|
|
|
3637
3637
|
throw new Error("Extraction failed");
|
|
3638
3638
|
}
|
|
3639
3639
|
const extractedPath = (0, import_path2.join)(tempDir, extractedFolder);
|
|
3640
|
-
|
|
3640
|
+
copyDirectory(extractedPath, domainPath);
|
|
3641
3641
|
result.successful.push(domain);
|
|
3642
3642
|
} catch (error) {
|
|
3643
3643
|
const reason = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -3689,9 +3689,9 @@ function getReadableError(status) {
|
|
|
3689
3689
|
return `Unexpected error (${status})`;
|
|
3690
3690
|
}
|
|
3691
3691
|
}
|
|
3692
|
-
function
|
|
3692
|
+
function copyDirectory(source, target) {
|
|
3693
3693
|
let added = 0;
|
|
3694
|
-
let
|
|
3694
|
+
let overwritten = 0;
|
|
3695
3695
|
if (!(0, import_fs2.existsSync)(target)) {
|
|
3696
3696
|
(0, import_fs2.mkdirSync)(target, { recursive: true });
|
|
3697
3697
|
}
|
|
@@ -3700,19 +3700,19 @@ function mergeDirectories(source, target) {
|
|
|
3700
3700
|
const sourcePath = (0, import_path2.join)(source, entry.name);
|
|
3701
3701
|
const targetPath = (0, import_path2.join)(target, entry.name);
|
|
3702
3702
|
if (entry.isDirectory()) {
|
|
3703
|
-
const result =
|
|
3703
|
+
const result = copyDirectory(sourcePath, targetPath);
|
|
3704
3704
|
added += result.added;
|
|
3705
|
-
|
|
3705
|
+
overwritten += result.overwritten;
|
|
3706
3706
|
} else {
|
|
3707
3707
|
if ((0, import_fs2.existsSync)(targetPath)) {
|
|
3708
|
-
|
|
3708
|
+
overwritten++;
|
|
3709
3709
|
} else {
|
|
3710
|
-
(0, import_fs2.copyFileSync)(sourcePath, targetPath);
|
|
3711
3710
|
added++;
|
|
3712
3711
|
}
|
|
3712
|
+
(0, import_fs2.copyFileSync)(sourcePath, targetPath);
|
|
3713
3713
|
}
|
|
3714
3714
|
}
|
|
3715
|
-
return { added,
|
|
3715
|
+
return { added, overwritten };
|
|
3716
3716
|
}
|
|
3717
3717
|
|
|
3718
3718
|
// src/utils/setup/setup-mcp.ts
|
|
@@ -3759,20 +3759,15 @@ async function setupMCPConfiguration(projectPath, mcpConfig, agent) {
|
|
|
3759
3759
|
console.log(box);
|
|
3760
3760
|
}
|
|
3761
3761
|
}
|
|
3762
|
-
const existing = existingFile[target.rootKey] ?? {};
|
|
3763
3762
|
const addedServers = [];
|
|
3764
3763
|
const skippedServers = [];
|
|
3765
|
-
const
|
|
3764
|
+
const servers = {};
|
|
3766
3765
|
for (const [serverName, serverConfig] of Object.entries(mcpConfig)) {
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
const { description, useWhen, active, ...mcpFields } = serverConfig;
|
|
3771
|
-
mergedServers[serverName] = mcpFields;
|
|
3772
|
-
addedServers.push(serverName);
|
|
3773
|
-
}
|
|
3766
|
+
const { description, useWhen, active, ...mcpFields } = serverConfig;
|
|
3767
|
+
servers[serverName] = mcpFields;
|
|
3768
|
+
addedServers.push(serverName);
|
|
3774
3769
|
}
|
|
3775
|
-
const outputFile = { ...existingFile, [target.rootKey]:
|
|
3770
|
+
const outputFile = { ...existingFile, [target.rootKey]: servers };
|
|
3776
3771
|
(0, import_fs3.writeFileSync)(mcpJsonPath, JSON.stringify(outputFile, null, 2), "utf-8");
|
|
3777
3772
|
return { addedServers, skippedServers };
|
|
3778
3773
|
}
|
|
@@ -3995,8 +3990,17 @@ applyTo: "**"
|
|
|
3995
3990
|
case "cursor": {
|
|
3996
3991
|
const cursorDir = (0, import_path4.join)(projectPath, ".cursor", "rules");
|
|
3997
3992
|
if (!(0, import_fs4.existsSync)(cursorDir)) (0, import_fs4.mkdirSync)(cursorDir, { recursive: true });
|
|
3993
|
+
const filePath = (0, import_path4.join)(cursorDir, "instructions.mdc");
|
|
3994
|
+
if (!(0, import_fs4.existsSync)(filePath)) {
|
|
3995
|
+
(0, import_fs4.writeFileSync)(filePath, `---
|
|
3996
|
+
description: AI development instructions from One-Shot Installer
|
|
3997
|
+
alwaysApply: true
|
|
3998
|
+
---
|
|
3999
|
+
|
|
4000
|
+
`, "utf-8");
|
|
4001
|
+
}
|
|
3998
4002
|
const body = buildCombinedInstructions(domains, mcpConfig, agent, projectPath);
|
|
3999
|
-
upsertBlock(
|
|
4003
|
+
upsertBlock(filePath, body);
|
|
4000
4004
|
break;
|
|
4001
4005
|
}
|
|
4002
4006
|
default:
|
|
@@ -4024,7 +4028,7 @@ async function loadWizardOptions(token, repo) {
|
|
|
4024
4028
|
}
|
|
4025
4029
|
|
|
4026
4030
|
// src/index.ts
|
|
4027
|
-
var INSTALLER_VERSION = "0.4.
|
|
4031
|
+
var INSTALLER_VERSION = "0.4.9";
|
|
4028
4032
|
function getInstructionFilePath(agent) {
|
|
4029
4033
|
switch (agent) {
|
|
4030
4034
|
case "claude-code":
|
|
@@ -4216,27 +4220,13 @@ async function execute(config, token, repo) {
|
|
|
4216
4220
|
Object.entries(config.mcpConfig).filter(([name]) => successfulMcpServers.has(name))
|
|
4217
4221
|
);
|
|
4218
4222
|
const statePath = (0, import_path5.join)(config.projectPath, ".one-shot-state.json");
|
|
4219
|
-
|
|
4220
|
-
try {
|
|
4221
|
-
if ((0, import_fs5.existsSync)(statePath)) {
|
|
4222
|
-
previousState = JSON.parse((0, import_fs5.readFileSync)(statePath, "utf-8"));
|
|
4223
|
-
}
|
|
4224
|
-
} catch {
|
|
4225
|
-
}
|
|
4226
|
-
const allDomains = [.../* @__PURE__ */ new Set([
|
|
4227
|
-
...previousState.domains ?? [],
|
|
4228
|
-
...result.domainsInstalled
|
|
4229
|
-
])];
|
|
4230
|
-
const mergedMcpConfig = {
|
|
4231
|
-
...previousState.mcpConfigs ?? {},
|
|
4232
|
-
...filteredMcpConfig
|
|
4233
|
-
};
|
|
4223
|
+
const allDomains = result.domainsInstalled;
|
|
4234
4224
|
process.stdout.write(` Writing ${instructionFilePath}... `);
|
|
4235
4225
|
try {
|
|
4236
4226
|
await setupInstructions({
|
|
4237
4227
|
domains: allDomains,
|
|
4238
4228
|
agent: config.agent,
|
|
4239
|
-
mcpConfig:
|
|
4229
|
+
mcpConfig: filteredMcpConfig,
|
|
4240
4230
|
projectPath: config.projectPath
|
|
4241
4231
|
});
|
|
4242
4232
|
result.instructionsCreated = true;
|
|
@@ -4262,10 +4252,7 @@ async function execute(config, token, repo) {
|
|
|
4262
4252
|
console.log(` Path: ${mcpConfigPath}`);
|
|
4263
4253
|
}
|
|
4264
4254
|
result.success = result.domainsFailed.length === 0 && result.instructionsCreated && result.mcpConfigured;
|
|
4265
|
-
const allPersonas =
|
|
4266
|
-
...previousState.personas ?? [],
|
|
4267
|
-
...config.personas.map((p) => p.id)
|
|
4268
|
-
])];
|
|
4255
|
+
const allPersonas = config.personas.map((p) => p.id);
|
|
4269
4256
|
const state = {
|
|
4270
4257
|
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4271
4258
|
installerVersion: INSTALLER_VERSION,
|
|
@@ -4274,8 +4261,8 @@ async function execute(config, token, repo) {
|
|
|
4274
4261
|
agent: config.agent,
|
|
4275
4262
|
personas: allPersonas,
|
|
4276
4263
|
domains: allDomains,
|
|
4277
|
-
mcpServers: Object.keys(
|
|
4278
|
-
mcpConfigs:
|
|
4264
|
+
mcpServers: Object.keys(filteredMcpConfig),
|
|
4265
|
+
mcpConfigs: filteredMcpConfig,
|
|
4279
4266
|
files: {
|
|
4280
4267
|
instructions: instructionFilePath,
|
|
4281
4268
|
mcpConfig: mcpConfigPath,
|