npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ai-coding-agent-darwin-x64

v0.3.34

Published

AI Coding Agent binary for darwin-x64

Readme

AI Coding Agent

跨平台 Go 客户端,在 Git post-commit、post-merge、pre-push 阶段采集提交、Git AI、AI 工具和系统元数据,并向编译内置的 git-ai-server 异步上报。

npm 自动安装

正式发布后,用户只需:

npm install -g @soulock/ai-coding-agent

npm 会下载当前操作系统和 CPU 对应的 Go 二进制,并在 postinstall 阶段自动运行 ai-coding-agent install。如果 npm 使用了 --ignore-scripts,需再手动执行一次 ai-coding-agent install。

执行 npm uninstall -g @soulock/ai-coding-agent 时会自动移除 Agent 自己安装的 Hook、配置和数据,并恢复安装前的 core.hooksPath。

发布者先生成六个平台包:

npm run build:npm

在源码仓库中测试自动安装时,也应先执行上述构建命令,再运行 npm run postinstall。本地测试会从 npm/platforms 选择当前平台的二进制。

然后先发布 npm/platforms/* 下的平台包,最后发布根目录主包。所有包版本必须一致。

源码使用

go build -o ai-coding-agent ./cmd/agent
./ai-coding-agent install
./ai-coding-agent status
./ai-coding-agent event commit   # Hook 使用:只写本地事件并唤醒 daemon
./ai-coding-agent event pull
./ai-coding-agent event push
./ai-coding-agent collect commit # 兼容旧 Hook,同样只写事件
./ai-coding-agent daemon --once  # 执行一轮后台维护后退出
./ai-coding-agent uninstall

安装成功后客户端会自动启动一个单实例 daemon。Git Hook 只把事件原子写入 data/events/,记录当时的仓库根目录和 commit SHA,然后唤醒 daemon;Hook 内不执行依赖安装、数据采集或网络请求。daemon 按事件文件顺序执行采集,失败事件保留且不会被后续事件越过;损坏事件移入 data/events/dead-letter/。

daemon 每 5 分钟重放上传队列、增量同步 sessions 和 client.log,并在最后检查客户端更新;新 Hook 事件会立即唤醒它,无需等待周期。每次 Hook 也会检查 daemon 原生进程锁,未运行时自动拉起。更新成功后旧进程释放单实例锁,再启动更新后的 daemon。daemon 异常退出时内核会立即释放锁,不会阻断 Git 提交;下一次 Hook、安装流程或手工执行 ai-coding-agent daemon 会恢复维护。

自动更新先校验 SHA-256 并备份当前版本。Windows 因运行中的 .exe 不能覆盖自身,会启动位于暂存目录的独立 updater,等待旧 daemon 退出后替换并拉起新版;macOS 的原子替换失败时也使用同一兜底。替换失败会恢复备份并保留暂存文件,后续 Hook/daemon 自动重试,无需重新安装。

配置中的 endpoint 键已废弃并被忽略(服务器地址编译在二进制中,当前为 http://192.168.110.120:8080,改地址需修改代码重新发版);config.yaml 只保存身份与超时(Windows 为 %LOCALAPPDATA%\\ai-coding-agent\\config.yaml)。上报失败的数据会保存到 data/queue,下次采集时重放;详见下文「上报」。

构建目标示例:

GOOS=darwin GOARCH=arm64 go build -o dist/ai-coding-agent-darwin-arm64 ./cmd/agent
GOOS=windows GOARCH=amd64 go build -o dist/ai-coding-agent-windows-amd64.exe ./cmd/agent
GOOS=linux GOARCH=arm64 go build -o dist/ai-coding-agent-linux-arm64 ./cmd/agent

Hook 只负责调用 Agent 写入本地事件;所有采集和 HTTP 逻辑均由后台 daemon 执行。

Git 数据包含 repository_url。HTTPS/SSH 地址会移除用户名、密码、Token、查询参数和 fragment 后再上报;本地仓库磁盘路径不会上传。

post-commit、post-merge、pre-push 都使用 Git 自带的 POSIX shell 执行,兼容 macOS、Linux 和 Windows Git for Windows。Windows 安装路径会转换为 Git Bash 的 /c/... 格式;Hook 使用 LF 换行,同步完成一次轻量事件落盘后立即返回,并始终忽略 Agent 错误,确保不影响 Git 操作。

上报

post-commit / post-merge / pre-push 钩子触发 ai-coding-agent event <type> 写入事件,daemon 消费事件后向 git-ai-server 上报:

| 端点 | 触发 | 内容 | |---|---|---| | POST /api/v1/commits/stats | commit | 本次 commit 的 AI 归属统计(sha/时间/工具×模型) | | POST /api/v1/tools/env | 全部 | 本机 AI 工具安装/配置状态(全量替换) | | POST /api/v1/tools/keys | 全部 | 各工具 API key 状态(打码前缀,完整 key 不上报) | | POST /api/v1/usage | 全部 | 当日 usage 快照(--period <当日>,服务器按 (日期,用户,项目) 覆盖)内嵌 git-ai 不支持日期窗口时自动回退 --period 1d(usage_date 仍为当日);升级内嵌二进制后自动启用日期窗口。 | | POST /api/v1/skills | 全部 | 技能使用统计(npx skillusage,每次触发 -d 1、首次 -d 30 回填;按日×技能覆盖写入,raw 完整留档) |

  • 服务器地址编译在二进制中(当前 http://192.168.110.120:8080),改地址需重新发版
  • 身份:author = team_name + "-" + git user.name;team_id/team_name 在 ~/.ai-coding-agent/config.yaml 配置(未配置则跳过上报)
  • git config user.name 必须是 团队-姓名 格式(如 运维-张三),install 会校验并阻断不符合的安装
  • 失败自动入队(data/queue/),下次触发时重放;日志见 logs/client.log(1MB×3 轮转)