Compare commits
3 Commits
b9a12931fe
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 723b7be84a | |||
| bed74f9d33 | |||
| 3a3c293aa7 |
77
index.ts
77
index.ts
@@ -201,13 +201,14 @@ async function selectLoopOptions(
|
||||
|
||||
/**
|
||||
* When multiple PRD loops have progress, prompt the user to select which one
|
||||
* to resume. Returns the selected PRD key and sourcePath.
|
||||
* to act on. Returns the selected PRD key and sourcePath.
|
||||
* If only one PRD exists, returns it without prompting.
|
||||
* Returns null if no PRDs exist.
|
||||
*/
|
||||
async function selectPRDToResume(
|
||||
async function selectPRD(
|
||||
ctx: ExtensionContext,
|
||||
found: NonNullable<ReturnType<typeof findProgressFile>>,
|
||||
prompt: string,
|
||||
): Promise<{ prdKey: string; sourcePath: string } | null> {
|
||||
const prds = listPRDsSorted(found.state);
|
||||
if (prds.length === 0) return null;
|
||||
@@ -230,10 +231,7 @@ async function selectPRDToResume(
|
||||
return `${relPath} — ${completed}/${total} done${failed ? `, ${failed} failed` : ""} · ${updated}`;
|
||||
});
|
||||
|
||||
const selected = await ctx.ui.select(
|
||||
"Multiple loops found. Which to resume?",
|
||||
options,
|
||||
);
|
||||
const selected = await ctx.ui.select(prompt, options);
|
||||
if (!selected) return null;
|
||||
|
||||
const idx = options.indexOf(selected);
|
||||
@@ -1231,7 +1229,11 @@ async function handleResume(
|
||||
|
||||
// When no specific task file is given, let the user select which loop
|
||||
// to resume from multiple PRDs (sorted by most recent first).
|
||||
const selected = await selectPRDToResume(ctx, found);
|
||||
const selected = await selectPRD(
|
||||
ctx,
|
||||
found,
|
||||
"Multiple loops found. Which to resume?",
|
||||
);
|
||||
if (!selected) {
|
||||
ctx.ui.notify("Resume cancelled.", "info");
|
||||
return;
|
||||
@@ -1285,12 +1287,17 @@ async function handleReset(
|
||||
ctx: ExtensionContext,
|
||||
args: string[],
|
||||
): Promise<void> {
|
||||
let sourcePath: string;
|
||||
let prdKey: string | undefined;
|
||||
let progress: ProgressTracker;
|
||||
|
||||
if (args[0]) {
|
||||
const taskFile = resolveTaskArg(args[0], ctx.cwd);
|
||||
const found = findProgressFile(ctx.cwd, taskFile);
|
||||
const projectDir = found ? path.dirname(path.dirname(found.path)) : ctx.cwd;
|
||||
const progress = new ProgressTracker(projectDir, taskFile, found?.prdKey);
|
||||
progress.reset();
|
||||
sourcePath = taskFile;
|
||||
prdKey = found?.prdKey;
|
||||
progress = new ProgressTracker(projectDir, taskFile, prdKey);
|
||||
} else {
|
||||
const found = findProgressFile(ctx.cwd);
|
||||
if (!found) {
|
||||
@@ -1301,13 +1308,53 @@ async function handleReset(
|
||||
return;
|
||||
}
|
||||
const projectDir = path.dirname(path.dirname(found.path));
|
||||
// Use the most recently updated PRD (first in sorted order)
|
||||
const prds = listPRDsSorted(found.state);
|
||||
const sourcePath =
|
||||
prds.length > 0 ? prds[0].prd.sourcePath : found.state.sourcePath;
|
||||
const progress = new ProgressTracker(projectDir, sourcePath);
|
||||
progress.reset();
|
||||
|
||||
// Multiple loops may have progress — let the user select which one to
|
||||
// reset (sorted by most recent first), same as resume.
|
||||
const selected = await selectPRD(
|
||||
ctx,
|
||||
found,
|
||||
"Multiple loops found. Which to reset?",
|
||||
);
|
||||
if (!selected) {
|
||||
ctx.ui.notify("Reset cancelled.", "info");
|
||||
return;
|
||||
}
|
||||
sourcePath = selected.sourcePath;
|
||||
prdKey = selected.prdKey;
|
||||
progress = new ProgressTracker(projectDir, sourcePath, prdKey);
|
||||
}
|
||||
|
||||
// Ask whether to also clear the progress markers (checkboxes/status) in the
|
||||
// source PRD/README file itself, not just .ralpi/progress.json.
|
||||
const taskIds = Object.keys(progress.getState().tasks);
|
||||
if (taskIds.length > 0) {
|
||||
const choice = await ctx.ui.select(
|
||||
`Also reset progress markers in the source file (${path.basename(
|
||||
sourcePath,
|
||||
)})?`,
|
||||
[
|
||||
"Yes — clear checkboxes/status markers in the source PRD/README",
|
||||
"No — only reset .ralpi/progress.json",
|
||||
],
|
||||
);
|
||||
if (choice === undefined) {
|
||||
ctx.ui.notify("Reset cancelled.", "info");
|
||||
return;
|
||||
}
|
||||
if (choice.startsWith("Yes")) {
|
||||
progress.reset();
|
||||
for (const id of taskIds) {
|
||||
updateTaskInFile(sourcePath, id, "pending");
|
||||
}
|
||||
ctx.ui.notify(
|
||||
`Progress reset — cleared ${taskIds.length} task marker(s) in ${path.basename(sourcePath)}.`,
|
||||
"info",
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
progress.reset();
|
||||
ctx.ui.notify("Progress reset. All task statuses cleared.", "info");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@mikefreno/ralpi",
|
||||
"version": "0.4.3",
|
||||
"version": "0.5.0",
|
||||
"description": "Execute tasks from task files/PRD's using DAG-based dependency resolution with persistent progress tracking",
|
||||
"keywords": [
|
||||
"pi-package",
|
||||
|
||||
@@ -1434,7 +1434,7 @@ async function runFollowUpSession(
|
||||
undefined,
|
||||
model,
|
||||
config.thinkingLevel,
|
||||
true, // noSkills — follow-up sessions don't need the skills catalog
|
||||
false, // noSkills=false — follow-up sessions load skills too
|
||||
(ctx.modelRegistry as any).runtime as ModelRuntime,
|
||||
);
|
||||
|
||||
|
||||
@@ -596,14 +596,17 @@ export async function runAgentSession(
|
||||
} = {};
|
||||
|
||||
try {
|
||||
// Loop sessions load the full normal pi context: extensions (so all
|
||||
// extension-provided tools register), skills, and project context
|
||||
// (AGENTS.md / CLAUDE.md)
|
||||
const loader = new DefaultResourceLoader({
|
||||
cwd,
|
||||
agentDir: getAgentDir(),
|
||||
noExtensions: true,
|
||||
noSkills,
|
||||
noPromptTemplates: true,
|
||||
noThemes: true,
|
||||
noContextFiles: true,
|
||||
noExtensions: false,
|
||||
noContextFiles: false,
|
||||
});
|
||||
await loader.reload();
|
||||
|
||||
@@ -613,7 +616,7 @@ export async function runAgentSession(
|
||||
resourceLoader: loader,
|
||||
settingsManager: SettingsManager.create(cwd, getAgentDir()),
|
||||
modelRuntime,
|
||||
tools: ["read", "bash", "edit", "write", "grep", "find", "ls"],
|
||||
// No `tools` allowlist: matches a normal pi session's tool set.
|
||||
model: model as any,
|
||||
thinkingLevel: thinkingLevel as any,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user