dlw-machine-setup 0.9.1 → 0.9.3

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 +119 -43
  2. package/package.json +1 -1
package/bin/installer.js CHANGED
@@ -1612,14 +1612,14 @@ var require_lib = __commonJS({
1612
1612
  var require_ansi_escapes = __commonJS({
1613
1613
  "node_modules/ansi-escapes/index.js"(exports2, module2) {
1614
1614
  "use strict";
1615
- var ansiEscapes4 = module2.exports;
1616
- module2.exports.default = ansiEscapes4;
1615
+ var ansiEscapes5 = module2.exports;
1616
+ module2.exports.default = ansiEscapes5;
1617
1617
  var ESC = "\x1B[";
1618
1618
  var OSC = "\x1B]";
1619
1619
  var BEL = "\x07";
1620
1620
  var SEP = ";";
1621
1621
  var isTerminalApp = process.env.TERM_PROGRAM === "Apple_Terminal";
1622
- ansiEscapes4.cursorTo = (x, y) => {
1622
+ ansiEscapes5.cursorTo = (x, y) => {
1623
1623
  if (typeof x !== "number") {
1624
1624
  throw new TypeError("The `x` argument is required");
1625
1625
  }
@@ -1628,7 +1628,7 @@ var require_ansi_escapes = __commonJS({
1628
1628
  }
1629
1629
  return ESC + (y + 1) + ";" + (x + 1) + "H";
1630
1630
  };
1631
- ansiEscapes4.cursorMove = (x, y) => {
1631
+ ansiEscapes5.cursorMove = (x, y) => {
1632
1632
  if (typeof x !== "number") {
1633
1633
  throw new TypeError("The `x` argument is required");
1634
1634
  }
@@ -1645,46 +1645,46 @@ var require_ansi_escapes = __commonJS({
1645
1645
  }
1646
1646
  return ret;
1647
1647
  };
1648
- ansiEscapes4.cursorUp = (count = 1) => ESC + count + "A";
1649
- ansiEscapes4.cursorDown = (count = 1) => ESC + count + "B";
1650
- ansiEscapes4.cursorForward = (count = 1) => ESC + count + "C";
1651
- ansiEscapes4.cursorBackward = (count = 1) => ESC + count + "D";
1652
- ansiEscapes4.cursorLeft = ESC + "G";
1653
- ansiEscapes4.cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
1654
- ansiEscapes4.cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
1655
- ansiEscapes4.cursorGetPosition = ESC + "6n";
1656
- ansiEscapes4.cursorNextLine = ESC + "E";
1657
- ansiEscapes4.cursorPrevLine = ESC + "F";
1658
- ansiEscapes4.cursorHide = ESC + "?25l";
1659
- ansiEscapes4.cursorShow = ESC + "?25h";
1660
- ansiEscapes4.eraseLines = (count) => {
1648
+ ansiEscapes5.cursorUp = (count = 1) => ESC + count + "A";
1649
+ ansiEscapes5.cursorDown = (count = 1) => ESC + count + "B";
1650
+ ansiEscapes5.cursorForward = (count = 1) => ESC + count + "C";
1651
+ ansiEscapes5.cursorBackward = (count = 1) => ESC + count + "D";
1652
+ ansiEscapes5.cursorLeft = ESC + "G";
1653
+ ansiEscapes5.cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
1654
+ ansiEscapes5.cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
1655
+ ansiEscapes5.cursorGetPosition = ESC + "6n";
1656
+ ansiEscapes5.cursorNextLine = ESC + "E";
1657
+ ansiEscapes5.cursorPrevLine = ESC + "F";
1658
+ ansiEscapes5.cursorHide = ESC + "?25l";
1659
+ ansiEscapes5.cursorShow = ESC + "?25h";
1660
+ ansiEscapes5.eraseLines = (count) => {
1661
1661
  let clear = "";
1662
1662
  for (let i = 0; i < count; i++) {
1663
- clear += ansiEscapes4.eraseLine + (i < count - 1 ? ansiEscapes4.cursorUp() : "");
1663
+ clear += ansiEscapes5.eraseLine + (i < count - 1 ? ansiEscapes5.cursorUp() : "");
1664
1664
  }
1665
1665
  if (count) {
1666
- clear += ansiEscapes4.cursorLeft;
1666
+ clear += ansiEscapes5.cursorLeft;
1667
1667
  }
1668
1668
  return clear;
1669
1669
  };
1670
- ansiEscapes4.eraseEndLine = ESC + "K";
1671
- ansiEscapes4.eraseStartLine = ESC + "1K";
1672
- ansiEscapes4.eraseLine = ESC + "2K";
1673
- ansiEscapes4.eraseDown = ESC + "J";
1674
- ansiEscapes4.eraseUp = ESC + "1J";
1675
- ansiEscapes4.eraseScreen = ESC + "2J";
1676
- ansiEscapes4.scrollUp = ESC + "S";
1677
- ansiEscapes4.scrollDown = ESC + "T";
1678
- ansiEscapes4.clearScreen = "\x1Bc";
1679
- ansiEscapes4.clearTerminal = process.platform === "win32" ? `${ansiEscapes4.eraseScreen}${ESC}0f` : (
1670
+ ansiEscapes5.eraseEndLine = ESC + "K";
1671
+ ansiEscapes5.eraseStartLine = ESC + "1K";
1672
+ ansiEscapes5.eraseLine = ESC + "2K";
1673
+ ansiEscapes5.eraseDown = ESC + "J";
1674
+ ansiEscapes5.eraseUp = ESC + "1J";
1675
+ ansiEscapes5.eraseScreen = ESC + "2J";
1676
+ ansiEscapes5.scrollUp = ESC + "S";
1677
+ ansiEscapes5.scrollDown = ESC + "T";
1678
+ ansiEscapes5.clearScreen = "\x1Bc";
1679
+ ansiEscapes5.clearTerminal = process.platform === "win32" ? `${ansiEscapes5.eraseScreen}${ESC}0f` : (
1680
1680
  // 1. Erases the screen (Only done in case `2` is not supported)
1681
1681
  // 2. Erases the whole screen including scrollback buffer
1682
1682
  // 3. Moves cursor to the top-left position
1683
1683
  // More info: https://www.real-world-systems.com/docs/ANSIcode.html
1684
- `${ansiEscapes4.eraseScreen}${ESC}3J${ESC}H`
1684
+ `${ansiEscapes5.eraseScreen}${ESC}3J${ESC}H`
1685
1685
  );
1686
- ansiEscapes4.beep = BEL;
1687
- ansiEscapes4.link = (text, url) => {
1686
+ ansiEscapes5.beep = BEL;
1687
+ ansiEscapes5.link = (text, url) => {
1688
1688
  return [
1689
1689
  OSC,
1690
1690
  "8",
@@ -1700,7 +1700,7 @@ var require_ansi_escapes = __commonJS({
1700
1700
  BEL
1701
1701
  ].join("");
1702
1702
  };
1703
- ansiEscapes4.image = (buffer, options = {}) => {
1703
+ ansiEscapes5.image = (buffer, options = {}) => {
1704
1704
  let ret = `${OSC}1337;File=inline=1`;
1705
1705
  if (options.width) {
1706
1706
  ret += `;width=${options.width}`;
@@ -1713,7 +1713,7 @@ var require_ansi_escapes = __commonJS({
1713
1713
  }
1714
1714
  return ret + ":" + buffer.toString("base64") + BEL;
1715
1715
  };
1716
- ansiEscapes4.iTerm = {
1716
+ ansiEscapes5.iTerm = {
1717
1717
  setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
1718
1718
  annotation: (message, options = {}) => {
1719
1719
  let ret = `${OSC}1337;`;
@@ -3103,9 +3103,60 @@ var esm_default4 = createPrompt((config, done) => {
3103
3103
  ];
3104
3104
  });
3105
3105
 
3106
+ // node_modules/@inquirer/password/dist/esm/index.mjs
3107
+ var import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
3108
+ var esm_default5 = createPrompt((config, done) => {
3109
+ const { validate = () => true } = config;
3110
+ const theme = makeTheme(config.theme);
3111
+ const [status, setStatus] = useState("pending");
3112
+ const [errorMsg, setError] = useState();
3113
+ const [value, setValue] = useState("");
3114
+ const isLoading = status === "loading";
3115
+ const prefix = usePrefix({ isLoading, theme });
3116
+ useKeypress(async (key, rl) => {
3117
+ if (status !== "pending") {
3118
+ return;
3119
+ }
3120
+ if (isEnterKey(key)) {
3121
+ const answer = value;
3122
+ setStatus("loading");
3123
+ const isValid = await validate(answer);
3124
+ if (isValid === true) {
3125
+ setValue(answer);
3126
+ setStatus("done");
3127
+ done(answer);
3128
+ } else {
3129
+ rl.write(value);
3130
+ setError(isValid || "You must provide a valid value");
3131
+ setStatus("pending");
3132
+ }
3133
+ } else {
3134
+ setValue(rl.line);
3135
+ setError(void 0);
3136
+ }
3137
+ });
3138
+ const message = theme.style.message(config.message);
3139
+ let formattedValue = "";
3140
+ let helpTip;
3141
+ if (config.mask) {
3142
+ const maskChar = typeof config.mask === "string" ? config.mask : "*";
3143
+ formattedValue = maskChar.repeat(value.length);
3144
+ } else if (status !== "done") {
3145
+ helpTip = `${theme.style.help("[input is masked]")}${import_ansi_escapes3.default.cursorHide}`;
3146
+ }
3147
+ if (status === "done") {
3148
+ formattedValue = theme.style.answer(formattedValue);
3149
+ }
3150
+ let error = "";
3151
+ if (errorMsg) {
3152
+ error = theme.style.error(errorMsg);
3153
+ }
3154
+ return [[prefix, message, config.mask ? formattedValue : helpTip].join(" "), error];
3155
+ });
3156
+
3106
3157
  // node_modules/@inquirer/select/dist/esm/index.mjs
3107
3158
  var import_yoctocolors_cjs4 = __toESM(require_yoctocolors_cjs(), 1);
3108
- var import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
3159
+ var import_ansi_escapes4 = __toESM(require_ansi_escapes(), 1);
3109
3160
  var selectTheme = {
3110
3161
  icon: { cursor: esm_default.pointer },
3111
3162
  style: {
@@ -3139,7 +3190,7 @@ function normalizeChoices2(choices) {
3139
3190
  };
3140
3191
  });
3141
3192
  }
3142
- var esm_default5 = createPrompt((config, done) => {
3193
+ var esm_default6 = createPrompt((config, done) => {
3143
3194
  const { loop = true, pageSize = 7 } = config;
3144
3195
  const firstRender = useRef(true);
3145
3196
  const theme = makeTheme(selectTheme, config.theme);
@@ -3240,7 +3291,7 @@ ${theme.style.help("(Use arrow keys to reveal more choices)")}`;
3240
3291
  const choiceDescription = selectedChoice.description ? `
3241
3292
  ${theme.style.description(selectedChoice.description)}` : ``;
3242
3293
  return `${[prefix, message, helpTipTop].filter(Boolean).join(" ")}
3243
- ${page}${helpTipBottom}${choiceDescription}${import_ansi_escapes3.default.cursorHide}`;
3294
+ ${page}${helpTipBottom}${choiceDescription}${import_ansi_escapes4.default.cursorHide}`;
3244
3295
  });
3245
3296
 
3246
3297
  // src/index.ts
@@ -5240,7 +5291,10 @@ var red2 = (text) => `\x1B[31m${text}\x1B[0m`;
5240
5291
  var write_mcp_config_default = defineStep({
5241
5292
  name: "write-mcp-config",
5242
5293
  label: "Writing MCP configuration",
5243
- when: (ctx) => Object.keys(ctx.config.mcpConfig).length > 0,
5294
+ /* Claude Code registers servers via `claude mcp add` (run-mcp-install-commands),
5295
+ * so the project-scoped `.mcp.json` is redundant there. Cursor and GitHub
5296
+ * Copilot have no equivalent CLI — they still need their config file. */
5297
+ when: (ctx) => ctx.config.agent !== "claude-code" && Object.keys(ctx.config.mcpConfig).length > 0,
5244
5298
  execute: async (ctx) => {
5245
5299
  const filteredMcpConfig = getFilteredMcpConfig(ctx);
5246
5300
  const target = getAgentTarget(ctx.config.agent);
@@ -5369,23 +5423,24 @@ var run_mcp_install_commands_default = defineStep({
5369
5423
  },
5370
5424
  inverse: {
5371
5425
  label: "Unregistering MCP servers from Claude Code",
5372
- execute: async (raw) => {
5426
+ execute: async (raw, ctx) => {
5373
5427
  const rec = raw ?? {};
5374
5428
  const servers = rec.registeredServers ?? [];
5375
5429
  if (servers.length === 0) return { status: "skipped", detail: "nothing was registered" };
5376
5430
  if (!isClaudeCliAvailable()) {
5377
5431
  return {
5378
5432
  status: "skipped",
5379
- detail: "`claude` CLI not found \u2014 leftover global registrations: " + servers.join(", ")
5433
+ detail: "`claude` CLI not found \u2014 leftover registrations: " + servers.join(", ")
5380
5434
  };
5381
5435
  }
5382
5436
  const removed = [];
5383
5437
  const failed = [];
5384
5438
  for (const name of servers) {
5385
- const r = (0, import_child_process3.spawnSync)(`claude mcp remove ${name}`, {
5439
+ const r = (0, import_child_process3.spawnSync)(`claude mcp remove ${name} --scope project`, {
5386
5440
  shell: true,
5387
5441
  stdio: "pipe",
5388
- encoding: "utf-8"
5442
+ encoding: "utf-8",
5443
+ cwd: ctx.config.projectPath
5389
5444
  });
5390
5445
  if (r.status === 0) removed.push(name);
5391
5446
  else failed.push(name);
@@ -5817,7 +5872,7 @@ async function collectInputs(options, releaseVersion, factoryAvailable = false,
5817
5872
  loop: false
5818
5873
  });
5819
5874
  const selectedTechnologies = options.technologies.filter((p) => selectedIds.includes(p.id));
5820
- const agent = await esm_default5({
5875
+ const agent = await esm_default6({
5821
5876
  message: "AI coding tool:",
5822
5877
  choices: options.agents,
5823
5878
  loop: false
@@ -5840,6 +5895,27 @@ async function collectInputs(options, releaseVersion, factoryAvailable = false,
5840
5895
  }
5841
5896
  }
5842
5897
  }
5898
+ if (mcpConfig["sap_mcp_server"]) {
5899
+ const sapUser = (await esm_default4({
5900
+ message: "SAP MCP (ABAP F4P) username (leave empty to skip):"
5901
+ })).trim();
5902
+ if (sapUser === "") {
5903
+ delete mcpConfig["sap_mcp_server"];
5904
+ } else {
5905
+ const sapPassword = await esm_default5({
5906
+ message: "SAP MCP (ABAP F4P) password:",
5907
+ mask: "*"
5908
+ });
5909
+ if (sapPassword === "") {
5910
+ delete mcpConfig["sap_mcp_server"];
5911
+ } else {
5912
+ const encoded = Buffer.from(`${sapUser}:${sapPassword}`).toString("base64");
5913
+ if (mcpConfig["sap_mcp_server"].installCommand) {
5914
+ mcpConfig["sap_mcp_server"].installCommand = mcpConfig["sap_mcp_server"].installCommand.replace(/__SAP_MCP_AUTH__/g, encoded);
5915
+ }
5916
+ }
5917
+ }
5918
+ }
5843
5919
  const projectInput = await esm_default4({
5844
5920
  message: "Project directory:",
5845
5921
  default: (0, import_path16.resolve)(process.cwd())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dlw-machine-setup",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "One-shot installer for The Machine toolchain",
5
5
  "bin": {
6
6
  "dlw-machine-setup": "bin/installer.js"