fix: lsof flags, dry-run error guard, remove unused --regenerate

1. Fix lsof flag from -Fn to -Ffn so findProcessWebDir() actually
   gets the file descriptor field needed to match "fcwd" markers.

2. Dry-run cleanup now guards "no sessions" message with both
   killed.length === 0 AND errors.length === 0, matching the
   non-dry-run branch behavior.

3. Remove unused --regenerate CLI option from ao start (defined
   but never referenced in the action body).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Prateek 2026-02-18 12:22:09 +05:30
parent b3d0ba7feb
commit ba04f50656
3 changed files with 9 additions and 9 deletions

View File

@ -116,17 +116,19 @@ export function registerSession(program: Command): void {
}
}
if (result.killed.length === 0) {
if (result.killed.length === 0 && result.errors.length === 0) {
console.log(chalk.dim(" No sessions to clean up."));
} else {
for (const id of result.killed) {
console.log(chalk.yellow(` Would kill ${id}`));
}
console.log(
chalk.dim(
`\nDry run complete. ${result.killed.length} session${result.killed.length !== 1 ? "s" : ""} would be cleaned.`,
),
);
if (result.killed.length > 0) {
console.log(
chalk.dim(
`\nDry run complete. ${result.killed.length} session${result.killed.length !== 1 ? "s" : ""} would be cleaned.`,
),
);
}
}
} else {
const result = await sm.cleanup(opts.project);

View File

@ -117,7 +117,6 @@ export function registerStart(program: Command): void {
.description("Start orchestrator agent and dashboard for a project")
.option("--no-dashboard", "Skip starting the dashboard server")
.option("--no-orchestrator", "Skip starting the orchestrator agent")
.option("--regenerate", "Regenerate CLAUDE.orchestrator.md")
.option("--rebuild", "Clean and rebuild dashboard before starting")
.action(
async (
@ -125,7 +124,6 @@ export function registerStart(program: Command): void {
opts?: {
dashboard?: boolean;
orchestrator?: boolean;
regenerate?: boolean;
rebuild?: boolean;
},
) => {

View File

@ -26,7 +26,7 @@ export async function findRunningDashboardPid(port: number): Promise<string | nu
* Returns null if the cwd can't be determined.
*/
export async function findProcessWebDir(pid: string): Promise<string | null> {
const lsofDetail = await execSilent("lsof", ["-p", pid, "-Fn"]);
const lsofDetail = await execSilent("lsof", ["-p", pid, "-Ffn"]);
if (!lsofDetail) return null;
// lsof -Fn outputs lines like "n/path/to/cwd" — the cwd entry follows "fcwd"