feat: add multi-schema validation with numbered selection

Enhanced schema-list and schema-validate commands to support efficient
batch validation of multiple schemas, especially useful when the
metaschema changes.

**schema-list enhancements:**
- Added numbered references (#1, #2, etc.) to all output formats
- Simple format: [1] prefix for each schema
- Table format: # column as first column
- JSON/YAML: number field added to each schema

**schema-validate enhancements:**
- Number selection: `markitect schema-validate 1`
- Range selection: `markitect schema-validate 1-3`
- List selection: `markitect schema-validate 1,3,5`
- Batch validation: `markitect schema-validate --all`
- Filename selection: `markitect schema-validate schema.md`
- Filesystem path: `markitect schema-validate ./schema.md`
- Batch results displayed as clear summary table
- Registry schemas take precedence with filesystem fallback
- Full backward compatibility maintained

**Implementation details:**
- Added ValidationResult dataclass for structured results
- Added helper functions: parse_schema_selector, resolve_schema_source,
  is_filesystem_path, format_validation_summary
- Changed schema_selector from Path to str for flexible input
- Added --all flag for validating all registered schemas
- Comprehensive error handling and helpful usage messages

**Testing:**
- All selection methods tested and working
- Backward compatibility verified
- Parsing utilities tested with unit tests

Completes Phase 5 of Schema-of-Schemas implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-05 10:55:48 +01:00
parent 60d9f7a2c3
commit 7d115b6325
3 changed files with 437 additions and 60 deletions

41
TODO.md
View File

@@ -57,11 +57,20 @@ This section is for tasks currently being discussed with or worked on by the cod
- [x] Validate all migrated schemas
- [x] Ingest all markdown schemas into database
**Next Phases:**
- Phase 5: CLI & Documentation Updates (1 day)
- Phase 6: Testing & Validation (1 day)
**Phase 5 Tasks (Completed ✅):**
- [x] Add numbered references to schema-list (all output formats)
- [x] Implement schema selection parser (numbers, ranges, lists)
- [x] Implement schema resolution logic (registry with filesystem fallback)
- [x] Enhance schema-validate command with multiple selection support
- [x] Add --all flag for batch validation
- [x] Implement batch output formatting with summary table
- [x] Test all selection methods (1, 1-3, 1,3,5, all, filename, ./path)
- [x] Maintain backward compatibility with single-file validation
**Expected Completion:** 2-3 days remaining
**Next Phase:**
- Phase 6: Integration testing and final documentation (1 day)
**Expected Completion:** 1 day remaining
---
@@ -127,6 +136,30 @@ The **capability-capability** includes:
*Recent completed tasks have been documented in _issue-tracking/issue-facade/CHANGELOG.md following Keep a Changelog format.*
### 2026-01-05 - Phase 5: Enhanced Schema Validation with Multiple Selection
- ✅ Enhanced schema-list command with numbered references in all formats
- ✅ Implemented schema selection parser supporting:
- Single number: `markitect schema-validate 1`
- Number range: `markitect schema-validate 1-3`
- Number list: `markitect schema-validate 1,3,5`
- Keyword: `markitect schema-validate --all` or `all`
- Filename: `markitect schema-validate schema.md`
- Filesystem path: `markitect schema-validate ./schema.md`
- ✅ Implemented schema resolution with registry precedence and filesystem fallback
- ✅ Added batch validation with summary table output
- ✅ Added ValidationResult dataclass for structured results
- ✅ Created helper functions: parse_schema_selector, resolve_schema_source, is_filesystem_path, format_validation_summary
- ✅ Maintained full backward compatibility with existing single-file validation
- ✅ Tested all selection methods successfully
**Key Features Delivered:**
- Number-based schema selection for quick validation
- Batch validation results displayed as clear summary table
- Registry schemas take precedence over filesystem paths
- Helpful error messages with usage examples
- Exit code 0 for success, 1 for validation failures
- Support for future wildcard/globbing expansion
### 2026-01-04 - Phase 2: Schema Refinement Tools & Terminology Example
- ✅ Implemented schema-analyze command to detect rigidity issues
- ✅ Implemented schema-refine command with automatic loosening logic