git-colabor 0.1.9 → 0.1.11
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 +12 -10
- package/dist/askpass.cjs +26 -1
- package/dist/cli.cjs +489 -200
- package/dist/index.cjs +308 -158
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ You share a machine — a lab workstation, a pair-programming box, a Remote-SSH
|
|
|
16
16
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
19
|
-
- **Identities** — named `{ name, email, SSH key }` profiles; `identity use` writes `user.name`, `user.email`, and `core.sshCommand` for the current repo and snapshots prior config so `revert` can restore it. Keys are never auto-loaded into ssh-agent — that's the explicit `identity agent <
|
|
19
|
+
- **Identities** — named `{ name, email, SSH key }` profiles; `identity use` writes `user.name`, `user.email`, and `core.sshCommand` for the current repo and snapshots prior config so `revert` can restore it. Keys are never auto-loaded into ssh-agent — that's the explicit `identity agent <email>`.
|
|
20
20
|
- **Co-authors** — pick people from your identities; trailers are seeded into the commit template and stay in sync.
|
|
21
21
|
- **Safe key handling** — private keys are referenced in place (never copied or modified), passphrases never appear on `argv` / `ps` (SSH_ASKPASS bridge), a broken key reference degrades to a key-less apply.
|
|
22
22
|
- **Coordination** — advisory `heldBy` session locking warns when a second session (another terminal, another VS Code window) is about to override the repo identity; nothing is ever silently clobbered.
|
|
@@ -45,7 +45,7 @@ git colabor identity add --name "Robert" --email me@personal.io \
|
|
|
45
45
|
--key ~/.ssh/id_ed25519_personal
|
|
46
46
|
|
|
47
47
|
# 2. Use one in the current repo
|
|
48
|
-
git colabor identity use
|
|
48
|
+
git colabor identity use "Robert He <robert@work.io>" # or the bare email when unique
|
|
49
49
|
|
|
50
50
|
# 3. Pairing: add a co-author (must exist as an identity)
|
|
51
51
|
git colabor coauthor add jamie@example.com # next commit only
|
|
@@ -68,7 +68,7 @@ git colabor identity revert # restore pre-tool git config
|
|
|
68
68
|
| `coauthor rm <email\|id>` | Remove a co-author from every scope it is active in. |
|
|
69
69
|
| `coauthor ls [filter]` | Active co-authors + available candidates (identities minus the active one); optional substring filter. |
|
|
70
70
|
| `coauthor print` | Print the `Co-authored-by:` trailer blob for the current selection. |
|
|
71
|
-
| `coauthor suggest [filter]` | Suggest co-authors from `git shortlog`
|
|
71
|
+
| `coauthor suggest [filter]` | Suggest co-authors from history — `git shortlog` committers **plus every `Co-authored-by:` trailer author**; interactive pick without `--json`. |
|
|
72
72
|
|
|
73
73
|
Selecting co-authors rewrites the commit template (`commit.template` / `~/.gitmessage`): all existing `Co-authored-by:` trailers are stripped and the current selection re-appended — the same behavior as git-mob's message formatter.
|
|
74
74
|
|
|
@@ -77,16 +77,17 @@ Selecting co-authors rewrites the commit template (`commit.template` / `~/.gitme
|
|
|
77
77
|
| Command | Effect |
|
|
78
78
|
| --- | --- |
|
|
79
79
|
| `identity ls` | List identities; `*` marks the default; shows key fingerprint. |
|
|
80
|
-
| `identity use <
|
|
81
|
-
| `identity agent <
|
|
80
|
+
| `identity use <name-email>` | Apply identity to the current repo (config + state; reports whether the key is in ssh-agent, never loads it). Flags: `--source cli\|ext`, `--as-name`, `--as-email` (override committer fields), `--config-scope local\|global` (which git-config file to write — default `local`; `global` writes `~/.gitconfig` and leaves the repo untouched). With an encrypted key neither in the agent nor served by the extension bridge, prints an `agent-reminder` pointing at `ssh-add <key>`. |
|
|
81
|
+
| `identity agent <name-email>` | The only path that loads a key into ssh-agent. `--remove` unloads (`ssh-add -d`); `--verify` proves the extension-session passphrase is correct without any agent write (`ssh-keygen -y` under askpass). |
|
|
82
82
|
| `identity add` | `--name`, `--email` (required); `--key <path>` (import), `--host`, `--default`. |
|
|
83
|
-
| `identity rm <
|
|
83
|
+
| `identity rm <name-email>` | Remove from the identity map (logs out first, best-effort; imported identities are also hidden from future auto-imports). |
|
|
84
84
|
| `identity import` | Add every distinct **committer** from the repo history as a key-less identity (idempotent, skips hidden emails; driven automatically by the extension on repo open). |
|
|
85
|
-
| `identity set <
|
|
86
|
-
| `identity sign <
|
|
85
|
+
| `identity set <name-email>` | Edit in place: `--name <n>`, `--email <e>`, `--key <path>` (re-reference the push/auth key), `--no-key` (clear), `--scope user\|machine\|project`, `--sign-key <path>` (bind a DEDICATED SSH signing key — separate from the push key), `--gpg-key <key>` (bind a secret GPG signing key — fingerprint, key id or email; stored as the fingerprint), `--alias <a>` / `--no-alias` (a unique short handle — letters/digits/dot/dash/underscore/`@` — shown first in the tree and usable as a CLI ref; resolution is alias-FIRST so an @-shaped alias beats an email), `--no-sign-key` / `--no-gpg-key` (unbind the sign key; signing falls back to the push key), `--sign-commits` / `--no-sign-commits` (the per-identity signing preference: every later `use` of the identity re-enables / keeps off commit signing). |
|
|
86
|
+
| `identity sign <email>` / `identity sign [id] --off` | Opt-in commit signing with the identity's key — its bound GPG key (`gpg.format=openpgp`), else its SSH key (`gpg.format=ssh`) — writes `commit.gpgsign=true`, `gpg.format`, `user.signingKey`. The choice is remembered per identity: `identity sign` stores it, and every later `identity use` of that identity re-enables signing with its key (switching to a key-less identity turns it off for that repo); `--off` drops the preference too. `--off` drops colabor's keys and, when global/system config would still sign, pins `commit.gpgsign=false` locally — off means this repo does not sign. |
|
|
87
87
|
| `identity gpg-keys` | Secret GPG keys usable for signing (via `gpg.program`, default `gpg`): fingerprint + user ids. |
|
|
88
|
-
| `identity
|
|
89
|
-
| `identity
|
|
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
|
+
| `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, `managed` when colabor turned it on, and the GPG key's `keyEmails`). |
|
|
90
91
|
| `identity audit` | `--repo <path>`, `--since <date>`, `--tail <n>` filters over the audit log. |
|
|
91
92
|
| `identity doctor` | Self-check: binaries, identity map, key dir, agent, askpass bundle, repo markers. |
|
|
92
93
|
|
|
@@ -125,6 +126,7 @@ This is the contract the VS Code extension consumes.
|
|
|
125
126
|
|
|
126
127
|
| Path | Purpose | Mode |
|
|
127
128
|
| --- | --- | --- |
|
|
129
|
+
| `~/.config/git-colabor/session-*.json` | One per running extension instance (askpass bridge endpoint + token). Auto-cleaned: descriptors whose extension-host pid is gone — and any orphaned `askpass-*.sock` — are deleted on every new session and on every CLI bridge discovery. | `0600` |
|
|
128
130
|
| `~/.config/git-colabor/identities.json` | Identity map (referenced key paths + fingerprints; env `GIT_COLABOR_MAP`) | `0600` |
|
|
129
131
|
| `~/.config/git-colabor/audit.log` | JSONL audit trail | `0600` |
|
|
130
132
|
| `<git-dir>/colabor/state.json` | Per-repo state: active identity, `heldBy`, opt-in signing flag, config backups | `0600` |
|
package/dist/askpass.cjs
CHANGED
|
@@ -40,6 +40,15 @@ function dataDir() {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
// src/core/secrets/session-bridge.ts
|
|
43
|
+
function pidIsAlive(pid) {
|
|
44
|
+
if (typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0) return false;
|
|
45
|
+
try {
|
|
46
|
+
process.kill(pid, 0);
|
|
47
|
+
return true;
|
|
48
|
+
} catch (e) {
|
|
49
|
+
return e.code === "EPERM";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
43
52
|
function discoverSessionBridges() {
|
|
44
53
|
try {
|
|
45
54
|
const dir = dataDir();
|
|
@@ -48,7 +57,23 @@ function discoverSessionBridges() {
|
|
|
48
57
|
for (const s of sessions) {
|
|
49
58
|
try {
|
|
50
59
|
const parsed = JSON.parse(fs.readFileSync(path.join(dir, s.f), "utf8"));
|
|
51
|
-
if (parsed.socketPath
|
|
60
|
+
if (!parsed.socketPath || !parsed.token) continue;
|
|
61
|
+
const ourSock = /^askpass-[\w.-]+\.sock$/.test(path.basename(parsed.socketPath)) && path.join(dir, path.basename(parsed.socketPath)) === parsed.socketPath;
|
|
62
|
+
const stale = parsed.pid !== void 0 && !pidIsAlive(parsed.pid) || !ourSock || !fs.existsSync(parsed.socketPath);
|
|
63
|
+
if (stale) {
|
|
64
|
+
if (ourSock && fs.existsSync(parsed.socketPath)) {
|
|
65
|
+
try {
|
|
66
|
+
fs.rmSync(parsed.socketPath);
|
|
67
|
+
} catch {
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
fs.unlinkSync(path.join(dir, s.f));
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
out.push({ socketPath: parsed.socketPath, token: parsed.token });
|
|
52
77
|
} catch {
|
|
53
78
|
}
|
|
54
79
|
}
|