@shadevkumar/agent-wrapped 0.4.1 → 0.5.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/README.md CHANGED
@@ -20,6 +20,7 @@ Nothing is uploaded unless you share. The story is one HTML file written to your
20
20
  - **Nothing is shared until you share it.** When you share, the site saves what's on your cards so the link can be short. Your prompts and logs never leave your computer. If the site can't be reached, you get a long link that carries the story inside it instead. Anyone you give the link to can watch it.
21
21
  - **You see the story before you share it,** and a card you leave out is not in the link at all.
22
22
  - **Your year in chapters** splits your year into stretches, each named from the everyday words that set it apart, found on your computer. Words that could be a person's or a private name are left out. Your `claude` command turns those few words into short names; it never sees a prompt. Chapters say what you worked on, so they are left out of a share link unless you add them. With `--no-ai`, a chapter is named by its top words.
23
+ - **Your first name** opens your story and heads its summary card. It is left out of a share link unless you add it.
23
24
  - **The letter** is written by your own `claude` command, if you have one. It gets your numbers and a few quotes that passed the same privacy check as the cards, never your prompts or logs. It doesn't save a session or load any project files. Run with `--no-ai` to use a template letter instead.
24
25
 
25
26
  ## What it reads
@@ -29,10 +30,12 @@ Nothing is uploaded unless you share. The story is one HTML file written to your
29
30
  | Claude Code | `~/.claude/history.jsonl` | the prompts you typed |
30
31
  | Claude Code | `~/.claude/projects/**/*.jsonl` | token use, how long each request took, and when the agent ran tests, made a commit, edited a file or was stopped |
31
32
  | Claude Code | `~/.claude/stats-cache.json` | older token totals |
33
+ | Claude Code | `~/.claude.json` | the first word of your account's name |
32
34
  | Codex | `~/.codex/thread_history_*.sqlite` | the prompts you typed, how long each request took, and the same tests, commits, edits and stops |
33
35
  | Codex | `~/.codex/state_*.sqlite` | token totals per thread |
34
36
  | Codex | `~/.codex/sessions/**/*.jsonl` | token splits for recent threads |
35
37
  | Cursor | `~/.cursor/projects/*/agent-transcripts/*/*.jsonl` | the prompts you typed to Cursor's agent, and the same tests, commits and edits |
38
+ | Git | `git config --global user.name` | the first word of your name, when your Claude account has none |
36
39
 
37
40
  Everything is opened read-only. For what the agents did, only the kind is kept (a test run, a commit, a push, a pull request, a deploy, a stop) and, for an edit, the file type: never a command, a file name or any output. Cursor doesn't log tokens or how long its agent worked, so Cursor adds prompts and work but no hours or cost. Claude Code deletes full transcripts after about 30 days, so older Claude token use and work can be missing. The prompts themselves go back further.
38
41
 
package/dist/cli.js CHANGED
@@ -8,6 +8,7 @@ import { nameChapters } from "./chapters.js";
8
8
  import { localDay } from "./files.js";
9
9
  import { templateLetter, writeLetter } from "./letter.js";
10
10
  import { computeWrapped } from "./moments.js";
11
+ import { firstName } from "./name.js";
11
12
  import { pickPersonality } from "./personality.js";
12
13
  import { bold, choose, dim, line, step } from "./screen.js";
13
14
  import { readInBackground } from "./read-worker.js";
@@ -77,7 +78,7 @@ const [letter, chapterNames] = await step(useAi ? "Writing your letter" : "Writi
77
78
  const dir = join(tmpdir(), "agent-wrapped");
78
79
  mkdirSync(dir, { recursive: true });
79
80
  const file = join(dir, `agent-wrapped-${localDay(new Date())}${span === "month" ? "-last-30-days" : ""}.html`);
80
- writeFileSync(file, buildHtml(storyData(wrapped, personality, letter, chapterNames, span)));
81
+ writeFileSync(file, buildHtml(storyData(wrapped, personality, letter, chapterNames, span, firstName(home))));
81
82
  const hours = wrapped.totals.agentHours >= 1 ? `, ${n(wrapped.totals.agentHours)} hours of agent work` : "";
82
83
  line();
83
84
  console.log(` You are ${bold(personality.name)}.`);
package/dist/name.js ADDED
@@ -0,0 +1,22 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { join } from "node:path";
3
+ import { readJson } from "./files.js";
4
+ // The first name the story greets you by: from your Claude account, else from
5
+ // git. Only the first word, so a full name never ends up on a card.
6
+ export function firstName(home) {
7
+ const account = readJson(join(home, ".claude.json"))?.oauthAccount;
8
+ for (const full of [account?.displayName, account?.fullName, gitName(home)]) {
9
+ const first = typeof full === "string" ? full.trim().split(/\s+/)[0].replace(/\p{C}/gu, "") : "";
10
+ if (first)
11
+ return first.slice(0, 24);
12
+ }
13
+ return null;
14
+ }
15
+ function gitName(home) {
16
+ try {
17
+ return execFileSync("git", ["config", "--global", "user.name"], { env: { ...process.env, HOME: home }, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] });
18
+ }
19
+ catch {
20
+ return null; // no git, or no name set
21
+ }
22
+ }
@@ -280,6 +280,9 @@ html.home:not(.fonts-in) #home { visibility: hidden; }
280
280
  <button class="primary" data-copy-command>Copy</button>
