ai-wrapped 1.11.0 → 1.13.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.
Files changed (74) hide show
  1. package/README.md +25 -29
  2. package/bin/cli.ts +22 -235
  3. package/dist/apple-touch-icon.png +0 -0
  4. package/dist/assets/BotAvatar-DBsbq7ca.js +1 -0
  5. package/dist/assets/{CrystalizedBall-fdPnFP5O.js → CrystalizedBall-Cpb3-_Ei.js} +9 -9
  6. package/dist/assets/EchoText-BGLBMBIB.js +1 -0
  7. package/dist/assets/GlowCursor-CCIshutg.js +221 -0
  8. package/dist/assets/Heatwave-DOd4ZAV5.js +146 -0
  9. package/dist/assets/{LightTunnel-DWAZftvN.js → LightTunnel-Cmhal5gj.js} +3 -3
  10. package/dist/assets/LineSpiral-DGdfRPle.js +221 -0
  11. package/dist/assets/{SideRays-BFkjst89.js → SideRays-Dy6_gRFG.js} +3 -3
  12. package/dist/assets/SlicedWaves-BoYUO0Z_.js +118 -0
  13. package/dist/assets/{SplitFlapText-Cpb9Vcdu.js → SplitFlapText-B4X0GqT2.js} +3 -3
  14. package/dist/assets/{Strands-C-50OkYn.js → Strands-DO5P5Q2H.js} +3 -3
  15. package/dist/assets/TechText-CjMXCY_m.js +1 -0
  16. package/dist/assets/index-DOJtWYpx.css +1 -0
  17. package/dist/assets/index-DlmdUHms.js +161 -0
  18. package/dist/favicon-32.png +0 -0
  19. package/dist/favicon.ico +0 -0
  20. package/dist/favicon.svg +16 -0
  21. package/dist/icon.png +0 -0
  22. package/dist/index.html +5 -2
  23. package/icon.png +0 -0
  24. package/package.json +6 -14
  25. package/public/apple-touch-icon.png +0 -0
  26. package/public/favicon-32.png +0 -0
  27. package/public/favicon.ico +0 -0
  28. package/public/favicon.svg +16 -0
  29. package/public/icon.png +0 -0
  30. package/skills/ai-wrapped/SKILL.md +53 -4
  31. package/src/bun/discovery/additional.ts +51 -0
  32. package/src/bun/discovery/index.ts +8 -0
  33. package/src/bun/headless.ts +18 -2
  34. package/src/bun/local.ts +156 -0
  35. package/src/bun/parsers/additional.test.ts +81 -1
  36. package/src/bun/parsers/additional.ts +264 -0
  37. package/src/bun/parsers/index.ts +14 -1
  38. package/src/bun/share.ts +0 -30
  39. package/src/shared/buildPayload.test.ts +29 -1
  40. package/src/shared/buildPayload.ts +13 -6
  41. package/src/shared/schema.ts +9 -1
  42. package/src/shared/shareData.test.ts +2 -2
  43. package/src/shared/shareData.ts +59 -4
  44. package/src/shared/types.ts +1 -70
  45. package/tsconfig.json +1 -1
  46. package/dist/assets/BotAvatar-B1afqxjz.js +0 -1
  47. package/dist/assets/EchoText-CySFjm8w.js +0 -1
  48. package/dist/assets/GlowCursor-C0jBh3OU.js +0 -221
  49. package/dist/assets/Heatwave-CjFyQGbM.js +0 -146
  50. package/dist/assets/LineSpiral-CnfM5ley.js +0 -221
  51. package/dist/assets/SlicedWaves-Dpkt-Vaj.js +0 -118
  52. package/dist/assets/TechText-C7Id1PJM.js +0 -1
  53. package/dist/assets/index-BiLDfPwS.js +0 -161
  54. package/dist/assets/index-CyB7FOHv.css +0 -1
  55. package/dist/tray-icon.png +0 -0
  56. package/dist/tray-icon@2x.png +0 -0
  57. package/electrobun.config.ts +0 -27
  58. package/icon.icns +0 -0
  59. package/icon.ico +0 -0
  60. package/icon.iconset/icon_128x128.png +0 -0
  61. package/icon.iconset/icon_128x128@2x.png +0 -0
  62. package/icon.iconset/icon_16x16.png +0 -0
  63. package/icon.iconset/icon_16x16@2x.png +0 -0
  64. package/icon.iconset/icon_256x256.png +0 -0
  65. package/icon.iconset/icon_256x256@2x.png +0 -0
  66. package/icon.iconset/icon_32x32.png +0 -0
  67. package/icon.iconset/icon_32x32@2x.png +0 -0
  68. package/icon.iconset/icon_512x512.png +0 -0
  69. package/icon.iconset/icon_512x512@2x.png +0 -0
  70. package/public/tray-icon.png +0 -0
  71. package/public/tray-icon@2x.png +0 -0
  72. package/src/bun/external.test.ts +0 -32
  73. package/src/bun/external.ts +0 -39
  74. package/src/bun/index.ts +0 -887
