feat(auth): force org selection in parse-prd and export commands

CHANGES:
- Add forcePrompt option to ensureOrgSelected utility
- When forcePrompt=true, always fetch orgs and prompt (if >1 org exists)
- Pre-select current org in dropdown when forcePrompt is used
- Show '(current)' label next to currently selected org in prompt

PARSE-PRD:
- Force org selection after authentication (forcePrompt: true)
- User can choose which org to create the brief in
- Auto-selects if only one org available

EXPORT:
- Force org selection after tag selection (forcePrompt: true)
- User can choose which org to export to
- Auto-selects if only one org available

INIT:
- Removed process.exit(0) hack that was incorrectly added

This ensures users explicitly choose (or confirm) their target organization
before creating briefs, preventing accidental exports to wrong orgs.
This commit is contained in:
Eyal Toledano
2025-12-02 12:06:23 -05:00
parent 985b6e16fa
commit f04a568de0
4 changed files with 44 additions and 13 deletions

View File

@@ -383,9 +383,12 @@ async function handleParsePrdToHamster(prdPath) {
const authManager = AuthManager.getInstance();
// Ensure an organization is selected before proceeding
// Always prompt for organization selection for parse-prd
// This allows users to choose which org to create the brief in
// even if they have one already selected in context
const orgResult = await ensureOrgSelected(authManager, {
promptMessage: 'Select an organization to create the brief in:'
promptMessage: 'Select an organization to create the brief in:',
forcePrompt: true
});
if (!orgResult.success) {
console.error(