wrapt-cli 0.1.6 → 0.2.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
@@ -14,32 +14,24 @@ Instagram, LinkedIn and X. Your chats never leave your machine.
14
14
 
15
15
  <sub>Sample cards for “Ada”, a made-up demo user.</sub>
16
16
 
17
- ## Get yours
17
+ ## Get yours: one command
18
18
 
19
19
  ```bash
20
- npx wrapt-cli analyze && npx wrapt-cli render --name "Ada" && npx wrapt-cli share
20
+ npx wrapt-cli
21
21
  ```
22
22
 
23
- Put your own first name in place of Ada. When it's done, a QR code appears in your terminal.
24
- Scan it with your phone on the same Wi-Fi to open your cards, save them and copy a ready-made
25
- caption for each platform.
23
+ That's it. It reads your history, makes your cards in a `wrapt-<year>` folder where you ran it
24
+ and plays your year as a story in your browser. Add `--name "Ada"` to put your first name on the
25
+ cover. Your private stats stay separately in `~/.wrapt/<year>/`.
26
26
 
27
- Your cards are saved in a `wrapt-<year>` folder inside the folder you ran the command from,
28
- with a ZIP of each set. Your private stats stay separately in `~/.wrapt/<year>/`. To open the
29
- cards folder:
27
+ **Optional:** get the cards onto your phone.
30
28
 
31
- ```bash
32
- npx wrapt-cli open
33
- ```
34
-
35
- **On a Mac with an iPhone?** Skip the QR code and AirDrop the cards straight into Photos:
36
-
37
- ```bash
38
- npx wrapt-cli airdrop
39
- ```
40
-
41
- Pick your iPhone in the AirDrop window and tap **Accept** on the phone. Add `--set carousel` for
42
- the carousel cards, or `--set all` for every card.
29
+ | Command | What it does |
30
+ |---|---|
31
+ | `npx wrapt-cli share` | Shows a QR code. Scan it on the same Wi-Fi to save the cards and copy a caption. |
32
+ | `npx wrapt-cli airdrop` | Mac + iPhone: sends the cards straight into Photos. |
33
+ | `npx wrapt-cli open` | Opens the cards folder. |
34
+ | `npx wrapt-cli play` | Plays the story again. Screen-record it to post it as a video. |
43
35
 
44
36
  Step-by-step guide: **https://wrapt.cc**
45
37
 
@@ -47,13 +39,14 @@ Step-by-step guide: **https://wrapt.cc**
47
39
 
48
40
  | Format | Size | For |
49
41
  |---|---|---|
50
- | 8 story cards | 1080 × 1920 | Instagram Stories |
51
- | 8 carousel cards | 1080 × 1350 | Instagram carousel, or a LinkedIn image post (easiest) |
52
- | 8-page PDF | 1080 × 1350 | LinkedIn document post (swipeable in the feed) |
42
+ | 9 story cards | 1080 × 1920 | Instagram Stories |
43
+ | 9 carousel cards | 1080 × 1350 | Instagram carousel, or a LinkedIn image post (easiest) |
44
+ | 9-page PDF | 1080 × 1350 | LinkedIn document post (swipeable in the feed) |
53
45
  | 1 summary card | 1200 × 675 | X |
46
+ | story.html | any screen | Your year as a tap-through story with guessing games: `npx wrapt-cli play` |
54
47
 
55
- The eight cards: your name and year, your biggest number (tokens, hours or prompts), when you
56
- work and your longest streak, your busiest weekday, your word of the year, your languages,
48
+ The nine cards: your name and year, your biggest number (tokens, hours or prompts), when you
49
+ work and your longest streak, your busiest weekday, your word of the year, your receipts (please, thank you, “You’re absolutely right”, Esc), your languages,
57
50
  tools and models, an archetype, and a summary with a QR code to wrapt.cc.
58
51
 
59
52
  <img src="https://wrapt.cc/x-card.png" alt="X summary card for Ada" width="60%">
@@ -61,7 +54,7 @@ tools and models, an archetype, and a summary with a QR code to wrapt.cc.
61
54
  ## Options
62
55
 
63
56
  ```bash
64
- npx wrapt-cli render --name "Ada" --theme pastel
57
+ npx wrapt-cli --name "Ada" --theme pastel
65
58
  ```
66
59
 
67
60
  | Option | What it does |
@@ -84,7 +77,9 @@ Run `npx wrapt-cli --help` for everything else.
84
77
  repeated prompts like “continue”. They never show what you asked.
85
78
  - **Secrets are filtered out.** Anything that looks like a key or token is left out.
86
79
  - **Project names are hidden by default**, so work projects don't end up on a public card.
87
- - **`share` stays on your Wi-Fi.** It serves only your cards, behind a random link, and stops
80
+ - **The story is one offline file.** `story.html` makes no network requests. It holds the same
81
+ numbers as the cards, and no project names unless you used `--show-projects`.
82
+ - **`share` stays on your Wi-Fi.** It serves only your cards and story, behind a random link, and stops
88
83
  after 15 minutes or when you press Ctrl+C.
89
84
 
90
85
  ## Requirements
