dlw-machine-setup 0.5.17 → 0.5.18

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 +66 -2
  2. package/package.json +1 -1
package/bin/installer.js CHANGED
@@ -3638,6 +3638,7 @@ var steps_exports = {};
3638
3638
  __export(steps_exports, {
3639
3639
  fetchContexts: () => fetch_contexts_default,
3640
3640
  fetchFactory: () => fetch_factory_default,
3641
+ runMcpInstallCommands: () => run_mcp_install_commands_default,
3641
3642
  updateGitignore: () => update_gitignore_default,
3642
3643
  writeInstructions: () => write_instructions_default,
3643
3644
  writeMcpConfig: () => write_mcp_config_default,
@@ -4368,7 +4369,7 @@ var write_mcp_config_default = defineStep({
4368
4369
  const existingServers = existingFile[target.rootKey] ?? {};
4369
4370
  const newServers = {};
4370
4371
  for (const [serverName, serverConfig] of Object.entries(filteredMcpConfig)) {
4371
- const { description, useWhen, active, ...mcpFields } = serverConfig;
4372
+ const { description, useWhen, active, installCommand, ...mcpFields } = serverConfig;
4372
4373
  newServers[serverName] = mcpFields;
4373
4374
  addedServers.push(serverName);
4374
4375
  }
@@ -4394,6 +4395,66 @@ function getAgentMCPTarget(agent) {
4394
4395
  }
4395
4396
  }
4396
4397
 
4398
+ // src/steps/setup/run-mcp-install-commands.ts
4399
+ var import_child_process4 = require("child_process");
4400
+ var run_mcp_install_commands_default = defineStep({
4401
+ name: "run-mcp-install-commands",
4402
+ label: "Registering MCP servers with Claude Code",
4403
+ when: (ctx) => {
4404
+ if (ctx.config.agent !== "claude-code") return false;
4405
+ const filtered = getFilteredMcpConfig(ctx);
4406
+ return Object.values(filtered).some((s) => typeof s.installCommand === "string" && s.installCommand.length > 0);
4407
+ },
4408
+ execute: async (ctx) => {
4409
+ if (!isClaudeCliAvailable()) {
4410
+ return {
4411
+ status: "skipped",
4412
+ detail: "`claude` CLI not found on PATH \u2014 skipping CLI registration (project .mcp.json was still written)"
4413
+ };
4414
+ }
4415
+ const filtered = getFilteredMcpConfig(ctx);
4416
+ const succeeded = [];
4417
+ const failed = [];
4418
+ for (const [name, cfg] of Object.entries(filtered)) {
4419
+ const cmd = cfg.installCommand;
4420
+ if (typeof cmd !== "string" || cmd.length === 0) continue;
4421
+ const result = (0, import_child_process4.spawnSync)(cmd, {
4422
+ shell: true,
4423
+ stdio: "pipe",
4424
+ encoding: "utf-8",
4425
+ cwd: ctx.config.projectPath
4426
+ });
4427
+ if (result.status === 0) {
4428
+ succeeded.push(name);
4429
+ } else {
4430
+ const stderr = (result.stderr ?? "").trim();
4431
+ const reason = stderr.length > 0 ? stderr.split("\n")[0] : `exit ${result.status}`;
4432
+ failed.push({ name, reason });
4433
+ }
4434
+ }
4435
+ ctx.installed.mcpInstallCommandsRun = { succeeded, failed };
4436
+ if (failed.length === 0) {
4437
+ return {
4438
+ status: "success",
4439
+ message: succeeded.length > 0 ? succeeded.join(", ") : void 0
4440
+ };
4441
+ }
4442
+ const failedSummary = failed.map((f) => `${f.name} (${f.reason})`).join("; ");
4443
+ if (succeeded.length === 0) {
4444
+ return { status: "failed", detail: failedSummary };
4445
+ }
4446
+ return {
4447
+ status: "success",
4448
+ message: `${succeeded.join(", ")}; failed: ${failed.map((f) => f.name).join(", ")}`,
4449
+ detail: `Some registrations failed: ${failedSummary}`
4450
+ };
4451
+ }
4452
+ });
4453
+ function isClaudeCliAvailable() {
4454
+ const check2 = (0, import_child_process4.spawnSync)("claude --version", { shell: true, stdio: "ignore" });
4455
+ return check2.status === 0;
4456
+ }
4457
+
4397
4458
  // src/steps/setup/update-gitignore.ts
4398
4459
  var import_fs6 = require("fs");
4399
4460
  var import_path6 = require("path");
@@ -4454,7 +4515,7 @@ var update_gitignore_default = defineStep({
4454
4515
  var import_fs7 = require("fs");
4455
4516
  var import_path7 = require("path");
4456
4517
  var import_os2 = require("os");
4457
- var INSTALLER_VERSION = "0.5.17";
4518
+ var INSTALLER_VERSION = "0.5.18";
4458
4519
  var write_state_default = defineStep({
4459
4520
  name: "write-state",
4460
4521
  label: "Saving installation state",
@@ -4648,6 +4709,9 @@ async function collectInputs(options, releaseVersion, factoryAvailable = false)
4648
4709
  mcpConfig["azure-devops"].args = mcpConfig["azure-devops"].args?.map(
4649
4710
  (arg) => arg === "__AZURE_ORG__" ? azureDevOpsOrg : arg
4650
4711
  );
4712
+ if (mcpConfig["azure-devops"].installCommand) {
4713
+ mcpConfig["azure-devops"].installCommand = mcpConfig["azure-devops"].installCommand.replace(/__AZURE_ORG__/g, azureDevOpsOrg);
4714
+ }
4651
4715
  }
4652
4716
  }
4653
4717
  const projectInput = await esm_default4({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dlw-machine-setup",
3
- "version": "0.5.17",
3
+ "version": "0.5.18",
4
4
  "description": "One-shot installer for The Machine toolchain",
5
5
  "bin": {
6
6
  "dlw-machine-setup": "bin/installer.js"