@serviceme/devtools-cli 0.1.4 → 0.1.5

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.
@@ -9600,7 +9600,7 @@ function normalizeServicemeError(error, fallbackCode = "internal_error") {
9600
9600
  }
9601
9601
 
9602
9602
  // src/version.ts
9603
- var SERVICEME_CLI_VERSION = "0.1.4";
9603
+ var SERVICEME_CLI_VERSION = "0.1.5";
9604
9604
 
9605
9605
  // src/bridge/ndjson.ts
9606
9606
  function writeBridgeMessage(message) {
@@ -9760,6 +9760,30 @@ function writeDiagnostic(message) {
9760
9760
  }
9761
9761
  process.stderr.write(message);
9762
9762
  }
9763
+ function resolveGithubCopilotCliExecution(payload) {
9764
+ const args = ["copilot", "prompt", "--prompt", payload.prompt];
9765
+ if (payload.autopilot) {
9766
+ args.push("--autopilot");
9767
+ }
9768
+ if (payload.allowTools && payload.allowTools.length > 0) {
9769
+ args.push("--allow-tools", payload.allowTools.join(","));
9770
+ }
9771
+ if (payload.model) {
9772
+ args.push("--model", payload.model);
9773
+ }
9774
+ if (payload.agent) {
9775
+ args.push("--agent", payload.agent);
9776
+ }
9777
+ args.push("--timeout", String(payload.timeout ?? 0));
9778
+ return {
9779
+ command: "serviceme",
9780
+ args,
9781
+ cwd: payload.workspace,
9782
+ timeoutMs: resolveConfiguredTimeoutMs(payload.timeout, DEFAULT_TIMEOUT_MS),
9783
+ diagnosticArgs: redactArgs(args),
9784
+ promptLen: payload.prompt.length
9785
+ };
9786
+ }
9763
9787
  var GithubCopilotCliExecutor = class {
9764
9788
  async execute(payload, abortSignal) {
9765
9789
  const authenticated = await isCopilotAuthenticated();
@@ -9782,7 +9806,7 @@ var GithubCopilotCliExecutor = class {
9782
9806
  }
9783
9807
  executeStreaming(payload, onOutput, abortSignal) {
9784
9808
  const p = payload;
9785
- const timeoutMs = resolveConfiguredTimeoutMs(p.timeout, DEFAULT_TIMEOUT_MS);
9809
+ const execution = resolveGithubCopilotCliExecution(p);
9786
9810
  let resolve;
9787
9811
  const resultPromise = new Promise((r) => {
9788
9812
  resolve = r;
@@ -9804,26 +9828,12 @@ var GithubCopilotCliExecutor = class {
9804
9828
  }
9805
9829
  };
9806
9830
  }
9807
- const args = ["copilot", "prompt", "--prompt", p.prompt];
9808
- if (p.autopilot) {
9809
- args.push("--autopilot");
9810
- }
9811
- if (p.allowTools && p.allowTools.length > 0) {
9812
- args.push("--allow-tools", p.allowTools.join(","));
9813
- }
9814
- if (p.model) {
9815
- args.push("--model", p.model);
9816
- }
9817
- if (p.agent) {
9818
- args.push("--agent", p.agent);
9819
- }
9820
- args.push("--timeout", String(p.timeout ?? 0));
9821
9831
  writeDiagnostic(
9822
- `[GithubCopilotCliExecutor] spawn: command=serviceme, args=${JSON.stringify(redactArgs(args))}, promptLen=${p.prompt.length}, cwd=${p.workspace ?? "(default)"}, platform=${process.platform}, windowsHide=true, pid=${process.pid}
9832
+ `[GithubCopilotCliExecutor] spawn: command=${execution.command}, args=${JSON.stringify(execution.diagnosticArgs)}, promptLen=${execution.promptLen}, cwd=${execution.cwd ?? "(default)"}, platform=${process.platform}, windowsHide=true, pid=${process.pid}
9823
9833
  `
9824
9834
  );
9825
- const child = child_process.spawn("serviceme", args, {
9826
- cwd: p.workspace,
9835
+ const child = child_process.spawn(execution.command, execution.args, {
9836
+ cwd: execution.cwd,
9827
9837
  stdio: ["ignore", "pipe", "pipe"],
9828
9838
  windowsHide: true
9829
9839
  });
@@ -9833,6 +9843,7 @@ var GithubCopilotCliExecutor = class {
9833
9843
  `
9834
9844
  );
9835
9845
  }
9846
+ const timeoutMs = execution.timeoutMs;
9836
9847
  const timer = timeoutMs != null ? setTimeout(() => {
9837
9848
  child.kill("SIGTERM");
9838
9849
  setTimeout(() => {
package/dist/cli.js CHANGED
@@ -159,6 +159,7 @@ var init_env = __esm({
159
159
  "pnpm",
160
160
  "nvm",
161
161
  "nrm",
162
+ "rtk",
162
163
  "dotnet",
163
164
  "nuget"
164
165
  ];
@@ -585,13 +586,19 @@ var init_copilot2 = __esm({
585
586
  });
586
587
 
587
588
  // ../../packages/serviceme-core/src/env/environmentInspector.ts
588
- var TOOL_CHECK_TIMEOUT_MS, ERROR_CODE_NOT_FOUND, EnvironmentInspector;
589
+ var DEFAULT_TOOL_CHECK_TIMEOUT_MS, TOOL_CHECK_TIMEOUT_MS, ERROR_CODE_NOT_FOUND, ERROR_CODE_TIMEOUT, EnvironmentInspector;
589
590
  var init_environmentInspector = __esm({
590
591
  "../../packages/serviceme-core/src/env/environmentInspector.ts"() {
591
592
  init_src();
592
593
  init_runCommand();
593
- TOOL_CHECK_TIMEOUT_MS = 5e3;
594
+ DEFAULT_TOOL_CHECK_TIMEOUT_MS = 5e3;
595
+ TOOL_CHECK_TIMEOUT_MS = {
596
+ nuget: 12e3,
597
+ nvm: 8e3,
598
+ dotnet: 8e3
599
+ };
594
600
  ERROR_CODE_NOT_FOUND = 127;
601
+ ERROR_CODE_TIMEOUT = "ETIMEDOUT";
595
602
  EnvironmentInspector = class {
596
603
  async checkEnvironment() {
597
604
  const results = await Promise.all(
@@ -628,19 +635,18 @@ var init_environmentInspector = __esm({
628
635
  const isWindows = process.platform === "win32";
629
636
  const result = await runCommand(isWindows ? "where" : "which", {
630
637
  args: [toolName],
631
- timeoutMs: TOOL_CHECK_TIMEOUT_MS
638
+ timeoutMs: this.getToolTimeout(toolName)
632
639
  });
633
- return result.stdout.trim().split("\n")[0];
640
+ return result.stdout.split(/\r?\n/).map((line2) => line2.trim()).find((line2) => line2.length > 0);
634
641
  } catch {
635
642
  return void 0;
636
643
  }
637
644
  }
638
645
  async getToolVersion(toolName) {
639
- const command = this.getVersionCommand(toolName);
640
- const isWindows = process.platform === "win32";
641
- const result = await runCommand(isWindows ? "cmd.exe" : "/bin/bash", {
642
- args: isWindows ? ["/c", command] : ["-lc", command],
643
- timeoutMs: TOOL_CHECK_TIMEOUT_MS
646
+ const invocation = this.getVersionInvocation(toolName);
647
+ const result = await runCommand(invocation.command, {
648
+ args: invocation.args,
649
+ timeoutMs: this.getToolTimeout(toolName)
644
650
  });
645
651
  return this.parseVersion(toolName, result.stdout || result.stderr);
646
652
  }
@@ -649,7 +655,7 @@ var init_environmentInspector = __esm({
649
655
  try {
650
656
  const result = await runCommand("cmd.exe", {
651
657
  args: ["/c", "nvm version"],
652
- timeoutMs: TOOL_CHECK_TIMEOUT_MS
658
+ timeoutMs: this.getToolTimeout("nvm")
653
659
  });
654
660
  return {
655
661
  installed: true,
@@ -669,7 +675,7 @@ var init_environmentInspector = __esm({
669
675
  "-lc",
670
676
  'export NVM_DIR="$HOME/.nvm"; [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"; nvm --version'
671
677
  ],
672
- timeoutMs: TOOL_CHECK_TIMEOUT_MS
678
+ timeoutMs: this.getToolTimeout("nvm")
673
679
  });
674
680
  return {
675
681
  installed: true,
@@ -694,7 +700,7 @@ var init_environmentInspector = __esm({
694
700
  try {
695
701
  const result = await runCommand("dotnet", {
696
702
  args: ["nuget", "list", "source"],
697
- timeoutMs: TOOL_CHECK_TIMEOUT_MS
703
+ timeoutMs: this.getToolTimeout("nuget")
698
704
  });
699
705
  const privateSourceUrl = "http://192.168.20.209:10010/nuget";
700
706
  if (result.stdout.includes(privateSourceUrl)) {
@@ -712,17 +718,28 @@ var init_environmentInspector = __esm({
712
718
  return this.handleToolCheckError(error);
713
719
  }
714
720
  }
715
- getVersionCommand(toolName) {
721
+ getVersionInvocation(toolName) {
722
+ const isWindows = process.platform === "win32";
723
+ if (isWindows && ["npm", "pnpm", "nrm"].includes(toolName)) {
724
+ return {
725
+ command: "cmd.exe",
726
+ args: ["/d", "/s", "/c", `${toolName} --version`]
727
+ };
728
+ }
716
729
  const commands = {
717
- git: "git --version",
718
- node: "node --version",
719
- npm: "npm --version",
720
- pnpm: "pnpm --version",
721
- nvm: "nvm --version",
722
- nrm: "nrm --version",
723
- dotnet: "dotnet --version"
730
+ git: { command: "git", args: ["--version"] },
731
+ node: { command: "node", args: ["--version"] },
732
+ npm: { command: "npm", args: ["--version"] },
733
+ pnpm: { command: "pnpm", args: ["--version"] },
734
+ nvm: { command: "nvm", args: ["--version"] },
735
+ nrm: { command: "nrm", args: ["--version"] },
736
+ rtk: { command: "rtk", args: ["--version"] },
737
+ dotnet: { command: "dotnet", args: ["--version"] }
724
738
  };
725
- return commands[toolName] || `${toolName} --version`;
739
+ return commands[toolName] || { command: toolName, args: ["--version"] };
740
+ }
741
+ getToolTimeout(toolName) {
742
+ return TOOL_CHECK_TIMEOUT_MS[toolName] ?? DEFAULT_TOOL_CHECK_TIMEOUT_MS;
726
743
  }
727
744
  parseVersion(toolName, output) {
728
745
  const cleaned = output.trim();
@@ -749,10 +766,11 @@ var init_environmentInspector = __esm({
749
766
  const execError = error;
750
767
  const message = execError.message || String(error);
751
768
  const code = execError.code;
752
- const isNotFound = message.includes("command not found") || message.includes("not recognized") || code === ERROR_CODE_NOT_FOUND;
769
+ const isNotFound = message.includes("command not found") || message.includes("not recognized") || message.includes("ENOENT") || code === "ENOENT" || code === ERROR_CODE_NOT_FOUND;
770
+ const isTimeout = code === ERROR_CODE_TIMEOUT || message.toLowerCase().includes("timed out");
753
771
  return {
754
772
  installed: false,
755
- error: isNotFound ? "Not installed" : message
773
+ error: isNotFound ? "Not installed" : isTimeout ? "Check timed out" : message
756
774
  };
757
775
  }
758
776
  };
@@ -11939,6 +11957,30 @@ function writeDiagnostic(message) {
11939
11957
  }
11940
11958
  process.stderr.write(message);
11941
11959
  }
11960
+ function resolveGithubCopilotCliExecution(payload) {
11961
+ const args = ["copilot", "prompt", "--prompt", payload.prompt];
11962
+ if (payload.autopilot) {
11963
+ args.push("--autopilot");
11964
+ }
11965
+ if (payload.allowTools && payload.allowTools.length > 0) {
11966
+ args.push("--allow-tools", payload.allowTools.join(","));
11967
+ }
11968
+ if (payload.model) {
11969
+ args.push("--model", payload.model);
11970
+ }
11971
+ if (payload.agent) {
11972
+ args.push("--agent", payload.agent);
11973
+ }
11974
+ args.push("--timeout", String(payload.timeout ?? 0));
11975
+ return {
11976
+ command: "serviceme",
11977
+ args,
11978
+ cwd: payload.workspace,
11979
+ timeoutMs: resolveConfiguredTimeoutMs(payload.timeout, DEFAULT_TIMEOUT_MS2),
11980
+ diagnosticArgs: redactArgs(args),
11981
+ promptLen: payload.prompt.length
11982
+ };
11983
+ }
11942
11984
  var MAX_OUTPUT_BYTES, DEFAULT_TIMEOUT_MS2, GithubCopilotCliExecutor;
11943
11985
  var init_GithubCopilotCliExecutor = __esm({
11944
11986
  "../../packages/serviceme-core/src/scheduled-tasks/executors/GithubCopilotCliExecutor.ts"() {
@@ -11968,7 +12010,7 @@ var init_GithubCopilotCliExecutor = __esm({
11968
12010
  }
11969
12011
  executeStreaming(payload, onOutput, abortSignal) {
11970
12012
  const p = payload;
11971
- const timeoutMs = resolveConfiguredTimeoutMs(p.timeout, DEFAULT_TIMEOUT_MS2);
12013
+ const execution = resolveGithubCopilotCliExecution(p);
11972
12014
  let resolve;
11973
12015
  const resultPromise = new Promise((r) => {
11974
12016
  resolve = r;
@@ -11990,26 +12032,12 @@ var init_GithubCopilotCliExecutor = __esm({
11990
12032
  }
11991
12033
  };
11992
12034
  }
11993
- const args = ["copilot", "prompt", "--prompt", p.prompt];
11994
- if (p.autopilot) {
11995
- args.push("--autopilot");
11996
- }
11997
- if (p.allowTools && p.allowTools.length > 0) {
11998
- args.push("--allow-tools", p.allowTools.join(","));
11999
- }
12000
- if (p.model) {
12001
- args.push("--model", p.model);
12002
- }
12003
- if (p.agent) {
12004
- args.push("--agent", p.agent);
12005
- }
12006
- args.push("--timeout", String(p.timeout ?? 0));
12007
12035
  writeDiagnostic(
12008
- `[GithubCopilotCliExecutor] spawn: command=serviceme, args=${JSON.stringify(redactArgs(args))}, promptLen=${p.prompt.length}, cwd=${p.workspace ?? "(default)"}, platform=${process.platform}, windowsHide=true, pid=${process.pid}
12036
+ `[GithubCopilotCliExecutor] spawn: command=${execution.command}, args=${JSON.stringify(execution.diagnosticArgs)}, promptLen=${execution.promptLen}, cwd=${execution.cwd ?? "(default)"}, platform=${process.platform}, windowsHide=true, pid=${process.pid}
12009
12037
  `
12010
12038
  );
12011
- const child = child_process.spawn("serviceme", args, {
12012
- cwd: p.workspace,
12039
+ const child = child_process.spawn(execution.command, execution.args, {
12040
+ cwd: execution.cwd,
12013
12041
  stdio: ["ignore", "pipe", "pipe"],
12014
12042
  windowsHide: true
12015
12043
  });
@@ -12019,6 +12047,7 @@ var init_GithubCopilotCliExecutor = __esm({
12019
12047
  `
12020
12048
  );
12021
12049
  }
12050
+ const timeoutMs = execution.timeoutMs;
12022
12051
  const timer = timeoutMs != null ? setTimeout(() => {
12023
12052
  child.kill("SIGTERM");
12024
12053
  setTimeout(() => {
@@ -13177,7 +13206,7 @@ init_src();
13177
13206
 
13178
13207
  // src/version.ts
13179
13208
  var SERVICEME_CLI_NAME = "serviceme";
13180
- var SERVICEME_CLI_VERSION = "0.1.4";
13209
+ var SERVICEME_CLI_VERSION = "0.1.5";
13181
13210
 
13182
13211
  // src/bridge/ndjson.ts
13183
13212
  function writeBridgeMessage(message) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serviceme/devtools-cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Unified SERVICEME CLI for automation, project scaffolding, and bridge-based tooling.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "repository": {
@@ -42,8 +42,8 @@
42
42
  "@types/node": "^24",
43
43
  "tsup": "^8.5.1",
44
44
  "typescript": "^5.9.3",
45
- "@serviceme/devtools-core": "0.1.4",
46
- "@serviceme/devtools-protocol": "0.1.4"
45
+ "@serviceme/devtools-protocol": "0.1.5",
46
+ "@serviceme/devtools-core": "0.1.5"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsup --config tsup.config.ts",