@neriros/ralphy 0.1.0 → 0.2.0
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 +80 -56
- package/package.json +18 -18
package/dist/cli/index.js
CHANGED
|
@@ -38382,8 +38382,8 @@ var require_cjs = __commonJS((exports, module) => {
|
|
|
38382
38382
|
});
|
|
38383
38383
|
|
|
38384
38384
|
// apps/cli/src/index.ts
|
|
38385
|
-
import { resolve as resolve3, join as
|
|
38386
|
-
import { existsSync as
|
|
38385
|
+
import { resolve as resolve3, join as join14 } from "path";
|
|
38386
|
+
import { existsSync as existsSync7 } from "fs";
|
|
38387
38387
|
|
|
38388
38388
|
// node_modules/.bun/ink@5.2.1+1f88f629f0141b18/node_modules/ink/build/render.js
|
|
38389
38389
|
import { Stream } from "stream";
|
|
@@ -43760,7 +43760,7 @@ var import_react58 = __toESM(require_react(), 1);
|
|
|
43760
43760
|
|
|
43761
43761
|
// apps/cli/src/cli.ts
|
|
43762
43762
|
import { readFileSync as readFileSync2 } from "fs";
|
|
43763
|
-
var VALID_MODES = new Set(["task", "list", "status", "advance", "set-phase"]);
|
|
43763
|
+
var VALID_MODES = new Set(["task", "list", "status", "advance", "set-phase", "init"]);
|
|
43764
43764
|
var VALID_MODELS = new Set(["haiku", "sonnet", "opus"]);
|
|
43765
43765
|
function parseArgs(argv) {
|
|
43766
43766
|
const result2 = {
|
|
@@ -44137,13 +44137,29 @@ function scaffoldTasksDir(tasksDir) {
|
|
|
44137
44137
|
}
|
|
44138
44138
|
}
|
|
44139
44139
|
|
|
44140
|
+
// packages/core/src/init.ts
|
|
44141
|
+
import { mkdirSync as mkdirSync2, existsSync as existsSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
44142
|
+
import { join as join3, dirname as dirname3 } from "path";
|
|
44143
|
+
var GITIGNORE_CONTENT = `tasks/
|
|
44144
|
+
`;
|
|
44145
|
+
function initRalph(ralphDir) {
|
|
44146
|
+
mkdirSync2(join3(ralphDir, "tasks"), { recursive: true });
|
|
44147
|
+
const gitignorePath = join3(ralphDir, ".gitignore");
|
|
44148
|
+
if (!existsSync4(gitignorePath)) {
|
|
44149
|
+
writeFileSync2(gitignorePath, GITIGNORE_CONTENT);
|
|
44150
|
+
}
|
|
44151
|
+
}
|
|
44152
|
+
function initRalphFromTasksDir(tasksDir) {
|
|
44153
|
+
initRalph(dirname3(tasksDir));
|
|
44154
|
+
}
|
|
44155
|
+
|
|
44140
44156
|
// apps/cli/src/components/App.tsx
|
|
44141
44157
|
var import_react57 = __toESM(require_react(), 1);
|
|
44142
|
-
import { join as
|
|
44143
|
-
import { existsSync as
|
|
44158
|
+
import { join as join13 } from "path";
|
|
44159
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync3 } from "fs";
|
|
44144
44160
|
|
|
44145
44161
|
// packages/core/src/state.ts
|
|
44146
|
-
import { join as
|
|
44162
|
+
import { join as join4 } from "path";
|
|
44147
44163
|
import { execSync } from "child_process";
|
|
44148
44164
|
|
|
44149
44165
|
// node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
|
|
@@ -48252,14 +48268,14 @@ function formatTaskName(name) {
|
|
|
48252
48268
|
// packages/core/src/state.ts
|
|
48253
48269
|
var STATE_FILE = "state.json";
|
|
48254
48270
|
function readState(taskDir) {
|
|
48255
|
-
const filePath =
|
|
48271
|
+
const filePath = join4(taskDir, STATE_FILE);
|
|
48256
48272
|
const raw = getStorage().read(filePath);
|
|
48257
48273
|
if (raw === null)
|
|
48258
48274
|
throw new Error(`state.json not found in ${taskDir}`);
|
|
48259
48275
|
return StateSchema.parse(JSON.parse(raw));
|
|
48260
48276
|
}
|
|
48261
48277
|
function writeState(taskDir, state) {
|
|
48262
|
-
const filePath =
|
|
48278
|
+
const filePath = join4(taskDir, STATE_FILE);
|
|
48263
48279
|
getStorage().write(filePath, JSON.stringify(state, null, 2) + `
|
|
48264
48280
|
`);
|
|
48265
48281
|
}
|
|
@@ -48288,10 +48304,10 @@ function buildInitialState(opts) {
|
|
|
48288
48304
|
}
|
|
48289
48305
|
function inferPhaseFromFiles(taskDir) {
|
|
48290
48306
|
const storage = getStorage();
|
|
48291
|
-
if (storage.read(
|
|
48307
|
+
if (storage.read(join4(taskDir, "RESEARCH.md")) === null)
|
|
48292
48308
|
return getFirstPhase().name;
|
|
48293
|
-
const plan = storage.read(
|
|
48294
|
-
const progress = storage.read(
|
|
48309
|
+
const plan = storage.read(join4(taskDir, "PLAN.md"));
|
|
48310
|
+
const progress = storage.read(join4(taskDir, "PROGRESS.md"));
|
|
48295
48311
|
if (plan === null || progress === null)
|
|
48296
48312
|
return "plan";
|
|
48297
48313
|
const unchecked = (progress.match(/^- \[ \]/gm) ?? []).length;
|
|
@@ -48305,12 +48321,12 @@ function migrateState(taskDir) {
|
|
|
48305
48321
|
return state;
|
|
48306
48322
|
}
|
|
48307
48323
|
function ensureState(taskDir) {
|
|
48308
|
-
const filePath =
|
|
48324
|
+
const filePath = join4(taskDir, STATE_FILE);
|
|
48309
48325
|
const storage = getStorage();
|
|
48310
48326
|
if (storage.read(filePath) !== null) {
|
|
48311
48327
|
return readState(taskDir);
|
|
48312
48328
|
}
|
|
48313
|
-
const hasFiles = storage.read(
|
|
48329
|
+
const hasFiles = storage.read(join4(taskDir, "RESEARCH.md")) !== null || storage.read(join4(taskDir, "PLAN.md")) !== null || storage.read(join4(taskDir, "PROGRESS.md")) !== null;
|
|
48314
48330
|
if (hasFiles) {
|
|
48315
48331
|
return migrateState(taskDir);
|
|
48316
48332
|
}
|
|
@@ -48321,7 +48337,7 @@ function ensureState(taskDir) {
|
|
|
48321
48337
|
}
|
|
48322
48338
|
|
|
48323
48339
|
// packages/core/src/phases.ts
|
|
48324
|
-
import { join as
|
|
48340
|
+
import { join as join5 } from "path";
|
|
48325
48341
|
|
|
48326
48342
|
// packages/core/src/progress.ts
|
|
48327
48343
|
function extractCurrentSection(content) {
|
|
@@ -48392,7 +48408,7 @@ function advancePhase(state, taskDir) {
|
|
|
48392
48408
|
throw new Error("Task is already done. Nothing to advance.");
|
|
48393
48409
|
}
|
|
48394
48410
|
if (config.loopBack) {
|
|
48395
|
-
const progress = storage.read(
|
|
48411
|
+
const progress = storage.read(join5(taskDir, "PROGRESS.md")) ?? "";
|
|
48396
48412
|
const hasIssues = /\u26A0\uFE0F/.test(progress);
|
|
48397
48413
|
if (hasIssues) {
|
|
48398
48414
|
return recordPhaseTransition(state, current, config.loopBack, "issues found -> loop back");
|
|
@@ -48416,19 +48432,19 @@ function advancePhase(state, taskDir) {
|
|
|
48416
48432
|
}
|
|
48417
48433
|
const nextConfig = getPhase(nextName);
|
|
48418
48434
|
for (const file of nextConfig.requires) {
|
|
48419
|
-
if (storage.read(
|
|
48435
|
+
if (storage.read(join5(taskDir, file)) === null) {
|
|
48420
48436
|
throw new Error(`Cannot advance to ${nextName} \u2014 ${file} does not exist yet`);
|
|
48421
48437
|
}
|
|
48422
48438
|
}
|
|
48423
48439
|
if (nextName === "exec" && current === "plan") {
|
|
48424
|
-
let progressContent = storage.read(
|
|
48440
|
+
let progressContent = storage.read(join5(taskDir, "PROGRESS.md"));
|
|
48425
48441
|
if (progressContent !== null) {
|
|
48426
48442
|
const { unchecked } = countProgress(progressContent);
|
|
48427
48443
|
if (unchecked === 0) {
|
|
48428
48444
|
throw new Error("Cannot advance to exec \u2014 PROGRESS.md has no unchecked items");
|
|
48429
48445
|
}
|
|
48430
48446
|
progressContent = appendChecklists(progressContent);
|
|
48431
|
-
storage.write(
|
|
48447
|
+
storage.write(join5(taskDir, "PROGRESS.md"), progressContent);
|
|
48432
48448
|
}
|
|
48433
48449
|
}
|
|
48434
48450
|
return recordPhaseTransition(state, current, nextName);
|
|
@@ -48442,7 +48458,7 @@ function setPhase(state, taskDir, targetPhase) {
|
|
|
48442
48458
|
function autoTransitionAfterIteration(state, taskDir) {
|
|
48443
48459
|
const config = getPhase(state.phase);
|
|
48444
48460
|
const storage = getStorage();
|
|
48445
|
-
const progress = storage.read(
|
|
48461
|
+
const progress = storage.read(join5(taskDir, "PROGRESS.md"));
|
|
48446
48462
|
if (progress === null)
|
|
48447
48463
|
return state;
|
|
48448
48464
|
if (config.loopBack) {
|
|
@@ -48493,7 +48509,7 @@ function appendChecklists(progress) {
|
|
|
48493
48509
|
const sectionMatches = progress.match(/^## Section \d+/gm);
|
|
48494
48510
|
let nextSection = (sectionMatches?.length ?? 0) + 1;
|
|
48495
48511
|
for (const name of names) {
|
|
48496
|
-
const raw = storage.read(
|
|
48512
|
+
const raw = storage.read(join5(dir, `${name}.md`));
|
|
48497
48513
|
if (raw === null)
|
|
48498
48514
|
continue;
|
|
48499
48515
|
const h1Match = raw.match(/^# (.+)\n/);
|
|
@@ -48511,7 +48527,7 @@ ${body.trimEnd()}
|
|
|
48511
48527
|
|
|
48512
48528
|
// packages/core/src/git.ts
|
|
48513
48529
|
import { execSync as execSync2 } from "child_process";
|
|
48514
|
-
import { join as
|
|
48530
|
+
import { join as join6 } from "path";
|
|
48515
48531
|
function getCurrentBranch() {
|
|
48516
48532
|
try {
|
|
48517
48533
|
return execSync2("git branch --show-current", { encoding: "utf-8" }).trim();
|
|
@@ -48544,7 +48560,7 @@ function gitPush() {
|
|
|
48544
48560
|
}
|
|
48545
48561
|
}
|
|
48546
48562
|
function commitState(taskDir, message) {
|
|
48547
|
-
const stateFile =
|
|
48563
|
+
const stateFile = join6(taskDir, "state.json");
|
|
48548
48564
|
try {
|
|
48549
48565
|
gitAdd([stateFile]);
|
|
48550
48566
|
gitCommit(`docs(ralph): ${message}`);
|
|
@@ -48559,14 +48575,14 @@ function commitTaskDir(taskDir, message) {
|
|
|
48559
48575
|
|
|
48560
48576
|
// apps/cli/src/components/TaskList.tsx
|
|
48561
48577
|
var import_react22 = __toESM(require_react(), 1);
|
|
48562
|
-
import { join as
|
|
48578
|
+
import { join as join7 } from "path";
|
|
48563
48579
|
var jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
|
|
48564
48580
|
function buildRows(tasksDir) {
|
|
48565
48581
|
const storage = getStorage();
|
|
48566
48582
|
const entries = storage.list(tasksDir);
|
|
48567
48583
|
const rows = [];
|
|
48568
48584
|
for (const entry of entries) {
|
|
48569
|
-
const raw = storage.read(
|
|
48585
|
+
const raw = storage.read(join7(tasksDir, entry, "state.json"));
|
|
48570
48586
|
if (raw === null)
|
|
48571
48587
|
continue;
|
|
48572
48588
|
let state;
|
|
@@ -48582,7 +48598,7 @@ function buildRows(tasksDir) {
|
|
|
48582
48598
|
`).find((l) => l.trim() !== "") ?? "";
|
|
48583
48599
|
let progress = "\u2014";
|
|
48584
48600
|
let progressStyled = true;
|
|
48585
|
-
const progressContent = storage.read(
|
|
48601
|
+
const progressContent = storage.read(join7(tasksDir, entry, "PROGRESS.md"));
|
|
48586
48602
|
if (progressContent !== null) {
|
|
48587
48603
|
const { checked, unchecked } = countProgress(progressContent);
|
|
48588
48604
|
const total = checked + unchecked;
|
|
@@ -48709,7 +48725,7 @@ function TaskList({ tasksDir }) {
|
|
|
48709
48725
|
}
|
|
48710
48726
|
|
|
48711
48727
|
// apps/cli/src/components/TaskStatus.tsx
|
|
48712
|
-
import { join as
|
|
48728
|
+
import { join as join8 } from "path";
|
|
48713
48729
|
var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
|
|
48714
48730
|
var HEAVY_RULE = "============================================";
|
|
48715
48731
|
var LIGHT_RULE = "--------------------------------------------";
|
|
@@ -48719,9 +48735,9 @@ function TaskStatus({ state, taskDir }) {
|
|
|
48719
48735
|
const time = Math.round(state.usage.total_duration_ms / 1000 * 10) / 10 + "s";
|
|
48720
48736
|
const documents = getStatusDocuments().map((doc) => ({
|
|
48721
48737
|
name: doc.name,
|
|
48722
|
-
exists: storage.read(
|
|
48738
|
+
exists: storage.read(join8(taskDir, doc.name)) !== null
|
|
48723
48739
|
}));
|
|
48724
|
-
const progressContent = storage.read(
|
|
48740
|
+
const progressContent = storage.read(join8(taskDir, "PROGRESS.md"));
|
|
48725
48741
|
const progress = progressContent !== null ? countProgress(progressContent) : null;
|
|
48726
48742
|
const recent = state.history.slice(-10);
|
|
48727
48743
|
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
@@ -48889,7 +48905,7 @@ function TaskStatus({ state, taskDir }) {
|
|
|
48889
48905
|
|
|
48890
48906
|
// apps/cli/src/components/TaskLoop.tsx
|
|
48891
48907
|
var import_react56 = __toESM(require_react(), 1);
|
|
48892
|
-
import { join as
|
|
48908
|
+
import { join as join12 } from "path";
|
|
48893
48909
|
|
|
48894
48910
|
// apps/cli/src/components/Banner.tsx
|
|
48895
48911
|
var jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
|
|
@@ -52365,15 +52381,15 @@ function StopMessage({
|
|
|
52365
52381
|
|
|
52366
52382
|
// apps/cli/src/hooks/useLoop.ts
|
|
52367
52383
|
var import_react55 = __toESM(require_react(), 1);
|
|
52368
|
-
import { join as
|
|
52384
|
+
import { join as join11 } from "path";
|
|
52369
52385
|
|
|
52370
52386
|
// packages/engine/src/spawn.ts
|
|
52371
52387
|
var {spawn: bunSpawn } = globalThis.Bun;
|
|
52372
52388
|
var spawn = bunSpawn;
|
|
52373
52389
|
|
|
52374
52390
|
// packages/engine/src/engine.ts
|
|
52375
|
-
import { writeFileSync as
|
|
52376
|
-
import { join as
|
|
52391
|
+
import { writeFileSync as writeFileSync3, unlinkSync as unlinkSync2, existsSync as existsSync5, mkdtempSync } from "fs";
|
|
52392
|
+
import { join as join9 } from "path";
|
|
52377
52393
|
import { tmpdir } from "os";
|
|
52378
52394
|
|
|
52379
52395
|
// packages/output/src/output.ts
|
|
@@ -53129,8 +53145,8 @@ function buildCodexArgs() {
|
|
|
53129
53145
|
return ["exec", "--json", "--color", "never", "--dangerously-bypass-approvals-and-sandbox", "-"];
|
|
53130
53146
|
}
|
|
53131
53147
|
async function runInteractive(model, prompt, taskDir) {
|
|
53132
|
-
const promptFile = taskDir ?
|
|
53133
|
-
|
|
53148
|
+
const promptFile = taskDir ? join9(taskDir, "_interactive_prompt.md") : join9(mkdtempSync(join9(tmpdir(), "ralph-")), "prompt.md");
|
|
53149
|
+
writeFileSync3(promptFile, prompt);
|
|
53134
53150
|
try {
|
|
53135
53151
|
const cmd = [
|
|
53136
53152
|
"claude",
|
|
@@ -53155,8 +53171,8 @@ async function runInteractive(model, prompt, taskDir) {
|
|
|
53155
53171
|
stderr: "inherit"
|
|
53156
53172
|
});
|
|
53157
53173
|
const exitCode = await proc.exited;
|
|
53158
|
-
const doneFile = taskDir ?
|
|
53159
|
-
if (doneFile &&
|
|
53174
|
+
const doneFile = taskDir ? join9(taskDir, "_interactive_done") : null;
|
|
53175
|
+
if (doneFile && existsSync5(doneFile)) {
|
|
53160
53176
|
return { exitCode: 0, usage: null };
|
|
53161
53177
|
}
|
|
53162
53178
|
return { exitCode, usage: null };
|
|
@@ -53255,14 +53271,14 @@ async function runEngine(opts) {
|
|
|
53255
53271
|
}
|
|
53256
53272
|
|
|
53257
53273
|
// apps/cli/src/loop.ts
|
|
53258
|
-
import { join as
|
|
53274
|
+
import { join as join10 } from "path";
|
|
53259
53275
|
function buildTaskPrompt(state, taskDir) {
|
|
53260
53276
|
const phaseConfig = getPhase(state.phase);
|
|
53261
53277
|
let prompt = "";
|
|
53262
53278
|
const storage = getStorage();
|
|
53263
53279
|
for (const doc of getPromptDocuments(state.phase)) {
|
|
53264
53280
|
const injection = doc.promptInjection;
|
|
53265
|
-
const content = storage.read(
|
|
53281
|
+
const content = storage.read(join10(taskDir, doc.name));
|
|
53266
53282
|
if (content === null)
|
|
53267
53283
|
continue;
|
|
53268
53284
|
if (injection.filterHeaders) {
|
|
@@ -53302,7 +53318,7 @@ function buildTaskPrompt(state, taskDir) {
|
|
|
53302
53318
|
for (const entry of phaseConfig.context) {
|
|
53303
53319
|
switch (entry.type) {
|
|
53304
53320
|
case "file": {
|
|
53305
|
-
const content = storage.read(
|
|
53321
|
+
const content = storage.read(join10(taskDir, entry.file));
|
|
53306
53322
|
if (content !== null) {
|
|
53307
53323
|
prompt += `
|
|
53308
53324
|
---
|
|
@@ -53315,7 +53331,7 @@ function buildTaskPrompt(state, taskDir) {
|
|
|
53315
53331
|
break;
|
|
53316
53332
|
}
|
|
53317
53333
|
case "currentSection": {
|
|
53318
|
-
const progressContent = storage.read(
|
|
53334
|
+
const progressContent = storage.read(join10(taskDir, "PROGRESS.md"));
|
|
53319
53335
|
if (progressContent !== null) {
|
|
53320
53336
|
const section = extractCurrentSection(progressContent);
|
|
53321
53337
|
if (section) {
|
|
@@ -53367,7 +53383,7 @@ function buildTemplateVars(state, taskDir) {
|
|
|
53367
53383
|
}
|
|
53368
53384
|
function checkStopSignal(taskDir) {
|
|
53369
53385
|
const storage = getStorage();
|
|
53370
|
-
const stopFile =
|
|
53386
|
+
const stopFile = join10(taskDir, "STOP");
|
|
53371
53387
|
const reason = storage.read(stopFile);
|
|
53372
53388
|
if (reason === null)
|
|
53373
53389
|
return null;
|
|
@@ -53478,10 +53494,10 @@ function useLoop(opts) {
|
|
|
53478
53494
|
setLogLines((prev) => [...prev, { id: nextId(), kind: "feed", event }]);
|
|
53479
53495
|
};
|
|
53480
53496
|
runWithContext(createDefaultContext(), async () => {
|
|
53481
|
-
const taskDir =
|
|
53497
|
+
const taskDir = join11(opts.tasksDir, opts.name);
|
|
53482
53498
|
const storage = getStorage();
|
|
53483
53499
|
let currentState;
|
|
53484
|
-
const existingState = storage.read(
|
|
53500
|
+
const existingState = storage.read(join11(taskDir, "state.json"));
|
|
53485
53501
|
if (existingState !== null) {
|
|
53486
53502
|
currentState = readState(taskDir);
|
|
53487
53503
|
if (currentState.engine !== opts.engine || currentState.model !== opts.model) {
|
|
@@ -53519,7 +53535,7 @@ function useLoop(opts) {
|
|
|
53519
53535
|
const time = new Date().toLocaleTimeString("en-US", { hour12: false });
|
|
53520
53536
|
addIterationHeader(iter, time);
|
|
53521
53537
|
addInfo(`Phase: ${currentState.phase} (iteration ${currentState.phaseIteration})`);
|
|
53522
|
-
const progressContent = storage.read(
|
|
53538
|
+
const progressContent = storage.read(join11(taskDir, "PROGRESS.md"));
|
|
53523
53539
|
if (progressContent !== null) {
|
|
53524
53540
|
const section = extractCurrentSection(progressContent);
|
|
53525
53541
|
if (section) {
|
|
@@ -53534,7 +53550,7 @@ function useLoop(opts) {
|
|
|
53534
53550
|
const prompt = buildTaskPrompt(currentState, taskDir);
|
|
53535
53551
|
const iterStart = new Date().toISOString();
|
|
53536
53552
|
try {
|
|
53537
|
-
const interactiveDone = storage.read(
|
|
53553
|
+
const interactiveDone = storage.read(join11(taskDir, "_interactive_done")) !== null;
|
|
53538
53554
|
const isInteractivePhase = opts.interactive && currentState.phase === "research" && !interactiveDone;
|
|
53539
53555
|
const engineResult = await runEngine({
|
|
53540
53556
|
engine: opts.engine,
|
|
@@ -53585,8 +53601,8 @@ function useLoop(opts) {
|
|
|
53585
53601
|
break;
|
|
53586
53602
|
}
|
|
53587
53603
|
}
|
|
53588
|
-
storage.remove(
|
|
53589
|
-
const finalProgressContent = storage.read(
|
|
53604
|
+
storage.remove(join11(taskDir, "_interactive_done"));
|
|
53605
|
+
const finalProgressContent = storage.read(join11(taskDir, "PROGRESS.md"));
|
|
53590
53606
|
if (finalProgressContent !== null) {
|
|
53591
53607
|
setProgress(countProgress(finalProgressContent));
|
|
53592
53608
|
}
|
|
@@ -53677,7 +53693,7 @@ function TaskLoop({ opts }) {
|
|
|
53677
53693
|
}, [loop.isRunning, exit]);
|
|
53678
53694
|
if (!loop.state)
|
|
53679
53695
|
return null;
|
|
53680
|
-
const taskDir =
|
|
53696
|
+
const taskDir = join12(opts.tasksDir, opts.name);
|
|
53681
53697
|
return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
53682
53698
|
flexDirection: "column",
|
|
53683
53699
|
children: [
|
|
@@ -53777,8 +53793,8 @@ function App2({ args, tasksDir }) {
|
|
|
53777
53793
|
message: "Error: --name is required for status mode"
|
|
53778
53794
|
}, undefined, false, undefined, this);
|
|
53779
53795
|
}
|
|
53780
|
-
const taskDir =
|
|
53781
|
-
if (!
|
|
53796
|
+
const taskDir = join13(tasksDir, args.name);
|
|
53797
|
+
if (!existsSync6(join13(taskDir, "state.json"))) {
|
|
53782
53798
|
return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ErrorMessage, {
|
|
53783
53799
|
message: `Error: task '${args.name}' not found`
|
|
53784
53800
|
}, undefined, false, undefined, this);
|
|
@@ -53797,7 +53813,7 @@ function App2({ args, tasksDir }) {
|
|
|
53797
53813
|
message: "Error: --name is required for advance mode"
|
|
53798
53814
|
}, undefined, false, undefined, this);
|
|
53799
53815
|
}
|
|
53800
|
-
const taskDir =
|
|
53816
|
+
const taskDir = join13(tasksDir, args.name);
|
|
53801
53817
|
const state = ensureState(taskDir);
|
|
53802
53818
|
const updated = advancePhase(state, taskDir);
|
|
53803
53819
|
writeState(taskDir, updated);
|
|
@@ -53819,7 +53835,7 @@ function App2({ args, tasksDir }) {
|
|
|
53819
53835
|
message: "Error: --phase is required for set-phase mode"
|
|
53820
53836
|
}, undefined, false, undefined, this);
|
|
53821
53837
|
}
|
|
53822
|
-
const taskDir =
|
|
53838
|
+
const taskDir = join13(tasksDir, args.name);
|
|
53823
53839
|
const state = ensureState(taskDir);
|
|
53824
53840
|
const updated = setPhase(state, taskDir, args.phase);
|
|
53825
53841
|
return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ExitAfterRender, {
|
|
@@ -53828,13 +53844,20 @@ function App2({ args, tasksDir }) {
|
|
|
53828
53844
|
}, undefined, false, undefined, this)
|
|
53829
53845
|
}, undefined, false, undefined, this);
|
|
53830
53846
|
}
|
|
53847
|
+
case "init":
|
|
53848
|
+
return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ExitAfterRender, {
|
|
53849
|
+
children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
53850
|
+
color: "green",
|
|
53851
|
+
children: "Initialized .ralph directory"
|
|
53852
|
+
}, undefined, false, undefined, this)
|
|
53853
|
+
}, undefined, false, undefined, this);
|
|
53831
53854
|
case "task": {
|
|
53832
53855
|
if (!args.name) {
|
|
53833
53856
|
return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ErrorMessage, {
|
|
53834
53857
|
message: "Error: --name is required for task mode"
|
|
53835
53858
|
}, undefined, false, undefined, this);
|
|
53836
53859
|
}
|
|
53837
|
-
|
|
53860
|
+
mkdirSync3(join13(tasksDir, args.name), { recursive: true });
|
|
53838
53861
|
return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(TaskLoop, {
|
|
53839
53862
|
opts: {
|
|
53840
53863
|
name: args.name,
|
|
@@ -53861,17 +53884,18 @@ function App2({ args, tasksDir }) {
|
|
|
53861
53884
|
function resolveTasksDir2() {
|
|
53862
53885
|
let dir = process.cwd();
|
|
53863
53886
|
while (dir !== "/") {
|
|
53864
|
-
const candidate =
|
|
53865
|
-
if (
|
|
53887
|
+
const candidate = join14(dir, ".ralph", "tasks");
|
|
53888
|
+
if (existsSync7(candidate))
|
|
53866
53889
|
return candidate;
|
|
53867
53890
|
dir = resolve3(dir, "..");
|
|
53868
53891
|
}
|
|
53869
|
-
return
|
|
53892
|
+
return join14(process.cwd(), ".ralph", "tasks");
|
|
53870
53893
|
}
|
|
53871
53894
|
try {
|
|
53872
53895
|
const args = parseArgs(process.argv.slice(2));
|
|
53873
53896
|
const tasksDir = resolveTasksDir2();
|
|
53874
53897
|
runWithContext(createDefaultContext(), () => {
|
|
53898
|
+
initRalphFromTasksDir(tasksDir);
|
|
53875
53899
|
scaffoldTasksDir(tasksDir);
|
|
53876
53900
|
render_default(import_react58.createElement(App2, { args, tasksDir }));
|
|
53877
53901
|
});
|
package/package.json
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neriros/ralphy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "An iterative AI task execution framework. Orchestrates multi-phase autonomous work using Claude or Codex engines.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "https://github.com/neriros/ralphy.git"
|
|
9
|
-
},
|
|
10
5
|
"keywords": [
|
|
6
|
+
"agent",
|
|
11
7
|
"ai",
|
|
12
|
-
"cli",
|
|
13
8
|
"claude",
|
|
14
|
-
"
|
|
9
|
+
"cli",
|
|
10
|
+
"loop",
|
|
15
11
|
"mcp",
|
|
16
|
-
"agent",
|
|
17
12
|
"ralph",
|
|
18
|
-
"
|
|
13
|
+
"task-runner"
|
|
19
14
|
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/neriros/ralphy.git"
|
|
19
|
+
},
|
|
20
|
+
"bin": {
|
|
21
|
+
"ralphy": "./dist/cli/index.js",
|
|
22
|
+
"ralphy-mcp": "./dist/mcp/index.js"
|
|
23
|
+
},
|
|
20
24
|
"workspaces": [
|
|
21
25
|
"packages/*",
|
|
22
26
|
"apps/*",
|
|
23
27
|
"tools/generators/*"
|
|
24
28
|
],
|
|
25
|
-
"type": "module",
|
|
26
|
-
"bin": {
|
|
27
|
-
"ralphy": "./dist/cli/index.js",
|
|
28
|
-
"ralphy-mcp": "./dist/mcp/index.js"
|
|
29
|
-
},
|
|
30
29
|
"files": [
|
|
31
30
|
"dist/cli/index.js",
|
|
32
31
|
"dist/mcp/index.js",
|
|
@@ -35,9 +34,7 @@
|
|
|
35
34
|
"dist/scaffolds/",
|
|
36
35
|
"README.md"
|
|
37
36
|
],
|
|
38
|
-
"
|
|
39
|
-
"bun": ">=1.0.0"
|
|
40
|
-
},
|
|
37
|
+
"type": "module",
|
|
41
38
|
"scripts": {
|
|
42
39
|
"ralph": "bun .ralph/bin/cli.js",
|
|
43
40
|
"lint": "oxlint --config .oxlintrc.json .",
|
|
@@ -84,5 +81,8 @@
|
|
|
84
81
|
"secretlint": "^11.3.1",
|
|
85
82
|
"typescript": "^5.8.0",
|
|
86
83
|
"zod": "^3.24.0"
|
|
84
|
+
},
|
|
85
|
+
"engines": {
|
|
86
|
+
"bun": ">=1.0.0"
|
|
87
87
|
}
|
|
88
88
|
}
|