@webinson/peer 0.3.0 → 0.3.1

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
@@ -70,7 +70,8 @@ printf '%s' "$YOUR_TEAM_KEY" | peer team connect https://memory.example.com --as
70
70
  The key comes on stdin and is saved in `~/.peer/team-memory/member.json` (mode 0600). After that, the first
71
71
  prompt of every thread in that repository (and the first after a resume or compaction) gets at most five
72
72
  teammates' published findings that match it: verified or observed, not your own, about 1,500 tokens,
73
- fenced as data from colleagues. The prompt's first 400 characters go to the team server as the search
73
+ fenced as data from colleagues; a page whose paths changed in three or more commits since it was last
74
+ confirmed comes marked "may be stale". The prompt's first 400 characters go to the team server as the search
74
75
  query. Nothing else of the thread is sent. `peer team status` shows the connection and the last recalls.
75
76
 
76
77
  ## Other commands
package/bin/peer.mjs CHANGED
@@ -552,6 +552,17 @@ function teamLog(line) {
552
552
  } catch {}
553
553
  }
554
554
 
555
+ // How much the code a page is about has changed since the page was last confirmed: commits in this checkout
556
+ // that touched its paths after that date. Pages without paths, or outside a git checkout, count as 0.
557
+ const STALE_AFTER = 3;
558
+ function changesSince(cwd, paths, date) {
559
+ if (!paths.length || !/^\d{4}-\d{2}-\d{2}$/.test(date)) return 0;
560
+ const top = git(cwd, "rev-parse", "--show-toplevel");
561
+ if (!top) return 0;
562
+ const log = git(top, "log", `--since=${date}T23:59:59`, "--format=%h", "--", ...paths);
563
+ return log ? log.split("\n").filter(Boolean).length : 0;
564
+ }
565
+
555
566
  async function teamHook(event) {
556
567
  const input = await readStdin();
557
568
  const team = readJson(TEAM_FILE);
@@ -594,7 +605,10 @@ async function teamHook(event) {
594
605
  const date = text.match(/last_confirmed: (\d{4}-\d{2}-\d{2})/)?.[1] ?? "";
595
606
  const body = text.split("\n").find((line, i) => i > 2 && line.trim() && !/^(kind|paths|contributors):/.test(line)) ?? "";
596
607
  const by = author === "team" ? contributors.join(", ") : author;
597
- const entry = `- [${status} ${kind}] ${title}\n ${body.replace(/[\u0000-\u001f\u007f-\u009f]/g, "").slice(0, 600)}\n (${plain(by)}, ${date}, ${hit.uri})`;
608
+ const paths = (text.match(/^paths: (.+)$/m)?.[1] ?? "").split(/,\s*/).filter((p) => p && !p.includes(".."));
609
+ const changed = changesSince(cwd, paths, date);
610
+ const stale = changed >= STALE_AFTER ? ` · may be stale: ${changed} commits touched its paths since ${date}, check before relying on it` : "";
611
+ const entry = `- [${status} ${kind}${stale}] ${title}\n ${body.replace(/[\u0000-\u001f\u007f-\u009f]/g, "").slice(0, 600)}\n (${plain(by)}, ${date}, ${hit.uri})`;
598
612
  if (used + entry.length > 6000) break;
599
613
  used += entry.length;
600
614
  entries.push(entry);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webinson/peer",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Share chosen Claude Code threads with your team: who has agents running and on what.",
5
5
  "license": "MIT",
6
6
  "type": "module",