大家好!今天来交一个拖欠了两个月的作业。
先说成果:掘金 AI 用量统计的 Tauri 版,独立维护,刚发了几版,macOS 安装包 33MB,功能对齐官方 Electron 版——订阅额度、桌面宠物、菜单栏用量这些都有。
这事儿要从一封没被合并的 PR 说起。
一、起因:PR #138
用掘金 AI 用量统计的兄弟们都知道,这工具是真的香——Claude Code、Codex、Cursor 这些 AI 工具烧了多少 Token,本地全记着,还能上排行榜看谁用得最凶(谁加班最多)。
唯一的"但是":官方桌面端是 Electron 的。我自己平时写 Rust,属于"看到 100MB 安装包就想手痒"的那种人,于是 9 月份我给官方提了个 PR:feat: add Tauri desktop app。
结果呢?没合并。
先说清楚:官方的决定我也理解,后续维护会有成本,技术栈不同。 桌面端是多端共享的产品,为了一个社区贡献再养一套 UI 框架,构建、测试、维护全是双倍成本,谁接谁头疼。换成我是维护者,我大概率也是先说 "谢谢,再看看"。
但 Tauri 版做都做了。怎么办?自己养呗。没事抽时间养养,最近迷恋 Rust... 也有可能遇到坑,填不动...全当玩就行了,感兴趣的可以一起过来玩。
二、这个项目最讨巧的地方:数据层一根手指都没碰
做桌面版之前我想明白了一件事:这个项目最难的 80% 不是窗口和按钮,是数据层——三十多个 AI 工具,每家的用量数据藏的位置和格式都不一样,官方光是解析器就维护了一大堆,还隔三差五因为工具更新跟着修。
这种东西我重写一遍?疯了吧。
所以我的架构就一句话:官方 core 原样包进来当引擎,Tauri 只做壳。
这么干的好处立竿见影:官方这段时间新增了 6 个数据源(Deveco、TeleAgent、WPS Comate……),我这边合并一下上游,一个解析器都没写,功能自动跟上。官方修 bug,我白嫖修复。这买卖太划算了。
代价也要诚实说:为了跑官方 core(它是 Node 的),我的安装包里内嵌了一个 Node 运行时。所以我的 Rust 壳其实只有 10MB,剩下的大头是 Node。
三、体积这口饭是怎么一口口咽下去的
初始版本 44MB。这次 v0.3.0 磨到了 33MB,过程挺有意思:
- 先扫目录:把打包产物摊开一看,好家伙,hono 的 TypeScript 类型声明(.d.ts,运行时根本不读)、CJS 重复构建、yaml 的 browser 版本……全被打进去了,先剥掉一层
- 再查大头:内嵌的 node 二进制 110MB,其中 30MB 是全量 ICU 多语言库——一个跑在本机、只处理日期格式的 sidecar,配全套世界语言纯属浪费
- 换成 small-icu 的 node(只带英语 locale):但直接换有坑——代码里有 4 处日期格式化用的 en-CA/en-GB locale,小 ICU 下格式会变,日期一变数据分桶就乱了。幸运的是检查后发现这 4 处全都用的 formatToParts 写法(按字段取值再自己拼),天生跟 locale 无关,换完直接过
- 最后跑对照实验:同一个日期、同一个时区,官方 node 和 small-icu node 输出逐字节一致;再跑 516 个测试用例,两边结果一模一样。稳了。
现在的体积构成:Node 运行时 81MB(压缩后大头)、Rust 壳 10MB、其余是官方 core 和面板。官方 Electron 版安装包一般 100MB 起步——我们大概是三分之一。
剩余的路线也排好了:下一步用 Rust 重写本地 API 和存储层(0.4.x),再逐步把解析器迁过去,全 Rust 化的时候就是 1.0,到时候安装包目标 15MB 以内。
四、现在都有什么功能
- 📊 完整面板:跟官方同一套 dashboard(数据层是同一个包,所见即所得)
- 💳 订阅额度卡:Claude / Codex / Cursor / Grok / Kimi / Qoder 等 12 个渠道的剩余额度,直接在面板看
- 🐱 桌面宠物:三只内置 + 社区宠物目录在线下载,会跑会跳,同步完还会冒气泡报 Token 增量
- 📈 macOS 菜单栏实时用量:今日 Token 和费用常驻菜单栏
- 🔗 掘金登录深链:浏览器登录完自动跳回应用
- 🔄 自动更新:带签名校验,新版本推送后应用内直接升级
- ⚙️ 开机自启、静默启动、主题跟随系统、托盘常驻……该有的都有
五、怎么用
- 下载:github.com/you-want/ju…
- macOS:下载对应芯片的 .dmg,拖进应用程序。首次打开会被拦一下(没买苹果的签名服务,$99/年,社区版先不花这个钱),终端跑一句就能放行, 或者系统设置里边打开就行:
sudo xattr -dr com.apple.quarantine /Applications/Juejin\ Usage.app
- Windows:下载 -setup.exe,SmartScreen 弹窗点"更多信息 → 仍要运行"
- 数据和官方版完全互通(同一套数据目录、同一套云同步协议),换着用无缝
六、写在最后
再次感谢 juejin-cn/juejin-usage 的维护者们——@ATQQ 和各位贡献者。数据底座是人家一砖一瓦垒起来的,我这个项目本质上就是"在别人打好地基的楼上盖了个 Rust 装修",每次合并上游都在白嫖人家的劳动成果,心里是很感激的。
两个项目是互补关系:官方 Electron 版继续深耕,Tauri 社区版服务喜欢轻量客户端的同学,并且长期跟进上游。以后如果官方对 Rust 数据层有兴趣,我攒的这些东西随时可以带回去。
本文由 AI图鉴自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
Hello! I'm here today to pay a two-month overdue assignment.
First results: Gold dig AI volume Tauri version, stand-alone maintenance, just release several editions, MacOS installation package 33MB, functional alignment of official Electron version - subscriptions to quota, desktop pets, menu bars.
It starts with a PR that wasn't merged.
Causes: PR #138
As our brothers in gold mining I.A. do know, the tool is real fragrance - Claude Code, Codex, Cursor, how many of these AI tools have burned Token, and it's all up there to see who uses the most (who works most overtime).
The only "but": the official desktop end is Electron. I wrote Rust myself, the kind of guy who wanted to tickle when he saw the 100MB kit, so I brought him up in September.
And? No merger.
Let's be clear: I understand that there are costs to follow-up maintenance and that there are different technologies. The desktop end is a multi-end shared product, with an additional UI framework for the contribution of a community, with double costs for construction, testing, maintenance and who gets headaches. If I were a maintainer, I'd probably say, "Thank you, look."
But Tauri did everything. What do we do? Take care of yourself. It's okay to take time to raise Rust, and it's possible to have a pit, fill it up... and play it all.
II. The best place for this project: not a single finger in the data layer
One thing I thought about before doing the desktop version: the hardest thing about this project is that 80% is not windows and buttons, it's data layers -- more than 30 AI tools, different locations and formats for each household's quantitative data collection. Official solvers alone maintain a lot of them, and it's five different times because tools are updated.
I'll rewrite this thing. Crazy.
So my structure is just one thing: official core is wrapped in as an engine, Tauri is just a shell.
The benefits of this work are immediate: six new data sources (Deveco, TeleAgent, WPS Company...) have been added in the official period, and I'm going to merge up here, without a solver, and automatically follow. Official repair bug, I free access repair. It's too much.
The price must also be honest: to run the official core, my installation bag has a Node running time. So my Rust shell is actually only 10MB, and the rest is Node.
Three: How did you swallow this meal?
Initial 44MB. This time v. 0.3.0 grinded 33MB, which is interesting:
-Sweep the catalogue first: put the wrapping on the side, good guy, topScript type statement (.d.ts, running without reading), CJS repeated construction, yaml's browser version... it's all in, strip off one layer first.
- Check the head again: embedded Node binary 110MB, of which 30MB is full of ICU multilingual libraries - a sidecar running on the machine, processing date only, full world language is a waste.
- Node (English only) for small-icu: but there's a pit - there's 4 places in the code for the date format en-CA/en-GB locale, the format changes under the ICU, and the date changes the data sub-breath. Fortunately, it turns out that formatToParts are all used in four places.
- Final running contrast experiment: same date, same time zone, same official node and small-icu node output on Z113Z; running 516 additional test examples with identical results. Steady.
The current volume composition: Node runs 81MB (a condensed big head), Rust shell 10MB, and the rest is official core and panel. The official Electron setup package is 100MB starting -- we're about a third.
The remaining route is also set: next step rewrites the local API and storage reservoirs (0.4.x) with Rust, and then gradually removes the decryptator, which will be 1.0 for all Rust, and then install the package within target 15MB.
What are the functions now?
- Full panel: the same dashboard as the official.
- Subscription to quota cards: Claude / Codex / Cursor / Grok / Kimi / Qoder, etc., with the remaining quota from 12 channels directly on the panel Look.
- Desktop pets: three built-in + community pet directories download online, run, jump, synchronize and flaunt Token 's increase
- Real-time usage of the macOS menu bar: Today Token and the fee resident menu Column
Deep chain of gold login: Auto-jump response for browser login
Auto-updating: signature verification, direct upgrade in new post-referral application
- On-board, silent start-up, theme following system, tray permanent... Everything.
V. HOW TO USE IT
- Download: Github.com/you-want/ju...
- MacOS: Download the.dmg of the corresponding chip, drag into the application. First-time opening will be blocked (no apple signature service, 99/year, community version without the money), and the terminal will be released with one run, or the system settings will open:
sudo xattr -dr com.apple.quarantine /Applications/Juejin\ Usage.app
- Windows: Download -setup.exe, SmartScreen.
- Full interconnectivity of data and official editions (same data catalogue, same cloud synchronisation protocol) in exchange for seamlessness
VI. At the end
Thanks again to the defenders of juejin-cn/juejin-usage @ATQQ and your contributors. The data base was built on a brick-and-barrel basis, and I'm really grateful for the fact that I put a Rust renovation on top of someone else's foundation, and I've been working with the free access family every time I merge.
The two projects are complementary: the official Electron version continues to grow deep, and the Tauri community service likes its students with light clients and follows up upstream. If the official interest in Rust Data Levels comes later, I can bring these things back.
Auto-fetched and translated by AI Atlas. All rights belong to the original author.