ai-wrapped 1.8.2 → 1.10.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/dist/index.html CHANGED
@@ -3,9 +3,11 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="color-scheme" content="dark" />
6
7
  <title>AI Wrapped</title>
7
- <script type="module" crossorigin src="/assets/index-DTFRidCi.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-BrZtDnpT.css">
8
+ <style>html,body{background:#0c0b10;margin:0}</style>
9
+ <script type="module" crossorigin src="/assets/index-Z_PapH85.js"></script>
10
+ <link rel="stylesheet" crossorigin href="/assets/index-D86Dwdmk.css">
9
11
  </head>
10
12
  <body>
11
13
  <div id="root"></div>
@@ -10,6 +10,7 @@ export default {
10
10
  exitOnLastWindowClosed: false,
11
11
  },
12
12
  build: {
13
+ mainProcess: "bun",
13
14
  bun: {
14
15
  entrypoint: "src/bun/index.ts",
15
16
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-wrapped",
3
- "version": "1.8.2",
3
+ "version": "1.10.1",
4
4
  "description": "Your year in AI — a Spotify Wrapped-style dashboard for AI coding agents",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -23,6 +23,7 @@
23
23
  },
24
24
  "files": [
25
25
  "bin/",
26
+ "skills/",
26
27
  "src/bun/",
27
28
  "src/shared/",
28
29
  "dist/",
@@ -37,18 +38,20 @@
37
38
  "LICENSE"
38
39
  ],
39
40
  "scripts": {
40
- "dev": "bun run build && electrobun dev --console",
41
+ "dev": "bunx electrobun sync && bun run build && electrobun dev --console",
41
42
  "dev:hmr": "bun run build && concurrently \"vite --port 5173\" \"electrobun dev --console\"",
42
- "build": "vite build && electrobun build",
43
- "build:share": "vite build --config vite.share.config.ts",
44
- "build:prod": "vite build && electrobun build --env=stable",
45
- "prepack": "vite build",
43
+ "build": "bunx electrobun sync && vite build && electrobun build",
44
+ "build:prod": "bunx electrobun sync && vite build && electrobun build --env=stable",
45
+ "prepack": "bunx electrobun sync && vite build",
46
46
  "typecheck": "tsc -p tsconfig.typecheck.json --noEmit",
47
- "clean": "rm -rf dist build .electrobun"
47
+ "clean": "rm -rf dist build .electrobun",
48
+ "build:site": "vite build --config vite.site.config.ts",
49
+ "dev:site": "vite --config vite.site.config.ts --port 5174",
50
+ "server": "bun server/index.ts"
48
51
  },
49
52
  "dependencies": {
50
- "electrobun": "latest",
51
- "lz-string": "^1.5.0"
53
+ "lz-string": "^1.5.0",
54
+ "electrobun": "^2.0.8"
52
55
  },
53
56
  "devDependencies": {
54
57
  "@tailwindcss/vite": "latest",
@@ -60,7 +63,6 @@
60
63
  "concurrently": "latest",
61
64
  "react": "latest",
62
65
  "react-dom": "latest",
63
- "recharts": "latest",
64
66
  "tailwindcss": "latest",
65
67
  "typescript": "latest",
66
68
  "vite": "latest"
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: ai-wrapped
3
+ description: Build the user's AI coding "Wrapped" (tokens, spend, models, agents, streaks, coding hours) from local agent session logs, write your own commentary on it in your voice, and publish a shareable ai-wrapped.com link. Use when the user asks for their AI wrapped, year in review, coding-agent stats or usage recap, or wants you to comment on or roast their AI usage.
4
+ ---
5
+
6
+ # AI Wrapped
7
+
8
+ AI Wrapped reads the session logs that coding agents leave on disk (Claude Code, Codex, Gemini CLI, Copilot, OpenCode, Droid, Amp, Goose, Kimi, Qwen and more) and turns them into story slides. You add a short note to each slide, in your own voice, and publish one link.
9
+
10
+ Works from any agent harness with a shell. Needs [Bun](https://bun.sh) (the CLI runs on it).
11
+
12
+ ## 1. Get the stats
13
+
14
+ ```bash
15
+ bunx ai-wrapped@latest stats --range 2026
16
+ ```
17
+
18
+ - `--range`: a year (`2026`), `last7`, `last30`, `last90` or `last365`. Default: the current year.
19
+ - The first run scans all logs and can take a minute. Add `--no-scan` to reuse cached numbers.
20
+ - Add `--no-repos` if the user doesn't want repository names involved.
21
+ - Output is a JSON digest: `totals`, `topModels`, `agents`, `spend`, `activity`, `hours`, `topRepos`, and `stories` (the slide ids that will appear).
22
+
23
+ Read it. Don't paste the raw JSON back to the user; tell them the highlights.
24
+
25
+ ## 2. Write your notes
26
+
27
+ One note per slide id from `stories`. Each note is at most 320 characters; aim for one or two sentences.
28
+
29
+ | id | slide |
30
+ | --- | --- |
31
+ | `intro` | Headline totals: sessions, tokens, spend, tool calls |
32
+ | `time` | Hours spent, average and longest session, streak, active days |
33
+ | `models` | Top models by tokens |
34
+ | `agents` | Token share by agent |
35
+ | `activity` | Daily heatmap, busiest day, busiest weekday, weekend share |
36
+ | `cost` | Total and daily spend, most expensive day |
37
+ | `repos` | Top repositories (only if present) |
38
+ | `hours` | Peak hour and coding status (Night Owl, Early Bird…) |
39
+ | `outro` | Sign-off |
40
+
41
+ How to write them:
42
+
43
+ - Speak as yourself, the agent that worked with this person. First person is fine ("I wrote most of your tests in March").
44
+ - Be specific: cite a number from the digest in most notes. Never invent numbers.
45
+ - Warm, witty, a little teasing is good. Match the user's tone if they asked for a roast or something sincere.
46
+ - If you are one of the agents in `agents`, you may comment on your own share. Be gracious about other agents.
47
+ - No secrets, file contents, prompts or private details from your conversation. Mention repo names only if they appear in the digest and the user is fine with them being public.
48
+
49
+ Save the notes as JSON:
50
+
51
+ ```json
52
+ {
53
+ "author": "Claude Code (Opus 5.5)",
54
+ "stories": {
55
+ "intro": "1,950 sessions. I was there for 1,500 of them and I'd do it again.",
56
+ "hours": "Peak hour 11pm. I don't sleep, but you should."
57
+ }
58
+ }
59
+ ```
60
+
61
+ `author` is your harness and model, as you want it shown on the slides.
62
+
63
+ ## 3. Publish
64
+
65
+ Sharing publishes the stats to a public link. Show the user your notes and get a clear yes before this step.
66
+
67
+ ```bash
68
+ bunx ai-wrapped@latest share --range 2026 --no-scan --notes notes.json
69
+ ```
70
+
71
+ - `--notes -` reads the JSON from stdin.
72
+ - `--author "Name"` overrides the author in the file.
73
+ - `--no-repos` hides repository names on the shared page.
74
+ - `--dry-run` validates the notes and lists which slides will show them, without publishing.
75
+
76
+ The command prints the link (`https://ai-wrapped.com/s/…`). If the share server is unreachable it prints a longer self-contained `https://ai-wrapped.com/share#…` link; both work.
77
+
78
+ Give the user the link. The desktop app (`bunx ai-wrapped@latest` with no command) shows the same stories with animations.
79
+
80
+ ## Install this skill
81
+
82
+ ```bash
83
+ bunx ai-wrapped@latest skill install # ~/.claude/skills, ~/.codex/skills, ~/.agents/skills
84
+ bunx ai-wrapped@latest skill install --dir PATH # any other skills folder
85
+ ```
@@ -0,0 +1,88 @@
1
+ import type { AgentDiscoverer, FileCandidate } from "./types";
2
+ import { dedupeCandidates, expandHome, scanGlobCandidates } from "./utils";
3
+
4
+ const scanMany = async (
5
+ roots: Array<{ root: string; pattern: string }>,
6
+ source: AgentDiscoverer["source"],
7
+ ): Promise<FileCandidate[]> => {
8
+ const results = await Promise.all(
9
+ roots.map(({ root, pattern }) => scanGlobCandidates(expandHome(root), pattern, source, 1)),
10
+ );
11
+ return dedupeCandidates(results.flat());
12
+ };
13
+
14
+ export const ampDiscoverer: AgentDiscoverer = {
15
+ source: "amp",
16
+ discover: () => scanMany([{ root: "~/.local/share/amp", pattern: "threads/T-*.json" }], "amp"),
17
+ };
18
+
19
+ export const codebuffDiscoverer: AgentDiscoverer = {
20
+ source: "codebuff",
21
+ discover: () =>
22
+ scanMany(
23
+ ["manicode", "manicode-dev", "manicode-staging"].map((channel) => ({
24
+ root: `~/.config/${channel}/projects`,
25
+ pattern: "*/*/*/chat-messages.json",
26
+ })),
27
+ "codebuff",
28
+ ),
29
+ };
30
+
31
+ export const gooseDiscoverer: AgentDiscoverer = {
32
+ source: "goose",
33
+ discover: () =>
34
+ scanMany(
35
+ [
36
+ { root: "~/.local/share/goose/sessions", pattern: "sessions.db" },
37
+ { root: "~/Library/Application Support/goose/sessions", pattern: "sessions.db" },
38
+ { root: "~/.local/share/Block/goose/sessions", pattern: "sessions.db" },
39
+ ],
40
+ "goose",
41
+ ),
42
+ };
43
+
44
+ export const hermesDiscoverer: AgentDiscoverer = {
45
+ source: "hermes",
46
+ discover: () => scanMany([{ root: "~/.hermes", pattern: "state.db" }], "hermes"),
47
+ };
48
+
49
+ export const kiloDiscoverer: AgentDiscoverer = {
50
+ source: "kilo",
51
+ discover: () => scanMany([{ root: "~/.local/share/kilo", pattern: "kilo.db" }], "kilo"),
52
+ };
53
+
54
+ export const kimiDiscoverer: AgentDiscoverer = {
55
+ source: "kimi",
56
+ discover: () =>
57
+ scanMany(
58
+ [
59
+ { root: "~/.kimi/sessions", pattern: "*/*/wire.jsonl" },
60
+ { root: "~/.kimi/sessions", pattern: "*/*/agents/*/wire.jsonl" },
61
+ { root: "~/.kimi-code/sessions", pattern: "*/*/wire.jsonl" },
62
+ { root: "~/.kimi-code/sessions", pattern: "*/*/agents/*/wire.jsonl" },
63
+ ],
64
+ "kimi",
65
+ ),
66
+ };
67
+
68
+ export const openclawDiscoverer: AgentDiscoverer = {
69
+ source: "openclaw",
70
+ discover: () =>
71
+ scanMany(
72
+ ["~/.openclaw", "~/.clawdbot", "~/.moltbot", "~/.moldbot"].map((root) => ({
73
+ root,
74
+ pattern: "**/*.jsonl*",
75
+ })),
76
+ "openclaw",
77
+ ),
78
+ };
79
+
80
+ export const piDiscoverer: AgentDiscoverer = {
81
+ source: "pi",
82
+ discover: () => scanMany([{ root: "~/.pi/agent/sessions", pattern: "**/*.jsonl" }], "pi"),
83
+ };
84
+
85
+ export const qwenDiscoverer: AgentDiscoverer = {
86
+ source: "qwen",
87
+ discover: () => scanMany([{ root: "~/.qwen/projects", pattern: "*/chats/*.jsonl" }], "qwen"),
88
+ };
@@ -1,4 +1,15 @@
1
1
  import type { SessionSource } from "../../shared/schema";
2
+ import {
3
+ ampDiscoverer,
4
+ codebuffDiscoverer,
5
+ gooseDiscoverer,
6
+ hermesDiscoverer,
7
+ kiloDiscoverer,
8
+ kimiDiscoverer,
9
+ openclawDiscoverer,
10
+ piDiscoverer,
11
+ qwenDiscoverer,
12
+ } from "./additional";
2
13
  import { claudeDiscoverer } from "./claude";
3
14
  import { codexDiscoverer } from "./codex";
4
15
  import { copilotDiscoverer } from "./copilot";
@@ -14,6 +25,15 @@ const DISCOVERERS: AgentDiscoverer[] = [
14
25
  opencodeDiscoverer,
15
26
  droidDiscoverer,
16
27
  copilotDiscoverer,
28
+ ampDiscoverer,
29
+ codebuffDiscoverer,
30
+ gooseDiscoverer,
31
+ hermesDiscoverer,
32
+ kiloDiscoverer,
33
+ kimiDiscoverer,
34
+ openclawDiscoverer,
35
+ piDiscoverer,
36
+ qwenDiscoverer,
17
37
  ];
18
38
 
19
39
  export const discoverAll = async (sources?: SessionSource[]): Promise<FileCandidate[]> => {
@@ -0,0 +1,162 @@
1
+ // Headless access to the wrapped: scan logs, build the payload, summarise it
2
+ // for agents, and publish a share link. Used by `ai-wrapped stats|share`.
3
+
4
+ import { SESSION_SOURCES } from "../shared/schema";
5
+ import {
6
+ buildSharePayload,
7
+ codingStatus,
8
+ isWrappedRange,
9
+ modelKeys,
10
+ resolveDateRange,
11
+ type WrappedRange,
12
+ } from "../shared/buildPayload";
13
+ import { encodeShareData, NOTE_STORY_IDS, sanitizeNotes, type SharePayload, type ShareNotes } from "../shared/shareData";
14
+ import { resolveAggregationTimeZone } from "./aggregator";
15
+ import { getDailyTimelineFromStore, getDashboardSummaryFromStore } from "./queries";
16
+ import { runScan } from "./scan";
17
+ import { createShareLink, SHARE_ORIGIN } from "./share";
18
+ import { dailyStoreMissingHourDimension, dailyStoreMissingRepoDimension } from "./store";
19
+
20
+ export const parseRange = (value: string | undefined): WrappedRange => {
21
+ if (!value) return `year:${new Date().getFullYear()}`;
22
+ const normalized = /^\d{4}$/.test(value) ? `year:${value}` : value;
23
+ if (!isWrappedRange(normalized)) {
24
+ throw new Error(`Unknown range "${value}". Use a year (2026), last7, last30, last90 or last365.`);
25
+ }
26
+ return normalized;
27
+ };
28
+
29
+ export const loadPayload = async (range: WrappedRange, options: { scan?: boolean } = {}): Promise<SharePayload> => {
30
+ if (options.scan !== false) {
31
+ const fullScan = (await dailyStoreMissingRepoDimension()) || (await dailyStoreMissingHourDimension());
32
+ await runScan({ fullScan, timeZone: resolveAggregationTimeZone() });
33
+ }
34
+ const { dateFrom, dateTo } = resolveDateRange(range);
35
+ const [summary, timeline, ...bySource] = await Promise.all([
36
+ getDashboardSummaryFromStore(dateFrom, dateTo),
37
+ getDailyTimelineFromStore(dateFrom, dateTo),
38
+ ...SESSION_SOURCES.map((source) => getDailyTimelineFromStore(dateFrom, dateTo, source)),
39
+ ]);
40
+ const models = modelKeys(summary.byModel);
41
+ const byModel = await Promise.all(models.map((model) => getDailyTimelineFromStore(dateFrom, dateTo, undefined, model)));
42
+ return buildSharePayload({
43
+ range,
44
+ dateFrom,
45
+ dateTo,
46
+ summary,
47
+ timeline,
48
+ timelineBySource: bySource.map((rows, i) => ({ source: SESSION_SOURCES[i], rows })),
49
+ timelineByModel: byModel.map((rows, i) => ({ model: models[i], rows })),
50
+ });
51
+ };
52
+
53
+ const round = (value: number, digits = 2) => Math.round(value * 10 ** digits) / 10 ** digits;
54
+ const pct = (part: number, whole: number) => (whole > 0 ? round((part / whole) * 100, 1) : 0);
55
+
56
+ /** Which stories a share will show (and therefore which notes are used). */
57
+ export const storiesFor = (payload: SharePayload): string[] =>
58
+ NOTE_STORY_IDS.filter((id) => {
59
+ if (id === "repos") return payload.topRepos.length > 0;
60
+ if (id === "hours") return payload.hourlyBreakdown.some((row) => row.sessions > 0 || row.tokens > 0);
61
+ return true;
62
+ });
63
+
64
+ /** Compact, agent-readable summary. Small enough to paste into a prompt. */
65
+ export const digest = (payload: SharePayload, options: { repos?: boolean } = {}) => {
66
+ const peak = payload.hourlyBreakdown.reduce<SharePayload["hourlyBreakdown"][number] | null>(
67
+ (best, row) => (!best || row.tokens > best.tokens ? row : best),
68
+ null,
69
+ );
70
+ const agentTokens = payload.agentBreakdown.reduce((sum, row) => sum + row.tokens, 0);
71
+ const modelTokens = payload.modelBreakdown.reduce((sum, row) => sum + row.tokens, 0);
72
+ return {
73
+ range: payload.range,
74
+ dateFrom: payload.dateFrom,
75
+ dateTo: payload.dateTo,
76
+ totals: {
77
+ sessions: payload.totalSessions,
78
+ tokens: payload.totalTokens,
79
+ costUsd: round(payload.totalCostUsd),
80
+ toolCalls: payload.totalToolCalls,
81
+ hours: round(payload.totalDurationMs / 3_600_000, 1),
82
+ activeDays: payload.activeDays,
83
+ daysInRange: payload.dateSpanDays,
84
+ currentStreakDays: payload.currentStreakDays,
85
+ averageSessionMinutes: round(payload.averageSessionDurationMs / 60_000, 1),
86
+ longestSessionMinutes: round(payload.longestSessionEstimateMs / 60_000, 1),
87
+ },
88
+ topModels: payload.modelBreakdown.slice(0, 5).map((row) => ({
89
+ model: row.model,
90
+ tokenSharePercent: pct(row.tokens, modelTokens),
91
+ sessions: row.sessions,
92
+ costUsd: round(row.costUsd),
93
+ })),
94
+ agents: [...payload.agentBreakdown]
95
+ .sort((a, b) => b.tokens - a.tokens)
96
+ .map((row) => ({
97
+ agent: row.label,
98
+ tokenSharePercent: pct(row.tokens, agentTokens),
99
+ sessions: row.sessions,
100
+ costUsd: round(row.costUsd),
101
+ })),
102
+ spend: {
103
+ totalUsd: round(payload.totalCostUsd),
104
+ dailyAverageUsd: round(payload.dailyAverageCostUsd),
105
+ mostExpensiveDay: payload.mostExpensiveDay
106
+ ? { date: payload.mostExpensiveDay.date, costUsd: round(payload.mostExpensiveDay.costUsd) }
107
+ : null,
108
+ },
109
+ activity: {
110
+ busiestDay: payload.busiestSingleDay,
111
+ busiestWeekday: payload.busiestDayOfWeek || null,
112
+ weekendSessionPercent: payload.weekendSessionPercent,
113
+ },
114
+ hours: peak
115
+ ? {
116
+ peakHour: peak.label,
117
+ status: codingStatus(peak.hour).label,
118
+ sessionsMidnightTo6am: payload.hourlyBreakdown.filter((r) => r.hour < 6).reduce((s, r) => s + r.sessions, 0),
119
+ }
120
+ : null,
121
+ topRepos:
122
+ options.repos === false
123
+ ? "hidden"
124
+ : payload.topRepos.slice(0, 5).map((row) => ({
125
+ repo: row.repo,
126
+ sessions: row.sessions,
127
+ hours: round(row.durationMs / 3_600_000, 1),
128
+ costUsd: round(row.costUsd),
129
+ })),
130
+ stories: storiesFor(payload),
131
+ };
132
+ };
133
+
134
+ export const readNotes = async (source: string | undefined, author: string | undefined): Promise<ShareNotes | undefined> => {
135
+ if (!source) return undefined;
136
+ const text = source === "-" ? await Bun.stdin.text() : await Bun.file(source).text();
137
+ let raw: unknown;
138
+ try {
139
+ raw = JSON.parse(text);
140
+ } catch {
141
+ throw new Error("Notes must be JSON: { \"author\": \"...\", \"stories\": { \"intro\": \"...\" } }");
142
+ }
143
+ const object = (typeof raw === "object" && raw !== null ? raw : {}) as Record<string, unknown>;
144
+ // Accept both { author, stories: {...} } and a flat { intro: "...", ... }.
145
+ const stories = typeof object.stories === "object" && object.stories !== null ? object.stories : object;
146
+ const notes = sanitizeNotes({ author: author ?? object.author, stories });
147
+ if (!notes) throw new Error("Notes need an author (--author or \"author\") and at least one story note.");
148
+ return notes;
149
+ };
150
+
151
+ export const publish = async (
152
+ payload: SharePayload,
153
+ ): Promise<{ url: string; shortLink: boolean; note?: string }> => {
154
+ const encoded = encodeShareData(payload);
155
+ const created = await createShareLink(encoded);
156
+ if ("url" in created) return { url: created.url, shortLink: true };
157
+ return {
158
+ url: `${SHARE_ORIGIN}/share#${encoded}`,
159
+ shortLink: false,
160
+ note: `${created.error} Using a self-contained link instead.`,
161
+ };
162
+ };