@@ -0,0 +1,116 @@
1
+ /* wrapt story player. One phone-shaped stage; every size is in cqw (1cqw = 1% of the stage width). */
2
+ * { box-sizing: border-box; }
3
+ [hidden] { display: none !important; }
4
+ html, body { margin: 0; height: 100%; background: #0b0b0e; overflow: hidden; }
5
+ body { font-family: "Space Grotesk", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
6
+ .stage { position: fixed; inset: 0; display: grid; place-items: center; }
7
+ .phone { position: relative; height: min(100dvh, calc(100vw * 16 / 9)); aspect-ratio: 9 / 16; overflow: hidden; container-type: inline-size; touch-action: manipulation; }
8
+ /* Framed like a phone only on wide screens; a phone-shaped window (or a video recording) is filled edge to edge. */
9
+ @media (min-width: 700px) and (min-aspect-ratio: 3 / 4) { .phone { height: min(94dvh, calc(100vw * 16 / 9)); border-radius: 2.2cqw; box-shadow: 0 30px 80px #000a; } }
10
+
11
+ .slide { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 21cqw 8cqw 16cqw; background: var(--bg); color: var(--fg); opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility 0s linear .35s; }
12
+ .slide.on { opacity: 1; visibility: visible; transition: opacity .35s ease; }
13
+ .slide .body { flex: 1; display: flex; flex-direction: column; justify-content: safe center; min-height: 0; }
14
+ .kicker { font-weight: 500; font-size: 3.6cqw; display: flex; justify-content: space-between; }
15
+ .kicker span:last-child { opacity: .6; }
16
+ .foot { display: flex; justify-content: space-between; align-items: center; min-height: 9cqw; font-weight: 500; font-size: 3cqw; }
17
+ .foot b { font-size: 4.4cqw; letter-spacing: -.1cqw; }
18
+ .foot span { opacity: .6; }
19
+
20
+ .h1 { font-weight: 700; font-size: 11cqw; line-height: 1; letter-spacing: -.35cqw; margin: 0; }
21
+ .h2 { font-weight: 700; font-size: 7.4cqw; line-height: 1.05; letter-spacing: -.2cqw; margin: 0; }
22
+ .lede { font-weight: 500; font-size: 5cqw; line-height: 1.25; margin: 0; opacity: .9; }
23
+ .small { font-weight: 500; font-size: 3.4cqw; line-height: 1.35; opacity: .75; margin: 0; }
24
+ .mega { font-weight: 700; font-size: 30cqw; line-height: .95; letter-spacing: -1.2cqw; color: var(--accent); margin: 1cqw 0 2cqw; white-space: nowrap; }
25
+ .accent { color: var(--accent); }
26
+ .gap { height: 6cqw; flex: none; }
27
+
28
+ /* Things that appear in turn: give an element .rise and a --d delay. */
29
+ .rise { opacity: 0; transform: translateY(4cqw); }
30
+ .on .rise { animation: rise .6s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: var(--d, 0s); }
31
+ @keyframes rise { to { opacity: 1; transform: none; } }
32
+ .pop { opacity: 0; transform: scale(.6); }
33
+ .on .pop { animation: pop .7s cubic-bezier(.2, 1.4, .3, 1) forwards; animation-delay: var(--d, 0s); }
34
+ @keyframes pop { to { opacity: 1; transform: none; } }
35
+
36
+ /* Progress bars sit above the slides. */
37
+ .bars { position: absolute; top: 3.2cqw; left: 3cqw; right: 3cqw; display: flex; gap: 1cqw; z-index: 3; pointer-events: none; }
38
+ .bars i { flex: 1; height: .8cqw; border-radius: 1cqw; background: #ffffff55; overflow: hidden; }
39
+ .bars i b { display: block; height: 100%; width: 0; background: #fff; }
40
+ .opt:focus-visible, .again:focus-visible { outline: .7cqw solid currentColor; outline-offset: .5cqw; }
41
+ .paused { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .2s; }
42
+ .paused span { font: 700 5cqw "Space Grotesk", sans-serif; color: #fff; background: #000a; padding: 2cqw 5cqw; border-radius: 99cqw; }
43
+ .is-paused .paused { opacity: 1; }
44
+
45
+ /* Quiz */
46
+ .opts { display: flex; flex-direction: column; gap: 3cqw; margin-top: 8cqw; }
47
+ .opt { position: relative; text-align: left; font: 700 6.4cqw "Space Grotesk", sans-serif; color: var(--fg); background: transparent; border: .6cqw solid currentColor; border-radius: 4cqw; padding: 4cqw 5cqw; cursor: pointer; transition: background .25s, color .25s, opacity .25s, transform .25s; }
48
+ .opt:active { transform: scale(.98); }
49
+ .answered .opt { cursor: default; opacity: .35; }
50
+ .answered .opt.right { opacity: 1; background: var(--accent); color: var(--bg); border-color: var(--accent); }
51
+ .answered .opt.picked:not(.right) { opacity: .7; text-decoration: line-through; }
52
+ .verdict { min-height: 16cqw; margin-top: 6cqw; }
53
+ .verdict:empty { min-height: 0; }
54
+ .verdict p { margin: 0; }
55
+
56
+ /* Charts */
57
+ .hours { display: flex; align-items: flex-end; gap: .9cqw; height: 46cqw; margin: 8cqw 0 2cqw; }
58
+ .hours i { flex: 1; background: var(--fg); opacity: .45; border-radius: .6cqw; height: 0; transition: height .9s cubic-bezier(.2, .8, .2, 1); }
59
+ .hours i.peak { background: var(--accent); opacity: 1; }
60
+ .axis { display: flex; justify-content: space-between; font-weight: 500; font-size: 3cqw; opacity: .7; }
61
+ .week { display: flex; flex-direction: column; gap: 2.6cqw; margin-top: 4cqw; }
62
+ .week div { display: grid; grid-template-columns: 12cqw 1fr 12cqw; align-items: center; gap: 2cqw; font-weight: 700; font-size: 4.2cqw; }
63
+ .week div span:last-child { text-align: right; opacity: .8; }
64
+ .week em { display: block; height: 2.4cqw; border-radius: 2cqw; background: var(--fg); width: 0; transition: width .9s cubic-bezier(.2, .8, .2, 1); }
65
+ .week .top em { background: var(--accent); }
66
+ .stats { display: flex; gap: 8cqw; margin-top: 8cqw; }
67
+ .stats div { display: flex; flex-direction: column; }
68
+ .stats b { font-size: 9.5cqw; letter-spacing: -.3cqw; line-height: 1; }
69
+ .stats span { font-weight: 500; font-size: 3.3cqw; opacity: .75; margin-top: 1cqw; }
70
+
71
+ /* Receipts: printed line by line */
72
+ .receipt { margin-top: 6cqw; border-top: .5cqw dashed currentColor; border-bottom: .5cqw dashed currentColor; padding: 5cqw 0; display: flex; flex-direction: column; gap: 5cqw; }
73
+ .receipt .row { display: flex; justify-content: space-between; align-items: center; gap: 3cqw; }
74
+ .receipt .row b { font-size: 5.6cqw; display: block; }
75
+ .receipt .row small { font-weight: 500; font-size: 3.2cqw; opacity: .7; }
76
+ .receipt .row strong { font-size: 8.4cqw; letter-spacing: -.2cqw; white-space: nowrap; }
77
+ .receipt .row:first-child strong { color: var(--accent); }
78
+ .total { display: flex; justify-content: space-between; font-weight: 700; font-size: 4.6cqw; margin-top: 5cqw; }
79
+
80
+ /* Lists (stack, top asks) */
81
+ .list { margin-top: 5cqw; }
82
+ .list h3 { font-weight: 500; font-size: 3.4cqw; opacity: .8; margin: 0 0 1.4cqw; }
83
+ .list p { display: flex; justify-content: space-between; align-items: baseline; margin: 0; font-weight: 700; font-size: 6cqw; line-height: 1.2; }
84
+ .list p:first-of-type { color: var(--accent); font-size: 8.4cqw; }
85
+ .list p span { font-weight: 500; font-size: 3.6cqw; opacity: .8; color: var(--fg); }
86
+ .asks { display: flex; flex-direction: column; gap: 4.6cqw; margin-top: 8cqw; }
87
+ .asks div { display: flex; justify-content: space-between; font-weight: 700; font-size: 6cqw; }
88
+ .asks em { display: block; height: 2.2cqw; border-radius: 2cqw; background: var(--fg); width: 0; margin-top: 1.4cqw; transition: width .9s cubic-bezier(.2, .8, .2, 1); }
89
+ .asks section:first-child em { background: var(--accent); }
90
+
91
+ /* Archetype: a drumroll, then the reveal */
92
+ .drum { font-weight: 700; font-size: 9cqw; letter-spacing: -.2cqw; }
93
+ .drum i { display: inline-block; font-style: normal; animation: blink 1s infinite; }
94
+ .drum i:nth-child(2) { animation-delay: .2s; } .drum i:nth-child(3) { animation-delay: .4s; }
95
+ @keyframes blink { 50% { opacity: .2; } }
96
+ .reveal { display: none; }
97
+ .revealed .drum { display: none; }
98
+ .revealed .reveal { display: block; }
99
+ .arch { font-weight: 700; font-size: 15cqw; line-height: .95; letter-spacing: -.5cqw; color: var(--accent); margin: 3cqw 0 6cqw; }
100
+
101
+ /* Outro */
102
+ .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.2cqw; margin-top: 5cqw; }
103
+ .grid div { background: var(--fg); color: var(--bg); border-radius: 3cqw; padding: 2.8cqw 3.6cqw; display: flex; flex-direction: column; }
104
+ .grid b { font-size: 7cqw; letter-spacing: -.3cqw; line-height: 1; }
105
+ .grid span { font-weight: 500; font-size: 3.2cqw; opacity: .8; margin-top: 1cqw; }
106
+ .make { margin-top: 5cqw; font-weight: 500; font-size: 4.2cqw; }
107
+ .make a { display: block; font-weight: 700; font-size: 8.6cqw; color: var(--accent); text-decoration: none; letter-spacing: -.3cqw; }
108
+ .credit { margin-top: 4cqw; font-weight: 500; font-size: 3cqw; opacity: .8; line-height: 1.4; }
109
+ .foot .again { font: 700 3.6cqw "Space Grotesk", sans-serif; color: var(--bg); background: var(--fg); border: 0; border-radius: 99cqw; padding: 2.2cqw 4.4cqw; cursor: pointer; }
110
+
111
+ @media (prefers-reduced-motion: reduce) {
112
+ .slide, .slide.on { transition: none; }
113
+ .on .rise, .on .pop { animation: none; opacity: 1; transform: none; }
114
+ .hours i, .week em, .asks em { transition: none; }
115
+ .drum i { animation: none; }
116
+ }
@@ -0,0 +1,298 @@
1
+ // wrapt story player. Reads the stats embedded in #wrapt-data and plays them as tap-through slides.
2
+ // Controls: tap right / left, hold to pause, arrow keys, space, P (pause). ?slide=N opens a given slide.
3
+ // ?video=1 leaves out the tap hints and the replay button, for recording the story as a video.
4
+ (() => {
5
+ const D = JSON.parse(document.getElementById("wrapt-data").textContent);
6
+ const P = D.palettes; // cover, big, rhythm, asks, word, receipts, stack, archetype, outro
7
+ const params = new URLSearchParams(location.search);
8
+ const video = params.has("video");
9
+ const reduced = matchMedia("(prefers-reduced-motion: reduce)").matches;
10
+ const esc = (s) => String(s).replace(/[&<>"']/g, (c) => `&#${c.charCodeAt(0)};`);
11
+ const human = (n) => {
12
+ const a = Math.abs(n);
13
+ for (const [v, s] of [[1e12, "T"], [1e9, "B"], [1e6, "M"], [1e3, "K"]]) {
14
+ if (a >= v) { const x = n / v; return `${x >= 100 ? Math.round(x) : Math.round(x * 10) / 10}${s}`; }
15
+ }
16
+ return String(Math.round(n));
17
+ };
18
+ const comma = (n) => Math.round(n).toLocaleString("en-US");
19
+ const DAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
20
+ const hourLabel = (h) => (h === 0 ? "12am" : h < 12 ? `${h}am` : h === 12 ? "12pm" : `${h - 12}pm`);
21
+ const shortDate = (iso) => new Date(`${iso}T12:00:00`).toLocaleDateString("en-US", { month: "short", day: "numeric" });
22
+ /** Round to two significant figures, for quiz options that look like guesses. */
23
+ const nice = (x) => { if (x < 10) return Math.max(1, Math.round(x)); const p = 10 ** (Math.floor(Math.log10(x)) - 1); return Math.round(x / p) * p; };
24
+
25
+ // ───────────── slides ─────────────
26
+ // Each slide: palette, seconds on screen (0 = wait for a tap or an answer), and its HTML.
27
+ const slides = [];
28
+ const add = (s) => slides.push(s);
29
+ const brand = D.brand;
30
+ const t = D.totals;
31
+
32
+ add({ id: "intro", pal: P[0], dur: 4.5, kicker: "Year in review", html: `
33
+ <p class="h1 rise">${esc(D.possessive)}</p>
34
+ <p class="mega pop" style="--d:.15s;color:var(--accent)">${D.year}</p>
35
+ <p class="h2 rise" style="--d:.3s">with ${esc(brand.short)}</p>
36
+ ${video ? "" : `<p class="small rise" style="--d:.8s;margin-top:8cqw">Tap right for next, left to go back. Hold to pause.</p>`}` });
37
+
38
+ if (t.hours >= 1) {
39
+ const real = Math.round(t.hours);
40
+ const opts = [...new Set([nice(real * 0.35), real, nice(real * 2.4)])].sort((a, b) => a - b);
41
+ add({ id: "quiz-hours", pal: P[2], dur: 0, kicker: "First, a guess", quiz: { answer: String(real), after: `That’s about ${Math.max(1, Math.round(t.hours / 8))} full workdays.` }, html: `
42
+ <p class="h2 rise">How many hours do you think you spent with ${esc(brand.short)} this year?</p>
43
+ <div class="opts">${opts.map((o, i) => `<button class="opt rise" style="--d:${0.2 + i * 0.1}s" data-v="${o}">${comma(o)} hours</button>`).join("")}</div>
44
+ <div class="verdict"></div>` });
45
+ add({ id: "hours", pal: P[1], dur: 6, kicker: "Time together", html: `
46
+ <p class="lede rise">You spent</p>
47
+ <p class="mega" data-count="${t.hours}" data-fmt="int">0</p>
48
+ <p class="h2 rise" style="--d:.4s">hours pair programming</p>
49
+ <div class="stats rise" style="--d:.8s">
50
+ <div><b data-count="${t.sessions}" data-fmt="int">0</b><span>sessions</span></div>
51
+ <div><b data-count="${t.activeDays}" data-fmt="int">0</b><span>active days</span></div>
52
+ </div>` });
53
+ }
54
+
55
+ add({ id: "prompts", pal: P[3], dur: 5.5, kicker: "You asked", html: `
56
+ <p class="lede rise">You sent</p>
57
+ <p class="mega" data-count="${t.prompts}" data-fmt="human">0</p>
58
+ <p class="h2 rise" style="--d:.4s">prompts</p>
59
+ <p class="lede rise" style="--d:.8s;margin-top:6cqw">That’s about ${comma(t.prompts / Math.max(1, t.activeDays))} every day you showed up.</p>` });
60
+
61
+ if (t.tokens > 0) {
62
+ const wp = t.tokens / 780000;
63
+ add({ id: "tokens", pal: P[1], dur: 6, kicker: "The big number", html: `
64
+ <p class="lede rise">And</p>
65
+ <p class="mega" data-count="${t.tokens}" data-fmt="human">0</p>
66
+ <p class="h2 rise" style="--d:.4s">tokens flowed between you and ${esc(brand.partner)}</p>
67
+ <p class="lede rise" style="--d:.9s;margin-top:6cqw">${wp < 1 ? "A novella’s worth of thinking." : `That’s about ${wp >= 10 ? comma(wp) : wp.toFixed(1)}× War and Peace.`}</p>` });
68
+ }
69
+
70
+ if (D.apiCost && D.apiCost.usd >= 0.01) {
71
+ const c = D.apiCost;
72
+ const whole = c.usd >= 100;
73
+ const money = (n) => (whole ? `$${comma(n)}` : `$${n.toFixed(2)}`);
74
+ add({ id: "cost", pal: P[5], dur: 7.5, kicker: "At API prices", html: `
75
+ <p class="lede rise">At pay-as-you-go API prices, those tokens would have cost</p>
76
+ <p class="mega" data-count="${c.usd}" data-fmt="usd" style="font-size:${money(c.usd).length > 7 ? 21 : 26}cqw">$0</p>
77
+ ${c.byModel.length > 1 ? `<div class="receipt rise" style="--d:.9s">${c.byModel.map((m) => `<div class="row"><div><b>${esc(m.name)}</b></div><strong style="font-size:6cqw">${money(m.usd)}</strong></div>`).join("")}</div>` : ""}
78
+ <p class="small rise" style="--d:1.3s;margin-top:5cqw">An estimate from Anthropic’s list prices for your Claude tokens, not what you paid. Plans and subscriptions are billed differently.</p>` });
79
+ }
80
+
81
+ const wk = D.rhythm.weekdays;
82
+ const wkTotal = wk.reduce((a, b) => a + b, 0);
83
+ if (wkTotal > 0) {
84
+ const top = wk.indexOf(Math.max(...wk));
85
+ const others = [0, 1, 2, 3, 4, 5, 6].filter((i) => i !== top);
86
+ // Deterministic "random" picks, so a replay asks the same question.
87
+ const picks = [others[(D.year * 7) % 6], others[(D.year * 3 + 1) % 6], others[(D.year + 4) % 6]];
88
+ const opts = [...new Set([top, ...picks])].sort((a, b) => a - b);
89
+ const max = Math.max(...wk);
90
+ add({ id: "quiz-week", pal: P[4], dur: 0, kicker: "Another guess", quiz: { answer: String(top), after: `${DAYS[top]}s were your day.`, showWeek: true }, html: `
91
+ <p class="h2 rise">Which day of the week did you show up the most?</p>
92
+ <div class="opts">${opts.map((o, i) => `<button class="opt rise" style="--d:${0.2 + i * 0.08}s" data-v="${o}">${DAYS[o]}</button>`).join("")}</div>
93
+ <div class="week" hidden>${wk.map((n, i) => `<div class="${i === top ? "top" : ""}"><span>${DAYS[i].slice(0, 3)}</span><span><em data-w="${(n / max) * 100}"></em></span><span>${Math.round((n / wkTotal) * 100)}%</span></div>`).join("")}</div>
94
+ <div class="verdict"></div>` });
95
+ }
96
+
97
+ const hrs = D.rhythm.hours;
98
+ const hMax = Math.max(...hrs, 1);
99
+ const peak = hrs.indexOf(hMax);
100
+ add({ id: "rhythm", pal: P[2], dur: 6.5, kicker: "Your rhythm", html: `
101
+ <p class="lede rise">You’re a</p>
102
+ <p class="h1 pop accent" style="--d:.2s;font-size:15cqw">${esc(D.rhythm.label)}</p>
103
+ <div class="hours">${hrs.map((n, h) => `<i class="${h === peak ? "peak" : ""}" data-h="${Math.max(2, (n / hMax) * 100)}"></i>`).join("")}</div>
104
+ <div class="axis"><span>12am</span><span>6am</span><span>12pm</span><span>6pm</span><span>11pm</span></div>
105
+ <div class="stats rise" style="--d:1s">
106
+ <div><b>${hourLabel(peak)}</b><span>peak hour</span></div>
107
+ <div><b>${comma(D.rhythm.afterMidnight)}</b><span>prompts after midnight</span></div>
108
+ </div>` });
109
+
110
+ if (D.rhythm.streak.days > 0) {
111
+ const s = D.rhythm.streak;
112
+ add({ id: "streak", pal: P[0], dur: 5.5, kicker: "Showing up", html: `
113
+ <p class="lede rise">Your longest streak</p>
114
+ <p class="mega" data-count="${s.days}" data-fmt="int">0</p>
115
+ <p class="h2 rise" style="--d:.4s">days in a row</p>
116
+ ${s.start ? `<p class="lede rise" style="--d:.7s;margin-top:3cqw">${shortDate(s.start)} → ${shortDate(s.end)}</p>` : ""}
117
+ ${D.rhythm.busiest ? `<div class="stats rise" style="--d:1s"><div><b>${shortDate(D.rhythm.busiest.date)}</b><span>busiest day</span></div><div><b>${comma(D.rhythm.busiest.prompts)}</b><span>prompts that day</span></div></div>` : ""}` });
118
+ }
119
+
120
+ if (D.words.word) {
121
+ const w = D.words.word;
122
+ const size = Math.min(26, 150 / Math.max(4, w.name.length));
123
+ add({ id: "word", pal: P[4], dur: 6, kicker: "Word of the year", html: `
124
+ <p class="lede rise">The word you couldn’t stop typing</p>
125
+ <p class="pop accent" style="--d:.3s;font-weight:700;font-size:${size}cqw;line-height:1;letter-spacing:-.6cqw;margin:4cqw 0">${esc(w.name)}</p>
126
+ <p class="h2 rise" style="--d:.7s">${comma(w.count)} times</p>
127
+ ${D.words.goto ? `<div class="gap"></div><p class="small rise" style="--d:1.1s">Your go-to prompt</p><p class="h2 rise" style="--d:1.2s">“${esc(D.words.goto.text)}” ×${comma(D.words.goto.count)}</p>` : ""}` });
128
+ }
129
+
130
+ if (D.receipts) {
131
+ const r = D.receipts;
132
+ const rows = [["“please”", "prompts that said it", r.please], ["“thank you”", "prompts that said it", r.thanks]];
133
+ if (D.claude) rows.push(["“You’re absolutely right”", "times Claude said it", r.absolutelyRight], ["Esc", "times you stopped Claude mid-reply", r.interrupts]);
134
+ add({ id: "receipts", pal: P[5], dur: 7, kicker: "The receipts", html: `
135
+ <p class="h1 rise">Manners</p><p class="h1 rise accent" style="--d:.1s">&amp; mayhem.</p>
136
+ <div class="receipt">${rows.map(([a, b, n], i) => `<div class="row rise" style="--d:${0.5 + i * 0.55}s"><div><b>${a}</b><small>${b}</small></div><strong>×${human(n)}</strong></div>`).join("")}</div>
137
+ <div class="total rise" style="--d:${0.6 + rows.length * 0.55}s"><span>TOTAL</span><span>${human(t.prompts)} prompts</span></div>` });
138
+ }
139
+
140
+ const list = (title, items, d) =>
141
+ items.length ? `<div class="list rise" style="--d:${d}s"><h3>${esc(title)}</h3>${items.map((x) => `<p>${esc(x.name)}<span>${esc(x.meta)}</span></p>`).join("")}</div>` : "";
142
+ if (D.stack.models.length || D.stack.languages.length || D.stack.tools.length) {
143
+ add({ id: "stack", pal: P[6], dur: 7, kicker: "Your stack", html: `
144
+ <p class="h1 rise">Built with</p>
145
+ ${list("Models", D.stack.models, 0.4)}
146
+ ${list("Languages", D.stack.languages, 0.9)}
147
+ ${list(`Tools ${brand.short} reached for`, D.stack.tools, 1.4)}
148
+ ${D.stack.project ? `<p class="small rise" style="--d:1.9s;margin-top:5cqw">Top project: ${esc(D.stack.project.name)} · ${human(D.stack.project.count)} prompts</p>` : ""}` });
149
+ }
150
+
151
+ if (D.categories && D.categories.length) {
152
+ const max = Math.max(...D.categories.map((c) => c.pct), 1);
153
+ add({ id: "asks", pal: P[3], dur: 6.5, kicker: "What you asked for", html: `
154
+ <p class="h1 rise">Your top asks</p>
155
+ <div class="asks">${D.categories.map((c, i) => `<section class="rise" style="--d:${0.3 + i * 0.2}s"><div><span>${i + 1}. ${esc(c.name)}</span><span>${Math.round(c.pct)}%</span></div><em data-w="${(c.pct / max) * 100}"></em></section>`).join("")}</div>` });
156
+ }
157
+
158
+ add({ id: "archetype", pal: P[7], dur: 9, kicker: "Your archetype", reveal: 2.2, html: `
159
+ <p class="drum">And you are<i>.</i><i>.</i><i>.</i></p>
160
+ <div class="reveal">
161
+ <p class="lede">You’re</p>
162
+ <p class="arch pop">${esc(D.archetype.name)}</p>
163
+ <p class="lede rise" style="--d:.6s">${esc(D.archetype.description)}</p>
164
+ </div>` });
165
+
166
+ add({ id: "outro", pal: P[8], dur: 0, kicker: "That’s a wrap", html: `
167
+ <p class="h2 rise" style="font-size:6.4cqw">${esc(D.possessive)} ${D.year} in ${esc(brand.long)}</p>
168
+ <div class="grid">${D.outro.map((s, i) => `<div class="rise" style="--d:${0.2 + i * 0.08}s"><b>${esc(s.value)}</b><span>${esc(s.label)}</span></div>`).join("")}</div>
169
+ <p class="make rise" style="--d:.8s">Make yours<a href="${esc(D.siteUrl)}" target="_blank" rel="noopener">→ ${esc(D.site)}</a></p>
170
+ ${D.credit ? `<p class="credit rise" style="--d:.9s">wrapt by <b>${esc(D.credit.name)}</b> · LinkedIn ${esc(D.credit.linkedin)} · Instagram ${esc(D.credit.instagram)}</p>` : ""}`, foot: video ? "" : `<button class="again" data-again>↺ Play again</button>` });
171
+
172
+ // ───────────── DOM ─────────────
173
+ const phone = document.querySelector(".phone");
174
+ const total = slides.length;
175
+ phone.insertAdjacentHTML("beforeend", slides.map((s, i) => `
176
+ <section class="slide" data-i="${i}" aria-hidden="true" style="--bg:${s.pal.bg};--fg:${s.pal.fg};--accent:${s.pal.accent}">
177
+ <div class="kicker"><span>${esc(s.kicker)}</span><span>${String(i + 1).padStart(2, "0")}/${String(total).padStart(2, "0")}</span></div>
178
+ <div class="body">${s.html}</div>
179
+ <div class="foot"><b>wrapt</b>${s.foot || `<span>${D.year} · ${esc(D.site)}</span>`}</div>
180
+ </section>`).join(""));
181
+ const els = [...phone.querySelectorAll(".slide")];
182
+ const bars = phone.querySelector(".bars");
183
+ bars.innerHTML = slides.map(() => "<i><b></b></i>").join("");
184
+ const fills = [...bars.querySelectorAll("b")];
185
+
186
+ // ───────────── playback ─────────────
187
+ let cur = -1, elapsed = 0, last = 0, paused = false, waiting = false;
188
+ const countUps = new Map();
189
+
190
+ function animateCounts(el) {
191
+ el.querySelectorAll("[data-count]").forEach((n) => {
192
+ const to = Number(n.dataset.count), fmt = n.dataset.fmt === "human" ? human : n.dataset.fmt === "usd" ? (x) => (to >= 100 ? `$${comma(x)}` : `$${x.toFixed(2)}`) : comma;
193
+ if (reduced) { n.textContent = fmt(to); return; }
194
+ const t0 = performance.now(), dur = 1400;
195
+ const step = (now) => {
196
+ const k = Math.min(1, (now - t0) / dur), e = 1 - (1 - k) ** 3;
197
+ n.textContent = fmt(to * e);
198
+ if (k < 1) countUps.set(n, requestAnimationFrame(step));
199
+ };
200
+ countUps.set(n, requestAnimationFrame(step));
201
+ });
202
+ }
203
+ function grow(el) {
204
+ setTimeout(() => {
205
+ el.querySelectorAll("[data-h]").forEach((b) => (b.style.height = `${b.dataset.h}%`));
206
+ el.querySelectorAll("[data-w]").forEach((b) => (b.style.width = `${b.dataset.w}%`));
207
+ }, reduced ? 0 : 300);
208
+ }
209
+ function reset(el) {
210
+ el.classList.remove("answered", "revealed");
211
+ el.querySelectorAll(".opt").forEach((o) => o.classList.remove("right", "picked"));
212
+ el.querySelectorAll(".verdict").forEach((v) => (v.innerHTML = ""));
213
+ el.querySelectorAll(".week").forEach((w) => (w.hidden = true));
214
+ el.querySelectorAll(".opts").forEach((o) => (o.hidden = false));
215
+ el.querySelectorAll("[data-h]").forEach((b) => (b.style.height = "0"));
216
+ el.querySelectorAll("[data-w]").forEach((b) => (b.style.width = "0"));
217
+ }
218
+
219
+ function show(i) {
220
+ i = Math.max(0, Math.min(total - 1, i));
221
+ if (cur >= 0) { els[cur].classList.remove("on"); els[cur].setAttribute("aria-hidden", "true"); }
222
+ cur = i; elapsed = 0; last = performance.now();
223
+ const s = slides[i], el = els[i];
224
+ if (s.quiz) s.dur = 0; // a quiz waits for an answer every time it's shown
225
+ reset(el);
226
+ // Restart CSS animations on revisit.
227
+ el.querySelectorAll(".rise,.pop").forEach((n) => { n.style.animation = "none"; void n.offsetWidth; n.style.animation = ""; });
228
+ el.classList.add("on"); el.setAttribute("aria-hidden", "false");
229
+ waiting = s.dur === 0;
230
+ fills.forEach((f, k) => (f.style.width = k < i ? "100%" : "0"));
231
+ animateCounts(el);
232
+ if (!s.quiz) grow(el);
233
+ if (s.reveal) setTimeout(() => { if (cur === i) { el.classList.add("revealed"); } }, reduced ? 0 : s.reveal * 1000);
234
+ if (s.id === "outro") fills[i].style.width = "100%";
235
+ }
236
+
237
+ function answer(btn) {
238
+ const el = els[cur], s = slides[cur];
239
+ if (!s.quiz || el.classList.contains("answered")) return;
240
+ const right = btn.dataset.v === s.quiz.answer;
241
+ el.classList.add("answered");
242
+ btn.classList.add("picked");
243
+ el.querySelector(`.opt[data-v="${s.quiz.answer}"]`).classList.add("right");
244
+ el.querySelector(".verdict").innerHTML = `<p class="h2">${right ? "Nailed it." : "Not quite."}</p>${s.quiz.after ? `<p class="lede">${esc(s.quiz.after)}</p>` : ""}`;
245
+ if (s.quiz.showWeek) { el.querySelector(".opts").hidden = true; el.querySelector(".week").hidden = false; grow(el); }
246
+ // Give the answer a moment, then carry on.
247
+ waiting = false; s.dur = s.quiz.showWeek ? 5 : 3.5; elapsed = 0;
248
+ }
249
+
250
+ function next() { if (cur < total - 1) show(cur + 1); }
251
+ function prev() { show(cur - 1); }
252
+ function setPaused(p) { paused = p; phone.classList.toggle("is-paused", p); last = performance.now(); }
253
+
254
+ function frame(now) {
255
+ if (!paused && !waiting && cur >= 0) {
256
+ elapsed += (now - last) / 1000;
257
+ const s = slides[cur];
258
+ if (s.dur > 0) {
259
+ fills[cur].style.width = `${Math.min(100, (elapsed / s.dur) * 100)}%`;
260
+ if (elapsed >= s.dur) next();
261
+ }
262
+ }
263
+ last = now;
264
+ requestAnimationFrame(frame);
265
+ }
266
+
267
+ // Tap right/left to move, hold to pause. Buttons do their own thing.
268
+ let holdTimer = 0, held = false;
269
+ phone.addEventListener("pointerdown", (e) => {
270
+ if (e.target.closest("button,a")) return;
271
+ held = false;
272
+ holdTimer = setTimeout(() => { held = true; setPaused(true); }, 220);
273
+ });
274
+ phone.addEventListener("pointerup", (e) => {
275
+ clearTimeout(holdTimer);
276
+ if (e.target.closest("button,a")) return;
277
+ if (held) { setPaused(false); return; }
278
+ const r = phone.getBoundingClientRect();
279
+ (e.clientX - r.left < r.width / 3 ? prev : next)();
280
+ });
281
+ phone.addEventListener("pointercancel", () => { clearTimeout(holdTimer); if (held) setPaused(false); });
282
+ phone.addEventListener("click", (e) => {
283
+ const b = e.target.closest("button");
284
+ if (!b) return;
285
+ if (b.hasAttribute("data-again")) show(0);
286
+ else if (b.classList.contains("opt")) answer(b);
287
+ });
288
+ addEventListener("keydown", (e) => {
289
+ if (e.key === "ArrowRight" || e.key === " ") { e.preventDefault(); next(); }
290
+ else if (e.key === "ArrowLeft") prev();
291
+ else if (e.key === "p" || e.key === "P") setPaused(!paused);
292
+ });
293
+ document.addEventListener("visibilitychange", () => { if (document.hidden) setPaused(true); });
294
+
295
+ const jump = Number(params.get("slide"));
296
+ show(jump > 1 ? jump - 1 : 0);
297
+ requestAnimationFrame(frame);
298
+ })();
package/dist/analyze.js CHANGED
@@ -8,6 +8,21 @@ export function claudeProjectsDir() {
8
8
  const base = process.env.CLAUDE_CONFIG_DIR ?? path.join(os.homedir(), ".claude");
9
9
  return path.join(base, "projects");
10
10
  }
11
+ /**
12
+ * Claude Code's cleanupPeriodDays (how long it keeps session transcripts), from settings.json
13
+ * in the Claude config folder. null when unset, which means Claude Code's default of 30 days.
14
+ */
15
+ export function claudeRetentionDays(configDir) {
16
+ try {
17
+ const v = JSON.parse(fs.readFileSync(path.join(configDir, "settings.json"), "utf8"))?.cleanupPeriodDays;
18
+ return typeof v === "number" && Number.isFinite(v) ? v : null;
19
+ }
20
+ catch {
21
+ return null;
22
+ }
23
+ }
24
+ /** Claude Code deletes transcripts older than this many days unless cleanupPeriodDays says otherwise. */
25
+ export const DEFAULT_RETENTION_DAYS = 30;
11
26
  export function wraptHome() {
12
27
  return process.env.WRAPT_HOME ?? path.join(os.homedir(), ".wrapt");
13
28
  }
@@ -19,7 +34,7 @@ export async function analyze(opts) {
19
34
  };
20
35
  const sources = resolveSources(opts.source, paths);
21
36
  const report = emptyReport();
22
- const engine = new StatsEngine({ year: opts.year });
37
+ const engine = new StatsEngine({ year: opts.year, retentionDays: claudeRetentionDays(path.dirname(paths.claudeProjects)) });
23
38
  for (const src of sources)
24
39
  for await (const e of src.read(paths, report))
25
40
  engine.add(e);