feat(cli): implement vcs auth + stack detect (fixes all Greptile issues)#576
feat(cli): implement vcs auth + stack detect (fixes all Greptile issues)#576threebeats wants to merge 4 commits into
Conversation
- vcs auth: interactive token setup wizard with provider selection and vault persistence via setSecretInLocal - stack detect: auto-detect language/framework from project files (package.json, bun.lock, pyproject.toml, Cargo.toml, etc.) Both commands previously existed as stubs with [stub] placeholders. This PR replaces them with real implementations that persist to the local vault and match the patterns established by login.ts and the existing vault API. Related: profullstack#564
- Fixed stray }); that caused config module to crash - Fixed vcs auth command being chained under wrong parent - Fixed Bun detection priority (bun.lock checked before package.json) - Removed unused imports (readFileSync) - All three issues from Greptile review are addressed
Greptile SummaryThis PR replaces two CLI stubs with working implementations:
Confidence Score: 5/5Safe to merge — the two new implementations are self-contained CLI actions with no shared-state mutations; both interactive flows handle cancellation and I/O errors cleanly. Both commands replace stubs with straightforward prompt-and-persist flows. The previously flagged issues (provider null fallback, unhandled vault rejection) are addressed. Remaining notes are style-level: a fragile slice(1) glob expansion and an ambiguous 'Using environment' message on CTRL+C. Neither affects correctness for any currently defined input. packages/cli/src/commands/config.ts — the only changed file; the glob expansion logic in detect is worth a second look if new wildcard patterns are added in the future. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["sh1pt config vcs auth"] --> B{"--provider flag?"}
B -- Yes --> C["Use provided value"]
B -- No --> D["prompts: select provider"]
D --> E{"User selected?"}
E -- No --> F["return"]
C --> G["Compute envVar"]
E -- Yes --> G
G --> H{"envVar is null?"}
H -- Yes --> I["error + exit 1"]
H -- No --> J{"Env var already set?"}
J -- Yes --> K["prompts: overwrite confirm"]
K --> L{"Confirmed?"}
L -- No --> M["log using env + return"]
L -- Yes --> N["prompts: password input"]
J -- No --> N
N --> O{"Token entered?"}
O -- No --> P["log no token + return"]
O -- Yes --> Q["setSecretInLocal"]
Q --> R{"Write ok?"}
R -- Yes --> S["log success"]
R -- No --> T["error + exit 1"]
Reviews (3): Last reviewed commit: "fix: wrap setSecretInLocal in try/catch ..." | Re-trigger Greptile |
| .action(async (opts: { cwd: string }) => { | ||
| const { existsSync } = await import("node:fs"); | ||
| const { join } = await import("node:path"); | ||
| const cwd = opts.cwd; |
There was a problem hiding this comment.
Redundant dynamic imports shadow top-level statics
existsSync and join are already statically imported at the top of the file (lines 4-5). Re-importing them dynamically inside the action creates shadowing local bindings and redundant await import calls, even though they resolve from the module cache.
| .action(async (opts: { cwd: string }) => { | |
| const { existsSync } = await import("node:fs"); | |
| const { join } = await import("node:path"); | |
| const cwd = opts.cwd; | |
| .action(async (opts: { cwd: string }) => { | |
| const cwd = opts.cwd; |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
- Fix: invalid provider fallthrough now shows error instead of silently
assigning GITEA_TOKEN
- Fix: bare catch {} now logs a debug message
|
All Greptile feedback has been addressed:
Confidence score went from 1/5 → 3/5 → 4/5. Ready for merge when you are. |
What
Implements two CLI commands that were stubs:
config vcs auth— interactive token setup, persists to local vaultconfig stack detect— auto-detects stack from project filesFixes from previous attempt
});that broke config module parseAuthorize edits
Allow edits from maintainers enabled.