@fallow-cli/fallow-node

中文文档
3.43.0发布于 2026/11/14MITTypeScriptCommonJS零依赖构建来源已验证近 30 天下载 6368

Native Node.js bindings for fallow, codebase intelligence for TypeScript and JavaScript: health, complexity, duplication, architecture, and unused code.

原始使用文档

@fallow-cli/fallow-node

Native Node.js bindings for fallow's main analyses.

Install

npm install @fallow-cli/fallow-node   # or: pnpm/yarn/bun add @fallow-cli/fallow-node

API

  • detectDeadCode(options?)
  • detectCircularDependencies(options?)
  • detectBoundaryViolations(options?)
  • detectArchitecture(options?)
  • detectDuplication(options?)
  • detectSimilarCode(options?)
  • detectFeatureFlags(options?)
  • computeComplexity(options?)
  • computeHealth(options?)

All functions are async and return the same JSON-shaped report contracts that the CLI emits for --format json.

detectSimilarCode is opt-in and advisory. It resolves and verifies the exact-version fallow-similar-code companion before project source is read, then returns unverified semantic candidates from the pinned local model. It never downloads the model. Run fallow similar-code setup --local separately after explicit user confirmation.

Enum-like option values use lowercase CLI-style strings such as "mild", "cyclomatic", "handle", and "low".

Shared options mirror analysis-affecting CLI globals, including root, configPath, noCache, threads, diffFile, production, changedSince, workspace, changedWorkspaces, and explain. Object-shaped JSON roots have a top-level kind discriminator. Branch on kind when reading a report. diffFile accepts a path to a unified diff file. Reading diffs from stdin is CLI-only.

The public declarations live in types/index.d.ts. The package-level index.d.ts is a generated entry point that re-exports that canonical source. This keeps the package root stable when NAPI-RS regenerates its temporary declarations during a native build.

Rejected promises throw a FallowNodeError with:

  • message
  • exitCode
  • optional code
  • optional help
  • optional context

版本与发布记录

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

版本发布日期距今
3.43.0latest2026/11/14今天
3.42.02026/11/104 天前
3.41.02026/11/076 天前
3.40.02026/11/068 天前
3.39.02026/11/0410 天前
3.38.12026/10/3113 天前

关于 @fallow-cli/fallow-node 的常见问题

@fallow-cli/fallow-node 是什么?

Native Node.js bindings for fallow, codebase intelligence for TypeScript and JavaScript: health, complexity, duplication, architecture, and unused code.

如何安装 @fallow-cli/fallow-node?

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

@fallow-cli/fallow-node 支持 TypeScript 吗?

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

@fallow-cli/fallow-node 支持 ESM 还是 CommonJS?

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

@fallow-cli/fallow-node 需要什么版本的 Node.js?

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

@fallow-cli/fallow-node 可以商用吗?

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

@fallow-cli/fallow-node 的下载量有多少?

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

@fallow-cli/fallow-node 还在维护吗?

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