@eyeauras/cli-factory

中文文档
0.7.1发布于 2026/11/08MITTypeScriptES Module近 30 天下载 3594

Reusable primitives for consistent, AI-friendly TypeScript CLIs.

原始使用文档

AI CLI Factory Core

Shared TypeScript/Node.js primitives for consistent command-line tools used by humans and AI agents. Requires Node.js 22 or newer. Licensed under MIT.

Core supplies recursive commands and help, human/JSON output, persistent JSON-RPC, profile isolation, platform-protected credentials, permission gates and resource disposal. Service vocabulary and HTTP/browser behavior belong to integrations.

import { command, createCli } from "@eyeauras/cli-factory";

const app = createCli({
  name: "example-cli",
  description: "A small example CLI",
  commands: [command("echo <text>", "Return text", ({ args }) => ({ text: args.text }))],
});
try {
  process.exitCode = await app.run();
} finally {
  await app.dispose();
}

The default export surface is the runtime. Separate @eyeauras/cli-factory/testing and @eyeauras/cli-factory/proof entries provide offline fixtures and bounded, explicit local integration-proof helpers. IPC and Playwright are optional modules; Core imports neither.

Handlers can return streamResult(async function* (signal) { ... }) for a finite sequence. Acquire resources and create signal-bound clients inside the producer, pass its signal to pending work and clean up in finally. Ordinary CLI --json writes each item as NDJSON with backpressure; human output, execute and JSON-RPC receive an array. Streaming failures leave emitted lines on stdout and report errors and failed-result metadata on stderr. Ordinary result output is unchanged.

Standalone secrets use PlatformSecretStore with no plaintext fallback: Windows DPAPI CurrentUser encrypted files under each profile's AppData secrets/ directory, macOS Keychain, or Linux system keyring. Help does not need a configured service or stored credentials. Windows Credential Manager is no longer used. Sign in again per CLI/profile and reimport auxiliary secrets; existing profiles, permissions and old Credential Manager entries are retained.

See the integration authoring guide, canonical design, and release guide.

版本与发布记录

@eyeauras/cli-factory 共发布 19 个版本,首次发布于 2026/09/09;过去 12 个月发布了 19 个版本。

版本发布日期距今
0.7.1latest2026/11/085 天前
0.7.02026/11/086 天前
0.6.12026/11/076 天前
0.6.02026/11/077 天前
0.5.72026/11/077 天前
0.5.62026/11/0211 天前

关于 @eyeauras/cli-factory 的常见问题

@eyeauras/cli-factory 是什么?

Reusable primitives for consistent, AI-friendly TypeScript CLIs.

如何安装 @eyeauras/cli-factory?

在项目目录运行 npm install @eyeauras/cli-factory,或使用 pnpm add / yarn add / bun add。

@eyeauras/cli-factory 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@eyeauras/cli-factory 支持 ESM 还是 CommonJS?

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

@eyeauras/cli-factory 需要什么版本的 Node.js?

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

@eyeauras/cli-factory 可以商用吗?

@eyeauras/cli-factory 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@eyeauras/cli-factory 的下载量有多少?

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

@eyeauras/cli-factory 还在维护吗?

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