Skip to content

feat: Git 根初始化写入 checkout 隔离硬约束 - #127

Merged
VirusPC merged 5 commits into
mainfrom
cursor/git-root-worktree-constraint-b100
Nov 14, 2026
Merged

VirusPC merged 5 commits into
mainfrom
cursor/git-root-worktree-constraint-b100

Conversation

@VirusPC

@VirusPC VirusPC commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

做了什么

edges init 的官方模板 packages/skills/edges/references/memory/references/templates/AGENTS.tmpl.md 增加一条 Git 根专用的 checkout 隔离硬约束。模板用 <!-- git-root-constraint --> 标出这一行,落盘时去掉注释。这条规则的正文只在模板里。skill 说明不再复述规则内容和触发细节,memory-init.md 与 LAYOUT.md 只写「Git 根新建入口的硬约束以 AGENTS.tmpl.md 为准」。

为什么这样设,追加在 packages/skills/edges/references/memory/.edges/memory/projects/project_design_decisions/INDEX.md 的「2026-11-14:Git 根新建入口的隔离硬约束以模板为唯一事实源」。没有另开记忆条目,也没有改 project_agents_three_blocks。该文件的作者仍是 viruspc。

本仓根 AGENTS.md 里原来的 worktree 短句改成同一句。下层 AGENTS.md 没有加这句。

随包技能 edges 升到 0.4.6,并写了 changelog。@viruspc/edges 的包版本没有升,变更记在 CLI 与根 changelog 的 Unreleased。dist/ 由构建时的 copy-memory-templates.ts 从模板真源复制,不手改、不入库。

没有把「本仓内容变更走 PR」写进通用种子。全局安装要换仓内 tracked 副本时另开 PR 已经在这句里。init 也会用在不走 PR 的目录上,所以不把「所有内容变更都走 PR」做成每份新入口的默认硬约束。

合入 main 时再打 skill/edges@0.4.6。这个 PR 不打 tag,也不合并。

init 现在怎么写

只在新建 Git 根的 AGENTS.md 时写入。普通仓库的 .git 目录和 worktree 根上的 .git 文件都算。

  • 新建 Git 根 AGENTS.md:硬约束种子是原来的两句,加上这一句。
  • 下层目录,以及还没有 Git 仓库的目录:新建时不写这一句。
  • 已有 AGENTS.md 一律不补这一句。缺硬约束区块时补上的仍是两句通用种子。老仓库要加这句话,人手改或另开 PR。

验证

packages/cli 下跑过新建 Git 根、worktree 根、下层、无 Git,以及已有文件(含缺硬约束区块)的 init 测试。这次只追加设计决策,没有改 CLI,也没有加测试。

Open in Web Open in Cursor 

edges init 只把这条约束写进 Git 根(含 worktree 根)的系统入口。
下层入口不写。已有手写硬约束不覆盖;仍是两句通用种子时,再次 init 补上这一句。

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cheng Peng <VirusPC@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML; Path: .coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 6ab5b576-592d-4359-bfcf-ba94b62e88a6
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

只在新建 Git 根入口时写入。刷新已有文件,包括缺硬约束区块时补种子,都不加这一行。

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cheng Peng <VirusPC@users.noreply.github.com>
cursoragent and others added 3 commits November 14, 2026 13:18
skill 正文不再复述这条规则。Git 根新建入口的硬约束以 AGENTS.tmpl.md 为准。

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cheng Peng <VirusPC@users.noreply.github.com>
这条记忆的正文和 frontmatter 都回到 main 上的原样,不再出现在本 PR。

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cheng Peng <VirusPC@users.noreply.github.com>
按时间追加到 project_design_decisions。作者 frontmatter 仍是 viruspc。

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cheng Peng <VirusPC@users.noreply.github.com>
@VirusPC
VirusPC merged commit 3235974 into main Nov 14, 2026
2 checks passed
VirusPC added a commit that referenced this pull request Nov 14, 2026
把 #127 收进补丁:edges init 只在新建 Git 根 AGENTS.md 时写入 checkout 隔离硬约束,已有文件不回填。随包技能 edges 仍是 0.4.6。

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cheng Peng <VirusPC@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants