reference-module

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Reference Module

参考模块

Use when the user asks to inspect, compare, or research another Git repository.
当用户要求检查、比较或研究其他Git仓库时使用。

Workflow

工作流程

  1. Get the repo URL, plus any requested branch, tag, commit, or alias.
  2. Resolve storage from the active
    SKILL.md
    : find the nearest parent named
    skills
    ; its parent is
    <scope-root>
    . If unavailable, ask for a storage path.
  3. Store references in
    <scope-root>/reference-modules/<name>
    , where
    <name>
    is the alias,
    <owner>/<repo-name>
    when the URL has an owner or group, or the repo basename when it does not. Strip trailing
    .git
    .
  4. If the target exists, ask unless the user already chose:
    • use as-is: do not fetch or check out; report current ref/SHA
    • update: fetch, then check out the requested ref or remote
      HEAD
    • copy: clone into a separate directory; ask for a name unless alias was provided Never modify an unsafe or wrong-repo target without asking.
  5. If the target is missing, clone it. Use remote
    HEAD
    unless a ref was requested.
  6. Fetch only for update/copy:
    bash
    git -C <reference-path> fetch --all --tags --prune
  7. After clone/update/copy, check out the requested ref or remote
    HEAD
    , preferably detached. If the user chose use as-is, leave it untouched.
  8. Treat contents as read-only. Do not create submodules, symlinks, or pointer files unless explicitly asked.
  9. Report path, source URL, action taken, checked-out ref, and commit SHA.
  1. 获取仓库URL,以及任何请求的分支、标签、提交记录或别名。
  2. 从活跃的
    SKILL.md
    中解析存储路径:找到最近的名为
    skills
    的父目录;其父目录为
    <scope-root>
    。如果无法获取,询问存储路径。
  3. 将参考内容存储在
    <scope-root>/reference-modules/<name>
    ,其中
    <name>
    为别名;当URL包含所有者或组时为
    <owner>/<repo-name>
    ;若没有则为仓库基名。去除末尾的
    .git
  4. 如果目标已存在,除非用户已做出选择,否则询问:
    • 直接使用:不进行拉取或检出;报告当前引用/SHA
    • 更新:拉取,然后检出请求的引用或远程
      HEAD
    • 复制:克隆到单独目录;除非已提供别名,否则询问名称 未经询问,绝不要修改不安全或错误的仓库目标。
  5. 如果目标不存在,克隆它。除非请求了特定引用,否则使用远程
    HEAD
  6. 仅在更新/复制时执行拉取:
    bash
    git -C <reference-path> fetch --all --tags --prune
  7. 克隆/更新/复制完成后,检出请求的引用或远程
    HEAD
    ,优选分离头指针模式。如果用户选择直接使用,则保持原样。
  8. 将内容视为只读。除非明确要求,否则不要创建子模块、符号链接或指针文件。
  9. 报告路径、源URL、执行的操作、检出的引用以及提交SHA。