git-colabor 0.1.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.
package/dist/index.cjs ADDED
@@ -0,0 +1,1110 @@
1
+ 'use strict';
2
+
3
+ var promises = require('fs/promises');
4
+ var fs = require('fs');
5
+ var path = require('path');
6
+ var os = require('os');
7
+ var child_process = require('child_process');
8
+ var crypto = require('crypto');
9
+ var net = require('net');
10
+ var promises$1 = require('readline/promises');
11
+
12
+ // src/core/authors/types.ts
13
+ var CO_AUTHOR_TRAILER = "Co-authored-by:";
14
+ var Author = class {
15
+ constructor(key, name, email) {
16
+ this.key = key;
17
+ this.name = name;
18
+ this.email = email;
19
+ }
20
+ key;
21
+ name;
22
+ email;
23
+ /** `NAME <EMAIL>` */
24
+ toString() {
25
+ return `${this.name} <${this.email}>`;
26
+ }
27
+ /** `Co-authored-by: NAME <EMAIL>` */
28
+ format() {
29
+ return `${CO_AUTHOR_TRAILER} ${this.toString()}`;
30
+ }
31
+ };
32
+ function genKey(name, email) {
33
+ const initials = name.toLowerCase().split(/\s+/).filter(Boolean).map((w) => w[0] ?? "").join("");
34
+ return `${initials}${email.slice(0, 2)}`;
35
+ }
36
+ var GitError = class extends Error {
37
+ cmd;
38
+ exitCode;
39
+ stderr;
40
+ constructor(cmd, exitCode, stderr) {
41
+ super(`git ${cmd} failed (exit ${exitCode})${stderr ? ": " + stderr.trim() : ""}`);
42
+ this.name = "GitError";
43
+ this.cmd = cmd;
44
+ this.exitCode = exitCode;
45
+ this.stderr = stderr;
46
+ }
47
+ };
48
+ function run(args, opts) {
49
+ return new Promise((resolve4, reject) => {
50
+ const child = child_process.spawn("git", args, {
51
+ cwd: opts.cwd,
52
+ env: opts.env ? { ...process.env, ...opts.env } : process.env,
53
+ stdio: ["ignore", "pipe", "pipe"]
54
+ });
55
+ let stdout = "";
56
+ let stderr = "";
57
+ child.stdout.on("data", (d) => {
58
+ stdout += d.toString("utf8");
59
+ });
60
+ child.stderr.on("data", (d) => {
61
+ stderr += d.toString("utf8");
62
+ });
63
+ child.on("error", reject);
64
+ child.on("close", (code) => {
65
+ resolve4({ stdout, stderr, exitCode: code ?? 0 });
66
+ });
67
+ });
68
+ }
69
+ async function gitRaw(args, opts = {}) {
70
+ return run(args, opts);
71
+ }
72
+ async function git(args, opts = {}) {
73
+ const result = await run(args, opts);
74
+ if (result.exitCode !== 0) throw new GitError(args.join(" "), result.exitCode, result.stderr);
75
+ return result;
76
+ }
77
+ async function runBin(cmd, args, opts = {}) {
78
+ return new Promise((resolve4, reject) => {
79
+ const child = child_process.spawn(cmd, args, {
80
+ cwd: opts.cwd,
81
+ env: opts.env ? { ...process.env, ...opts.env } : process.env,
82
+ stdio: ["pipe", "pipe", "pipe"]
83
+ });
84
+ let stdout = "";
85
+ let stderr = "";
86
+ child.stdout.on("data", (d) => {
87
+ stdout += d.toString("utf8");
88
+ });
89
+ child.stderr.on("data", (d) => {
90
+ stderr += d.toString("utf8");
91
+ });
92
+ child.on("error", reject);
93
+ child.on("close", (code) => {
94
+ resolve4({ stdout, stderr, exitCode: code ?? 0 });
95
+ });
96
+ if (opts.input !== void 0) child.stdin.end(opts.input, "utf8");
97
+ else child.stdin.end();
98
+ });
99
+ }
100
+
101
+ // src/core/git/rev.ts
102
+ async function insideWorkTree(cwd) {
103
+ const r = await gitRaw(["rev-parse", "--is-inside-work-tree"], { cwd });
104
+ return r.exitCode === 0 && r.stdout.trim() === "true";
105
+ }
106
+ async function topLevel(cwd) {
107
+ const r = await git(["rev-parse", "--show-toplevel"], { cwd });
108
+ return r.stdout.trim();
109
+ }
110
+ async function gitDir(cwd) {
111
+ const r = await git(["rev-parse", "--git-dir"], { cwd });
112
+ return path.resolve(cwd ?? process.cwd(), r.stdout.trim());
113
+ }
114
+ async function isRepo(cwd) {
115
+ return insideWorkTree(cwd);
116
+ }
117
+ async function headSha(cwd) {
118
+ const r = await gitRaw(["rev-parse", "HEAD"], { cwd });
119
+ if (r.exitCode !== 0) return void 0;
120
+ const sha = r.stdout.trim();
121
+ return sha.length > 0 ? sha : void 0;
122
+ }
123
+
124
+ // src/core/errors.ts
125
+ var EXIT_CODES = {
126
+ OK: 0,
127
+ RUNTIME: 1,
128
+ USAGE: 2,
129
+ NOT_A_REPO: 3,
130
+ SECRET_UNAVAILABLE: 4,
131
+ NOT_FOUND: 5,
132
+ CONFLICT_BLOCKED: 6
133
+ };
134
+ var AppError = class extends Error {
135
+ code;
136
+ exitCode;
137
+ hints;
138
+ constructor(init) {
139
+ super(init.message);
140
+ this.name = "AppError";
141
+ this.code = init.code;
142
+ this.exitCode = init.exitCode ?? EXIT_CODES.RUNTIME;
143
+ this.hints = init.hints;
144
+ }
145
+ toPayload() {
146
+ return { code: this.code, message: this.message, hints: this.hints, exitCode: this.exitCode };
147
+ }
148
+ };
149
+ var Errors = {
150
+ notARepo: (cwd) => new AppError({
151
+ code: "NOT_A_REPO",
152
+ message: cwd ? `not a git repository: ${cwd}` : "not a git repository",
153
+ exitCode: EXIT_CODES.NOT_A_REPO
154
+ }),
155
+ authorNotFound: (key) => new AppError({
156
+ code: "AUTHOR_NOT_FOUND",
157
+ message: `Author with initials "${key}" not found in .git-coauthors`,
158
+ exitCode: EXIT_CODES.NOT_FOUND,
159
+ hints: [`Add it with: git colabor coauthor add ${key} "Full Name" email@example.com`]
160
+ }),
161
+ duplicateKey: (key) => new AppError({
162
+ code: "DUPLICATE_KEY",
163
+ message: `Key "${key}" already exists in .git-coauthors`,
164
+ exitCode: EXIT_CODES.NOT_FOUND,
165
+ hints: ["Edit .git-coauthors directly to change an existing entry."]
166
+ }),
167
+ invalidEmail: (email) => new AppError({ code: "INVALID_EMAIL", message: `Invalid email: ${email}`, exitCode: EXIT_CODES.USAGE }),
168
+ usage: (message, hints) => new AppError({ code: "USAGE", message, exitCode: EXIT_CODES.USAGE, hints }),
169
+ secretUnavailable: (message, hints) => new AppError({ code: "SECRET_UNAVAILABLE", message, exitCode: EXIT_CODES.SECRET_UNAVAILABLE, hints })
170
+ };
171
+ function toErrorPayload(e) {
172
+ if (e instanceof AppError) return e.toPayload();
173
+ const message = e instanceof Error ? e.message : String(e);
174
+ return { code: "INTERNAL", message, exitCode: EXIT_CODES.RUNTIME };
175
+ }
176
+
177
+ // src/core/authors/store.ts
178
+ var COAUTHORS_FILENAME = ".git-coauthors";
179
+ var EMAIL_RE = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[(?:\d{1,3}\.){3}\d{1,3}])|((\w+\.)+[a-zA-Z]{2,}))$/;
180
+ function validateEmail(email) {
181
+ return EMAIL_RE.test(email);
182
+ }
183
+ function homeCoAuthorsPath() {
184
+ return path.join(os.homedir(), COAUTHORS_FILENAME);
185
+ }
186
+ async function coAuthorsPath(cwd) {
187
+ const envPath = process.env.GIT_COLABOR_COAUTHORS_PATH;
188
+ if (envPath) return path.resolve(envPath);
189
+ try {
190
+ const root = await topLevel(cwd);
191
+ const local = path.join(root, COAUTHORS_FILENAME);
192
+ if (fs.existsSync(local)) return local;
193
+ } catch {
194
+ }
195
+ return homeCoAuthorsPath();
196
+ }
197
+ async function readAuthors(cwd) {
198
+ const p = await coAuthorsPath(cwd);
199
+ const txt = await promises.readFile(p, "utf8");
200
+ const parsed = JSON.parse(txt);
201
+ if (!parsed || typeof parsed !== "object" || !parsed.coauthors) {
202
+ throw Errors.usage(`Invalid .git-coauthors at ${p}: missing "coauthors" object`);
203
+ }
204
+ return { coauthors: parsed.coauthors };
205
+ }
206
+ async function writeAuthors(schema, cwd) {
207
+ const p = await coAuthorsPath(cwd);
208
+ await promises.mkdir(path.dirname(p), { recursive: true });
209
+ await promises.writeFile(p, JSON.stringify(schema, null, 2) + "\n", "utf8");
210
+ }
211
+ function schemaToAuthors(schema) {
212
+ return Object.entries(schema.coauthors).map(([key, v]) => new Author(key, v.name, v.email));
213
+ }
214
+ async function listAuthors(filter, cwd) {
215
+ let schema;
216
+ try {
217
+ schema = await readAuthors(cwd);
218
+ } catch {
219
+ return [];
220
+ }
221
+ const all = schemaToAuthors(schema);
222
+ if (!filter) return all;
223
+ const f = filter.toLowerCase();
224
+ return all.filter(
225
+ (a) => a.key.toLowerCase().includes(f) || a.name.toLowerCase().includes(f) || a.email.toLowerCase().includes(f)
226
+ );
227
+ }
228
+ async function getAuthor(key, cwd) {
229
+ const all = await listAuthors(void 0, cwd);
230
+ const found = all.find((a) => a.key === key);
231
+ if (!found) throw Errors.authorNotFound(key);
232
+ return found;
233
+ }
234
+ async function addCoAuthor(author, cwd) {
235
+ if (!validateEmail(author.email)) throw Errors.invalidEmail(author.email);
236
+ let schema;
237
+ try {
238
+ schema = await readAuthors(cwd);
239
+ } catch {
240
+ schema = { coauthors: {} };
241
+ }
242
+ if (Object.prototype.hasOwnProperty.call(schema.coauthors, author.key)) {
243
+ throw Errors.duplicateKey(author.key);
244
+ }
245
+ schema.coauthors[author.key] = { name: author.name, email: author.email };
246
+ await writeAuthors(schema, cwd);
247
+ }
248
+ function formatMessage(txt, authors) {
249
+ const stripRe = new RegExp(`(\r
250
+ |\r|
251
+ ){0,2}${CO_AUTHOR_TRAILER}.*`, "g");
252
+ const message = txt.replace(stripRe, "");
253
+ if (authors && authors.length > 0) {
254
+ const trailerText = authors.map((a) => a.format()).join(os.EOL);
255
+ return [message, os.EOL, os.EOL, trailerText].join("");
256
+ }
257
+ return message;
258
+ }
259
+ function printTrailers(authors) {
260
+ if (authors.length === 0) return "";
261
+ return os.EOL + os.EOL + authors.map((a) => a.format()).join(os.EOL);
262
+ }
263
+
264
+ // src/core/git/config.ts
265
+ function scopeArgs(scope) {
266
+ return scope ? [`--${scope}`] : [];
267
+ }
268
+ async function getConfig(key, scope, cwd) {
269
+ const r = await gitRaw(["config", ...scopeArgs(scope), "--get", key], { cwd });
270
+ if (r.exitCode !== 0) return void 0;
271
+ const v = r.stdout.trim();
272
+ return v.length > 0 ? v : void 0;
273
+ }
274
+ async function getAllConfig(key, scope, cwd) {
275
+ const r = await gitRaw(["config", ...scopeArgs(scope), "--get-all", key], { cwd });
276
+ return r.exitCode === 0 ? r.stdout.replace(/\s+$/, "") : "";
277
+ }
278
+ async function setConfig(key, value, scope, cwd) {
279
+ await git(["config", ...scopeArgs(scope), key, value], { cwd });
280
+ }
281
+ async function addConfigValue(key, value, scope, cwd) {
282
+ await git(["config", ...scopeArgs(scope), "--add", key, value], { cwd });
283
+ }
284
+ async function unsetConfig(key, scope, cwd) {
285
+ await gitRaw(["config", ...scopeArgs(scope), "--unset", key], { cwd });
286
+ }
287
+ async function unsetAllConfig(key, scope, cwd) {
288
+ await gitRaw(["config", ...scopeArgs(scope), "--unset-all", key], { cwd });
289
+ }
290
+ async function removeSection(section, scope, cwd) {
291
+ await gitRaw(["config", ...scopeArgs(scope), "--remove-section", section], { cwd });
292
+ }
293
+
294
+ // src/core/message/template.ts
295
+ function gitMessagePath() {
296
+ return path.join(os.homedir(), ".gitmessage");
297
+ }
298
+ async function resolveTemplatePath(templatePath, cwd) {
299
+ if (process.env.GIT_COLABOR_MESSAGE_PATH) return path.resolve(process.env.GIT_COLABOR_MESSAGE_PATH);
300
+ if (templatePath) return path.resolve(await topLevel(cwd), templatePath);
301
+ return gitMessagePath();
302
+ }
303
+ async function ensureCommitTemplate(cwd) {
304
+ const has = await getConfig("commit.template", void 0, cwd);
305
+ if (!has) await setConfig("commit.template", gitMessagePath(), "global", cwd);
306
+ }
307
+ async function readMsg(p) {
308
+ try {
309
+ return await promises.readFile(p, "utf8");
310
+ } catch {
311
+ return "";
312
+ }
313
+ }
314
+ async function writeMsg(p, txt) {
315
+ await promises.mkdir(path.dirname(p), { recursive: true });
316
+ await promises.writeFile(p, txt, "utf8");
317
+ }
318
+ async function applyToTemplate(authors, cwd) {
319
+ const [localTpl, firstTpl] = await Promise.all([
320
+ getConfig("commit.template", "local", cwd),
321
+ getConfig("commit.template", void 0, cwd)
322
+ ]);
323
+ const primaryPath = await resolveTemplatePath(firstTpl ?? void 0, cwd);
324
+ await writeMsg(primaryPath, formatMessage(await readMsg(primaryPath), authors));
325
+ if (localTpl) {
326
+ const globalTpl = await getConfig("commit.template", "global", cwd) ?? gitMessagePath();
327
+ const globalPath = await resolveTemplatePath(globalTpl, cwd);
328
+ await writeMsg(globalPath, formatMessage(await readMsg(globalPath), authors));
329
+ }
330
+ }
331
+ async function writeCoAuthorsToTemplate(authors, cwd) {
332
+ await applyToTemplate(authors, cwd);
333
+ }
334
+ async function clearTemplate(cwd) {
335
+ await applyToTemplate([], cwd);
336
+ }
337
+
338
+ // src/core/coauthors/state.ts
339
+ var KEY = "colabor.selected";
340
+ var LINE_RE = /^(.*)\s<([^>]+)>$/;
341
+ async function getSelected(cwd) {
342
+ const raw = (await getAllConfig(KEY, "local", cwd)).split(/\r?\n/).filter(Boolean);
343
+ if (raw.length === 0) return [];
344
+ const all = await listAuthors(void 0, cwd);
345
+ const out = [];
346
+ for (const line of raw) {
347
+ const m = line.match(LINE_RE);
348
+ if (!m) continue;
349
+ const name = m[1].trim();
350
+ const email = m[2].trim();
351
+ const found = all.find((a) => a.email === email);
352
+ out.push(found ?? new Author(email.split("@")[0] || "co", name, email));
353
+ }
354
+ return out;
355
+ }
356
+ async function setSelected(authors, cwd) {
357
+ await unsetAllConfig(KEY, "local", cwd);
358
+ for (const a of authors) await addConfigValue(KEY, a.toString(), "local", cwd);
359
+ await ensureCommitTemplate(cwd);
360
+ await writeCoAuthorsToTemplate(authors, cwd);
361
+ }
362
+ async function clearSelected(cwd) {
363
+ await unsetAllConfig(KEY, "local", cwd);
364
+ await ensureCommitTemplate(cwd);
365
+ await clearTemplate(cwd);
366
+ }
367
+
368
+ // src/core/git/shortlog.ts
369
+ var SHORTLOG_LINE = /^\d+\t(.+)\s<(.+)>$/;
370
+ async function repoAuthors(filter, cwd) {
371
+ const args = ["shortlog", "-seni", "HEAD"];
372
+ if (filter) args.splice(1, 0, `--author=${filter}`);
373
+ const r = await gitRaw(args, { cwd });
374
+ if (r.exitCode !== 0) return [];
375
+ const out = [];
376
+ for (const line of r.stdout.split(/\r?\n/)) {
377
+ const m = line.match(SHORTLOG_LINE);
378
+ if (!m) continue;
379
+ const name = m[1].trim();
380
+ const email = m[2].trim();
381
+ out.push(new Author(genKey(name, email), name, email));
382
+ }
383
+ return out;
384
+ }
385
+ var ORDER = { trace: 10, debug: 20, info: 30, warn: 40, error: 50 };
386
+ var VALID = /* @__PURE__ */ new Set(["trace", "debug", "info", "warn", "error"]);
387
+ var MAX_BYTES = 2 * 1024 * 1024;
388
+ var redactable = /* @__PURE__ */ new Set();
389
+ function addRedactable(s) {
390
+ if (s && s.length > 0) redactable.add(s);
391
+ }
392
+ function redact(input) {
393
+ let out = input;
394
+ for (const r of redactable) out = out.split(r).join("[redacted]");
395
+ return out;
396
+ }
397
+ function redactFields(fields) {
398
+ if (!fields) return {};
399
+ const o = {};
400
+ for (const [k, v] of Object.entries(fields)) o[k] = typeof v === "string" ? redact(v) : v;
401
+ return o;
402
+ }
403
+ function defaultLogFile() {
404
+ if (process.env.GIT_COLABOR_LOG_FILE) return process.env.GIT_COLABOR_LOG_FILE;
405
+ const home = os.homedir();
406
+ if (process.platform === "darwin") return path.join(home, "Library", "Logs", "git-colabor", "cli.log");
407
+ if (process.platform === "win32") {
408
+ return path.join(process.env.LOCALAPPDATA ?? path.join(home, "AppData", "Local"), "git-colabor", "logs", "cli.log");
409
+ }
410
+ return path.join(process.env.XDG_STATE_HOME ?? path.join(home, ".local", "state"), "git-colabor", "cli.log");
411
+ }
412
+ function levelFromEnv() {
413
+ const v = process.env.GIT_COLABOR_LOG_LEVEL?.toLowerCase();
414
+ return v && VALID.has(v) ? v : "info";
415
+ }
416
+ function createLogger(opts = {}) {
417
+ const level = opts.level ?? levelFromEnv();
418
+ const file = opts.file ?? defaultLogFile();
419
+ let writing = Promise.resolve();
420
+ const write = (lvl, msg, fields) => {
421
+ if (ORDER[lvl] < ORDER[level]) return;
422
+ const rec = JSON.stringify({
423
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
424
+ level: lvl,
425
+ msg: redact(String(msg)),
426
+ ...redactFields(fields)
427
+ }) + "\n";
428
+ writing = writing.then(async () => {
429
+ try {
430
+ await promises.mkdir(path.dirname(file), { recursive: true });
431
+ try {
432
+ const st = await promises.stat(file);
433
+ if (st.size > MAX_BYTES) await promises.rename(file, `${file}.1`);
434
+ } catch {
435
+ }
436
+ await promises.appendFile(file, rec, "utf8");
437
+ } catch {
438
+ }
439
+ });
440
+ };
441
+ return {
442
+ level,
443
+ trace: (m, f) => write("trace", m, f),
444
+ debug: (m, f) => write("debug", m, f),
445
+ info: (m, f) => write("info", m, f),
446
+ warn: (m, f) => write("warn", m, f),
447
+ error: (m, f) => write("error", m, f)
448
+ };
449
+ }
450
+ function dataDir() {
451
+ if (process.platform === "win32") {
452
+ return path.join(process.env.APPDATA ?? path.join(os.homedir(), "AppData", "Roaming"), "git-colabor");
453
+ }
454
+ return path.join(process.env.XDG_CONFIG_HOME ?? path.join(os.homedir(), ".config"), "git-colabor");
455
+ }
456
+ function mapPath() {
457
+ return process.env.GIT_COLABOR_MAP ?? path.join(dataDir(), "identities.json");
458
+ }
459
+ function keysDir() {
460
+ return path.join(dataDir(), "keys");
461
+ }
462
+ function auditLogPath() {
463
+ return process.env.GIT_COLABOR_AUDIT_FILE ?? path.join(dataDir(), "audit.log");
464
+ }
465
+ function keyFileName(fingerprint) {
466
+ return fingerprint.replace(/[^A-Za-z0-9]+/g, "_") + ".key";
467
+ }
468
+ function keyFilePath(fingerprint) {
469
+ return path.join(keysDir(), keyFileName(fingerprint));
470
+ }
471
+
472
+ // src/core/logging/audit.ts
473
+ async function appendAudit(input) {
474
+ const entry = {
475
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
476
+ action: input.action,
477
+ identity: input.identity,
478
+ identityName: input.identityName,
479
+ fingerprint: input.fingerprint,
480
+ repo: input.repo,
481
+ sha: input.sha,
482
+ host: os.hostname(),
483
+ osUser: os.userInfo().username,
484
+ source: input.source,
485
+ result: input.result ?? "ok",
486
+ message: input.message
487
+ };
488
+ const file = auditLogPath();
489
+ try {
490
+ await promises.mkdir(path.dirname(file), { recursive: true });
491
+ await promises.appendFile(file, JSON.stringify(entry) + "\n", "utf8");
492
+ await promises.chmod(file, 384).catch(() => {
493
+ });
494
+ } catch {
495
+ }
496
+ }
497
+ async function readAudit(opts = {}) {
498
+ try {
499
+ const txt = await promises.readFile(auditLogPath(), "utf8");
500
+ let entries = txt.split(/\r?\n/).filter(Boolean).map((l) => JSON.parse(l));
501
+ if (opts.repo) entries = entries.filter((e) => e.repo === opts.repo);
502
+ if (opts.since) {
503
+ const t = new Date(opts.since).getTime();
504
+ entries = entries.filter((e) => new Date(e.ts).getTime() >= t);
505
+ }
506
+ if (opts.tail && opts.tail > 0) entries = entries.slice(-opts.tail);
507
+ return entries;
508
+ } catch {
509
+ return [];
510
+ }
511
+ }
512
+ async function atomicWriteJson(path$1, data, mode) {
513
+ await promises.mkdir(path.dirname(path$1), { recursive: true });
514
+ const tmp = `${path$1}.${crypto.randomBytes(4).toString("hex")}.tmp`;
515
+ await promises.writeFile(tmp, JSON.stringify(data, null, 2) + "\n", "utf8");
516
+ if (mode !== void 0) {
517
+ await promises.chmod(tmp, mode).catch(() => {
518
+ });
519
+ }
520
+ await promises.rename(tmp, path$1);
521
+ }
522
+ async function statePath(cwd) {
523
+ return path.join(await gitDir(cwd), "colabor", "state.json");
524
+ }
525
+ async function readState(cwd) {
526
+ try {
527
+ const p = await statePath(cwd);
528
+ const txt = await promises.readFile(p, "utf8");
529
+ return JSON.parse(txt);
530
+ } catch {
531
+ return { schemaVersion: 1 };
532
+ }
533
+ }
534
+ async function writeState(state, cwd) {
535
+ const p = await statePath(cwd);
536
+ await atomicWriteJson(p, state, 384);
537
+ }
538
+ async function readCurrentIdentityConfig(cwd) {
539
+ const [userName, userEmail, sshCommand, commitTemplate] = await Promise.all([
540
+ getConfig("user.name", "local", cwd),
541
+ getConfig("user.email", "local", cwd),
542
+ getConfig("core.sshCommand", "local", cwd),
543
+ getConfig("commit.template", "local", cwd)
544
+ ]);
545
+ return { userName, userEmail, sshCommand, commitTemplate };
546
+ }
547
+ async function captureBackupIfFirstTouch(cwd) {
548
+ const managed = await getConfig("colabor.managed", "local", cwd);
549
+ const state = await readState(cwd);
550
+ if (managed === "true" || state.backups) return state;
551
+ state.backups = await readCurrentIdentityConfig(cwd);
552
+ await writeState(state, cwd);
553
+ return state;
554
+ }
555
+ function isStale(heldBy, staleMinutes) {
556
+ const ageMs = Date.now() - new Date(heldBy.since).getTime();
557
+ return ageMs > staleMinutes * 6e4;
558
+ }
559
+ async function detectConflict(session, cwd, staleMinutes = 5) {
560
+ const st = await readState(cwd);
561
+ const hb = st.heldBy;
562
+ if (!hb || hb.session === session) return null;
563
+ if (isStale(hb, staleMinutes)) return null;
564
+ return { heldBy: hb };
565
+ }
566
+ function cliSessionId() {
567
+ return `cli:${process.pid}@${os.hostname()}`;
568
+ }
569
+ function nowHeldBy(session, source) {
570
+ return {
571
+ session,
572
+ since: (/* @__PURE__ */ new Date()).toISOString(),
573
+ host: os.hostname(),
574
+ osUser: os.userInfo().username,
575
+ source
576
+ };
577
+ }
578
+
579
+ // src/core/repo/status.ts
580
+ async function repoStatus(cwd) {
581
+ const inRepo = cwd ? await insideWorkTree(cwd) : false;
582
+ if (!inRepo) {
583
+ return {
584
+ inRepo: false,
585
+ repo: cwd ?? null,
586
+ managed: false,
587
+ managedBy: null,
588
+ activeIdentityId: null,
589
+ heldBy: null,
590
+ selected: [],
591
+ available: []
592
+ };
593
+ }
594
+ const [managed, managedBy, state, selected] = await Promise.all([
595
+ getConfig("colabor.managed", "local", cwd),
596
+ getConfig("colabor.managed-by", "local", cwd),
597
+ readState(cwd),
598
+ getSelected(cwd)
599
+ ]);
600
+ const allAuthors = await listAuthors(void 0, cwd);
601
+ const selectedEmails = new Set(selected.map((a) => a.email));
602
+ const available = allAuthors.filter((a) => !selectedEmails.has(a.email)).map(toBrief);
603
+ return {
604
+ inRepo: true,
605
+ repo: cwd,
606
+ managed: managed === "true",
607
+ managedBy: managedBy ?? null,
608
+ activeIdentityId: state.activeIdentity ?? null,
609
+ heldBy: state.heldBy ?? null,
610
+ selected: selected.map(toBrief),
611
+ available
612
+ };
613
+ }
614
+ function toBrief(a) {
615
+ return { key: a.key, name: a.name, email: a.email };
616
+ }
617
+ function genId() {
618
+ return "id_" + crypto.randomBytes(4).toString("hex");
619
+ }
620
+ async function readMap() {
621
+ try {
622
+ const txt = await promises.readFile(mapPath(), "utf8");
623
+ const parsed = JSON.parse(txt);
624
+ return {
625
+ schemaVersion: 1,
626
+ identities: parsed.identities ?? {},
627
+ defaultIdentity: parsed.defaultIdentity
628
+ };
629
+ } catch {
630
+ return { schemaVersion: 1, identities: {} };
631
+ }
632
+ }
633
+ async function writeMap(map) {
634
+ await atomicWriteJson(mapPath(), map, 384);
635
+ }
636
+ async function getIdentity(id) {
637
+ const map = await readMap();
638
+ const found = map.identities[id];
639
+ if (!found) throw Errors.usage(`identity "${id}" not found`);
640
+ return found;
641
+ }
642
+ async function addIdentity(input) {
643
+ const map = await readMap();
644
+ const id = input.id ?? genId();
645
+ if (map.identities[id]) throw Errors.usage(`identity "${id}" already exists`);
646
+ const identity = { ...input, id, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
647
+ map.identities[id] = identity;
648
+ await writeMap(map);
649
+ return identity;
650
+ }
651
+ async function removeIdentity(id) {
652
+ const map = await readMap();
653
+ if (!map.identities[id]) throw Errors.usage(`identity "${id}" not found`);
654
+ delete map.identities[id];
655
+ if (map.defaultIdentity === id) delete map.defaultIdentity;
656
+ await writeMap(map);
657
+ }
658
+ async function setDefault(id) {
659
+ const map = await readMap();
660
+ if (!map.identities[id]) throw Errors.usage(`identity "${id}" not found`);
661
+ map.defaultIdentity = id;
662
+ await writeMap(map);
663
+ }
664
+ async function listIdentities() {
665
+ const map = await readMap();
666
+ return { identities: Object.values(map.identities), defaultIdentity: map.defaultIdentity };
667
+ }
668
+ var FP_RE = /SHA256:[A-Za-z0-9+/=]+/;
669
+ async function fingerprintOfFile(path) {
670
+ const r = await runBin("ssh-keygen", ["-lf", path]);
671
+ if (r.exitCode !== 0) {
672
+ throw new AppError({
673
+ code: "KEY_READ_FAILED",
674
+ message: `cannot read key fingerprint: ${r.stderr.trim() || "ssh-keygen failed"}`
675
+ });
676
+ }
677
+ const m = r.stdout.match(FP_RE);
678
+ if (!m) throw new AppError({ code: "KEY_READ_FAILED", message: `unparseable ssh-keygen output: ${r.stdout}` });
679
+ return m[0];
680
+ }
681
+ async function isEncrypted(path) {
682
+ const r = await runBin("ssh-keygen", ["-y", "-P", "", "-f", path]);
683
+ return r.exitCode !== 0;
684
+ }
685
+ async function restrictKeyPerms(path) {
686
+ if (process.platform === "win32") {
687
+ const user = process.env.USERNAME ?? process.env.USER ?? "";
688
+ if (user) {
689
+ await runBin("icacls", [path, "/inheritance:r", "/grant:r", `${user}:(R,W)`]).catch(() => {
690
+ });
691
+ }
692
+ return;
693
+ }
694
+ await promises.chmod(path, 384).catch(() => {
695
+ });
696
+ }
697
+ async function materializeKey(privateKeyPem) {
698
+ await promises.mkdir(keysDir(), { recursive: true });
699
+ const tmp = path.join(keysDir(), `.import.${crypto.randomBytes(4).toString("hex")}`);
700
+ await promises.writeFile(tmp, privateKeyPem.endsWith("\n") ? privateKeyPem : privateKeyPem + "\n", "utf8");
701
+ await restrictKeyPerms(tmp);
702
+ const fingerprint = await fingerprintOfFile(tmp);
703
+ const dest = keyFilePath(fingerprint);
704
+ await promises.rename(tmp, dest);
705
+ await restrictKeyPerms(dest);
706
+ return { path: dest, fingerprint };
707
+ }
708
+ async function importKey(sourcePath) {
709
+ const pem = await promises.readFile(sourcePath, "utf8");
710
+ const { path, fingerprint } = await materializeKey(pem);
711
+ const encrypted = await isEncrypted(path);
712
+ return { path, fingerprint, encrypted };
713
+ }
714
+ function runInherit(cmdArgs, env, stdinNull = false) {
715
+ return new Promise((resolve4) => {
716
+ const [cmd, ...args] = cmdArgs;
717
+ const child = child_process.spawn(cmd, args, {
718
+ env: env ?? process.env,
719
+ stdio: [stdinNull ? "ignore" : "inherit", "inherit", "pipe"]
720
+ });
721
+ child.on("error", () => resolve4(127));
722
+ child.on("close", (c) => resolve4(c ?? 127));
723
+ });
724
+ }
725
+ function hasBin(bin) {
726
+ if (process.platform === "win32") {
727
+ return child_process.spawnSync("where", [bin]).status === 0;
728
+ }
729
+ return child_process.spawnSync(`command -v ${bin}`, { shell: true }).status === 0;
730
+ }
731
+ async function supportsAppleKeychain() {
732
+ if (process.platform !== "darwin") return false;
733
+ const r = await runBinQuiet("ssh-add", ["-h"]);
734
+ return r.includes("--apple-use-keychain");
735
+ }
736
+ async function runBinQuiet(cmd, args) {
737
+ return new Promise((resolve4) => {
738
+ const child = child_process.spawn(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
739
+ let out = "";
740
+ child.stdout.on("data", (d) => {
741
+ out += d.toString("utf8");
742
+ });
743
+ child.on("error", () => resolve4(""));
744
+ child.on("close", () => resolve4(out));
745
+ });
746
+ }
747
+ async function loadKey(opts) {
748
+ if (!fs.existsSync(opts.keyPath)) return { loaded: false, via: "none", message: "key file missing" };
749
+ let code = await runInherit(["ssh-add", opts.keyPath], void 0, !process.stdin.isTTY);
750
+ if (code === 0) return { loaded: true, via: "plain" };
751
+ if (opts.useAppleKeychain && await supportsAppleKeychain()) {
752
+ code = await runInherit(["ssh-add", "--apple-use-keychain", opts.keyPath]);
753
+ if (code === 0) return { loaded: true, via: "apple-keychain" };
754
+ }
755
+ const haveSource = opts.socketPath && opts.token || opts.passphraseCommand;
756
+ if (opts.askpassScriptPath && haveSource) {
757
+ const env = { ...process.env };
758
+ env.SSH_ASKPASS = opts.askpassScriptPath;
759
+ env.SSH_ASKPASS_REQUIRE = "force";
760
+ env.DISPLAY = env.DISPLAY ?? ":0";
761
+ if (opts.socketPath) env.GIT_COLABOR_ASKPASS_SOCK = opts.socketPath;
762
+ if (opts.token) env.GIT_COLABOR_ASKPASS_TOKEN = opts.token;
763
+ if (opts.passphraseCommand) env.GIT_COLABOR_PASSPHRASE_COMMAND = opts.passphraseCommand;
764
+ env.GIT_COLABOR_FINGERPRINT = opts.fingerprint;
765
+ const useSetsid = process.platform !== "win32" && hasBin("setsid");
766
+ code = await runInherit(useSetsid ? ["setsid", "ssh-add", opts.keyPath] : ["ssh-add", opts.keyPath], env, true);
767
+ if (code === 0) return { loaded: true, via: "askpass" };
768
+ return { loaded: false, via: "askpass", message: `ssh-add exited ${code}` };
769
+ }
770
+ if (process.stdin.isTTY) {
771
+ code = await runInherit(["ssh-add", opts.keyPath]);
772
+ if (code === 0) return { loaded: true, via: "tty" };
773
+ return { loaded: false, via: "tty", message: `ssh-add exited ${code}` };
774
+ }
775
+ return { loaded: false, via: "none", message: "no passphrase source and no tty" };
776
+ }
777
+ async function listAgent() {
778
+ return runBinQuiet("ssh-add", ["-l"]);
779
+ }
780
+ async function removeKey(keyPath) {
781
+ const code = await runInherit(["ssh-add", "-d", keyPath], void 0, true);
782
+ return code === 0;
783
+ }
784
+
785
+ // src/core/identity/apply.ts
786
+ async function safeTopLevel(cwd) {
787
+ try {
788
+ return await topLevel(cwd);
789
+ } catch {
790
+ return void 0;
791
+ }
792
+ }
793
+ async function applyResolvedIdentity(args) {
794
+ const { name, email, sshCommand, identity, opts } = args;
795
+ const session = opts.session ?? (opts.source === "cli" ? cliSessionId() : "ext:unknown");
796
+ const conflict = await detectConflict(session, opts.cwd, opts.staleMinutes);
797
+ if (conflict && opts.noOverride) {
798
+ throw new AppError({
799
+ code: "CONFLICT_BLOCKED",
800
+ message: `repo is held by ${conflict.heldBy.session} (since ${conflict.heldBy.since})`,
801
+ exitCode: 6,
802
+ hints: ["re-run without --no-override to take over"]
803
+ });
804
+ }
805
+ await captureBackupIfFirstTouch(opts.cwd);
806
+ await setConfig("user.name", name, "local", opts.cwd);
807
+ await setConfig("user.email", email, "local", opts.cwd);
808
+ if (sshCommand) await setConfig("core.sshCommand", sshCommand, "local", opts.cwd);
809
+ await setConfig("colabor.managed", "true", "local", opts.cwd);
810
+ await setConfig("colabor.managed-by", opts.source, "local", opts.cwd);
811
+ const state = await readState(opts.cwd);
812
+ state.activeIdentity = identity?.id;
813
+ state.heldBy = nowHeldBy(session, opts.source);
814
+ await writeState(state, opts.cwd);
815
+ let keyLoaded;
816
+ if (identity?.sshKeyPath && identity.sshKeyFingerprint) {
817
+ keyLoaded = await loadKey({
818
+ keyPath: identity.sshKeyPath,
819
+ fingerprint: identity.sshKeyFingerprint,
820
+ askpassScriptPath: opts.askpassScriptPath,
821
+ socketPath: opts.socketPath,
822
+ token: opts.token,
823
+ passphraseCommand: identity.passphraseCommand,
824
+ useAppleKeychain: true
825
+ });
826
+ }
827
+ await appendAudit({
828
+ action: "identity.use",
829
+ source: opts.source,
830
+ identity: identity?.id,
831
+ identityName: identity?.name ?? name,
832
+ fingerprint: identity?.sshKeyFingerprint,
833
+ repo: await safeTopLevel(opts.cwd),
834
+ result: conflict ? "warn" : "ok",
835
+ message: conflict ? `overrode ${conflict.heldBy.session}` : void 0
836
+ });
837
+ return { name, email, sshCommand, conflict, keyLoaded };
838
+ }
839
+ async function applyIdentity(id, opts) {
840
+ const identity = await getIdentity(id);
841
+ const sshCommand = identity.sshKeyPath ? `ssh -i ${identity.sshKeyPath} -o IdentitiesOnly=yes` : void 0;
842
+ const result = await applyResolvedIdentity({
843
+ name: opts.asName ?? identity.name,
844
+ email: opts.asEmail ?? identity.email,
845
+ sshCommand,
846
+ identity,
847
+ opts
848
+ });
849
+ return { identity, result };
850
+ }
851
+
852
+ // src/core/identity/revert.ts
853
+ async function safeTopLevel2(cwd) {
854
+ try {
855
+ return await topLevel(cwd);
856
+ } catch {
857
+ return void 0;
858
+ }
859
+ }
860
+ async function restoreKey(key, value, cwd) {
861
+ if (value === void 0) await unsetConfig(key, "local", cwd);
862
+ else await setConfig(key, value, "local", cwd);
863
+ }
864
+ async function revertRepo(opts) {
865
+ const state = await readState(opts.cwd);
866
+ const backups = state.backups;
867
+ const managed = await getConfig("colabor.managed", "local", opts.cwd);
868
+ if (backups) {
869
+ await restoreKey("user.name", backups.userName, opts.cwd);
870
+ await restoreKey("user.email", backups.userEmail, opts.cwd);
871
+ await restoreKey("core.sshCommand", backups.sshCommand, opts.cwd);
872
+ await restoreKey("commit.template", backups.commitTemplate, opts.cwd);
873
+ }
874
+ if (state.activeIdentity) {
875
+ try {
876
+ const id = await getIdentity(state.activeIdentity);
877
+ if (id.sshKeyPath) await removeKey(id.sshKeyPath);
878
+ } catch {
879
+ }
880
+ }
881
+ await unsetConfig("colabor.managed", "local", opts.cwd);
882
+ await unsetConfig("colabor.managed-by", "local", opts.cwd);
883
+ await unsetAllConfig("colabor.selected", "local", opts.cwd);
884
+ await clearTemplate(opts.cwd).catch(() => {
885
+ });
886
+ state.activeIdentity = void 0;
887
+ state.backups = void 0;
888
+ state.heldBy = void 0;
889
+ await writeState(state, opts.cwd);
890
+ await appendAudit({
891
+ action: "identity.revert",
892
+ source: opts.source,
893
+ repo: await safeTopLevel2(opts.cwd),
894
+ result: managed === "true" ? "ok" : "warn",
895
+ message: managed === "true" ? void 0 : "repo was not managed"
896
+ });
897
+ return { restored: backups, hadBackup: !!backups };
898
+ }
899
+ async function safeTopLevel3(cwd) {
900
+ try {
901
+ return await topLevel(cwd);
902
+ } catch {
903
+ return void 0;
904
+ }
905
+ }
906
+ async function shred(path) {
907
+ if (process.platform !== "win32") {
908
+ const r = child_process.spawnSync("shred", ["-u", path]);
909
+ if (r.status === 0) return true;
910
+ }
911
+ try {
912
+ await promises.unlink(path);
913
+ return true;
914
+ } catch {
915
+ return false;
916
+ }
917
+ }
918
+ async function logoutIdentity(opts) {
919
+ const state = await readState(opts.cwd);
920
+ let id = opts.id ?? state.activeIdentity;
921
+ if (!id) {
922
+ const { identities } = await listIdentities();
923
+ if (identities.length === 1) id = identities[0].id;
924
+ else throw Errors.usage("no active identity \u2014 specify one: git colabor identity logout <id>");
925
+ }
926
+ const identity = await getIdentity(id);
927
+ let agentRemoved = false;
928
+ let keyfileShredded = false;
929
+ if (identity.sshKeyPath) {
930
+ agentRemoved = await removeKey(identity.sshKeyPath);
931
+ keyfileShredded = await shred(identity.sshKeyPath);
932
+ }
933
+ if (state.activeIdentity === identity.id) {
934
+ state.activeIdentity = void 0;
935
+ state.heldBy = void 0;
936
+ await writeState(state, opts.cwd);
937
+ }
938
+ await appendAudit({
939
+ action: "identity.logout",
940
+ source: opts.source,
941
+ identity: identity.id,
942
+ identityName: identity.name,
943
+ fingerprint: identity.sshKeyFingerprint,
944
+ repo: await safeTopLevel3(opts.cwd)
945
+ });
946
+ return {
947
+ identity: { id: identity.id, name: identity.name, fingerprint: identity.sshKeyFingerprint },
948
+ agentRemoved,
949
+ keyfileShredded
950
+ };
951
+ }
952
+ var SOCKET_TIMEOUT_MS = 3e3;
953
+ function askSocket(socketPath, token, fingerprint) {
954
+ return new Promise((resolve4) => {
955
+ let settled = false;
956
+ const done = (v) => {
957
+ if (!settled) {
958
+ settled = true;
959
+ resolve4(v);
960
+ }
961
+ };
962
+ const sock = net.connect(socketPath, () => {
963
+ sock.write(JSON.stringify({ token, fingerprint }) + "\n");
964
+ });
965
+ let data = "";
966
+ sock.on("data", (d) => {
967
+ data += d.toString("utf8");
968
+ });
969
+ sock.on("close", () => done(data.replace(/\r?\n$/, "") || void 0));
970
+ sock.on("error", () => done(void 0));
971
+ setTimeout(() => {
972
+ sock.destroy();
973
+ done(void 0);
974
+ }, SOCKET_TIMEOUT_MS).unref?.();
975
+ });
976
+ }
977
+ function runPassphraseCommand(command) {
978
+ return new Promise((resolve4) => {
979
+ const child = child_process.spawn(command, { shell: true, stdio: ["ignore", "pipe", "pipe"] });
980
+ let out = "";
981
+ child.stdout.on("data", (d) => {
982
+ out += d.toString("utf8");
983
+ });
984
+ child.on("error", () => resolve4(void 0));
985
+ child.on("close", () => resolve4(out.replace(/\r?\n$/, "") || void 0));
986
+ });
987
+ }
988
+ async function resolvePassphrase(fingerprint, opts = {}) {
989
+ if (opts.socketPath && opts.token) {
990
+ const got = await askSocket(opts.socketPath, opts.token, fingerprint);
991
+ if (got) return got;
992
+ }
993
+ if (opts.passphraseCommand) {
994
+ const got = await runPassphraseCommand(opts.passphraseCommand);
995
+ if (got) return got;
996
+ }
997
+ if (opts.interactive && process.stdin.isTTY) {
998
+ return await promptPassphraseTty(`Passphrase for ${fingerprint}: `);
999
+ }
1000
+ throw Errors.secretUnavailable("no passphrase source available", [
1001
+ "use --passphrase-command <cmd>",
1002
+ "run within the VS Code extension (provides the askpass bridge)",
1003
+ "import a passphraseless key"
1004
+ ]);
1005
+ }
1006
+ async function promptPassphraseTty(prompt) {
1007
+ const posix = process.platform !== "win32";
1008
+ process.stderr.write(prompt);
1009
+ if (posix) child_process.spawn("stty", ["-echo"], { stdio: "inherit" });
1010
+ const rl = promises$1.createInterface({ input: process.stdin, terminal: false });
1011
+ try {
1012
+ return await new Promise((resolve4) => {
1013
+ rl.on("line", (line) => resolve4(line));
1014
+ });
1015
+ } finally {
1016
+ rl.close();
1017
+ if (posix) child_process.spawn("stty", ["echo"], { stdio: "inherit" });
1018
+ process.stderr.write("\n");
1019
+ }
1020
+ }
1021
+
1022
+ exports.AppError = AppError;
1023
+ exports.Author = Author;
1024
+ exports.COAUTHORS_FILENAME = COAUTHORS_FILENAME;
1025
+ exports.CO_AUTHOR_TRAILER = CO_AUTHOR_TRAILER;
1026
+ exports.EXIT_CODES = EXIT_CODES;
1027
+ exports.Errors = Errors;
1028
+ exports.GitError = GitError;
1029
+ exports.addCoAuthor = addCoAuthor;
1030
+ exports.addConfigValue = addConfigValue;
1031
+ exports.addIdentity = addIdentity;
1032
+ exports.addRedactable = addRedactable;
1033
+ exports.appendAudit = appendAudit;
1034
+ exports.applyIdentity = applyIdentity;
1035
+ exports.applyResolvedIdentity = applyResolvedIdentity;
1036
+ exports.askSocket = askSocket;
1037
+ exports.atomicWriteJson = atomicWriteJson;
1038
+ exports.auditLogPath = auditLogPath;
1039
+ exports.captureBackupIfFirstTouch = captureBackupIfFirstTouch;
1040
+ exports.clearSelected = clearSelected;
1041
+ exports.clearTemplate = clearTemplate;
1042
+ exports.cliSessionId = cliSessionId;
1043
+ exports.coAuthorsPath = coAuthorsPath;
1044
+ exports.createLogger = createLogger;
1045
+ exports.dataDir = dataDir;
1046
+ exports.defaultLogFile = defaultLogFile;
1047
+ exports.detectConflict = detectConflict;
1048
+ exports.ensureCommitTemplate = ensureCommitTemplate;
1049
+ exports.fingerprintOfFile = fingerprintOfFile;
1050
+ exports.formatMessage = formatMessage;
1051
+ exports.genId = genId;
1052
+ exports.genKey = genKey;
1053
+ exports.getAllConfig = getAllConfig;
1054
+ exports.getAuthor = getAuthor;
1055
+ exports.getConfig = getConfig;
1056
+ exports.getIdentity = getIdentity;
1057
+ exports.getSelected = getSelected;
1058
+ exports.git = git;
1059
+ exports.gitDir = gitDir;
1060
+ exports.gitMessagePath = gitMessagePath;
1061
+ exports.gitRaw = gitRaw;
1062
+ exports.headSha = headSha;
1063
+ exports.homeCoAuthorsPath = homeCoAuthorsPath;
1064
+ exports.importKey = importKey;
1065
+ exports.insideWorkTree = insideWorkTree;
1066
+ exports.isEncrypted = isEncrypted;
1067
+ exports.isRepo = isRepo;
1068
+ exports.isStale = isStale;
1069
+ exports.keyFileName = keyFileName;
1070
+ exports.keyFilePath = keyFilePath;
1071
+ exports.keysDir = keysDir;
1072
+ exports.listAgent = listAgent;
1073
+ exports.listAuthors = listAuthors;
1074
+ exports.listIdentities = listIdentities;
1075
+ exports.loadKey = loadKey;
1076
+ exports.logoutIdentity = logoutIdentity;
1077
+ exports.mapPath = mapPath;
1078
+ exports.materializeKey = materializeKey;
1079
+ exports.nowHeldBy = nowHeldBy;
1080
+ exports.printTrailers = printTrailers;
1081
+ exports.readAudit = readAudit;
1082
+ exports.readAuthors = readAuthors;
1083
+ exports.readCurrentIdentityConfig = readCurrentIdentityConfig;
1084
+ exports.readMap = readMap;
1085
+ exports.readState = readState;
1086
+ exports.redact = redact;
1087
+ exports.removeIdentity = removeIdentity;
1088
+ exports.removeKey = removeKey;
1089
+ exports.removeSection = removeSection;
1090
+ exports.repoAuthors = repoAuthors;
1091
+ exports.repoStatus = repoStatus;
1092
+ exports.resolvePassphrase = resolvePassphrase;
1093
+ exports.resolveTemplatePath = resolveTemplatePath;
1094
+ exports.revertRepo = revertRepo;
1095
+ exports.runBin = runBin;
1096
+ exports.runPassphraseCommand = runPassphraseCommand;
1097
+ exports.schemaToAuthors = schemaToAuthors;
1098
+ exports.setConfig = setConfig;
1099
+ exports.setDefault = setDefault;
1100
+ exports.setSelected = setSelected;
1101
+ exports.statePath = statePath;
1102
+ exports.toErrorPayload = toErrorPayload;
1103
+ exports.topLevel = topLevel;
1104
+ exports.unsetAllConfig = unsetAllConfig;
1105
+ exports.unsetConfig = unsetConfig;
1106
+ exports.validateEmail = validateEmail;
1107
+ exports.writeAuthors = writeAuthors;
1108
+ exports.writeCoAuthorsToTemplate = writeCoAuthorsToTemplate;
1109
+ exports.writeMap = writeMap;
1110
+ exports.writeState = writeState;