weapp-ide-cli-best-practices
weapp-ide-cli-best-practices
目的
Design and evolve weapp-ide-cli with deterministic command behavior, automation-friendly UX, and stable integration contracts for other CLIs (especially weapp-vite).
触发信号
- User asks to add/refactor
weapp-ide-clicommands or argument validation. - User asks to expose command metadata for external CLI dispatch.
- User asks to improve DevTools automation, screenshot, or automator subcommands.
- User asks to add language switching or config persistence behavior.
- User asks how
weapp-viteshould delegate toweapp-ide-cli.
适用边界
Use this skill when the center of gravity is command routing, CLI UX, config persistence, and cross-package CLI contracts.
Do not use this as the primary skill when:
- The issue is mainly
weapp-viteproject build/subpackage architecture. Useweapp-vite-best-practices. - The issue is mainly Vue SFC syntax/macro compatibility. Use
weapp-vite-vue-sfc-best-practices. - The issue is runtime lifecycle/state architecture in components/pages. Use
wevu-best-practices.
快速开始
- Classify change type: command addition, validation, i18n/config, or dispatch contract.
- Update command source-of-truth first, then update parser/dispatcher.
- Add/adjust tests around routing and error behavior.
- Sync docs in package README, website package page, packaged docs, and AI-facing guidance when relevant.
执行流程
- Keep command taxonomy explicit
- Maintain command groups as separate layers:
- WeChat official passthrough commands
- automator enhanced commands
- config commands
- minidev namespace passthrough
- Keep screenshot behavior explicit because AI workflows frequently depend on deterministic file output.
- Export top-level command catalog from
weapp-ide-clifor external reuse. - Provide a direct predicate function to check command support.
- Enforce dispatch invariants
- Parse global language option before command routing.
- Route minidev namespace and automator commands before generic WeChat CLI passthrough.
- Keep
help <automator-command>behavior explicit and deterministic. - Validate critical arguments before invoking external CLI.
- Keep i18n + config predictable
- Default language is Chinese.
- Support command-level temporary language override and persistent config language.
- Persist config to user directory config file and expose
configsubcommands for read/write/export/import. - Prefer Chinese user-facing messages, with switchable English fallback.
- Establish integration contract for upstream CLI
- Upstream CLI (e.g.
weapp-vite) should:- execute its native command table first
- delegate only when
isWeappIdeTopLevelCommand(command)is true - avoid blind passthrough for unknown commands
- Keep
wvandweapp-viteexamples aligned in upstream docs and generated project guidance. - Keep this rule documented and tested on both sides.
- Verify narrowly
- Prefer targeted tests in:
packages/weapp-ide-cli/test/*.test.ts- related
packages/weapp-vite/src/cli/*.test.tswhen dispatch contract changes
- Run lint on touched docs and source files only.
约束
- Do not duplicate command lists in multiple packages as independent sources of truth.
- Do not add user-facing text without i18n wrapping.
- Do not couple command parsing with business side effects before validation.
- Do not let unknown commands silently passthrough when integrating with another CLI.
输出要求
When applying this skill, return:
- Command-level design summary (what changed and why).
- Concrete file edits for catalog/routing/validation/docs/tests.
- Verification commands and expected outcomes.
- Cross-package contract notes when
weapp-viteintegration is touched.
完成检查
- Top-level command catalog and predicate are exported from
weapp-ide-cli. - Dispatch priority is deterministic and covered by tests.
- New/changed user-facing messages support Chinese default and English switch.
- Config persistence and command behavior are documented.
- If integration changed,
weapp-viteuses exported catalog instead of duplicated lists. - Screenshot and log-related commands stay documented for AI-driven acceptance workflows.
参考资料
references/command-catalog-and-dispatch.mdreferences/i18n-config-playbook.md
More from sonofmagic/skills
weapp-tailwindcss
帮助用户在 uni-app、taro、uni-app x 与原生小程序项目中接入和排障 weapp-tailwindcss。Use when 用户提到 weapp-tailwindcss、小程序 Tailwind 不生效、rpx 任意值、JS 字符串 class、space-y/space-x、weapp-tw patch、content/@source、twMerge/cva/tv。
127weapp-vite-best-practices
面向采用 weapp-vite 项目布局仓库或已安装 `weapp-vite` 依赖项目的工程化实践手册,覆盖 `vite.config.ts` 的 `weapp` 配置、自动路由、routeRules/layout、自动导入组件、分包、npm、多平台、受管 TypeScript、`prepare`、`forwardConsole`、`mcp`、`screenshot/compare/ide logs`、Web runtime、lib mode、worker、`dist/docs`、脚手架 `AGENTS.md`、AI skills 安装,以及与 `weapp-ide-cli` 的命令治理和透传边界。
68wevu-best-practices
面向小程序中 wevu 运行时的实践手册,覆盖生命周期注册、响应式更新、事件契约、`bindModel/useBindModel`、`setPageLayout/usePageLayout`、根入口 `useNativeRouter/useNativePageRouter`、`wevu/router`、store 约束,以及 `setData`、渲染、页面切换、资源与内存性能治理。
62weapp-vite-vue-sfc-best-practices
面向使用 weapp-vite 的小程序项目的 Vue SFC 实践手册,覆盖 `<script setup lang="ts">`、JSON 宏、`definePageMeta`/layout、`defineModel`、`usingComponents`、模板指令兼容、`.weapp-vite` 类型支持文件、受管 `prepare` 工作流,以及和脚手架 `AGENTS.md` / 本地 `dist/docs` 对齐的当前 SFC 约定。
58docs-and-website-sync
面向采用 weapp-vite monorepo 布局仓库的文档、website 与 skills 同步工作流。适用于代码能力已变化但 website/docs/README/skills/AI 指南/packaged docs 可能过期的场景,尤其覆盖 `weapp` 配置页、`dist/docs`、`AGENTS.md` 模板、AI skills 安装、`prepare`、MCP、`forwardConsole`、`screenshot/compare/ide logs`、Web runtime、lib mode、多平台与 routeRules/layout 等入口同步。
43playwright-cli
Automate browser interactions, test web pages and work with Playwright tests.
41