repown 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,29 @@ commands. How a release is cut: [docs/RELEASING.md](docs/RELEASING.md).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.7.1] - 2026-11-29
11
+
12
+ ### Added
13
+ - `docs/TROUBLESHOOTING.md` lists every message repown and git print, with its fix.
14
+
15
+ ### Changed
16
+ - The guard's refusal of commits by another address now ends with the fix:
17
+ `repown reauthor`, which rewrites that branch's unpushed commits as the pinned account,
18
+ asks first, and never pushes.
19
+ - `repown use`, when no credential is stored yet, points at `repown doctor --online` to
20
+ check the sign-in (it pointed at `repown doctor`, which can't check it).
21
+
22
+ ### Fixed
23
+ - Done on an already set-up clone offered the online sign-in check even when something
24
+ would stop the next push. It now says `sign-in not checked online: the next push will
25
+ fail: …` instead, as after a run.
26
+ - Where the push URL names a user other than the pinned account, a rejected or missing
27
+ sign-in suggested a Git Credential Manager sign-in as that user. It now says the URL
28
+ names that user, and to remove it.
29
+ - With no credential helper at all, `repown doctor` said it couldn't tell whether
30
+ "nothing" honours the per-clone pin. It now says no helper serves github.com, and how to
31
+ set up Git Credential Manager.
32
+
10
33
  ## [0.7.0] - 2026-11-28
11
34
 
12
35
  ### Added
@@ -278,9 +301,17 @@ and cmd. `status`, `doctor` and the pre-push guard are faster on Windows.
278
301
  remote, they say so, say how to fetch and count again where there is a remote to fetch,
279
302
  and offer the rebase only for when the destination has none of those commits. The URL
280
303
  is never printed (ADR-025).
281
- - `repown setup` no longer says `done` when the next push would fail. It names what is in the way, first among the review's notes, on the already-set-up screen, and in its closing line (`set up for <account>; the next push will fail: …`): commits the guard will refuse, a sign-in in the push URL, identity or token variables, `author.email` in config, a destination owner, a diverged branch, a missing upstream, a detached HEAD (ADR-026).
282
- - With the guard off, setup and status still name commits by another address, a destination owner and `GH_TOKEN`, but as a warning (`the guard is off, so …`): they no longer stop `done` or `ready` (ADR-026).
283
- - `repown status` no longer says `ready` when the next push would fail. It prints what is in the way first among its warnings (`WARN push`), and ends `the next push will fail: …`; the exit code is unchanged (ADR-026).
304
+ - `repown setup` no longer says `done` when the next push would fail. It names what is in
305
+ the way, first among the review's notes, on the already-set-up screen, and in its closing
306
+ line (`set up for <account>; the next push will fail: …`): commits the guard will refuse,
307
+ a sign-in in the push URL, identity or token variables, `author.email` in config, a
308
+ destination owner, a diverged branch, a missing upstream, a detached HEAD (ADR-026).
309
+ - With the guard off, setup and status still name commits by another address, a
310
+ destination owner and `GH_TOKEN`, but as a warning (`the guard is off, so …`): they no
311
+ longer stop `done` or `ready` (ADR-026).
312
+ - `repown status` no longer says `ready` when the next push would fail. It prints what is
313
+ in the way first among its warnings (`WARN push`), and ends `the next push will fail: …`;
314
+ the exit code is unchanged (ADR-026).
284
315
  - The re-author advice says `or pin that address` only when one address made them all.
285
316
  - The suggested `git rebase` starts at the parent of the oldest commit by another address,
286
317
  not the oldest unpushed one, so your own commits before it are never rewritten.
@@ -383,7 +414,8 @@ and cmd. `status`, `doctor` and the pre-push guard are faster on Windows.
383
414
  contract for scripts.
384
415
  - Runs on Node 20+ on Windows, macOS and Linux, with zero runtime dependencies.
385
416
 
386
- [Unreleased]: https://github.com/makubexD/repown/compare/v0.7.0...HEAD
417
+ [Unreleased]: https://github.com/makubexD/repown/compare/v0.7.1...HEAD
418
+ [0.7.1]: https://github.com/makubexD/repown/compare/v0.7.0...v0.7.1
387
419
  [0.7.0]: https://github.com/makubexD/repown/compare/v0.6.0...v0.7.0
388
420
  [0.6.0]: https://github.com/makubexD/repown/compare/v0.5.5...v0.6.0
389
421
  [0.5.5]: https://github.com/makubexD/repown/compare/v0.5.4...v0.5.5
package/README.md CHANGED
@@ -96,9 +96,19 @@ cd ~/code/my-repo
96
96
  repown # in a terminal: starts the guided setup of this clone
97
97
  ```
98
98
 
99
+ > 👤 **Only one account?** repown still helps: it pins each clone, so a global identity that
100
+ > changes (an IDE, a CI script, a work email set machine-wide) can't leak into its commits;
101
+ > the guard checks every push; and `repown doctor --online` checks the sign-in. You need
102
+ > only `repown doctor` once and `repown` in each clone.
103
+
99
104
  1. **`repown doctor`, once per machine.** It ends with a verdict:
100
105
  - 🟢 `ready: each clone signs in as its own account through Git Credential Manager`
106
+ - 🟢 `ready · no accounts stored yet: the first push signs in once`
101
107
  - 🔴 `1 problem: gh answers git's sign-in requests: run repown fix`
108
+ - 🟡 `unchecked: repown can't tell whether <helper> honours the per-clone pin` (often
109
+ macOS's `osxkeychain`: install GCM, then `git credential-manager configure`)
110
+ - 🟡 `unchecked: no credential helper serves github.com: git credential-manager configure`
111
+ (often Linux: install GCM first)
102
112
 
103
113
  If gh is the helper, or something is missing, see [Troubleshooting](#troubleshooting).
104
114
  2. **Clone as usual,** then from inside a new clone just type **`repown`.** That starts
@@ -106,20 +116,22 @@ repown # in a terminal: starts the guided setup of this clone
106
116
  in first: pick the account that owns it.) It asks how setup should work. Recommended is
107
117
  the default. Answers it fills in still appear in the review.
108
118
 
109
- | Question | Recommended | Step by step | Flag |
110
- | --- | --- | --- | --- |
111
- | Which account should this clone belong to? | Asked. `repown setup <account>` skips the mode question and uses Recommended, so a recorded account goes straight to the review when nothing else must be asked. A new account also asks where it's hosted, the name and the email. | Asked | `<account>`, `--host`, `--name`, `--email` |
112
- | Push through the remote instead of a URL? Asked when the branch pushes to a URL (which can carry its own sign-in) that names the same repository as a remote here. The review shows the key and the remote, never the URL. | Answers Yes without asking | Asked, default Yes | `--repoint` |
113
- | Fetch the remote first? Asked when commits by another address wait behind a remote this clone has never fetched, so repown can count which it already has. Prompts are off; a failed fetch is a warning. | Answers Yes without asking | Asked, default Yes | `--fetch` |
114
- | Let this clone push to origin's owner? Asked when origin belongs to someone else, like an organisation. | Asked, default Yes. No means the guard refuses pushes there. | Asked, default Yes | `--allow-owner <owner>` |
115
- | Turn the guard on? | Answers Yes without asking | Asked | `--guard` |
116
- | Push branches without -u? Only on git 2.37+. It sets `push.autoSetupRemote` in this clone only; the guard still checks that first push. | Answers Yes without asking | Asked, default Yes | `--auto-upstream` |
117
- | gh. "Switch gh too" makes `gh pr create` match. | Switches without asking when gh already lists the account and the clone is not already pinned to it. A sign-in, which opens a browser, is asked, default No. Skips the question when the clone is already pinned to that account. | Asked | `--gh` |
118
- | Take git's sign-ins back from gh? Machine-wide. | Asked, default No. Answer Yes if `repown doctor` said gh is the helper, or pushes from your other account's clones fail. | Asked, default No | `--fix` |
119
- | Re-author your unpushed commits by another address as this account? Asked when commits you made before pinning (or an IDE made) carry another email. Only if you made them. It runs last, as `repown reauthor --yes`: it fetches first, rewrites only what no remote has, keeps a backup, and never pushes. | Asked, default No. Enter at the review is Decline when this is a step. | Asked, default No; Enter at the step is Skip | `--reauthor` |
120
-
121
- Step by step asks every question: `--step-by-step`.
122
- `--no-input` asks nothing ([scripts and CI](docs/CONFIGURATION.md#scripts-and-ci)).
119
+ Only the questions that apply to this clone are asked:
120
+
121
+ | Question | Recommended | Flag |
122
+ | --- | --- | --- |
123
+ | Which account should this clone belong to? (a new one also asks host, name, email) | Asked | `<account>`, `--host`, `--name`, `--email` |
124
+ | Let this clone push to origin's owner, such as an organisation? | Asked, default Yes | `--allow-owner <owner>` |
125
+ | Turn the guard on? · Push branches without `-u`? (git 2.37+) · Push through the remote instead of a URL? · Fetch the remote first? | Yes, without asking | `--guard`, `--auto-upstream`, `--repoint`, `--fetch` |
126
+ | Switch gh too, so `gh pr create` matches? | Yes without asking when gh lists the account and the clone isn't already pinned to it; a gh sign-in (a browser) is asked, default No | `--gh` |
127
+ | Take git's sign-ins back from gh? (machine-wide: answer Yes if `repown doctor` said gh is the helper) | Asked, default No | `--fix` |
128
+ | Re-author your unpushed commits by another address? (only if you made them; runs last, as `repown reauthor --yes`) | Asked, default No | `--reauthor` |
129
+
130
+ `repown setup <account>` skips the mode question and uses Recommended, so a recorded
131
+ account goes straight to the review when nothing else must be asked. Step by step asks
132
+ every question: `--step-by-step`. `--no-input` asks nothing
133
+ ([scripts and CI](docs/CONFIGURATION.md#scripts-and-ci)). When each one is asked, and its
134
+ default: [card 13](docs/HOW-IT-WORKS.md#13-guided-setup).
123
135
 
124
136
  - **In your first clone,** it lists the accounts it can already see on GitHub (origin's
125
137
  owner, gh's accounts, Git Credential Manager's) and suggests origin's owner when that
@@ -166,8 +178,9 @@ repown # in a terminal: starts the guided setup of this clone
166
178
  `done … · origin accepts the sign-in` only when it passes
167
179
  ([card 13](docs/HOW-IT-WORKS.md#13-guided-setup)).
168
180
 
169
- 4. **Push.** The first push from each account signs in once: GCM opens a browser, and you
170
- sign in as *that* clone's account, not whichever you used last. After that, pushes from
181
+ 4. **Push.** The first push from each account signs in once (unless you accepted the
182
+ sign-in that setup's check offered): GCM opens a browser, and you sign in as *that* clone's account,
183
+ not whichever you used last. After that, pushes from
171
184
  that clone use it without asking. When setup set `push.autoSetupRemote`, the first
172
185
  `git push` of a branch without an upstream also creates it on origin. When it did not
173
186
  (older git, a version repown could not read, or you answered No), use
@@ -204,8 +217,10 @@ with no account and no flags, and setup opens on this screen, before any questio
204
217
  └
205
218
  ```
206
219
 
207
- **Done** changes nothing. **Use another account** asks which account this clone should
208
- use. When gh acts as someone else, a third option is **Sign in to gh as `<account>`** (or
220
+ **Done** changes nothing, then, when nothing blocks the next push, offers the same sign-in
221
+ check as after a run (otherwise it says
222
+ `sign-in not checked online: the next push will fail: …`). **Use another account** asks
223
+ which account this clone should use. When gh acts as someone else, a third option is **Sign in to gh as `<account>`** (or
209
224
  **Make `<account>` gh's active account** when gh already lists it) and runs
210
225
  `repown use <account> --gh`. With unpushed commits by another address, **Re-author them**
211
226
  is offered too (`repown reauthor --yes`). The upstream line shows the tracked branch (for example
@@ -290,31 +305,29 @@ note, not a warning. Every warning it can print:
290
305
  | --- | --- | --- | --- | --- |
291
306
  | In general | Success | Failure or refusal | Usage error | 130 when setup or the start screen is cancelled |
292
307
  | `repown scan` | Whatever it finds (read its output or JSON) | | A missing folder or a bad `--depth` | |
293
- | `repown setup` | Done, or already set up | Decline, or it can't start | Flags that don't fit, or no terminal without `--no-input` | 130 when cancelled or interrupted; a failing step's own code |
308
+ | `repown setup` | Done, or already set up. A sign-in the last step found refused is said in the closing line, not the exit code | Decline, or it can't start | Flags that don't fit, or no terminal without `--no-input` | 130 when cancelled or interrupted; a failing step's own code |
294
309
  | `repown status` | Success. Warnings alone exit 0 | A problem | | |
295
- | `repown doctor --online` | Ready, and the remote accepts the sign-in | A problem, or the remote refused the sign-in | | 3 when the sign-in couldn't be checked (no network, no commit, no remote) |
310
+ | `repown doctor --online` | Ready, and the remote accepts the sign-in | A problem, or the remote refused the sign-in | | 3 when the sign-in wasn't confirmed: no network, a timeout, no commit, no remote, or an answer repown can't classify (the `WARN` shows git's reason). 1 instead if the offline checks already failed |
296
311
 
297
312
  Every `setup` case: [Scripts and CI](docs/CONFIGURATION.md#scripts-and-ci).
298
313
 
299
314
  ## Troubleshooting
300
315
 
316
+ Start with `repown` in the clone, `repown doctor`, then `repown doctor --online`. The most
317
+ common cases:
318
+
301
319
  | What happened | What to do |
302
320
  | --- | --- |
303
321
  | `repown doctor` says gh is the helper | `repown fix` ([card 1](docs/HOW-IT-WORKS.md#1-set-up-the-machine)) |
304
- | `repown doctor` shows `GCM` … `not found` | install Git Credential Manager ([Install](#install)), then `repown doctor` again |
305
- | `repown doctor` shows `helper` … `none configured` | `git credential-manager configure`, then `repown doctor` again |
306
322
  | A push asked for a password | `repown status` (this clone) or `repown doctor` (this machine): each names the cause (gh as the helper, or no helper) and the fix |
307
- | A push failed right after signing in (SSO) | [card 6](docs/HOW-IT-WORKS.md#6-commit-and-first-push) |
308
- | A pinned clone still can't push or pull ("Invalid username or token", "SAML SSO", 403, 404) | `repown doctor --online`: it says whether the token was rejected, needs SSO approval, or belongs to the wrong account, and the command or link that fixes it. In a terminal it offers to run the fix, then checks again |
309
- | The guard refused a push | it says which commit and the fix. Most often a commit made before pinning: `git commit --amend --reset-author --no-edit` fixes the last one ([card 8](docs/HOW-IT-WORKS.md#8-push-refused-and-the-fix) for older ones, and every other refusal) |
323
+ | A pinned clone still can't push or pull ("Invalid username or token", "SAML SSO", 403, 404) | `repown doctor --online`: it tells a rejected or missing token, an SSO approval, the wrong account, a repository that account can't see, and an SSH key, host key or deploy key problem apart, with the command or link that fixes it. In a terminal it offers to run the fix, then checks again |
324
+ | The guard refused a push: commits by another address | most often made before pinning: `repown reauthor` (fetches, rewrites only what no remote has, keeps a backup, never pushes); for just the last one, `git commit --amend --reset-author --no-edit`. Every other refusal: [card 8](docs/HOW-IT-WORKS.md#8-push-refused-and-the-fix) |
325
+ | The guard said the push goes to another owner (on Azure DevOps, the organisation) | if you're a member or collaborator there: `git config --local --add repown.allowOwner <owner>` |
310
326
  | `gh pr create` acts as the wrong account | `gh auth switch -u <account>` when gh lists it, otherwise `repown use <account> --gh` |
311
- | `git push` says the branch has no upstream | `repown setup --auto-upstream`, or once `git push -u origin <branch>` |
312
- | The first push opened a browser | Expected, once per account. Git Credential Manager stores it |
313
- | The guard said the push goes to another owner | if you're a member or collaborator there: `git config --local --add repown.allowOwner <owner>` |
314
- | The guard said `GH_TOKEN` (or `GITHUB_TOKEN`, `GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_EMAIL`) is set | unset it, then push again: the email variables override the pinned identity, and the token variables make gh serve that token |
315
- | husky or another tool owns the pre-push hook | have that hook run `repown guard check --remote="$1" --url="$2"`, passing its stdin through; if the hook is committed, make it skip teammates without repown ([card 10](docs/HOW-IT-WORKS.md#10-other-hook-tools)) |
316
- | An Azure DevOps push is refused as "wrong owner" | the owner there is the organisation: allow it with `git config --local --add repown.allowOwner <organisation>` |
317
- | "repown cannot be found" on push | [card 12](docs/HOW-IT-WORKS.md#12-uninstall-or-repown-missing) |
327
+
328
+ 📖 Everything else, by the exact message you see (doctor's and status's every line, setup's
329
+ closing line, git's own errors, a missing `repown`, the macOS and Linux helpers):
330
+ [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md).
318
331
 
319
332
  A refused push:
320
333
 
@@ -323,6 +336,7 @@ FAIL guard 1 commit(s) bound for refs/heads/main were not authored as octo
323
336
  6e7b31adb someone@example.invalid someone else's commit
324
337
 
325
338
  These addresses become permanent once pushed.
339
+ fix: repown reauthor (on that branch: rewrites the unpushed ones as the pinned account; asks first, never pushes)
326
340
 
327
341
 
328
342
  Push stopped by the repown identity guard (above).
@@ -356,7 +370,7 @@ $ repown use octocat
356
370
  OK identity Octo Cat <octocat@users.noreply.github.com> push-as:octocat
357
371
 
358
372
  No stored credential for "octocat" yet -- the first push signs in
359
- once, then never again. Verify it afterwards: repown doctor
373
+ once, then never again. To sign in and check now: repown doctor --online
360
374
 
361
375
  Next: repown guard on (check every push before it leaves)
362
376
 
@@ -392,6 +406,7 @@ want it back: `gh auth setup-git`. Details, and submodules:
392
406
  | --- | --- |
393
407
  | every scenario, with diagrams | [docs/HOW-IT-WORKS.md](docs/HOW-IT-WORKS.md) |
394
408
  | environment variables, where accounts are kept, per-clone keys, scripts and JSON | [docs/CONFIGURATION.md](docs/CONFIGURATION.md) |
409
+ | what a message means, and the command that fixes it | [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) |
395
410
  | short answers, and how repown compares with `includeIf`, SSH aliases and `gh auth switch` | [docs/FAQ.md](docs/FAQ.md) |
396
411
  | to contribute, see where each feature lives in the code, or try it on throwaway repositories | [CONTRIBUTING.md](CONTRIBUTING.md) |
397
412
  | to report a vulnerability privately | [SECURITY.md](SECURITY.md) |
@@ -374,12 +374,20 @@ function ghHelperFiles(auth) {
374
374
  out.detail(' ' + file);
375
375
  }
376
376
  function diagnoseUnknownHelper(auth) {
377
- const helper = out.printable(auth.helper ?? 'nothing');
377
+ if (!auth.helper)
378
+ return diagnoseNoHelper();
379
+ const helper = out.printable(auth.helper);
378
380
  out.warn('helper', 'github.com is served by "' + helper + '", which repown has no opinion about.');
379
381
  out.detail('The per-repository pin (credential.<url>.username) only works if');
380
382
  out.detail('that helper honours it.');
381
383
  return { code: 0, verdict: unchecked(helper) };
382
384
  }
385
+ /** Nothing serves github.com, so a push has nothing to sign in with: say so, and the fix. */
386
+ function diagnoseNoHelper() {
387
+ out.warn('helper', 'no credential helper serves github.com, so a push has nothing to sign in with.');
388
+ out.detail('Install Git Credential Manager (Git for Windows includes it), then: git credential-manager configure');
389
+ return { code: 0, verdict: 'unchecked: no credential helper serves github.com: git credential-manager configure' };
390
+ }
383
391
  function unchecked(helper) {
384
392
  return 'unchecked: repown can\'t tell whether ' + helper + ' honours the per-clone pin';
385
393
  }
@@ -295,6 +295,6 @@ async function credentialConcern(account, repo) {
295
295
  else if (auth.gcmPresent && auth.stored.ok && !auth.stored.value.includes(account)) {
296
296
  out.line();
297
297
  out.line(' No stored credential for "' + account + '" yet -- the first push signs in');
298
- out.line(' once, then never again. Verify it afterwards: repown doctor');
298
+ out.line(' once, then never again. To sign in and check now: repown doctor --online');
299
299
  }
300
300
  }
@@ -83,8 +83,8 @@ export async function listAccounts(gcmPath, namespace) {
83
83
  }
84
84
  /**
85
85
  * GCM's own github.com sign-in, with the terminal handed to it (ADR-032): the browser opens,
86
- * the user signs in, and GCM stores the token. repown sees nothing GCM prints. The command is
87
- * GCM 2.6.1's; `--force` over an account GCM already holds is not yet measured (ADR-032).
86
+ * the user signs in, and GCM stores the token. repown sees nothing GCM prints. Measured on
87
+ * GCM 2.6.1, over an account GCM already holds too (ADR-032).
88
88
  * Offered only for github.com with GCM as the helper.
89
89
  */
90
90
  export async function gcmGithubLogin(account, runner = inherit) {
@@ -210,6 +210,8 @@ async function rangeFor(git, ref, exclude) {
210
210
  const known = !isZero(ref.remoteSha) && await git.hasCommit(ref.remoteSha);
211
211
  return known ? [ref.remoteSha + '..' + ref.localSha, ...exclude] : [ref.localSha, ...exclude];
212
212
  }
213
+ /** reauthor rewrites this branch's commits no remote has, after asking; it never pushes (ADR-026). */
214
+ const REAUTHOR_FIX = 'fix: repown reauthor (on that branch: rewrites the unpushed ones as the pinned account; asks first, never pushes)';
213
215
  /** Each commit shows the address that is WRONG -- the committer's, when the author is right. */
214
216
  function foreignRefusal(ref, foreign, expected) {
215
217
  const shown = foreign.slice(0, 10).map((commit) => {
@@ -221,7 +223,7 @@ function foreignRefusal(ref, foreign, expected) {
221
223
  return {
222
224
  reason: foreign.length + ' commit(s) bound for ' + ref.remoteRef +
223
225
  ' were not authored as ' + expected + ', or were committed by someone else.',
224
- detail: [...shown, ...more, '', 'These addresses become permanent once pushed.'],
226
+ detail: [...shown, ...more, '', 'These addresses become permanent once pushed.', REAUTHOR_FIX],
225
227
  };
226
228
  }
227
229
  /** A fetch cures a missing object; it does nothing for history git printed in a shape repown cannot parse. */
@@ -58,6 +58,9 @@ function ssoFix(link) {
58
58
  function signInFix(ctx) {
59
59
  if (isGh(ctx.helper))
60
60
  return ['gh signs in as its active account; undo it: repown fix'];
61
+ // A username in the URL outranks the pin, so the URL is the fix (ADR-032), not a login as it.
62
+ if (urlNamesOther(ctx))
63
+ return [fromUrlFix(ctx.account)];
61
64
  if (!ctx.helper)
62
65
  return ['no credential helper serves this URL; install Git Credential Manager, then: repown doctor --online'];
63
66
  if (!isGcm(ctx.helper))
@@ -65,6 +68,18 @@ function signInFix(ctx) {
65
68
  const command = ctx.github && ctx.account ? gcmLogin(ctx.account) : null;
66
69
  return [command ? 'sign in again: ' + command : 'sign in again through Git Credential Manager; a push in a terminal asks'];
67
70
  }
71
+ /**
72
+ * The push URL names a user other than the pinned account, so removing it is the fix. The
73
+ * pinned account itself in the URL changes nothing: git sends the same name either way.
74
+ */
75
+ export function urlNamesOther(ctx) {
76
+ if (!ctx.fromUrl)
77
+ return false;
78
+ return !ctx.account || !ctx.pinned || ctx.account.toLowerCase() !== ctx.pinned.toLowerCase();
79
+ }
80
+ function fromUrlFix(user) {
81
+ return 'the push URL names ' + (user ?? 'a user') + ', so git signs in as it; remove it (repown status prints the command)';
82
+ }
68
83
  /** GCM's sign-in for github.com (measured, GCM 2.6.1); null when no shell quotes the account. */
69
84
  export function gcmLogin(account) {
70
85
  return copyableCommand(['git', 'credential-manager', 'github', 'login', '--username', account, '--browser', '--force']);
@@ -89,7 +104,7 @@ function denied(as, ctx) {
89
104
  if (ctx.account.toLowerCase() === pinned.toLowerCase())
90
105
  return { level: 'fail', message, fix: storedFor(ctx) };
91
106
  if (ctx.fromUrl)
92
- return { level: 'fail', message, fix: ['the push URL names ' + as + '; remove it (repown status prints the command)'] };
107
+ return { level: 'fail', message, fix: [fromUrlFix(as)] };
93
108
  const command = copyableCommand(['repown', 'use', pinned]);
94
109
  return { level: 'fail', message, fix: [command ? 'use the pinned account: ' + command : 'pin ' + pinned + ' again with repown use'] };
95
110
  }
@@ -7,6 +7,7 @@
7
7
  // edit). Everything else stays printed advice.
8
8
  import { isGcm } from './credential/gcm.js';
9
9
  import { isGh } from './credential/gh.js';
10
+ import { urlNamesOther } from './signin-check.js';
10
11
  /** Null when there is nothing repown can run for this verdict. */
11
12
  export function repairFor(verdict, ctx) {
12
13
  if (verdict.kind === 'sso')
@@ -22,15 +23,15 @@ export function repairFor(verdict, ctx) {
22
23
  */
23
24
  function deniedRepair(as, ctx) {
24
25
  const same = (a, b) => a.toLowerCase() === b.toLowerCase();
25
- if (ctx.fromUrl || !ctx.pinned || !as || same(as, ctx.pinned) || !ctx.account)
26
+ if (urlNamesOther(ctx) || !ctx.pinned || !as || same(as, ctx.pinned) || !ctx.account)
26
27
  return null;
27
28
  return same(ctx.account, ctx.pinned) ? signInRepair(ctx) : { kind: 'use', account: ctx.pinned };
28
29
  }
29
30
  function signInRepair(ctx) {
30
31
  if (isGh(ctx.helper))
31
32
  return { kind: 'fix' };
32
- // A username in the URL is the blocker to remove, never an account to sign in as.
33
- return isGcm(ctx.helper) && ctx.github && ctx.account && !ctx.fromUrl ? { kind: 'login', account: ctx.account } : null;
33
+ // A username in the URL other than the pin is the blocker to remove, never an account to sign in as.
34
+ return isGcm(ctx.helper) && ctx.github && ctx.account && !urlNamesOther(ctx) ? { kind: 'login', account: ctx.account } : null;
34
35
  }
35
36
  /**
36
37
  * The question before running it, or null when the repair asks its own: `repown fix` shows
@@ -198,12 +198,20 @@ async function runGuided(given, ctx, guided) {
198
198
  return stoppedBefore(outcome.status, guided.prompter);
199
199
  return runAccepted(outcome.answers, ctx, guided);
200
200
  }
201
- /** Already set up: nothing to run, and the sign-in check is still offered (ADR-032). */
201
+ /**
202
+ * Already set up: nothing to run, and the sign-in check is still offered, as after a run only
203
+ * with nothing in the way of the next push (ADR-032); the review above listed what is.
204
+ */
202
205
  async function settled({ git, prompter, signIn }) {
203
206
  prompter.outro?.('Nothing changed: this clone was already set up');
204
207
  if (!signIn)
205
208
  return 0;
206
209
  prompter.close();
210
+ const first = await firstBlocking(git);
211
+ if (first) {
212
+ out.detail(out.marked('warn', process.stderr, 'sign-in not checked online: the next push will fail: ' + printable(first.summary)));
213
+ return 0;
214
+ }
207
215
  const online = await signInAfterSetup(signIn, git);
208
216
  if (online)
209
217
  out.detail(signInLine(online));
@@ -395,6 +403,11 @@ function closing({ account, found }, online) {
395
403
  for (const line of found.flatMap((blocker) => blocker.lines))
396
404
  out.detail(indent + printable(line));
397
405
  }
406
+ /** What stops the next push of a settled clone, read now; none without a pinned account. */
407
+ async function firstBlocking(git) {
408
+ const account = await git.getConfig('repown.account', 'local');
409
+ return account ? (await blockersNow(git, account)).find((blocker) => blocker.blocks) : undefined;
410
+ }
398
411
  /** Re-read after the run: a step may have fixed what the review showed, or not. */
399
412
  async function blockersNow(git, account) {
400
413
  const email = await git.getConfig('user.email', 'local') ?? '';
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "repown",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "repown",
9
- "version": "0.7.0",
9
+ "version": "0.7.1",
10
10
  "license": "MIT",
11
11
  "bin": {
12
12
  "repown": "dist/cli.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repown",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Use several git accounts on one machine: each repo owns its identity, so you move between repos with no switch command and never push the wrong one.",
5
5
  "repository": {
6
6
  "type": "git",