git-colabor 0.2.6 → 0.2.8
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/README.md +3 -3
- package/dist/cli.cjs +3 -16
- package/dist/index.cjs +3 -38
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# git-colabor
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<img src="https://raw.githubusercontent.com/hnrobert/vscode-git-colabor/main/assets/images/
|
|
4
|
+
<img src="https://raw.githubusercontent.com/hnrobert/vscode-git-colabor/main/assets/images/logo.png" width="140" alt="Git Colabor logo" />
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
**`git colabor`** — switch the Git **committer + pusher identity** and **SSH key** per repository, and manage **co-authors** with a better experience, from one CLI.
|
|
@@ -87,7 +87,7 @@ Selecting co-authors rewrites the commit template (`commit.template` / `~/.gitme
|
|
|
87
87
|
| `identity gpg-keys` | Secret GPG keys usable for signing (via `gpg.program`, default `gpg`): fingerprint + user ids. |
|
|
88
88
|
| `identity unset-config <name-email>` | Strip an identity's name/email/keys from ONE git-config file (`--scope local\|global`, default local; content-matched — another person's config survives). Local scope also arms the standing-down guard: auto-apply (extension reconcile) will not re-materialize the identity into that repo until an explicit local `identity use`. |
|
|
89
89
|
| `identity logout [id]` | Remove key from `ssh-agent` (`--no-agent` keeps it loaded) and clear the identity's git-config layer: `user.name`/`user.email` on match, plus any `core.sshCommand` / signing keys its previous `use` left in the repo — even after the config moved on to someone else. Another person's committer config always survives. |
|
|
90
|
-
| `identity status` | Per-repo snapshot: active identity, per-scope config identities (`configIdentities.repo` / `.global` — which person each git-config file names), selected + available co-authors, and the **effective** commit signing (`signing`: `enabled`, `format`, `key`, the `scope`/`origin` file `commit.gpgsign` comes from,
|
|
90
|
+
| `identity status` | Per-repo snapshot: active identity, per-scope config identities (`configIdentities.repo` / `.global` — which person each git-config file names), selected + available co-authors, and the **effective** commit signing (`signing`: `enabled`, `format`, `key`, the `scope`/`origin` file `commit.gpgsign` comes from, and the GPG key's `keyEmails`). |
|
|
91
91
|
| `identity audit` | `--repo <path>`, `--since <date>`, `--tail <n>` filters over the audit log. |
|
|
92
92
|
| `identity doctor` | Self-check: binaries, identity map, key dir, agent, askpass bundle, repo markers. |
|
|
93
93
|
|
|
@@ -134,7 +134,7 @@ This is the contract the VS Code extension consumes.
|
|
|
134
134
|
|
|
135
135
|
(Windows: the data dir is `%APPDATA%\git-colabor`.)
|
|
136
136
|
|
|
137
|
-
Git config keys **written locally** per repo: `user.name`, `user.email`, `core.sshCommand` (only when the identity has a key: `ssh -i <key> -o IdentitiesOnly=yes`), and — after an explicit `identity sign` — commit signing (`commit.gpgsign=true`, `gpg.format=openpgp|ssh`, `user.signingKey=<GPG fingerprint | SSH key path>`; switching to a key-less identity or `--off` clears them and pins `commit.gpgsign=false` when global/system config would still sign),
|
|
137
|
+
Git config keys **written locally** per repo: `user.name`, `user.email`, `core.sshCommand` (only when the identity has a key: `ssh -i <key> -o IdentitiesOnly=yes`), and — after an explicit `identity sign` — commit signing (`commit.gpgsign=true`, `gpg.format=openpgp|ssh`, `user.signingKey=<GPG fingerprint | SSH key path>`; switching to a key-less identity or `--off` clears them and pins `commit.gpgsign=false` when global/system config would still sign), plus multi-valued `colabor.selected` (`Name <email>` per co-author). `commit.template` is set **globally** only if unset in any scope.
|
|
138
138
|
|
|
139
139
|
## git-mob compatibility
|
|
140
140
|
|
package/dist/cli.cjs
CHANGED
|
@@ -753,7 +753,7 @@ async function loadKey(opts) {
|
|
|
753
753
|
return {
|
|
754
754
|
loaded: true,
|
|
755
755
|
via: "keygen-verify",
|
|
756
|
-
message: "passphrase verified
|
|
756
|
+
message: "passphrase verified, but no ssh-agent is available \u2014 the key is not loaded into an agent; it will unlock at ssh time via SSH_ASKPASS"
|
|
757
757
|
};
|
|
758
758
|
}
|
|
759
759
|
return { loaded: false, via: "askpass", message: "passphrase rejected" };
|
|
@@ -1001,8 +1001,7 @@ async function signingStatus(cwd) {
|
|
|
1001
1001
|
key: key?.value || null,
|
|
1002
1002
|
format: format?.value || "openpgp",
|
|
1003
1003
|
scope: sign2?.scope ?? null,
|
|
1004
|
-
origin: sign2?.origin ?? null
|
|
1005
|
-
managed: sign2?.scope === "local"
|
|
1004
|
+
origin: sign2?.origin ?? null
|
|
1006
1005
|
};
|
|
1007
1006
|
if (status2.enabled && status2.format === "openpgp" && status2.key) {
|
|
1008
1007
|
const emails = (await listSigningKeys(cwd, status2.key).catch(() => [])).flatMap((k) => k.emails);
|
|
@@ -1776,14 +1775,12 @@ init_agent();
|
|
|
1776
1775
|
init_rev();
|
|
1777
1776
|
|
|
1778
1777
|
// src/core/repo/status.ts
|
|
1779
|
-
init_config();
|
|
1780
1778
|
init_rev();
|
|
1781
1779
|
init_map();
|
|
1782
1780
|
init_types();
|
|
1783
1781
|
|
|
1784
1782
|
// src/core/repo/state.ts
|
|
1785
1783
|
init_rev();
|
|
1786
|
-
init_config();
|
|
1787
1784
|
init_io();
|
|
1788
1785
|
async function statePath(cwd) {
|
|
1789
1786
|
return path.join(await gitDir(cwd), "colabor", "state.json");
|
|
@@ -1805,21 +1802,13 @@ async function repoStatus(cwd) {
|
|
|
1805
1802
|
return {
|
|
1806
1803
|
inRepo: false,
|
|
1807
1804
|
repo: cwd ?? null,
|
|
1808
|
-
managed: false,
|
|
1809
|
-
managedBy: null,
|
|
1810
1805
|
activeIdentityId: null,
|
|
1811
1806
|
heldBy: null,
|
|
1812
1807
|
selected: [],
|
|
1813
1808
|
available: []
|
|
1814
1809
|
};
|
|
1815
1810
|
}
|
|
1816
|
-
const [
|
|
1817
|
-
getConfig("colabor.managed", "local", cwd),
|
|
1818
|
-
getConfig("colabor.managed-by", "local", cwd),
|
|
1819
|
-
readState(cwd),
|
|
1820
|
-
getSelected(cwd),
|
|
1821
|
-
listIdentities()
|
|
1822
|
-
]);
|
|
1811
|
+
const [state, selected, identityMap] = await Promise.all([readState(cwd), getSelected(cwd), listIdentities()]);
|
|
1823
1812
|
const selectedEmails = new Set(selected.map((a) => a.email));
|
|
1824
1813
|
const available = identityMap.identities.filter((i) => !selectedEmails.has(i.email)).map((i) => ({ key: genKey(i.name, i.email), name: i.name, email: i.email }));
|
|
1825
1814
|
return {
|
|
@@ -1828,8 +1817,6 @@ async function repoStatus(cwd) {
|
|
|
1828
1817
|
// /private/var on macOS) — the standing-down store and every per-repo
|
|
1829
1818
|
// comparison key off this exact form
|
|
1830
1819
|
repo: await topLevel(cwd),
|
|
1831
|
-
managed: managed === "true",
|
|
1832
|
-
managedBy: managedBy ?? null,
|
|
1833
1820
|
activeIdentityId: state.activeIdentity ?? null,
|
|
1834
1821
|
heldBy: state.heldBy ?? null,
|
|
1835
1822
|
selected: selected.map(toBrief),
|
package/dist/index.cjs
CHANGED
|
@@ -593,7 +593,6 @@ async function atomicWriteJson(path$1, data, mode) {
|
|
|
593
593
|
|
|
594
594
|
// src/core/repo/state.ts
|
|
595
595
|
init_rev();
|
|
596
|
-
init_config();
|
|
597
596
|
async function statePath(cwd) {
|
|
598
597
|
return path.join(await gitDir(cwd), "colabor", "state.json");
|
|
599
598
|
}
|
|
@@ -610,26 +609,6 @@ async function writeState(state, cwd) {
|
|
|
610
609
|
const p = await statePath(cwd);
|
|
611
610
|
await atomicWriteJson(p, state, 384);
|
|
612
611
|
}
|
|
613
|
-
async function readCurrentIdentityConfig(cwd) {
|
|
614
|
-
const [userName, userEmail, sshCommand, commitTemplate, commitGpgsign, gpgFormat, signingKey] = await Promise.all([
|
|
615
|
-
getConfig("user.name", "local", cwd),
|
|
616
|
-
getConfig("user.email", "local", cwd),
|
|
617
|
-
getConfig("core.sshCommand", "local", cwd),
|
|
618
|
-
getConfig("commit.template", "local", cwd),
|
|
619
|
-
getConfig("commit.gpgsign", "local", cwd),
|
|
620
|
-
getConfig("gpg.format", "local", cwd),
|
|
621
|
-
getConfig("user.signingKey", "local", cwd)
|
|
622
|
-
]);
|
|
623
|
-
return { userName, userEmail, sshCommand, commitTemplate, commitGpgsign, gpgFormat, signingKey };
|
|
624
|
-
}
|
|
625
|
-
async function captureBackupIfFirstTouch(cwd) {
|
|
626
|
-
const managed = await getConfig("colabor.managed", "local", cwd);
|
|
627
|
-
const state = await readState(cwd);
|
|
628
|
-
if (managed === "true" || state.backups) return state;
|
|
629
|
-
state.backups = await readCurrentIdentityConfig(cwd);
|
|
630
|
-
await writeState(state, cwd);
|
|
631
|
-
return state;
|
|
632
|
-
}
|
|
633
612
|
function isStale(heldBy, staleMinutes) {
|
|
634
613
|
const ageMs = Date.now() - new Date(heldBy.since).getTime();
|
|
635
614
|
return ageMs > staleMinutes * 6e4;
|
|
@@ -655,7 +634,6 @@ function nowHeldBy(session, source) {
|
|
|
655
634
|
}
|
|
656
635
|
|
|
657
636
|
// src/core/repo/status.ts
|
|
658
|
-
init_config();
|
|
659
637
|
init_rev();
|
|
660
638
|
|
|
661
639
|
// src/core/errors.ts
|
|
@@ -907,21 +885,13 @@ async function repoStatus(cwd) {
|
|
|
907
885
|
return {
|
|
908
886
|
inRepo: false,
|
|
909
887
|
repo: cwd ?? null,
|
|
910
|
-
managed: false,
|
|
911
|
-
managedBy: null,
|
|
912
888
|
activeIdentityId: null,
|
|
913
889
|
heldBy: null,
|
|
914
890
|
selected: [],
|
|
915
891
|
available: []
|
|
916
892
|
};
|
|
917
893
|
}
|
|
918
|
-
const [
|
|
919
|
-
getConfig("colabor.managed", "local", cwd),
|
|
920
|
-
getConfig("colabor.managed-by", "local", cwd),
|
|
921
|
-
readState(cwd),
|
|
922
|
-
getSelected(cwd),
|
|
923
|
-
listIdentities()
|
|
924
|
-
]);
|
|
894
|
+
const [state, selected, identityMap] = await Promise.all([readState(cwd), getSelected(cwd), listIdentities()]);
|
|
925
895
|
const selectedEmails = new Set(selected.map((a) => a.email));
|
|
926
896
|
const available = identityMap.identities.filter((i) => !selectedEmails.has(i.email)).map((i) => ({ key: genKey(i.name, i.email), name: i.name, email: i.email }));
|
|
927
897
|
return {
|
|
@@ -930,8 +900,6 @@ async function repoStatus(cwd) {
|
|
|
930
900
|
// /private/var on macOS) — the standing-down store and every per-repo
|
|
931
901
|
// comparison key off this exact form
|
|
932
902
|
repo: await topLevel(cwd),
|
|
933
|
-
managed: managed === "true",
|
|
934
|
-
managedBy: managedBy ?? null,
|
|
935
903
|
activeIdentityId: state.activeIdentity ?? null,
|
|
936
904
|
heldBy: state.heldBy ?? null,
|
|
937
905
|
selected: selected.map(toBrief),
|
|
@@ -1054,7 +1022,7 @@ async function loadKey(opts) {
|
|
|
1054
1022
|
return {
|
|
1055
1023
|
loaded: true,
|
|
1056
1024
|
via: "keygen-verify",
|
|
1057
|
-
message: "passphrase verified
|
|
1025
|
+
message: "passphrase verified, but no ssh-agent is available \u2014 the key is not loaded into an agent; it will unlock at ssh time via SSH_ASKPASS"
|
|
1058
1026
|
};
|
|
1059
1027
|
}
|
|
1060
1028
|
return { loaded: false, via: "askpass", message: "passphrase rejected" };
|
|
@@ -1295,8 +1263,7 @@ async function signingStatus(cwd) {
|
|
|
1295
1263
|
key: key?.value || null,
|
|
1296
1264
|
format: format?.value || "openpgp",
|
|
1297
1265
|
scope: sign?.scope ?? null,
|
|
1298
|
-
origin: sign?.origin ?? null
|
|
1299
|
-
managed: sign?.scope === "local"
|
|
1266
|
+
origin: sign?.origin ?? null
|
|
1300
1267
|
};
|
|
1301
1268
|
if (status.enabled && status.format === "openpgp" && status.key) {
|
|
1302
1269
|
const emails = (await listSigningKeys(cwd, status.key).catch(() => [])).flatMap((k) => k.emails);
|
|
@@ -1647,7 +1614,6 @@ exports.applyResolvedIdentity = applyResolvedIdentity;
|
|
|
1647
1614
|
exports.askSocket = askSocket;
|
|
1648
1615
|
exports.atomicWriteJson = atomicWriteJson;
|
|
1649
1616
|
exports.auditLogPath = auditLogPath;
|
|
1650
|
-
exports.captureBackupIfFirstTouch = captureBackupIfFirstTouch;
|
|
1651
1617
|
exports.clearIdentityConfigLayer = clearIdentityConfigLayer;
|
|
1652
1618
|
exports.clearSelected = clearSelected;
|
|
1653
1619
|
exports.clearTemplate = clearTemplate;
|
|
@@ -1698,7 +1664,6 @@ exports.mapPath = mapPath;
|
|
|
1698
1664
|
exports.nowHeldBy = nowHeldBy;
|
|
1699
1665
|
exports.printTrailers = printTrailers;
|
|
1700
1666
|
exports.readAudit = readAudit;
|
|
1701
|
-
exports.readCurrentIdentityConfig = readCurrentIdentityConfig;
|
|
1702
1667
|
exports.readMap = readMap;
|
|
1703
1668
|
exports.readState = readState;
|
|
1704
1669
|
exports.redact = redact;
|