@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/index.js CHANGED
@@ -488,7 +488,10 @@ async function getChangedFiles(cwd, config, options) {
488
488
  };
489
489
  if (existsSync(cachePath)) {
490
490
  try {
491
- cachedState = JSON.parse(readFileSync(cachePath, "utf-8"));
491
+ const parsed = JSON.parse(readFileSync(cachePath, "utf-8"));
492
+ if (Array.isArray(parsed.fileHashes)) {
493
+ cachedState = parsed;
494
+ }
492
495
  } catch {
493
496
  }
494
497
  }
@@ -802,13 +805,56 @@ var AiderExecutor = class {
802
805
  }
803
806
  }
804
807
  };
808
+ var OLLAMA_TIMEOUT = 6e5;
809
+ var DEFAULT_MODEL = "codellama";
810
+ var OllamaExecutor = class {
811
+ name = "ollama";
812
+ model;
813
+ constructor(model = DEFAULT_MODEL) {
814
+ this.model = model;
815
+ }
816
+ async isAvailable() {
817
+ return isProviderAvailable("ollama");
818
+ }
819
+ async runPrompt(prompt, options) {
820
+ const ollamaCommand = getProviderCommand("ollama");
821
+ try {
822
+ const { stdout, stderr } = await execa(
823
+ ollamaCommand,
824
+ ["run", this.model, prompt],
825
+ {
826
+ cwd: options.cwd,
827
+ timeout: options.timeout || OLLAMA_TIMEOUT,
828
+ env: {
829
+ ...process.env,
830
+ NO_COLOR: "1"
831
+ },
832
+ reject: false
833
+ }
834
+ );
835
+ return {
836
+ output: stdout || "",
837
+ error: stderr || void 0
838
+ };
839
+ } catch (error) {
840
+ if (error.message?.includes("ENOENT")) {
841
+ throw new Error("Ollama not found. Install from: https://ollama.ai");
842
+ }
843
+ if (error.message?.includes("model") && error.message?.includes("not found")) {
844
+ throw new Error(`Ollama model '${this.model}' not found. Run: ollama pull ${this.model}`);
845
+ }
846
+ throw error;
847
+ }
848
+ }
849
+ };
805
850
 
806
851
  // src/providers/executors/index.ts
807
852
  var executors = {
808
853
  "claude-code": () => new ClaudeCodeExecutor(),
809
854
  "codex": () => new CodexExecutor(),
810
855
  "gemini": () => new GeminiExecutor(),
811
- "aider": () => new AiderExecutor()
856
+ "aider": () => new AiderExecutor(),
857
+ "ollama": () => new OllamaExecutor()
812
858
  };
813
859
  function getExecutor(name) {
814
860
  const factory = executors[name];
@@ -3682,7 +3728,7 @@ async function createFixBranch(branchName, bug, cwd = process.cwd()) {
3682
3728
  }
3683
3729
  async function commitFix(bug, cwd = process.cwd()) {
3684
3730
  try {
3685
- await execa("git", ["add", bug.file], { cwd, timeout: GIT_TIMEOUT });
3731
+ await execa("git", ["add", "--", bug.file], { cwd, timeout: GIT_TIMEOUT });
3686
3732
  const { stdout: diff } = await execa("git", ["diff", "--cached", "--name-only"], {
3687
3733
  cwd,
3688
3734
  timeout: GIT_TIMEOUT