global-projects

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Global Projects

全局项目

Use this skill to follow the user's project organization standard. The project CLI is installed as either
moi
(try first) or
mo
; the skill is mainly about the directory standard and when to use the selected command. The document will use
mo
as an example.
Standard layout:
text
<rootPath>/<github-owner-or-org>/<repo>
Examples:
text
~/code/vuejs/core
~/code/vitejs/vite
~/code/liangmiQwQ/mo
使用此 skill 遵循用户的项目组织规范。项目 CLI 已安装为
moi
(优先尝试)或
mo
;此 skill 主要介绍目录规范以及何时使用所选命令。文档将以
mo
为例。
标准布局:
text
<rootPath>/<github-owner-or-org>/<repo>
示例:
text
~/code/vuejs/core
~/code/vitejs/vite
~/code/liangmiQwQ/mo

First Step

第一步

Skill loading does not automatically execute commands. When a task needs the project root, select the CLI and run its paired resolver first:
bash
if command -v moi-get-root >/dev/null 2>&1; then
  moi-get-root
elif command -v mo-get-root >/dev/null 2>&1; then
  mo-get-root
else
  echo "Install @liangmi/moi or @liangmi/mo before resolving global projects." >&2
  exit 1
fi
Prefer
moi
when both resolver commands exist. The resolver only reads
~/.config/morc.json
and prints JSON with
rootPath
. If
rootPath
is missing, ask the user before creating or cloning anything; they may need to run
moi setup
or
mo setup
for the selected CLI.
Use the command paired with the resolver for the rest of the task:
moi-get-root
selects
moi
, while
mo-get-root
selects
mo
. Never identify the project CLI from the
mo
command alone because another tool may own that name. The examples below use
mo
; substitute
moi
when
moi-get-root
was selected.
加载 skill 不会自动执行命令。当任务需要项目根目录时,先选择 CLI 并运行与之配对的解析器:
bash
if command -v moi-get-root >/dev/null 2>&1; then
  moi-get-root
elif command -v mo-get-root >/dev/null 2>&1; then
  mo-get-root
else
  echo "Install @liangmi/moi or @liangmi/mo before resolving global projects." >&2
  exit 1
fi
当两个解析器命令都存在时,优先使用
moi
。解析器仅读取
~/.config/morc.json
并输出包含
rootPath
的 JSON。如果缺少
rootPath
,请先询问用户,再创建或克隆任何内容;用户可能需要为所选 CLI 运行
moi setup
或
mo setup
。
在任务后续部分,使用与解析器配对的命令:
moi-get-root
对应
moi
,
mo-get-root
对应
mo
。不要仅凭
mo
命令判断项目 CLI,因为其他工具也可能使用该名称。下面的示例使用
mo
;如果选择了
moi-get-root
,则替换为
moi
。

Project Path Rules

项目路径规则

After resolving
rootPath
, infer paths yourself.
For a GitHub repo identifier, join the pieces directly:
text
owner/repo -> <rootPath>/owner/repo
For a GitHub URL:
text
https://github.com/vitejs/vite -> <rootPath>/vitejs/vite
git@github.com:vuejs/core.git -> <rootPath>/vuejs/core
For a bare project name or fuzzy query:
  1. Run the selected CLI's
    list
    command or inspect one level under
    rootPath
    .
  2. Prefer exact repo-name matches.
  3. Prefer exact
    owner/repo
    matches when the user gave an owner.
  4. If multiple owners match, ask the user to choose.
  5. Use the resolved path directly for file operations.
