@alfacapital-tech/c4builder

中文文档
0.14.0发布于 2026/11/04MITES Module构建来源已验证近 30 天下载 2195

A CLI tool designed to compile a folder structure of markdowns and plant uml files into a site, single file markdown or a collection of markdowns with links

原始使用文档
文档目录5 节
  1. Why this fork
  2. Quick start
  3. Documentation
  4. Contributing
  5. Credits and license

Документация на русском · English documentation · Site

C4-Builder

Architecture as code that an agent writes, checks and reads.

C4-Builder is a CLI that builds a folder of markdown files and PlantUML, D2, BPMN, Mermaid or Wireflow diagrams into documentation: a docsify site, a markdown file per folder, or a single file. Folders follow the C4 model (system → container → component), and git keeps the history of architecture decisions next to the code.

Why this fork

The original C4-Builder by Adrian Victor Lupu has not been developed since March 2024. At Alfa-Capital it builds an architecture repository of more than a hundred diagrams, so we continue it as a maintained fork, adapted to working with AI agents:

  • Deterministic offline rendering. The PlantUML jar, the diagram font and the engines ship with the package; layout is computed by PlantUML's built-in Smetana engine, no Graphviz. The same sources produce the same SVG on a laptop, in CI and in Docker, with no network access.
  • c4builder check validates individual .puml/.iuml/.d2/.bpmn/.mmd/.wireflow.json files with the build's own engine and returns an exit code and the error line — fast feedback for agents, pre-commit hooks and CI.
  • Plugins. openspec publishes an OpenSpec store (specs and changes) as a site section; openapi renders service contracts as offline swagger-ui pages.
  • D2 as a second diagram engine, deterministic PNG via resvg, and optional Java: without a system Java, c4builder downloads a private JRE.
  • BPMN processes written as BPMN 2.0 XML without coordinates: the build validates the model and lays it out with horizontal pools and lanes.
  • Mermaid .mmd files and ```mermaid blocks are rendered at build time by real mermaid, without a browser: images in every output instead of client-side rendering.
  • Wireflow user flows: a .wireflow.json export of the editor becomes an image with screen cards, notes and transitions, without a browser or network.
  • Review from the page. In c4builder --site -w a selection becomes a question in the source .md or feedback for the agent; c4builder feedback --wait --as <name> hands the batch to the agent, and the page reloads with its edits.
  • Maintained. TypeScript, golden rendering snapshots, CI on every pull request, releases to npm and GHCR. The PDF output of the original was removed.

Quick start

Requires Node.js ≥ 22.17. Java 17+ is optional.

npm i -g @alfacapital-tech/c4builder

c4builder --new --name demo -y   # project from the template, full config, no prompts
cd demo
c4builder                        # build into docs/
c4builder --site -w              # live preview at http://localhost:3000

Since 0.5.0, c4builder new and c4builder config work too (0.4.0 has only the flags). Without -y, c4builder asks for the project name and the first build runs the setup wizard.

The agent loop — edit a diagram, check it, look at the result:

c4builder check src/context.puml   # exit code 0 or 1, "✗ file: line N: message" on error
c4builder --site -w                # rebuilds and reloads the browser on every save

For agents: c4builder skills installs the agent skills of the installed version into the project (c4builder --new does it for a new one), and "generateLLMS": true adds llms.txt / llms-full.txt (diagram sources included) to the site.

Or with Docker (Node, JRE, PlantUML, fonts and D2 included):

docker run --rm -v "$PWD:/pwd" ghcr.io/alfacapital-tech/c4builder:latest c4builder

Release candidates are published under the rc tag: npm i -g @alfacapital-tech/c4builder@rc.

Documentation

The full reference lives on the documentation site, in Russian (primary) and English:

РусскийEnglish
Getting startedБыстрый стартGetting started
Diagrams, fonts, checkДиаграммыDiagrams
CLI and .c4builder keysCLI и конфигурацияCLI & configuration
PluginsПлагиныPlugins
Docker and CIDocker и CIDocker & CI
Working with agentsАгентыAgents
Development and releasesРазработкаDevelopment

What changed in each version: CHANGELOG.md. Why things are the way they are: the design log (OpenSpec store) on the site.

Contributing

npm ci && npm run build
npm test            # all tests, golden rendering snapshots included
npm run check       # biome lint and format

Behaviour changes are described in OpenSpec (openspec/changes/) first, add a line to ## Unreleased in CHANGELOG.md and update the documentation pages in both languages (docs/ru/src, docs/en/src). Details are on the Development page.

Credits and license

C4-Builder was created by Adrian Victor Lupu; this fork is maintained by Alfa Capital Technologies. Upstream changes and their contributors are listed in the changelog. MIT license, see license.

版本与发布记录

@alfacapital-tech/c4builder 共发布 38 个版本,首次发布于 2026/03/30;过去 12 个月发布了 38 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.14.0latest2026/11/043 天前
0.13.02026/10/318 天前
0.12.02026/10/318 天前
0.11.02026/10/308 天前
0.10.12026/10/2612 天前
0.10.02026/10/2612 天前

其他发布通道:rc → 0.10.0-rc.3。

关于 @alfacapital-tech/c4builder 的常见问题

@alfacapital-tech/c4builder 是什么?

A CLI tool designed to compile a folder structure of markdowns and plant uml files into a site, single file markdown or a collection of markdowns with links

如何安装 @alfacapital-tech/c4builder?

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

@alfacapital-tech/c4builder 支持 TypeScript 吗?

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

@alfacapital-tech/c4builder 支持 ESM 还是 CommonJS?

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

@alfacapital-tech/c4builder 需要什么版本的 Node.js?

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

@alfacapital-tech/c4builder 可以商用吗?

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

@alfacapital-tech/c4builder 的下载量有多少?

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

@alfacapital-tech/c4builder 还在维护吗?

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