ai-wrapped 1.10.1 → 1.12.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 +17 -29
- package/bin/cli.ts +32 -230
- package/dist/apple-touch-icon.png +0 -0
- package/dist/assets/BotAvatar-DQljNXqE.js +1 -0
- package/dist/assets/CrystalizedBall-D-HRqF-i.js +440 -0
- package/dist/assets/EchoText-Bh5B8jwf.js +1 -0
- package/dist/assets/GlowCursor-CweToSjn.js +221 -0
- package/dist/assets/Heatwave-D03UY60G.js +146 -0
- package/dist/assets/LightTunnel-DOgB67JQ.js +152 -0
- package/dist/assets/LineSpiral-HyanwOhc.js +221 -0
- package/dist/assets/SideRays-BZkj7mcv.js +114 -0
- package/dist/assets/SlicedWaves-BU2SNcWc.js +118 -0
- package/dist/assets/SplitFlapText-B77SP2Jd.js +36 -0
- package/dist/assets/Strands-B0LJQ-ls.js +269 -0
- package/dist/assets/TechText-rLlgoD-6.js +1 -0
- package/dist/assets/index-C4giU4ib.css +1 -0
- package/dist/assets/index-CRDlBDiW.js +161 -0
- package/dist/favicon-32.png +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/favicon.svg +16 -0
- package/dist/icon.png +0 -0
- package/dist/index.html +5 -2
- package/icon.png +0 -0
- package/package.json +8 -14
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon-32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/favicon.svg +16 -0
- package/public/icon.png +0 -0
- package/skills/ai-wrapped/SKILL.md +37 -11
- package/src/bun/headless.ts +7 -0
- package/src/bun/local.ts +156 -0
- package/src/bun/share.ts +0 -30
- package/src/shared/buildPayload.test.ts +40 -4
- package/src/shared/shareData.ts +87 -4
- package/src/shared/types.ts +1 -70
- package/tsconfig.json +1 -1
- package/dist/assets/index-D86Dwdmk.css +0 -1
- package/dist/assets/index-Z_PapH85.js +0 -119
- package/dist/tray-icon.png +0 -0
- package/dist/tray-icon@2x.png +0 -0
- package/electrobun.config.ts +0 -27
- package/icon.icns +0 -0
- package/icon.ico +0 -0
- package/icon.iconset/icon_128x128.png +0 -0
- package/icon.iconset/icon_128x128@2x.png +0 -0
- package/icon.iconset/icon_16x16.png +0 -0
- package/icon.iconset/icon_16x16@2x.png +0 -0
- package/icon.iconset/icon_256x256.png +0 -0
- package/icon.iconset/icon_256x256@2x.png +0 -0
- package/icon.iconset/icon_32x32.png +0 -0
- package/icon.iconset/icon_32x32@2x.png +0 -0
- package/icon.iconset/icon_512x512.png +0 -0
- package/icon.iconset/icon_512x512@2x.png +0 -0
- package/public/tray-icon.png +0 -0
- package/public/tray-icon@2x.png +0 -0
- package/src/bun/external.test.ts +0 -32
- package/src/bun/external.ts +0 -39
- package/src/bun/index.ts +0 -887
package/README.md
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
<h1 align="center">AI Wrapped</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
Spotify Wrapped-style
|
|
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
13
|
A visual summary across multiple agents.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
`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
16
|
|
|
17
17
|
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
18
|
|
|
@@ -39,12 +39,11 @@ Built on top of [agent-sessions](https://github.com/jazzyalex/agent-sessions) se
|
|
|
39
39
|
- Total sessions, messages, tool calls, tokens, and estimated cost
|
|
40
40
|
- Daily activity timeline with per-agent and per-model breakdown
|
|
41
41
|
- Cost breakdown by model (Claude Opus, Sonnet, GPT-4o, Gemini Pro, etc.)
|
|
42
|
-
- Agent
|
|
42
|
+
- Agent podium and top-5 models, with their logos
|
|
43
43
|
- Time spent — total hours, average session duration, longest session, current streak, active day coverage ring
|
|
44
|
-
- Top repositories with sessions, tokens, cost, and duration
|
|
44
|
+
- Top repositories with sessions, tokens, cost, and duration (names hidden as codes unless you choose to show them)
|
|
45
45
|
- Coding hours — 24-hour activity breakdown by agent
|
|
46
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
|
|
48
47
|
|
|
49
48
|
## Quick start
|
|
50
49
|
|
|
@@ -54,7 +53,7 @@ npx ai-wrapped@latest
|
|
|
54
53
|
bunx ai-wrapped@latest
|
|
55
54
|
```
|
|
56
55
|
|
|
57
|
-
Flags: `--
|
|
56
|
+
Flags: `--no-open` (only print the link), `--no-scan`, `--version`, `--uninstall`
|
|
58
57
|
|
|
59
58
|
## For agents: the AI Wrapped skill
|
|
60
59
|
|
|
@@ -64,29 +63,29 @@ Any coding agent with a shell (Claude Code, Codex, Gemini CLI, OpenCode, …) ca
|
|
|
64
63
|
bunx ai-wrapped@latest skill install # copies SKILL.md into ~/.claude/skills, ~/.codex/skills, ~/.agents/skills
|
|
65
64
|
```
|
|
66
65
|
|
|
67
|
-
Then ask your agent for "my AI wrapped". Under the hood it uses:
|
|
66
|
+
Then ask your agent for "my AI wrapped". The agent can comment on each story, give it its own title and subtitle, and pick its background and number animation from a fixed catalog. Under the hood it uses:
|
|
68
67
|
|
|
69
68
|
```bash
|
|
70
69
|
ai-wrapped stats --range 2026 # JSON digest for the agent to read
|
|
71
70
|
ai-wrapped share --range 2026 --notes notes.json # publish with the agent's notes
|
|
72
71
|
```
|
|
73
72
|
|
|
74
|
-
Notes are `{ "author": "Codex (gpt-6)", "stories": { "intro": "…", "hours": "…" } }
|
|
73
|
+
Notes are `{ "author": "Codex (gpt-6)", "stories": { "intro": { "title": "…", "subtitle": "…", "note": "…" }, "hours": "…" } }`. Repository names are shared as codes unless you add `--show-repos`.
|
|
75
74
|
|
|
76
75
|
## Stack
|
|
77
76
|
|
|
78
77
|
- **Runtime**: [Bun](https://bun.sh)
|
|
79
|
-
- **
|
|
80
|
-
- **Frontend**: React + Tailwind CSS,
|
|
81
|
-
- **Build**: Vite (
|
|
78
|
+
- **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.
|
|
79
|
+
- **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).
|
|
80
|
+
- **Build**: Vite (`dist/` for the local app, `dist-site/` for the website)
|
|
82
81
|
- **Storage**: JSON files in `~/.ai-wrapped/`
|
|
83
82
|
|
|
84
83
|
## Layout
|
|
85
84
|
|
|
86
85
|
| Path | What |
|
|
87
86
|
| --- | --- |
|
|
88
|
-
| `src/bun/` |
|
|
89
|
-
| `src/mainview/` |
|
|
87
|
+
| `src/bun/` | Session discovery, parsing, aggregation, the local server (`local.ts`), share upload |
|
|
88
|
+
| `src/mainview/` | The local web app (stories + share controls) |
|
|
90
89
|
| `src/wrapped/` | Design system: shader, palettes, stories, charts, share image |
|
|
91
90
|
| `src/site/` | Landing page (`/`) and share page (`/share`, `/s/:id`) |
|
|
92
91
|
| `server/` | Bun server for the site and short share links (SQLite) |
|
|
@@ -100,19 +99,8 @@ bun install
|
|
|
100
99
|
### Development
|
|
101
100
|
|
|
102
101
|
```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
|
|
102
|
+
bun run dev # builds the web app, then runs the CLI (opens your browser)
|
|
103
|
+
bun run build # builds dist/ only
|
|
116
104
|
```
|
|
117
105
|
|
|
118
106
|
### Website and share server
|
|
@@ -125,11 +113,11 @@ bun run server # serves dist-site and the share API on :3000
|
|
|
125
113
|
Environment: `PORT`, `HOST`, `STATIC_DIR`, `DATA_DIR` (SQLite location), `PUBLIC_ORIGIN` (e.g. `https://ai-wrapped.com`), `RATE_LIMIT_PER_HOUR`.
|
|
126
114
|
A `Dockerfile` builds the site and runs the server; mount a volume at `/data`.
|
|
127
115
|
|
|
128
|
-
The
|
|
116
|
+
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
117
|
|
|
130
118
|
## How It Works
|
|
131
119
|
|
|
132
|
-
1. On launch
|
|
120
|
+
1. On launch, the CLI scans known session directories for each agent
|
|
133
121
|
2. New or changed session files are parsed into a normalized format with token counts, tool calls, and cost estimates
|
|
134
122
|
3. Aggregated daily stats are written to `~/.ai-wrapped/daily.json`
|
|
135
|
-
4. The
|
|
123
|
+
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
|
|
8
|
-
|
|
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 => {
|
|
@@ -183,12 +29,14 @@ const has = (name: string) => process.argv.slice(2).includes(`--${name}`);
|
|
|
183
29
|
const SKILL_DIR = join(PKG_ROOT, "skills", "ai-wrapped");
|
|
184
30
|
|
|
185
31
|
async function runHeadless(command: string): Promise<boolean> {
|
|
186
|
-
if (command === "stats" || command === "share") {
|
|
32
|
+
if (command === "stats" || command === "share" || command === "view") {
|
|
187
33
|
const headless = await import("../src/bun/headless");
|
|
188
34
|
const range = headless.parseRange(flag("range") || undefined);
|
|
189
35
|
const repos = !has("no-repos");
|
|
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.
|
|
38
|
+
const { hideRepoNames } = await import("../src/shared/shareData");
|
|
39
|
+
const shared = !repos ? { ...payload, topRepos: [] } : has("show-repos") ? payload : hideRepoNames(payload);
|
|
192
40
|
|
|
193
41
|
if (command === "stats") {
|
|
194
42
|
const out = flag("out");
|
|
@@ -199,6 +47,16 @@ async function runHeadless(command: string): Promise<boolean> {
|
|
|
199
47
|
|
|
200
48
|
const notes = await headless.readNotes(flag("notes") || undefined, flag("author") || undefined);
|
|
201
49
|
const withNotes = notes ? { ...shared, notes } : shared;
|
|
50
|
+
if (command === "view") {
|
|
51
|
+
// Private view: nothing is uploaded; the data stays in the link's #fragment.
|
|
52
|
+
const url = headless.privateLink(withNotes);
|
|
53
|
+
console.log(url);
|
|
54
|
+
if (!has("no-open")) {
|
|
55
|
+
const { openInBrowser } = await import("../src/bun/local");
|
|
56
|
+
openInBrowser(url);
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
202
60
|
if (has("dry-run")) {
|
|
203
61
|
console.log(JSON.stringify({ notes: withNotes.notes ?? null, stories: headless.storiesFor(withNotes) }, null, 2));
|
|
204
62
|
return true;
|
|
@@ -235,111 +93,55 @@ async function runHeadless(command: string): Promise<boolean> {
|
|
|
235
93
|
}
|
|
236
94
|
|
|
237
95
|
async function main() {
|
|
238
|
-
const platform = process.platform;
|
|
239
96
|
const command = process.argv[2];
|
|
240
97
|
if (command && !command.startsWith("-")) {
|
|
241
98
|
if (await runHeadless(command)) return;
|
|
242
99
|
throw new Error(`Unknown command "${command}". Run ai-wrapped --help.`);
|
|
243
100
|
}
|
|
244
|
-
const arch = process.arch;
|
|
245
101
|
|
|
246
102
|
console.log("");
|
|
247
103
|
console.log(" \x1b[1mAI Wrapped\x1b[0m");
|
|
248
104
|
console.log(" Your year in AI\n");
|
|
249
105
|
|
|
250
|
-
// --help
|
|
251
106
|
if (process.argv.includes("--help") || process.argv.includes("-h")) {
|
|
252
107
|
console.log(" Usage: ai-wrapped [command] [options]\n");
|
|
253
108
|
console.log(" Commands:");
|
|
254
|
-
console.log(" (none) Open the
|
|
109
|
+
console.log(" (none) Open your wrapped in the browser (runs locally)");
|
|
110
|
+
console.log(" [--no-open] Only print the link");
|
|
255
111
|
console.log(" stats [--range R] Print a JSON summary (R: 2026, last7, last30, last90, last365)");
|
|
256
112
|
console.log(" [--out file] Also write the full wrapped data to a file");
|
|
257
|
-
console.log("
|
|
113
|
+
console.log(" view [--range R] [--notes file|-] [--no-open]");
|
|
114
|
+
console.log(" Open a private link with your agent's notes (nothing is uploaded)");
|
|
115
|
+
console.log(" share [--range R] [--notes file|-] [--author name] [--show-repos|--no-repos] [--dry-run]");
|
|
258
116
|
console.log(" Publish a share link, optionally with your agent's notes");
|
|
259
117
|
console.log(" skill [install] Print or install the agent skill (SKILL.md)");
|
|
260
|
-
console.log(" Common: --no-scan (use cached stats), --
|
|
118
|
+
console.log(" Common: --no-scan (use cached stats), --show-repos (show repository names; hidden by default), --no-repos (leave repositories out)\n");
|
|
261
119
|
console.log(" Options:");
|
|
262
120
|
console.log(" --version, -v Show installed version");
|
|
263
|
-
console.log(" --
|
|
264
|
-
console.log(" --uninstall Remove cached app");
|
|
121
|
+
console.log(" --uninstall Remove saved stats and settings (~/.ai-wrapped)");
|
|
265
122
|
console.log(" --help, -h Show this help");
|
|
266
123
|
return;
|
|
267
124
|
}
|
|
268
125
|
|
|
269
|
-
// --version
|
|
270
126
|
if (process.argv.includes("--version") || process.argv.includes("-v")) {
|
|
271
|
-
|
|
272
|
-
const pkgVersion = await getPackageVersion();
|
|
273
|
-
console.log(` Package: v${pkgVersion}`);
|
|
274
|
-
console.log(
|
|
275
|
-
cached
|
|
276
|
-
? ` Installed: v${cached.version} (${cached.platform}/${cached.arch})`
|
|
277
|
-
: " Not built yet",
|
|
278
|
-
);
|
|
127
|
+
console.log(` v${await getPackageVersion()}`);
|
|
279
128
|
return;
|
|
280
129
|
}
|
|
281
130
|
|
|
282
|
-
// --uninstall
|
|
283
131
|
if (process.argv.includes("--uninstall")) {
|
|
284
132
|
console.log(" Removing ~/.ai-wrapped...");
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
} else {
|
|
288
|
-
await Bun.$`rm -rf ${HOME}/.ai-wrapped`.quiet();
|
|
289
|
-
}
|
|
133
|
+
const { rm } = await import("node:fs/promises");
|
|
134
|
+
await rm(join(HOME, ".ai-wrapped"), { recursive: true, force: true });
|
|
290
135
|
console.log(" Done.");
|
|
291
136
|
return;
|
|
292
137
|
}
|
|
293
138
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
const pkgVersion = await getPackageVersion();
|
|
298
|
-
const cached = await readCachedBuild();
|
|
299
|
-
const platformLabel =
|
|
300
|
-
platform === "darwin" ? "macos" : platform === "win32" ? "win" : "linux";
|
|
301
|
-
const needsBuild =
|
|
302
|
-
forceRebuild ||
|
|
303
|
-
!cached ||
|
|
304
|
-
cached.version !== pkgVersion ||
|
|
305
|
-
cached.platform !== platformLabel ||
|
|
306
|
-
cached.arch !== arch;
|
|
307
|
-
|
|
308
|
-
if (needsBuild) {
|
|
309
|
-
if (cached && !forceRebuild) {
|
|
310
|
-
console.log(
|
|
311
|
-
` Upgrading v${cached.version} \u2192 v${pkgVersion}`,
|
|
312
|
-
);
|
|
313
|
-
} else if (!forceRebuild) {
|
|
314
|
-
console.log(` First run — building v${pkgVersion}...`);
|
|
315
|
-
} else {
|
|
316
|
-
console.log(` Rebuilding v${pkgVersion}...`);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
const builtPath = await buildApp();
|
|
320
|
-
await installToCache(builtPath);
|
|
321
|
-
|
|
322
|
-
// Write version cache
|
|
323
|
-
await Bun.write(
|
|
324
|
-
VERSION_FILE,
|
|
325
|
-
JSON.stringify(
|
|
326
|
-
{
|
|
327
|
-
version: pkgVersion,
|
|
328
|
-
platform: platformLabel,
|
|
329
|
-
arch,
|
|
330
|
-
builtAt: new Date().toISOString(),
|
|
331
|
-
},
|
|
332
|
-
null,
|
|
333
|
-
2,
|
|
334
|
-
),
|
|
335
|
-
);
|
|
336
|
-
|
|
337
|
-
console.log(`\n Built and cached v${pkgVersion}\n`);
|
|
338
|
-
} else {
|
|
339
|
-
console.log(` v${pkgVersion} ready\n`);
|
|
340
|
-
}
|
|
139
|
+
// The desktop app from older versions is no longer used.
|
|
140
|
+
const { rm } = await import("node:fs/promises");
|
|
141
|
+
await rm(LEGACY_APP_DIR, { recursive: true, force: true }).catch(() => undefined);
|
|
341
142
|
|
|
342
|
-
await
|
|
143
|
+
const { runLocal } = await import("../src/bun/local");
|
|
144
|
+
await runLocal({ appDir: APP_DIR, open: !has("no-open"), scan: !has("no-scan") });
|
|
343
145
|
}
|
|
344
146
|
|
|
345
147
|
main().catch((err) => {
|
|
Binary file
|