ai-wrapped 1.11.0 → 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 +12 -24
- package/bin/cli.ts +17 -233
- package/dist/apple-touch-icon.png +0 -0
- package/dist/assets/{BotAvatar-B1afqxjz.js → BotAvatar-DQljNXqE.js} +1 -1
- package/dist/assets/{CrystalizedBall-fdPnFP5O.js → CrystalizedBall-D-HRqF-i.js} +1 -1
- package/dist/assets/{EchoText-CySFjm8w.js → EchoText-Bh5B8jwf.js} +1 -1
- package/dist/assets/{GlowCursor-C0jBh3OU.js → GlowCursor-CweToSjn.js} +1 -1
- package/dist/assets/{Heatwave-CjFyQGbM.js → Heatwave-D03UY60G.js} +1 -1
- package/dist/assets/{LightTunnel-DWAZftvN.js → LightTunnel-DOgB67JQ.js} +1 -1
- package/dist/assets/{LineSpiral-CnfM5ley.js → LineSpiral-HyanwOhc.js} +1 -1
- package/dist/assets/{SideRays-BFkjst89.js → SideRays-BZkj7mcv.js} +1 -1
- package/dist/assets/{SlicedWaves-Dpkt-Vaj.js → SlicedWaves-BU2SNcWc.js} +1 -1
- package/dist/assets/{SplitFlapText-Cpb9Vcdu.js → SplitFlapText-B77SP2Jd.js} +1 -1
- package/dist/assets/{Strands-C-50OkYn.js → Strands-B0LJQ-ls.js} +1 -1
- package/dist/assets/{TechText-C7Id1PJM.js → TechText-rLlgoD-6.js} +1 -1
- 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 +6 -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 +1 -1
- package/src/bun/local.ts +156 -0
- package/src/bun/share.ts +0 -30
- package/src/shared/types.ts +1 -70
- package/tsconfig.json +1 -1
- package/dist/assets/index-BiLDfPwS.js +0 -161
- package/dist/assets/index-CyB7FOHv.css +0 -1
- 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
|
|
|
@@ -44,7 +44,6 @@ Built on top of [agent-sessions](https://github.com/jazzyalex/agent-sessions) se
|
|
|
44
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
|
|
|
@@ -76,17 +75,17 @@ Notes are `{ "author": "Codex (gpt-6)", "stories": { "intro": { "title": "…",
|
|
|
76
75
|
## Stack
|
|
77
76
|
|
|
78
77
|
- **Runtime**: [Bun](https://bun.sh)
|
|
79
|
-
- **
|
|
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.
|
|
80
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).
|
|
81
|
-
- **Build**: Vite (
|
|
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 => {
|
|
@@ -206,12 +52,8 @@ async function runHeadless(command: string): Promise<boolean> {
|
|
|
206
52
|
const url = headless.privateLink(withNotes);
|
|
207
53
|
console.log(url);
|
|
208
54
|
if (!has("no-open")) {
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
Bun.spawn([opener, url], { stdout: "ignore", stderr: "ignore" });
|
|
212
|
-
} catch {
|
|
213
|
-
// No browser here; the link is printed above.
|
|
214
|
-
}
|
|
55
|
+
const { openInBrowser } = await import("../src/bun/local");
|
|
56
|
+
openInBrowser(url);
|
|
215
57
|
}
|
|
216
58
|
return true;
|
|
217
59
|
}
|
|
@@ -251,113 +93,55 @@ async function runHeadless(command: string): Promise<boolean> {
|
|
|
251
93
|
}
|
|
252
94
|
|
|
253
95
|
async function main() {
|
|
254
|
-
const platform = process.platform;
|
|
255
96
|
const command = process.argv[2];
|
|
256
97
|
if (command && !command.startsWith("-")) {
|
|
257
98
|
if (await runHeadless(command)) return;
|
|
258
99
|
throw new Error(`Unknown command "${command}". Run ai-wrapped --help.`);
|
|
259
100
|
}
|
|
260
|
-
const arch = process.arch;
|
|
261
101
|
|
|
262
102
|
console.log("");
|
|
263
103
|
console.log(" \x1b[1mAI Wrapped\x1b[0m");
|
|
264
104
|
console.log(" Your year in AI\n");
|
|
265
105
|
|
|
266
|
-
// --help
|
|
267
106
|
if (process.argv.includes("--help") || process.argv.includes("-h")) {
|
|
268
107
|
console.log(" Usage: ai-wrapped [command] [options]\n");
|
|
269
108
|
console.log(" Commands:");
|
|
270
|
-
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");
|
|
271
111
|
console.log(" stats [--range R] Print a JSON summary (R: 2026, last7, last30, last90, last365)");
|
|
272
112
|
console.log(" [--out file] Also write the full wrapped data to a file");
|
|
273
113
|
console.log(" view [--range R] [--notes file|-] [--no-open]");
|
|
274
|
-
console.log(" Open your
|
|
114
|
+
console.log(" Open a private link with your agent's notes (nothing is uploaded)");
|
|
275
115
|
console.log(" share [--range R] [--notes file|-] [--author name] [--show-repos|--no-repos] [--dry-run]");
|
|
276
116
|
console.log(" Publish a share link, optionally with your agent's notes");
|
|
277
117
|
console.log(" skill [install] Print or install the agent skill (SKILL.md)");
|
|
278
118
|
console.log(" Common: --no-scan (use cached stats), --show-repos (show repository names; hidden by default), --no-repos (leave repositories out)\n");
|
|
279
119
|
console.log(" Options:");
|
|
280
120
|
console.log(" --version, -v Show installed version");
|
|
281
|
-
console.log(" --
|
|
282
|
-
console.log(" --uninstall Remove cached app");
|
|
121
|
+
console.log(" --uninstall Remove saved stats and settings (~/.ai-wrapped)");
|
|
283
122
|
console.log(" --help, -h Show this help");
|
|
284
123
|
return;
|
|
285
124
|
}
|
|
286
125
|
|
|
287
|
-
// --version
|
|
288
126
|
if (process.argv.includes("--version") || process.argv.includes("-v")) {
|
|
289
|
-
|
|
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
|
-
);
|
|
127
|
+
console.log(` v${await getPackageVersion()}`);
|
|
297
128
|
return;
|
|
298
129
|
}
|
|
299
130
|
|
|
300
|
-
// --uninstall
|
|
301
131
|
if (process.argv.includes("--uninstall")) {
|
|
302
132
|
console.log(" Removing ~/.ai-wrapped...");
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
} else {
|
|
306
|
-
await Bun.$`rm -rf ${HOME}/.ai-wrapped`.quiet();
|
|
307
|
-
}
|
|
133
|
+
const { rm } = await import("node:fs/promises");
|
|
134
|
+
await rm(join(HOME, ".ai-wrapped"), { recursive: true, force: true });
|
|
308
135
|
console.log(" Done.");
|
|
309
136
|
return;
|
|
310
137
|
}
|
|
311
138
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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
|
-
}
|
|
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);
|
|
359
142
|
|
|
360
|
-
await
|
|
143
|
+
const { runLocal } = await import("../src/bun/local");
|
|
144
|
+
await runLocal({ appDir: APP_DIR, open: !has("no-open"), scan: !has("no-scan") });
|
|
361
145
|
}
|
|
362
146
|
|
|
363
147
|
main().catch((err) => {
|
|
Binary file
|