dlw-machine-setup 0.4.9 → 0.4.11

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 +64 -11
  2. package/package.json +1 -1
package/bin/installer.js CHANGED
@@ -3240,9 +3240,9 @@ ${page}${helpTipBottom}${choiceDescription}${import_ansi_escapes3.default.cursor
3240
3240
  });
3241
3241
 
3242
3242
  // src/index.ts
3243
- var import_fs5 = require("fs");
3243
+ var import_fs6 = require("fs");
3244
3244
  var import_readline = require("readline");
3245
- var import_path5 = require("path");
3245
+ var import_path6 = require("path");
3246
3246
 
3247
3247
  // src/utils/fetch.ts
3248
3248
  var DEFAULT_TIMEOUT_MS = 3e4;
@@ -3761,13 +3761,15 @@ async function setupMCPConfiguration(projectPath, mcpConfig, agent) {
3761
3761
  }
3762
3762
  const addedServers = [];
3763
3763
  const skippedServers = [];
3764
- const servers = {};
3764
+ const existingServers = existingFile[target.rootKey] ?? {};
3765
+ const newServers = {};
3765
3766
  for (const [serverName, serverConfig] of Object.entries(mcpConfig)) {
3766
3767
  const { description, useWhen, active, ...mcpFields } = serverConfig;
3767
- servers[serverName] = mcpFields;
3768
+ newServers[serverName] = mcpFields;
3768
3769
  addedServers.push(serverName);
3769
3770
  }
3770
- const outputFile = { ...existingFile, [target.rootKey]: servers };
3771
+ const mergedServers = { ...existingServers, ...newServers };
3772
+ const outputFile = { ...existingFile, [target.rootKey]: mergedServers };
3771
3773
  (0, import_fs3.writeFileSync)(mcpJsonPath, JSON.stringify(outputFile, null, 2), "utf-8");
3772
3774
  return { addedServers, skippedServers };
3773
3775
  }
@@ -4008,6 +4010,44 @@ alwaysApply: true
4008
4010
  }
4009
4011
  }
4010
4012
 
4013
+ // src/utils/setup/setup-gitignore.ts
4014
+ var import_fs5 = require("fs");
4015
+ var import_path5 = require("path");
4016
+ var MARKER_START2 = "# one-shot-installer:start";
4017
+ var MARKER_END2 = "# one-shot-installer:end";
4018
+ var GITIGNORE_ENTRIES = [
4019
+ "# One-Shot installer generated files",
4020
+ ".one-shot-state.json",
4021
+ ".mcp.json",
4022
+ "_ai-context/",
4023
+ "_bmad/",
4024
+ "_bmad-output/",
4025
+ "",
4026
+ "# Claude Code local/generated files",
4027
+ ".claude/agents/",
4028
+ ".claude/agent-memory/",
4029
+ ".claude/plans/",
4030
+ ".claude/settings.local.json"
4031
+ ];
4032
+ function setupGitignore(projectPath) {
4033
+ const gitignorePath = (0, import_path5.join)(projectPath, ".gitignore");
4034
+ const block = [MARKER_START2, ...GITIGNORE_ENTRIES, MARKER_END2].join("\n");
4035
+ if (!(0, import_fs5.existsSync)(gitignorePath)) {
4036
+ (0, import_fs5.writeFileSync)(gitignorePath, block + "\n", "utf-8");
4037
+ return;
4038
+ }
4039
+ const existing = (0, import_fs5.readFileSync)(gitignorePath, "utf-8");
4040
+ const start = existing.indexOf(MARKER_START2);
4041
+ const end = existing.indexOf(MARKER_END2);
4042
+ if (start !== -1 && end !== -1 && end > start) {
4043
+ const updated = existing.slice(0, start) + block + existing.slice(end + MARKER_END2.length);
4044
+ (0, import_fs5.writeFileSync)(gitignorePath, updated, "utf-8");
4045
+ } else {
4046
+ const separator = existing.endsWith("\n") ? "\n" : "\n\n";
4047
+ (0, import_fs5.writeFileSync)(gitignorePath, existing + separator + block + "\n", "utf-8");
4048
+ }
4049
+ }
4050
+
4011
4051
  // src/utils/mod.ts
