@ascenda-one/gemini-hooks

中文文档
0.1.41发布于 2026/11/02Apache-2.0ES Module零依赖构建来源已验证近 30 天下载 2360

Gemini CLI hooks adapter for Ascenda AI workload telemetry

原始使用文档
文档目录5 节
  1. Install
  2. Configure
  3. Privacy defaults
  4. Event mapping
  5. Test locally

@ascenda-one/gemini-hooks

Gemini CLI agent hooks adapter for Ascenda AI workload telemetry. Metadata only — prompt text, file contents and command output never leave the machine.

Install

npx @ascenda-one/gemini-hooks setup

This pairs (printing a 6-digit code to confirm in the Ascenda app), installs a self-contained hook bundle to ~/.ascenda/bin, records the pairing under tools.gemini_cli in ~/.ascenda/credentials.json, and registers the hooks in this project's .gemini/settings.json. Restart Gemini CLI and events flow — no shell exports, no settings file to hand-edit. That matters more than it sounds: a GUI-launched editor never sees a shell rc file, so an id that lives only in an export line silently stops telemetry the next time the app is opened from the Dock.

npx @ascenda-one/gemini-hooks status      # exits non-zero if anything is unwired
npx @ascenda-one/gemini-hooks doctor      # can the hooks run, has one run, and does the screen saver hear them
npx @ascenda-one/gemini-hooks uninstall   # removes hooks, the binary and this pairing
Option
--api-base-url <url>ingest host (default https://api.ascenda.one)
--local [port]shorthand for a local dev server (default 4477)
--tool-installation-id <id> / --token <t>reuse an existing pairing instead of creating one
--scope user|projectregister in ~/.gemini/settings.json for every project (default), or in this project only
--project-dir <path>project root for --scope project (default cwd)
--no-pairinstall without pairing: the screen saver and live view work, nothing is sent
--dry-runprint what would change, write nothing

examples/ holds the equivalent hand-written config for anyone who would rather not run setup.

Configure

Nothing is required after setup. A hook resolves its identity from, in order: the environment, its own entry in ~/.ascenda/credentials.json, and — when exactly one cli_agent token is on disk — the token store. A hook that still cannot name its installation records the skipped send in the journal status reads, rather than exiting silently.

Variable
ASCENDA_TOOL_INSTALLATION_IDoverrides the pairing setup recorded
ASCENDA_EVENT_WRITE_TOKENoverrides the stored token
ASCENDA_API_BASE_URLoverrides the ingest host
ASCENDA_EVENT_LOG_FILElocal JSONL log of every event, or off

Without a pairing, every event is written to ~/.ascenda/events.jsonl as not_sent, so you can see exactly what would be transmitted, or read the events with your own tools, without connecting anything. examples/local-event-reader shows how. setup --event-log <path> moves the file, setup --event-log off stops it, and the variable wins over both. Every payload carries the UTC offset and an idempotency key; both come from the shared sender in tool-kit, so this adapter holds only its mapping.

Privacy defaults

Metadata-only. Does not send prompts, responses, code, file paths, command text, repository names or branch names. Correction detection runs locally on prompt text; only the classification is transmitted.

setup prints the full list before it pairs — every family this adapter sends, the refusals, and how to turn it off. That block is generated from the adapter's own declaration in src/setup.ts, and a guard test (packages/tool-kit/tests/setupDisclosure.test.mjs) runs the mapper and fails the build when the declaration claims a family the mapper does not send, or omits one it does.

Event mapping

See docs/GEMINI_MAPPING.md.

BeforeModel/AfterModel are deliberately unregistered: they fire per LLM round trip and would multiply event volume. See the mapping doc.

Test locally

No Gemini CLI install required:

./scripts/replay-agent-hooks.sh gemini

Hook invocations always exit 0: telemetry must never block your work.

版本与发布记录

@ascenda-one/gemini-hooks 共发布 22 个版本,首次发布于 2026/09/04;过去 12 个月发布了 22 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.41latest2026/11/025 天前
0.1.402026/10/1919 天前
0.1.392026/10/1523 天前
0.1.382026/10/1523 天前
0.1.372026/10/1523 天前
0.1.362026/10/1424 天前

关于 @ascenda-one/gemini-hooks 的常见问题

@ascenda-one/gemini-hooks 是什么?

Gemini CLI hooks adapter for Ascenda AI workload telemetry

如何安装 @ascenda-one/gemini-hooks?

在项目目录运行 npm install @ascenda-one/gemini-hooks,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 ascenda-gemini-hook,可以用 npx ascenda-gemini-hook 直接运行。

@ascenda-one/gemini-hooks 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/ascenda-one__gemini-hooks 是否存在。

@ascenda-one/gemini-hooks 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@ascenda-one/gemini-hooks 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ascenda-one/gemini-hooks 可以商用吗?

@ascenda-one/gemini-hooks 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@ascenda-one/gemini-hooks 的下载量有多少?

根据 npm 官方下载统计,@ascenda-one/gemini-hooks 在 2026/10/07 – 2026/11/05 这 30 天内被下载 2,360 次,日均约 79 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ascenda-one/gemini-hooks 还在维护吗?

最新版本 0.1.41 发布于 2026/11/02(5 天前);至今共发布 22 个版本,其中过去 12 个月发布了 22 个;首次发布于 2026/09/04。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。