@azrico/azcli

中文文档
1.3.22发布于 2026/11/07MITCommonJS近 30 天下载 7576

Project build, publishing, dependency, and AI transcript helpers

原始使用文档
文档目录4 节
  1. Commands
  2. Browser checks
  3. Transcript options
  4. Source layout

az-cli

Helpers for building, cleaning, updating, and publishing projects, plus exporting and analysing AI session transcripts.

Requires Node.js 20 or newer. Yarn 4.6.0 is pinned in package.json and included in .yarn/releases.

node .yarn/releases/yarn-4.6.0.cjs install --immutable
node .yarn/releases/yarn-4.6.0.cjs typecheck
node .yarn/releases/yarn-4.6.0.cjs test
node .yarn/releases/yarn-4.6.0.cjs build
node dist/cli/index.js --help

With Yarn available on PATH, the equivalent commands are yarn install --immutable, yarn typecheck, yarn test, and yarn build.

yarn build-dev compiles the CLI and copies optional assets from temp/ into dist/. yarn start watches source and asset changes. Builds use TypeScript directly and preserve source maps.

Commands

CommandBehavior
build [mode]Build an inferred project, or select php, yarn, python, or docker. Docker builds also start Compose services.
clean buildRemove build/ and dist/ in the selected project.
clean allAlso remove dependencies, caches, and lockfiles.
up [target..]Update dependencies; Yarn targets may be omitted or repeated.
publishPublish a Yarn or Python package. Yarn packages are built first.
package prepareGenerate the workspace's core package before building.
package finalizeGenerate publishable manifests in dist/, build/, or temp/.
package publishPublish the prepared packages.
package goPrepare, build, finalize, then publish; stop on the first failure.
transcripts <claude|codex>Export sessions to Markdown with an index.json.
optimize-transcripts [analyser] [source] [last-chats]Alias optimize. Prepare a transcript snapshot of source (default: the analyser) and run the analyser agent (claude or codex, default claude) on it. last-chats is the same as --last; --analyser-model (--model) picks the analyser's model.
verify-changesRun the checks from .azcli/verify.json that match files changed since the base ref. First restores HEAD's line endings in modified files whose CRLF/LF endings were changed. Reports passed, failed, or not-run; exits 1 on failure (--strict also on not-run). --profile, --base, --json, --no-fix (skip the line-ending restore).
restore-line-endingsOnly restore HEAD's line endings in modified files whose CRLF/LF endings were changed (the first step of verify-changes). --path.
find-pricePrice a BOM file (--bom) or part numbers after -- (NE555P:250 3051BK005:30m, default 1 pcs) from the Mouser/DigiKey APIs (default: those with credentials) or sites (--use-mouser-scrap, --use-digikey-scrap). Writes prices.csv, report.json and report.md to output/<date_time>/ (or next to --out) and lists them at the end. Credentials come from the flags, the environment or .env in the current directory. The scrapers need Python camoufox[geoip] (CAMOUFOX_PYTHON picks the interpreter) and, on Linux, Xvfb; --headless runs without a display and --headful opens a visible window (other OSes default to headless); see skills/az-find-price/SKILL.md.
scrape <urls..>Load pages one after another in one Camoufox browser, the one find-price scrapes with (same bot-check handling, Xvfb, --headless / --headful), and print each page as readable text for AI agents (links as [text](url), table rows as cell | cell), or its final HTML with --html. -p X (--part) fills {part} in the URLs with the URL-encoded X; repeat it to search every part on every URL. --out writes to a file. A page that fails gets an error: line and the command exits 1 after the rest. Same Python camoufox[geoip] requirement as find-price; distributor search URLs are in skills/az-find-price/references/distributors.md.
install-skillsCopy the skills shipped in the package (skills/) into ~/.claude/skills. Pass skill names (azcli install-skills azrico-js azrico-css) to install only those. --target picks another directory. In this repository, yarn install-skills builds and runs it without publishing.
install-modsAdd the Claude Code mods shipped in the package (mods/, see mods/README.md) as the azrico-claude-mods plugin marketplace and install them. Pass mod names (azcli install-mods azrico-model-router) to install only those. Safe to rerun; the mods load in place from the package, so restart Claude Code or run /reload-plugins afterwards.
patch-claude-vscodePatch the installed Claude Code VS Code extensions (~/.vscode/extensions, ~/.vscode-server/extensions, or --dir) so a mod's box on a reply (an AssistantMessage render hook) can sit after the reply text: when the mod's tree puts the engine's row first ([row, ...buttons]) the box goes after it, otherwise before it as unpatched. A mod can also style its own box: <Box key="azcli-style" display="none"><Text>{css}</Text></Box> in its tree becomes a <style> under @scope of that box (:scope is the box itself), so it reaches nothing else; unpatched surfaces hide it. Keeps a .azcli-backup beside the script, skips already patched versions, refuses versions whose code does not match, and --restore undoes it. Rerun after each extension update, then run "Developer: Reload Window".
worktree start <path>Install the worktree's locked dependencies, pick a free port above the configured default, run the dev server detached, and wait for it to answer or exit. Reports URL, pid, compile result, and log file (inside the git dir). Fails at once if the process exits; --timeout bounds the wait. --page, --port, --skip-install.
worktree status <path>Branch tips and dirty files of the worktree and the target, ahead/behind counts, whether the branch is merged, and dependency manifests changed on each side.
`worktree sync --direction inout
browser-check [directory]Start the selected project's dev server, wait for readiness, and run its browser-test script with the server origin in BASE_URL. --tags, --headed, --url, --json.

Worktree commands read .azcli/worktree.json from the worktree, else from --project; run azcli worktree start --help for the format. All three accept --target and --json.

Project commands accept --path to select a working directory. Build, update, clean, and publish accept --type, direct flags such as --python, and exclusions such as --nopython or --no-python. Use --quiet to suppress progress. Errors go to stderr and cause a nonzero exit status.

External tools must already be available on PATH. Commands run with explicit argument arrays and working directories. On Windows, standard Node and Composer .cmd/.bat shims are resolved to their entry points without a command shell. Custom batch launchers are rejected with an explanatory error.

Production Composer installation (up --prod and WordPress builds) preserves the lockfile and installs with --no-dev. Normal Composer updates retain the existing dependency-refresh behavior. Python build/publish expands distribution files explicitly.

Browser checks

azcli browser-check ./worktrees/order --tags "@shipping and not @save"
azcli browser-check --path ./web --url http://localhost:3001 --tags "@shipping" --headed

The directory defaults to the current directory and does not need to be a Git repository. All browser-check configuration lives in .azcli/browser.json. Without --url, startup installs locked project dependencies, picks a free port above the configured default, and waits for the server. Exited, timed-out, or failed-compilation servers stop the browser checks before the test command runs. Started servers remain running after success or test failure; the command prints their URL, pid, and log location. Logs are written to .azcli/logs/browser/ in the selected directory; add .azcli/logs/ to that project's .gitignore. --skip-install, --port, --page, and --timeout control startup.

Use --url for an already-running server; this skips installation and startup. Its availability is checked by the project's tests. The server's origin (scheme, host, and port, without the page path) is passed as BASE_URL. --headed sets HEADED=1; project browser hooks must read that variable to show the browser.

By default, browser checks run yarn test:browser in the selected directory. Configure the test command and server together in .azcli/browser.json (this example assumes the application's start script reads PORT):

{
  "command": "yarn",
  "args": ["test:browser"],
  "baseUrlEnv": "BASE_URL",
  "report": "cucumber-report.html",
  "install": {
    "command": "yarn",
    "args": ["install", "--immutable"]
  },
  "dev": {
    "command": "yarn",
    "args": ["start"],
    "defaultPort": 3000,
    "portEnv": "PORT",
    "readyPath": "/",
    "timeoutSeconds": 120,
    "pages": { "order": "/order" }
  }
}

command is required when the file exists; args defaults to an empty array. Optional cwd selects a directory inside the selected project. report is relative to that test working directory and must stay inside it. baseUrlEnv defaults to BASE_URL. Config is read from the selected directory, falling back to --project; fallback configuration still runs against the selected directory. Tags are appended as --tags <expression> without shell parsing. For npm scripts, use "command": "npm", "args": ["run", "test:browser", "--"].

dev is required for startup; without a config or dev, supply --url. install is optional and defaults to yarn install --immutable at the selected directory. Both accept command, args, and optional cwd relative to that directory. dev.defaultPort defaults to 3000; startup picks the first free port above it unless --port is supplied. dev.portEnv defaults to PORT, and {port} in dev arguments is replaced with the selected port. dev.readyPath defaults to /, timeoutSeconds to 120, and binDirs to ["node_modules/.bin"]. --page selects a named path from dev.pages; it affects the reported server URL, while BASE_URL remains the origin. Optional compiledPattern and failedPattern customize regexes matched against the dev log. Worktree configuration is never read by browser-check.

The target application owns its .feature files, Cucumber step definitions, authentication, fixtures, and cleanup. For example, its package.json can define "test:browser": "cucumber-js". Its browser hook should create a Playwright context with baseURL: process.env.BASE_URL and launch with headless: process.env.HEADED !== '1'. Configure Cucumber's HTML formatter to write the same file named by report; azcli reports its path when that file exists after a successful run. Test failures propagate to exit code 1. --quiet suppresses progress and subprocess output; --json returns server details and captured test output on success, while failures use the normal CLI error handler.

@cucumber/cucumber (12.x, compatible with Node.js 20) and @playwright/test are optional dependencies of azcli. Other commands do not import them, so they work when optional dependencies are omitted. Browser binaries are a separate setup step (yarn playwright install chromium in the application). The application's test script and step definitions must have their own resolvable Cucumber/Playwright dependencies, usually declared as its dev dependencies; installing azcli globally does not expose its optional packages to another project's module resolution. No packages or browser binaries are installed automatically by browser-check beyond its configured dependency install.

Transcript options

Use --project <text> repeatedly to filter projects, --since-days 0 to include all dates, and --last N to select the newest N matched sessions across projects. --list lists without exporting. Rendering supports --user-only, --no-include-tools, --no-include-thinking, and --include-subagents.

Optimization accepts --in for an existing export. It copies only indexed sessions to a fresh analysis directory before redacting them, preserving the original export. --out must name an empty directory; omitted output paths receive a unique suffix. --dry-run prepares the redacted snapshot and prints the agent command without launching it. Secret removal covers known project .env values and secret-like assignments, including summaries in the index.

Source layout

src/
  cli/                         entry point, registration, shared CLI options
  core/                        subprocesses, files, JSON guards, logging, project detection
  features/
    build/ clean/ update/ publish/ package/
    transcripts/               extraction, rendering, types, JSONL readers
      sources/                 Claude and Codex adapters
    optimize-transcripts/      snapshots, redaction, prompts, agent execution
tests/
  fixtures/                    synthetic JSONL sessions
scripts/                       build and test entry points

Each feature owns a typed yargs command module and its implementation. Shared subprocesses use core/process.ts; feature code lets failures reach the CLI boundary. Tests use temporary project fixtures and injected command runners, so the suite does not publish packages or run Docker/AI services. The test script type-checks tests and source, discovers every tests/*.test.ts, and keeps temporary files inside the project.

版本与发布记录

@azrico/azcli 共发布 169 个版本,首次发布于 2022/06/25;过去 12 个月发布了 54 个版本。

版本发布日期距今
1.3.22latest2026/11/07今天
1.3.212026/11/07今天
1.3.202026/11/07今天
1.3.192026/11/07今天
1.3.182026/11/07今天
1.3.172026/11/07今天

关于 @azrico/azcli 的常见问题

@azrico/azcli 是什么?

Project build, publishing, dependency, and AI transcript helpers

如何安装 @azrico/azcli?

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

@azrico/azcli 支持 TypeScript 吗?

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

@azrico/azcli 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@azrico/azcli 需要什么版本的 Node.js?

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

@azrico/azcli 可以商用吗?

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

@azrico/azcli 的下载量有多少?

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

@azrico/azcli 还在维护吗?

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