feat: implement Phase 4 - Schema Migration

Completed Phase 4 of the schema-of-schemas implementation with successful
migration of all legacy schemas to the new markdown format following the
naming convention.

Migration Script (scripts/migrate_schemas.py - 240 lines):
- Automated schema migration from JSON to markdown format
- Updates version and $id fields to follow conventions
- Generates proper frontmatter metadata
- Dry-run mode for safe testing
- Database cleanup functionality
- Comprehensive progress reporting

Schemas Migrated (2):
- terminology-schema.json → terminology-schema-v1.0.md
  - Fixed missing version field
  - Updated $id from /terminology-v1.json to /terminology/v1.0
  - Validates successfully against metaschema

- api-documentation → api-documentation-schema-v1.0.md
  - Added version: 1.0.0
  - Updated $id to follow /api-documentation/v1.0 format
  - Validates successfully against metaschema

Schemas Deleted (3):
- markdown-manpage (duplicate of manpage-schema-v1.0.md)
- markdown-manpage-schema.json (duplicate of manpage-schema-v1.0.md)
- enhanced-manpage (replaced by manpage-schema-v1.0.md)

CLI Enhancement (markitect/cli.py):
- Updated schema-ingest to support markdown (.md) files
- Auto-detects file type and uses MarkdownSchemaLoader for .md files
- Extracts JSON schema from markdown for database storage
- Maintains backward compatibility with JSON files

Final Schema Registry (4 schemas):
 terminology-schema-v1.0.md - Terminology validation
 api-documentation-schema-v1.0.md - API documentation structure
 manpage-schema-v1.0.md - Unix manual pages
 schema-schema-v1.0.md - Metaschema for validating schemas

All schemas:
- Follow naming convention: {domain}-schema-v{major}.{minor}.md
- Include proper frontmatter with schema-id, version, status
- Validate successfully against schema-schema-v1.0.md metaschema
- Stored in database and ready for use

Progress Tracking:
- Updated TODO.md with Phase 4 completion
- Updated CHANGELOG.md with migration details
- Next: Phase 5 - CLI & Documentation Updates

🤖 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 09:38:43 +01:00
parent f3aaec99bb
commit 60d9f7a2c3
6 changed files with 800 additions and 20 deletions

43
TODO.md
View File

@@ -12,9 +12,9 @@ The structure organizes **future tasks** by their impact, just as a changelog or
This section is for tasks currently being discussed with or worked on by the coding assistant. These are the ephemeral, flow-of-thought tasks.
### Schema-of-Schemas Implementation (Active - Phase 3)
### Schema-of-Schemas Implementation (Active - Phase 4)
**Status:** Phase 3 - Schema-for-Schemas Metaschema (Completed ✅)
**Status:** Phase 4 - Schema Migration (Completed ✅)
**Workplan:** See `roadmap/schema-of-schemas/WORKPLAN.md`
**Current Goals:**
@@ -23,7 +23,7 @@ This section is for tasks currently being discussed with or worked on by the cod
3. ✅ Create markdown schema loader
4. ✅ Create example markdown schema
5. ✅ Build schema-for-schemas metaschema
6. Migrate existing schemas to new format (Next: Phase 4)
6. Migrate existing schemas to new format
**Phase 1 Tasks (Completed ✅):**
- [x] Write `markitect/schema_naming.py` with validation logic
@@ -47,12 +47,21 @@ This section is for tasks currently being discussed with or worked on by the cod
- [x] Test metaschema self-validation
- [x] Validate existing schemas against metaschema
**Phase 4 Tasks (Completed ✅):**
- [x] Create migration script (scripts/migrate_schemas.py)
- [x] Migrate terminology-schema.json → terminology-schema-v1.0.md
- [x] Migrate api-documentation → api-documentation-schema-v1.0.md
- [x] Delete duplicate schemas (markdown-manpage, markdown-manpage-schema.json)
- [x] Delete replaced schema (enhanced-manpage)
- [x] Update schema-ingest CLI to support markdown files
- [x] Validate all migrated schemas
- [x] Ingest all markdown schemas into database
**Next Phases:**
- Phase 4: Schema Migration (1-2 days)
- Phase 5: CLI & Documentation Updates (1 day)
- Phase 6: Testing & Validation (1 day)
**Expected Completion:** 4-5 days remaining
**Expected Completion:** 2-3 days remaining
---
@@ -194,6 +203,30 @@ The **capability-capability** includes:
- ✅ Manpage schema validates successfully
- ⚠️ Terminology schema needs migration (missing version field, incorrect $id format)
### 2026-01-05 - Phase 4: Schema Migration
- ✅ Created migration script (scripts/migrate_schemas.py, 240 lines)
- ✅ Migrated 2 schemas to markdown format
- ✅ Deleted 3 duplicate/replaced schemas from database
- ✅ Updated schema-ingest CLI to support markdown files (.md)
- ✅ All 4 schemas now in markdown format following naming convention
**Schemas Migrated:**
- terminology-schema.json → terminology-schema-v1.0.md
- api-documentation → api-documentation-schema-v1.0.md
**Schemas Deleted:**
- markdown-manpage (duplicate)
- markdown-manpage-schema.json (duplicate)
- enhanced-manpage (replaced by manpage-schema-v1.0.md)
**Final Schema Registry:**
- ✅ terminology-schema-v1.0.md
- ✅ api-documentation-schema-v1.0.md
- ✅ manpage-schema-v1.0.md
- ✅ schema-schema-v1.0.md (metaschema)
All schemas validate successfully against the metaschema!
### 2025-12-17 - Architecture Refactoring
- ✅ Implemented ReusableCapabilitiesArchitecture v0.1
- ✅ Added feedback capability to issue-facade