feat: add terminology schema example and improve schema-list command

This commit completes Phase 2 of schema evolution work and establishes
a new example demonstrating schema usage for terminology documents.

## New Features

### Terminology Validation Example (examples/terminology/)
- Complete example terminology document with proper structure
- JSON schema with MarkiTect extensions for validation
- Demonstrates schema usage beyond manpages (glossaries, lexicons)
- Validates term structure: Definition, Synonyms, Related Terms, Examples
- Includes content control and quality validation rules
- Full documentation with usage examples and best practices

### Schema Registration System
- Registered terminology schema in markitect database
- Created schema catalog (markitect/schemas/schema-catalog.yaml)
- Copied schema to official location (markitect/schemas/)
- Provides metadata, features, and usage info for all schemas

### Improved schema-list Command
- Now displays creation timestamps in default output
- Table format includes Created/Updated columns
- Cleaner timestamp formatting (removed microseconds)
- Better visibility into when schemas were added

## Files Changed

Added:
- examples/terminology/README.md - Complete documentation
- examples/terminology/terminology-example.md - Example glossary
- examples/terminology/terminology-schema.json - Validation schema
- markitect/schemas/terminology-schema.json - Registered schema
- markitect/schemas/schema-catalog.yaml - Schema registry

Modified:
- markitect/cli.py - Enhanced schema-list with timestamps
- TODO.md - Documented Phase 2 completion and new example

Moved:
- SCHEMA_EVOLUTION_WORKPLAN.md → todo/ directory

## Schema Features Demonstrated

- Heading hierarchy validation (H1 → H2 → H3)
- Term structure validation with required/optional fields
- Content quality metrics (word counts, readability targets)
- MarkiTect extensions (x-markitect-sections, x-markitect-content-control)
- Classification system (required/recommended/optional/discouraged/improper)

## Usage

```bash
# List schemas with timestamps
markitect schema-list

# Validate terminology document
markitect validate glossary.md --schema terminology-schema.json

# View in table format
markitect schema-list --format table
```

🤖 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-04 23:07:36 +01:00
parent 82c1a3ab65
commit 6df9b5df05
8 changed files with 927 additions and 3 deletions

View File

@@ -1740,15 +1740,46 @@ def schema_list(config, output_format, names_only):
click.echo()
for schema_info in schemas:
click.echo(f"🔧 {schema_info['filename']}")
# Format timestamp for display (remove microseconds)
created = schema_info['created_at']
if created:
# Format: YYYY-MM-DD HH:MM:SS (remove microseconds if present)
if '.' in created:
created_display = created.split('.')[0]
else:
created_display = created
click.echo(f"🔧 {schema_info['filename']:<40} (added: {created_display})")
else:
click.echo(f"🔧 {schema_info['filename']}")
if config.get('verbose'):
click.echo(f" Title: {schema_info['title']}")
click.echo(f" Created: {schema_info['created_at']}")
click.echo(f" Updated: {schema_info['updated_at']}")
if schema_info['description']:
click.echo(f" Description: {schema_info['description']}")
click.echo()
elif output_format == 'table':
# Custom table format for better readability
table_data = []
for schema in schemas:
# Format timestamps (remove microseconds)
created_date = schema['created_at'].split('.')[0] if schema['created_at'] and '.' in schema['created_at'] else schema['created_at']
updated_date = schema['updated_at'].split('.')[0] if schema['updated_at'] and '.' in schema['updated_at'] else schema['updated_at']
table_data.append({
'Name': schema['filename'],
'Title': schema['title'] or '',
'Created': created_date or '',
'Updated': updated_date or ''
})
if table_data:
headers = ['Name', 'Title', 'Created', 'Updated']
rows = [[row[h] for h in headers] for row in table_data]
click.echo(tabulate(rows, headers=headers, tablefmt='simple'))
else:
# Use structured format (table, json, yaml)
# Use structured format (json, yaml)
formatted_output = format_output(schemas, output_format)
click.echo(formatted_output)