Repository navigation
fix(code init): polish next-steps login copy — one primitive, clean bullets - #92
Conversation
…ullets
The merged delegation PR composed the final panel from the inline-note
sentences, which read awkwardly (the API-key alternative looked like a
repeated line). Introduce TOOL_LOGIN_METHODS as the single primitive and
derive both the inline-note sentences and the panel bullets from it, so
the copy cannot drift.
Before (opencode):
1. Run `opencode`, type `/connect` and choose "Login with Berget".
Run `opencode`, type `/connect` and choose "Enter Berget API Key manually",
or set the BERGET_API_KEY environment variable.
2. Select model: /models
After (opencode):
1. Run `opencode` and type `/connect`, then either:
• choose "Login with Berget" (subscription), or
• choose "Enter Berget API Key manually" — or set BERGET_API_KEY
2. Select model: /models
There was a problem hiding this comment.
Review
Summary
This PR refactors the per-tool login copy in auth-sync.ts into a single structured source (TOOL_LOGIN_METHODS) and uses it to render a cleaner two-alternative bullet list in init.ts's next-steps panel, eliminating the previously mis-indented \nor set the BERGET_API_KEY... line in the opencode flow.
Risk
LOW — pure display-copy refactor; all four legacy instruction strings are reproduced verbatim by the new loginInstruction helper, public exports are preserved, and I verified tsc --noEmit, all 74 existing tests (init.test.ts, auth-sync.test.ts, code.test.ts), eslint, and prettier pass on this branch.
Issues
None. I traced every consumer (API_KEY_LOGIN_INSTRUCTIONS at auth-sync.ts:308, SUBSCRIPTION_LOGIN_INSTRUCTIONS at auth-sync.ts:338,373, and the rewritten init.ts:171 next-steps path), confirmed the generated strings for both tools are semantically identical to the old copy (Run \opencode`, type `/connect` and choose "Login with Berget".etc. — including the Pi/loginvariants), and confirmed the existing tests asserting/connect, "Login with Berget", /login, and Authenticate with Berget AI` substrings still pass. No secrets, no behavioral change, no stale docs referencing the old wording.
Suggestions
None.
Architecture
No structural change — it consolidates login copy into one exported constant map with compile-time-exhaustive Record<Tool, string> exports, strengthening the "single source of truth" invariant already claimed by the module docblock.
CodeSense score: 9/10 — all copy derives from one constant, exhaustive typing catches future tool additions, zero behavioral delta, fully covered by existing tests.
Inline findings
Berget AI (berget/zai-org/GLM-5.3-Flash) | PR #92
Follow-up polish to #91. The final next-steps panel composed its text from the inline-note sentences, which read awkwardly (the API-key alternative looked like a repeated line). Introduces
TOOL_LOGIN_METHODSas the single primitive and derives both the inline-note sentences and the panel bullets from it — copy cannot drift.Before → after (opencode):
Inline notes unchanged. 265 tests green, lint/typecheck/format clean.