codemaxxing 0.4.8 → 0.4.10

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/index.js CHANGED
@@ -1465,16 +1465,15 @@ function App() {
1465
1465
  if (key.return) {
1466
1466
  // Auto-install Ollama if not present
1467
1467
  if (!isOllamaInstalled()) {
1468
- setWizardPullProgress({ status: "Installing Ollama...", percent: 0 });
1469
- setWizardScreen("pulling");
1468
+ setLoading(true);
1469
+ setSpinnerMsg("Installing Ollama... this may take a minute");
1470
1470
  // Run install async so the UI can update
1471
1471
  const installCmd = getOllamaInstallCommand(wizardHardware?.os ?? "linux");
1472
1472
  (async () => {
1473
1473
  try {
1474
- const { execFile } = _require("child_process");
1475
- const parts = installCmd.split(" ");
1474
+ const { exec } = _require("child_process");
1476
1475
  await new Promise((resolve, reject) => {
1477
- execFile(parts[0], parts.slice(1), { shell: true, timeout: 180000 }, (err, _stdout, stderr) => {
1476
+ exec(installCmd, { timeout: 180000 }, (err, _stdout, stderr) => {
1478
1477
  if (err)
1479
1478
  reject(new Error(stderr || err.message));
1480
1479
  else
@@ -1482,17 +1481,17 @@ function App() {
1482
1481
  });
1483
1482
  });
1484
1483
  addMsg("info", "✅ Ollama installed! Proceeding to model download...");
1484
+ setLoading(false);
1485
1485
  // Small delay for PATH to update on Windows
1486
1486
  await new Promise(r => setTimeout(r, 2000));
1487
1487
  // Go back to models screen so user can pick and it'll proceed to pull
1488
1488
  setWizardScreen("models");
1489
- setWizardPullProgress(null);
1490
1489
  }
1491
1490
  catch (e) {
1492
1491
  addMsg("error", `Install failed: ${e.message}`);
1493
1492
  addMsg("info", `Try manually in a separate terminal: ${installCmd}`);
1493
+ setLoading(false);
1494
1494
  setWizardScreen("install-ollama");
1495
- setWizardPullProgress(null);
1496
1495
  }
1497
1496
  })();
1498
1497
  return;
@@ -1,4 +1,4 @@
1
- /** Check if ollama binary exists on PATH */
1
+ /** Check if ollama binary exists on PATH, known install locations, or server is running */
2
2
  export declare function isOllamaInstalled(): boolean;
3
3
  /** Check if ollama server is responding */
4
4
  export declare function isOllamaRunning(): Promise<boolean>;
@@ -1,14 +1,52 @@
1
1
  import { execSync, spawn } from "child_process";
2
- /** Check if ollama binary exists on PATH */
2
+ import { existsSync } from "fs";
3
+ import { join } from "path";
4
+ /** Get known Ollama binary paths for Windows */
5
+ function getWindowsOllamaPaths() {
6
+ const paths = [];
7
+ const localAppData = process.env.LOCALAPPDATA || join(process.env.USERPROFILE || "", "AppData", "Local");
8
+ const programFiles = process.env.ProgramFiles || "C:\\Program Files";
9
+ paths.push(join(localAppData, "Programs", "Ollama", "ollama.exe"));
10
+ paths.push(join(programFiles, "Ollama", "ollama.exe"));
11
+ paths.push(join(localAppData, "Ollama", "ollama.exe"));
12
+ return paths;
13
+ }
14
+ /** Check if ollama binary exists on PATH, known install locations, or server is running */
3
15
  export function isOllamaInstalled() {
16
+ // Check PATH first
4
17
  try {
5
18
  const cmd = process.platform === "win32" ? "where ollama" : "which ollama";
6
19
  execSync(cmd, { stdio: ["pipe", "pipe", "pipe"], timeout: 3000 });
7
20
  return true;
8
21
  }
9
- catch {
10
- return false;
22
+ catch { }
23
+ // Check known install paths on Windows
24
+ if (process.platform === "win32") {
25
+ if (getWindowsOllamaPaths().some(p => existsSync(p)))
26
+ return true;
27
+ }
28
+ // Check if the server is responding (if server is running, Ollama is definitely installed)
29
+ try {
30
+ execSync("curl -s http://localhost:11434/api/tags", {
31
+ stdio: ["pipe", "pipe", "pipe"],
32
+ timeout: 3000,
33
+ });
34
+ return true;
35
+ }
36
+ catch { }
37
+ // Check if ollama process is running (Windows)
38
+ if (process.platform === "win32") {
39
+ try {
40
+ const result = execSync("tasklist /fi \"imagename eq ollama app.exe\" /fo csv /nh", {
41
+ stdio: ["pipe", "pipe", "pipe"],
42
+ timeout: 3000,
43
+ });
44
+ if (result.toString().toLowerCase().includes("ollama"))
45
+ return true;
46
+ }
47
+ catch { }
11
48
  }
49
+ return false;
12
50
  }
13
51
  /** Check if ollama server is responding */
14
52
  export async function isOllamaRunning() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemaxxing",
3
- "version": "0.4.8",
3
+ "version": "0.4.10",
4
4
  "description": "Open-source terminal coding agent. Connect any LLM. Max your code.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/src/index.tsx CHANGED
@@ -1489,32 +1489,31 @@ function App() {
1489
1489
  if (key.return) {
1490
1490
  // Auto-install Ollama if not present
1491
1491
  if (!isOllamaInstalled()) {
1492
- setWizardPullProgress({ status: "Installing Ollama...", percent: 0 });
1493
- setWizardScreen("pulling");
1492
+ setLoading(true);
1493
+ setSpinnerMsg("Installing Ollama... this may take a minute");
1494
1494
 
1495
1495
  // Run install async so the UI can update
1496
1496
  const installCmd = getOllamaInstallCommand(wizardHardware?.os ?? "linux");
1497
1497
  (async () => {
1498
1498
  try {
1499
- const { execFile } = _require("child_process");
1500
- const parts = installCmd.split(" ");
1499
+ const { exec } = _require("child_process");
1501
1500
  await new Promise<void>((resolve, reject) => {
1502
- execFile(parts[0], parts.slice(1), { shell: true, timeout: 180000 }, (err: any, _stdout: string, stderr: string) => {
1501
+ exec(installCmd, { timeout: 180000 }, (err: any, _stdout: string, stderr: string) => {
1503
1502
  if (err) reject(new Error(stderr || err.message));
1504
1503
  else resolve();
1505
1504
  });
1506
1505
  });
1507
1506
  addMsg("info", "✅ Ollama installed! Proceeding to model download...");
1507
+ setLoading(false);
1508
1508
  // Small delay for PATH to update on Windows
1509
1509
  await new Promise(r => setTimeout(r, 2000));
1510
1510
  // Go back to models screen so user can pick and it'll proceed to pull
1511
1511
  setWizardScreen("models");
1512
- setWizardPullProgress(null);
1513
1512
  } catch (e: any) {
1514
1513
  addMsg("error", `Install failed: ${e.message}`);
1515
1514
  addMsg("info", `Try manually in a separate terminal: ${installCmd}`);
1515
+ setLoading(false);
1516
1516
  setWizardScreen("install-ollama");
1517
- setWizardPullProgress(null);
1518
1517
  }
1519
1518
  })();
1520
1519
  return;
@@ -1,14 +1,53 @@
1
1
  import { execSync, spawn } from "child_process";
2
+ import { existsSync } from "fs";
3
+ import { join } from "path";
2
4
 
3
- /** Check if ollama binary exists on PATH */
5
+ /** Get known Ollama binary paths for Windows */
6
+ function getWindowsOllamaPaths(): string[] {
7
+ const paths: string[] = [];
8
+ const localAppData = process.env.LOCALAPPDATA || join(process.env.USERPROFILE || "", "AppData", "Local");
9
+ const programFiles = process.env.ProgramFiles || "C:\\Program Files";
10
+ paths.push(join(localAppData, "Programs", "Ollama", "ollama.exe"));
11
+ paths.push(join(programFiles, "Ollama", "ollama.exe"));
12
+ paths.push(join(localAppData, "Ollama", "ollama.exe"));
13
+ return paths;
14
+ }
15
+
16
+ /** Check if ollama binary exists on PATH, known install locations, or server is running */
4
17
  export function isOllamaInstalled(): boolean {
18
+ // Check PATH first
5
19
  try {
6
20
  const cmd = process.platform === "win32" ? "where ollama" : "which ollama";
7
21
  execSync(cmd, { stdio: ["pipe", "pipe", "pipe"], timeout: 3000 });
8
22
  return true;
9
- } catch {
10
- return false;
23
+ } catch {}
24
+
25
+ // Check known install paths on Windows
26
+ if (process.platform === "win32") {
27
+ if (getWindowsOllamaPaths().some(p => existsSync(p))) return true;
28
+ }
29
+
30
+ // Check if the server is responding (if server is running, Ollama is definitely installed)
31
+ try {
32
+ execSync("curl -s http://localhost:11434/api/tags", {
33
+ stdio: ["pipe", "pipe", "pipe"],
34
+ timeout: 3000,
35
+ });
36
+ return true;
37
+ } catch {}
38
+
39
+ // Check if ollama process is running (Windows)
40
+ if (process.platform === "win32") {
41
+ try {
42
+ const result = execSync("tasklist /fi \"imagename eq ollama app.exe\" /fo csv /nh", {
43
+ stdio: ["pipe", "pipe", "pipe"],
44
+ timeout: 3000,
45
+ });
46
+ if (result.toString().toLowerCase().includes("ollama")) return true;
47
+ } catch {}
11
48
  }
49
+
50
+ return false;
12
51
  }
13
52
 
14
53
  /** Check if ollama server is responding */