File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,6 +83,15 @@ export function buildAgentOptions(): { value: string; label: string; hint?: stri
8383 ] ;
8484}
8585
86+ export function getInitialAgentValues (
87+ env : Record < string , string | undefined > = process . env ,
88+ ) : string [ ] {
89+ if ( env [ "COPILOT_CLI" ] === "1" || env [ "COPILOT_AGENT_SESSION_ID" ] ) {
90+ return [ "copilot-cli" ] ;
91+ }
92+ return [ "claude-code" ] ;
93+ }
94+
8695// Mirror src/cli.ts findEnvExample so onboarding ships the same .env
8796// skeleton whether called directly or via `agentmemory init`. We
8897// duplicate (rather than import) so the onboarding module doesn't
@@ -154,7 +163,7 @@ export async function runOnboarding(): Promise<OnboardingResult> {
154163 message : "Which agents will use agentmemory? (space to toggle, enter to confirm)" ,
155164 options : buildAgentOptions ( ) ,
156165 required : false ,
157- initialValues : [ "claude-code" ] ,
166+ initialValues : getInitialAgentValues ( ) ,
158167 } ) ;
159168 if ( p . isCancel ( agentsPicked ) ) {
160169 p . cancel ( "Setup cancelled. Re-run any time with: agentmemory --reset" ) ;
Original file line number Diff line number Diff line change 11import { describe , expect , it } from "vitest" ;
22
3- import { buildAgentOptions } from "../src/cli/onboarding.js" ;
3+ import { buildAgentOptions , getInitialAgentValues } from "../src/cli/onboarding.js" ;
44
55describe ( "first-run onboarding" , ( ) => {
66 it ( "offers GitHub Copilot CLI as a native setup target" , ( ) => {
@@ -15,4 +15,13 @@ describe("first-run onboarding", () => {
1515 ] ) ,
1616 ) ;
1717 } ) ;
18+
19+ it ( "selects GitHub Copilot CLI by default when running inside Copilot CLI" , ( ) => {
20+ expect ( getInitialAgentValues ( { COPILOT_CLI : "1" } ) ) . toEqual ( [ "copilot-cli" ] ) ;
21+ expect ( getInitialAgentValues ( { COPILOT_AGENT_SESSION_ID : "session" } ) ) . toEqual ( [ "copilot-cli" ] ) ;
22+ } ) ;
23+
24+ it ( "keeps Claude Code as the default outside known agent environments" , ( ) => {
25+ expect ( getInitialAgentValues ( { } ) ) . toEqual ( [ "claude-code" ] ) ;
26+ } ) ;
1827} ) ;
You can’t perform that action at this time.
0 commit comments