repown 0.1.0 → 0.2.0

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.
@@ -0,0 +1,459 @@
1
+ // `repown setup` from start to finish: turn flags into answers, check them, ask for
2
+ // the rest (or not, with --no-input), and run the commands the review showed --
3
+ // the same `run()` each command's own parser dispatches to, so there is one code
4
+ // path, not a wizard's copy of it.
5
+ //
6
+ // Nothing is written before the commands run. Cancelling exits 130, declining 1.
7
+ import { ghAdvice } from "../commands/status.js";
8
+ import { handingOver } from "../core/exec.js";
9
+ import { ok, err } from "../core/result.js";
10
+ import { inspectAuth } from "../core/inspect.js";
11
+ import { flagBool, flagString, gitFor, parseArgs } from "../ui/args.js";
12
+ import { specFor } from "../ui/command.js";
13
+ import * as out from "../ui/format.js";
14
+ import { useColour } from "../ui/format.js";
15
+ import useCommand, { NEXT_GUARD } from "../commands/use.js";
16
+ import fixCommand from "../commands/fix.js";
17
+ import guardGroup from "../commands/guard.js";
18
+ import accountsGroup from "../commands/accounts.js";
19
+ import { wizard, refusedGiven } from "./engine.js";
20
+ import { setupFlow, planCommands, formatCommand, briefOf, missingFlags, printable, dropFixPrefix, NEW_ACCOUNT, accountOf, pinUnchanged, ghNoted } from "./setup-flow.js";
21
+ import { cloneChangeLines, machineChangeLines, readCloneSnapshot } from "./setup-changes.js";
22
+ import { readContext, readRegistry } from "./setup-context.js";
23
+ import { plainPrompter } from "./plain.js";
24
+ const CANCELLED = 130;
25
+ export async function runSetup(args, deps) {
26
+ const registry = await readRegistry();
27
+ if (!registry.ok) {
28
+ out.fail('setup', registry.error);
29
+ return 1;
30
+ }
31
+ const given = givenFrom(args, registry.value.accounts);
32
+ if (!given.ok)
33
+ return usage(given.error);
34
+ const unattended = flagBool(args, 'no-input');
35
+ if (!deps.interactive && !unattended)
36
+ return needsTerminal(given.value, registry.value.accounts);
37
+ const git = gitFor(args);
38
+ if (!(await git.isRepo())) {
39
+ out.fail('setup', 'Not a git repository: ' + git.cwd);
40
+ out.detail('run it inside a clone: cd path/to/repo, then repown setup');
41
+ return 1;
42
+ }
43
+ const prompter = unattended ? null : deps.prompter ?? await choosePrompter();
44
+ try {
45
+ return await continueSetup({
46
+ args, git, given: given.value, prompter, accountKind: deps.accountKind, readAuth: deps.auth ?? inspectAuth,
47
+ ...(deps.preview ? { preview: deps.preview } : {}),
48
+ });
49
+ }
50
+ finally {
51
+ prompter?.close();
52
+ }
53
+ }
54
+ async function continueSetup({ args, git, given, prompter, accountKind, readAuth, preview }) {
55
+ prompter?.intro?.('repown setup');
56
+ prompter?.busy?.('Reading this clone and this machine');
57
+ const ctx = await readContext(git, flagString(args, 'cwd'), contextOptions(prompter, accountKind, preview));
58
+ if (!ctx.ok) {
59
+ out.fail('setup', ctx.error);
60
+ return 1;
61
+ }
62
+ const answers = checkAgainst(given, ctx.value, flagString(args, 'allow-owner'));
63
+ if (!answers.ok)
64
+ return answers.error;
65
+ if (!prompter)
66
+ return runUnattended(answers.value, ctx.value, git, readAuth);
67
+ return runGuided(answers.value, ctx.value, { git, prompter, readAuth });
68
+ }
69
+ function contextOptions(prompter, accountKind, preview) {
70
+ const classifyOwner = prompter !== null;
71
+ const auth = preview ? { auth: preview } : {};
72
+ return accountKind ? { classifyOwner, accountKind, ...auth } : { classifyOwner, ...auth };
73
+ }
74
+ /** Flags as the answers they stand for. An account that isn't recorded is a new one. */
75
+ function givenFrom(args, recorded) {
76
+ const answers = {};
77
+ const account = args.positional[0];
78
+ const known = account !== undefined && Object.hasOwn(recorded, account);
79
+ if (account !== undefined)
80
+ Object.assign(answers, known ? { account } : { account: NEW_ACCOUNT, newAccount: account });
81
+ // --name, --email and --host describe a new account: with them, the account is a new one.
82
+ const describesNew = ['name', 'email', 'host'].some((key) => flagString(args, key) !== null);
83
+ if (account === undefined && describesNew)
84
+ answers['account'] = NEW_ACCOUNT;
85
+ for (const key of ['name', 'email', 'host']) {
86
+ const value = flagString(args, key);
87
+ if (value !== null)
88
+ answers[key] = value;
89
+ }
90
+ if (known && ['name', 'email', 'host'].some((key) => answers[key] !== undefined)) {
91
+ return err('"' + account + '" is already recorded: --name, --email and --host describe a new account' +
92
+ '\nto change it, record it again: repown accounts add ' + account + ' --name "..." --email "..."');
93
+ }
94
+ applyConfirms(args, answers);
95
+ return modeOf(args, answers);
96
+ }
97
+ /** `--step-by-step` asks every question. An account on the command line uses Recommended and skips the question. */
98
+ function modeOf(args, answers) {
99
+ if (flagBool(args, 'step-by-step') && flagBool(args, 'no-input'))
100
+ return err('--step-by-step needs a terminal to ask');
101
+ if (flagBool(args, 'step-by-step'))
102
+ answers['mode'] = 'step';
103
+ else if (args.positional[0] !== undefined)
104
+ answers['mode'] = 'recommended';
105
+ return ok(answers);
106
+ }
107
+ const CONFIRM_FLAGS = ['gh', 'guard', 'fix'];
108
+ const CONFIRM_DEFAULTS = ['gh', 'allowOwner', 'guard', 'fix', 'upstream'];
109
+ /** A passed flag is Yes. With --no-input, a confirm that was not passed is No, not Recommended's Yes. */
110
+ function applyConfirms(args, answers) {
111
+ for (const key of CONFIRM_FLAGS)
112
+ if (flagBool(args, key))
113
+ answers[key] = true;
114
+ if (flagBool(args, 'auto-upstream'))
115
+ answers['upstream'] = true;
116
+ if (flagString(args, 'allow-owner') !== null)
117
+ answers['allowOwner'] = true;
118
+ if (flagBool(args, 'no-input'))
119
+ for (const key of CONFIRM_DEFAULTS)
120
+ answers[key] ??= false;
121
+ }
122
+ function usage(message) {
123
+ const [first, ...rest] = message.split('\n');
124
+ out.fail('setup', first ?? message);
125
+ for (const line of rest)
126
+ out.detail(line);
127
+ out.detail('run `repown help setup` for usage');
128
+ return 2;
129
+ }
130
+ function needsTerminal(given, recorded) {
131
+ out.fail('setup', 'needs a terminal to ask its questions.');
132
+ out.detail('without one, give the answers as flags and add --no-input:');
133
+ out.detail(' repown setup <account> [--name "..." --email "..."] [--gh] [--allow-owner <owner>] [--guard] [--auto-upstream] [--fix] --no-input');
134
+ const missing = missingFlags(given, recorded);
135
+ if (missing.length > 0)
136
+ out.detail('still needed: ' + missing.join(', '));
137
+ return 2;
138
+ }
139
+ /** Flags checked against this clone: the same rules a typed answer meets, before anything is written. */
140
+ function checkAgainst(given, ctx, allowOwner) {
141
+ const answers = { ...given };
142
+ if (allowOwner !== null) {
143
+ if (!ctx.owner || allowOwner.toLowerCase() !== ctx.owner.toLowerCase()) {
144
+ return err(usage(printable('--allow-owner ' + allowOwner + ': origin belongs to ' + (ctx.owner ? '"' + ctx.owner + '"' : 'no owner repown can read'))));
145
+ }
146
+ }
147
+ const refused = refusedGiven(setupFlow(ctx), answers);
148
+ if (refused.length > 0)
149
+ return err(usage(refused.join('\n')));
150
+ if (answers['guard'] === true && (ctx.guard === 'foreign' || ctx.redirected)) {
151
+ out.fail('setup', '--guard: ' + (ctx.redirected ? 'core.hooksPath points hooks elsewhere' : 'another tool owns the pre-push hook') + '; nothing was changed');
152
+ out.detail('see: repown guard status');
153
+ return err(1);
154
+ }
155
+ if (answers['fix'] === true && ctx.fixLines === null) {
156
+ out.detail('--fix: gh is not the credential helper for this clone, so there is nothing to undo');
157
+ answers['fix'] = false;
158
+ }
159
+ return ok(answers);
160
+ }
161
+ // ------------------------------------------------------------------- the runs
162
+ async function runUnattended(answers, ctx, git, readAuth) {
163
+ const missing = missingFlags(answers, ctx.recorded);
164
+ if (missing.length > 0)
165
+ return usage('--no-input, but still needed: ' + missing.join(', '));
166
+ return execute(planCommands(answers, ctx), { ...runState(git, readAuth, ctx), ...reported(answers, ctx, true) });
167
+ }
168
+ async function runGuided(given, ctx, guided) {
169
+ const outcome = await wizard(setupFlow(ctx), ctx, given, guided.prompter);
170
+ if (outcome.status === 'done') {
171
+ guided.prompter.outro?.('Nothing changed: this clone was already set up');
172
+ return 0;
173
+ }
174
+ if (outcome.status !== 'run')
175
+ return stoppedBefore(outcome.status, guided.prompter);
176
+ return runAccepted(outcome.answers, ctx, guided);
177
+ }
178
+ async function runAccepted(answers, ctx, { git, prompter, readAuth }) {
179
+ prompter.outro?.('Running the commands');
180
+ const confirm = gateFor(prompter, answers, ctx);
181
+ // Recommended hands the terminal over now. Step by step keeps it for each question.
182
+ if (!confirm)
183
+ prompter.close();
184
+ const state = { ...runState(git, readAuth, ctx), ...reported(answers, ctx, !ghNoted(answers, ctx)) };
185
+ const code = await execute(planCommands(answers, ctx), confirm ? { ...state, confirm } : state);
186
+ if (confirm)
187
+ prompter.close();
188
+ return code;
189
+ }
190
+ function gateFor(prompter, answers, ctx) {
191
+ if (answers['mode'] !== 'step')
192
+ return undefined;
193
+ return (planned) => askStep(prompter, planned, answers, ctx);
194
+ }
195
+ async function askStep(prompter, planned, answers, ctx) {
196
+ const choice = await prompter.confirmStep(briefOf(planned, answers, ctx));
197
+ prompter.suspend?.();
198
+ return choice;
199
+ }
200
+ /** One closing line: what happened, that nothing changed, and how to start again. */
201
+ function stoppedBefore(status, prompter) {
202
+ const cancelled = status === 'cancelled';
203
+ const message = (cancelled ? 'Cancelled' : 'Declined') + ': nothing was changed. Run repown setup again any time.';
204
+ if (prompter.outro)
205
+ prompter.outro(message, cancelled);
206
+ else
207
+ out.warn('setup', message);
208
+ return cancelled ? CANCELLED : 1;
209
+ }
210
+ /**
211
+ * @clack/prompts when colour is on for stderr and the terminal can draw it; the plain
212
+ * prompter otherwise, and whenever the optional dependency is absent or fails to load
213
+ * (an older Node skips installing it, ADR-016) -- said once, then carried on.
214
+ */
215
+ async function choosePrompter() {
216
+ const streams = { input: process.stdin, output: process.stderr };
217
+ if (!useColour(process.stderr) || process.env['TERM'] === 'dumb')
218
+ return plainPrompter(streams);
219
+ try {
220
+ return (await import("./clack.js")).clackPrompter(streams);
221
+ }
222
+ catch (cause) {
223
+ out.detail('plain prompts: the richer prompter could not load (' + (cause instanceof Error ? cause.message : String(cause)) + ')');
224
+ return plainPrompter(streams);
225
+ }
226
+ }
227
+ function runState(git, readAuth, ctx) {
228
+ return { git, readAuth, credentialKeys: ctx.credentialKeys };
229
+ }
230
+ function reported(answers, ctx, repeatGh) {
231
+ return { account: accountOf(answers), pinnedAlready: pinUnchanged(answers, ctx), repeatGh };
232
+ }
233
+ /**
234
+ * Runs the plan in order and stops at the first failure. In step-by-step mode each
235
+ * step is confirmed first: Skip leaves it unrun, Stop (and Esc) runs nothing more.
236
+ * Ctrl-C stops the steps that have not run (exit 130), except while an inherited
237
+ * child is running: that Ctrl-C belongs to gh, and the remaining steps still run.
238
+ * The clone is read before the first step and again after, including a stop or a failure.
239
+ */
240
+ async function execute(plan, state) {
241
+ const before = await readCloneSnapshot(state.git, state.credentialKeys);
242
+ const ran = await walk(plan, state.git, state.confirm);
243
+ await reportRun(before, ran, state);
244
+ return ran.code ?? 0;
245
+ }
246
+ async function walk(plan, git, confirm) {
247
+ let interrupted = false;
248
+ const onInterrupt = () => { if (!handingOver())
249
+ interrupted = true; };
250
+ process.on('SIGINT', onInterrupt);
251
+ try {
252
+ return await eachStep(plan, git, confirm, () => interrupted);
253
+ }
254
+ finally {
255
+ process.off('SIGINT', onInterrupt);
256
+ }
257
+ }
258
+ async function eachStep(plan, git, confirm, interrupted) {
259
+ const done = [];
260
+ const skipped = [];
261
+ for (const [index, planned] of plan.entries()) {
262
+ const choice = await offer(plan, index, planned, confirm);
263
+ const halted = await actOn(choice, { plan, index, git, interrupted, confirming: confirm !== undefined });
264
+ if (halted !== null)
265
+ return { done, skipped, code: halted };
266
+ (choice === 'skip' ? skipped : done).push(planned);
267
+ }
268
+ return { done, skipped, code: null };
269
+ }
270
+ async function offer(plan, index, planned, confirm) {
271
+ // A blank line between steps, so each command's output reads as its own.
272
+ if (index > 0)
273
+ process.stderr.write('\n');
274
+ out.detail('step ' + (index + 1) + ' of ' + plan.length + ': ' + printable(planned.what));
275
+ if (!confirm) {
276
+ out.detail('> ' + formatCommand(planned.argv));
277
+ return 'yes';
278
+ }
279
+ return confirm(planned);
280
+ }
281
+ async function actOn(choice, at) {
282
+ if (choice === 'skip')
283
+ return null;
284
+ if (choice !== 'yes')
285
+ return halt(at.plan.slice(at.index), CANCELLED, 'stopped');
286
+ const code = await runPlanned(at.plan[at.index], at.git, hideGuard(at));
287
+ if (code === 0 && !at.interrupted())
288
+ return null;
289
+ return halt(at.plan.slice(at.index + 1), at.interrupted() ? CANCELLED : code);
290
+ }
291
+ function hideGuard(at) {
292
+ const current = at.plan[at.index]?.argv[0];
293
+ return !at.confirming && current === 'use' && at.plan[at.index + 1]?.argv[0] === 'guard';
294
+ }
295
+ function runPlanned(planned, git, hideNext) {
296
+ const run = () => runOne(planned.argv, git);
297
+ return hideNext ? withoutLine(NEXT_GUARD, run) : run();
298
+ }
299
+ function halt(remaining, code, why) {
300
+ out.fail('setup', why ?? (code === CANCELLED ? 'interrupted' : 'stopped: that command exited ' + code));
301
+ if (remaining.length > 0)
302
+ out.detail('not run:');
303
+ for (const planned of remaining)
304
+ out.detail(' ' + formatCommand(planned.argv));
305
+ return code;
306
+ }
307
+ /** On stderr, like the step lines: stdout carries only what the commands themselves print. */
308
+ async function reportRun(before, ran, state) {
309
+ if (ran.code === null)
310
+ announce(ran.done, ran.skipped, state);
311
+ await printClone(before, state);
312
+ const auth = wantsAuth(ran, state) ? await state.readAuth(state.git) : null;
313
+ printMachine(ran.done, auth);
314
+ if (ran.code === null)
315
+ closeRun(auth, state);
316
+ }
317
+ function announce(done, skipped, report) {
318
+ process.stderr.write('\n');
319
+ const pinned = done.find((planned) => planned.argv[0] === 'use')?.argv.at(-1);
320
+ const account = pinned ?? (report.pinnedAlready ? report.account : null);
321
+ if (account)
322
+ out.detail('done: this clone is set up for ' + printable(account));
323
+ for (const planned of skipped)
324
+ out.detail('skipped: ' + printable(planned.what));
325
+ }
326
+ async function printClone(before, state) {
327
+ const lines = cloneChangeLines(before, await readCloneSnapshot(state.git, state.credentialKeys));
328
+ if (lines.length === 0) {
329
+ out.detail('nothing changed in this clone');
330
+ return;
331
+ }
332
+ out.detail('changed in this clone:');
333
+ for (const line of lines)
334
+ out.detail(printable(line));
335
+ }
336
+ /** Success re-reads gh for the optional line. A later failure still does, once, when `--gh` already ran. */
337
+ function wantsAuth(ran, report) {
338
+ if (ran.code === null && report.repeatGh)
339
+ return true;
340
+ const use = ran.done.find((item) => item.argv[0] === 'use');
341
+ if (!use)
342
+ return false;
343
+ return ran.code === null || use.argv.includes('--gh');
344
+ }
345
+ function printMachine(done, auth) {
346
+ const lines = machineChangeLines(addedAccount(done), activeGh(done, auth));
347
+ if (lines.length === 0)
348
+ return;
349
+ out.detail('changed on this machine:');
350
+ for (const line of lines)
351
+ out.detail(printable(line));
352
+ }
353
+ function addedAccount(done) {
354
+ return done.find((item) => item.argv[0] === 'accounts')?.argv.at(-1) ?? null;
355
+ }
356
+ function activeGh(done, auth) {
357
+ const account = done.find((item) => item.argv[0] === 'use' && item.argv.includes('--gh'))?.argv.at(-1);
358
+ const active = auth?.gh.ok ? auth.gh.value.active : null;
359
+ if (!account || active === null)
360
+ return null;
361
+ return active.toLowerCase() === account.toLowerCase() ? account : null;
362
+ }
363
+ function closeRun(auth, report) {
364
+ out.detail('check it any time: repown status (this clone), repown doctor (this machine)');
365
+ if (!report.repeatGh)
366
+ return;
367
+ const left = ghLeftover(report.account, auth);
368
+ if (left)
369
+ out.detail(left);
370
+ }
371
+ function ghLeftover(account, auth) {
372
+ if (!account || !auth)
373
+ return null;
374
+ const advice = ghAdvice(account, auth);
375
+ return advice ? 'optional, only if you use gh here: ' + dropFixPrefix(advice.detail) : null;
376
+ }
377
+ /**
378
+ * Runs `run` with one line of its stdout -- and the blank line before it -- left out:
379
+ * `use`'s "Next: repown guard on" when the plan's next step does just that. `use`
380
+ * itself is unchanged; run on its own, it still says it.
381
+ */
382
+ async function withoutLine(hidden, run) {
383
+ const write = process.stdout.write;
384
+ let held = '';
385
+ const pass = (text) => write.call(process.stdout, text);
386
+ process.stdout.write = ((chunk) => {
387
+ const text = String(chunk);
388
+ if (text === '\n' && !held) {
389
+ held = text;
390
+ return true;
391
+ }
392
+ const shown = text === hidden + '\n' ? '' : held + text;
393
+ held = '';
394
+ return shown ? pass(shown) : true;
395
+ });
396
+ try {
397
+ return await run();
398
+ }
399
+ finally {
400
+ process.stdout.write = write;
401
+ if (held)
402
+ pass(held);
403
+ }
404
+ }
405
+ // -------------------------------------------------------- one planned command
406
+ async function runOne(argv, git) {
407
+ if (argv[0] === 'git')
408
+ return gitLine(argv, git);
409
+ const [command, rest] = commandFor(argv);
410
+ const parsed = parseArgs(rest, specFor(command));
411
+ if (!parsed.ok) {
412
+ out.fail('setup', 'could not run ' + formatCommand(argv) + ': ' + parsed.error);
413
+ return 2;
414
+ }
415
+ return command.run(parsed.value);
416
+ }
417
+ /** The Command a planned argv names, and the arguments after its name. */
418
+ function commandFor(argv) {
419
+ if (argv[0] === 'use')
420
+ return [useCommand, argv.slice(1)];
421
+ if (argv[0] === 'fix')
422
+ return [fixCommand, argv.slice(1)];
423
+ if (argv[0] === 'guard')
424
+ return [guardGroup.actions['on'], argv.slice(2)];
425
+ return [accountsGroup.actions['add'], argv.slice(2)];
426
+ }
427
+ /** A planned git line. Both are repo-local; neither shells out past the Git wrapper. */
428
+ function gitLine(argv, git) {
429
+ if (argv.includes('push.autoSetupRemote'))
430
+ return setAutoUpstream(git);
431
+ return allowOwner(argv.at(-1), git);
432
+ }
433
+ /** push.autoSetupRemote, in this clone only, and only when it does not already say true. */
434
+ async function setAutoUpstream(git) {
435
+ if (await git.getBoolConfig('push.autoSetupRemote', 'local') === true) {
436
+ out.pass('upstream', 'push.autoSetupRemote is already set in this clone');
437
+ return 0;
438
+ }
439
+ if (!(await git.setConfig('push.autoSetupRemote', 'true', 'local'))) {
440
+ out.fail('upstream', 'could not write push.autoSetupRemote');
441
+ return 1;
442
+ }
443
+ out.pass('upstream', 'branches without an upstream push without -u in this clone');
444
+ return 0;
445
+ }
446
+ /** ADR-004's line, run through the Git wrapper: repo-local, and only if not there already. */
447
+ async function allowOwner(owner, git) {
448
+ const present = await git.getAllConfig('repown.allowOwner', 'local');
449
+ if (present.some((value) => value.toLowerCase() === owner.toLowerCase())) {
450
+ out.pass('origin', printable(owner) + ' is already allowed in this clone');
451
+ return 0;
452
+ }
453
+ if (!(await git.addConfig('repown.allowOwner', owner, 'local'))) {
454
+ out.fail('origin', 'could not write repown.allowOwner ' + printable(owner));
455
+ return 1;
456
+ }
457
+ out.pass('origin', 'pushes to ' + printable(owner) + ' allowed in this clone');
458
+ return 0;
459
+ }
@@ -0,0 +1,121 @@
1
+ {
2
+ "name": "repown",
3
+ "version": "0.2.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "repown",
9
+ "version": "0.2.0",
10
+ "license": "MIT",
11
+ "bin": {
12
+ "repown": "dist/cli.js"
13
+ },
14
+ "devDependencies": {
15
+ "@types/node": "^22.10.0",
16
+ "typescript": "^5.7.0"
17
+ },
18
+ "engines": {
19
+ "node": ">=20"
20
+ },
21
+ "optionalDependencies": {
22
+ "@clack/prompts": "1.8.1"
23
+ }
24
+ },
25
+ "node_modules/@clack/core": {
26
+ "version": "1.5.1",
27
+ "resolved": "https://registry.npmjs.org/@clack/core/-/core-1.5.1.tgz",
28
+ "integrity": "sha512-iHTrHA8MtVuLl2TfZySmcKv1qO2PoyC9Z7pfSDozEuV5vtY3/wcOPKJXlqJ5Oq2Cx5DDGQGAMVx6HZfRRoVEbQ==",
29
+ "license": "MIT",
30
+ "optional": true,
31
+ "dependencies": {
32
+ "fast-wrap-ansi": "^0.2.0",
33
+ "sisteransi": "^1.0.5"
34
+ },
35
+ "engines": {
36
+ "node": ">= 20.12.0"
37
+ }
38
+ },
39
+ "node_modules/@clack/prompts": {
40
+ "version": "1.8.1",
41
+ "resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.8.1.tgz",
42
+ "integrity": "sha512-dlT1m5e/0yUL0kRNcQn7yGLVThkgbB0Ga/1AmfDDC/8ik6AIiSf2QLQO2zPYvefsHP0aFgxO93cVLCCfDp7kzQ==",
43
+ "license": "MIT",
44
+ "optional": true,
45
+ "dependencies": {
46
+ "@clack/core": "1.5.1",
47
+ "fast-string-width": "^3.0.2",
48
+ "fast-wrap-ansi": "^0.2.0",
49
+ "sisteransi": "^1.0.5"
50
+ },
51
+ "engines": {
52
+ "node": ">= 20.12.0"
53
+ }
54
+ },
55
+ "node_modules/@types/node": {
56
+ "version": "22.20.3",
57
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.3.tgz",
58
+ "integrity": "sha512-DZmzkmwHzXrLPAXPyKNDzlIwMMUZCVacoD25ywdy5YTKGbOx/2ld+Q38Im2zJ0vBuZP5Prd3VZutKZyXwkOS8A==",
59
+ "dev": true,
60
+ "license": "MIT",
61
+ "dependencies": {
62
+ "undici-types": "~6.21.0"
63
+ }
64
+ },
65
+ "node_modules/fast-string-truncated-width": {
66
+ "version": "3.0.3",
67
+ "resolved": "https://registry.npmjs.org/fast-string-truncated-width/-/fast-string-truncated-width-3.0.3.tgz",
68
+ "integrity": "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==",
69
+ "license": "MIT",
70
+ "optional": true
71
+ },
72
+ "node_modules/fast-string-width": {
73
+ "version": "3.0.2",
74
+ "resolved": "https://registry.npmjs.org/fast-string-width/-/fast-string-width-3.0.2.tgz",
75
+ "integrity": "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==",
76
+ "license": "MIT",
77
+ "optional": true,
78
+ "dependencies": {
79
+ "fast-string-truncated-width": "^3.0.2"
80
+ }
81
+ },
82
+ "node_modules/fast-wrap-ansi": {
83
+ "version": "0.2.2",
84
+ "resolved": "https://registry.npmjs.org/fast-wrap-ansi/-/fast-wrap-ansi-0.2.2.tgz",
85
+ "integrity": "sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==",
86
+ "license": "MIT",
87
+ "optional": true,
88
+ "dependencies": {
89
+ "fast-string-width": "^3.0.2"
90
+ }
91
+ },
92
+ "node_modules/sisteransi": {
93
+ "version": "1.0.5",
94
+ "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
95
+ "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==",
96
+ "license": "MIT",
97
+ "optional": true
98
+ },
99
+ "node_modules/typescript": {
100
+ "version": "5.9.3",
101
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
102
+ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
103
+ "dev": true,
104
+ "license": "Apache-2.0",
105
+ "bin": {
106
+ "tsc": "bin/tsc",
107
+ "tsserver": "bin/tsserver"
108
+ },
109
+ "engines": {
110
+ "node": ">=14.17"
111
+ }
112
+ },
113
+ "node_modules/undici-types": {
114
+ "version": "6.21.0",
115
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
116
+ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
117
+ "dev": true,
118
+ "license": "MIT"
119
+ }
120
+ }
121
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repown",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
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",
@@ -21,7 +21,8 @@
21
21
  "files": [
22
22
  "dist",
23
23
  "!dist/**/*.map",
24
- "CHANGELOG.md"
24
+ "CHANGELOG.md",
25
+ "npm-shrinkwrap.json"
25
26
  ],
26
27
  "scripts": {
27
28
  "build": "tsc && tsc -p tsconfig.test.json",
@@ -55,5 +56,8 @@
55
56
  "devDependencies": {
56
57
  "@types/node": "^22.10.0",
57
58
  "typescript": "^5.7.0"
59
+ },
60
+ "optionalDependencies": {
61
+ "@clack/prompts": "1.8.1"
58
62
  }
59
63
  }