Repository navigation
fix(cli): validate the folder of a SKILL.md or workflow-rules.mdc argument - #556
Conversation
…ument `validate path/to/SKILL.md` passed the file itself to Tier 1 and Tier 2, while Tier 3 already used the folder that holds it. The schema, version and quality checks then failed with "No skills found", a run narrowed with --checks could pass without scanning the skill's other files, the results carried the file name as the skill name, and a run from inside the skill wrote its default reports into it. A workflow-rules.mdc argument failed the same way with "No workflow directories found". When the detected or forced type is skill and the argument is a SKILL.md (any case), or the type is workflows and the argument is workflow-rules.mdc, validate now uses the folder that holds the argument for every tier, the publication name and the default report location. The folder is taken from the path as given before it is resolved, so a linked manifest validates the folder that holds the link. Other files, such as a script inside a skill, are still validated as given, and rules and plugin manifests are unchanged. Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Passing a SKILL.md or workflow-rules.mdc now makes the folder that holds it the Tier 1 and Tier 2 root. The Tier 2 guard that refuses a symlinked or reparse-point root still checked only the argument as typed, so `validate linked-skill/SKILL.md` sent the whole folder behind the link to Tier 2, while `validate linked-skill` is refused. Check that folder with the same guard before using it, so the file form is refused the same way. The changelog entry now says Tier 1 and Tier 2 received the file itself, which is what happened before. Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fest argument A SKILL.md or workflow-rules.mdc argument now stands for the folder that holds it, so the checks that apply to a folder argument apply to it too. Pin the two that change what a user sees: - A SKILL.md inside a symlinked skill folder is refused with exit 2, the same as passing that folder, with the default tiers and with --tiers 1, because the guard runs before --tiers narrows the run. With --no-dedup the file form gives the same report as the folder form. - An explicit --output-dir inside the skill is refused, the same as for the folder argument, instead of writing the reports into the skill. Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The entry for SKILL.md and workflow-rules.mdc arguments said only that schema, version and quality failed with "No skills found". A workflow-rules.mdc argument failed the schema check with "No workflow directories found" instead, so name both messages. It also gave no hint that a file inside a symlinked folder is now refused unless --no-dedup is passed, as that folder already is. Before, such a run with --tiers 1 passed; a CI job that validates a SKILL.md through a symlinked skills folder now stops with exit 2. Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rng1995
left a comment
There was a problem hiding this comment.
This fixes a real problem cleanly. A SKILL.md or workflow-rules.mdc argument is now mapped to its folder in one small block, so every tier, the report name and the report location match the folder form. The symlink refusal and the report location check are reused rather than copied, and the tests compare the file form against the folder form for findings, refusals and report placement. What remains is minor. Nothing pins the any-case SKILL.md match. The new code comment calls the mapping existing Tier 3 behavior, but for workflows it is new. And the claim that other files are never widened to a folder holds only for Tier 1 and Tier 2.
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
skill.md is a supported manifest name, and a path typed in lowercase reaches the same check on case-insensitive filesystems. Validate a skill whose manifest is named skill.md through that file and through its folder, and require the same report. An exact-case match on SKILL.md would validate the file alone and fail with No skills found. Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A workflow-rules.mdc argument now stands for its workflow folder in every tier. Run Tier 1 and Tier 3 on that file and require both to receive the folder. Before, Tier 3 received the file itself. Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tier 3 already took the folder of a SKILL.md argument, but it received a workflow-rules.mdc argument as the file. Say so in the code comment, and note in the CHANGELOG entry that Tier 3 now receives the workflow folder too. Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chrisknvidia
left a comment
There was a problem hiding this comment.
Needed: yes. On current main validate path/SKILL.md fails with 'No skills found' on a clean skill, validate wf/workflow-rules.mdc fails the same way, and a run from inside the skill writes reports/ into it. Worse, with --checks unicode the file form exits 0 on a skill that hides characters in a script where the folder form exits 1, because only SKILL.md gets scanned. The change is small, and the symlink and --output-dir refusals are reused rather than copied.
What I raised earlier is fixed: the CHANGELOG conflict is gone, a lowercase skill.md now has a test (I checked that making the comparison case-sensitive fails it), and the Tier 3 change for workflows is in the code comment, the CHANGELOG and the description. The new tests pass here (35 passed) and 12 of them fail against current main, so they do check the fix. CI is green and the branch merges cleanly into main.
One small gap, not blocking: a SKILL.md that is a symlink to a file with a different name (for example guide.md) is still not mapped when --no-dedup is passed, because the type is detected on the resolved path. The file form then exits 0 as unknown while the folder form runs the manifest checks. I left an inline note with the repro. Fine to merge as is, or fix it here. Looks good to merge otherwise.
validate detected the content type on the resolved path, so a SKILL.md that is a symlink to a file with another name, such as shared/guide.md, read as an unknown type and was validated as that single file. With --no-dedup, which lets a linked manifest through, the folder exited 1 on a script with hidden characters while the file argument exited 0. A file passed as SKILL.md or workflow-rules.mdc is now a manifest by the name it was passed under. With the auto type, or a --type that matches the manifest, it validates the folder that holds the link. The linked-root refusal in the default run is unchanged. Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
|
Review follow-up on No new PR-introduced defect confirmed. The previous symlink-to-differently-named-file issue is fixed by retaining the requested manifest name before type resolution. All 41 manifest/default CLI tests pass. Real subprocess runs with folder and SKILL.md arguments both detected hidden Unicode in a bundled script, exited 1 and wrote whole-skill JSON/terminal reports. Paid Tier 3 execution and dedup embeddings were not run. Please resolve the current merge conflict and retain the manifest/type/symlink/report-placement behavior. |
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
skillevaluator validate path/to/SKILL.mdpassed the file itself to Tier 1 and Tier 2, while Tier 3 already used the folder that holds it. Theschema,versionandqualitychecks failed withNo skills foundand the run exited 1, even for a clean skill. A run narrowed with--checks(for example--checks code-integrityor--checks unicode) could pass with exit 0 without scanning the skill's scripts, while the folder form failed. Results named the skillSKILL.md, and a run from inside the skill wrote its reports into the skill.validate path/to/workflow-rules.mdcfailed the same way, withNo workflow directories foundfrom theschemacheck, and Tier 3 also received the workflow file itself.Now a
SKILL.mdargument (any case, such asskill.md) or aworkflow-rules.mdcargument is validated as the folder that holds it, for every tier, the publication name and the report location. The argument's own name decides this, so with--no-dedupaSKILL.mdthat is a symlink to a file with another name, such asshared/guide.md, also validates its folder. A--typethat names another type keeps the file. The file form now gets the same refusals as the folder form. An explicit--output-dirinside the skill is refused, as it is for the folder argument. When the folder is a symlink or reparse point, the run is refused unless--no-dedupis passed, even with--tiers 1.Changes
validatekeeps the argument as typed. A file argument namedSKILL.md(case-insensitive) is a skill manifest, and one namedworkflow-rules.mdcis a workflow manifest, by the name as typed. With--type auto, that name gives the type, so detection does not read the file a link points to. Other files are detected as before.--type auto, or a--typethat names the manifest's own type,validatetakes the folder of the typed path, resolves it, and recomputes the publication name from it. A--typethat names another type keeps the file, as before:--type workflowson aSKILL.md, or--type ruleson aworkflow-rules.mdc, gives Tier 1 the file with that type.SKILL.mdvalidates the folder that holds the link, the same as passing that folder. This also holds when the link points to a file with another name. Before, with--no-dedup, aSKILL.mdlinked toshared/guide.mdwas detected asunknownand validated alone, so--checks unicodeexited 0 while the folder exited 1, and aworkflow-rules.mdclinked toshared/rules.mdcwas validated as a lone rules file.--no-dedupis passed, that folder goes through the same linked-root guard as a folder argument.validate linked-skill/SKILL.md, wherelinked-skillis a symlink or reparse point, is refused with exit 2, the same asvalidate linked-skill, so Tier 2 never reads the folder behind the link.workflow-rules.mdcargument. Before, it received the file; it already received the folder of aSKILL.md.<skill>-reportsnext to the skill, and an explicit--output-dirinside the skill is refused withReport output must be outside the publication target, as for the folder argument. Before, the file form wrote its reports into the skill in both cases.validate(): a manifest name check that feeds type detection, and the folder mapping after it. The target resolution and Tier 3 path lines are untouched.tests/cli/test_validate_manifest_file.py, andtest_default_autopilot_receives_skill_directory_for_file_inputnow asserts that Tier 1 and Tier 2 also receive the skill folder instead of stubbing them away.Fixedentry in theCHANGELOG.mdUnreleased section.Kept from public
SKILL.mdthat is itself a symlink is refused unless--no-dedupis passed, as before, while its folder is not refused.SKILL.mdargument to its folder. That line stays; for a manifest argument it now receives the folder directly.skills/x/scripts/y.py, Tier 3 and its dataset generation still receive that file's parent folder, as before.security-scan,tier1,tier2andtier3commands keep their own file handling.SKILL.mdfor skills andworkflow-rules.mdcfor workflows, so no docs change was needed.Known trade-offs
SKILL.mdinside a symlinked folder is now refused unless--no-dedupis passed, even with--tiers 1, the same as passing that folder. The guard runs before--tiersnarrows the run. Before,validate linked-skill/SKILL.md --tiers 1 --checks unicodeexited 0; it now exits 2. Pass--no-dedup, or pass the real path instead of the linked one.--no-dedup, aSKILL.mdorworkflow-rules.mdcthat is itself a symlink to a file outside its folder is no longer read by the Gitleaks secret scan, the same as for the folder argument: Gitleaks does not follow the link when it scans a folder. Before, the linked file was scanned on its own. With a GitHub token inshared/guide.md,validate simple/SKILL.md --no-dedup --tiers 1 --checks code-integrityexited 1 onSecrets Detection; it now exits 0, asvalidate simple --no-dedup --tiers 1 --checks code-integritydoes before and after. Aworkflow-rules.mdclinked toshared/rules.mdcbehaves the same way. Theunicodeandpiichecks still read the linked file. Without--no-dedup, such a link is refused, as before. To scan the linked file itself, pass it, as invalidate shared/guide.md.Tests
tests/cli/test_validate_manifest_file.py:schema,version,quality;skill.md;--checks unicode;workflow-rules.mdcargument sends its folder to Tier 1 and Tier 3;SKILL.mdvalidates the link's own folder;--no-dedup, aSKILL.mdorskill.mdlinked toshared/guide.mdgives the same exit code and report as the folder with--checks unicode, with the auto type and with--type skill(4 cases);--no-dedup, aSKILL.mdlinked toshared/guide.mdis refused with exit 2, even with--tiers 1, and validation never runs;--no-dedup, aworkflow-rules.mdclinked toshared/rules.mdcgives the same exit code and report as the folder;SKILL.mdinside a symlinked skill folder is refused with exit 2, like the folder, with the default tiers and with--tiers 1(2 cases), and validation never runs;--no-dedup, aSKILL.mdinside a symlinked skill folder gives the same report as the folder;<skill>-reports;--output-dirinside the skill is refused, like the folder, and nothing is written there;--tiers 1, a non-manifest file inside a skill reaches Tier 1 as given.tests/cli/test_validate_defaults.py.main8b19b2fe3: 17 failed, 2 passed. The 16 parity, refusal, report location and Tier 3 target cases and the changed test fail. Two cases pass onmainby design, as guards: the non-manifest file test and the refusal of aSKILL.mdlinked toshared/guide.mdwithout--no-dedup.tests/cli/test_validate_manifest_file.py: with the manifest name compared case-sensitively, theskill.mdtest and the two linkedskill.mdcases fail and the other 15 pass. With auto-detection reading the resolved file again, only the three linked auto-type cases fail.tests/cli/test_validate_manifest_file.pyandtests/cli/test_validate_defaults.py: 41 passed.tests/cli/test_validate_manifest_file.py,tests/cli/test_validate_defaults.py,tests/cli/test_content_type_detection.py,tests/test_artifact_applicability.py,tests/test_cli.py,tests/test_ci_workflows.py,tests/test_oss_packaging.py,tests/test_ci_change_classifier.py,tests/reporting/test_tier3_completed_agent_docs.py,tests/reporting/test_tier3_token_usage_reports.py,tests/reporting/test_tier3_incomplete_arms.py,tests/test_harbor_claude_refusal_fallback.py: 513 passed, 17 failed. The 17 failures come from the local Harbor version, which is older than the pinned one: 15 intests/test_harbor_claude_refusal_fallback.py(No module named 'harbor.agents.agent_auth_resolution'),test_harbor_environment_kwarg_contract_matches_installed_sourceandtest_validate_tier3_writes_the_same_report_pair. The same 17 fail onmain8b19b2fe3.tests/test_commands.py,tests/cli/test_validate_plugin.py,tests/cli/test_tier_workflows.py,tests/test_catalog_discovery.py: 244 passed.ruff checkandruff format --checkpass on the changed Python files. The OSS boundary scan passes.main8b19b2fe3and merged intomainwithout conflicts.🤖 Generated with Claude Code