@basenative / cli
这个
bn命令-每个BaseNative / DuganLabs项目的前门。
脚手架,prd,规范驱动的工作流(兼容
github / spec-kit), GitHub
里程碑/问题,Nx,牧马人+多普勒部署,和a doctor 调用
漂移。零重依赖-仅限节点内置。
安装
npm install -g @basenative/cli
# or, without installing:
npx @basenative/cli create my-app
快速启动
bn create my-app --template t4bs
cd my-app
bn dev
bn deploy --preview
命令
前门
| 命令 | 它是做什么的 |
|---|---|
bn create <name> [-t <template>] | 完成一个新项目。模板: webapp (默认), worker, library, t4bs. 遗产: minimal, enterprise, api. |
bn prd init | 写 docs/PRD.md 从t4bs格式支架。 |
bn prd edit | 开放 docs/PRD.md 在 $EDITOR. |
bn prd sync | 解析里程碑部分→ .bn/prd-issues.json (被 bn gh sync)。 |
bn speckit init | 引导 .specify/ (内存、规格、模板)。 |
bn speckit spec <name> | 脚手架 .specify/specs/NNN-name/spec.md. |
bn speckit plan | 存根 plan.md 对于活动规范。 |
bn speckit tasks | 提取 tasks.md 项→ .bn/speckit-tasks.json. |
bn speckit validate | 为必需的字段检查规范/计划/任务。 |
bn gh sync | 幂等地创建里程碑+问题 .bn/*.json. |
bn gh board | 创建/验证此版本的org项目。 |
bn gh automate | 验证 .github/workflows/deploy.yml 参考文献 DuganLabs/.github 可重用工作流。 |
bn nx [...] | 透传, nx (使用您检测到的pm)。 --task <t> [--affected] 普通运行的简写。 |
工作流
| 命令 | 它是做什么的 |
|---|---|
bn dev | 先用热模块替换(npm-script)运行项目的开发服务器 node --watch,然后 wrangler dev)。 --no-hmr 选择了。 |
bn deploy --prod / --preview | wrangler pages deploy (或 wrangler deploy),用… doppler run -- 如果安装了多普勒。 |
| ' bn部署——env <预览 | 暂存 |
bn doctor | 验证节点版本, .nvmrc、packageManager、eslint config、tsconfig、多普勒required。json, deploy.yml。 |
bn build | 为生产构建。 |
bn generate <type> <name> | 生成一个 component, route,或者 page. |
| ' bn env <list | 集 |
bn analyze [dir] | 包大小+依赖报告。 |
选项
每个命令都支持 --help/-h. 顶级国旗:
-h, --help显示帮助。-v, --version打印安装的CLI版本。
发出数据的命令接受 --json. 改变文件系统的命令
或者远程状态接受 --dry-run.
的端到端示例
# 1. Scaffold and check
bn create rocket --template webapp
cd rocket
bn doctor
# 2. Author a PRD, sync to GitHub
bn prd init --owner "Warren"
$EDITOR docs/PRD.md # fill in milestones
bn prd sync
bn gh sync # idempotent
# 3. Spec a feature
bn speckit init
bn speckit spec onboarding
bn speckit plan
bn speckit tasks
bn gh sync --input .bn/speckit-tasks.json
# 4. Build and ship
bn dev
bn deploy --preview
bn deploy --prod
模板
所有模板随附:
package.json引用@basenative/*包。eslint.config.js扩展@basenative/eslint-config.tsconfig.json扩展@basenative/tsconfig..nvmrc,.prettierrc,.gitignore.wrangler.toml(如适用)。.github/workflows/deploy.yml调用可重用工作流DuganLabs/.github.
| 模板 | 堆栈 |
|---|---|
webapp | Cloudflare Pages SPA + Worker, BaseNative runtime/router/server。 |
worker | Cloudflare Worker (API / cron / queue)。 |
library | npm-可发布库,Apache-2.0。 |
t4bs | 游戏支架的使用 @basenative/og-image, keyboard, share, auth-webauthn, admin, persist. |
清单
manifest.json 枚举每个命令、子命令和标志-用于
壳牌完井和下游工具。
许可证
apache - 2.0。