Pay attention, the codebase may be not up to dated or even not in the main branch so please take care and use tricks to check.
解析
rootPath
后,自行推断路径。
对于 GitHub 仓库标识符,直接连接各部分:
text
owner/repo -> <rootPath>/owner/repo
对于 GitHub URL:
text
https://github.com/vitejs/vite -> <rootPath>/vitejs/vite
git@github.com:vuejs/core.git -> <rootPath>/vuejs/core
对于仅提供项目名称或使用模糊查询的情况:
  1. 运行所选 CLI 的
    list
    命令,或检查
    rootPath
    下一层的内容。
  2. 优先选择仓库名称完全匹配的项目。
  3. 如果用户提供了 owner,优先选择
    owner/repo
    完全匹配的项目。
  4. 如果有多个 owner 匹配,请让用户选择。
  5. 直接使用解析出的路径进行文件操作。
请注意,代码库可能不是最新版本,甚至可能不在主分支上,因此请谨慎处理,并使用相应技巧进行检查。

Project CLI Command Usage

项目 CLI 命令用法

Use the selected project CLI when you need to clone/fork/create a project. Once you know the local path, use normal shell and editor tooling for ordinary file reads, edits, builds, and tests.
Use
mo list
to discover existing managed repositories:
bash
mo list
Use
mo clone <owner>/<repo>
when the user wants a GitHub project locally and it is not already under
<rootPath>/<owner>/<repo>
. This preserves the owner/repo layout:
bash
mo clone vitejs/vite
Use
mo init
to make a local project initialized using git and create a GitHub repo, only when the user explicitly asks to create/init a project:
bash
mo init [options]
当需要克隆、fork 或创建项目时,使用所选的项目 CLI。确定本地路径后,对于常规文件读取、编辑、构建和测试,使用普通的 shell 与编辑器工具。
使用
mo list
查找已有的受管理仓库:
bash
mo list
当用户希望在本地获取某个 GitHub 项目,且该项目尚不在
<rootPath>/<owner>/<repo>
下时,使用
mo clone <owner>/<repo>
。这会保留 owner/repo 布局:
bash
mo clone vitejs/vite
仅当用户明确要求创建或初始化项目时,使用
mo init
通过 git 初始化本地项目并创建 GitHub 仓库:
bash
mo init [options]

Options, at least one of them should be provided if you

Options, at least one of them should be provided if you

--public Create as public repository

--public Create as public repository

--private Create as private repository

--private Create as private repository


`mo init` can change remote GitHub state. Treat it as a dangerous command.

Use `mo fork` only when the user explicitly asks to fork or create a fork:

```bash
mo fork vitejs/vite
mo fork vitejs/vite --org my-org
mo fork vitejs/vite --name my-vite
Forking also changes remote GitHub state. Treat it as a dangerous command. Do not fork for inspection, editing, testing, cloning, opening, or convenience. It also includes some prompts you need to answer.

`mo init` 可能会更改远程 GitHub 状态,应将其视为危险命令。

仅当用户明确要求 fork 或创建 fork 时,使用 `mo fork`:

```bash
mo fork vitejs/vite
mo fork vitejs/vite --org my-org
mo fork vitejs/vite --name my-vite
Fork 同样会更改远程 GitHub 状态,应将其视为危险命令。不要为了检查、编辑、测试、克隆、打开项目或图方便而执行 fork。该命令还包含一些需要回答的提示。

Working Standard

工作规范

  • Search under
    rootPath
    before broad filesystem scans.
  • Preserve the
    <owner>/<repo>
    organization when cloning projects.
  • Avoid creating project directories outside
    rootPath
    unless the user asks.
  • Name both owner and repo in status updates for cross-project work.
  • Use the selected project CLI for repository discovery and placement; use normal shell and editor tooling once the local path is known.
  • 在
    rootPath
    下搜索,避免对整个文件系统进行广泛扫描。
  • 克隆项目时保留
    <owner>/<repo>
    组织结构。
  • 除非用户另有要求,否则避免在
    rootPath
    之外创建项目目录。
  • 进行跨项目工作时,在状态更新中同时注明 owner 和 repo。
  • 使用所选项目 CLI 发现和安置仓库;确定本地路径后,使用普通的 shell 与编辑器工具。