git-colabor 0.1.4 → 0.1.5

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # git-colabor
2
2
 
3
+ <p align="center">
4
+ <img src="assets/images/git-co-author-enhanced.png" width="140" alt="Git Colabor logo" />
5
+ </p>
6
+
3
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.
4
8
 
5
9
  This is the CLI half of Git Colabor. A VS Code extension ([`vscode-git-colabor`](https://github.com/hnrobert/vscode-git-colabor)) bundles this binary and drives it over its `--json` interface — but the CLI is fully standalone and scriptable.
@@ -24,7 +28,7 @@ You share a machine — a lab workstation, a pair-programming box, a Remote-SSH
24
28
  Requires **Node.js >= 24**.
25
29
 
26
30
  ```bash
27
- npm install -g git-colabor # once published (M6)
31
+ npm install -g git-colabor
28
32
  # or from source:
29
33
  git clone git@github.com:hnrobert/git-colabor.git && cd git-colabor
30
34
  pnpm install && pnpm build && npm link
@@ -43,14 +47,14 @@ git colabor identity add --name "Robert" --email me@personal.io \
43
47
  # 2. Use one in the current repo
44
48
  git colabor identity use id_a1b2c3d4 # from `identity ls`
45
49
 
46
- # 3. Pairing: add a co-author and select them for this repo
47
- git colabor coauthor add jd "Jamie Doe" jamie@example.com
48
- git colabor coauthor use jd # trailers go into .gitmessage
50
+ # 3. Pairing: add a co-author (must exist as an identity)
51
+ git colabor coauthor add jamie@example.com # next commit only
52
+ git colabor coauthor add jamie@example.com --always # every commit in this repo
49
53
 
50
54
  git commit # Co-authored-by: trailer included
51
55
 
52
56
  # 4. Done pairing / leaving the repo
53
- git colabor coauthor solo
57
+ git colabor coauthor rm jamie@example.com
54
58
  git colabor identity revert # restore pre-tool git config
55
59
  ```
56
60
 
@@ -60,11 +64,10 @@ git colabor identity revert # restore pre-tool git config
60
64
 
61
65
  | Command | Effect |
62
66
  | --- | --- |
63
- | `coauthor ls [filter]` | List catalogue entries (key / name / email); optional substring filter. |
64
- | `coauthor use <key…>` | Select co-authors for the current repo (no args: print current selection). |
65
- | `coauthor solo` | Clear the selection. |
66
- | `coauthor print [-i]` | Print `Co-authored-by:` trailer blob (`-i`: comma-joined keys instead). |
67
- | `coauthor add <key> "Name" <email>` | Add to `.git-coauthors`. |
67
+ | `coauthor add <email\|id> [--always] [--global]` | Add a co-author: one-shot (next commit), `--always` (every commit in this repo), `--global` (every repo). The person must exist as an identity. |
68
+ | `coauthor rm <email\|id>` | Remove a co-author from every scope it is active in. |
69
+ | `coauthor ls [filter]` | Active co-authors + available candidates (identities minus the active one); optional substring filter. |
70
+ | `coauthor print` | Print the `Co-authored-by:` trailer blob for the current selection. |
68
71
  | `coauthor suggest [filter]` | Suggest co-authors from `git shortlog` history; interactive pick without `--json`. |
69
72
 
70
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.
@@ -125,7 +128,6 @@ This is the contract the VS Code extension consumes.
125
128
  | `~/.config/git-colabor/identities.json` | Identity map (referenced key paths + fingerprints; env `GIT_COLABOR_MAP`) | `0600` |
126
129
  | `~/.config/git-colabor/audit.log` | JSONL audit trail | `0600` |
127
130
  | `<git-dir>/colabor/state.json` | Per-repo state: active identity, `heldBy`, opt-in signing flag, config backups | `0600` |
128
- | `.git-coauthors` (repo, else `~/.git-coauthors`) | Co-author catalogue, git-mob-compatible JSON | — |
129
131
  | `~/.gitmessage` (or `commit.template`) | Commit template seeded with trailers | — |
130
132
 
131
133
  (Windows: the data dir is `%APPDATA%\git-colabor`.)
@@ -134,8 +136,8 @@ Git config keys **written locally** per repo: `user.name`, `user.email`, `core.s
134
136
 
135
137
  ## git-mob compatibility
136
138
 
137
- - Same `.git-coauthors` **JSON** format (`{"coauthors": {"jd": {"name": …, "email": …}}}`) and same 3-tier resolution (env → repo → home).
138
- - Same trailer format `Co-authored-by: NAME <EMAIL>` and template rewrite semantics; same shortlog-derived key generation (`rkrk` for "Richard Kotze" `<rkotze@…>`).
139
+ - Same trailer format `Co-authored-by: NAME <EMAIL>` and the same template-rewrite semantics (strip existing trailers, re-append the current selection).
140
+ - Co-author candidates come from **identities**, not `.git-coauthors` — the catalogue file plays no role.
139
141
  - Does **not** read or write git-mob's `git-mob.co-author` config — the two tools can coexist.
140
142
 
141
143
  ## Security notes
@@ -152,7 +154,6 @@ Full threat model: [docs/SECURITY.md](../docs/SECURITY.md) in the extension repo
152
154
  | --- | --- |
153
155
  | `GIT_COLABOR_MAP` | identity map path |
154
156
  | `GIT_COLABOR_AUDIT_FILE` | audit log path |
155
- | `GIT_COLABOR_COAUTHORS_PATH` | `.git-coauthors` path |
156
157
  | `GIT_COLABOR_MESSAGE_PATH` | commit template path |
157
158
  | `GIT_COLABOR_LOG_FILE` / `GIT_COLABOR_LOG_LEVEL` | CLI debug log |
158
159
  | `GIT_COLABOR_ASKPASS_SOCK` / `GIT_COLABOR_ASKPASS_TOKEN` | askpass bridge endpoint (set by the extension) |
package/dist/cli.cjs CHANGED
@@ -743,7 +743,7 @@ function isStale(heldBy, staleMinutes) {
743
743
  const ageMs = Date.now() - new Date(heldBy.since).getTime();
744
744
  return ageMs > staleMinutes * 6e4;
745
745
  }
746
- async function detectConflict(session, cwd, staleMinutes = 5) {
746
+ async function detectConflict(session, cwd, staleMinutes = Infinity) {
747
747
  const st = await readState(cwd);
748
748
  const hb = st.heldBy;
749
749
  if (!hb || hb.session === session) return null;
@@ -1274,7 +1274,7 @@ function toBrief(a) {
1274
1274
  }
1275
1275
 
1276
1276
  // src/cli/identity.ts
1277
- var USE_SPEC = { valueFlags: ["--source", "--as-name", "--as-email"], boolFlags: ["--no-override"] };
1277
+ var USE_SPEC = { valueFlags: ["--source", "--as-name", "--as-email", "--stale-minutes"], boolFlags: ["--no-override"] };
1278
1278
  var ADD_SPEC = {
1279
1279
  valueFlags: ["--name", "--email", "--key", "--host", "--source"],
1280
1280
  boolFlags: ["--default", "--no-encrypt"]
@@ -1437,6 +1437,10 @@ async function agentKey(p, ctx) {
1437
1437
  async function use(p, ctx) {
1438
1438
  const id = p.positionals[0];
1439
1439
  if (!id) throw Errors.usage("git colabor identity use <id>");
1440
+ const staleRaw = p.values["--stale-minutes"];
1441
+ if (staleRaw !== void 0 && !Number.isFinite(Number(staleRaw))) {
1442
+ throw Errors.usage(`--stale-minutes must be a number, got "${staleRaw}"`);
1443
+ }
1440
1444
  const current = await getIdentity(id);
1441
1445
  if (current.disabled) await updateIdentity(id, { disabled: void 0 });
1442
1446
  const { identity, result } = await applyIdentity(id, {
@@ -1445,6 +1449,7 @@ async function use(p, ctx) {
1445
1449
  asName: p.values["--as-name"],
1446
1450
  asEmail: p.values["--as-email"],
1447
1451
  noOverride: p.bools.has("--no-override"),
1452
+ staleMinutes: staleRaw ? Number(staleRaw) : void 0,
1448
1453
  askpassScriptPath: ctx.askpassScriptPath,
1449
1454
  socketPath: ctx.socketPath,
1450
1455
  token: ctx.token
package/dist/index.cjs CHANGED
@@ -447,7 +447,7 @@ function isStale(heldBy, staleMinutes) {
447
447
  const ageMs = Date.now() - new Date(heldBy.since).getTime();
448
448
  return ageMs > staleMinutes * 6e4;
449
449
  }
450
- async function detectConflict(session, cwd, staleMinutes = 5) {
450
+ async function detectConflict(session, cwd, staleMinutes = Infinity) {
451
451
  const st = await readState(cwd);
452
452
  const hb = st.heldBy;
453
453
  if (!hb || hb.session === session) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-colabor",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Git co-author + multi-identity + SSH key management CLI",
5
5
  "repository": {
6
6
  "type": "git",