fix(claudecode):初始化Claudecode时使用CLAUDE.md#271
Conversation
|
I discovered an interesting phenomenon but I'm not sure if it's a bug. Currently, if the user chooses not to modify AGENTS.md, AGENTS.md will also be written into the.template-hashes.json file, and it will be deleted along with it when uninstalling. 我发现了一个有意思的现象但我不确定这是不是BUG,现在如果用户选择不修改AGENTS.md,AGENTS.md也会被写入到.template-hashes.json中,执行uninstall的时候会被一起删掉 Perhaps it would be better to restore AGENTS.md to its state before the user executed the init command. |
|
trellis init 的时候本身是不需要 AGENTS.md / CLAUDE.md 的,因为都是通过 hook 注入,然后 AGENTS.md 因为是个开放标准所以才搞得; |
If Trellis does not need to use AGENTS.md to achieve the effect of emphasizing commands, can it not operate AGENTS.md when running the trellis init command? If we need to generate AGENTS.md, wouldn't it be better to consider adapting it to the standards of Claude? I feel this statement is a bit strange because Claudecode doesn't seem to read AGENTS.md, or it could write a CLAUDE.md file that imports AGENTS.md. However, from a standard perspective, it seems a bit awkward. If you don't want to delete AGENTS.md, the simplest way is not to generate it. Then, don't write it into .template-hashes.json (this will have an adverse effect as it will modify the user's AGENTS.md). It seems to me that trellis uninstall deletes files based on the content of .template-hashes.json. |
trellis init walked managed dirs (.codex/, .claude/, .opencode/) and hashed every file into .template-hashes.json — including pre-existing user data (.codex/sessions/, .claude/projects/, user-owned AGENTS.md). trellis uninstall then unlinked every manifest entry, deleting that user data. Two real reports: GitHub Issue #221 (.codex/sessions/ wiped) and PR #271 (pre-existing AGENTS.md wiped via skip-existing path). Manifest is now derived from "what trellis actually wrote this run", not from walking the disk: - writeFile() instruments recordWrite() on actual disk writes only. byte- identical, skip-existing, and append paths do NOT record. initializeHashes consumes the recorded set instead of fs.readdirSync walks. - Root-level AGENTS.md only enters manifest when trellis writes it. - pruneOrphanManifestKeys() self-heals already-poisoned manifests at the top of both trellis update and trellis uninstall. Preserves .trellis/* (still walk-managed), every configured-platform collectTemplates() path, every path referenced by any migration manifest from/to, and AGENTS.md only when it still carries trellis managed-block markers. - Homedir guard: trellis init / uninstall refuse to run when cwd is exactly the user's home directory (realpathSync.native + Windows lowercase). Bypass via TRELLIS_ALLOW_HOMEDIR=1; --force does not bypass. .trellis/ files keep their existing walk-based hashing — trellis uninstall rm -rf's that subtree wholesale regardless of manifest content, so over- hashing there does not affect uninstall safety. Internal: - New utils/cwd-guard.ts and utils/manifest-prune.ts. - claude configurator excludes dev-only .ts from its template walk. - 27 new tests across recorder boundaries, prune semantics, homedir cases, and full init+uninstall reproductions for both reported scenarios. Spec: - .trellis/spec/cli/backend/migrations.md adds "Manifest ownership contract" with the recorder rules, prune preserve-set, homedir guard, wrong-vs- correct, and tests required for any future change in this area.
trellis init walked managed dirs (.codex/, .claude/, .opencode/) and hashed every file into .template-hashes.json — including pre-existing user data (.codex/sessions/, .claude/projects/, user-owned AGENTS.md). trellis uninstall then unlinked every manifest entry, deleting that user data. Two real reports: GitHub Issue #221 (.codex/sessions/ wiped) and PR #271 (pre-existing AGENTS.md wiped via skip-existing path). Manifest is now derived from "what trellis actually wrote this run", not from walking the disk: - writeFile() instruments recordWrite() on actual disk writes only. byte- identical, skip-existing, and append paths do NOT record. initializeHashes consumes the recorded set instead of fs.readdirSync walks. - Root-level AGENTS.md only enters manifest when trellis writes it. - pruneOrphanManifestKeys() self-heals already-poisoned manifests at the top of both trellis update and trellis uninstall. Preserves .trellis/* (still walk-managed), every configured-platform collectTemplates() path, every path referenced by any migration manifest from/to, and AGENTS.md only when it still carries trellis managed-block markers. - Homedir guard: trellis init / uninstall refuse to run when cwd is exactly the user's home directory (realpathSync.native + Windows lowercase). Bypass via TRELLIS_ALLOW_HOMEDIR=1; --force does not bypass. .trellis/ files keep their existing walk-based hashing — trellis uninstall rm -rf's that subtree wholesale regardless of manifest content, so over- hashing there does not affect uninstall safety. Internal: - New utils/cwd-guard.ts and utils/manifest-prune.ts. - claude configurator excludes dev-only .ts from its template walk. - 27 new tests across recorder boundaries, prune semantics, homedir cases, and full init+uninstall reproductions for both reported scenarios. Spec: - .trellis/spec/cli/backend/migrations.md adds "Manifest ownership contract" with the recorder rules, prune preserve-set, homedir guard, wrong-vs- correct, and tests required for any future change in this area. (cherry picked from commit c76ff33)
|
When using trellies init command and select claude code, initialize CLAUDE.md instead of AGETNS.md.
使用trellies init 命令初始化并选择Claudecode时创建CLAUDE.md而不是AGETNS.md