@devbie/fewbie-cli

中文文档
1.6.1发布于 2026/11/10MIT近 30 天下载 2940

fewbie frontend framework CLI

原始使用文档
文档目录19 节
  1. Requirements
  2. Installation
  3. Quick start
  4. The fewbie.json declaration
  5. Commands
  6. fewbie create <project-name>
  7. fewbie modules
  8. fewbie modules add <names...>
  9. fewbie modules apply
  10. fewbie modules remove <names...>
  11. fewbie modules update [names...]
  12. fewbie template update [paths...]
  13. fewbie apits [input]
  14. fewbie doctor
  15. fewbie status
  16. Registry items
  17. Global options
  18. Related packages
  19. License

@devbie/fewbie-cli

npm version license node

Command-line tool for the Fewbie frontend framework. Scaffold Next.js projects from the Fewbie basic template, manage registry modules declared in fewbie.json, update framework-owned template files, and generate typed API request code from OpenAPI documents.

The generated projects use Next.js 16 (App Router), React 19 and Tailwind CSS v4, with shadcn-style UI primitives and design tokens already wired up.

Requirements

  • Node.js >= 20

Installation

Run it directly with npx:

npx @devbie/fewbie-cli create my-app

Or install it globally:

npm install -g @devbie/fewbie-cli
fewbie --help

Quick start

# Scaffold a new project (writes an empty fewbie.json declaration)
npx @devbie/fewbie-cli create my-app

cd my-app
npm install
npm run dev

# Declare and install registry modules (dependencies installed automatically)
npx fewbie modules add api-client auth
npx fewbie modules add login-form

# Inspect project state
npx fewbie doctor
npx fewbie status

The fewbie.json declaration

The project root contains a declaration file that lists the registry modules the project enables:

{
  "modules": ["api-client", "auth", "login-form"]
}

It is the single source of truth for every module operation. A file that merely exists on disk (the starter template ships some registry files) does not count as installed. create writes an empty declaration; every other command reads or updates it.

Commands

fewbie create <project-name>

Create a new project from the Fewbie basic template.

OptionDescription
--template-path <dir>Use a local template directory instead of cloning the repository.
--template-ref <ref>Git ref of the fewbie-starter repository to clone the template from.
--no-git-initSkip git init in the new project.

fewbie modules

Bare invocation prints the module inventory. On a TTY it opens an interactive enable/disable picker; on a non-TTY (or with --json) it is read-only.

OptionDescription
--jsonPrint the module inventory as JSON.

fewbie modules add <names...>

npm-style add: declares the named modules in fewbie.json and lands their files (dependency closure included, npm dependencies installed automatically).

OptionDescription
-y, --yesSkip confirmation prompts.
-f, --forceOverwrite files that already exist but belong to no declared module (e.g. shipped by the template).
--skip-installDo not run npm install for missing dependencies.
--with-login-formAlso install the login-form block, e.g. fewbie modules add auth --with-login-form.

fewbie modules apply

Reconcile the project with fewbie.json: restore missing files, land dependency closure members, install npm dependencies.

OptionDescription
--checkCI gate: verify the declared set, its files and dependencies without writing anything.
-y, --yesSkip confirmation prompts.
-f, --forceOverwrite files that already exist but belong to no declared module (e.g. shipped by the template).
--skip-installDo not run npm install for missing dependencies.

fewbie modules remove <names...>

Remove modules from the declaration. Files are deleted only while they are byte-identical to the registry copy; locally modified files are reported and kept. Removing a module still required by another declared module fails.

OptionDescription
-y, --yesSkip confirmation prompts.

fewbie modules update [names...]

Update installed files to the registry source. Writes by default; missing files are reported as apply work rather than silently recreated.

OptionDescription
--checkCI gate: verify installed files against the registry; write nothing.
-y, --yesSkip confirmation prompts.

fewbie template update [paths...]

Update framework-owned template files from the starter template. Pass path prefixes (e.g. src/app) to restrict the scope; no paths means every framework-owned asset.

