@sureshsankaran/ralph-wiggum 0.1.5 → 0.1.6

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,14 @@
1
- import { existsSync, readFileSync, writeFileSync, unlinkSync } from "node:fs";
1
+ import { existsSync, readFileSync, writeFileSync, unlinkSync, mkdirSync } from "node:fs";
2
2
  import { join } from "node:path";
3
- const STATE_FILE = ".opencode/ralph-loop.local.md";
3
+ import { homedir } from "node:os";
4
+ // Use a global state directory that won't be affected by project snapshot/revert
5
+ function getStateFilePath() {
6
+ const configDir = process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
7
+ const stateDir = join(configDir, "opencode", "state");
8
+ // Ensure directory exists
9
+ mkdirSync(stateDir, { recursive: true });
10
+ return join(stateDir, "ralph-loop.local.md");
11
+ }
4
12
  function parseState(content) {
5
13
  const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
6
14
  if (!frontmatterMatch)
@@ -56,7 +64,7 @@ function extractPromiseText(text) {
56
64
  * The AI should output <promise>DONE</promise> when the task is complete.
57
65
  */
58
66
  export const RalphWiggumPlugin = async ({ client, directory }) => {
59
- const stateFilePath = join(directory, STATE_FILE);
67
+ const stateFilePath = getStateFilePath();
60
68
  // In-memory state to prevent race conditions
61
69
  // These are scoped to this plugin instance
62
70
  let completionDetected = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sureshsankaran/ralph-wiggum",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Ralph Wiggum iterative AI development plugin for OpenCode - continuously loops the same prompt until task completion",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",