@adlc/preflight

中文文档
1.12.0发布于 2026/10/10MITES Module构建来源已验证近 30 天下载 8138

Permissions and environment preflight check before fan-out (D2 phase 0).

原始使用文档
文档目录15 节
  1. Usage
  2. No flags — required checks only
  3. With optional checks
  4. Flags
  5. Checks
  6. Required (always run)
  7. Optional (run only when flag given)
  8. Exit codes
  9. Output
  10. Human-readable (default)
  11. JSON ( --json )
  12. ADLC phase served
  13. Cleanup guarantees
  14. Relationship to sibling tools
  15. Core gaps

@adlc/preflight

Permissions and environment preflight check before fan-out (ADLC D2 Phase 0).

Runs isolated checks to verify that every operation class the agent fleet needs actually works in the current environment — so permission prompts and configuration failures front-load into one batch instead of stalling mid-flight.

From the ADLC D2 field notes:

A permission prompt mid-flight is a hidden serialization point: one blocked agent × N teammates = N stalls, racing siblings, and half-started state. Environment determinism is a precondition of parallel wall-clock math.

Usage

preflight [--dir <path>] [--test-cmd "..."] [--gh] [--llm] [--worktrees] [--json]

No flags — required checks only

preflight

Runs the four required checks (bash, git, write, branch) and prints a table plus a verdict line. Exit 0 if all pass; exit 2 if any fail.

With optional checks

preflight --dir .sdlc/.adlc --test-cmd "npm test" --gh --llm --worktrees

Flags

FlagTypeDescription
--dir <path>stringADLC directory used for write checks and temporary files (default: .adlc or $ADLC_DIR).
--test-cmd "CMD"stringRun CMD via sh -c, expect exit 0. Tail of output shown on failure. A passed-but-empty value (e.g. an unset $TEST_CMD) is rejected with exit 1 — --test-cmd requires a non-empty command — never silently skipped.
--ghbooleanRun gh auth status; expect exit 0.
--llmbooleanCall detectProvider() and assert it is non-null. No API call made. Reports which provider was found.
--worktreesbooleangit worktree add --detach .worktrees/preflight-test HEAD then remove.
--jsonbooleanMachine-readable output: { checks, verdict, failedNames }.

Checks

Required (always run)

NameWhat it tests
bashecho preflight-ok succeeds
gitgit status in cwd succeeds (cwd must be a git repo)
writeWrite + delete .adlc/tmp/preflight-test (mkdir -p as needed)
branchCreate and delete preflight-test-branch; always cleans up in finally

Optional (run only when flag given)

NameFlagWhat it tests
worktrees--worktreesgit worktree add/remove cycle; always cleans up in finally
test-cmd--test-cmd "CMD"Runs CMD via sh, expects exit 0
gh--ghgh auth status exits 0
llm--llmdetectProvider() returns non-null (no API call)

Exit codes

CodeMeaning
0Gate passes — all checks (required + explicitly requested optional) passed
1Operational / internal error
2Gate fails — one or more required or explicitly requested checks failed

Note: optional checks that are NOT requested are not run and cannot fail. When a flag like --gh is passed, that check becomes required for this run. A --test-cmd that is passed but empty or whitespace-only (what preflight --test-cmd "$TEST_CMD" produces in CI when the variable is unset) is neither skipped nor run: it is an operational error — preflight prints error: --test-cmd requires a non-empty command … to stderr, prints nothing on stdout (no table, no verdict, no --json document), and exits 1. A requested check that cannot run must never look like a pass.

Output

Human-readable (default)

──────────────────────
check      status  detail
──────────────────────
bash       ✓ PASS    echo preflight-ok succeeded
git        ✓ PASS    git status succeeded
write      ✓ PASS    .adlc/tmp/preflight-test written and removed
branch     ✓ PASS    branch 'preflight-test-branch' created and removed
worktrees  ✓ PASS    worktree add/remove succeeded
test-cmd   ✓ PASS    exited 0
──────────────────────

verdict: ALL CHECKS PASSED — environment is ready.

JSON (--json)

{
  "checks": [
    { "name": "bash",   "status": "pass", "detail": "echo preflight-ok succeeded", "required": true },
    { "name": "git",    "status": "pass", "detail": "git status succeeded",          "required": true },
    { "name": "write",  "status": "pass", "detail": ".adlc/tmp/preflight-test written and removed", "required": true },
    { "name": "branch", "status": "pass", "detail": "branch 'preflight-test-branch' created and removed", "required": true }
  ],
  "verdict": "pass",
  "failedNames": []
}

ADLC phase served

D2 Phase 0 (pre-fan-out environment gate). Run once before spawning the parallel agent fleet to ensure every operation class succeeds. Integrates with team-develop as Phase 0 of the parallel build pipeline.

Cleanup guarantees

Every check that creates a side effect (branch, worktree, tmp file) performs cleanup in a finally block — residue is removed whether the check passes or fails.

Relationship to sibling tools

  • merge-forecast — uses after preflight confirms the environment is ready; validates the ticket DAG and forecasts conflict probability before the fan-out.
  • gate-manifest — records gate passage events into the ADLC manifest ledger; preflight should record its passage there in orchestrated flows.

Core gaps

None. All required core APIs (detectProvider, git, parseArgs, printJson) are available in @adlc/core.

版本与发布记录

@adlc/preflight 共发布 18 个版本,首次发布于 2026/06/14;过去 12 个月发布了 18 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.12.0latest2026/10/1027 天前
1.11.12026/09/091 个月前
1.11.02026/08/252 个月前
1.10.02026/08/112 个月前
1.9.02026/08/092 个月前
1.8.02026/08/082 个月前

关于 @adlc/preflight 的常见问题

@adlc/preflight 是什么?

Permissions and environment preflight check before fan-out (D2 phase 0).

如何安装 @adlc/preflight?

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

@adlc/preflight 支持 TypeScript 吗?

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

@adlc/preflight 支持 ESM 还是 CommonJS?

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

@adlc/preflight 需要什么版本的 Node.js?

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

@adlc/preflight 可以商用吗?

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

@adlc/preflight 的下载量有多少?

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

@adlc/preflight 还在维护吗?

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