281
281
  </div>
282
282
  <div class="row">
283
+ <button id="ending-copy">Copy link</button>
284
+ <a class="button" id="ending-x" href="#">Post on X</a>
285
+ <a class="button" id="ending-linkedin" href="#">Post on LinkedIn</a>
283
286
  <button data-replay>Watch again</button>
284
287
  </div>
285
288
  </div>
@@ -29,6 +29,7 @@ const FIELDS = [
29
29
  "period",
30
30
  ["shipped", ["since", "pushes", "prs", "deploys", ["biggestWeek", ["from", "to", "commits"]]]],
31
31
  ["crashouts", ["count", ["worstDay", ["day", "count"]], "word"]],
32
+ "name",
32
33
  ];
33
34
 
34
35
  export function toLink(data, fields = FIELDS) {
@@ -954,13 +954,14 @@ function buildCards(D) {
954
954
  const plain = (l) => l === "," || l === ":" || l === "." || l === " AM";
955
955
  const big = (size) => ({ family: "Geist", weight: 600, size });
956
956
  const say = (size = 50) => ({ size, style: "italic" });
957
+ const opening = D.name ? `${D.name}, your agents have been talking about you.` : "Your agents have been talking about you.";
957
958
 
958
959
  add({
959
960
  id: "intro", name: "Intro", ready: 2.6,
960
- alt: "Your agents have been talking about you.",
961
+ alt: opening,
961
962
  visual: (ctx, t, fx, cw, b) => typeRow(ctx, b, ["h", "e", "y"], 120, 210, t, 0.4, fx, cw, { step: 0.17 }),
962
963
  words(ctx, t, fx, cw, b) {
963
- const y = text(ctx, b, "Your agents have been talking about you.", 0, { ...big(78), color: cw.ink, alpha: fade(t, 1.3) });
964
+ const y = text(ctx, b, opening, 0, { ...big(78), color: cw.ink, alpha: fade(t, 1.3) });
964
965
  if (D.range) {
965
966
  text(ctx, b, `Here's what we noticed, ${day(D.range.from)} to ${day(D.range.to)}.`, y + 20, {
966
967
  ...say(48), color: cw.soft, alpha: fade(t, 2.1),
@@ -1441,7 +1442,7 @@ function buildCards(D) {
1441
1442
  id: "summary", name: "Summary", ready: 0.7 + tiles.length * 0.25,
1442
1443
  alt: `Summary: ${p.name}. ${num(D.prompts)} prompts.`,
1443
1444
  head(ctx, t, fx, cw, b) {
1444
- const y = text(ctx, b, `My ${SPAN} with AI agents`, 0, { ...say(), color: cw.soft });
1445
+ const y = text(ctx, b, `${D.name ? `${D.name}'s` : "My"} ${SPAN} with AI agents`, 0, { ...say(), color: cw.soft });
1445
1446
  text(ctx, b, p.name, y + 10, { family: "Geist", weight: 700, size: 92, color: cw.ink, lh: 1.05 });
1446
1447
  },
1447
1448
  visual(ctx, t, fx, cw, b) {
@@ -1742,10 +1743,11 @@ const postLinkedIn = document.getElementById("post-linkedin");
1742
1743
  const LEAVABLE = {
1743
1744
  chapters: "chapters", "top-typo": "topTypo", spellings: "spellings", slip: "slip", "top-prompts": "topPrompts", catchphrase: "catchphrase",
1744
1745
  talk: "talk", crashouts: "crashouts", night: "night", streak: "streak", agents: "agents", work: "work", shipped: "shipped", money: "money", letter: "letter",
1746
+ name: "name",
1745
1747
  };
1746
- // ids of the cards left out. Chapters say what you worked on, so they stay
1747
- // out of a link unless you add them.
1748
- const left = new Set(["chapters"]);
1748
+ // ids of what's left out. Chapters say what you worked on, and your name who
1749
+ // you are, so they stay out of a link unless you add them.
1750
+ const left = new Set(["chapters", "name"]);
1749
1751
  let link = "";
1750
1752
  let linkFor = 0; // ignores a slower, older link if the choice changed meanwhile
1751
1753
 
@@ -1756,7 +1758,11 @@ function sharedData() {
1756
1758
  return d;
1757
1759
  }
1758
1760
 
1759
- const shareText = (d) => `My ${SPAN} with AI coding agents, wrapped. I'm ${d.personality.name}.`;
1761
+ // Someone else's story is passed on in the third person, named only if its owner shared their name.
1762
+ const shareText = (d) =>
1763
+ SHARED
1764
+ ? `${D.name ? `${D.name}'s` : "Someone's"} ${SPAN} with AI coding agents, wrapped: ${D.personality.name}.`
1765
+ : `My ${SPAN} with AI coding agents, wrapped. I'm ${d.personality.name}.`;
1760
1766
 
1761
1767
  function finalFrame(card, s) {
1762
1768
  return withShape(s, () => {
@@ -1802,9 +1808,10 @@ async function renderShare() {
1802
1808
 
1803
1809
  function renderChoices() {
1804
1810
  const list = document.getElementById("choices");
1811
+ // Your name isn't a card of its own, but leaves the link the same way.
1812
+ const named = D.name ? [{ id: "name", name: "Your name" }] : [];
1805
1813
  list.replaceChildren(
1806
- ...cards
1807
- .filter((card) => card.id in LEAVABLE)
1814
+ ...[...named, ...cards.filter((card) => card.id in LEAVABLE)]
1808
1815
  .map((card) => {
1809
1816
  const btn = document.createElement("button");
1810
1817
  btn.className = "chip";
@@ -1843,6 +1850,7 @@ function openShare() {
1843
1850
  // code and names it. Without the site, the long link still works.
1844
1851
  let short = { for: "", url: "" };
1845
1852
  async function shortLink() {
1853
+ if (SHARED) return location.href; // the link it was opened from
1846
1854
  const mine = link;
1847
1855
  if (short.for === mine) return short.url;
1848
1856
  try {
@@ -1856,7 +1864,7 @@ async function shortLink() {
1856
1864
  }
1857
1865
  }
1858
1866
 
1859
- document.getElementById("copy-link").addEventListener("click", async () => {
1867
+ for (const id of ["copy-link", "ending-copy"]) document.getElementById(id).addEventListener("click", async () => {
1860
1868
  const url = shortLink();
1861
1869
  try {
1862
1870
  // Handing the clipboard a promise keeps the click's permission to copy
@@ -1868,7 +1876,7 @@ document.getElementById("copy-link").addEventListener("click", async () => {
1868
1876
  }
1869
1877
  notify("Link copied. Paste it anywhere.");
1870
1878
  } catch {
1871
- notify("Couldn't copy the link. Try Share instead.");
1879
+ notify(SHARED ? "Couldn't copy the link. Copy it from the address bar instead." : "Couldn't copy the link. Try Share instead.");
1872
1880
  }
1873
1881
  });
1874
1882
 
@@ -1885,9 +1893,13 @@ document.getElementById("share-link").addEventListener("click", async () => {
1885
1893
 
1886
1894
  // The post opens in a new tab straight away, so it isn't blocked, and moves
1887
1895
  // to the post once the short link is ready.
1896
+ const toX = (url) => `https://x.com/intent/post?text=${encodeURIComponent(shareText(sharedData()))}&url=${encodeURIComponent(url)}`;
1897
+ const toLinkedIn = (url) => `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}`;
1888
1898
  for (const [el, post] of [
1889
- [postX, (url) => `https://x.com/intent/post?text=${encodeURIComponent(shareText(sharedData()))}&url=${encodeURIComponent(url)}`],
1890
- [postLinkedIn, (url) => `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}`],
1899
+ [postX, toX],
1900
+ [postLinkedIn, toLinkedIn],
1901
+ [document.getElementById("ending-x"), toX],
1902
+ [document.getElementById("ending-linkedin"), toLinkedIn],
1891
1903
  ]) {
1892
1904
  el.addEventListener("click", async (e) => {
1893
1905
  e.preventDefault();
package/dist/story.js CHANGED
@@ -14,7 +14,7 @@ export const starred = (word) => word[0] + "*".repeat(word.length - 2) + word.at
14
14
  // A count this small isn't a habit yet.
15
15
  const HABIT = 20;
16
16
  // `chapterNames` come from `nameChapters`; without them a chapter is named by its top words.
17
- export function storyData(w, personality, letter, chapterNames = w.chapters.map((c) => plainName(c.words)), span = "year") {
17
+ export function storyData(w, personality, letter, chapterNames = w.chapters.map((c) => plainName(c.words)), span = "year", name = null) {
18
18
  const family = w.voice.typos.find((f) => f.spellings.length >= 5) ?? null;
19
19
  const streak = w.rhythm.longestStreak;
20
20
  const nickname = w.voice.nicknames[0] && w.voice.nicknames[0].count >= HABIT ? w.voice.nicknames[0] : null;
@@ -62,5 +62,6 @@ export function storyData(w, personality, letter, chapterNames = w.chapters.map(
62
62
  crashouts: w.voice.crashouts.count >= CRASHOUTS
63
63
  ? { ...w.voice.crashouts, word: w.voice.crashouts.word && starred(w.voice.crashouts.word) }
64
64
  : null,
65
+ name,
65
66
  };
66
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shadevkumar/agent-wrapped",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Your year with AI coding agents, played back in keyboard keys. Reads Claude Code and Codex logs on your computer.",
5
5
  "keywords": [
6
6
  "claude-code",