mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-18 00:02:45 +00:00
feat(coding-agent): Add --session-dir flag for custom session directory
- Add --session-dir CLI flag to specify custom session directory - SessionManager API: second param of create(), continueRecent(), list(), open() changed from agentDir to sessionDir (direct directory, no cwd encoding) - When omitted, uses default (~/.pi/agent/sessions/<encoded-cwd>/) - --session now derives sessionDir from file's parent if --session-dir not provided - list() validates session header before processing files - Closes #313 Co-authored-by: scutifer <scutifer@users.noreply.github.com>
This commit is contained in:
parent
4edfff41a7
commit
911963e777
8 changed files with 106 additions and 48 deletions
|
|
@ -173,12 +173,16 @@ function createSessionManager(parsed: Args, cwd: string): SessionManager | null
|
|||
return SessionManager.inMemory();
|
||||
}
|
||||
if (parsed.session) {
|
||||
return SessionManager.open(parsed.session);
|
||||
return SessionManager.open(parsed.session, parsed.sessionDir);
|
||||
}
|
||||
if (parsed.continue) {
|
||||
return SessionManager.continueRecent(cwd);
|
||||
return SessionManager.continueRecent(cwd, parsed.sessionDir);
|
||||
}
|
||||
// --resume is handled separately (needs picker UI)
|
||||
// If --session-dir provided without --continue/--resume, create new session there
|
||||
if (parsed.sessionDir) {
|
||||
return SessionManager.create(cwd, parsed.sessionDir);
|
||||
}
|
||||
// Default case (new session) returns null, SDK will create one
|
||||
return null;
|
||||
}
|
||||
|
|
@ -348,7 +352,7 @@ export async function main(args: string[]) {
|
|||
|
||||
// Handle --resume: show session picker
|
||||
if (parsed.resume) {
|
||||
const sessions = SessionManager.list(cwd);
|
||||
const sessions = SessionManager.list(cwd, parsed.sessionDir);
|
||||
time("SessionManager.list");
|
||||
if (sessions.length === 0) {
|
||||
console.log(chalk.dim("No sessions found"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue