octo-dev 0.4.0 → 0.4.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.
- package/package.json +3 -2
- package/src/cli/index.ts +1 -1
- package/src/hooks/hook-runner.ts +1 -1
- package/src/shared/ollama.ts +2 -1
- package/src/shared/process-runner.ts +30 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "octo-dev",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "CLI for monorepo build orchestration, semantic versioning, and local infrastructure management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"commander": "^13.1.0",
|
|
47
|
+
"execa": "^9.6.1",
|
|
47
48
|
"ollama": "^0.5.16",
|
|
48
49
|
"semver": "^7.7.2",
|
|
49
50
|
"tsx": "^4.19.4",
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
"@types/semver": "^7.7.0",
|
|
56
57
|
"fast-check": "^4.1.1",
|
|
57
58
|
"typescript": "^5.8.3",
|
|
58
|
-
"vitest": "^
|
|
59
|
+
"vitest": "^4.1.8"
|
|
59
60
|
},
|
|
60
61
|
"engines": {
|
|
61
62
|
"node": ">=25.0.0"
|
package/src/cli/index.ts
CHANGED
package/src/hooks/hook-runner.ts
CHANGED
|
@@ -29,7 +29,7 @@ export async function runHooks(trigger: HookTrigger, context: HookContext): Prom
|
|
|
29
29
|
logger.info(`Running hook "${hook.name}" (${trigger})...`);
|
|
30
30
|
const start = Date.now();
|
|
31
31
|
|
|
32
|
-
const result = await run(hook.command, [], { cwd: context.workingDir });
|
|
32
|
+
const result = await run(hook.command, [], { cwd: context.workingDir, shell: true });
|
|
33
33
|
const durationMs = Date.now() - start;
|
|
34
34
|
const output = (result.stdout + result.stderr).trim() || undefined;
|
|
35
35
|
|
package/src/shared/ollama.ts
CHANGED
|
@@ -24,9 +24,10 @@ async function hasModel(model: string): Promise<boolean> {
|
|
|
24
24
|
*/
|
|
25
25
|
async function install(): Promise<boolean> {
|
|
26
26
|
logger.info('Instalando Ollama...');
|
|
27
|
-
const result = await run('curl
|
|
27
|
+
const result = await run('curl -fsSL https://ollama.com/install.sh | sh', [], {
|
|
28
28
|
timeout: 120_000,
|
|
29
29
|
interactive: true,
|
|
30
|
+
shell: true,
|
|
30
31
|
});
|
|
31
32
|
return result.exitCode === 0;
|
|
32
33
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { execaCommand, execa } from 'execa';
|
|
2
2
|
|
|
3
3
|
export interface RunOptions {
|
|
4
4
|
cwd?: string;
|
|
@@ -6,6 +6,8 @@ export interface RunOptions {
|
|
|
6
6
|
env?: Record<string, string>;
|
|
7
7
|
/** When true, inherits stdio so the user can interact (e.g. git password prompts) */
|
|
8
8
|
interactive?: boolean;
|
|
9
|
+
/** When true, runs command through the system shell. Use only for piped/complex commands. */
|
|
10
|
+
shell?: boolean;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export interface RunResult {
|
|
@@ -14,39 +16,31 @@ export interface RunResult {
|
|
|
14
16
|
exitCode: number;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
resolve({ stdout, stderr, exitCode: code ?? 1 });
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
child.on('error', (err) => {
|
|
48
|
-
clearTimeout(timer);
|
|
49
|
-
reject(err);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
19
|
+
/**
|
|
20
|
+
* Executes a command with args. Powered by execa.
|
|
21
|
+
* Returns stdout, stderr, and exitCode without throwing on non-zero exit.
|
|
22
|
+
*/
|
|
23
|
+
export async function run(command: string, args: string[] = [], options: RunOptions = {}): Promise<RunResult> {
|
|
24
|
+
const { cwd, timeout = 60_000, env, interactive = false, shell = false } = options;
|
|
25
|
+
|
|
26
|
+
const execOptions = {
|
|
27
|
+
cwd,
|
|
28
|
+
env: env ? { ...process.env, ...env } : undefined,
|
|
29
|
+
timeout,
|
|
30
|
+
shell,
|
|
31
|
+
reject: false,
|
|
32
|
+
stdin: interactive ? 'inherit' as const : undefined,
|
|
33
|
+
stdout: interactive ? 'inherit' as const : 'pipe' as const,
|
|
34
|
+
stderr: interactive ? 'inherit' as const : 'pipe' as const,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const result = shell && args.length === 0
|
|
38
|
+
? await execaCommand(command, execOptions)
|
|
39
|
+
: await execa(command, args, execOptions);
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
stdout: result.stdout ?? '',
|
|
43
|
+
stderr: result.stderr ?? '',
|
|
44
|
+
exitCode: result.exitCode ?? 1,
|
|
45
|
+
};
|
|
52
46
|
}
|