rust-node-bootstrap
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRust+Node.js Bootstrap
Rust+Node.js 项目初始化
Scaffold a Rust+Node.js hybrid project with all infrastructure in one pass.
一键搭建包含所有基础设施的Rust+Node.js混合项目。
When to Use This Skill
何时使用该技能
Activate when any of the following are true:
- User says "bootstrap", "scaffold", "new project", "set up from scratch"
- Repo has or
Cargo.tomlbut is missing the otherpackage.json - Missing ,
.github/workflows/, orscripts/publish.config.ts - Incrementally adding forge infrastructure to an existing project
满足以下任一条件时激活:
- 用户提及"bootstrap"、"scaffold"、"new project"、"set up from scratch"
- 仓库已有或
Cargo.toml但缺少另一个文件package.json - 缺少、
.github/workflows/或scripts/publish.config.ts - 为现有项目逐步添加Forge基础设施
Decision Tree
决策树
Starting from scratch?
YES → Full scaffold (all steps in order below)
NO → Incremental setup ↓
Has package.json? → NO: Create root package.json + pnpm-workspace.yaml
Has Cargo.toml? → NO: Create Cargo workspace
Has .github/workflows/? → NO: Generate from rust-node-ci skill templates
Has scripts/? → NO: Generate from rust-npm-publish skill templates
Has publish.config.ts? → NO: Create from rust-npm-publish skill examples
Has specs/? → NO: Initialize LeanSpec是否从零开始?
是 → 完整搭建(按以下顺序执行所有步骤)
否 → 增量搭建 ↓
是否有package.json? → 否:创建根package.json + pnpm-workspace.yaml
是否有Cargo.toml? → 否:创建Cargo工作区
是否有.github/workflows/? → 否:从rust-node-ci技能模板生成
是否有scripts/? → 否:从rust-npm-publish技能模板生成
是否有publish.config.ts? → 否:根据rust-npm-publish技能示例创建
是否有specs/? → 否:初始化LeanSpecGather Project Info
收集项目信息
| Field | Example | Required |
|---|---|---|
| Project name | | Yes |
| npm scope | | Yes |
| Rust binary name(s) | | Yes |
| Cargo package name(s) | | Yes |
| Main npm packages | | Yes |
| Repository URL | | Yes |
| Platforms | | No (default: all 4) |
| 字段 | 示例 | 是否必填 |
|---|---|---|
| 项目名称 | | 是 |
| npm作用域 | | 是 |
| Rust二进制名称 | | 是 |
| Cargo包名称 | | 是 |
| 主npm包路径 | | 是 |
| 仓库URL | | 是 |
| 目标平台 | | 否(默认:全部4个) |
Scaffold Structure
项目结构
See references/project-structure.md for the full annotated tree.
my-tool/
├── .github/workflows/ ← CI + publish workflows
├── .lean-spec/config.json ← LeanSpec configuration
├── specs/ ← Spec-driven development
├── packages/cli/ ← Main npm package (thin JS wrapper)
│ ├── package.json ← bin + optionalDependencies
│ └── bin.js ← Resolves platform binary, spawns it
├── rust/ ← Rust workspace
├── scripts/ ← Publish & version scripts
├── publish.config.ts ← Publish pipeline configuration
├── package.json ← Root (version source of truth)
├── pnpm-workspace.yaml ← pnpm workspace definition
└── Cargo.toml ← Rust workspace manifest完整带注释的目录结构请参考references/project-structure.md。
my-tool/
├── .github/workflows/ ← CI + 发布工作流
├── .lean-spec/config.json ← LeanSpec配置文件
├── specs/ ← 规范驱动开发目录
├── packages/cli/ ← 主npm包(轻量JS封装层)
│ ├── package.json ← 二进制配置 + 可选依赖
│ └── bin.js ← 解析平台二进制文件并启动
├── rust/ ← Rust工作区
├── scripts/ ← 发布与版本管理脚本
├── publish.config.ts ← 发布流水线配置
├── package.json ← 根配置(版本唯一来源)
├── pnpm-workspace.yaml ← pnpm工作区定义
└── Cargo.toml ← Rust工作区清单File Generation Order
文件生成顺序
Order matters — later files depend on earlier ones:
- Root configs — ,
package.json,pnpm-workspace.yaml,Cargo.tomlUse templates/bootstrap/.turbo.json - Publish config — (drives script + workflow generation)
publish.config.ts - Main package wrapper — +
bin.jsfrom rust-npm-publish skill templates, fill in scope/binary name/platformspackage.json - Scripts — Copy from rust-npm-publish skill templates
- Workflows — Copy from rust-node-ci skill templates, customize matrix
- LeanSpec — Initialize and
.lean-spec/config.jsonspecs/ - AGENTS.md — Project-level agent instructions listing installed skills
顺序至关重要——后续文件依赖于前置文件:
- 根配置文件 — 、
package.json、pnpm-workspace.yaml、Cargo.toml使用templates/bootstrap/中的模板。turbo.json - 发布配置 — (驱动脚本与工作流生成)
publish.config.ts - 主包封装层 — 从rust-npm-publish技能模板生成+
bin.js, 填充作用域/二进制名称/平台信息package.json - 脚本文件 — 复制rust-npm-publish技能模板中的脚本
- 工作流文件 — 复制rust-node-ci技能模板中的工作流,自定义矩阵配置
- LeanSpec — 初始化和
.lean-spec/config.json目录specs/ - AGENTS.md — 项目级Agent说明文档,列出已安装的技能
Verify
验证
bash
pnpm install && pnpm build && cargo check --workspace && pnpm tsx scripts/sync-versions.tsSee references/checklist.md for the full post-bootstrap checklist.
bash
pnpm install && pnpm build && cargo check --workspace && pnpm tsx scripts/sync-versions.ts完整的初始化后检查清单请参考references/checklist.md。
Install Companion Skills
安装配套技能
After scaffolding, install skills for ongoing development:
bash
undefined搭建完成后,安装用于后续开发的技能:
bash
undefinedCI/CD workflows and composite actions
CI/CD工作流与复合动作
npx skills add -g onsager-ai/dev-skills --skill rust-node-ci -a claude-code -y
npx skills add -g onsager-ai/dev-skills --skill rust-node-ci -a claude-code -y
npm publishing pipeline and versioning
npm发布流水线与版本管理
npx skills add -g onsager-ai/dev-skills --skill rust-npm-publish -a claude-code -y
undefinednpx skills add -g onsager-ai/dev-skills --skill rust-npm-publish -a claude-code -y
undefinedTemplates
模板目录
| Directory | Contents |
|---|---|
| templates/bootstrap/ | Root configs: |
| 目录 | 内容 |
|---|---|
| templates/bootstrap/ | 根配置文件: |
Setup & Activation
安装与激活
bash
npx skills add -g onsager-ai/dev-skills --skill rust-node-bootstrap -a claude-code -yAuto-activates when: user says "bootstrap", "scaffold", "new project", or "init" in a Rust+Node.js context.
bash
npx skills add -g onsager-ai/dev-skills --skill rust-node-bootstrap -a claude-code -y自动激活条件:在Rust+Node.js场景中,用户提及"bootstrap"、"scaffold"、"new project"或"init"时。