scrolls-unhide
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUnhiding docs/.scrolls/
取消 docs/.scrolls/ 的隐藏状态
/scrolls-setup.scrolls.scrollsscrolls/scrolls-hideEverything operates relative to the current working directory unless / says otherwise — not relative to this skill's own location.
-t--reporoot/scrolls-setup.scrolls.scrollsscrolls/scrolls-hide所有操作均相对于当前工作目录,除非使用 / 指定其他路径——而非相对于本工具自身的位置。
-t--reporootCross-platform
跨平台支持
The bundled script ships in two forms: (bash — macOS, Linux, or Windows with Git Bash/WSL) and (PowerShell 7+ — Windows, or macOS/Linux with installed). Both accept the exact same flags in the exact same forms (/, /, /, /) and produce the same output — only the launcher differs. Pick by what's actually available: try ; if that succeeds, use ; otherwise use via (preferred — install from https://aka.ms/powershell if missing) or, only if genuinely isn't available, the built-in Windows PowerShell (untested against that older version; is what this was written and verified against).
unhide.shunhide.ps1pwsh-p--path-t--reporoot-l--local-r--recursebash --version.sh.ps1pwshpwshpowershell.exepwsh附带的脚本提供两种形式:(bash 脚本——适用于 macOS、Linux 或安装了 Git Bash/WSL 的 Windows)和 (PowerShell 7+ 脚本——适用于 Windows,或安装了 的 macOS/Linux)。两者接受完全相同的选项和格式(/, /, /, /),输出结果也一致——仅启动方式不同。根据实际可用环境选择:先尝试运行 ;如果成功,使用 脚本;否则通过 使用 脚本(推荐——若未安装可从 https://aka.ms/powershell 获取),只有当 确实不可用时,才使用 Windows 内置的旧版 PowerShell (未针对该旧版本测试;本脚本基于 编写并验证)。
unhide.shunhide.ps1pwsh-p--path-t--reporoot-l--local-r--recursebash --version.shpwsh.ps1pwshpowershell.exepwshOptions
选项说明
Read the invocation text for these, in any order — there's no real argv parser here, so pull them out of the plain text yourself:
- /
-p <path>/--path=<path>— a base directory to operate on, instead of the current directory. Repeatable, to target several locations in one run (e.g.--path <path>in a monorepo).-p packages/api -p packages/web - /
-t— use the git repository's top level (--reporoot) as the base directory, regardless of which subdirectory you actually invoked this from. Fails with a clear message if the current directory isn't inside a git repository.$(git rev-parse --show-toplevel) - /
-l— use the current working directory as the base directory explicitly. This is what happens by default anyway when none of--local/-p/-tare given — the flag exists to say so on purpose.-l - /
-r— search recursively under the base directory for scrolls folders, instead of checking only its exact--recurse. Matches the usual meaning ofdocs/.scrollson tools like-r/grep/cp: off by default, opt in to widen the blast radius. Combine with any of the above (or with none, recursing from cwd).rm
-p-t-l-t-l-p-p-rDEFAULT_SCROLLS_RELPATH-t-r以下选项可按任意顺序传入——此处没有真正的参数解析器,需从文本中自行识别:
- /
-p <path>/--path=<path>—— 指定操作的基础目录,替代当前目录。可重复使用,一次处理多个位置(例如在单体仓库中使用--path <path>)。-p packages/api -p packages/web - /
-t—— 将 git 仓库的顶层目录(--reporoot)作为基础目录,无论实际调用时处于哪个子目录。如果当前目录不在 git 仓库内,会输出清晰的错误信息。$(git rev-parse --show-toplevel) - /
-l—— 明确将当前工作目录作为基础目录。当未指定--local/-p/-t时,默认就是此行为——该选项用于显式声明此操作。-l - /
-r—— 在基础目录下递归搜索 scrolls 文件夹,而非仅检查精确的--recurse路径。与docs/.scrolls/grep/cp等工具中rm的常规含义一致:默认关闭,开启后扩大扫描范围。可与上述任意选项组合使用(或不组合,从当前目录开始递归)。-r
-p-t-l-t-l-p-p-rDEFAULT_SCROLLS_RELPATH-t-rSteps
操作步骤
1. Run the bundled script
1. 运行附带脚本
bash <skill-dir>/scripts/unhide.sh [-p BASE ...] [-t] [-l] [-r]
pwsh <skill-dir>/scripts/unhide.ps1 [-p BASE ...] [-t] [-l] [-r]Pass through whatever flags the user gave, in the same forms, to whichever of the two matches the environment (see "Cross-platform" above). Omit them entirely to use the default. The script, for each resolved base directory:
- Without (default): checks exactly one spot — the base directory itself if it already is a scrolls folder (has
-r), otherwiseSTARTER.md. Fast, and matches the location<base>/docs/.scrolls//scrolls-setupuse by default, so a bare invocation targets the obvious place first./scrolls-update - With /
-r: searches a bounded number of levels deep under the base directory for directories literally named--recursecontaining a.scrolls— that guard is what makes recursing from a broad base (even the whole repo) safe: coincidentally-named directories without aSTARTER.mdare ignored, and common heavy/vendor directories (STARTER.md,node_modules,.git,vendor,dist,build,.venv,venv,__pycache__,target,.next) are pruned rather than descended into..cache
For each match found (either way):
- Skips it (reporting why) if a folder already sits alongside it; otherwise renames it with
scrollswhen the repo and file are git-tracked (preserving history), falling back to a plaingit mvotherwise.mv - Rewrites the reference to the old path inside the moved folder's own files (this catches , which references its own path throughout) and, if present, in the one
STARTER.mdfile that's an exact sibling ofCLAUDE.mdfor that folder — never a broader search fordocs.CLAUDE.mdwrites a short, portable reference (/scrolls-setup) relative to whereverdocs/.scrollsitself lives, so in a multi-location sweep two different scrolls folders can legitimately share that exact same short string; a "helpfully" broader search for matchingCLAUDE.mdfiles would risk rewriting an unrelated sibling package's file. (The rewrite also tries the full path as discovered, for scrolls folders set up with a customCLAUDE.mdunder the older convention.)--path - Prints any other files nearby that still mention the old path — these are reported, not edited, and are excluded from inside other scrolls folders (a common source of false positives under the shared short-form convention) but can still include a false-positive sibling occasionally — that's expected, see step 2 below. The script deliberately doesn't touch files outside the scrolls folder and its own
CLAUDE.md, since rewriting arbitrary prose (READMEs, CI configs, other docs) without reading it first risks corrupting unrelated content.CLAUDE.md
Exits with an error if a given base directory has no matching folder — without , that's the signal to check the path, try if you expected the repo root, or add if it might be nested deeper; otherwise point the user at .
-r-t-r/scrolls-setupbash <skill-dir>/scripts/unhide.sh [-p BASE ...] [-t] [-l] [-r]
pwsh <skill-dir>/scripts/unhide.ps1 [-p BASE ...] [-t] [-l] [-r]根据环境(见上文“跨平台支持”),将用户传入的所有选项按原样传递给对应的脚本。若不传入任何选项则使用默认设置。针对每个解析后的基础目录,脚本会:
- 未使用 (默认):仅检查一个位置——如果基础目录本身就是 scrolls 文件夹(包含
-r),则直接处理该目录;否则检查STARTER.md。速度快,且与<base>/docs/.scrolls//scrolls-setup默认使用的位置一致,因此无参数调用会首先定位最明显的位置。/scrolls-update - 使用 /
-r:在基础目录下的有限层级内搜索名称恰好为--recurse且包含.scrolls的目录——该防护机制确保从大范围基础目录(甚至整个仓库)递归搜索是安全的:无STARTER.md的同名目录会被忽略,常见的大型/依赖目录(STARTER.md,node_modules,.git,vendor,dist,build,.venv,venv,__pycache__,target,.next)会被跳过而非深入遍历。.cache
对于找到的每个匹配项(无论哪种方式):
- 如果旁边已存在 文件夹,则跳过该匹配项并说明原因;否则,若目录和文件受 git 跟踪,则使用
scrolls重命名(保留历史记录),否则回退为普通git mv命令。mv - 改写移动后文件夹自身文件内的旧路径引用(这会处理 ,因为它通篇引用自身路径),如果存在与该文件夹的
STARTER.md同级的docs文件,也会改写其中的引用——绝不会全局搜索CLAUDE.md。CLAUDE.md会写入一个简短的可移植引用(/scrolls-setup),相对于docs/.scrolls自身所在位置,因此在多位置扫描时,两个不同的 scrolls 文件夹可能合法共享完全相同的短字符串;“全局”搜索匹配的CLAUDE.md文件可能会改写无关兄弟包的文件。(改写操作也会尝试使用发现的完整路径,以适配旧约定下使用自定义CLAUDE.md设置的 scrolls 文件夹。)--path - 打印附近所有仍提及旧路径的其他文件——这些文件仅被报告,不会被编辑,且会排除其他 scrolls 文件夹内部的文件(在共享短格式约定下,这是常见的误报来源),但偶尔仍可能包含误报的同级 文件——这是预期情况,见下文步骤2。脚本故意不修改 scrolls 文件夹及其自身
CLAUDE.md之外的文件,因为未经阅读就改写任意文本(README、CI 配置、其他文档)可能会破坏无关内容。CLAUDE.md
如果指定的基础目录没有匹配的文件夹,脚本会报错退出——未使用 时,这提示用户检查路径,若期望操作仓库根目录可尝试 ,若文件夹可能嵌套更深可添加 ;否则引导用户使用 。
-r-t-r/scrolls-setup2. Handle the leftover references it reports
2. 处理脚本报告的剩余引用
For each file the script lists under "Other references... left for manual review" — read it and update the reference yourself if it's a genuine stale path (a README, a CONTRIBUTING doc, a CI script), using normal editing judgment rather than blind find-and-replace. Skip anything that isn't actually about this project's scrolls folder (e.g. a coincidental string match).
对于脚本在“其他引用...需手动检查”下列出的每个文件——如果确实是过时路径(如 README、CONTRIBUTING 文档、CI 脚本),则手动读取并更新引用,使用常规编辑判断而非盲目查找替换。跳过与本项目 scrolls 文件夹无关的内容(例如偶然的字符串匹配)。
3. Report back
3. 反馈结果
List each folder that was unhidden (old path → new path), what was auto-fixed for each (its own files, ), any that were skipped and why (target already existed), and what you fixed manually in step 2, if anything.
CLAUDE.md列出每个被取消隐藏的文件夹(旧路径 → 新路径)、每个文件夹自动修复的内容(自身文件、)、被跳过的文件夹及其原因(目标已存在),以及步骤2中手动修复的内容(如有)。
CLAUDE.mdDevelopment
开发说明
tests/scripts/unhide.shscripts/unhide.ps1/scrolls-unhidetests/scripts/unhide.shscripts/unhide.ps1/scrolls-unhide