Skip to content

Commit 0fa45cf

Browse files
committed
fix(cli): make star prompt opt-in
1 parent 800ebc9 commit 0fa45cf

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/cli/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ async function handleStart(options: { block?: boolean } = {}) {
288288
// Auto-install .zshrc hook (idempotent — skips if already present).
289289
installShellHook();
290290

291-
await maybeShowStarPrompt(); // once-only [Y/n] GitHub-star prompt on first interactive start
291+
await maybeShowStarPrompt(); // once-only [y/N] GitHub-star prompt on first interactive start
292292
await syncModelsToCodex(port).catch(() => {});
293293
if (!currentExternalCodexModelProvider() && !shouldInjectApiAuthHeader(config) && config.syncResumeHistory !== false) {
294294
historyGuardian = startHistoryMigrationGuardian();

src/cli/star-prompt.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function starRepo(): { ok: boolean; error?: string } {
3535
}
3636

3737
/**
38-
* First interactive `ocx start`: a one-time `[Y/n]` "star on GitHub?" prompt.
38+
* First interactive `ocx start`: a one-time `[y/N]` "star on GitHub?" prompt.
3939
* On yes, stars the repo via the user's `gh` auth. No-op under the background
4040
* service, for non-TTY/piped runs, when already prompted, or when `gh` is
4141
* unavailable. Never throws.
@@ -52,8 +52,8 @@ export async function maybeShowStarPrompt(): Promise<void> {
5252
const rl = createInterface({ input: process.stdin, output: process.stdout });
5353
let yes = false;
5454
try {
55-
const ans = (await rl.question("\n \x1b[38;5;141m⭐ Enjoying opencodex? Star it on GitHub?\x1b[0m [Y/n] ")).trim().toLowerCase();
56-
yes = ans === "" || ans === "y" || ans === "yes";
55+
const ans = (await rl.question("\n \x1b[38;5;141m⭐ Enjoying opencodex? Star it on GitHub?\x1b[0m [y/N] ")).trim().toLowerCase();
56+
yes = ans === "y" || ans === "yes";
5757
} finally {
5858
rl.close();
5959
}

tests/startup-prompt.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ describe("startup star prompt", () => {
2828
expect(promptIndex).toBeLessThan(syncIndex);
2929
});
3030

31+
test("GitHub star prompt defaults to no", async () => {
32+
const prompt = await readText("src/cli/star-prompt.ts");
33+
34+
expect(prompt).toContain("[y/N]");
35+
expect(prompt).toContain('yes = ans === "y" || ans === "yes"');
36+
expect(prompt).not.toContain('ans === "" || ans === "y"');
37+
});
38+
3139
test("ocx init offers the Codex autostart shim by default", async () => {
3240
const init = await readText("src/cli/init.ts");
3341

0 commit comments

Comments
 (0)