Problem
The current admin onboarding flow (bgagent admin invite-user <email>) creates a Cognito user with a permanent password that the admin generates and shares with the teammate via Slack/email. Two UX gaps fall out of that:
- No way for a teammate to rotate their password. They keep using the admin-generated string forever unless they go through Cognito's console manually. The CLI has no
bgagent change-password command.
- The admin's terminal scrollback / Slack message stays canonical. The shared password is the actual login credential indefinitely. Standard secure pattern is a temporary admin-generated password that the teammate must replace on first login — that one-line message stops being a credential after the teammate logs in once.
Acceptance criteria
Part 1 — change-password command
- New
bgagent change-password command. Interactive: prompts for current password + new password (twice for confirmation).
- Calls Cognito's
ChangePasswordCommand against the user's current session token.
- Cognito enforces password policy server-side and returns a structured error; surface it cleanly.
- Works for any user with a valid
bgagent login session.
- Tests: success, wrong current password, weak new password, no session.
Part 2 — force-rotate on first login
- Flip
bgagent admin invite-user to set a temporary password (drop the Permanent: true on AdminSetUserPassword).
- Handle the
NEW_PASSWORD_REQUIRED challenge in bgagent login: when Cognito returns it, prompt the teammate for a new password, call RespondToAuthChallenge, persist the resulting tokens.
- Update
LINEAR_SETUP_GUIDE.md and USER_GUIDE.md teammate-onboarding sections to reflect the new flow ("you'll be prompted to set a permanent password on first login").
Out of scope (future)
- Forgot-password (
ForgotPassword + ConfirmForgotPassword) — needs Cognito email delivery, which means SES wiring. Park as a separate followup.
- MFA enrollment.
- Admin-side password rotation (
admin reset-password <email>) — distinct from a user changing their own password.
Files
cli/src/commands/change-password.ts (new)
cli/src/commands/admin.ts — drop Permanent: true
cli/src/auth.ts — handle NEW_PASSWORD_REQUIRED challenge in login
cli/src/bin/bgagent.ts — register change-password
cli/test/commands/change-password.test.ts (new)
cli/test/commands/admin.test.ts — update for temp password
cli/test/auth.test.ts — challenge-flow coverage
docs/guides/LINEAR_SETUP_GUIDE.md + docs/guides/USER_GUIDE.md — teammate-flow updates
- Mirrors regenerated via
docs/scripts/sync-starlight.mjs
Verification
bgagent change-password rotates an existing user's password end-to-end.
- New
admin invite-user flow: admin runs invite → teammate receives bundle + temp password → first bgagent login prompts them to set a permanent password → second bgagent login succeeds with the new password.
Problem
The current admin onboarding flow (
bgagent admin invite-user <email>) creates a Cognito user with a permanent password that the admin generates and shares with the teammate via Slack/email. Two UX gaps fall out of that:bgagent change-passwordcommand.Acceptance criteria
Part 1 — change-password command
bgagent change-passwordcommand. Interactive: prompts for current password + new password (twice for confirmation).ChangePasswordCommandagainst the user's current session token.bgagent loginsession.Part 2 — force-rotate on first login
bgagent admin invite-userto set a temporary password (drop thePermanent: trueonAdminSetUserPassword).NEW_PASSWORD_REQUIREDchallenge inbgagent login: when Cognito returns it, prompt the teammate for a new password, callRespondToAuthChallenge, persist the resulting tokens.LINEAR_SETUP_GUIDE.mdandUSER_GUIDE.mdteammate-onboarding sections to reflect the new flow ("you'll be prompted to set a permanent password on first login").Out of scope (future)
ForgotPassword+ConfirmForgotPassword) — needs Cognito email delivery, which means SES wiring. Park as a separate followup.admin reset-password <email>) — distinct from a user changing their own password.Files
cli/src/commands/change-password.ts(new)cli/src/commands/admin.ts— dropPermanent: truecli/src/auth.ts— handleNEW_PASSWORD_REQUIREDchallenge inlogincli/src/bin/bgagent.ts— registerchange-passwordcli/test/commands/change-password.test.ts(new)cli/test/commands/admin.test.ts— update for temp passwordcli/test/auth.test.ts— challenge-flow coveragedocs/guides/LINEAR_SETUP_GUIDE.md+docs/guides/USER_GUIDE.md— teammate-flow updatesdocs/scripts/sync-starlight.mjsVerification
bgagent change-passwordrotates an existing user's password end-to-end.admin invite-userflow: admin runs invite → teammate receives bundle + temp password → firstbgagent loginprompts them to set a permanent password → secondbgagent loginsucceeds with the new password.