thoth-agents 0.2.1 → 0.2.2
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.
|
@@ -546,7 +546,8 @@ function spawn(command, options = {}) {
|
|
|
546
546
|
options.stdin ?? "pipe",
|
|
547
547
|
options.stdout ?? "pipe",
|
|
548
548
|
options.stderr ?? "pipe"
|
|
549
|
-
]
|
|
549
|
+
],
|
|
550
|
+
shell: options.shell
|
|
550
551
|
});
|
|
551
552
|
const managed = {
|
|
552
553
|
stdin: child.stdin ?? fallbackStdin(),
|
|
@@ -577,7 +578,8 @@ function spawnSync(command, options = {}) {
|
|
|
577
578
|
options.stdin ?? "ignore",
|
|
578
579
|
options.stdout ?? "pipe",
|
|
579
580
|
options.stderr ?? "pipe"
|
|
580
|
-
]
|
|
581
|
+
],
|
|
582
|
+
shell: options.shell
|
|
581
583
|
});
|
|
582
584
|
return { exitCode: result.status };
|
|
583
585
|
}
|
|
@@ -585,6 +587,25 @@ function spawnSync(command, options = {}) {
|
|
|
585
587
|
// src/cli/system.ts
|
|
586
588
|
import { statSync } from "fs";
|
|
587
589
|
var cachedOpenCodePath = null;
|
|
590
|
+
function quoteWindowsShellCommand(command) {
|
|
591
|
+
if (!/[\s&()^<>"|]/.test(command)) {
|
|
592
|
+
return command;
|
|
593
|
+
}
|
|
594
|
+
return `"${command.replace(/"/g, '\\"')}"`;
|
|
595
|
+
}
|
|
596
|
+
function getOpenCodeVersionInvocation(opencodePath, platform = process.platform) {
|
|
597
|
+
const options = {
|
|
598
|
+
stdout: "pipe",
|
|
599
|
+
stderr: "pipe"
|
|
600
|
+
};
|
|
601
|
+
if (platform === "win32") {
|
|
602
|
+
return {
|
|
603
|
+
command: [`${quoteWindowsShellCommand(opencodePath)} --version`],
|
|
604
|
+
options: { ...options, shell: true }
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
return { command: [opencodePath, "--version"], options };
|
|
608
|
+
}
|
|
588
609
|
function getOpenCodePaths() {
|
|
589
610
|
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
590
611
|
return [
|
|
@@ -651,10 +672,8 @@ async function isOpenCodeInstalled() {
|
|
|
651
672
|
const paths = getOpenCodePaths();
|
|
652
673
|
for (const opencodePath of paths) {
|
|
653
674
|
try {
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
-
stderr: "pipe"
|
|
657
|
-
});
|
|
675
|
+
const invocation = getOpenCodeVersionInvocation(opencodePath);
|
|
676
|
+
const proc = spawn(invocation.command, invocation.options);
|
|
658
677
|
await proc.exited;
|
|
659
678
|
if (proc.exitCode === 0) {
|
|
660
679
|
cachedOpenCodePath = opencodePath;
|
|
@@ -668,10 +687,8 @@ async function isOpenCodeInstalled() {
|
|
|
668
687
|
async function getOpenCodeVersion() {
|
|
669
688
|
const opencodePath = resolveOpenCodePath();
|
|
670
689
|
try {
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
stderr: "pipe"
|
|
674
|
-
});
|
|
690
|
+
const invocation = getOpenCodeVersionInvocation(opencodePath);
|
|
691
|
+
const proc = spawn(invocation.command, invocation.options);
|
|
675
692
|
const output = await new Response(proc.stdout).text();
|
|
676
693
|
await proc.exited;
|
|
677
694
|
if (proc.exitCode === 0) {
|
package/dist/cli/index.js
CHANGED
package/dist/cli/system.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
type OpenCodeVersionInvocation = {
|
|
2
|
+
command: string[];
|
|
3
|
+
options: {
|
|
4
|
+
stdout: 'pipe';
|
|
5
|
+
stderr: 'pipe';
|
|
6
|
+
shell?: boolean;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare function getOpenCodeVersionInvocation(opencodePath: string, platform?: typeof process.platform): OpenCodeVersionInvocation;
|
|
1
10
|
export declare function resolveOpenCodePath(): string;
|
|
2
11
|
export declare function isOpenCodeInstalled(): Promise<boolean>;
|
|
3
12
|
export declare function isTmuxInstalled(): Promise<boolean>;
|
|
4
13
|
export declare function getOpenCodeVersion(): Promise<string | null>;
|
|
5
14
|
export declare function getOpenCodePath(): string | null;
|
|
6
15
|
export declare function fetchLatestVersion(packageName: string): Promise<string | null>;
|
|
16
|
+
export {};
|
package/dist/index.js
CHANGED
package/package.json
CHANGED