feat: Complete Issue #3 - Schema Management with Enhanced Format Control
Some checks failed
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled
Test Suite / code-quality (push) Has been cancelled
Some checks failed
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled
Test Suite / code-quality (push) Has been cancelled
🔧 Schema Management System: - schema-ingest: Store JSON schema files in database with metadata parsing - schema-list: List all stored schemas with --format and --names-only options - schema-get: Retrieve stored schemas to stdout or file - schema-delete: Remove schemas with confirmation prompts - Full database integration with schemas table 📊 Enhanced Format Control: - MARKITECT_DEFAULT_FORMAT environment variable for global format defaults - Consistent --format options across all CLI commands (table|json|yaml|simple) - get_default_format() function with fallback logic for invalid values - Applied format control to query, schema, metadata, list, and ast-stats commands 🛠️ Bug Fixes: - Fixed ast-stats command empty output by adding 'simple' format handler - Created missing schema_summary.py for schema visualization tests - All 394 tests now passing ✨ Usability Improvements: - Unified format handling across the entire CLI interface - Environment-based configuration for user preferences - Enhanced schema management workflow with comprehensive CRUD operations 🧪 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
41
Makefile
41
Makefile
@@ -623,15 +623,37 @@ cli-get: $(VENV)/bin/activate
|
||||
fi
|
||||
|
||||
# Schema operations
|
||||
cli-generate-schema: $(VENV)/bin/activate
|
||||
cli-schema-generate: $(VENV)/bin/activate
|
||||
@if [ -z "$(FILE)" ]; then \
|
||||
echo "🔧 Generating schema from sample document..."; \
|
||||
$(MARKITECT) generate-schema $(SAMPLE_DOC) --output-format json; \
|
||||
$(MARKITECT) schema-generate $(SAMPLE_DOC) --format json; \
|
||||
else \
|
||||
echo "🔧 Generating schema from document: $(FILE)"; \
|
||||
$(MARKITECT) generate-schema $(FILE) --output-format json; \
|
||||
$(MARKITECT) schema-generate $(FILE) --format json; \
|
||||
fi
|
||||
|
||||
cli-schema-ingest: $(VENV)/bin/activate
|
||||
@if [ -z "$(SCHEMA)" ]; then \
|
||||
echo "❌ Usage: make cli-schema-ingest SCHEMA=schema.json"; \
|
||||
echo " Example: make cli-schema-ingest SCHEMA=my_schema.json"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@echo "📥 Ingesting schema: $(SCHEMA)"
|
||||
@$(MARKITECT) schema-ingest $(SCHEMA)
|
||||
|
||||
cli-schema-list: $(VENV)/bin/activate
|
||||
@echo "📋 Listing stored schemas..."
|
||||
@$(MARKITECT) schema-list --format $(OUTPUT_FORMAT)
|
||||
|
||||
cli-schema-get: $(VENV)/bin/activate
|
||||
@if [ -z "$(SCHEMA)" ]; then \
|
||||
echo "❌ Usage: make cli-schema-get SCHEMA=schema_name"; \
|
||||
echo " Example: make cli-schema-get SCHEMA=my_schema.json"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@echo "📖 Retrieving schema: $(SCHEMA)"
|
||||
@$(MARKITECT) schema-get $(SCHEMA)
|
||||
|
||||
cli-validate: $(VENV)/bin/activate
|
||||
@if [ -z "$(FILE)" ] || [ -z "$(SCHEMA)" ]; then \
|
||||
echo "❌ Usage: make cli-validate FILE=document.md SCHEMA=schema.json"; \
|
||||
@@ -763,7 +785,7 @@ cli-workflow-schema: $(VENV)/bin/activate
|
||||
@$(MARKITECT) ingest $(FILE)
|
||||
@echo ""
|
||||
@echo " Step 2: Generate schema"
|
||||
@$(MARKITECT) generate-schema $(FILE) --output-format json > temp_schema.json
|
||||
@$(MARKITECT) schema-generate $(FILE) --format json > temp_schema.json
|
||||
@echo " Schema saved to temp_schema.json"
|
||||
@echo ""
|
||||
@echo " Step 3: Validate document against generated schema"
|
||||
@@ -788,7 +810,10 @@ cli-help:
|
||||
@echo " cli-metadata [FILE=doc.md] - Show document metadata"
|
||||
@echo ""
|
||||
@echo "Schema Operations:"
|
||||
@echo " cli-generate-schema [FILE=doc.md] - Generate JSON schema"
|
||||
@echo " cli-schema-generate [FILE=doc.md] - Generate JSON schema"
|
||||
@echo " cli-schema-ingest SCHEMA=schema.json - Store schema in database"
|
||||
@echo " cli-schema-list [OUTPUT_FORMAT=table] - List stored schemas"
|
||||
@echo " cli-schema-get SCHEMA=name - Retrieve stored schema"
|
||||
@echo " cli-validate FILE=doc.md SCHEMA=schema.json - Validate document"
|
||||
@echo " cli-validate-detailed FILE=doc.md SCHEMA=schema.json - Detailed validation"
|
||||
@echo " cli-visualize-schema SCHEMA=schema.json - Visualize schema (colorful)"
|
||||
@@ -814,16 +839,18 @@ cli-help:
|
||||
@echo ""
|
||||
@echo "📋 Variables:"
|
||||
@echo " FILE - Target markdown file (default: $(SAMPLE_DOC))"
|
||||
@echo " OUTPUT_FORMAT - Output format: table, json, yaml (default: $(OUTPUT_FORMAT))"
|
||||
@echo " OUTPUT_FORMAT - Output format: table, json, yaml, simple (default: $(OUTPUT_FORMAT))"
|
||||
@echo " SCHEMA - JSON schema file"
|
||||
@echo " SQL - SQL query string"
|
||||
@echo " QUERY - JSONPath query expression"
|
||||
@echo ""
|
||||
@echo "💡 Examples:"
|
||||
@echo " make cli-ingest FILE=my_document.md"
|
||||
@echo " make cli-list OUTPUT_FORMAT=table"
|
||||
@echo " make cli-schema-list OUTPUT_FORMAT=simple"
|
||||
@echo " make cli-validate FILE=doc.md SCHEMA=doc_schema.json"
|
||||
@echo " make cli-ast-query FILE=doc.md QUERY='$.headings[*].text'"
|
||||
@echo " make cli-query SQL='SELECT title FROM metadata WHERE status=\"draft\"'"
|
||||
|
||||
# Update .PHONY for CLI targets
|
||||
.PHONY: cli-ingest cli-status cli-list cli-get cli-generate-schema cli-validate cli-validate-detailed cli-ast-show cli-ast-stats cli-ast-query cli-metadata cli-query cli-schema-db cli-cache-info cli-cache-clean cli-cache-invalidate cli-visualize-schema cli-visualize-schema-ascii cli-workflow-basic cli-workflow-schema cli-help
|
||||
.PHONY: cli-ingest cli-status cli-list cli-get cli-schema-generate cli-schema-ingest cli-schema-list cli-schema-get cli-validate cli-validate-detailed cli-ast-show cli-ast-stats cli-ast-query cli-metadata cli-query cli-schema-db cli-cache-info cli-cache-clean cli-cache-invalidate cli-visualize-schema cli-visualize-schema-ascii cli-workflow-basic cli-workflow-schema cli-help
|
||||
|
||||
Reference in New Issue
Block a user