@ricsam/r5d-worker 0.0.21 → 0.0.23

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.
package/dist/cjs/main.cjs CHANGED
@@ -33,6 +33,7 @@ __export(main_exports, {
33
33
  isArtifactEnvPath: () => isArtifactEnvPath,
34
34
  prepareArtifactEnvForShell: () => prepareArtifactEnvForShell,
35
35
  preparePlanEnvForShell: () => preparePlanEnvForShell,
36
+ resolveHostShell: () => resolveHostShell,
36
37
  resolveProjectFilePath: () => resolveProjectFilePath,
37
38
  syncProjectPlans: () => syncProjectPlans,
38
39
  syncSessionArtifacts: () => syncSessionArtifacts
@@ -2007,11 +2008,16 @@ function createNodePtyBridge(options) {
2007
2008
  }
2008
2009
  };
2009
2010
  }
2010
- function resolveHostShell() {
2011
- if (process.platform === "win32") {
2012
- return { file: process.env.COMSPEC || "powershell.exe", args: [] };
2011
+ function resolveHostShell(command, platform = process.platform) {
2012
+ if (platform === "win32") {
2013
+ const file2 = process.env.COMSPEC || "powershell.exe";
2014
+ if (command === void 0) {
2015
+ return { file: file2, args: [] };
2016
+ }
2017
+ return /(?:^|[\\/])cmd\.exe$/i.test(file2) ? { file: file2, args: ["/d", "/s", "/c", command] } : { file: file2, args: ["-Command", command] };
2013
2018
  }
2014
- return { file: process.env.SHELL || "/bin/bash", args: ["-l"] };
2019
+ const file = process.env.SHELL || "/bin/bash";
2020
+ return { file, args: command === void 0 ? ["-l"] : ["-lc", command] };
2015
2021
  }
2016
2022
  async function openPty(input) {
2017
2023
  try {
@@ -2032,7 +2038,7 @@ async function openPty(input) {
2032
2038
  planRoot: input.planRoot,
2033
2039
  activePlanId: input.message.env?.R5D_ACTIVE_PLAN_ID
2034
2040
  });
2035
- const shell = resolveHostShell();
2041
+ const shell = resolveHostShell(input.message.command);
2036
2042
  const ptyProcess = createNodePtyBridge({
2037
2043
  file: shell.file,
2038
2044
  args: shell.args,
@@ -2478,6 +2484,7 @@ if (isCliEntrypoint()) {
2478
2484
  isArtifactEnvPath,
2479
2485
  prepareArtifactEnvForShell,
2480
2486
  preparePlanEnvForShell,
2487
+ resolveHostShell,
2481
2488
  resolveProjectFilePath,
2482
2489
  syncProjectPlans,
2483
2490
  syncSessionArtifacts
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "type": "commonjs"
5
5
  }
package/dist/mjs/main.mjs CHANGED
@@ -1967,11 +1967,16 @@ function createNodePtyBridge(options) {
1967
1967
  }
1968
1968
  };
1969
1969
  }
1970
- function resolveHostShell() {
1971
- if (process.platform === "win32") {
1972
- return { file: process.env.COMSPEC || "powershell.exe", args: [] };
1970
+ function resolveHostShell(command, platform = process.platform) {
1971
+ if (platform === "win32") {
1972
+ const file2 = process.env.COMSPEC || "powershell.exe";
1973
+ if (command === void 0) {
1974
+ return { file: file2, args: [] };
1975
+ }
1976
+ return /(?:^|[\\/])cmd\.exe$/i.test(file2) ? { file: file2, args: ["/d", "/s", "/c", command] } : { file: file2, args: ["-Command", command] };
1973
1977
  }
1974
- return { file: process.env.SHELL || "/bin/bash", args: ["-l"] };
1978
+ const file = process.env.SHELL || "/bin/bash";
1979
+ return { file, args: command === void 0 ? ["-l"] : ["-lc", command] };
1975
1980
  }
1976
1981
  async function openPty(input) {
1977
1982
  try {
@@ -1992,7 +1997,7 @@ async function openPty(input) {
1992
1997
  planRoot: input.planRoot,
1993
1998
  activePlanId: input.message.env?.R5D_ACTIVE_PLAN_ID
1994
1999
  });
1995
- const shell = resolveHostShell();
2000
+ const shell = resolveHostShell(input.message.command);
1996
2001
  const ptyProcess = createNodePtyBridge({
1997
2002
  file: shell.file,
1998
2003
  args: shell.args,
@@ -2437,6 +2442,7 @@ export {
2437
2442
  isArtifactEnvPath,
2438
2443
  prepareArtifactEnvForShell,
2439
2444
  preparePlanEnvForShell,
2445
+ resolveHostShell,
2440
2446
  resolveProjectFilePath,
2441
2447
  syncProjectPlans,
2442
2448
  syncSessionArtifacts
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "type": "module"
5
5
  }
@@ -48,4 +48,8 @@ export declare function ensureVisibleGitCheckout(input: {
48
48
  githubAuthHeader?: string | null;
49
49
  defaultBranch: string;
50
50
  }): string;
51
+ export declare function resolveHostShell(command?: string, platform?: NodeJS.Platform): {
52
+ file: string;
53
+ args: string[];
54
+ };
51
55
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/main.cjs",
6
6
  "module": "./dist/mjs/main.mjs",