Ownership follows ADR-025:

  • framework-owned — overwritten by the template: next.config.ts, tsconfig.json, postcss.config.mjs, eslint.config.mjs, components.json, .prettierignore, .env.example, src/instrumentation.ts, src/lib/utils.ts.
  • mixed — only the block between /* fewbie:framework:start */ and /* fewbie:framework:end */ is updated (src/app/globals.css); host content outside the markers is preserved. A missing marker pair is reported, never guessed.
  • host-owned — distributed once by create, never touched: src/app/layout.tsx, src/app/page.tsx, src/components/**, package.json, README.md, next-env.d.ts, AGENTS.md, CLAUDE.md.
OptionDescription
--template-path <dir>Use a local template directory instead of cloning the repository.
--template-ref <ref>Git ref of the fewbie-starter repository to update the template from.
--checkCI gate: print the diff and exit non-zero when template files drift.

fewbie apits [input]

Generate typed API request code from an OpenAPI document (a URL or a local JSON/YAML file). On the first run the command scaffolds apits.config.ts; subsequent runs generate the typed request layer via the @devbie/apits generator, installed into the project as a dev dependency.

OptionDescription
-n, --name <name>Only generate the config source with this name.
-w, --watchWatch a local OpenAPI document and regenerate on change.
--skip-installDo not install the generator dev dependency.

fewbie doctor

Check project health: structure, the declared module set (from fewbie.json), partially installed modules, dependencies and design tokens. Missing fewbie.json is an error.

OptionDescription
--jsonEmit machine-readable JSON.

fewbie status

Print machine-readable project state as JSON (always JSON, no flag). Reports declared, installed, missing files and warnings, for automation.

Registry items

The built-in registry follows the shadcn item conventions (registry:lib, registry:component, registry:block):

ItemTypeDescription
api-clientlibAxios instance with bearer-token auth, httpOnly refresh-cookie rotation, single-flight 401 retry and proactive token refresh.
app-shellblockCollapsible sidebar primitives plus a minimal nav-array-driven AppShell skeleton.
authlibLogin/logout helpers, session-expired redirect binding and proactive-refresh bootstrap built on the api-client.
chartcomponentTree-shaken echarts registry, React adapter, structured-data chart and the shared color palette.
data-tablecomponentGeneric data table with client-side sorting and pagination.
login-formblockAccount/password login card; submits through the auth util and honors ?redirect=.
page-headercomponentStandard page header with title, description and a right-aligned actions slot.
password-checklistblockLive password rule checklist with a reusable isStrongPassword predicate (mirrors the backend policy).
query-clientlibTanStack Query singleton plus the provider component, wired for the App Router.
settings-required-stateblockEmpty state shown when required configuration is missing, with a setup call-to-action.
sse-streamlibPOST-based SSE transport with frame decoding, keepalive handling and abort support.
themecomponentnext-themes ThemeProvider wrapper and a light/dark toggle button.
frontend-monitor-sdkcomponentBrowser-side monitoring (PV/AJAX/resource/errors) via @devbie/frontend-monitor-sdk; scaffolds a client component for the root layout.

An item whose target path also ships in the starter template must stay byte-identical to that template copy — fewbie create copies the whole template while fewbie modules add copies the item (and fewbie modules apply restores it on reconcile), so the same file has two delivery channels that fork if edited apart. npm run check:template-drift -w @devbie/fewbie-cli asserts this in CI and before publishing. npm run check:template-deps -w @devbie/fewbie-cli additionally compares the template's locked @devbie/* versions against npm latest (network; release checklist only).

Global options

OptionDescription
-C, --cwd <dir>Project root directory (defaults to the current working directory).
--dry-runPrint planned writes/removals without touching the working tree.

Running fewbie with no arguments prints help and exits successfully.

  • @devbie/heartbeat-sdk — the basic template reports application liveness through instrumentation.ts when HEARTBEAT_ENDPOINT and HEARTBEAT_TOKEN are configured.
  • @devbie/frontend-monitor-sdk — browser-side monitoring SDK available as the frontend-monitor-sdk registry item.

License

MIT

版本与发布记录

@devbie/fewbie-cli 共发布 20 个版本,首次发布于 2026/09/26;过去 12 个月发布了 20 个版本。

版本发布日期距今
1.6.1latest2026/11/101 天前
1.6.02026/11/101 天前
1.5.02026/11/101 天前
1.4.62026/11/093 天前
1.4.52026/11/065 天前
1.4.42026/11/065 天前

关于 @devbie/fewbie-cli 的常见问题

@devbie/fewbie-cli 是什么?

fewbie frontend framework CLI

如何安装 @devbie/fewbie-cli?

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

@devbie/fewbie-cli 支持 TypeScript 吗?

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

@devbie/fewbie-cli 需要什么版本的 Node.js?

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

@devbie/fewbie-cli 可以商用吗?

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

@devbie/fewbie-cli 的下载量有多少?

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

@devbie/fewbie-cli 还在维护吗?

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