@ferris1225/pi-subagents 4.0.1 → 4.1.2
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/README.md +506 -478
- package/agents/cleaner.md +51 -41
- package/agents/documenter.md +44 -0
- package/agents/reviewer.md +71 -70
- package/agents/worker.md +4 -1
- package/package.json +2 -2
- package/src/agents.ts +12 -0
- package/src/announcements.ts +34 -7
- package/src/completion.ts +160 -160
- package/src/config.ts +86 -15
- package/src/dispatch.ts +637 -704
- package/src/fixloop.ts +266 -52
- package/src/index.ts +93 -93
- package/src/models.ts +189 -189
- package/src/monitor.ts +12 -3
- package/src/prompt.ts +47 -12
- package/src/recovery.ts +145 -145
- package/src/rpc-run.ts +23 -7
- package/src/runtime.ts +8 -7
- package/src/session-fork.ts +80 -80
- package/src/setup.ts +36 -5
- package/src/spawn.ts +45 -11
- package/src/thread-lifecycle.ts +203 -49
- package/src/tools.ts +23 -9
- package/src/widget.ts +4 -4
- package/src/worktree.ts +27 -4
package/src/worktree.ts
CHANGED
|
@@ -298,11 +298,18 @@ export function isPathInside(root: string, candidate: string): boolean {
|
|
|
298
298
|
return rel === "" || (!rel.startsWith("..") && !isAbsolute(rel));
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
interface RepositoryLocation {
|
|
302
|
+
originalCwd: string;
|
|
303
|
+
originalRoot: string;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/** Resolve the canonical repository root without requiring a committed HEAD.
|
|
307
|
+
* Managed repository lanes use this for empty repositories as well as normal
|
|
308
|
+
* worktrees; worktree creation validates HEAD separately below. */
|
|
309
|
+
async function resolveRepositoryLocation(
|
|
303
310
|
cwd: string,
|
|
304
|
-
runner: CommandRunner
|
|
305
|
-
): Promise<
|
|
311
|
+
runner: CommandRunner,
|
|
312
|
+
): Promise<RepositoryLocation> {
|
|
306
313
|
const requested = resolve(cwd);
|
|
307
314
|
try {
|
|
308
315
|
if (!(await stat(requested)).isDirectory()) throw new Error("not a directory");
|
|
@@ -335,6 +342,22 @@ export async function resolveWorktreeTarget(
|
|
|
335
342
|
`Requested cwd ${originalCwd} is not inside Git worktree root ${originalRoot}.`,
|
|
336
343
|
);
|
|
337
344
|
}
|
|
345
|
+
return { originalCwd, originalRoot };
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export async function resolveRepositoryRoot(
|
|
349
|
+
cwd: string,
|
|
350
|
+
runner: CommandRunner = runCommand,
|
|
351
|
+
): Promise<string> {
|
|
352
|
+
return (await resolveRepositoryLocation(cwd, runner)).originalRoot;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** Resolve and validate the Git repository/worktree that contains cwd. */
|
|
356
|
+
export async function resolveWorktreeTarget(
|
|
357
|
+
cwd: string,
|
|
358
|
+
runner: CommandRunner = runCommand,
|
|
359
|
+
): Promise<WorktreeTarget> {
|
|
360
|
+
const { originalCwd, originalRoot } = await resolveRepositoryLocation(cwd, runner);
|
|
338
361
|
let headResult: CommandResult;
|
|
339
362
|
try {
|
|
340
363
|
headResult = await runGit(
|