搜索

PythonReactSEOPDF
GitHub Skill

cli

@farming-labs/docs CLI — scaffold and upgrade docs. Use when running init, upgrade, or using flags like --template, --name, --theme, --entry, --framework, --latest, --beta. Covers npm, pnpm, yarn, bun commands and framework detection.

farming-labs☆ 28 仓库 Stars1 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

@farming-labs/docs — CLI

The @farming-labs/docs CLI scaffolds and upgrades documentation projects. Use this skill when the user asks about CLI commands, init, upgrade, or scaffolding.


Init (add docs or bootstrap project)

Add docs to an existing app: Run from the project root. The CLI detects the framework from package.json (next, @sveltejs/kit, astro, nuxt) and scaffolds config, routes, CSS, and sample pages.

# npm
npx @farming-labs/docs@latest init

# pnpm
pnpm dlx @farming-labs/docs@latest init

# yarn
yarn dlx @farming-labs/docs@latest init

# bun
bunx @farming-labs/docs@latest init

If the CLI cannot auto-detect the framework, it will prompt you to choose one.

Bootstrap a new project from scratch: Use --template and --name. The CLI creates the project folder, installs dependencies, and can start the dev server.

npx @farming-labs/docs@latest init --template next --name my-docs
npx @farming-labs/docs@latest init --template nuxt --name my-docs
npx @farming-labs/docs@latest init --template sveltekit --name my-docs
npx @farming-labs/docs@latest init --template astro --name my-docs

Replace my-docs with the desired folder name. Same pattern with pnpm dlx, yarn dlx, or bunx.


Init flags

Flag Description
--template <name> Bootstrap a project: next, nuxt, sveltekit, astro. Use with --name.
--name <project> Project folder name when using --template (e.g. my-docs).
--theme <name> Skip theme prompt. Values: e.g. fumadocs, greentree, pixel-border, darksharp, colorful, darkbold, shiny.
--entry <path> Skip entry path prompt. Default is docs.

Example (non-interactive bootstrap with theme):

npx @farming-labs/docs@latest init --template next --name my-docs --theme pixel-border

Upgrade

Upgrade all @farming-labs/* docs packages to the latest version. Run from the project root. The CLI auto-detects the framework from package.json and upgrades the correct packages.

# npm
npx @farming-labs/docs@latest upgrade

# pnpm
pnpm dlx @farming-labs/docs@latest upgrade

# yarn
yarn dlx @farming-labs/docs@latest upgrade

# bun
bunx @farming-labs/docs@latest upgrade
Framework Packages upgraded
Next.js @farming-labs/docs, @farming-labs/theme, @farming-labs/next
Nuxt @farming-labs/docs, @farming-labs/nuxt, @farming-labs/nuxt-theme
SvelteKit @farming-labs/docs, @farming-labs/svelte, @farming-labs/svelte-theme
Astro @farming-labs/docs, @farming-labs/astro, @farming-labs/astro-theme

Upgrade flags

Explicit framework (e.g. in a monorepo or when auto-detect fails):

npx @farming-labs/docs@latest upgrade --framework astro
# or
npx @farming-labs/docs@latest upgrade astro

Valid values: next, nuxt, sveltekit, astro.

Version channel:

npx @farming-labs/docs@latest upgrade              # latest stable (default)
npx @farming-labs/docs@latest upgrade --latest     # same
npx @farming-labs/docs@latest upgrade --beta       # beta versions

What init does (per framework)

  • Next.js: Detects next in dependencies; generates docs.config.ts, next.config.ts, app/global.css, app/layout.tsx, app/docs/layout.tsx, sample MDX pages; installs @farming-labs/docs, @farming-labs/theme, @farming-labs/next; can start dev server.
  • SvelteKit: Detects @sveltejs/kit; generates src/lib/docs.config.ts, src/lib/docs.server.ts, src/routes/docs/*, src/app.css, docs/*.md; installs svelte + svelte-theme packages.
  • Astro: Detects astro; generates src/lib/docs.config.ts, src/lib/docs.server.ts, src/pages/**, API route, docs/*.md; installs astro + astro-theme packages.
  • Nuxt: Detects nuxt; generates docs.config.ts, nuxt.config.ts, server/api/docs.ts, pages/docs/[...slug].vue, docs/*.md; installs nuxt + nuxt-theme packages.

Edge cases

  1. Monorepo — Run init from the app package root (where package.json with the framework dependency lives). For upgrade, use --framework if auto-detect picks the wrong one.
  2. No package.json / wrong directory — Init and upgrade must run in a directory that has (or will have) a package.json with the framework dependency.
  3. Beta — Use upgrade --beta to get beta versions of the docs packages.

Resources

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-03-11
索引更新时间
2026-03-11
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!