fix(init): preserve additional roles selected at the prompt - #765
Merged
Merged
Conversation
|
Findings
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
teamai initrole prompt.primaryRoleand later selections asadditionalRoles.Fixes #759
Why
The prompt and its validation message already described comma-separated role numbers, but
initdestructured only the first parsed index and silently discarded the remaining selections. This made the saved configuration disagree with the user's input and caused role-scoped resources to omit the requested additional namespaces.The change reuses the existing
parseRoleSelectionvalidation/deduplication and the existingLocalConfig.additionalRolesconsumers. The non-interactive--role <id>path remains a single-primary-role path.Validation
Passed:
git diff --checknpx vitest run src/__tests__/init.test.ts -t 'role persistence'— 2 passednpm run typechecknpm run buildThe new regression test verifies that entering
1,3persistsprimaryRole: 'hai'andadditionalRoles: ['thpc'].I also ran the repository-wide suites. The full unit run and
npm run test:e2eare not green in this Windows sandbox because of unrelated environment-sensitive failures (Windows path separator assertions, spawned-processEINVAL/ENOENT, socket/fixture failures, and a nested temporary-path length failure); the new role-persistence test passes. The real CLI was exercised against an isolated fixture: it loaded the role manifest, displayed the available roles, accepted1,3, and proceeded past role selection before the environment-limited hook flow timed out. No remote team repository or production project was used.