4012
4052
  async function loadWizardOptions(token, repo) {
4013
4053
  const remote = await fetchWizardOptions(token, repo);
@@ -4028,7 +4068,7 @@ async function loadWizardOptions(token, repo) {
4028
4068
  }
4029
4069
 
4030
4070
  // src/index.ts
4031
- var INSTALLER_VERSION = "0.4.9";
4071
+ var INSTALLER_VERSION = "0.4.11";
4032
4072
  function getInstructionFilePath(agent) {
4033
4073
  switch (agent) {
4034
4074
  case "claude-code":
@@ -4126,13 +4166,13 @@ async function collectInputs(options, releaseVersion) {
4126
4166
  }
4127
4167
  const projectInput = await esm_default4({
4128
4168
  message: "Project directory:",
4129
- default: (0, import_path5.resolve)(process.cwd())
4169
+ default: (0, import_path6.resolve)(process.cwd())
4130
4170
  });
4131
4171
  return {
4132
4172
  personas: selectedPersonas,
4133
4173
  agent,
4134
4174
  azureDevOpsOrg,
4135
- projectPath: (0, import_path5.resolve)(projectInput),
4175
+ projectPath: (0, import_path6.resolve)(projectInput),
4136
4176
  baseMcpServers: options.baseMcpServers,
4137
4177
  mcpConfig,
4138
4178
  releaseVersion
@@ -4180,7 +4220,8 @@ async function execute(config, token, repo) {
4180
4220
  instructionFilePath,
4181
4221
  mcpConfigured: false,
4182
4222
  mcpConfigPath,
4183
- mcpServersAdded: []
4223
+ mcpServersAdded: [],
4224
+ gitignoreUpdated: false
4184
4225
  };
4185
4226
  console.log("");
4186
4227
  const uniqueDomains = [...new Set(config.personas.flatMap((p) => p.domains))];
@@ -4219,7 +4260,7 @@ async function execute(config, token, repo) {
4219
4260
  const filteredMcpConfig = Object.fromEntries(
4220
4261
  Object.entries(config.mcpConfig).filter(([name]) => successfulMcpServers.has(name))
4221
4262
  );
4222
- const statePath = (0, import_path5.join)(config.projectPath, ".one-shot-state.json");
4263
+ const statePath = (0, import_path6.join)(config.projectPath, ".one-shot-state.json");
4223
4264
  const allDomains = result.domainsInstalled;
4224
4265
  process.stdout.write(` Writing ${instructionFilePath}... `);
4225
4266
  try {
@@ -4251,6 +4292,15 @@ async function execute(config, token, repo) {
4251
4292
  console.log(` Error: ${error instanceof Error ? error.message : String(error)}`);
4252
4293
  console.log(` Path: ${mcpConfigPath}`);
4253
4294
  }
4295
+ process.stdout.write(` Updating .gitignore... `);
4296
+ try {
4297
+ setupGitignore(config.projectPath);
4298
+ result.gitignoreUpdated = true;
4299
+ console.log("\u2713");
4300
+ } catch (error) {
4301
+ console.log("\u2717");
4302
+ console.log(` Error: ${error instanceof Error ? error.message : String(error)}`);
4303
+ }
4254
4304
  result.success = result.domainsFailed.length === 0 && result.instructionsCreated && result.mcpConfigured;
4255
4305
  const allPersonas = config.personas.map((p) => p.id);
4256
4306
  const state = {
@@ -4270,7 +4320,7 @@ async function execute(config, token, repo) {
4270
4320
  }
4271
4321
  };
4272
4322
  try {
4273
- (0, import_fs5.writeFileSync)(statePath, JSON.stringify(state, null, 2), "utf-8");
4323
+ (0, import_fs6.writeFileSync)(statePath, JSON.stringify(state, null, 2), "utf-8");
4274
4324
  } catch {
4275
4325
  }
4276
4326
  return result;
@@ -4289,6 +4339,9 @@ function printSummary(result) {
4289
4339
  const serverList = result.mcpServersAdded.length > 0 ? ` (${result.mcpServersAdded.join(", ")})` : "";
4290
4340
  console.log(` ${result.mcpConfigPath} written${serverList}`);
4291
4341
  }
4342
+ if (result.gitignoreUpdated) {
4343
+ console.log(` .gitignore updated`);
4344
+ }
4292
4345
  if (hasErrors) {
4293
4346
  console.log("\n What went wrong:");
4294
4347
  if (result.domainsFailed.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dlw-machine-setup",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "One-shot installer for The Machine toolchain",
5
5
  "bin": {
6
6
  "dlw-machine-setup": "bin/installer.js"