Skip to content

Add mcs pack validate command for local tech pack validation#310

Merged
bguidolim merged 4 commits intomainfrom
bruno/pack-validate
Mar 30, 2026
Merged

Add mcs pack validate command for local tech pack validation#310
bguidolim merged 4 commits intomainfrom
bruno/pack-validate

Conversation

@bguidolim
Copy link
Copy Markdown
Collaborator

Summary

Phase 3 of the three-tier pack validation strategy (Worker → GitHub Actions → CLI). Lets pack authors run mcs pack validate locally during development to catch structural errors and heuristic issues before submitting to the registry.

  • mcs pack validate [source] — accepts a directory path, installed pack identifier, or defaults to CWD
  • Two-stage pipeline: structural validation via ExternalPackLoader.validate(at:), then heuristic checks via new PackHeuristics engine
  • Severity-based findings: errors (empty pack, source: ".", missing settings files) cause exit code 1; warnings (unreferenced files, MCP dependency gaps, python module paths, root-level content) exit 0
  • 7 heuristic checks: empty pack detection, root source copy, missing settingsFile sources, unreferenced subdirectory files, unreferenced root-level content files, MCP runtime dependency gaps, python -m module path verification

New Files

File Purpose
Sources/mcs/Commands/ValidatePackCommand.swift ValidatePack subcommand with path/identifier resolution
Sources/mcs/ExternalPack/PackHeuristics.swift Heuristic validation engine (7 checks, error/warning severity)
Tests/MCSTests/PackHeuristicsTests.swift 19 unit tests for all heuristic checks
Tests/MCSTests/ValidatePackCommandTests.swift 4 argument parsing + subcommand registration tests

Modified Files

File Change
Sources/mcs/Commands/PackCommand.swift Register ValidatePack subcommand
Tests/MCSTests/PackCommandTests.swift Update subcommand count assertion (4→5), add ValidatePack check

Test plan

  • swift test --filter MCSTests.PackHeuristicsTests — 19 heuristic tests pass
  • swift test --filter MCSTests.ValidatePackCommandTests — 4 command tests pass
  • swift test --filter MCSTests.PackCommandParsingTests — existing tests pass with new subcommand
  • swift test — full suite (938 tests, 110 suites) passes with no regressions
  • swiftformat + swiftlint clean
  • Manual: mcs pack validate ~/Developer/bug-shepherd — reports unreferenced files + warnings
  • Manual: mcs pack validate ~/Developer/morning-digest — reports empty pack error (exit 1)
  • Manual: mcs pack validate in a valid pack directory — all checks passed

- New ValidatePack subcommand with path/identifier resolution and severity-based findings (errors exit 1, warnings exit 0)
- New PackHeuristics engine with 7 checks: empty pack, root source copy, missing settings files, unreferenced files, root-level content, MCP dependency gaps, python module paths
- 21 unit tests for heuristics + 4 command parsing tests
- Add CLI reference, creating-tech-packs guide section, and schema heuristic checks
- Update CLAUDE.md with command and architecture entries for ValidatePackCommand and PackHeuristics
- Add quick links in README and docs index
…es, add tests

- Replace 3 try? usages in PackHeuristics with do/catch that emit warning findings instead of silently returning empty
- Distinguish "pack not found" from "registered but invalid path" in resolvePackPath
- Add 7 new tests: configureProject branches, configure script references, full-path commands, -m edge case, filesystem errors
- Guard checkPythonModulePaths on python/python3 command to avoid false positives on non-Python MCP servers
- Extract referencedPaths(from:) helper to deduplicate manifest iteration between two checks
- Use array .contains(base) instead of chained == comparisons for runtime checks
@bguidolim bguidolim enabled auto-merge (squash) March 30, 2026 11:26
@bguidolim bguidolim merged commit c6a941f into main Mar 30, 2026
4 checks passed
@bguidolim bguidolim deleted the bruno/pack-validate branch March 30, 2026 11:35
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.

1 participant