draftpage
v0.2.0
Published
Compile Markdown drafts and diagram DSL into self-contained HTML pages.
Readme
Draftpage
Draftpage 将 Markdown 草稿与图表 DSL 编译为自包含 HTML 页面。兼具纯计算编译器库与开箱即用的命令行工具。
draftpage/
├── core/ # 纯计算型单文件 ESM 编译器(零运行时依赖、纯内存转译)
├── host/ # 薄宿主层(拥有文件 I/O、原子写入、时间戳注入与 CLI 参数解析)
├── bin/ # CLI 入口(draftpage 命令)
└── skills/draftpage/ # Agent 调用技能(基于 bunx draftpage)架构与物理边界
core/:内部保持绝对纯洁。零外部运行时依赖,兼容浏览器、Node.js 与 Bun。严禁引入文件 I/O、系统时间或环境发现。由test/boundary.test.js和 esbuild browser 编译目标自动化守卫。host/:薄宿主适配层。负责文件读写、时间戳注入、原子替换 HTML 与终端格式化。- 单包统一发布:对外统一为 npm 包
draftpage。既可import { compile } from 'draftpage'作为纯函数库引用,也可直接执行draftpage命令行。
快速上手
1. 使用 Bunx(发布后免安装)
无需全局安装任何 CLI,直接运行:
bunx draftpage guide
bunx draftpage info flow
bunx draftpage build page.md -o page.html --json2. 本地开发
在仓库根目录下运行:
bun install
bun run build
bun ./bin/draftpage.js guide
bun ./bin/draftpage.js info flow
bun ./bin/draftpage.js build core/examples/tcp.md -o /tmp/tcp.html --json
bun run check # 校验全量构建、类型检查、738 项测试及边界哨兵Agent Skill 接入
Agent Skill 位于 skills/draftpage/SKILL.md。
若使用支持 ~/.agent/skills/ 的 Agent,直接软链接:
mkdir -p ~/.agent/skills
ln -s "$PWD/skills/draftpage" ~/.agent/skills/draftpageAI 通过 bunx draftpage ... 渐进式获取输入规则与组件语法,并使用 --json 获取紧凑诊断闭环修复源稿。
编译与发布
bun run release:prepare # 构建、测试、打包校验并输出至 output/release/
bun publish ./output/release/draftpage-0.2.0.tgz --access public # 手动发布详细发布说明见 PUBLISH.md。
