Skip to content

feat: offer git-profile pairing on add and use - #9

Merged
kuyacarlo merged 1 commit into
mainfrom
feat/git-profile-pairing
Aug 16, 2026
Merged

kuyacarlo merged 1 commit into
mainfrom
feat/git-profile-pairing

Conversation

@kuyacarlo

Copy link
Copy Markdown
Owner

Closes #8

What

When the companion git-profile binary is installed and the command runs on an
interactive terminal, git-ssh add <name> and git-ssh use <name> now ask
whether to hand off to git-profile so the same profile name carries both
identities.

  • add → interactive git-profile add (stdin/stdout passthrough; fills identity
    fields for the same-named profile). git-profile's add-on-existing-profile
    behavior is accepted as intended.
  • use → git-profile use <name> in the current repo.
  • Both offers are best-effort: decline or git-profile failure never fails the
    git-ssh command. Prompt is TTY-gated, so scripts/CI never see it.

Design

  • internal/gitprofile: Runner interface (Available, RunAdd, RunUse),
    default Linker (exec-based), Skip for tests/CI. No coupling to
    git-profile's config format.
  • ui.Confirm: huh-based yes/no prompt.
  • Offers wired into add (both forms) and use; terminal check + confirm +
    runner are all injectable on Root for testability.

Verification

  • go test ./... -count=1 — all packages ok (incl. new gitprofile + cmd wiring
    tests).
  • go vet ./... — clean.
  • golangci-lint: 9 errcheck issues, identical pre-existing set at branch point
    (beeabdf); none introduced by this change.
  • Manual smoke: git-ssh add <name> </dev/null (non-terminal) saves profile with
    no prompt; TTY prompt covered by injected tests.

Red/green: this is net-new behavior; the new tests exercise the added paths.

When the companion git-profile binary is installed, `git-ssh add <name>` and
`git-ssh use <name>` now ask whether to hand off to git-profile so the same
profile name carries both the SSH identity and the git identity.

The pairing is best-effort and keeps the two tools fully separate:
- detection is exec.LookPath only, no config coupling
- `add` hands off to interactive `git-profile add` (stdin/stdout passthrough)
- `use` runs `git-profile use <name>` in the current repo
- the prompt only fires on an interactive terminal; a decline or a git-profile
  failure never fails the git-ssh command

Adds internal/gitprofile with an injectable Runner (default Linker, Skip for
tests/CI), ui.Confirm, and TTY-gated offers wired into add and use.

Signed-off-by: kuyacarlo <106532351+kuyacarlo@users.noreply.github.com>
@kuyacarlo
kuyacarlo force-pushed the feat/git-profile-pairing branch from ea58456 to 7802dc5 Compare August 15, 2026 23:57
@kuyacarlo
kuyacarlo merged commit 09705a6 into main Aug 16, 2026
1 check passed
@kuyacarlo
kuyacarlo deleted the feat/git-profile-pairing branch August 16, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: offer git-profile pairing on add and use

1 participant