octo-dev 0.4.2 → 0.4.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.
- package/package.json +1 -1
- package/src/cli/index.ts +1 -1
- package/src/shared/ollama.ts +19 -0
package/package.json
CHANGED
package/src/cli/index.ts
CHANGED
package/src/shared/ollama.ts
CHANGED
|
@@ -19,10 +19,29 @@ async function hasModel(model: string): Promise<boolean> {
|
|
|
19
19
|
return result.stdout.includes(model);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Ensures a system dependency is available, installing it if the user agrees.
|
|
24
|
+
*/
|
|
25
|
+
async function ensureDependency(command: string, installCmd: string, name: string): Promise<boolean> {
|
|
26
|
+
const check = await run('which', [command], { timeout: 5_000 });
|
|
27
|
+
if (check.exitCode === 0) return true;
|
|
28
|
+
|
|
29
|
+
const shouldInstall = await confirm(`${name} não encontrado (necessário para Ollama). Instalar? (s/n) `);
|
|
30
|
+
if (!shouldInstall) return false;
|
|
31
|
+
|
|
32
|
+
const result = await run('sudo', installCmd.split(' '), { timeout: 60_000, interactive: true });
|
|
33
|
+
return result.exitCode === 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
22
36
|
/**
|
|
23
37
|
* Installs Ollama via the official install script.
|
|
24
38
|
*/
|
|
25
39
|
async function install(): Promise<boolean> {
|
|
40
|
+
// Ollama requires zstd for extraction
|
|
41
|
+
if (!await ensureDependency('zstd', 'apt-get install -y zstd', 'zstd')) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
|
|
26
45
|
logger.info('Instalando Ollama...');
|
|
27
46
|
const result = await run('curl -fsSL https://ollama.com/install.sh | sh', [], {
|
|
28
47
|
timeout: 120_000,
|