dlw-machine-setup 0.4.7 → 0.4.8

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.
Files changed (2) hide show
  1. package/bin/installer.js +19 -41
  2. 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
- mergeDirectories(extractedPath, domainPath);
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 mergeDirectories(source, target) {
3692
+ function copyDirectory(source, target) {
3693
3693
  let added = 0;
3694
- let skipped = 0;
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 = mergeDirectories(sourcePath, targetPath);
3703
+ const result = copyDirectory(sourcePath, targetPath);
3704
3704
  added += result.added;
3705
- skipped += result.skipped;
3705
+ overwritten += result.overwritten;
3706
3706
  } else {
3707
3707
  if ((0, import_fs2.existsSync)(targetPath)) {
3708
- skipped++;
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, skipped };
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 mergedServers = { ...existing };
3764
+ const servers = {};
3766
3765
  for (const [serverName, serverConfig] of Object.entries(mcpConfig)) {
3767
- if (mergedServers[serverName]) {
3768
- skippedServers.push(serverName);
3769
- } else {
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]: mergedServers };
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
  }
@@ -4024,7 +4019,7 @@ async function loadWizardOptions(token, repo) {
4024
4019
  }
4025
4020
 
4026
4021
  // src/index.ts
4027
- var INSTALLER_VERSION = "0.4.7";
4022
+ var INSTALLER_VERSION = "0.4.8";
4028
4023
  function getInstructionFilePath(agent) {
4029
4024
  switch (agent) {
4030
4025
  case "claude-code":
@@ -4216,27 +4211,13 @@ async function execute(config, token, repo) {
4216
4211
  Object.entries(config.mcpConfig).filter(([name]) => successfulMcpServers.has(name))
4217
4212
  );
4218
4213
  const statePath = (0, import_path5.join)(config.projectPath, ".one-shot-state.json");
4219
- let previousState = {};
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
- };
4214
+ const allDomains = result.domainsInstalled;
4234
4215
  process.stdout.write(` Writing ${instructionFilePath}... `);
4235
4216
  try {
4236
4217
  await setupInstructions({
4237
4218
  domains: allDomains,
4238
4219
  agent: config.agent,
4239
- mcpConfig: mergedMcpConfig,
4220
+ mcpConfig: filteredMcpConfig,
4240
4221
  projectPath: config.projectPath
4241
4222
  });
4242
4223
  result.instructionsCreated = true;
@@ -4262,10 +4243,7 @@ async function execute(config, token, repo) {
4262
4243
  console.log(` Path: ${mcpConfigPath}`);
4263
4244
  }
4264
4245
  result.success = result.domainsFailed.length === 0 && result.instructionsCreated && result.mcpConfigured;
4265
- const allPersonas = [.../* @__PURE__ */ new Set([
4266
- ...previousState.personas ?? [],
4267
- ...config.personas.map((p) => p.id)
4268
- ])];
4246
+ const allPersonas = config.personas.map((p) => p.id);
4269
4247
  const state = {
4270
4248
  installedAt: (/* @__PURE__ */ new Date()).toISOString(),
4271
4249
  installerVersion: INSTALLER_VERSION,
@@ -4274,8 +4252,8 @@ async function execute(config, token, repo) {
4274
4252
  agent: config.agent,
4275
4253
  personas: allPersonas,
4276
4254
  domains: allDomains,
4277
- mcpServers: Object.keys(mergedMcpConfig),
4278
- mcpConfigs: mergedMcpConfig,
4255
+ mcpServers: Object.keys(filteredMcpConfig),
4256
+ mcpConfigs: filteredMcpConfig,
4279
4257
  files: {
4280
4258
  instructions: instructionFilePath,
4281
4259
  mcpConfig: mcpConfigPath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dlw-machine-setup",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "description": "One-shot installer for The Machine toolchain",
5
5
  "bin": {
6
6
  "dlw-machine-setup": "bin/installer.js"