package/README.md CHANGED
@@ -5,14 +5,12 @@
5
5
  <h1 align="center">AI Wrapped</h1>
6
6
 
7
7
  <p align="center">
8
- Spotify Wrapped-style desktop dashboard for your AI coding agent activity.
8
+ Your year in AI coding, wrapped: Spotify Wrapped-style stories from your coding agents, in your browser.
9
9
  <br />
10
10
  <a href="https://ai-wrapped.com">ai-wrapped.com</a> · <a href="https://www.npmjs.com/package/ai-wrapped"><img src="https://img.shields.io/npm/v/ai-wrapped" alt="npm" /></a>
11
11
  </p>
12
12
 
13
- A visual summary across multiple agents.
14
-
15
- Built on [Electrobun](https://electrobun.dev) — a TypeScript-first desktop framework using Bun + native webviews.
13
+ No desktop app to install: `npx ai-wrapped@latest` reads the session logs on your machine, serves the stories from `127.0.0.1` and opens them in your browser. Nothing is uploaded unless you press Share.
16
14
 
17
15
  Built on top of [agent-sessions](https://github.com/jazzyalex/agent-sessions) session format discovery — reads JSONL/JSON session logs that AI coding agents write to disk.
18
16
 
@@ -33,6 +31,14 @@ Built on top of [agent-sessions](https://github.com/jazzyalex/agent-sessions) se
33
31
  - **OpenClaw** — OpenClaw session logs
34
32
  - **pi** — pi-agent session logs
35
33
  - **Qwen Code** — Qwen chat logs
34
+ - **agy (Antigravity CLI)** — `~/.gemini/antigravity-cli/brain` transcripts
35
+ - **DeepSeek Harness** — `~/.dsh/sessions` logs (plain or zstd)
36
+ - **Grok CLI** — `~/.grok/sessions/*/*/updates.jsonl`
37
+ - **Cursor CLI** — `~/.cursor/projects/*/agent-transcripts` (sessions, messages and tool calls; Cursor keeps token counts on its servers)
38
+
39
+ The newer readers (agy, DeepSeek Harness, Grok, Cursor) take numbers only: tokens, models, times and counts, never message text.
40
+
41
+ Usage from chat apps and provider APIs (claude.ai, ChatGPT, Anthropic/OpenAI usage APIs, Cursor's dashboard) can be added as totals with `--cloud`; see [agents.md](https://ai-wrapped.com/agents.md). Missing a harness? Open an issue or a PR with a discoverer and parser in `src/bun/discovery/additional.ts` and `src/bun/parsers/additional.ts`.
36
42
 
37
43
  ## What It Shows
38
44
 
@@ -43,8 +49,8 @@ Built on top of [agent-sessions](https://github.com/jazzyalex/agent-sessions) se
43
49
  - Time spent — total hours, average session duration, longest session, current streak, active day coverage ring
44
50
  - Top repositories with sessions, tokens, cost, and duration (names hidden as codes unless you choose to show them)
45
51
  - Coding hours — 24-hour activity breakdown by agent
46
- - Short share links (`ai-wrapped.com/s/…`) with a rich link preview, plus image and PDF export
47
- - System tray with today's stats at a glance
52
+ - Short share links (`ai-wrapped.com/s/…`) with a rich link preview, plus image export
53
+ - A soundtrack generated in the browser (a different genre per story), 12 interface languages, and a "Calm motion" option
48
54
 
49
55
  ## Quick start
50
56
 
@@ -54,11 +60,11 @@ npx ai-wrapped@latest
54
60
  bunx ai-wrapped@latest
55
61
  ```
56
62
 
57
- Flags: `--version`, `--rebuild`, `--uninstall`
63
+ Flags: `--no-open` (only print the link), `--no-scan`, `--version`, `--uninstall`
58
64
 
59
65
  ## For agents: the AI Wrapped skill
60
66
 
61
- Any coding agent with a shell (Claude Code, Codex, Gemini CLI, OpenCode, …) can build your wrapped, add its own commentary to every story, and publish a link. The skill is plain Markdown in [`skills/ai-wrapped/SKILL.md`](skills/ai-wrapped/SKILL.md).
67
+ Any coding agent with a shell (Claude Code, Codex, agy, DeepSeek Harness, Grok, Cursor, OpenCode, …) can build your wrapped, add its own commentary to every story, and publish a link. The skill is plain Markdown in [`skills/ai-wrapped/SKILL.md`](skills/ai-wrapped/SKILL.md).
62
68
 
63
69
  ```bash
64
70
  bunx ai-wrapped@latest skill install # copies SKILL.md into ~/.claude/skills, ~/.codex/skills, ~/.agents/skills
@@ -68,25 +74,26 @@ Then ask your agent for "my AI wrapped". The agent can comment on each story, gi
68
74
 
69
75
  ```bash
70
76
  ai-wrapped stats --range 2026 # JSON digest for the agent to read
77
+ ai-wrapped view --range 2026 --notes notes.json # private link (data stays in the #fragment)
71
78
  ai-wrapped share --range 2026 --notes notes.json # publish with the agent's notes
72
79
  ```
73
80
 
74
- Notes are `{ "author": "Codex (gpt-6)", "stories": { "intro": { "title": "…", "subtitle": "…", "note": "…" }, "hours": "…" } }`. Repository names are shared as codes unless you add `--show-repos`.
81
+ Notes are `{ "author": "Codex (gpt-6)", "lang": "en", "stories": { "intro": { "title": "…", "subtitle": "…", "note": "…" }, "hours": "…" } }`. Repository names are shared as codes unless you add `--show-repos`.
75
82
 
76
83
  ## Stack
77
84
 
78
85
  - **Runtime**: [Bun](https://bun.sh)
79
- - **Desktop**: [Electrobun 2](https://electrobun.dev) (native webview, no Chromium bundling on macOS). The SDK is projected into `.hutch/devkit` by `bunx electrobun sync`.
86
+ - **Local app**: a small Bun server on `127.0.0.1` (loopback only, per-run key in the opened link, Host header check) that serves the web app and the stats.
80
87
  - **Frontend**: React + Tailwind CSS, hand-rolled SVG charts, and per-story WebGL backgrounds and text effects from [React Bits](https://reactbits.dev) (`src/wrapped/rb/`, used under the React Bits license), shared by the app, share page and landing page. Avatars from [Open Bot Avatar](https://github.com/dominikscholz/open-bot-avatar).
81
- - **Build**: Vite (frontend) + Electrobun CLI (app bundle)
88
+ - **Build**: Vite (`dist/` for the local app, `dist-site/` for the website)
82
89
  - **Storage**: JSON files in `~/.ai-wrapped/`
83
90
 
84
91
  ## Layout
85
92
 
86
93
  | Path | What |
87
94
  | --- | --- |
88
- | `src/bun/` | Electrobun main process: session discovery, parsing, aggregation, tray, share upload |
89
- | `src/mainview/` | Desktop app view |
95
+ | `src/bun/` | Session discovery, parsing, aggregation, the local server (`local.ts`), share upload |
96
+ | `src/mainview/` | The local web app (stories + share controls) |
90
97
  | `src/wrapped/` | Design system: shader, palettes, stories, charts, share image |
91
98
  | `src/site/` | Landing page (`/`) and share page (`/share`, `/s/:id`) |
92
99
  | `server/` | Bun server for the site and short share links (SQLite) |
@@ -100,19 +107,8 @@ bun install
100
107
  ### Development
101
108
 
102
109
  ```bash
103
- bun run dev
104
- ```
105
-
106
- Or with HMR for the frontend:
107
-
108
- ```bash
109
- bun run dev:hmr
110
- ```
111
-
112
- ### Production Build
113
-
114
- ```bash
115
- bun run build:prod
110
+ bun run dev # builds the web app, then runs the CLI (opens your browser)
111
+ bun run build # builds dist/ only
116
112
  ```
117
113
 
118
114
  ### Website and share server
@@ -125,11 +121,11 @@ bun run server # serves dist-site and the share API on :3000
125
121
  Environment: `PORT`, `HOST`, `STATIC_DIR`, `DATA_DIR` (SQLite location), `PUBLIC_ORIGIN` (e.g. `https://ai-wrapped.com`), `RATE_LIMIT_PER_HOUR`.
126
122
  A `Dockerfile` builds the site and runs the server; mount a volume at `/data`.
127
123
 
128
- The desktop app posts shares to `https://ai-wrapped.com/api/share` (override with `AI_WRAPPED_SHARE_ORIGIN`). If the server can't be reached it falls back to a self-contained `/share#…` link.
124
+ The local app posts shares to `https://ai-wrapped.com/api/share` (override with `AI_WRAPPED_SHARE_ORIGIN`). If the server can't be reached it falls back to a self-contained `/share#…` link.
129
125
 
130
126
  ## How It Works
131
127
 
132
- 1. On launch (and every 5 minutes by default), the app scans known session directories for each agent
128
+ 1. On launch, the CLI scans known session directories for each agent
133
129
  2. New or changed session files are parsed into a normalized format with token counts, tool calls, and cost estimates
134
130
  3. Aggregated daily stats are written to `~/.ai-wrapped/daily.json`
135
- 4. The frontend fetches summaries over RPC and renders the Wrapped-style dashboard
131
+ 4. The local server builds the wrapped for the chosen range and the browser renders the stories
package/bin/cli.ts CHANGED
@@ -4,169 +4,15 @@ import { dirname, join } from "node:path";
4
4
 
5
5
  const PKG_ROOT = join(dirname(Bun.main), "..");
6
6
  const HOME = Bun.env.HOME || Bun.env.USERPROFILE || "";
7
- const CACHE_DIR = `${HOME}/.ai-wrapped/app`;
8
- const VERSION_FILE = `${CACHE_DIR}/version.json`;
9
-
10
- interface CachedBuild {
11
- version: string;
12
- platform: string;
13
- arch: string;
14
- builtAt: string;
15
- }
16
-
17
- async function readCachedBuild(): Promise<CachedBuild | null> {
18
- const file = Bun.file(VERSION_FILE);
19
- if (!(await file.exists())) return null;
20
- try {
21
- return (await file.json()) as CachedBuild;
22
- } catch {
23
- return null;
24
- }
25
- }
7
+ const LEGACY_APP_DIR = `${HOME}/.ai-wrapped/app`;
8
+ /** The built web app (vite build of src/mainview). */
9
+ const APP_DIR = join(PKG_ROOT, "dist");
26
10
 
27
11
  async function getPackageVersion(): Promise<string> {
28
12
  const pkg = await Bun.file(join(PKG_ROOT, "package.json")).json();
29
13
  return pkg.version;
30
14
  }
31
15
 
32
- async function ensureRuntimeBuildDependencies(): Promise<void> {
33
- const electrobunPkg = Bun.file(
34
- join(PKG_ROOT, "node_modules", "electrobun", "package.json"),
35
- );
36
- if (await electrobunPkg.exists()) return;
37
-
38
- // bunx extracts ai-wrapped without node_modules, but electrobun expects
39
- // ./node_modules/electrobun relative to the app root when building.
40
- console.log(" Installing build dependencies...\n");
41
- const proc = Bun.spawn([process.execPath, "install", "--production"], {
42
- cwd: PKG_ROOT,
43
- stdout: "inherit",
44
- stderr: "inherit",
45
- env: { ...process.env },
46
- });
47
-
48
- const exitCode = await proc.exited;
49
- if (exitCode !== 0) {
50
- throw new Error(`Dependency install failed with exit code ${exitCode}`);
51
- }
52
- }
53
-
54
- async function buildApp(): Promise<string> {
55
- const platform = process.platform;
56
- const arch = process.arch;
57
-
58
- // Electrobun build needs to run from the package root
59
- console.log(" Building app (first run only)...\n");
60
- await ensureRuntimeBuildDependencies();
61
-
62
- // Run electrobun build from the package directory
63
- const proc = Bun.spawn(["bunx", "electrobun", "build"], {
64
- cwd: PKG_ROOT,
65
- stdout: "inherit",
66
- stderr: "inherit",
67
- env: { ...process.env },
68
- });
69
-
70
- const exitCode = await proc.exited;
71
- if (exitCode !== 0) {
72
- throw new Error(`Build failed with exit code ${exitCode}`);
73
- }
74
-
75
- // Electrobun outputs to build/dev-{platform}-{arch}/. The bundle name inside
76
- // changed between major versions ("AI Wrapped-dev.app" vs "AIWrapped-dev"),
77
- // so locate it instead of hardcoding.
78
- const platformLabel =
79
- platform === "darwin" ? "macos" : platform === "win32" ? "win" : "linux";
80
- const buildDir = join(PKG_ROOT, "build", `dev-${platformLabel}-${arch}`);
81
-
82
- if (platform === "darwin") {
83
- const appPath = await findFirst(buildDir, (name) => name.endsWith(".app"), 2);
84
- if (!appPath || !(await Bun.file(join(appPath, "Contents", "Info.plist")).exists())) {
85
- throw new Error(`Build completed but no .app bundle was found in ${buildDir}.`);
86
- }
87
- return appPath;
88
- }
89
-
90
- // Linux/Windows: return the build directory
91
- return buildDir;
92
- }
93
-
94
- async function findFirst(
95
- dir: string,
96
- match: (name: string) => boolean,
97
- depth: number,
98
- ): Promise<string | null> {
99
- const { readdir } = await import("node:fs/promises");
100
- let entries: Array<{ name: string; isDirectory(): boolean }>;
101
- try {
102
- entries = await readdir(dir, { withFileTypes: true });
103
- } catch {
104
- return null;
105
- }
106
- for (const entry of entries) {
107
- if (match(entry.name)) return join(dir, entry.name);
108
- }
109
- if (depth <= 0) return null;
110
- for (const entry of entries) {
111
- if (!entry.isDirectory() || entry.name.endsWith(".app")) continue;
112
- const found = await findFirst(join(dir, entry.name), match, depth - 1);
113
- if (found) return found;
114
- }
115
- return null;
116
- }
117
-
118
- async function installToCache(builtPath: string): Promise<void> {
119
- const platform = process.platform;
120
-
121
- await Bun.$`mkdir -p ${CACHE_DIR}`.quiet();
122
-
123
- if (platform === "darwin") {
124
- // Copy .app bundle to cache
125
- await Bun.$`rm -rf ${CACHE_DIR}/"AI Wrapped.app"`.quiet();
126
- await Bun.$`cp -R ${builtPath} ${CACHE_DIR}/"AI Wrapped.app"`.quiet();
127
- } else {
128
- // Copy all files for linux/windows
129
- await Bun.$`rm -rf ${CACHE_DIR}/app-files`.quiet();
130
- await Bun.$`cp -R ${builtPath} ${CACHE_DIR}/app-files`.quiet();
131
- }
132
- }
133
-
134
- async function launch(): Promise<void> {
135
- const platform = process.platform;
136
-
137
- if (platform === "darwin") {
138
- const appPath = `${CACHE_DIR}/AI Wrapped.app`;
139
- const plist = Bun.file(`${appPath}/Contents/Info.plist`);
140
- if (!(await plist.exists())) {
141
- throw new Error(
142
- `App not found at ${appPath}. Try running with --rebuild.`,
143
- );
144
- }
145
- console.log(" Launching AI Wrapped...");
146
- await Bun.$`open ${appPath}`.quiet();
147
- } else if (platform === "linux") {
148
- const launcher = await findFirst(`${CACHE_DIR}/app-files`, (name) => name === "launcher", 3);
149
- if (!launcher) {
150
- throw new Error("App launcher not found. Try running with --rebuild.");
151
- }
152
- console.log(" Launching AI Wrapped...");
153
- Bun.spawn([launcher], {
154
- stdin: "ignore",
155
- stdout: "ignore",
156
- stderr: "ignore",
157
- }).unref();
158
- } else if (platform === "win32") {
159
- const exe =
160
- (await findFirst(`${CACHE_DIR}/app-files`, (name) => name.toLowerCase() === "launcher.exe", 3)) ??
161
- (await findFirst(`${CACHE_DIR}/app-files`, (name) => name.toLowerCase().endsWith(".exe") && !name.toLowerCase().includes("helper"), 3));
162
- if (!exe) {
163
- throw new Error("App executable not found. Try running with --rebuild.");
164
- }
165
- console.log(" Launching AI Wrapped...");
166
- Bun.spawn(["cmd", "/c", "start", "", exe], { stdout: "ignore", stderr: "ignore" });
167
- }
168
- }
169
-
170
16
  /* ---------------- headless commands (for agents) ---------------- */
171
17
 
172
18
  const flag = (name: string): string | undefined => {
@@ -190,7 +36,9 @@ async function runHeadless(command: string): Promise<boolean> {
190
36
  const payload = await headless.loadPayload(range, { scan: !has("no-scan") });
191
37
  // Repository names are hidden (replaced by codes) unless --show-repos; --no-repos drops them.
192
38
  const { hideRepoNames } = await import("../src/shared/shareData");
193
- const shared = !repos ? { ...payload, topRepos: [] } : has("show-repos") ? payload : hideRepoNames(payload);
39
+ const base = !repos ? { ...payload, topRepos: [] } : has("show-repos") ? payload : hideRepoNames(payload);
40
+ const cloud = await headless.readCloud(flag("cloud") || undefined);
41
+ const shared = cloud ? { ...base, cloud } : base;
194
42
 
195
43
  if (command === "stats") {
196
44
  const out = flag("out");
@@ -206,12 +54,8 @@ async function runHeadless(command: string): Promise<boolean> {
206
54
  const url = headless.privateLink(withNotes);
207
55
  console.log(url);
208
56
  if (!has("no-open")) {
209
- const opener = process.platform === "darwin" ? "open" : process.platform === "win32" ? "explorer" : "xdg-open";
210
- try {
211
- Bun.spawn([opener, url], { stdout: "ignore", stderr: "ignore" });
212
- } catch {
213
- // No browser here; the link is printed above.
214
- }
57
+ const { openInBrowser } = await import("../src/bun/local");
58
+ openInBrowser(url);
215
59
  }
216
60
  return true;
217
61
  }
@@ -251,113 +95,56 @@ async function runHeadless(command: string): Promise<boolean> {
251
95
  }
252
96
 
253
97
  async function main() {
254
- const platform = process.platform;
255
98
  const command = process.argv[2];
256
99
  if (command && !command.startsWith("-")) {
257
100
  if (await runHeadless(command)) return;
258
101
  throw new Error(`Unknown command "${command}". Run ai-wrapped --help.`);
259
102
  }
260
- const arch = process.arch;
261
103
 
262
104
  console.log("");
263
105
  console.log(" \x1b[1mAI Wrapped\x1b[0m");
264
106
  console.log(" Your year in AI\n");
265
107
 
266
- // --help
267
108
  if (process.argv.includes("--help") || process.argv.includes("-h")) {
268
109
  console.log(" Usage: ai-wrapped [command] [options]\n");
269
110
  console.log(" Commands:");
270
- console.log(" (none) Open the desktop app");
111
+ console.log(" (none) Open your wrapped in the browser (runs locally)");
112
+ console.log(" [--no-open] Only print the link");
271
113
  console.log(" stats [--range R] Print a JSON summary (R: 2026, last7, last30, last90, last365)");
272
114
  console.log(" [--out file] Also write the full wrapped data to a file");
273
115
  console.log(" view [--range R] [--notes file|-] [--no-open]");
274
- console.log(" Open your wrapped privately (nothing is uploaded)");
116
+ console.log(" Open a private link with your agent's notes (nothing is uploaded)");
275
117
  console.log(" share [--range R] [--notes file|-] [--author name] [--show-repos|--no-repos] [--dry-run]");
276
118
  console.log(" Publish a share link, optionally with your agent's notes");
277
119
  console.log(" skill [install] Print or install the agent skill (SKILL.md)");
278
- console.log(" Common: --no-scan (use cached stats), --show-repos (show repository names; hidden by default), --no-repos (leave repositories out)\n");
120
+ console.log(" Common: --no-scan (use cached stats), --show-repos (show repository names; hidden by default), --no-repos (leave repositories out),");
121
+ console.log(" --cloud file (add usage from chat apps or APIs as totals; see ai-wrapped.com/agents.md)\n");
279
122
  console.log(" Options:");
280
123
  console.log(" --version, -v Show installed version");
281
- console.log(" --rebuild Force rebuild the app");
282
- console.log(" --uninstall Remove cached app");
124
+ console.log(" --uninstall Remove saved stats and settings (~/.ai-wrapped)");
283
125
  console.log(" --help, -h Show this help");
284
126
  return;
285
127
  }
286
128
 
287
- // --version
288
129
  if (process.argv.includes("--version") || process.argv.includes("-v")) {
289
- const cached = await readCachedBuild();
290
- const pkgVersion = await getPackageVersion();
291
- console.log(` Package: v${pkgVersion}`);
292
- console.log(
293
- cached
294
- ? ` Installed: v${cached.version} (${cached.platform}/${cached.arch})`
295
- : " Not built yet",
296
- );
130
+ console.log(` v${await getPackageVersion()}`);
297
131
  return;
298
132
  }
299
133
 
300
- // --uninstall
301
134
  if (process.argv.includes("--uninstall")) {
302
135
  console.log(" Removing ~/.ai-wrapped...");
303
- if (platform === "win32") {
304
- await Bun.$`powershell -Command "Remove-Item -Recurse -Force '${HOME}/.ai-wrapped' -ErrorAction SilentlyContinue"`.quiet();
305
- } else {
306
- await Bun.$`rm -rf ${HOME}/.ai-wrapped`.quiet();
307
- }
136
+ const { rm } = await import("node:fs/promises");
137
+ await rm(join(HOME, ".ai-wrapped"), { recursive: true, force: true });
308
138
  console.log(" Done.");
309
139
  return;
310
140
  }
311
141
 
312
- const forceRebuild = process.argv.includes("--rebuild");
313
-
314
- // Check if we need to build
315
- const pkgVersion = await getPackageVersion();
316
- const cached = await readCachedBuild();
317
- const platformLabel =
318
- platform === "darwin" ? "macos" : platform === "win32" ? "win" : "linux";
319
- const needsBuild =
320
- forceRebuild ||
321
- !cached ||
322
- cached.version !== pkgVersion ||
323
- cached.platform !== platformLabel ||
324
- cached.arch !== arch;
325
-
326
- if (needsBuild) {
327
- if (cached && !forceRebuild) {
328
- console.log(
329
- ` Upgrading v${cached.version} \u2192 v${pkgVersion}`,
330
- );
331
- } else if (!forceRebuild) {
332
- console.log(` First run — building v${pkgVersion}...`);
333
- } else {
334
- console.log(` Rebuilding v${pkgVersion}...`);
335
- }
336
-
337
- const builtPath = await buildApp();
338
- await installToCache(builtPath);
339
-
340
- // Write version cache
341
- await Bun.write(
342
- VERSION_FILE,
343
- JSON.stringify(
344
- {
345
- version: pkgVersion,
346
- platform: platformLabel,
347
- arch,
348
- builtAt: new Date().toISOString(),
349
- },
350
- null,
351
- 2,
352
- ),
353
- );
354
-
355
- console.log(`\n Built and cached v${pkgVersion}\n`);
356
- } else {
357
- console.log(` v${pkgVersion} ready\n`);
358
- }
142
+ // The desktop app from older versions is no longer used.
143
+ const { rm } = await import("node:fs/promises");
144
+ await rm(LEGACY_APP_DIR, { recursive: true, force: true }).catch(() => undefined);
359
145
 
360
- await launch();
146
+ const { runLocal } = await import("../src/bun/local");
147
+ await runLocal({ appDir: APP_DIR, open: !has("no-open"), scan: !has("no-scan") });
361
148
  }
362
149
 
363
150
  main().catch((err) => {
Binary file