@shakecodeslikecray/whiterose 1.0.0 → 1.0.1

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/cli/index.js CHANGED
@@ -467,13 +467,56 @@ var AiderExecutor = class {
467
467
  }
468
468
  }
469
469
  };
470
+ var OLLAMA_TIMEOUT = 6e5;
471
+ var DEFAULT_MODEL = "codellama";
472
+ var OllamaExecutor = class {
473
+ name = "ollama";
474
+ model;
475
+ constructor(model = DEFAULT_MODEL) {
476
+ this.model = model;
477
+ }
478
+ async isAvailable() {
479
+ return isProviderAvailable("ollama");
480
+ }
481
+ async runPrompt(prompt, options) {
482
+ const ollamaCommand = getProviderCommand("ollama");
483
+ try {
484
+ const { stdout, stderr } = await execa(
485
+ ollamaCommand,
486
+ ["run", this.model, prompt],
487
+ {
488
+ cwd: options.cwd,
489
+ timeout: options.timeout || OLLAMA_TIMEOUT,
490
+ env: {
491
+ ...process.env,
492
+ NO_COLOR: "1"
493
+ },
494
+ reject: false
495
+ }
496
+ );
497
+ return {
498
+ output: stdout || "",
499
+ error: stderr || void 0
500
+ };
501
+ } catch (error) {
502
+ if (error.message?.includes("ENOENT")) {
503
+ throw new Error("Ollama not found. Install from: https://ollama.ai");
504
+ }
505
+ if (error.message?.includes("model") && error.message?.includes("not found")) {
506
+ throw new Error(`Ollama model '${this.model}' not found. Run: ollama pull ${this.model}`);
507
+ }
508
+ throw error;
509
+ }
510
+ }
511
+ };
470
512
 
471
513
  // src/providers/executors/index.ts
472
514
  var executors = {
473
515
  "claude-code": () => new ClaudeCodeExecutor(),
474
516
  "codex": () => new CodexExecutor(),
475
517
  "gemini": () => new GeminiExecutor(),
476
- "aider": () => new AiderExecutor()
518
+ "aider": () => new AiderExecutor(),
519
+ "ollama": () => new OllamaExecutor()
477
520
  };
478
521
  function getExecutor(name) {
479
522
  const factory = executors[name];
@@ -2658,7 +2701,10 @@ async function getChangedFiles(cwd, config, options) {
2658
2701
  };
2659
2702
  if (existsSync(cachePath)) {
2660
2703
  try {
2661
- cachedState = JSON.parse(readFileSync(cachePath, "utf-8"));
2704
+ const parsed = JSON.parse(readFileSync(cachePath, "utf-8"));
2705
+ if (Array.isArray(parsed.fileHashes)) {
2706
+ cachedState = parsed;
2707
+ }
2662
2708
  } catch {
2663
2709
  }
2664
2710
  }
@@ -6092,7 +6138,7 @@ async function createFixBranch(branchName, bug, cwd = process.cwd()) {
6092
6138
  }
6093
6139
  async function commitFix(bug, cwd = process.cwd()) {
6094
6140
  try {
6095
- await execa("git", ["add", bug.file], { cwd, timeout: GIT_TIMEOUT });
6141
+ await execa("git", ["add", "--", bug.file], { cwd, timeout: GIT_TIMEOUT });
6096
6142
  const { stdout: diff } = await execa("git", ["diff", "--cached", "--name-only"], {
6097
6143
  cwd,
6098
6144
  timeout: GIT_TIMEOUT
@@ -6505,9 +6551,7 @@ async function startFixTUI(bugs, config, options, cwd) {
6505
6551
  }
6506
6552
  )
6507
6553
  );
6508
- waitUntilExit().then(() => {
6509
- resolve6();
6510
- });
6554
+ waitUntilExit().then(resolve6).catch(reject);
6511
6555
  });
6512
6556
  }
6513
6557