fix(scripts): handle Windows path separators in skill catalog discovery #2050
<!-- coderabbit-ai-generated:v1 -->
<!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- review_stack_entry_start -->
<a href="https://app.coderabbit.ai/change-stack/mvschwarz/openrig/pull/2050?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a>
<!-- review_stack_entry_end -->
<!-- recent_review_start -->
No actionable comments were generated in the recent review.
<details>
<summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="16" height="16" align="absmiddle" alt=""></picture> Recent review info</strong></summary>
<dl>
<dd>
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary>
<dl>
<dd>
14fe1f7c-2ea5-476b-ac5e-2a32613f7fb2</dd>
</dl>
</details>
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary>
<dl>
<dd>
Reviewing files that changed from the base of the PR and between 5ef718c4d5e7c161cc06f4fded80f32edc1f9880 and 1c91a8b5ccfc4635ad99ce617c709fd4aacc5c36.
</dd>
</dl>
</details>
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 1</strong></summary>
<dl>
<dd>
scripts/check-first-run-references.mjs</dd>
</dl>
</details>
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
</dd>
</dl>
</details>
<!-- recent_review_end -->
<!-- walkthrough_start -->
<details>
<summary><strong>Walkthrough</strong></summary>
<dl>
<dd>
The shipped-skill scan now identifies SKILL.md files by basename instead of requiring the path to end in /SKILL.md.
Changes: Shipped-skill scan
|Layer / File(s)|Summary|
|:---|:---|
|Match skill files by basename <br> scripts/check-first-run-references.mjs|The skill scan now matches files whose basename is SKILL.md.|
<!-- change_assessment_start -->
<strong>Priority: <picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/priority-low-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Low</strong>
Estimated code review effort: 2 (Simple) | ~5 minutes
<!-- change_assessment_commit:"1c91a8b5ccfc4635ad99ce617c709fd4aacc5c36" -->
Change: Bug fix
<!-- change_assessment_end -->
Suggested reviewers: mvschwarz
</dd>
</dl>
</details>
<!-- walkthrough_end -->
<details>
<summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>1c91a</code></summary>
<dl>
<dd>
<!-- final_review_risk_start -->
<!-- final_review_risk_label
Merge Risk: ⚪ Minimal · up to 1c91a
-->
<!-- final_review_risk_coverage:{"sourceCommitId":"1c91a8b5ccfc4635ad99ce617c709fd4aacc5c36","coveredCommitId":"1c91a8b5ccfc4635ad99ce617c709fd4aacc5c36","kind":"reviewed"} -->
The focused cross-platform discovery change is mergeable.
<!-- final_review_risk_end -->
</dd>
</dl>
</details>
<!-- pre_merge_checks_walkthrough_start -->
<details>
<summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary>
<dl>
<dd>
<strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 warning</strong>
| Check name | Status | Explanation | Resolution |
| :---------------- | :----------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- |
| Docstring Coverage | !Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
<details>
<summary><strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> Passed checks: 4 passed</strong></summary>
<dl>
<dd>
| Check name | Status | Explanation |
| :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------- |
| Description Check | !Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | !Passed | The title clearly and concisely describes the main change: handling Windows path separators during skill catalog discovery. |
| Linked Issues check | !Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | !Passed | Check skipped because no linked issues were found for this pull request. |
</dd>
</dl>
</details>
</dd>
</dl>
</details>
<!-- pre_merge_checks_walkthrough_end -->
<!-- finishing_touch_checkbox_start -->
<details>
<summary><strong>Finishing Touches</strong></summary>
<dl>
<dd>
<details open>
<summary><strong>🧪 Generate unit tests (beta)</strong></summary>
<dl>
<dd>
</dd>
</dl>
</details>
</dd>
</dl>
</details>
<!-- finishing_touch_checkbox_end -->
<!-- autopilot:start -->
<!-- autopilot:end -->
<!-- tips_start -->
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.
<details>
<summary><strong>❤️ Share</strong></summary>
<dl>
<dd>
</dd>
</dl>
</details>
<sub>Comment @coderabbitai help to get the list of available commands.</sub>
<!-- tips_end -->
Admitted at 1c91a8b5ccfc4635ad99ce617c709fd4aacc5c36. The native path.basename check fixes Windows skill-file discovery without changing reference parsing or validation. I read both independent source-review returns and the complete one-line diff, verified all eight required checks on this exact head, and checked its unchanged target file against current main. The contributor's native Windows run remains attributed, not a run of my own.
— orch-lead@v-openrig-build
Thanks, @DeryFerd, for #2050. It's merged into main as 9166d061, and it isn't in a release yet. With it, scripts/check-first-run-references.mjs matches the shipped SKILL.md files with path.basename(p) === "SKILL.md" instead of a hard-coded /SKILL.md suffix, so it finds them with Windows path separators too, and nothing changes on other platforms. Thanks too for the native Windows before-and-after run, which shows it no longer stops with an empty skill catalog there.
@mvschwarz you are welcome
openrig-review
DeryFerd
What a user gets
npm run test:repoand the first-run reference validation script now pass on Windows without crashing on skill catalog discovery.scripts/check-first-run-references.mjswalks the shipped skill roots to assemble an authority map of available skills before checking that first-run surfaces (getting-started.md,quickstart.md, operator guidance, and setup next-steps) name existing skills. Becausewalk()joins directory segments withpath.join(), on Windows every walked file path uses backslashes (such aspackages\daemon\assets\skills\rigs\SKILL.md), but the file filter checkedp.endsWith("/SKILL.md")with a hardcoded forward slash. That filter never matched on Windows, leavingskillsempty and throwingError: empty shipped skill catalogbefore any references could be validated. Switching the check topath.basename(p) === "SKILL.md"allows skill files to be found regardless of OS path separator, matching the idiom already used byscripts/mirror-skills.mjsandscripts/generate-context-packs.mjs.Nothing in the authority model, reference parsing, or validation rules changes. Shipped skill names are still keyed by their parent directory name (
path.basename(path.dirname(file))), their relative repository paths are still recorded identically, and POSIX environments continue to discover the exact same catalog of 53 shipped skills.How you verified it
Tested on a native Windows host at commit
00e2c806with the change on top. Before the change, runningnode --import tsx scripts/check-first-run-references.mjsimmediately failed withError: empty shipped skill catalog(exit code 1) because zero skills matched the filter. After changing the filter topath.basename(p) === "SKILL.md", the discovery loop populated all 53 shipped skills, and the script ran to completion checking 10 scoped files, 489 concrete references, 0 failures, and 6 unchecked external bundle references.Commands run and observed output:
What I could not run: full end-to-end
npm testacross all workspaces on this machine, which is a native Windows host where tmux-dependent daemon suites are skipped or require Linux CI containers. The repository checks that run as part oftest:repowere run directly and succeed.Anything you were unsure about
I considered
p.endsWith(path.sep + "SKILL.md")versuspath.basename(p) === "SKILL.md". Both solve the separator difference on Windows, butpath.basenameis simpler and matches what sibling repository scripts already do:scripts/mirror-skills.mjs(lines 255, 338, 853) andscripts/generate-context-packs.mjs(lines 120, 206) both use basename equality to detectSKILL.md. I also checked the rest ofscripts/check-first-run-references.mjsfor other slash-filtering assumptions: line 183 was the only place filteringwalk()output with a hardcoded forward slash prefix.If this is security-related
Not security-related. The change is restricted to developer verification tooling in
scripts/and touches no daemon routes, credentials, runtime permissions, or delivery boundaries.CHANGELOG.mdedit<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
Improved detection of shipped skill files, including files specified without a directory path.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->