Skip to content

Commit 11a0200

Browse files
Ross StoryCopilot
andcommitted
Default onboarding to Copilot inside Copilot CLI
Detect Copilot CLI environment markers during first-run setup so pressing Enter wires the current agent instead of the historical Claude Code default. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 71f4c6b commit 11a0200

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

src/cli/onboarding.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff 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");

test/onboarding.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from "vitest";
22

3-
import { buildAgentOptions } from "../src/cli/onboarding.js";
3+
import { buildAgentOptions, getInitialAgentValues } from "../src/cli/onboarding.js";
44

55
describe("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
});

0 commit comments

Comments
 (0)