creating-projects
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWhen you are creating a project, you should make it usable and maintainable, you need to make infrastructure tools, release and validation system work perfectly.
When creating projects, what you should focus on is not the project code, but everything except project code.
You can create a small placeholder like macro and . You can fill the code later if I required. If I don't require you implement any logic, just keep placeholders.
todo!()console.error()创建项目时,应确保项目可用且易于维护,并需要让基础设施工具、发布流程和验证系统完美运行。
创建项目时,重点不在项目代码本身,而在项目代码之外的所有事项。
可以创建类似 宏和 这样的简单占位实现。如果我后续要求,再补全代码。如果我未要求实现任何逻辑,就只保留占位内容。
todo!()console.error()Required initialization gate
必需的项目初始化关卡
For a completely new project, finish the managed project initialization before writing any scaffold or project files:
- Load the skill and use its paired resolver to find the configured project root and project CLI.
$global-projects - Resolve the repository owner and name. If either is missing or ambiguous, ask the user before creating the project directory.
- Resolve whether the repository should be public or private. If the user did not specify visibility, ask before continuing.
- Run the selected CLI's command with the explicit visibility option from
init.<root>/<owner>/<repo> - Verify the local path and remote, then create the scaffold inside that initialized repository (see Templates).
origin
An explicit request to create or initialize a new project authorizes the managed initialization. Once the owner, name, and visibility are known, do not ask for a second confirmation before running , , or the paired command.
moi init --publicmoi init --privatemoDo not create the project in the current task directory, , , or another artifact directory unless the user explicitly chose that location. Generic artifact-output guidance does not override the managed project workflow.
work/outputs/Do not use plain as a substitute for or . Do not silently skip managed initialization because a required choice is missing; ask the user for that choice instead.
git initmoi initmo init对于全新的项目,在编写任何脚手架或项目文件之前,必须完成托管项目初始化:
- 加载 skill,并使用其配套解析器查找已配置的项目根目录和项目 CLI。
$global-projects - 解析仓库所有者和名称。如果其中任一项缺失或不明确,请在创建项目目录之前询问用户。
- 确定仓库应为公开还是私有。如果用户未指定可见性,请先询问用户再继续。
- 从 运行所选 CLI 的
<root>/<owner>/<repo>命令,并明确指定可见性选项。init - 验证本地路径和 remote,然后在已初始化的仓库中创建脚手架(参见模板)。
origin
明确要求创建或初始化新项目,即表示授权执行托管初始化。一旦所有者、名称和可见性均已确定,在运行 、 或配套的 命令之前,不要再次请求确认。
moi init --publicmoi init --privatemo除非用户明确选择了该位置,否则不要在当前任务目录、、 或其他产物目录中创建项目。通用的产物输出指导不能覆盖托管项目工作流。
work/outputs/不要使用普通的 代替 或 。不要因为缺少必要选项而擅自跳过托管初始化;应向用户询问该选项。
git initmoi initmo initTemplates
模板
Templates live in next to this file. Load to pick the stack, then scaffold with the script next to this file:
templates/$choosing-toolsbash
scripts/scaffold.sh <stack> <root>/<owner>/<repo> <owner> <repo> "<description>"| Stack | Layers | Use for |
|---|---|---|
| | Rust crates and CLIs |
| | npm libraries |
| | Node.js command line tools |
Websites and napi-rs projects have no template yet. Build them by hand, still following and the aspects below.
commonThe script copies the layers in order, renames paths to and paths to the repo name, fills the mechanical placeholders, and runs each layer's to add dependencies with their latest versions. Never copy pinned dependency versions from other projects into a new one.
_name.name__repo__setup.shAfter scaffolding:
- Write every placeholder the script prints, mostly in
{{TODO: ...}}. Delete a section instead of leaving it empty. Keep a new project'sAGENTS.mdshort (around 40 lines), it should only hold non-obvious rules and gotchas.AGENTS.md - Adjust the scaffold to the project: the package name (for example a scoped npm name), extra crates or packages, CLI binaries, and the CI matrix.
- Run the stack's checks before finishing: for Rust,
just readyfor JavaScript.vp run check && vp run build && vp run test
If a template itself is wrong or outdated, fix it in the repository instead of only patching the generated project.
liangmiQwQ/new模板位于本文件旁的 中。加载 以选择技术栈,然后使用本文件旁的脚本生成脚手架:
templates/$choosing-toolsbash
scripts/scaffold.sh <stack> <root>/<owner>/<repo> <owner> <repo> "<description>"| 技术栈 | 层级 | 适用场景 |
|---|---|---|
| | Rust crates 和 CLI |
| | npm 库 |
| | Node.js 命令行工具 |
网站和 napi-rs 项目目前尚无模板。需要手动构建,但仍应遵循 层及下述各方面要求。
common该脚本会按顺序复制各层,将 路径重命名为 ,将 路径重命名为仓库名称,填充机械性占位符,并运行各层的 以添加采用最新版本的依赖。绝不要将其他项目中固定版本的依赖复制到新项目中。
_name.name__repo__setup.sh生成脚手架后:
- 填写脚本输出的每个 占位符,这些内容大多位于
{{TODO: ...}}中。如果不需要某个章节,应直接删除,而不是留下空章节。新项目的AGENTS.md应保持简短(约 40 行),只记录不易理解的规则和易踩坑之处。AGENTS.md - 根据项目调整脚手架:软件包名称(例如带 scope 的 npm 名称)、额外的 crates 或 packages、CLI binaries 以及 CI matrix。
- 完成前运行相应技术栈的检查:Rust 使用 ,JavaScript 使用
just ready。vp run check && vp run build && vp run test
如果模板本身有误或已过时,应在 仓库中修复,而不应只修补生成的项目。
liangmiQwQ/newRelated skills
相关 skill
When you are initializing a project, like handling infrastructure and related data, you are supposed to load skills. You can also use to find how my other projects use CI and tools. Load for details of the preset in JavaScript projects.
$choosing-tools$global-projects$use-vp-config@liangmi/vp-config初始化项目时,包括处理基础设施和相关数据,应加载 skill。也可以使用 了解我的其他项目如何使用 CI 和工具。对于 JavaScript 项目中 预设的详细信息,请加载 。
$choosing-tools$global-projects@liangmi/vp-config$use-vp-configAspects of a project
项目的各个方面
When you are initializing a project, you should care about these aspect:
- Project layout (single-package, or a workspace, one language or multiple-languages mixed)
- Basic toolchain (Do not only care about build, care about linting, formatting, testing, git hooks, staging)
- Package Release (Skip for website, how to trigger, maintenance comment in response, GitHub compatible)
- CI checking (Add CI checks, including test, build, snap tests, e2e tests, codestyle, linting, formatting)
- Document placeholder (MIT License or other license as required, basically README.md)
- Editor settings (folder, format and lint)
.vscode - Scripts (For manually validation, and installing the developing products onto the using computer)
- Deploy (Websites)
- Tools version (Node version, Rust version)
- GitHub repo description, PR merge setting (Squash, Description as message, Auto delete branch)
- AGENTS.md document
You should prepare them in detail but should not make them too complex, for example, linting CI shouldn't be run on all macOS, Linux and Windows, a small library also doesn't need a VitePress website for docs, shouldn't be provided most of the time.
.editorconfig初始化项目时,应关注以下方面:
- 项目布局(单包或 workspace、单一语言或多语言混合)
- 基础工具链(不要只关注构建,还要关注 linting、格式化、测试、git hooks、staging)
- 软件包发布(网站可跳过;如何触发、响应中的维护说明、兼容 GitHub)
- CI 检查(添加 CI 检查,包括 test、build、snap tests、e2e tests、codestyle、linting、formatting)
- 文档占位内容(按要求提供 MIT License 或其他许可证,基本要求是 README.md)
- 编辑器设置(文件夹、format 和 lint)
.vscode - 脚本(用于手动验证,以及将开发中的产品安装到使用者的计算机上)
- 部署(网站)
- 工具版本(Node 版本、Rust 版本)
- GitHub 仓库描述、PR 合并设置(Squash、Description as message、Auto delete branch)
- AGENTS.md 文档
应详细准备这些内容,但不要做得过于复杂。例如,不应在所有 macOS、Linux 和 Windows 环境中运行 linting CI;小型库也不需要为文档搭建 VitePress 网站;多数情况下无需提供 。
.editorconfig