Skip to content

Move reviewer credential secret capture into reviewer-entity init flow #347

@rianjs

Description

@rianjs

Problem

cr init currently lets users configure a PAT or GitHub App reviewer entity, stage it, return to the main menu, and only later asks how to handle the credentials. That makes the reviewer setup feel incomplete and surprising: the UI explains the required GitHub App keys, but the user does not get an attached, key-specific credential step until finalization.

The write semantics are still correct: no config or keyring writes should happen until Commit staged changes and exit. The UX problem is where credential values are collected and how specifically they are represented.

Related: #291, #317.

Desired behavior

After configuring a separate reviewer entity, the reviewer-entity flow should immediately present a reviewer credential step before returning to the main menu.

The step should be specific to the selected auth mode:

  • PAT reviewer: one required key, git_token.
  • GitHub App reviewer: required keys github_app_id and github_app_private_key, optional key github_app_installation_id.
  • Profile Git account reviewer: no separate reviewer credential step.

Secret values collected here must remain draft-local/in-memory until the user commits staged changes. Back without staging and Discard staged changes and exit must not write config or credentials.

Acceptance criteria

  • Configuring a new PAT reviewer shows a reviewer credential step for git_token directly after reviewer settings are staged.
  • Configuring a new GitHub App reviewer shows reviewer credential handling for github_app_id, github_app_private_key, and optional github_app_installation_id directly after reviewer settings are staged.
  • Choosing set-now stores the entered values only in the init session draft until commit.
  • Choosing defer returns to the main menu and causes commit to print follow-up cr set-credential commands for missing required keys.
  • Planned reviewer credential writes suppress duplicate finalization prompts for the same reviewer ref.
  • Existing final commit semantics remain intact: config and credential writes happen only after Commit staged changes and exit.

Empirical verification

Use tmux to drive cr init in a real PTY.

Required captures:

  • New GitHub App reviewer flow reaches a key-specific credential step immediately after staging reviewer settings.
  • Set-now path accepts app id/private key, skips optional installation id, returns to the main menu, and commit does not ask for reviewer credentials again.
  • Defer path returns to the main menu and commit prints required set-credential hints.
  • PAT reviewer path shows exactly one required reviewer secret, git_token.
  • Discard path leaves both config and credential store unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:surfaceUser-visible command surface and lifecycle commandsenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions