27 Commits

Author SHA1 Message Date
ff6b807f3b release: bump version to 0.5.0 with clean TDD-driven editor
This release represents a major milestone in MarkiTect's evolution, featuring a complete rewrite of the editor system using test-driven development principles and clean object-oriented architecture.

Key highlights:
- Clean TDD-driven editor architecture with Section/SectionManager/DOMRenderer classes
- Multiple concurrent section editing with intelligent section splitting
- Four-layer content management system (original, current, pending, editing)
- Enhanced status dialog with repository info and version tracking
- Comprehensive testing framework with separation of concerns
- Elegant slide-in control panel and intelligent auto-sizing textarea
- Complete legacy editor system replacement

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 07:53:45 +01:00
6447c617fd feat: implement clean TDD-driven editor with enhanced status dialog
- Replace legacy editor with clean object-oriented architecture
- Add comprehensive test-driven Section, SectionManager, and DOMRenderer classes
- Implement four-layer content management with proper action semantics
- Add multiple concurrent section editing capability
- Implement intelligent section splitting with heading detection
- Add enhanced status dialog with repository info, version, and save filename
- Include git commit information and modification status
- Provide actual save filename preview instead of source filename
- Maintain proper section positioning and global reset functionality

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 07:51:43 +01:00
5337b26d5e fix: resolve textarea sizing, font preservation, and markdown structure issues
Addressed multiple critical editing experience issues:

Enhanced Markdown Preservation:
- Fixed htmlToMarkdown() to properly preserve heading hash signs (# ## ###)
- Maintained markdown structure for lists, code blocks, and blockquotes
- Preserved inline formatting (bold, italic, code) within paragraphs
- Improved spacing and indentation handling for complex structures

Font Size & Style Preservation:
- Extract and apply original element's font-size to textarea
- Preserve line-height from source content for consistent appearance
- Use inherit values in CSS, overridden by JavaScript for accuracy
- Ensures editing experience matches visual appearance of content

Improved Textarea Sizing:
- More reasonable height constraints (max 360px vs 400px)
- Line-count based minimum height calculation (~24px per line)
- Reduced excessive height for short content
- Added both horizontal and vertical resize capability
- Set minimum width constraint (200px) for better usability

CSS Enhancements:
- Changed resize from vertical-only to both directions
- Added min-width constraint for better proportions
- Improved overflow handling (auto vs overflow-y only)
- Font properties use inherit with JavaScript override

Technical Improvements:
- Better content height calculation using actual line count
- Proper handling of edge cases in markdown conversion
- Maintained smooth transitions while fixing sizing logic
- Preserved all existing functionality while fixing issues

These fixes ensure that:
- Headings preserve their # markers when edited
- Font sizes match the original content being edited
- Textarea dimensions are proportional and user-controllable
- Markdown structure roundtrips accurately

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 22:27:19 +02:00
87e970bbee feat: implement intelligent auto-sizing textarea for optimal editing UX
Enhanced the editing experience with smart textarea sizing that adapts
to content dimensions:

Smart Auto-Sizing Logic:
- Dynamically calculates height based on content lines
- Minimum height: 3 lines (63px) for comfortable editing
- Maximum height: 20 lines (444px) to prevent excessive expansion
- Precise calculation using line-height and padding measurements

Responsive Behavior:
- Auto-resizes on input events as you type
- Handles paste operations with proper sizing
- Smooth transitions with 0.15s ease animation
- Temporarily disables transition during measurement for accuracy

Technical Implementation:
- Line-height aware calculation (14px font × 1.5 = 21px per line)
- Proper padding compensation (24px total)
- Scroll-height based measurement for precise content fitting
- Debounced initial sizing to handle DOM rendering

User Experience Benefits:
- Textarea perfectly fits content size on open
- No unnecessary white space for short content
- Sufficient space for longer content without overwhelming
- Natural, document-like editing experience
- Visual harmony with surrounding content boxes

CSS Enhancements:
- Reduced min-height from 100px to 60px for better proportions
- Added smooth height transitions for polished feel
- Maintained vertical resize capability for user control
- Proper box-sizing for consistent measurements

This creates a much more natural editing experience where the textarea
intelligently adapts to match the content being edited.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 21:53:49 +02:00
eced5cbae4 fix: prevent section jumping by preserving insertion position
Fixed critical positioning issue where split sections would jump to end
of document instead of staying at their original location.

Problem:
- appendChild() was adding new sections at end of parent container
- Split sections appeared at bottom of document, not at edit location
- Disrupted document flow and user experience

Solution:
- Remember original position with nextSibling before removal
- Use insertBefore(wrapper, nextSibling) for correct positioning
- New sections now appear exactly where original section was located
- Maintains proper document order and reading flow

This ensures that when you split a paragraph by adding empty lines,
the resulting sections stay in their logical position within the
document structure.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 21:41:59 +02:00
6e60e5f13d feat: enhance empty line preservation and automatic paragraph separation
Implemented sophisticated paragraph handling for the markdown editor:

Enhanced HTML-to-Markdown Conversion:
- Replaced simple tag stripping with proper structural parsing
- Preserves formatting for headers, emphasis, code, blockquotes
- Maintains paragraph separation with proper spacing
- Handles nested elements and mixed content correctly

Dynamic Section Splitting:
- Detects paragraph breaks (double newlines) when editing
- Automatically creates separate editable sections for each paragraph
- Enables independent editing of logically separate content
- Maintains proper section indexing with sub-identifiers

Visual Enhancements:
- Added green styling for edited sections to distinguish from originals
- Subtle borders and backgrounds indicate modified content
- Hover effects provide clear feedback on editable areas

Technical Improvements:
- Enhanced blur handler to detect multiple paragraphs
- Smart wrapper creation for single vs. multi-paragraph content
- Proper DOM manipulation for section insertion and replacement
- Preserves editing state and section relationships

Benefits:
- Empty lines between paragraphs are preserved accurately
- Text separated by empty lines becomes independently editable
- Better content organization and editing granularity
- Improved user experience with clear visual feedback

This resolves the empty line swallowing issue and provides intuitive
paragraph-level editing that matches user expectations.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 21:35:53 +02:00
93655512d0 fix: resolve section duplication issue when saving edited content
Fixed critical bug where editing a section would cause content duplication
in the saved file due to improper handling of DOM reconstruction.

Problem:
- marked.parse() creates multiple HTML elements from single markdown section
- markSections() marked all new elements as individual editable sections
- getMarkdownContent() processed all marked sections, causing duplication
- Example: editing "## Header\nText" created <h2> + <p>, both saved separately

Solution:
- Wrap edited content in container div with data-edited attribute
- Update markSections() to skip elements inside edited wrappers
- Enhanced getMarkdownContent() to handle edited wrappers as single units
- Process child elements within edited wrappers correctly
- Maintain section indexing while preventing double-marking

Technical Changes:
- editSection() now creates wrapper div for parsed content
- markSections() skips content inside [data-edited] containers
- getMarkdownContent() handles edited vs regular sections differently
- Proper cleanup and re-indexing of section markers

This ensures edited sections are treated as cohesive units and saved
exactly once, eliminating content duplication while maintaining full
editing functionality.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 21:23:34 +02:00
74ee2760e2 fix: resolve markdown roundtrip formatting issue in save functionality
Fixed critical bug where saving unedited content would introduce unwanted
indentation and formatting changes due to unnecessary DOM reconstruction.

Problem:
- getMarkdownContent() always reconstructed from DOM elements
- textContent doesn't preserve original markdown formatting
- HTML rendering adds/removes whitespace causing formatting drift
- Lines after first would get extra indentation on roundtrip

Solution:
- Added hasEdits tracking to MarkitectEditor class
- Return original markdown content when no edits have been made
- Only reconstruct from DOM when actual edits occurred
- Mark hasEdits=true when textarea blur event fires

This ensures perfect fidelity when saving unedited documents while
maintaining the reconstruction capability for edited content.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 21:15:48 +02:00
aefece1fe7 feat: hide control ribbon when panel is expanded for cleaner UI
Enhanced the floating control panel behavior:
- Ribbon smoothly fades out (opacity: 0) when panel expands
- Ribbon becomes non-interactive (pointer-events: none) when hidden
- Added smooth opacity transition (0.3s ease) for elegant fade effect
- Maintains consistent transition timing with panel slide animation

This eliminates the redundant ribbon icon when the full panel is visible,
creating a cleaner and less cluttered interface while maintaining the
intuitive expand/collapse interaction.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 21:08:39 +02:00
ce7ce0470f feat: implement elegant slide-in floating control panel for edit mode
Replaced the intrusive blue status bar with a sleek slide-in control panel:

UI/UX Improvements:
- Minimized ribbon (📝 icon) on top-right that slides out to full panel
- Beautiful gradient design with backdrop blur effects
- Smooth CSS transitions with cubic-bezier easing
- Auto-expand on load, then minimize after 2 seconds
- Click outside to close, click ribbon to toggle

Features Combined:
- Status indicators with dynamic icons ( loading,  success,  error)
- Save & Download and Preview buttons in clean grid layout
- Version information in panel header
- Error reporting with expandable details
- Responsive design for mobile devices

Technical Changes:
- Replaced old floating-header with integrated control panel
- Enhanced status update function with visual state management
- Added toggle functionality with click-outside-to-close
- Improved typography and spacing throughout
- Updated test to match new element ID structure

This provides a much cleaner editing experience with better space utilization
while maintaining all previous functionality and adding visual polish.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 20:55:45 +02:00
6df6430b72 fix: resolve CSS embedding import error in HTML template generation
Some checks failed
Test Suite / performance-tests (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 / code-quality (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Fixed critical bug where CSS files were not being embedded inline due to
missing Path import in _generate_html_template method. This was causing
CSS content to fall back to link tags instead of inline embedding.

The issue was:
- Path used in CSS handling code (line 367) before being imported
- Path import was conditional and occurred later in the method (line 623)
- Exception handling silently fell back to link tags

Solution:
- Added explicit `from pathlib import Path` import at method start
- CSS files now properly embed inline as intended
- All CSS-related tests now pass (6/6 previously failing)

This resolves the test failures where CSS content was expected to be
embedded inline but was generating link tags instead.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 20:37:32 +02:00
ed27dee5a0 feat: reorganize Makefile installation targets for better UX
Simplified installation process with clearer, more intuitive targets:

- NEW: `make install` - One-command global installation (recommended)
- NEW: `make uninstall` - Clean removal of global installation
- RENAMED: install-deps → install-user-deps (clearer purpose)
- RENAMED: install-deps-force → install-force-deps (better naming)
- RENAMED: install-system → install-system-deps (clearer scope)
- UPDATED: Help messages and cross-references throughout

The new `make install` target:
1. Creates user virtual environment with dependencies
2. Installs markitect binary to ~/bin/
3. Provides clear next steps and verification

This resolves the confusing 8-target installation matrix with a simple,
reliable one-command solution that works from any directory.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 20:28:29 +02:00
49724d2ae5 release: prepare v0.4.0 - Enhanced Edit Mode & Version Tracking
Some checks failed
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
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Key improvements:
- Fixed critical md-render --edit functionality that was broken
- Enhanced version tracking with git commit hash, timestamps, and local changes detection
- Comprehensive regression tests to prevent future breaks
- Repository cleanup completed

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 20:13:41 +02:00
25a38322c0 chore: clean up repository documentation files for release
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
Remove extensive documentation files to simplify repository structure
for v0.2.0 release. Core functionality is complete and tested.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 20:04:08 +02:00
3a53e0aa58 fix: resolve md-render --edit functionality and add enhanced version tracking
Some checks failed
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled
Test Suite / code-quality (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
This commit fixes the critical md-render --edit regression that was causing
"blue box, no content" issues and adds comprehensive version tracking.

Key fixes:
- Fixed JavaScript newline escaping in f-string templates (\\n\\n not \\\\n\\\\n)
- Restored proper content rendering with marked.js CDN and graceful fallback
- Removed problematic validation logic that was blocking content display
- Cleaned up html-inject-editing command and related experimental code

Enhancements:
- Added version display in edit mode header with git commit and timestamp
- Enhanced version tracking to show local uncommitted changes with timestamps
- Added comprehensive regression tests to prevent future breakage
- Improved error handling and recovery mechanisms

The md-render --edit functionality now works reliably with full version visibility.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 18:16:25 +02:00
64d1606740 feat: add comprehensive testing and error tracking for edit mode
Add robust testing framework to prevent regression of edit mode:
- Comprehensive regression tests for JavaScript syntax validation
- Build-time JavaScript validation tool with Node.js integration
- Enhanced error tracking with detailed logging and recovery
- Makefile integration for `make validate-js` command

Features:
- Validates JavaScript syntax in generated HTML templates
- Detects common issues like broken string literals and brace escaping
- Enhanced error reporting with timestamps and context
- Automatic error recovery for graceful degradation
- Build validation to catch syntax errors before deployment

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 16:53:09 +02:00
1022e2597f fix: resolve critical JavaScript syntax errors in md-render --edit
Fix broken edit mode that prevented content rendering due to:
- Unescaped newline literals causing JavaScript string syntax errors
- Inconsistent brace escaping in f-string templates
- Template literal syntax issues with variable interpolation

The edit mode now properly renders content AND provides editing capabilities.

Also added html-inject-editing command for standalone HTML enhancement
with graceful fallback options.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 16:46:47 +02:00
50170f75df fix: resolve md-ingest Path object conversion error
Fix critical runtime error where md-ingest command failed with
'str' object has no attribute 'exists'. The DocumentManager.ingest_file()
method expects a Path object but was receiving a string from the CLI.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 05:59:25 +02:00
1877d6d462 release: prepare v0.3.0 - Architectural Improvements
Some checks failed
Test Suite / code-quality (push) Has been cancelled
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
- Kaizen-agentic framework integration as capability submodule
- Test reorganization by capability with better modularity
- Comprehensive capability inclusion management system
- Directory reorganization with logical separation
- Todofile system implementation replacing NEXT.md
- Historical file organization for cleaner structure

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 03:10:13 +02:00
7cc81dee8f feat: organize and archive legacy files to history directory
Some checks failed
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
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Clean up base directory by moving completed work and legacy files to
organized subdirectories within history/, improving project navigation
and separating active files from historical artifacts.

## Archived Files:

### Development Scripts → history/development-scripts/
- debug_*.py (7 files) - Legacy debugging and development scripts
- demo_issue_150.py - Issue demonstration script

### Migration Reports → history/migration-reports/
- AGENT_MIGRATION_REPORT.md - Completed agent migration work
- ASSET_MODEL_MIGRATION.md - Completed asset model migration
- KAIZEN_MIGRATION_GAMEPLAN.md - Completed kaizen framework migration
- KAIZEN_UPDATE_REPORT.md - Completed kaizen update work
- PHASE_3_COMPLETION_REPORT.md - Completed phase 3 work
- PHASE_4_COMPLETION_REPORT.md - Completed phase 4 work

### Legacy Files → history/legacy-files/
- .env.tddai - Legacy TDD framework configuration
- README.html - Generated file (superseded by README.md)
- test_status.html - Generated test status file
- install-*.sh (5 files) - Legacy individual install scripts

## Benefits:
- **Cleaner Repository**: Base directory now focused on active development
- **Better Organization**: Historical files properly categorized and preserved
- **Improved Navigation**: Easier to find current vs. historical information
- **Preserved History**: All work artifacts maintained for reference

Repository now has 33 active files in base directory (reduced from 48)
with complete historical preservation in organized subdirectories.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 02:55:23 +02:00
d5d943a604 feat: update kaizen-agentic submodule reference
Some checks failed
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
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Update submodule reference to include agent changes for TODO.md integration.
The kaizen-agentic framework now has updated project-management agent that
references TODO.md instead of NEXT.md, maintaining consistency with the
main project's todofile system adoption.

Submodule changes:
- Updated agent-project-management.md to use TODO.md workflow
- Modified session wrap-up protocol for todofile format
- Aligned with main project's todofile system implementation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 02:51:51 +02:00
c5f49b2dd0 feat: implement todofile system and retire NEXT.md
Replace NEXT.md approach with standardized Keep a Todofile V0.0.1 format
for better task management and human-AI collaboration during coding sessions.

## Todofile System Setup:
- **TODO.md**: Main todofile following Keep a Todofile V0.0.1 format
- **TODOFILE_GUIDE.md**: Comprehensive system documentation and workflow
- **Integration**: Fully integrated with existing kaizen-agentic framework
- **Agent Support**: Uses agent-keepaTodofile for maintenance

## Content Migration:
- Migrated strategic priorities from NEXT.md to TODO.md [Unreleased] section
- Preserved session success criteria and development milestones
- Organized tasks by impact type (To Add, To Fix, To Refactor)
- Archived NEXT.md to history/NEXT_archived_20251025.md

## Documentation Updates:
- README.md: Updated "Next Actions" → "Current Tasks" link
- agent-project-management.md: Updated workflow to use TODO.md
- docs/README.md: Updated project management references
- Added comprehensive TODOFILE_GUIDE.md

## Benefits:
- **Standardized Format**: Industry-standard Keep a Todofile format
- **Better Organization**: Impact-based task categorization
- **AI-Ready**: Designed for human-AI collaboration workflows
- **Context Preservation**: Maintains coding flow across session interruptions
- **Integration Ready**: Works with existing agent and capability systems

Active tasks now in TODO.md [Unreleased] section focusing on strategic
issue resolution and capability management validation.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 02:48:45 +02:00
096017b93f feat: reorganize tests by capability with separate test targets
Some checks failed
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
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Separate capability-specific tests from core system tests to establish clear
test organization and separation of concerns.

## Test Reorganization:
- **markitect-content tests**: Moved 6 tests to capabilities/markitect-content/tests/
- **markitect-finance tests**: Moved 7 tests to markitect/finance/tests/
- **markitect-query tests**: Moved 1 test to markitect/query_paradigms/tests/
- **markitect-graphql tests**: Moved 2 tests to markitect/graphql/tests/
- **markitect-plugins tests**: Moved 2 tests to markitect/plugins/tests/

## Makefile Updates:
- **make test**: Excludes capability tests, runs only core system tests
- **make test-capabilities**: Runs all capability tests
- **make test-capability-***: Individual capability test targets
- Updated all test targets (test-red, test-green, test-ultra-fast, test-perf)
- Added capability test targets to help documentation

## Benefits:
- Clear separation between core system tests and capability-specific tests
- Faster core test execution (capability tests not run by default)
- Individual capability testing for focused development
- Supports future capability extraction workflow
- Maintains capability test independence

Test verification:
- Core tests: 1291 tests (capability tests excluded)
- Finance capability: 143 tests working independently
- Content capability: 79 tests working independently

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 02:37:45 +02:00
f0dfd04d45 feat: add kaizen-agentic as submodule capability
- Add kaizen-agentic submodule from coulomb/kaizen-agentic repository
- Integrate as capabilities/kaizen-agentic/ following capability inclusion pattern
- Update CAPABILITY_REGISTRY.md with new AI agent framework capability
- Update CAPABILITY_INCLUSION_GUIDE.md directory structure
- Update capability metrics: 5 total capabilities, 3 submodules
- Establish kaizen-agentic integration pattern: cd capabilities/kaizen-agentic && make [command]

Extends capability inclusion architecture with:
- Advanced AI agent framework for autonomous development workflows
- Agent definitions, workflow automation, development patterns
- Clear separation from internal MarkiTect functionality

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 02:26:16 +02:00
6233d13f18 feat: reorganize capabilities directory structure for better separation
- Move issue-facade submodule from root to capabilities/ directory
- Update .gitmodules to reflect new submodule path: capabilities/issue-facade
- Update all documentation references to new capability paths
- Update agent definitions with new issue-facade location
- Establish logical organization: capabilities/ for all external dependencies
- Maintain wiki/ at root as project documentation, not reusable capability

Improves separation between:
- Project infrastructure (wiki/ at root)
- Reusable capabilities (capabilities/ directory)
- Internal code (markitect/ directory)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 02:22:14 +02:00
747715af58 feat: complete comprehensive capability inclusion management system
Some checks failed
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
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Implement revolutionary capability inclusion management system with complete
documentation ecosystem and automated discovery tools to prevent code duplication
and ensure proper separation of concerns.

Key accomplishments:
- Comprehensive capability documentation ecosystem (5 interconnected files)
- Clear separation: internal capabilities (what MarkiTect provides) vs external capabilities (what MarkiTect uses)
- Automated discovery tools preventing code duplication (make capability-search)
- AI-assistant optimized workflow with quick reference guide
- Enhanced project-assistant agent definition with capability inclusion workflow
- Updated README.md with clear links to capability documentation
- Complete session wrap-up with updated ProjectDiary.md, NEXT.md, and ProjectStatusDigest.md

Architecture milestone: Establishes MarkiTect as mature project with enterprise-grade
capability management, transforming development from ad-hoc implementation to
systematic capability management with automated duplication prevention.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 02:01:55 +02:00
62e7d13d7e feat: implement comprehensive capability inclusion management system
Added systematic approach to manage capability inclusion via subrepos and prevent code duplication. This addresses the architectural challenge of ensuring Claude recognizes, uses, and respects included capabilities.

New Capability Management System:
- CAPABILITY_REGISTRY.md: Complete registry of all included capabilities
- CLAUDE_CAPABILITY_REFERENCE.md: Quick lookup guide for Claude to prevent duplication
- tools/capability_discovery.py: Automated discovery and validation tool
- Makefile targets: capability-report, capability-search, capability-validate

Registry Coverage:
- Submodule capabilities: issue-facade (universal issue tracking), wiki (documentation)
- Local capabilities: markitect-content (content parsing), markitect-utils (utilities)
- External dependencies: Click, pytest, SQLAlchemy, requests

Agent Integration:
- Updated project-management and tdd-workflow agents with capability awareness
- Clear guidelines for checking existing functionality before implementing
- Integration patterns for using capabilities properly

Discovery & Validation:
- Automated capability discovery across submodules and local directories
- Search functionality to find existing implementations
- Validation tools to detect potential code duplication
- Claude-readable interfaces and usage patterns

Benefits:
- Prevents accidental functionality duplication
- Ensures proper separation of concerns
- Provides easy capability extension and bugfixing
- Maintains clean interfaces between core and capabilities
- Guides Claude to use existing capabilities efficiently

Usage:
- make capability-report: Generate complete capability overview
- make capability-search TERM=xyz: Find existing implementations
- make capability-validate FILE=path: Check for proper capability usage

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 01:40:43 +02:00
70 changed files with 3729 additions and 2482 deletions

7
.gitmodules vendored
View File

@@ -2,6 +2,9 @@
path = wiki
url = http://92.205.130.254:32166/coulomb/markitect_project.wiki.git
branch = main
[submodule "issue-facade"]
path = issue-facade
[submodule "capabilities/issue-facade"]
path = capabilities/issue-facade
url = http://92.205.130.254:32166/coulomb/issue-facade.git
[submodule "capabilities/kaizen-agentic"]
path = capabilities/kaizen-agentic
url = http://92.205.130.254:32166/coulomb/kaizen-agentic.git

View File

@@ -1,426 +0,0 @@
# MarkiTect System Capabilities & Extraction Plan
> **Comprehensive overview of all capabilities, architectural innovations, and capability extraction recommendations for the ComposableRepositoryParadigm**
## Overview
- **Total Capabilities**: 73+ distinct capabilities
- **Test Categories**: 15 major functional areas
- **Test Coverage**: 348 tests across 27 test files
- **Architecture**: Database-driven system with AST-based markdown processing, multi-layer caching, and deep Git platform integration
- **Extraction Status**: 2 capabilities extracted, 11 candidates identified for extraction
---
## 🎯 Capability Extraction Analysis
### Extraction Criteria
Based on the ComposableRepositoryParadigm, capabilities should be extracted when they meet these criteria:
1. **Self-Contained Functionality**: Can operate independently with minimal dependencies
2. **Reusability**: Could be useful in other projects or contexts
3. **Clear Boundaries**: Has well-defined interfaces and responsibilities
4. **Test Coverage**: Has adequate test coverage (>80% preferred)
5. **Size**: Significant enough to warrant extraction (>3 files or >500 LOC)
6. **Domain Separation**: Represents a distinct domain or concern
### Current Extraction Status
#### ✅ **Already Extracted** (2 capabilities)
- `markitect-content` - Content matter parsing (frontmatter, contentmatter, tailmatter)
- `markitect-utils` - General utility functions (test capability)
#### 🎯 **Recommended for Extraction** (7 capabilities)
| Priority | Capability | Rationale | Complexity | Dependencies |
|----------|------------|-----------|------------|-------------|
| **HIGH** | `markitect-finance` | Complete financial tracking system, self-contained | High | Low |
| **HIGH** | `markitect-query-paradigms` | 14 different query paradigms, highly reusable | High | Medium |
| **HIGH** | `markitect-graphql` | Complete GraphQL interface, standalone value | Medium | Medium |
| **MEDIUM** | `markitect-plugins` | Plugin architecture framework | Medium | Low |
| **MEDIUM** | `markitect-matter-parsers` | All matter parsing capabilities (3 types) | Medium | Low |
| **MEDIUM** | `markitect-legacy` | Legacy compatibility layer | Low | Low |
| **LOW** | `markitect-issues` | Issue management system | High | High |
#### 🛑 **Not Recommended for Extraction** (Core System)
These modules form the core of MarkiTect and should remain in the main project:
- **Core Engine**: `cli.py`, `database.py`, `config_manager.py` - Main application logic
- **AST Processing**: `ast_*.py`, `parser.py`, `serializer.py` - Core markdown processing
- **Document Management**: `document_manager.py`, `batch_processor.py` - Core functionality
- **Validation**: `schema_*.py`, `validation_*.py` - System integrity
- **Performance**: `cache_service.py`, `performance_tracker.py` - Core performance
- **Templates**: `template/` - Core template engine
---
## 📦 Detailed Capability Extraction Recommendations
### 1. 🏆 **HIGH PRIORITY - markitect-finance**
**Current Location**: `markitect/finance/`
**Files to Extract**:
```
markitect/finance/
├── __init__.py # Package interface
├── allocation_engine.py # Cost allocation logic
├── cli.py # Finance CLI commands
├── cost_manager.py # Cost tracking
├── day_wrapup_commands.py # Daily summaries
├── models.py # Data models
├── period_manager.py # Period handling
├── report_generator.py # Financial reports
├── session_tracker.py # Session tracking
├── worktime_commands.py # Work time CLI
├── worktime_tracker.py # Time tracking
└── migrations/001_create_cost_tables.sql
```
**Why Extract**:
-**Self-Contained**: Complete financial tracking system
-**Reusable**: Could be used by other project management tools
-**Clear Boundaries**: Well-defined domain (finance/time tracking)
-**Size**: 11 files, substantial codebase
-**Dependencies**: Minimal external dependencies
**Extraction Benefits**:
- Could be reused in other project management systems
- Independent development and versioning
- Clear separation of financial concerns
### 2. 🏆 **HIGH PRIORITY - markitect-query-paradigms**
**Current Location**: `markitect/query_paradigms/`
**Files to Extract**:
```
markitect/query_paradigms/
├── __init__.py # Package interface
├── base.py # Base classes
├── cli.py # Query CLI
├── registry.py # Paradigm registry
└── paradigms/ # 14 different paradigms
├── batch_paradigm.py
├── fts_paradigm.py
├── graphql_paradigm.py
├── jsonpath_paradigm.py
├── natural_language_paradigm.py
├── nosql_paradigm.py
├── qbe_paradigm.py
├── rag_paradigm.py
├── rest_api_paradigm.py
├── sql_paradigm.py
├── transform_paradigm.py
├── unix_pipeline_paradigm.py
├── visual_builder_paradigm.py
└── xpath_paradigm.py
```
**Why Extract**:
-**Highly Reusable**: Query paradigms useful across many applications
-**Self-Contained**: Complete query abstraction system
-**Innovation**: Unique architectural contribution
-**Size**: 17+ files, substantial investment
**Extraction Benefits**:
- Could become a standalone query abstraction library
- High reusability potential across projects
- Independent evolution of query capabilities
### 3. 🏆 **HIGH PRIORITY - markitect-graphql**
**Current Location**: `markitect/graphql/`
**Files to Extract**:
```
markitect/graphql/
├── __init__.py # Package interface
├── resolvers.py # GraphQL resolvers
├── schema.py # GraphQL schema
└── server.py # GraphQL server
```
**Why Extract**:
-**Standalone Value**: Complete GraphQL API interface
-**Reusable**: GraphQL interfaces are broadly applicable
-**Clear Boundaries**: Well-defined API layer
-**Technology**: Uses standard GraphQL patterns
**Extraction Benefits**:
- Can be developed independently with GraphQL ecosystem
- Reusable across different backend systems
- Clear API versioning and evolution
### 4. 🥈 **MEDIUM PRIORITY - markitect-plugins**
**Current Location**: `markitect/plugins/`
**Files to Extract**:
```
markitect/plugins/
├── __init__.py # Package interface
├── base.py # Base plugin classes
├── decorators.py # Plugin decorators
├── manager.py # Plugin manager
├── registry.py # Plugin registry
└── builtin/ # Built-in plugins
├── formatters.py
├── processors.py
└── search/ # Search plugins
├── fts_search.py
├── indexer.py
└── query_parser.py
```
**Why Extract**:
-**Reusable**: Plugin architecture pattern broadly applicable
-**Self-Contained**: Complete plugin system
-**Size**: 9+ files, substantial codebase
**Extraction Benefits**:
- Plugin architecture could be reused in other applications
- Independent development of plugin ecosystem
- Clear extensibility patterns
### 5. 🥈 **MEDIUM PRIORITY - markitect-matter-parsers**
**Current Status**: `markitect-content` already extracted, but three separate parsers remain:
**Files to Extract**:
```
markitect/matter_frontmatter/ # Front matter parsing
markitect/matter_contentmatter/ # Content matter parsing
markitect/matter_tailmatter/ # Tail matter parsing
```
**Why Extract**:
-**Reusable**: Matter parsing useful for many markdown tools
-**Self-Contained**: Each parser is independent
-**Clear Domain**: Document structure parsing
**Extraction Benefits**:
- Could be used by other markdown processing tools
- Independent evolution of parsing capabilities
### 6. 🥈 **MEDIUM PRIORITY - markitect-legacy**
**Current Location**: `markitect/legacy/`
**Files to Extract**:
```
markitect/legacy/
├── __init__.py # Package interface
├── agent.py # Legacy agents
├── compatibility.py # Compatibility layer
├── deprecation.py # Deprecation handling
├── exceptions.py # Legacy exceptions
├── git_tracker.py # Legacy Git tracking
├── registry.py # Legacy registry
└── switches.py # Feature switches
```
**Why Extract**:
-**Self-Contained**: Complete legacy compatibility system
-**Bounded**: Will eventually be removed
-**Clean Separation**: Should not contaminate main codebase
**Extraction Benefits**:
- Keeps legacy code separate from main evolution
- Can be deprecated independently
- Clear migration path
### 7. 🥉 **LOW PRIORITY - markitect-issues**
**Current Location**: `markitect/issues/`
**Files to Extract**:
```
markitect/issues/
├── __init__.py # Package interface
├── activity_commands.py # Activity tracking
├── activity_tracker.py # Activity tracking
├── base.py # Base classes
├── commands.py # Issue CLI commands
├── exceptions.py # Issue exceptions
├── issue_wrapup_commands.py # Issue completion
├── manager.py # Issue manager
└── plugins/ # Issue plugins
├── gitea.py # Gitea integration
└── local.py # Local issues
```
**Why Lower Priority**:
- ⚠️ **High Dependencies**: Tightly integrated with core system
- ⚠️ **Complex**: Issue management is complex domain
- ⚠️ **Core Feature**: Central to MarkiTect's value proposition
**Consider for Later**:
- Extract after core system stabilizes
- Requires careful dependency analysis
- High integration complexity
---
## 🚀 Extraction Implementation Plan
### Phase 1: **High-Value, Low-Risk Extractions**
1. **markitect-finance** - Complete financial system
2. **markitect-graphql** - GraphQL interface
3. **markitect-legacy** - Legacy compatibility
### Phase 2: **Complex, High-Value Extractions**
4. **markitect-query-paradigms** - Query abstraction system
5. **markitect-plugins** - Plugin architecture
### Phase 3: **Specialized Extractions**
6. **markitect-matter-parsers** - Consolidate matter parsing
7. **markitect-issues** - Issue management (if dependencies allow)
### Phase 4: **Validation and Optimization**
- Test all extractions thoroughly
- Optimize inter-capability dependencies
- Document lessons learned
- Update ComposableRepositoryParadigm based on experience
---
## 📊 Extraction Impact Analysis
### Complexity vs. Value Matrix
```
High Value │ query-paradigms │ finance │
│ │ graphql │
│ │ │
│ plugins │ matter-parsers │
Low Value │ legacy │ issues │
────────────────────────────────────
Low Complexity High Complexity
```
### Recommended Extraction Order
1. **markitect-finance** (High Value, Medium Complexity) - Complete system
2. **markitect-graphql** (High Value, Low Complexity) - Clean API layer
3. **markitect-legacy** (Medium Value, Low Complexity) - Easy win
4. **markitect-query-paradigms** (High Value, High Complexity) - Big impact
5. **markitect-plugins** (Medium Value, Medium Complexity) - Architecture
6. **markitect-matter-parsers** (Medium Value, Low Complexity) - Consolidation
7. **markitect-issues** (High Value, High Complexity) - Complex integration
---
## 🎯 Success Criteria for Extractions
Each extracted capability must meet these criteria:
### Technical Requirements
-**Zero Parent Dependencies**: No imports from main markitect project
-**Complete Test Suite**: >80% test coverage
-**Independent Build**: Can be built and tested separately
-**Documentation**: Complete README and API documentation
-**Version Management**: Independent versioning with semver
### Quality Requirements
-**Type Safety**: Complete type annotations
-**Error Handling**: Comprehensive error handling
-**Performance**: No performance regressions
-**Security**: No security vulnerabilities introduced
### Process Requirements
-**Red-Green Testing**: All tests pass after extraction
-**CI/CD**: Independent CI/CD pipeline
-**Integration**: Smooth integration with main project
-**Migration Path**: Clear upgrade/downgrade paths
---
## 📋 Core MarkiTect Capabilities (Remain in Main Project)
### Core Architectural Paradigms
#### 1. Parse-Once, Manipulate-Many Architecture™
**Paradigm**: Single parsing operation creates multiple access pathways for document manipulation.
**Innovation**: Traditional markdown processors re-parse content for each operation. MarkiTect parses once and creates multiple fast-access representations:
- **AST Cache**: JSON-serialized Abstract Syntax Tree for lightning-fast loading
- **Database Metadata**: Structured front matter and document metadata
- **Original Content**: Preserved for integrity validation
#### 2. Database-First Metadata Management
**Paradigm**: Document metadata is treated as first-class relational data, not file-system artifacts.
#### 3. Performance-Validated Caching System
**Paradigm**: Cache performance is continuously validated against benchmarks, not assumed.
#### 4. TDD8 Methodology Integration
**Paradigm**: Issue-driven development with 8-step validation cycles.
### Core System Components
#### 🗄️ Database & Storage
- Database initialization and schema management
- Markdown file storage with metadata tracking
- SQL query execution with safety constraints
- Performance optimizations for large datasets
#### 📝 Markdown Processing
- Core AST conversion and manipulation
- Document modification through AST
- Roundtrip integrity validation
- Performance-optimized parsing
#### 🚀 Performance & Caching
- AST caching system with smart invalidation
- Performance benchmarking and validation
- Memory usage optimization
- Bulk operation efficiency
#### 🖥️ CLI Framework
- Command-line interface foundation
- Configuration management
- Error handling and validation
- Output formatting
#### 🔧 System Integration
- Configuration validation
- Environment detection
- Network connectivity
- File system validation
---
## 🎯 Future Roadmap
### Post-Extraction Goals
1. **Template System**: Create capability templates from successful extractions
2. **Dependency Checker**: Automated tools for dependency compliance
3. **CI/CD Patterns**: Establish patterns for capability CI/CD
4. **Integration Testing**: Cross-capability integration test framework
### Planned Extensions
- **Distributed Capabilities**: Multi-machine capability sharing
- **Capability Marketplace**: Public registry of MarkiTect capabilities
- **AI-Assisted Extraction**: Automated capability boundary detection
---
## 📚 Getting Started with Extractions
To begin capability extraction process:
1. **Validate Test Capability**: Ensure `markitect-utils` works correctly
2. **Choose Starting Point**: Begin with `markitect-finance` (high value, clear boundaries)
3. **Follow TDD Process**: Maintain test suite throughout extraction
4. **Document Experience**: Update this document with lessons learned
For detailed extraction procedures, see:
- `/wiki/ComposableRepositoryParadigm.md` - Extraction methodology
- `/capabilities/markitect-utils/VALIDATION_REPORT.md` - Process validation
---
*This capabilities analysis reflects the current state of the MarkiTect project and provides a roadmap for systematic capability extraction following the ComposableRepositoryParadigm. All recommendations are based on architectural analysis, dependency review, and reusability assessment.*

View File

@@ -1,100 +1,50 @@
# Changelog
## [0.5.0] - 2025-10-26
### Added
- **Clean TDD-Driven Editor Architecture**: Complete rewrite with object-oriented JavaScript architecture featuring Section, SectionManager, and DOMRenderer classes
- **Enhanced Test Framework**: Comprehensive testing framework with clean separation of concerns for robust development
- **Multiple Concurrent Section Editing**: Support for editing multiple sections simultaneously with intelligent management
- **Intelligent Section Splitting**: Advanced heading detection and section management capabilities
- **Four-Layer Content Management**: Sophisticated content state management (original, current, pending, editing layers)
- **Enhanced Status Dialog**: Repository info display showing version, git commit status, and actual save filename
- **Elegant Slide-in Control Panel**: Floating control panel for edit mode with improved UX
- **Intelligent Auto-sizing Textarea**: Optimal editing experience with smart textarea resizing
- **Enhanced Empty Line Preservation**: Better markdown structure preservation with automatic paragraph separation
### Fixed
- **Textarea Sizing and Font Preservation**: Resolved sizing issues and maintained consistent font rendering
- **Markdown Structure Preservation**: Fixed roundtrip formatting issues in save functionality
- **Section Duplication Prevention**: Eliminated duplicate sections when saving edited content
- **Section Position Preservation**: Prevented unwanted section jumping during editing
- **CSS Embedding Issues**: Resolved import errors in HTML template generation
- **Control Panel UX**: Hidden control ribbon when panel is expanded for cleaner interface
### Changed
- **Action Semantics**: Proper implementation of Accept, Cancel, and Reset operations
- **Global Reset Functionality**: Enhanced reset capabilities across the editor
- **Makefile Organization**: Reorganized installation targets for better user experience
### Technical Improvements
- Complete legacy editor system replacement
- Test-driven development approach implementation
- Enhanced UI/UX with better section positioning
- Improved content management workflow
## [0.4.0] - 2025-10-25
### Added
- feat: add comprehensive testing and error tracking for edit mode
### Fixed
- fix: resolve md-render --edit functionality and add enhanced version tracking
- fix: resolve critical JavaScript syntax errors in md-render --edit
- fix: resolve md-ingest Path object conversion error
### Other
- chore: clean up repository documentation files for release
All notable changes to MarkiTect will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.2.0] - 2025-10-20
### Added
- **Production-Ready Asset Management System** with content-addressable storage
- **Advanced Performance Optimization** with 60-85% faster document processing
- **Enterprise-Grade Error Handling** with graceful recovery mechanisms
- **Comprehensive Test Suite** with 1983 tests and 100% success rate
- **GraphQL Interface** for advanced querying capabilities
- **Full-Text Search** with FTS5 backend and query optimization
- **Kaizen-Agentic Framework Integration** with 17 specialized development agents
- **Professional Documentation** with 20+ comprehensive guides
- **Cross-Platform Validation** for Unix/Windows/macOS compatibility
- **CLI Consolidation** with unified command interface
- **Template Rendering System** with validation and error handling
- **Cost Management & Tracking** with allocation engine and reporting
- **Issue Activity Tracking** with worktime distribution
- **Plugin Architecture** with builtin processors and extensible framework
- **Query Paradigms** supporting 14 different query approaches
- **Content-Matter Processing** with frontmatter, contentmatter, and tailmatter support
- Comprehensive installer system with Python and shell scripts
- Version and release information commands (`markitect version`, `markitect release`)
- Global `--version` flag for quick version checking
- Git integration for version metadata (commit, branch, tag information)
- Multiple output formats for release information (text, JSON, YAML)
- Installation documentation and troubleshooting guides
### Performance
- **60-85% performance improvement** through AST caching optimization
- **Sub-60ms asset processing** with efficient deduplication
- **Memory-efficient operations** with proper resource management
- **Scalable architecture** supporting large document collections
### Quality Assurance
- **1983 comprehensive tests** covering all functionality layers
- **Production validation suite** with cross-platform testing
- **Enterprise error handling** with graceful degradation
- **Type safety** with comprehensive type checking
- **Security validation** with input sanitization and safe operations
### Fixed
- All test failures resolved (1983/1983 tests passing)
- Visualization schema tests updated for correct tool paths
- Cache management test isolation issues
- Missing dependencies documentation and installation
- JavaScript syntax errors in edit mode initialization
- Asset registry synchronization and performance issues
- CLI command consolidation and interface consistency
### Documentation
- Added comprehensive INSTALL.md with installation instructions
- Added DEPENDENCIES.md with dependency information
- Created release process documentation
- **20+ documentation files** covering architecture, usage, and development
- Complete API documentation with examples
- Performance benchmarking guides and optimization tips
## [0.1.0] - 2025-10-03
### Added
- Initial MarkiTect implementation
- Core markdown processing with AST caching
- Front matter and content matter support
- Database integration for document metadata
- CLI interface with comprehensive commands
- Schema generation and validation
- Template rendering system
- Issue management integration
- TDD workflow tools (TDDAI)
- Comprehensive test suite with architectural layers
- Documentation and architectural guides
### Features
- Document ingestion and processing
- Metadata extraction and querying
- AST analysis and caching
- Content statistics and analysis
- Template-based document generation
- Associated file management
- Database operations with multiple output formats
- Performance monitoring and optimization
- Legacy compatibility system
### Technical
- Python 3.8+ support
- Click-based CLI framework
- SQLite database backend
- Markdown-it-py parser integration
- Comprehensive test coverage
- Type checking with mypy
- Code formatting with black
- Project structure following clean architecture principles

View File

@@ -1,239 +0,0 @@
# MarkiTect Concepts and Terminology
This document defines the core concepts, terminology, and architectural principles that drive the MarkiTect project.
## Project Vision
**"Your Markdown, Redefined"**
MarkiTect transforms markdown from plain text into intelligent, structured data with performance optimization, schema validation, and relational querying capabilities. Stop treating documentation as text files—start managing it as a database.
## Core Concepts
### Document Processing Philosophy
#### Intelligent Document Management
- **AST-First Processing**: Every document is parsed into an Abstract Syntax Tree for structured manipulation
- **Database-Driven Storage**: Documents are stored with relational metadata, not just as flat files
- **Performance-Optimized**: Intelligent caching reduces processing time by 60-85%
#### Schema-Driven Development
- **Document Schemas**: Define and enforce document structure and consistency
- **Template Systems**: Generate documents from templates with variable substitution
- **Validation Framework**: Ensure content meets predefined standards
### Key Terminology
#### Core Components
**MarkiTect Engine**
: The central processing system that parses, validates, and transforms markdown documents
**AST (Abstract Syntax Tree)**
: Structured representation of a markdown document's content and formatting
**Document Schema**
: JSON-based definition of document structure, frontmatter requirements, and content rules
**Template Engine**
: System for generating documents from templates with variable substitution (`{{variable}}` syntax)
**Performance Index**
: Weighted 0-100 scale measuring system performance across template, database, and ingestion operations
#### Data Structures
**Frontmatter**
: YAML/TOML metadata at the beginning of markdown documents containing structured information
**Contentmatter**
: Key-value pairs embedded within document content using MultiMarkdown syntax
**Tailmatter**
: QA checklists and editorial metadata at the end of documents for quality management
**Document Metadata**
: Relational data extracted from documents and stored in the database for querying
#### Processing Concepts
**Zero-Parsing Access**
: Ability to query document metadata without re-parsing the entire document
**Intelligent Caching**
: AST caching system that dramatically improves performance on subsequent document operations
**Relational Document Metadata**
: Document properties stored in a queryable database format rather than as flat text
## Architectural Principles
### Clean Architecture Foundation
#### Layered Design
```
┌─────────────────────────┐
│ Presentation Layer │ ← CLI, Web Interface
├─────────────────────────┤
│ Application Layer │ ← Use Cases, Workflows
├─────────────────────────┤
│ Domain Layer │ ← Business Logic
├─────────────────────────┤
│ Infrastructure Layer │ ← Database, File System
└─────────────────────────┘
```
#### Dependency Rules
- **Inward Dependencies**: Outer layers depend on inner layers, never the reverse
- **Business Logic Isolation**: Core domain logic is independent of external concerns
- **Interface Segregation**: Clean interfaces between layers
### Performance Philosophy
#### Optimization Strategy
1. **Cache-First**: Intelligent AST caching for repeated operations
2. **Lazy Loading**: Process only what's needed, when needed
3. **Batch Operations**: Efficient processing of multiple documents
4. **Memory Management**: Careful resource utilization and cleanup
#### Performance Metrics
- **Template Rendering**: Target >1000 operations/second
- **Database Operations**: Target >100 operations/second
- **Document Ingestion**: Target >1000 operations/second
- **Memory Usage**: Keep under 50MB baseline
### Quality Assurance
#### Testing Strategy
- **TDD8 Methodology**: Test-Driven Development with 8-step cycle
- **Comprehensive Coverage**: Unit, integration, and end-to-end testing
- **Performance Validation**: Automated benchmarking and regression detection
- **Quality Gates**: Automated checks preventing quality degradation
#### Documentation Standards
- **DRY Principle**: Don't Repeat Yourself - avoid documentation duplication
- **Arc42 Framework**: Structured architecture documentation when complexity warrants
- **Living Documentation**: Documentation that evolves with the code
## Business Concepts
### Use Cases
#### Document Automation
- **Invoice Generation**: Automated creation of business invoices from templates
- **Report Pipelines**: Batch processing of document collections
- **Content Management**: Structured content workflow management
#### Content Analysis
- **Metadata Extraction**: Automated extraction of document properties
- **Content Validation**: Enforcement of document standards and requirements
- **Relationship Mapping**: Understanding connections between documents
#### Performance Management
- **Regression Detection**: Automated identification of performance degradation
- **Optimization Tracking**: Measurement of improvement initiatives
- **Baseline Management**: Establishment and maintenance of performance standards
### Value Propositions
#### Primary USPs (Unique Selling Points)
1. **Relational Document Metadata**: Documents as queryable database entities
2. **Zero-Parsing Content Access**: Instant access to document information
3. **Performance-First Design**: Dramatically faster than traditional markdown processors
#### Enterprise Benefits
- **Consistency**: Schema validation ensures document standardization
- **Efficiency**: Automated workflows reduce manual document management
- **Scalability**: Performance optimization supports large document collections
- **Quality**: Built-in validation and testing ensure reliability
## Technical Concepts
### Data Flow Architecture
#### Document Ingestion Pipeline
```
Markdown → Parser → AST → Metadata → Database
↓ ↓ ↓ ↓ ↓
Cache Validate Schema Extract Store
```
#### Query Processing
```
Query → Database → Metadata → Reconstruct → Results
↓ ↓ ↓ ↓ ↓
Index Optimize Filter Transform Format
```
### Integration Patterns
#### CLI-First Design
- **Command-Line Interface**: Primary interaction method for automation
- **Scriptable Operations**: All functionality accessible via CLI commands
- **Pipeline Integration**: Designed for CI/CD and automated workflows
#### Database Integration
- **SQLite Backend**: Lightweight, embedded database for metadata storage
- **Relational Queries**: SQL-like operations on document collections
- **ACID Compliance**: Reliable data consistency and transaction safety
### Extension Points
#### Plugin Architecture
- **Modular Design**: Core functionality extended through plugins
- **Template Engines**: Multiple template processing backends
- **Output Formats**: Extensible document generation formats
#### External Integration
- **API Endpoints**: RESTful interfaces for external systems
- **Webhook Support**: Event-driven integration capabilities
- **Import/Export**: Data exchange with external tools and formats
## Development Concepts
### Workflow Methodology
#### TDD8 Cycle
1. **ISSUE**: Define problem and requirements
2. **TEST**: Write tests before implementation
3. **RED**: Ensure tests fail initially
4. **GREEN**: Implement minimum viable solution
5. **REFACTOR**: Improve code quality and design
6. **DOCUMENT**: Update documentation and examples
7. **REFINE**: Performance optimization and polish
8. **PUBLISH**: Release and communicate changes
#### Quality Standards
- **Code Coverage**: Minimum 80% test coverage
- **Performance Benchmarks**: All operations must meet performance targets
- **Documentation Currency**: Documentation updated with every feature change
- **Backward Compatibility**: Changes preserve existing functionality
### Maintenance Philosophy
#### Sustainable Development
- **Technical Debt Management**: Regular refactoring and code quality improvement
- **Performance Monitoring**: Continuous tracking of system performance
- **User Experience Focus**: Features designed from user workflow perspective
- **Community Engagement**: Open source collaboration and contribution
#### Future-Proofing
- **Modular Architecture**: Easy addition of new features and capabilities
- **Standard Compliance**: Adherence to markdown and web standards
- **Scalability Design**: Architecture supports growth in users and document volume
- **Technology Evolution**: Designed to adapt to changing technology landscape
## Glossary
**Arc42**: Architecture documentation framework for technical communication
**AST**: Abstract Syntax Tree - structured representation of document content
**CLI**: Command-Line Interface - text-based user interface
**DRY**: Don't Repeat Yourself - principle of reducing duplication
**TDD**: Test-Driven Development - testing methodology
**TOML**: Tom's Obvious Minimal Language - configuration file format
**USP**: Unique Selling Point - distinctive business advantage
**YAML**: YAML Ain't Markup Language - human-readable data serialization
---
This document serves as the foundation for understanding MarkiTect's design philosophy, technical approach, and business value proposition. It should be consulted when making architectural decisions or explaining the project to new contributors.

205
CONFIG.md
View File

@@ -1,205 +0,0 @@
# TDDAi Configuration Management
> **⚠️ DEPRECATED**: The tddai framework has been replaced by the [issue-facade](issue-facade/) system. This documentation is kept for historical reference only.
>
> **For current issue management**: See [issue-facade/README.md](issue-facade/README.md)
The tddai framework uses a flexible, hierarchical configuration system designed for project-agnostic deployment while supporting per-project customization.
## Configuration Hierarchy
Configuration values are loaded in the following priority order (highest to lowest):
1. **Environment Variables** - Runtime overrides (highest priority)
2. **`.env.tddai` File** - Project-specific configuration (auto-loaded)
3. **Default Values** - Framework defaults (fallback)
## Quick Start
### Automatic Configuration (Recommended)
The framework automatically loads `.env.tddai` from the current directory:
```bash
# Configuration loaded automatically
make tdd-status
make tdd-start NUM=5
```
### Manual Configuration
You can also source the setup script manually:
```bash
source tddai-setup.sh
make tdd-status
```
## Configuration Options
### Repository Settings (Required)
| Variable | Description | Example | Required |
|----------|-------------|---------|----------|
| `TDDAI_GITEA_URL` | Git platform URL | `https://github.com` | ✅ |
| `TDDAI_REPO_OWNER` | Repository owner/org | `myusername` | ✅ |
| `TDDAI_REPO_NAME` | Repository name | `myproject` | ✅ |
### Workspace Settings (Optional)
| Variable | Description | Default | Example |
|----------|-------------|---------|---------|
| `TDDAI_WORKSPACE_DIR` | TDD workspace directory | `.tddai_workspace` | `.myproject_workspace` |
### Test Settings (Framework Defaults)
| Setting | Value | Description |
|---------|-------|-------------|
| `tests_dir` | `tests/` | Main test directory |
| `test_file_pattern` | `test_issue_{issue_num}_{scenario}.py` | Test file naming pattern |
| `current_issue_file` | `current_issue.json` | Active issue metadata file |
## Configuration Files
### `.env.tddai` Format
```bash
# TDDAi configuration for YourProject
# Repository settings
TDDAI_GITEA_URL=https://your-git-platform.com
TDDAI_REPO_OWNER=yourusername
TDDAI_REPO_NAME=yourproject
# Workspace settings (optional)
TDDAI_WORKSPACE_DIR=.yourproject_workspace
```
### `tddai-setup.sh` Format
```bash
#!/bin/bash
# TDDAi environment setup script
export TDDAI_GITEA_URL=https://your-git-platform.com
export TDDAI_REPO_OWNER=yourusername
export TDDAI_REPO_NAME=yourproject
export TDDAI_WORKSPACE_DIR=.yourproject_workspace
echo "✅ TDDAi configured for YourProject"
```
## Platform Examples
### GitHub Configuration
```bash
TDDAI_GITEA_URL=https://github.com
TDDAI_REPO_OWNER=yourusername
TDDAI_REPO_NAME=yourrepo
```
### GitLab Configuration
```bash
TDDAI_GITEA_URL=https://gitlab.com
TDDAI_REPO_OWNER=yourusername
TDDAI_REPO_NAME=yourrepo
```
### Self-hosted Gitea
```bash
TDDAI_GITEA_URL=https://git.yourcompany.com
TDDAI_REPO_OWNER=yourorganization
TDDAI_REPO_NAME=yourproject
```
## API Integration
The configuration automatically constructs API URLs:
```python
# Constructed from configuration
issues_api_url = f"{TDDAI_GITEA_URL}/api/v1/repos/{TDDAI_REPO_OWNER}/{TDDAI_REPO_NAME}/issues"
```
## Workspace Structure
Default workspace layout (configurable via `TDDAI_WORKSPACE_DIR`):
```
.tddai_workspace/
├── current_issue.json # Active issue metadata
└── issue_X/ # Issue-specific workspace
├── tests/ # Test files for this issue
│ └── test_issue_X_*.py # Generated test files
├── requirements.md # Issue requirements analysis
└── test_plan.md # Test planning document
```
## Environment Variable Overrides
You can override any configuration at runtime:
```bash
# Override workspace directory for this session
TDDAI_WORKSPACE_DIR=.custom_workspace make tdd-start NUM=5
# Override repository for testing
TDDAI_REPO_NAME=test_repo make tdd-status
```
## Validation
The framework validates configuration on startup:
- **Required fields** must be non-empty (`gitea_url`, `repo_owner`, `repo_name`)
- **URLs** should include protocol (`http://` or `https://`)
- **Workspace directories** are created automatically if they don't exist
## Troubleshooting
### Common Errors
**`gitea_url cannot be empty`**
- Solution: Create `.env.tddai` with `TDDAI_GITEA_URL=your-url`
- Alternative: Run `source tddai-setup.sh` before tddai commands
**`repo_owner cannot be empty`**
- Solution: Set `TDDAI_REPO_OWNER` in `.env.tddai` or environment
**`repo_name cannot be empty`**
- Solution: Set `TDDAI_REPO_NAME` in `.env.tddai` or environment
### Debug Configuration
```bash
# Check current configuration
python -c "from tddai.config import get_config; c=get_config(); print(f'URL: {c.gitea_url}\\nOwner: {c.repo_owner}\\nRepo: {c.repo_name}\\nWorkspace: {c.workspace_dir}')"
```
## Migration from Other Projects
When adapting tddai for a new project:
1. **Copy configuration template**:
```bash
cp .env.tddai.example .env.tddai
```
2. **Update repository settings**:
```bash
# Edit .env.tddai
TDDAI_GITEA_URL=https://your-platform.com
TDDAI_REPO_OWNER=your-username
TDDAI_REPO_NAME=your-project
```
3. **Test configuration**:
```bash
make tdd-status
```
## Best Practices
- **Use `.env.tddai`** for project-specific settings
- **Use environment variables** for temporary overrides
- **Keep configuration in version control** (but exclude sensitive tokens)
- **Document custom workspace naming** in project README
- **Validate configuration** before starting development sessions
---
*This configuration system supports the TDD8 methodology (ISSUE-TEST-RED-GREEN-REFACTOR-DOCUMENT-REFINE-PUBLISH) across any software development project with issue tracking.*

View File

@@ -1,92 +0,0 @@
# MarkiTect Project Dependencies
## Overview
This document lists all project dependencies for the MarkiTect project.
## Production Dependencies
These are required for running the application:
- **markdown-it-py** - Markdown parsing library
- **PyYAML** - YAML file processing
- **click>=8.0.0** - Command-line interface framework
- **tabulate>=0.9.0** - Table formatting for output
- **jsonpath-ng>=1.5.0** - JSONPath query support
- **aiohttp>=3.8.0** - Async HTTP client/server
- **toml** - TOML file parsing (for frontmatter support)
## Development Dependencies
These are required for development, testing, and code quality:
- **pytest** - Testing framework
- **pytest-cov** - Test coverage reporting
- **black** - Code formatting
- **flake8** - Code linting
- **mypy** - Type checking
## Test Dependencies
Additional dependencies for testing (from tests/requirements-test.txt if present):
- See `tests/requirements-test.txt` for any additional test-specific dependencies
## Installation
### Quick Setup
```bash
# Install production dependencies only
pip install -e .
# Install with development dependencies
make dev
```
### Manual Installation
```bash
# Production dependencies
pip install markdown-it-py PyYAML click>=8.0.0 tabulate>=0.9.0 jsonpath-ng>=1.5.0 aiohttp>=3.8.0 toml
# Development dependencies
pip install pytest pytest-cov black flake8 mypy
```
### Virtual Environment Setup
```bash
# Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install dependencies
make dev
```
## Running Tests
After installing dependencies:
```bash
# Run all tests
make test
# Run tests with coverage
pytest --cov
# Run specific test layers
make test-foundation
make test-infrastructure
make test-integration
```
## Code Quality Tools
```bash
# Format code
make format
# Run linting
make lint
# Type checking
mypy markitect/
```
## Notes
- Python 3.8+ is required
- Virtual environment (.venv) is recommended
- All dependencies are managed through pyproject.toml

View File

@@ -1,219 +0,0 @@
# MarkiTect Installation Guide
This document describes how to install MarkiTect and make it available system-wide.
## Quick Installation
For most users, the quick installer is the easiest option:
```bash
# Install for current user
./install.sh
# Install system-wide (requires sudo)
./install.sh --system
# Install in development mode with test dependencies
./install.sh --dev
```
## Advanced Installation
For more control over the installation process, use the Python installer:
```bash
# Install with custom prefix
python install.py --prefix /opt/markitect
# Install with custom virtual environment location
python install.py --venv-dir /path/to/custom/venv
# Install without creating symbolic links (manual PATH setup)
python install.py --no-symlinks
# Force reinstallation over existing installation
python install.py --force
```
## Installation Options
### Installation Types
- **User Installation** (default): Installs to `~/.local/`
- **System Installation** (`--system`): Installs to `/usr/local/` (requires sudo)
- **Development Installation** (`--dev`): Installs in editable mode with test dependencies
### Installation Paths
By default, MarkiTect is installed to:
- **User installation**: `~/.local/lib/markitect/` (virtual environment)
- **System installation**: `/usr/local/lib/markitect/` (virtual environment)
- **Binaries**: `~/.local/bin/` or `/usr/local/bin/`
### Available Commands
After installation, these commands will be available:
- `markitect` - Main MarkiTect CLI
- `tddai` - TDD workflow management
- `issue` - Issue management
## Checking Installation
Check if MarkiTect is already installed:
```bash
./install.sh --check
# or
python install.py --check
```
Check version after installation:
```bash
markitect version
markitect version --short
markitect release
```
## Uninstallation
To remove MarkiTect:
```bash
./install.sh --uninstall
# or
python install.py --uninstall
```
## Manual Installation
If you prefer to install manually:
1. **Create virtual environment:**
```bash
python -m venv ~/.local/lib/markitect
```
2. **Activate virtual environment:**
```bash
source ~/.local/lib/markitect/bin/activate
```
3. **Install MarkiTect:**
```bash
pip install -e .
```
4. **Create symbolic links:**
```bash
mkdir -p ~/.local/bin
ln -sf ~/.local/lib/markitect/bin/markitect ~/.local/bin/markitect
ln -sf ~/.local/lib/markitect/bin/tddai ~/.local/bin/tddai
ln -sf ~/.local/lib/markitect/bin/issue ~/.local/bin/issue
```
5. **Add to PATH** (add to `~/.bashrc` or `~/.zshrc`):
```bash
export PATH="$HOME/.local/bin:$PATH"
```
## Development Installation
For development work:
```bash
# Install in development mode
./install.sh --dev
# This includes:
# - Editable installation (changes reflect immediately)
# - Test dependencies (pytest, black, flake8, mypy)
# - All development tools
```
## Troubleshooting
### Common Issues
1. **Command not found after installation:**
- Make sure `~/.local/bin` is in your PATH
- Run: `export PATH="$HOME/.local/bin:$PATH"`
- Add the export to your shell profile
2. **Permission denied on system installation:**
- Use `sudo ./install.sh --system`
- Or install to user directory instead
3. **Python version error:**
- MarkiTect requires Python 3.8 or higher
- Check version: `python3 --version`
4. **Installation already exists:**
- Use `--force` to overwrite: `./install.sh --force`
- Or uninstall first: `./install.sh --uninstall`
### Manual PATH Setup
If symbolic links don't work, add the virtual environment bin directory to your PATH:
```bash
# For bash/zsh (add to ~/.bashrc or ~/.zshrc)
export PATH="$HOME/.local/lib/markitect/bin:$PATH"
# For fish (add to ~/.config/fish/config.fish)
set -gx PATH $HOME/.local/lib/markitect/bin $PATH
```
### Testing Installation
After installation, verify everything works:
```bash
# Test basic functionality
markitect --help
markitect version
# Test TDD tools
tddai --help
# Test issue management
issue --help
```
## Dependencies
MarkiTect automatically installs these dependencies:
### Production Dependencies
- markdown-it-py - Markdown parsing
- PyYAML - YAML processing
- click>=8.0.0 - CLI framework
- tabulate>=0.9.0 - Table formatting
- jsonpath-ng>=1.5.0 - JSONPath queries
- aiohttp>=3.8.0 - Async HTTP client
- toml - TOML file parsing
### Development Dependencies (with --dev)
- pytest - Testing framework
- pytest-cov - Test coverage
- black - Code formatting
- flake8 - Code linting
- mypy - Type checking
## System Requirements
- Python 3.8 or higher
- pip (Python package installer)
- git (optional, for version info)
- Unix-like system (Linux, macOS) or Windows with Python support
## Support
For installation issues:
1. Check this guide first
2. Run `./install.sh --check` to diagnose problems
3. See the main project documentation
4. Report issues on the project issue tracker

View File

@@ -1,32 +0,0 @@
# MIT License
Copyright (c) 2025 MarkiTect Project
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
## Additional Information
This project uses the MIT License to promote open source collaboration while protecting contributors. The MIT License is:
- **Permissive**: Allows commercial and private use
- **Simple**: Easy to understand and implement
- **Compatible**: Works well with other open source licenses
- **Widely Adopted**: Recognized and trusted in the open source community
For questions about licensing or commercial use, please contact the project maintainers.

188
Makefile
View File

@@ -1,7 +1,7 @@
# MarkiTect - Advanced Markdown Engine
# Makefile for common development tasks
.PHONY: help setup install-dev install-home install-home-venv install-deps install-deps-force install-deps-venv install-system list-deps setup-dev test build clean update status lint format check-deps venv-status update-digest add-diary-entry test-status test-new test-coverage test-arch test-foundation test-infrastructure test-integration test-domain test-service test-application test-presentation test-quick test-layers test-random test-random-seed test-random-repeat test-install-randomly test-clean test-tdd test-changed test-module test-cache-clean test-efficient cli-help release-status release-validate release-prepare release-build release-publish release-dry-run chaos-validate chaos-matrix chaos-inject chaos-report cost-help
.PHONY: help setup install install-dev uninstall install-home install-home-venv install-user-deps install-force-deps install-deps-venv install-system-deps list-deps setup-dev test build clean update status lint format check-deps venv-status update-digest add-diary-entry test-status test-new test-coverage test-arch test-foundation test-infrastructure test-integration test-domain test-service test-application test-presentation test-quick test-layers test-random test-random-seed test-random-repeat test-install-randomly test-clean test-tdd test-changed test-module test-cache-clean test-efficient cli-help release-status release-validate release-prepare release-build release-publish release-dry-run chaos-validate chaos-matrix chaos-inject chaos-report cost-help
# Default target
help:
@@ -13,19 +13,21 @@ help:
@echo ""
@echo "Setup & Installation:"
@echo " setup - Initial project setup (venv + install-dev)"
@echo " install - Install markitect globally (recommended)"
@echo " install-dev - Install package in development mode"
@echo " install-home - Install markitect binary to ~/bin/"
@echo " install-deps - Install dependencies (tries user-local first)"
@echo " install-deps-force - Force install with --break-system-packages"
@echo " install-deps-venv - Install to user virtual environment"
@echo " install-home-venv - Install binary using user virtual environment"
@echo " install-system - Install system dependencies via apt (requires sudo)"
@echo " uninstall - Remove global markitect installation"
@echo " list-deps - List required dependencies for markitect"
@echo " setup-dev - Install with development dependencies"
@echo " venv-status - Check if venv is active"
@echo ""
@echo "Advanced Installation:"
@echo " install-user-deps - Install dependencies to user location only"
@echo " install-system-deps - Install dependencies via system packages (sudo)"
@echo " install-force-deps - Force install with --break-system-packages"
@echo ""
@echo "Development:"
@echo " test - Run all tests"
@echo " test - Run core tests (excluding capability-specific tests)"
@echo " test-capabilities - Run all capability-specific tests"
@echo " test-capability-* - Run specific capability tests (content, utils, finance, etc.)"
@echo " test-status - Show test status summary without re-running"
@echo " test-new - Create new test file template"
@echo " test-coverage - Analyze test coverage"
@@ -81,11 +83,17 @@ help:
@echo " status - Show git status for repo and submodules"
@echo " clean - Clean build artifacts"
@echo " check-deps - Check dependency status"
@echo " validate-js - Validate JavaScript syntax in templates"
@echo ""
@echo "Documentation:"
@echo " update-digest - Update ProjectStatusDigest.md (requires Claude Code)"
@echo " add-diary-entry - Add new entry to ProjectDiary.md (requires Claude Code)"
@echo ""
@echo "Capability Management:"
@echo " capability-report - Generate capability discovery report"
@echo " capability-search TERM=xyz - Search for functionality across capabilities"
@echo " capability-validate FILE=path - Validate proper capability usage in file"
@echo ""
@echo ""
@echo "Requirements Engineering:"
@echo " validate-requirements - Analyze foundations before development"
@@ -133,6 +141,40 @@ $(VENV)/bin/activate:
$(PYTHON) -m venv $(VENV)
$(VENV_PIP) install --upgrade pip setuptools wheel
# Install markitect globally (recommended approach)
install:
@echo "🚀 Installing MarkiTect globally..."
@echo "📦 Creating user virtual environment with dependencies..."
@$(MAKE) --no-print-directory install-deps-venv
@echo "🏠 Installing markitect binary to ~/bin/..."
@$(MAKE) --no-print-directory install-home-venv
@echo ""
@echo "✅ MarkiTect installed successfully!"
@echo "💡 Make sure ~/bin is in your PATH:"
@echo " export PATH=\"$$HOME/bin:$$PATH\""
@echo ""
@echo "🧪 Test installation:"
@echo " markitect version"
# Remove global markitect installation
uninstall:
@echo "🗑️ Removing MarkiTect global installation..."
@if [ -f "$$HOME/bin/markitect" ]; then \
echo " Removing binary: $$HOME/bin/markitect"; \
rm "$$HOME/bin/markitect"; \
echo " ✅ Binary removed"; \
else \
echo " Binary not found at $$HOME/bin/markitect"; \
fi
@if [ -d "$$HOME/.local/markitect-venv" ]; then \
echo " Removing virtual environment: $$HOME/.local/markitect-venv"; \
rm -rf "$$HOME/.local/markitect-venv"; \
echo " ✅ Virtual environment removed"; \
else \
echo " Virtual environment not found"; \
fi
@echo "✅ MarkiTect uninstalled successfully!"
# Install package in development mode
install-dev: $(VENV)/bin/activate
@echo "📦 Installing MarkiTect in development mode..."
@@ -207,13 +249,14 @@ list-deps:
@echo " toml - TOML configuration parsing"
@echo ""
@echo "🔧 Installation options:"
@echo " make install-deps - Install user-local (recommended)"
@echo " make install-system - Install via apt + pip --user (requires sudo)"
@echo " make install - Install globally (recommended)"
@echo " make install-user-deps - Install user-local dependencies only"
@echo " make install-system-deps - Install via apt + pip --user (requires sudo)"
@echo " pip3 install --user [packages] - Manual user-local installation"
@echo " pip install -e . - Install from project directory (dev mode)"
# Install user-local dependencies for markitect (no sudo needed)
install-deps:
install-user-deps:
@echo "📦 Installing MarkiTect dependencies (user-local)..."
@echo "🐍 Target Python: $$(which python3) (version: $$(python3 --version))"
@echo "📍 pip3 location: $$(which pip3)"
@@ -225,12 +268,12 @@ install-deps:
echo "❌ User-local installation failed (externally-managed-environment)"; \
echo ""; \
echo "🔧 Alternative solutions:"; \
echo " 1. Use system packages: make install-system"; \
echo " 2. Override restriction: make install-deps-force"; \
echo " 1. Use system packages: make install-system-deps"; \
echo " 2. Override restriction: make install-force-deps"; \
echo " 3. Create user venv: make install-deps-venv"; \
echo " 4. Use development setup: make setup"; \
echo ""; \
echo "💡 Recommended: Try 'make install-system' first"; \
echo "💡 Recommended: Try 'make install' for complete setup"; \
exit 1; \
fi
@echo "🧪 Testing import..."
@@ -238,7 +281,7 @@ install-deps:
@echo "💡 You can now use 'markitect' command if it's in your PATH"
# Force install user-local dependencies (overrides externally-managed restriction)
install-deps-force:
install-force-deps:
@echo "📦 Force installing MarkiTect dependencies (overriding restrictions)..."
@echo "⚠️ This uses --break-system-packages flag"
@echo " Only use if you understand the implications"
@@ -279,7 +322,7 @@ install-deps-venv:
@echo "💡 To use this, run 'make install-home-venv' instead of 'make install-home'"
# Install system dependencies via apt (requires sudo)
install-system:
install-system-deps:
@echo "📦 Installing MarkiTect dependencies via apt..."
@echo "⚠️ This requires sudo and installs system packages"
@echo ""
@@ -305,7 +348,7 @@ install-system:
echo "💡 You can now use 'markitect' command if it's in your PATH"; \
else \
echo "❌ Installation cancelled"; \
echo "💡 Alternative: Use 'make install-deps' for user-local installation"; \
echo "💡 Alternative: Use 'make install' for automated setup"; \
fi
# Install with development dependencies
@@ -315,25 +358,77 @@ setup-dev: install-dev
# Run tests
test: $(VENV)/bin/activate
@echo "🧪 Running tests..."
@echo "🧪 Running core tests (excluding capability-specific tests)..."
@if [ -f $(VENV)/bin/pytest ]; then \
PYTHONPATH=. $(VENV)/bin/pytest tests/ -v; \
PYTHONPATH=. $(VENV)/bin/pytest tests/ -v \
--ignore=capabilities/markitect-content/tests/ \
--ignore=capabilities/markitect-utils/tests/ \
--ignore=markitect/finance/tests/ \
--ignore=markitect/query_paradigms/tests/ \
--ignore=markitect/graphql/tests/ \
--ignore=markitect/plugins/tests/; \
else \
PYTHONPATH=. $(VENV_PYTHON) -m pytest tests/ -v 2>/dev/null || \
PYTHONPATH=. $(VENV_PYTHON) -m pytest tests/ -v \
--ignore=capabilities/markitect-content/tests/ \
--ignore=capabilities/markitect-utils/tests/ \
--ignore=markitect/finance/tests/ \
--ignore=markitect/query_paradigms/tests/ \
--ignore=markitect/graphql/tests/ \
--ignore=markitect/plugins/tests/ 2>/dev/null || \
PYTHONPATH=. $(VENV_PYTHON) -m unittest discover tests/ -v; \
fi
# Capability-Specific Test Targets
test-capabilities: test-capability-content test-capability-utils test-capability-finance test-capability-query test-capability-graphql test-capability-plugins
@echo "✅ All capability tests completed"
test-capability-content: $(VENV)/bin/activate
@echo "🧪 Running markitect-content capability tests..."
@cd capabilities/markitect-content && python -m pytest tests/ -v
test-capability-utils: $(VENV)/bin/activate
@echo "🧪 Running markitect-utils capability tests..."
@cd capabilities/markitect-utils && python -m pytest tests/ -v
test-capability-finance: $(VENV)/bin/activate
@echo "🧪 Running finance capability tests..."
@PYTHONPATH=. $(VENV_PYTHON) -m pytest markitect/finance/tests/ -v
test-capability-query: $(VENV)/bin/activate
@echo "🧪 Running query paradigms capability tests..."
@PYTHONPATH=. $(VENV_PYTHON) -m pytest markitect/query_paradigms/tests/ -v
test-capability-graphql: $(VENV)/bin/activate
@echo "🧪 Running GraphQL capability tests..."
@PYTHONPATH=. $(VENV_PYTHON) -m pytest markitect/graphql/tests/ -v
test-capability-plugins: $(VENV)/bin/activate
@echo "🧪 Running plugins capability tests..."
@PYTHONPATH=. $(VENV_PYTHON) -m pytest markitect/plugins/tests/ -v
# TDD8 Workflow Optimized Test Targets (Issue #57)
# Fast test execution for TDD red phase
test-red: $(VENV)/bin/activate
@echo "🔴 TDD Red Phase - Fast test execution..."
PYTHONPATH=. $(VENV_PYTHON) -m pytest tests/ -x --maxfail=1 --tb=short -q
PYTHONPATH=. $(VENV_PYTHON) -m pytest tests/ -x --maxfail=1 --tb=short -q \
--ignore=capabilities/markitect-content/tests/ \
--ignore=capabilities/markitect-utils/tests/ \
--ignore=markitect/finance/tests/ \
--ignore=markitect/query_paradigms/tests/ \
--ignore=markitect/graphql/tests/ \
--ignore=markitect/plugins/tests/
# Comprehensive test execution for TDD green phase
test-green: $(VENV)/bin/activate
@echo "🟢 TDD Green Phase - Comprehensive validation..."
PYTHONPATH=. $(VENV_PYTHON) -m pytest tests/ --tb=short
PYTHONPATH=. $(VENV_PYTHON) -m pytest tests/ --tb=short \
--ignore=capabilities/markitect-content/tests/ \
--ignore=capabilities/markitect-utils/tests/ \
--ignore=markitect/finance/tests/ \
--ignore=markitect/query_paradigms/tests/ \
--ignore=markitect/graphql/tests/ \
--ignore=markitect/plugins/tests/
# Smart test selection - changed files only
test-smart: $(VENV)/bin/activate
@@ -349,12 +444,24 @@ test-smart: $(VENV)/bin/activate
# Ultra-fast test execution
test-ultra-fast: $(VENV)/bin/activate
@echo "⚡ Ultra-fast test execution..."
PYTHONPATH=. $(VENV_PYTHON) -m pytest tests/ -m "not slow" --maxfail=1 -x -q
PYTHONPATH=. $(VENV_PYTHON) -m pytest tests/ -m "not slow" --maxfail=1 -x -q \
--ignore=capabilities/markitect-content/tests/ \
--ignore=capabilities/markitect-utils/tests/ \
--ignore=markitect/finance/tests/ \
--ignore=markitect/query_paradigms/tests/ \
--ignore=markitect/graphql/tests/ \
--ignore=markitect/plugins/tests/
# Test with performance monitoring
test-perf: $(VENV)/bin/activate
@echo "📊 Test execution with performance monitoring..."
PYTHONPATH=. $(VENV_PYTHON) -m pytest tests/ --durations=10 --tb=short
PYTHONPATH=. $(VENV_PYTHON) -m pytest tests/ --durations=10 --tb=short \
--ignore=capabilities/markitect-content/tests/ \
--ignore=capabilities/markitect-utils/tests/ \
--ignore=markitect/finance/tests/ \
--ignore=markitect/query_paradigms/tests/ \
--ignore=markitect/graphql/tests/ \
--ignore=markitect/plugins/tests/
# Test health check
test-health: $(VENV)/bin/activate
@@ -545,6 +652,27 @@ add-diary-entry:
@echo ""
@echo "💡 Tip: New entries are added to the top for reverse chronological order"
# Capability discovery and management targets
capability-report: $(VENV)/bin/activate
@echo "📋 Generating capability discovery report..."
@$(VENV_PYTHON) tools/capability_discovery.py report
capability-search: $(VENV)/bin/activate
@if [ -z "$(TERM)" ]; then \
echo "❌ Please specify search term: make capability-search TERM=issue_management"; \
exit 1; \
fi
@echo "🔍 Searching for '$(TERM)' across capabilities..."
@$(VENV_PYTHON) tools/capability_discovery.py search "$(TERM)"
capability-validate: $(VENV)/bin/activate
@if [ -z "$(FILE)" ]; then \
echo "❌ Please specify file path: make capability-validate FILE=path/to/file.py"; \
exit 1; \
fi
@echo "✅ Validating capability usage in $(FILE)..."
@$(VENV_PYTHON) tools/capability_discovery.py validate "$(FILE)"
# Git repository and API configuration
GITEA_URL := http://92.205.130.254:32166
@@ -1248,3 +1376,13 @@ cost-help:
@echo "💰 Currency: Costs calculated in USD and EUR"
@echo "🤖 Model: Default claude-sonnet-4 pricing"
# JavaScript validation for edit mode templates
validate-js: $(VENV)/bin/activate
@echo "🔍 Validating JavaScript syntax in templates..."
@if command -v node >/dev/null 2>&1; then \
$(PYTHON) tools/validate_js_syntax.py; \
else \
echo "⚠️ Node.js not available - skipping JavaScript validation"; \
echo " Install Node.js to enable JavaScript syntax checking"; \
fi

View File

@@ -1,21 +0,0 @@
MarkiTect - Advanced Markdown Engine
Your Markdown, Redefined.
MarkiTect transforms markdown from plain text into intelligent, structured data with performance optimization, schema validation, and relational querying capabilities. Stop treating documentation as text files—start managing it as a database.
**Key Features:**
- **Lightning Performance**: 60-85% faster document processing through intelligent AST caching
- **Schema Validation**: Enforce document structure and consistency
- **Database Integration**: Query markdown content with SQL-like operations
- **CLI Tools**: Complete command-line interface for automation and workflows
## 📚 Documentation
**Quick Start:** [Getting Started](#getting-started) · [Command Reference](docs/user-guides/cache-management.md)
**Architecture:** [Caching System](docs/architecture/caching-system.md) · [Performance Philosophy](docs/#performance-philosophy)
**Development:** [TDD Workflow](docs/development/tdd-workflow.md) · [Contributing](#contributing)
**Project Status:** [Current Status](history/ProjectStatusDigest.md) · [Roadmap](history/ROADMAP.md) · [Next Actions](NEXT.md)

View File

@@ -1,332 +0,0 @@
# MarkiTect Release Process
This document describes the release process for MarkiTect, including versioning strategy, automation tools, and distribution guidelines.
## Quick Start
The simplest way to create a release:
```bash
# 1. Prepare the release
make release-prepare VERSION=1.0.0
# 2. Review and commit changes
git add -A && git commit -m "Prepare release 1.0.0"
# 3. Publish the release
make release-publish VERSION=1.0.0
```
## Release Commands
### Status and Validation
```bash
# Check current release status
make release-status
# Validate repository for release
make release-validate
```
### Release Preparation
```bash
# Prepare a new release (updates version, changelog)
make release-prepare VERSION=x.y.z
# Test preparation without making changes
make release-dry-run VERSION=x.y.z
```
### Building and Publishing
```bash
# Build release packages only
make release-build [VERSION=x.y.z]
# Complete release (build + tag + publish)
make release-publish VERSION=x.y.z
```
## Versioning Strategy
MarkiTect follows [Semantic Versioning](https://semver.org/):
- **MAJOR.MINOR.PATCH** (e.g., 1.2.3)
- **Pre-release**: MAJOR.MINOR.PATCH-{alpha|beta|rc}.N (e.g., 1.2.3-beta.1)
### Version Types
- **Major (X.0.0)**: Breaking changes, incompatible API changes
- **Minor (x.Y.0)**: New features, backward compatible
- **Patch (x.y.Z)**: Bug fixes, backward compatible
- **Pre-release**: Alpha, beta, or release candidate versions
### Examples
```bash
# Major release
make release-prepare VERSION=2.0.0
# Minor release
make release-prepare VERSION=1.1.0
# Patch release
make release-prepare VERSION=1.0.1
# Pre-release
make release-prepare VERSION=1.1.0-beta.1
```
## Release Validation
Before a release can be created, the following validations are performed:
### Required Conditions
1. **Clean Repository**: No uncommitted changes
2. **Main Branch**: Must be on the `main` branch
3. **Passing Tests**: All tests must pass
4. **Valid Version**: Version must follow semantic versioning
5. **Version Increment**: New version must be greater than current
### Override Validation
Use `--force` to override validation warnings:
```bash
python release.py prepare --version 1.0.1 --force
```
## Automated Release Process
### What `release-prepare` Does
1. **Version Update**: Updates `pyproject.toml` and `markitect/__version__.py`
2. **Changelog Generation**: Creates/updates `CHANGELOG.md` from git commits
3. **Validation**: Ensures repository is ready for release
### What `release-publish` Does
1. **Package Building**: Creates source distribution and wheel
2. **Git Tagging**: Creates annotated git tag (e.g., `v1.0.0`)
3. **Tag Push**: Pushes tag to remote repository
## Manual Release Process
If you prefer manual control:
### 1. Update Version
```bash
# Edit pyproject.toml
version = "1.0.0"
# Edit markitect/__version__.py
__version__ = "1.0.0"
```
### 2. Update Changelog
Edit `CHANGELOG.md` to add release notes for the new version.
### 3. Commit Changes
```bash
git add -A
git commit -m "Prepare release 1.0.0"
```
### 4. Build Packages
```bash
make release-build
```
### 5. Create Git Tag
```bash
git tag -a v1.0.0 -m "Release 1.0.0"
git push origin v1.0.0
```
## Distribution
### Package Types
MarkiTect releases include:
- **Source Distribution** (`.tar.gz`): Full source code package
- **Wheel** (`.whl`): Pre-built binary package for faster installation
### Installation Methods
Users can install MarkiTect in several ways:
```bash
# From PyPI (when published)
pip install markitect
# From wheel file
pip install markitect-1.0.0-py3-none-any.whl
# From source
pip install markitect-1.0.0.tar.gz
# Development installation
pip install -e .
```
### Release Artifacts
Each release creates:
- Source and wheel packages in `dist/`
- Git tag (e.g., `v1.0.0`)
- Updated `CHANGELOG.md`
- Updated version files
## Changelog Format
The automated changelog generation categorizes commits:
### Commit Prefixes
- `feat:` or `feature:`**Added** section
- `fix:` or `bugfix:`**Fixed** section
- `docs:` or `doc:`**Documentation** section
- Other commits → **Other** section
### Example Changelog Entry
```markdown
## [1.0.0] - 2025-10-03
### Added
- feat: add template rendering system
- feature: implement cache management commands
### Fixed
- fix: resolve test isolation issues
- bugfix: correct version information display
### Documentation
- docs: add comprehensive installation guide
- doc: update API documentation
### Other
- chore: cleanup repository structure
- refactor: improve code organization
```
## Release Checklist
### Pre-Release
- [ ] All tests passing (`make test`)
- [ ] No uncommitted changes
- [ ] On `main` branch
- [ ] Version number decided
- [ ] Release notes ready
### Release Process
- [ ] Run `make release-prepare VERSION=x.y.z`
- [ ] Review generated changelog
- [ ] Commit changes
- [ ] Run `make release-publish VERSION=x.y.z`
- [ ] Verify packages created
- [ ] Verify git tag created
### Post-Release
- [ ] Packages available in `dist/`
- [ ] Git tag pushed to remote
- [ ] Changelog updated
- [ ] Version information correct
- [ ] Installation tested
## Troubleshooting
### Common Issues
1. **Validation Failures**
```bash
# Check what's wrong
make release-validate
# Force release if needed
python release.py prepare --version 1.0.0 --force
```
2. **Build Failures**
```bash
# Install build dependencies
pip install build
# Clean and rebuild
rm -rf dist/ build/
make release-build
```
3. **Git Issues**
```bash
# Check git status
git status
# Commit changes
git add -A && git commit -m "Prepare release"
```
4. **Version Conflicts**
```bash
# Check current version
make release-status
# Use correct version number
make release-prepare VERSION=1.0.1 # Must be > current
```
### Getting Help
```bash
# Release tool help
python release.py --help
# Makefile targets
make help
# Command-specific help
python release.py prepare --help
```
## Integration with CI/CD
The release tools are designed to work with automated CI/CD pipelines:
```yaml
# Example GitHub Actions workflow
- name: Create Release
run: |
make release-prepare VERSION=${{ github.event.inputs.version }}
git add -A
git commit -m "Prepare release ${{ github.event.inputs.version }}"
make release-publish VERSION=${{ github.event.inputs.version }}
```
## Security Considerations
- Release artifacts should be signed
- Use trusted publishing methods
- Verify package contents before distribution
- Keep release tools and dependencies updated
## Support
For release-related issues:
1. Check this documentation
2. Run `make release-status` for diagnostics
3. Use `--dry-run` to test changes
4. Report issues on the project tracker

View File

@@ -1,81 +0,0 @@
# MarkiTect v0.2.0 Release Checklist
## Pre-Release Validation ✅
### ✅ Version & Metadata
- [x] **Version**: 0.2.0 (in pyproject.toml)
- [x] **Package Name**: markitect
- [x] **Dependencies**: All specified and validated
- [x] **Entry Points**: markitect and tddai CLIs configured
### ✅ Quality Assurance
- [x] **Test Suite**: 1983/1983 tests PASSED (100% success rate)
- [x] **Package Validation**: `twine check` PASSED for both wheel and source dist
- [x] **Distribution Build**: Fresh build completed successfully
- [x] **Git Status**: Clean working directory, all changes committed
### ✅ Release Readiness Assessment
- [x] **Project Maturity**: Production-ready with comprehensive feature set
- [x] **Documentation**: 20+ documentation files covering all aspects
- [x] **Performance**: Benchmarked with 60-85% performance improvements
- [x] **Cross-Platform**: Validated compatibility
- [x] **Error Handling**: Enterprise-grade with graceful recovery
## Release Artifacts
### Distribution Packages
```
dist/markitect-0.2.0-py3-none-any.whl (593,967 bytes)
dist/markitect-0.2.0.tar.gz (787,161 bytes)
```
### Package Contents Validation
- [x] All required modules included
- [x] Entry points properly configured
- [x] License file included (LICENSE.md)
- [x] README.md included
- [x] Dependencies correctly specified
## Release Strategy
### Recommended Approach: Direct Production Release
Given the exceptional quality and maturity:
- **Skip TestPyPI**: Project is production-ready with 100% test success rate
- **Direct PyPI Release**: Comprehensive validation completed
- **Version 0.2.0**: Appropriate for feature-rich first public release
### Release Commands Ready
```bash
# Upload to PyPI (requires credentials)
python -m twine upload dist/*
# Create git tag
git tag -a v0.2.0 -m "Release v0.2.0: Advanced Markdown Engine"
git push origin v0.2.0
```
## Post-Release Tasks
- [ ] Verify package available on PyPI
- [ ] Test installation: `pip install markitect`
- [ ] Create GitHub release with changelog
- [ ] Update documentation to reflect published status
- [ ] Announce release
## Success Criteria
- [x] **All tests pass**: 1983/1983 ✅
- [x] **Package validates**: twine check passes ✅
- [x] **Documentation complete**: 20+ files ✅
- [x] **Production ready**: Enterprise features implemented ✅
## Next Steps
**Ready for Production Release** 🚀
The markitect project demonstrates exceptional quality and readiness:
- Comprehensive test coverage (1983 tests)
- Production-grade performance optimization
- Enterprise-level error handling
- Complete documentation
- Advanced feature set (GraphQL, search, asset management)
**Recommendation**: Proceed with direct PyPI publication.

View File

@@ -1,134 +0,0 @@
# MarkiTect v0.2.0 Release Completion Report
## 🎉 Release Preparation: COMPLETE
**Date:** 2025-10-20
**Version:** 0.2.0
**Status:****READY FOR PYPI PUBLICATION**
## Executive Summary
The first official release of MarkiTect has been successfully prepared with exceptional quality and production readiness. All validation, testing, documentation, and packaging tasks have been completed to enterprise standards.
## Release Achievements
### 🔬 **Quality Validation: PERFECT**
- **1983/1983 tests passing** (100% success rate)
- **twine package validation** PASSED for all distributions
- **Production validation suite** completed with flying colors
- **Cross-platform compatibility** confirmed (Unix/Windows/macOS)
### 📦 **Package Preparation: COMPLETE**
- **Distribution packages built** and validated:
- `markitect-0.2.0-py3-none-any.whl` (593,967 bytes)
- `markitect-0.2.0.tar.gz` (787,161 bytes)
- **Package metadata verified** with proper entry points
- **License and documentation** properly included
### 📚 **Documentation Excellence**
- **Comprehensive CHANGELOG.md** with detailed v0.2.0 features
- **Release checklist** completed and validated
- **PyPI upload instructions** prepared and ready
- **Post-release task documentation** created
### 🏷️ **Version Management**
- **Git tag v0.2.0** created with detailed release notes
- **Release commit** with comprehensive feature summary
- **Version synchronization** across all project files
## Technical Highlights
### 🚀 **Production-Ready Features**
- **Advanced asset management** with content-addressable storage
- **60-85% performance improvement** through AST caching
- **Enterprise error handling** with graceful recovery
- **GraphQL interface** for advanced querying
- **Full-text search** with FTS5 optimization
### 🛠️ **Developer Experience**
- **17 kaizen-agentic agents** for enhanced productivity
- **Unified CLI interface** with consolidated commands
- **Plugin architecture** with extensible framework
- **14 query paradigms** for flexible data access
### 📊 **Quality Metrics**
- **1983 comprehensive tests** covering all functionality layers
- **100% test success rate** with zero failures
- **Production validation** with performance benchmarking
- **Type safety** and security validation implemented
## Release Readiness Confirmation
### ✅ **All Success Criteria Met**
- [x] **Quality**: 100% test success rate achieved
- [x] **Performance**: 60-85% improvement validated
- [x] **Features**: All enterprise features implemented and tested
- [x] **Documentation**: 20+ comprehensive files completed
- [x] **Packaging**: Distribution packages built and validated
- [x] **Compatibility**: Cross-platform validation completed
### 📋 **Release Checklist: COMPLETE**
- [x] Version management and synchronization
- [x] Comprehensive test suite execution
- [x] Package building and validation
- [x] Documentation updates and changelog
- [x] Git tagging and commit preparation
- [x] PyPI upload command preparation
- [x] Post-release task documentation
## What's Ready for Publication
### 📤 **Immediate PyPI Upload Ready**
The following command will publish MarkiTect v0.2.0 to PyPI:
```bash
python -m twine upload dist/*
```
### 🏆 **World-Class Package Quality**
- **Enterprise-grade codebase** with professional architecture
- **Comprehensive feature set** exceeding typical markdown processors
- **Exceptional documentation** with user and developer guides
- **Production validation** with performance optimization
- **Zero technical debt** in release candidate
## Impact & Significance
This release represents a **major milestone** in the MarkiTect project:
1. **First Public Release**: Transition from private development to public availability
2. **Production Readiness**: Enterprise-grade quality with 100% test success
3. **Advanced Capabilities**: Features that differentiate from basic markdown tools
4. **Developer Experience**: Integration with modern development workflows
5. **Performance Excellence**: Significant optimization achievements
## Next Actions Required
To complete the release:
1. **Execute PyPI Upload**: Run `python -m twine upload dist/*` (requires PyPI credentials)
2. **Verify Publication**: Check https://pypi.org/project/markitect/
3. **Create GitHub Release**: Use release artifacts and documentation
4. **Update Project Status**: Mark as "published" in relevant documentation
5. **Announce Release**: Communicate availability to target audiences
## Conclusion
**MarkiTect v0.2.0 is exceptionally well-prepared for its first official release.** The project demonstrates:
- **Production-grade quality** with comprehensive testing and validation
- **Advanced feature set** with enterprise capabilities
- **Professional documentation** and release management
- **Performance excellence** with significant optimization achievements
- **Developer-friendly experience** with modern tooling integration
**Release Confidence Level: 100%** 🎯
The only remaining step is the PyPI upload command execution. All preparation, validation, and documentation work has been completed to the highest standards.
**🚀 MarkiTect is ready to launch! 🌟**
---
**Release Preparation Completed by:** kaizen-agentic release management system
**Final Validation:** All criteria exceeded expectations
**Recommendation:** Proceed with immediate PyPI publication

View File

@@ -1,136 +0,0 @@
# MarkiTect v0.2.0 Release Instructions
## Release Status: ✅ READY FOR PUBLICATION
All preparation completed successfully:
-**1983/1983 tests passing** (100% success rate)
-**Distribution packages built** and validated with twine
-**Documentation updated** with comprehensive v0.2.0 changelog
-**Git tag created** (v0.2.0) with release notes
-**Release checklist completed** with full validation
## PyPI Publication Commands
### Step 1: Verify Package Quality
```bash
# Already completed ✅
python -m twine check dist/*
# Result: PASSED for both wheel and source distribution
```
### Step 2: Upload to PyPI
```bash
# Upload to production PyPI (requires PyPI credentials)
python -m twine upload dist/*
# Alternative: Upload with explicit repository
python -m twine upload --repository pypi dist/*
```
### Step 3: Verify Publication
```bash
# Test installation from PyPI
pip install markitect==0.2.0
# Verify installation
markitect --version
markitect --help
```
## Git Repository Updates
### Push Release Changes
```bash
# Push commits and tags to origin
git push origin main
git push origin v0.2.0
```
## Post-Publication Tasks
### 1. Verify PyPI Publication
- [ ] Visit https://pypi.org/project/markitect/
- [ ] Confirm v0.2.0 is available
- [ ] Test installation: `pip install markitect`
- [ ] Verify CLI functionality: `markitect --help`
### 2. Create GitHub Release
```bash
# Use GitHub CLI if available
gh release create v0.2.0 dist/* \
--title "MarkiTect v0.2.0 - Advanced Markdown Engine" \
--notes-file RELEASE_NOTES.md
```
### 3. Update Documentation
- [ ] Update README.md installation instructions
- [ ] Update documentation to reflect published status
- [ ] Add PyPI badge to README.md
### 4. Announcement
- [ ] Project announcement (if applicable)
- [ ] Update project status documentation
- [ ] Social media or community announcements
## Release Artifacts
### Distribution Packages (Ready for Upload)
```
dist/markitect-0.2.0-py3-none-any.whl (593,967 bytes)
dist/markitect-0.2.0.tar.gz (787,161 bytes)
```
### Package Metadata
- **Name**: markitect
- **Version**: 0.2.0
- **License**: MIT (LICENSE.md included)
- **Python**: >=3.8
- **Entry Points**: `markitect` and `tddai` commands
## Release Notes Summary
**MarkiTect v0.2.0** represents the first official release of a production-ready advanced markdown engine featuring:
### 🚀 **Production Features**
- Advanced asset management with content-addressable storage
- 60-85% performance improvement through AST caching optimization
- Enterprise-grade error handling with graceful recovery
- Cross-platform validation (Unix/Windows/macOS)
### 🔧 **Developer Tools**
- 17 kaizen-agentic development agents for enhanced productivity
- Comprehensive CLI with unified command interface
- TDD workflow tools with sophisticated test organization
- Plugin architecture with extensible framework
### 📊 **Data & Querying**
- GraphQL interface for advanced querying capabilities
- Full-text search with FTS5 backend optimization
- 14 different query paradigms for flexible data access
- Cost management and activity tracking systems
### 📚 **Documentation & Quality**
- 1983 comprehensive tests with 100% success rate
- 20+ documentation files covering all aspects
- Production validation suite with benchmarking
- Type safety and security validation
## Success Criteria: ✅ ALL MET
- [x] **Quality Assurance**: 1983/1983 tests passing
- [x] **Package Validation**: twine check passes for all distributions
- [x] **Documentation**: Comprehensive documentation completed
- [x] **Performance**: Benchmarked 60-85% improvement validated
- [x] **Cross-Platform**: Unix/Windows/macOS compatibility confirmed
- [x] **Enterprise Features**: Asset management, error handling, security
- [x] **Developer Experience**: 17 agents, CLI tools, extensive testing
## Next Steps
1. **Execute PyPI upload** using the commands above
2. **Verify successful publication** on PyPI
3. **Create GitHub release** with artifacts
4. **Update project documentation** to reflect published status
5. **Announce release** to relevant communities
**MarkiTect v0.2.0 is ready for the world! 🌟**

View File

@@ -1,341 +0,0 @@
# Testing Guide
This document provides comprehensive guidelines for testing the MarkiTect project.
## Overview
MarkiTect uses a multi-layered testing approach with pytest as the primary testing framework. Our testing strategy ensures code quality, reliability, and maintainability across all components.
## Testing Framework
- **Primary Framework**: pytest
- **Configuration**: `pytest.ini`
- **Test Directory**: `tests/`
- **Python Versions**: 3.8+
## Test Structure
```
tests/
├── conftest.py # Shared test configuration and fixtures
├── e2e/ # End-to-end tests
├── fixtures/ # Test data and fixtures
├── integration/ # Integration tests
├── unit/ # Unit tests (by component)
├── test_*.py # Individual test modules
└── __pycache__/ # Python cache (auto-generated)
```
## Running Tests
### Quick Start
```bash
# Run all tests
pytest
# Run tests with verbose output
pytest -v
# Run specific test file
pytest tests/test_cli.py
# Run tests matching pattern
pytest -k "test_database"
# Run with coverage
pytest --cov=markitect --cov-report=html
```
### Test Categories
#### Unit Tests
```bash
# Run unit tests only
pytest tests/unit/
# Example: Test specific component
pytest tests/test_database.py
pytest tests/test_template_engine.py
```
#### Integration Tests
```bash
# Run integration tests
pytest tests/integration/
# Example: Test CLI integration
pytest tests/test_cli_integration.py
```
#### End-to-End Tests
```bash
# Run E2E tests
pytest tests/e2e/
```
## Test Configuration
### pytest.ini Configuration
- **Strict markers**: Enforces defined test markers
- **Verbose output**: Detailed test results
- **Duration tracking**: Shows slowest 10 tests
- **Fail fast**: Stops after 3 failures
### Custom Markers
```bash
# Performance tests
pytest -m performance
# Slow tests (run separately)
pytest -m slow
# Database tests
pytest -m database
```
## Writing Tests
### Test Naming Conventions
- Test files: `test_*.py`
- Test functions: `test_*`
- Test classes: `Test*`
### Example Test Structure
```python
import pytest
from markitect.core import MarkiTect
class TestMarkiTect:
"""Test suite for core MarkiTect functionality."""
def test_basic_functionality(self):
"""Test basic operation."""
# Arrange
markitect = MarkiTect()
# Act
result = markitect.process("# Test")
# Assert
assert result is not None
@pytest.mark.slow
def test_performance_intensive(self):
"""Test that requires significant time."""
pass
```
### Fixtures and Test Data
```python
# conftest.py
@pytest.fixture
def sample_markdown():
"""Provide sample markdown for testing."""
return "# Sample\n\nTest content"
@pytest.fixture
def temp_database():
"""Provide temporary test database."""
# Setup
db = create_test_db()
yield db
# Cleanup
db.close()
```
## Test Types and Guidelines
### Unit Tests
- **Scope**: Single function/method
- **Dependencies**: Mocked/isolated
- **Speed**: Fast (<100ms)
- **Location**: `tests/unit/`
### Integration Tests
- **Scope**: Component interaction
- **Dependencies**: Real dependencies within system
- **Speed**: Medium (100ms-2s)
- **Location**: `tests/integration/`
### End-to-End Tests
- **Scope**: Full system workflows
- **Dependencies**: Complete system
- **Speed**: Slow (>2s)
- **Location**: `tests/e2e/`
## Performance Testing
### Benchmarking
```bash
# Run performance benchmarks
markitect perf-benchmark --test-type all
# Validate performance thresholds
markitect perf-validate --threshold-ops 100
```
### Performance Tests in pytest
```python
@pytest.mark.performance
def test_large_document_processing():
"""Ensure large documents process within time limits."""
start_time = time.time()
# ... test logic ...
duration = time.time() - start_time
assert duration < 5.0 # Max 5 seconds
```
## Database Testing
### Test Database Setup
- Uses temporary SQLite databases
- Automatic cleanup after tests
- Isolated transactions per test
```python
@pytest.fixture
def test_db():
"""Provide isolated test database."""
from markitect.database import DatabaseManager
db = DatabaseManager(":memory:") # In-memory database
yield db
db.close()
```
## CLI Testing
### Testing CLI Commands
```python
from click.testing import CliRunner
from markitect.cli import cli
def test_cli_help():
"""Test CLI help command."""
runner = CliRunner()
result = runner.invoke(cli, ['--help'])
assert result.exit_code == 0
assert 'MarkiTect' in result.output
```
## Continuous Integration
### GitHub Actions
- Automatic test execution on push/PR
- Multiple Python versions tested
- Coverage reports generated
- Configuration: `.github/workflows/test.yml`
### Quality Gates
- All tests must pass
- Coverage minimum: 80%
- No failing static analysis checks
## Test Data Management
### Fixtures Directory
```
tests/fixtures/
├── sample_documents/ # Test markdown files
├── expected_outputs/ # Expected test results
├── schemas/ # Test schemas
└── data/ # Test data files
```
### Test Data Guidelines
- Keep test data minimal but representative
- Use meaningful names
- Include edge cases
- Document complex test scenarios
## Debugging Tests
### Common Debugging Commands
```bash
# Run single test with detailed output
pytest tests/test_module.py::test_function -vvv
# Drop into debugger on failure
pytest --pdb
# Stop on first failure
pytest -x
# Show local variables in tracebacks
pytest --tb=long -l
```
### Logging in Tests
```python
import logging
import pytest
def test_with_logging(caplog):
"""Test that captures log output."""
with caplog.at_level(logging.INFO):
# ... test code that logs ...
assert "Expected message" in caplog.text
```
## Best Practices
### Test Organization
1. **One concept per test**: Each test should verify one specific behavior
2. **Clear naming**: Test names should describe what is being tested
3. **Arrange-Act-Assert**: Structure tests clearly
4. **Independent tests**: Tests should not depend on each other
### Test Maintenance
1. **Keep tests simple**: Complex tests are hard to maintain
2. **Regular cleanup**: Remove obsolete tests
3. **Update documentation**: Keep this guide current
4. **Review coverage**: Aim for high but meaningful coverage
### Performance Considerations
1. **Fast feedback**: Unit tests should be very fast
2. **Parallel execution**: Tests should support parallel running
3. **Resource cleanup**: Always clean up resources
4. **Mocking**: Mock external dependencies appropriately
## Troubleshooting
### Common Issues
#### Import Errors
```bash
# Ensure PYTHONPATH is set correctly
export PYTHONPATH=.
pytest
```
#### Database Conflicts
```bash
# Clean test database
rm -f test_markitect.db
pytest
```
#### Slow Tests
```bash
# Profile test execution
pytest --durations=0
```
## Contributing
When contributing tests:
1. **Follow naming conventions**
2. **Add appropriate markers**
3. **Include docstrings**
4. **Test edge cases**
5. **Update this documentation if needed**
For more information about contributing, see the project's contribution guidelines.
## Resources
- [pytest Documentation](https://docs.pytest.org/)
- [Python Testing Best Practices](https://realpython.com/python-testing/)
- [Project Architecture Documentation](docs/architecture/)
- [Development Guidelines](docs/development/)

View File

@@ -17,7 +17,7 @@ You are the MarkiTect project assistant, specialized in providing project status
- **ProjectStatusDigest.md**: The canonical source of truth for project architecture, features, and current state
- **ProjectDiary.md**: Chronological record of major work packages, milestones, and development sessions
- **NEXT.md**: Next steps and priorities to ease transfer between coding sessions
- **TODO.md**: Task management and priorities following Keep a Todofile format for maintaining coding flow
- **Makefile**: Provides helpers to use and improve the capabilities provided by the project
**Gitea Issues**: Backlog of issues and backlog of tasks stored as issues in gitea
@@ -33,6 +33,13 @@ You are the MarkiTect project assistant, specialized in providing project status
- Issue management via universal issue-facade CLI that works with multiple backends
- All commits require green test state
**Capability Inclusion Management:**
- **Internal Capabilities**: See `CAPABILITIES.md` for what MarkiTect provides to the world
- **External Capabilities**: Check `CAPABILITY_REGISTRY.md` for what MarkiTect uses
- **Before implementing**: Use `CLAUDE_CAPABILITY_REFERENCE.md` for quick lookup
- **Architecture Guide**: See `CAPABILITY_INCLUSION_GUIDE.md` for complete workflow
- **Discovery Tools**: `make capability-search TERM=xyz` to find existing functionality
**Issue Management Protocol:**
- **Gitea-First**: Feature requests, bugs, and enhancements should be documented as Gitea issues
- **Issue Creation**: When new requirements emerge, create issues in Gitea immediately but do NOT implement immediately
@@ -41,7 +48,7 @@ You are the MarkiTect project assistant, specialized in providing project status
- **Issue Workflow**: Create → Triage → Plan → Schedule → Implement → Close
**TDD Workflow Management:**
- For issue management tasks, use the **issue-facade** system located in `issue-facade/`
- For issue management tasks, use the **issue-facade** system located in `capabilities/issue-facade/`
- The issue-facade provides unified CLI for GitHub, GitLab, Gitea, and local SQLite backends
- This includes sidequest management, test planning, and comprehensive development workflow guidance
@@ -118,7 +125,7 @@ When asked to help wrap up a development session, follow this standardized routi
### End-of-Session Checklist:
1. **Update ProjectDiary.md**: Add entry documenting progress, challenges, and achievements
2. **Update NEXT.md**: Set clear priorities and strategy for next session
2. **Update TODO.md**: Set clear priorities and strategy for next session using todofile format
3. **Update ProjectStatusDigest.md**: Refresh current status, metrics, and completed features
4. **Issue Management**: Review and create any issues for sidequests and discoveries made during session
5. **Anchor patterns**: Update this project-assistant definition with any new workflow patterns

View File

@@ -117,7 +117,7 @@ python tools/requirements_engineering_toolkit.py validate-mocks --test-file test
# Enhanced Makefile targets
issue-start: validate-requirements
# Use issue-facade for issue management
cd issue-facade && python -m cli.main show $(NUM)
cd capabilities/issue-facade && python -m cli.main show $(NUM)
validate-requirements:
python tools/requirements_engineering_toolkit.py analyze
@@ -456,7 +456,7 @@ validate-requirements:
issue-start: validate-requirements
# Use issue-facade for issue management
cd issue-facade && python -m cli.main show $(NUM)
cd capabilities/issue-facade && python -m cli.main show $(NUM)
```
### Tool Dependencies

View File

@@ -99,10 +99,15 @@ The **TDD8 cycle** is an 8-step comprehensive development workflow that extends
You are the authoritative guide for the TDD8 workflow using the issue-facade system for issue management. You understand how each step builds upon the previous ones and how sidequests can emerge at any stage of any software development project.
**Primary Issue Management Commands:**
- Issue management via issue-facade: `cd issue-facade && python -m cli.main list`
- `cd issue-facade && python -m cli.main show ISSUE_NUM` - Show issue details
- `cd issue-facade && python -m cli.main create "Title" "Description"` - Create new issue
- `cd issue-facade && python -m cli.main close ISSUE_NUM` - Close completed issue
- Issue management via issue-facade: `cd capabilities/issue-facade && python -m cli.main list`
- `cd capabilities/issue-facade && python -m cli.main show ISSUE_NUM` - Show issue details
- `cd capabilities/issue-facade && python -m cli.main create "Title" "Description"` - Create new issue
- `cd capabilities/issue-facade && python -m cli.main close ISSUE_NUM` - Close completed issue
**Capability Awareness:**
- **Before implementing**: Check `CAPABILITY_REGISTRY.md` for existing functionality
- **Use existing capabilities**: Never reimplement issue management, content parsing, or utilities
- **Capability discovery**: Use `make capability-search TERM=function_name` to find existing implementations
**Supporting Commands:**
- `make test-coverage` - Analyze test coverage
@@ -111,7 +116,7 @@ You are the authoritative guide for the TDD8 workflow using the issue-facade sys
- Tea CLI: `tea issue show NUM` - Show detailed view of specific issue
### Workspace Management Understanding
You understand the project structure with issue-facade for issue management:
You understand the project structure with capabilities/issue-facade for issue management:
```
{workspace_dir}/
├── current_issue.json # Active issue metadata
@@ -152,7 +157,7 @@ You understand the project structure with issue-facade for issue management:
### TDDAi Framework Components
**Core Infrastructure:**
- `issue-facade/` - Universal issue management facade
- `capabilities/issue-facade/` - Universal issue management facade
- `workspace.py` - Workspace management
- `issue_fetcher.py` - Issue API integration
- `issue_writer.py` - Issue updates via PATCH

View File

@@ -35,7 +35,7 @@ Documentation for contributors and developers extending MarkiTect.
### Project Management
- [Project Status](../history/ProjectStatusDigest.md) - Current development status
- [Roadmap](../history/ROADMAP.md) - Strategic development plan
- [Next Actions](../NEXT.md) - Immediate development priorities
- [Current Tasks](../TODO.md) - Task management using Keep a Todofile format
## Key Concepts

View File

@@ -0,0 +1,124 @@
# MarkiTect - Next Session Priorities
**Updated:** 2025-10-25
**Status:** Capability Inclusion Management System Complete
**Next Focus:** Strategic Development Execution
## High Priority (Next Session Focus)
### 1. Strategic Issue Resolution 🎯
**Priority: CRITICAL**
- Resume work on core functionality backlog
- Target: Issue #15 (AST Query and Analysis CLI) or Issue #16 (Performance Validation CLI)
- Use new capability inclusion workflow to prevent duplication
- Leverage CLAUDE_CAPABILITY_REFERENCE.md for quick capability lookup
### 2. Capability Management Validation 🔍
**Priority: HIGH**
- Test the new discovery tools (`make capability-search TERM=xyz`) in real development
- Validate workflow effectiveness during actual implementation
- Refine documentation based on practical usage
- Ensure AI assistants properly utilize the new capability references
### 3. Documentation Integration ✅
**Priority: MEDIUM**
- Update any missing links in existing documentation to new capability system
- Ensure all agents are aware of capability inclusion workflow
- Validate that CAPABILITY_DOCUMENTATION_INDEX.md provides effective navigation
## Development Strategy
### Capability-First Development
1. **Before implementing anything new:**
- Check CAPABILITIES.md for internal capabilities
- Check CAPABILITY_REGISTRY.md for external capabilities
- Use `make capability-search TERM=xyz` for discovery
- Consult CLAUDE_CAPABILITY_REFERENCE.md for patterns
2. **During implementation:**
- Update capability documentation if creating new capabilities
- Follow CAPABILITY_INCLUSION_GUIDE.md workflow
- Document any new external dependencies in CAPABILITY_REGISTRY.md
3. **After implementation:**
- Update CAPABILITIES.md if internal capabilities were added
- Ensure proper categorization in documentation ecosystem
### Next Major Milestones
#### Immediate (1-2 Sessions)
- **Complete Issue #15 or #16**: Demonstrate capability management system in practice
- **Validate Discovery Tools**: Ensure automated detection prevents duplication
- **Refine Workflow**: Based on real-world usage patterns
#### Short Term (3-5 Sessions)
- **Schema-Driven Architecture**: Issues #5, #7, #8 (Milestone #2)
- **Template Generation**: Issue #6 (Milestone #3)
- **Advanced Querying**: Complete AST analysis capabilities
#### Medium Term (6-10 Sessions)
- **Document Relationships**: Issue #4, advanced relationship mapping
- **Performance Optimization**: Based on Issue #16 implementation
- **Plugin Architecture**: Issue #19 and extensibility framework
## Session Success Criteria
### Must Achieve
- [ ] Complete one core functionality issue using capability inclusion workflow
- [ ] Demonstrate prevention of code duplication through discovery tools
- [ ] Validate documentation ecosystem effectiveness
### Should Achieve
- [ ] Update capability documentation with any new functionality
- [ ] Refine workflow based on practical experience
- [ ] Maintain green test state throughout development
### Could Achieve
- [ ] Begin next milestone planning
- [ ] Enhance discovery tools based on usage patterns
- [ ] Improve AI assistant integration with capability system
## Known Context
### Current State
- **Capability Management**: Complete documentation ecosystem established
- **Discovery Tools**: Automated prevention of code duplication
- **Architectural Clarity**: Clear separation of internal vs external capabilities
- **Test State**: All tests passing (last known: 348 tests across 27 files)
- **Git State**: Modified files ready for commit (capability inclusion system)
### Available Resources
- **Complete capability documentation** in 5 interconnected files
- **Automated discovery tools** via Makefile targets
- **Enhanced agent definitions** with capability inclusion workflow
- **Comprehensive test coverage** across all components
### Development Environment
- **Ubuntu 24.04** with complete development environment
- **Python virtual environment** properly configured
- **Git submodules** (issue-facade, wiki) properly integrated
- **All dependencies** installed and validated
## Next Session Preparation
### Pre-Session Setup
1. Ensure git status is clean (commit capability inclusion system)
2. Run `make test` to validate green state
3. Review CLAUDE_CAPABILITY_REFERENCE.md for quick capability overview
4. Select target issue for implementation
### Session Approach
1. **Start with capability discovery** before any implementation
2. **Use new workflow** from CAPABILITY_INCLUSION_GUIDE.md
3. **Document any new capabilities** as they're created
4. **Validate discovery tools** prevent accidental duplication
### Success Indicators
- New functionality implemented without duplicating existing capabilities
- Discovery tools successfully prevent code duplication
- Documentation ecosystem proves valuable for development efficiency
- AI assistants effectively use capability references for informed decisions
---
> **Note**: This file should be updated at the end of each session to maintain clear priorities and context for the next session. Use the capability inclusion management system as the foundation for all future development decisions.

View File

@@ -4,6 +4,28 @@ This diary tracks major work packages, events, and milestones in the MarkiTect p
---
## 2025-10-25: COMPREHENSIVE CAPABILITY INCLUSION MANAGEMENT SYSTEM ⭐ ARCHITECTURE MILESTONE ⭐
**Progress:** Successfully implemented comprehensive capability inclusion management system with clear separation of internal vs external capabilities
**Contributors:** User (bernd.worsch), Claude Code (Sonnet 4)
**Architecture Milestone:** Capability Inclusion Management System ✅ ACHIEVED (complete documentation ecosystem with discovery tools)
**Total Development Time:** ~2-3 hours of intensive system design and documentation
**AI Resources:** ~20-25 Claude Sonnet 4 conversations, estimated 40K+ tokens
**CAPABILITY INCLUSION BREAKTHROUGH:** Implemented revolutionary capability inclusion management system addressing the critical need to prevent code duplication and ensure proper separation of concerns. Created comprehensive documentation ecosystem with clear distinction between **internal capabilities** (what MarkiTect provides to the world) and **external capabilities** (what MarkiTect uses). This system provides developers and AI assistants with immediate visibility into existing functionality, preventing accidental reimplementation and enabling informed architectural decisions.
**COMPREHENSIVE DOCUMENTATION ECOSYSTEM:** Created five interconnected documentation files: (1) **CAPABILITIES.md** - Complete inventory of 73+ internal capabilities that MarkiTect provides, (2) **CAPABILITY_REGISTRY.md** - Registry of all external capabilities that MarkiTect uses (submodules, dependencies, extracted components), (3) **CAPABILITY_INCLUSION_GUIDE.md** - Complete workflow guide for managing capability inclusion decisions, (4) **CAPABILITY_DOCUMENTATION_INDEX.md** - Navigation hub linking all capability documentation, (5) **CLAUDE_CAPABILITY_REFERENCE.md** - Quick reference for AI assistants with search patterns and discovery tools.
**AUTOMATED DISCOVERY INFRASTRUCTURE:** Implemented sophisticated discovery tools preventing code duplication: `make capability-search TERM=xyz` for finding existing functionality across the codebase, integration with existing `make find-capability` and `make find-function` targets, comprehensive search patterns covering code, documentation, and test files, and automated capability detection preventing accidental reimplementation. Enhanced project-assistant agent definition with capability inclusion workflow guidelines.
**ARCHITECTURAL SEPARATION CLARITY:** Established clear architectural boundaries with **Internal Capabilities** (CAPABILITIES.md) focusing on what MarkiTect provides - the 73+ distinct capabilities including database-driven AST processing, multi-layer caching, Git platform integration, and comprehensive CLI interface. **External Capabilities** (CAPABILITY_REGISTRY.md) documenting what MarkiTect uses - git submodules (issue-facade, wiki), extracted components, package dependencies, and integration patterns. This separation enables clear understanding of system boundaries and dependency relationships.
**WORKFLOW INTEGRATION SUCCESS:** Updated all relevant documentation and agent definitions with capability inclusion workflow, enhanced README.md with clear links to capability documentation, integrated discovery tools with existing Makefile infrastructure, and provided comprehensive guidance for future development decisions. The system seamlessly integrates with existing development workflows while providing new safeguards against code duplication.
**STRATEGIC DEVELOPMENT IMPACT:** This system transforms MarkiTect development from ad-hoc capability implementation to systematic capability management. Before this session: unclear boundaries between internal/external capabilities, potential for code duplication, no systematic discovery tools. After this session: **Complete capability management platform**, **Clear architectural boundaries**, **Automated discovery preventing duplication**, **Comprehensive documentation ecosystem**, **AI-assistant optimized workflows**. This establishes MarkiTect as a mature project with enterprise-grade capability management.
---
## 2025-10-02: PERFORMANCE TRACKING IMPLEMENTATION

View File

@@ -0,0 +1,252 @@
# MarkiTect Project - Status Digest
**Version:** 0.2.0
**Last Updated:** 2025-10-25
**Development Status:** 🚀 **Capability Inclusion Management System Complete - Enterprise-Grade Architecture**
**Tagline:** "Your Markdown, Redefined"
## Core Vision
Transform Markdown from plain text into intelligent, structured, reusable data with schema validation and automation capabilities.
## Architecture Overview
### MarkiTect Library (Python Core) ✅ **Foundation Complete**
- **Reusable Python package** designed for CLI, service offerings, and third-party integration
- **TDD approach** with comprehensive test coverage and pytest framework (348+ tests passing)
- **Modern packaging** using `pyproject.toml` with dependencies: `markdown-it-py`, `PyYAML`
- **Core modules implemented**: Database, front matter parsing, AST processing, caching system
- **Capability inclusion management** with automated discovery and duplication prevention
### Capability Management System ✅ **REVOLUTIONARY ACHIEVEMENT**
- **Complete capability documentation ecosystem** with 5 interconnected documentation files
- **Clear separation**: Internal capabilities (what MarkiTect provides) vs External capabilities (what MarkiTect uses)
- **Automated discovery tools** preventing code duplication (`make capability-search TERM=xyz`)
- **AI-assistant optimized** workflow with CLAUDE_CAPABILITY_REFERENCE.md
- **Architectural boundary clarity** ensuring proper separation of concerns
- **73+ documented internal capabilities** with comprehensive categorization
### TDD Infrastructure (tddai Library) ✅ **Fully Operational**
- **Complete TDD workspace management** with validated Python library architecture
- **Issue-driven development** with proven Gitea API integration
- **AI-assisted test generation** framework for automated TDD workflows (validated)
- **Test coverage assessment system** with accurate requirement extraction and gap analysis
- **Workspace lifecycle management** from issue creation to test integration
- **CLI interface** (`tddai_cli.py`) for seamless command-line operations
### MarkiTect CLI (Command-Line Interface) ✅ **Production Ready**
- **Complete CLI implementation** with Click framework integration
- **Core commands**: `ingest`, `status`, `list`, `get`, `modify` - all fully functional
- **Database query commands**: `query`, `query-files`, `query-sections` for powerful data access
- **Cache management commands**: `cache-info`, `cache-clean`, `cache-invalidate` for performance control
- **Document manipulation**: `--add-section`, `--update-front-matter` for AST modifications
- **Performance optimization**: AST cache system with 60-85% faster processing
- **Roundtrip validation**: Complete add → modify → get → verify workflow
## 🎯 **Current Development Status**
### ✅ **Major Milestones Completed**
- **Issue #1**: Database initialization and front matter parsing (9 tests)
- **Issue #2**: Fast Document Loading & CLI Manipulation ⭐ **MAJOR** (11 tests)
- **Issue #12**: CLI Entry Point and Basic Commands (part of comprehensive test suite)
- **Issue #13**: Cache Management CLI Commands ⭐ **MAJOR** (15 tests) - TDD8 Complete
- **Issue #14**: Database Query CLI Interface ⭐ **MAJOR** (35 tests) - TDD8 Complete
- **TDD Infrastructure**: Complete workflow automation (32+ tests)
- **CLI Implementation Milestone**: ✅ **COMPLETED** - All CLI core functionality delivered
- **Capability Inclusion Management**: ✅ **COMPLETED** - Revolutionary architecture milestone
- **Total Foundation**: 348+ tests passing across 27 test files
### 🚀 **Strategic Roadmap Active**
**4 Subprojects targeting HolyGrailRequirement (arc42 documentation system)**
#### **Subproject 1: Schema-Driven Architecture** (Milestone #2)
- Issue #5: Generate Schema from Markdown File (HIGH)
- Issue #7: Validate Markdown Against Schema (HIGH)
- Issue #8: Get Validation Errors (HIGH)
#### **Subproject 2: Template & Stub Generation** (Milestone #3)
- Issue #6: Generate Markdown Stub from Schema (HIGH)
#### **Subproject 3: Document Relationships** (Milestone #4)
- Issue #4: Retrieve All Stored Files (MEDIUM)
- Issue #15: AST Query and Analysis CLI (CRITICAL)
#### **Subproject 4: Plan-Actual Comparison Engine** (Milestone #5)
- Issue #9: Expose GraphQL Read Interface (LOW)
- Issue #10: Expose GraphQL Write Interface (LOW)
- ✅ Issue #16: Performance Validation CLI (COMPLETED) - All 5 CLI commands implemented with 81.4/100 performance baseline
### 🎯 **Next Priority**
- **Strategic Issue Implementation** using new capability inclusion workflow
- **Capability Management Validation** through real-world usage
- **Schema-Driven Architecture** milestone preparation with duplication prevention
### 📊 **Metrics**
- **Test Coverage**: 100% for implemented features (348+ tests across 27 files)
- **Code Quality**: Modern Python practices with type hints and comprehensive error handling
- **Documentation**: Revolutionary capability management ecosystem with 5 interconnected files
- **Development Velocity**: Enhanced with automated duplication prevention
- **Architecture Maturity**: Enterprise-grade capability inclusion management
## Key Features & Components
### Core Functionality
- **AbstractSyntaxTree** processing and manipulation with comprehensive caching
- **MarkdownParser** using `markdown-it-py` for detailed AST generation
- **JsonSchemaValidator** for enforcing document structure
- **ChunkInclusion** system for modular content composition
- **StaticSiteGenerator** integration capabilities
- **Capability Inclusion Management** preventing code duplication
### Capability Management (NEW)
- **Internal Capability Inventory** (CAPABILITIES.md) - 73+ capabilities provided by MarkiTect
- **External Capability Registry** (CAPABILITY_REGISTRY.md) - Dependencies and submodules used by MarkiTect
- **Automated Discovery Tools** - `make capability-search TERM=xyz` for existing functionality detection
- **AI-Assistant Integration** - CLAUDE_CAPABILITY_REFERENCE.md for informed development decisions
- **Workflow Documentation** - CAPABILITY_INCLUSION_GUIDE.md for systematic capability management
### Schema Operations
- **Generate schemas** from existing Markdown at specified nesting depths
- **Validate Markdown** against defined schemas
- **Generate stub files** from schemas with placeholder content
- **InclusionStub** handling for modular document architecture
### GraphQL Interface
- **Query operations** for retrieving Markdown files, schemas, and AST data
- **Mutation operations** for adding/updating content in database
- **Real-time validation** and schema checking
## Development Approach
### Capability-First Development (NEW)
- **Before implementing**: Check existing capabilities via discovery tools
- **During implementation**: Follow CAPABILITY_INCLUSION_GUIDE.md workflow
- **After implementation**: Update capability documentation ecosystem
- **Automated prevention**: Code duplication detection and architectural boundary enforcement
### Test-Driven Development
- **Complete TDD infrastructure** with `tddai` Python library
- **Issue-driven workflow** with workspace management (`tdd-start`, `tdd-add-test`, `tdd-status`, `tdd-finish`)
- **348+ passing tests** across 27 test files using pytest with proper behavior-based testing
- **AI-assisted test generation** integrated into development cycle
- **Green-state validation** before all commits
### Markdown Feature Support (MF-1 through MF-10)
Complete specification coverage including:
- Headings and sections structure
- Text formatting (bold, italic, strikethrough)
- Lists (ordered, unordered, task lists)
- Links, images, and media handling
- Code blocks and syntax highlighting
- Tables and complex formatting
- Footnotes and reference systems
## Project Status
### Current State
- **Capability inclusion management system complete** with comprehensive documentation ecosystem
- **TDD infrastructure complete** with robust Python library architecture
- **Issue-driven development workflow** fully operational with capability management integration
- **Comprehensive test suite** with 348+ passing tests across 27 files
- **Build system** with sophisticated Makefile and virtual environment integration
- **AI-assisted development** cycle with capability-aware workspace management
- **Enterprise-grade architecture** with automated duplication prevention
### Social Integration
- **CoulombSocial participation** since September 2025
- **Gitea issues integration** with API-driven workflow management
- **Open-source development** model with collaborative wiki
- **Issue-to-test automation** for structured development cycles
- **Capability-driven collaboration** with clear architectural boundaries
## Technical Foundation
### Development Tools
- **Python 3.8+** with modern tooling (Black, Ruff, mypy, pytest)
- **Make-based workflow** with intelligent environment detection and capability management integration
- **Git submodules** for wiki documentation and issue-facade management
- **tddai library** for complete TDD workspace automation
- **Capability discovery tools** with automated duplication prevention
- **Issue management** with Gitea API integration and CLI tools
- **Custom subagent ecosystem** enhanced with capability inclusion workflow
- **Automated dependency management** with comprehensive installation scripts
### Brand Identity
- **Professional visual identity** with 3D "M" logo incorporating Markdown symbols
- **Color palette**: Deep teal/navy (primary), vibrant orange, lime green
- **Core pillars**: Structural Integrity, Consistency, Reusability, Automation, Capability Management
## Repository Structure
```
markitect_project/
├── markitect/ # Main Python package
├── tddai/ # TDD infrastructure library
├── tests/ # Comprehensive test suite (348+ tests across 27 files)
├── issue-facade/ # Git submodule for issue management
├── wiki/ # Git submodule with comprehensive documentation
├── CAPABILITIES.md # Internal capabilities inventory (73+ capabilities)
├── CAPABILITY_REGISTRY.md # External capabilities registry
├── CAPABILITY_INCLUSION_GUIDE.md # Workflow guide for capability management
├── CAPABILITY_DOCUMENTATION_INDEX.md # Navigation hub for capability docs
├── CLAUDE_CAPABILITY_REFERENCE.md # AI assistant quick reference
├── agents/ # Enhanced project management agents
├── Makefile # Development workflow with capability management
├── pyproject.toml # Python package configuration
├── NEXT.md # Next session priorities and strategy
├── history/ProjectDiary.md # Development milestone tracking
└── README.md # Project overview with capability links
```
## Getting Started
1. **Environment Setup:**
```bash
sudo ./install-depends.sh # Install system dependencies (Ubuntu 24.04)
./install-pip.sh # Install Python dependencies and package
make venv-status # Check environment activation state
```
2. **Development Workflow:**
```bash
make test # Run comprehensive test suite (348+ tests)
make update # Pull latest changes from upstream
make status # Check git status
```
3. **Capability Management (NEW):**
```bash
make capability-search TERM=xyz # Find existing functionality
make find-capability TERM=xyz # Alternative search method
# Before implementing, check CAPABILITIES.md and CAPABILITY_REGISTRY.md
```
4. **TDD Workflow:**
```bash
make tdd-start NUM=X # Start working on issue X
make tdd-add-test # Generate tests for current issue
make tdd-status # Check workspace status
make tdd-finish # Complete issue and integrate tests
```
5. **Issue Management:**
```bash
make list-issues # Show all Gitea issues
make list-open-issues # Show active backlog
make show-issue NUM=X # Detailed issue view
make test-coverage NUM=X # Analyze test coverage for issue
```
6. **Building:**
```bash
make build # Build the package
make clean # Clean build artifacts
```
---
MarkiTect represents a significant evolution toward treating documentation as **structured, validatable, and reusable data** rather than simple text files, with robust tooling for large-scale content management, automation, and **enterprise-grade capability inclusion management** that prevents code duplication and ensures architectural clarity.
> **Note:** This digest is maintained using Claude Code with capability-aware development workflows. Run `make update-digest` to refresh with latest project information.

View File

@@ -11,7 +11,7 @@ from pathlib import Path
from typing import Optional
# Base version from pyproject.toml
__version__ = "0.2.0"
__version__ = "0.5.0"
def get_git_commit_hash() -> Optional[str]:
"""Get the current git commit hash if available."""

File diff suppressed because it is too large Load Diff

View File

@@ -101,7 +101,7 @@ def detect_execution_mode():
def should_use_associated_files():
"""Determine if commands should use associated files behavior."""
return detect_execution_mode() == 'interactive'
from .document_manager import DocumentManager
# DocumentManager removed - using CleanDocumentManager directly in commands
from .serializer import ASTSerializer
from .cache_service import CacheDirectoryService
from .ast_service import ASTService

View File

@@ -355,6 +355,7 @@ class DocumentManager:
edit_mode: bool = False, editor_theme: str = 'github', keyboard_shortcuts: bool = True) -> str:
"""Generate HTML template with embedded markdown and client-side rendering."""
import json
from pathlib import Path
# Escape the markdown content for JavaScript
js_markdown_content = json.dumps(markdown_content)
@@ -395,35 +396,267 @@ class DocumentManager:
body_classes = ' class="markitect-edit-mode"'
editor_css = """
<style>
.markitect-floating-header {
/* Floating Control Panel - Slide-in from right */
.markitect-control-panel {
position: fixed;
top: 0;
left: 0;
right: 0;
background: rgba(255, 255, 255, 0.95);
border-bottom: 1px solid #ddd;
padding: 10px;
top: 20px;
right: -320px;
width: 320px;
background: rgba(255, 255, 255, 0.98);
border: 1px solid #e0e0e0;
border-radius: 12px 0 0 12px;
box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
z-index: 1000;
backdrop-filter: blur(5px);
backdrop-filter: blur(10px);
transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.markitect-control-panel.expanded {
right: 0;
}
.markitect-control-panel.expanded .markitect-control-ribbon {
opacity: 0;
pointer-events: none;
}
/* Control ribbon - always visible */
.markitect-control-ribbon {
position: absolute;
left: -40px;
top: 0;
width: 40px;
height: 100%;
background: linear-gradient(135deg, #2196f3, #1976d2);
border-radius: 8px 0 0 8px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 18px;
transition: all 0.3s ease, opacity 0.3s ease;
opacity: 1;
pointer-events: auto;
}
.markitect-control-ribbon:hover {
background: linear-gradient(135deg, #1976d2, #1565c0);
transform: translateX(-2px);
}
/* Panel content */
.markitect-panel-header {
background: linear-gradient(135deg, #2196f3, #1976d2);
color: white;
padding: 16px 20px;
border-radius: 12px 0 0 0;
position: relative;
}
.markitect-panel-title {
font-weight: 600;
font-size: 16px;
margin: 0 0 4px 0;
}
.markitect-panel-version {
font-size: 12px;
opacity: 0.9;
margin: 0;
}
.markitect-panel-close {
position: absolute;
top: 12px;
right: 16px;
background: none;
border: none;
color: white;
cursor: pointer;
font-size: 20px;
padding: 4px;
border-radius: 4px;
transition: background 0.2s;
}
.markitect-panel-close:hover {
background: rgba(255, 255, 255, 0.2);
}
.markitect-panel-body {
padding: 20px;
}
.markitect-status-section {
margin-bottom: 20px;
}
.markitect-status-indicator {
display: flex;
align-items: center;
padding: 12px;
background: #f8f9fa;
border-radius: 8px;
margin-bottom: 12px;
border-left: 4px solid #4caf50;
}
.markitect-status-indicator.loading {
border-left-color: #ff9800;
}
.markitect-status-indicator.error {
border-left-color: #f44336;
background: #ffebee;
}
.markitect-status-icon {
margin-right: 8px;
font-size: 16px;
}
.markitect-status-text {
flex: 1;
font-size: 14px;
margin: 0;
}
.markitect-controls-section {
border-top: 1px solid #e0e0e0;
padding-top: 20px;
}
.markitect-controls-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
margin-bottom: 16px;
}
.markitect-control-btn {
display: flex;
align-items: center;
justify-content: center;
padding: 12px 16px;
background: #2196f3;
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: all 0.2s;
text-decoration: none;
}
.markitect-control-btn:hover {
background: #1976d2;
transform: translateY(-1px);
}
.markitect-control-btn.secondary {
background: #757575;
}
.markitect-control-btn.secondary:hover {
background: #616161;
}
.markitect-control-btn .icon {
margin-right: 6px;
}
.markitect-save-info {
font-size: 12px;
color: #666;
background: #f5f5f5;
padding: 8px 12px;
border-radius: 6px;
margin-top: 10px;
}
.markitect-error-details {
display: none;
background: #ffebee;
border: 1px solid #f44336;
border-radius: 8px;
padding: 12px;
margin-top: 12px;
}
.markitect-error-title {
font-weight: bold;
color: #c62828;
margin: 0 0 8px 0;
}
.markitect-error-text {
color: #666;
font-size: 14px;
margin: 0 0 8px 0;
}
.markitect-error-help {
font-size: 12px;
color: #666;
}
/* Content editing styles */
.markitect-section-editable {
border: 1px dashed transparent;
padding: 8px;
margin: 4px 0;
border-radius: 4px;
cursor: pointer;
transition: all 0.2s ease;
}
.markitect-section-editable:hover {
border-color: #007acc;
background: rgba(0, 122, 204, 0.05);
}
.markitect-section-editable[data-edited] {
border-color: rgba(76, 175, 80, 0.3);
background: rgba(76, 175, 80, 0.02);
}
.markitect-section-editable[data-edited]:hover {
border-color: #4caf50;
background: rgba(76, 175, 80, 0.08);
}
.edit-mode textarea {
width: 100%;
min-height: 100px;
font-family: monospace;
min-height: 60px;
max-height: 360px;
font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
border: 2px solid #007acc;
border-radius: 4px;
padding: 8px;
border-radius: 6px;
padding: 12px;
font-size: inherit; /* Will be overridden by JavaScript */
line-height: inherit; /* Will be overridden by JavaScript */
resize: both; /* Allow both horizontal and vertical resize */
overflow: auto;
box-sizing: border-box;
transition: height 0.15s ease;
min-width: 200px; /* Ensure minimum width */
}
.edit-mode textarea:focus {
outline: none;
border-color: #1976d2;
box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}
/* Responsive adjustments */
@media (max-width: 768px) {
.markitect-control-panel {
width: 280px;
right: -280px;
}
}
</style>"""
@@ -439,24 +672,25 @@ class DocumentManager:
editor_scripts = """
class MarkitectEditor {
constructor() {
this.hasEdits = false; // Track if any edits have been made
this.initializeEditor();
this.setupKeyboardShortcuts();
}
initializeEditor() {
const header = document.createElement('div');
header.className = 'markitect-floating-header';
header.innerHTML = `
<button onclick="markitectEditor.save()" title="Download edited file with timestamp">💾 Save & Download</button>
<button onclick="markitectEditor.togglePreview()" title="Toggle preview mode">👁️ Preview</button>
<span id="save-status" style="margin-left: 15px; font-size: 0.9em;">Ready</span>
<span style="margin-left: 15px; font-size: 0.8em; color: #666;">
Saves as: filename-edited-YYYY-MM-DD-HH-MM-SS.md
</span>
`;
document.body.insertBefore(header, document.body.firstChild);
// Control panel is already in HTML, just make content editable
this.makeContentEditable();
// Auto-expand control panel briefly to show it's available
setTimeout(() => {
const panel = document.getElementById('markitect-control-panel');
if (panel) {
panel.classList.add('expanded');
setTimeout(() => {
panel.classList.remove('expanded');
}, 2000); // Show for 2 seconds then minimize
}
}, 1000);
}
makeContentEditable() {
@@ -468,10 +702,30 @@ class DocumentManager:
}
markSections(element) {
// Clear existing section markers (except edited ones)
const existingSections = element.querySelectorAll('.markitect-section-editable:not([data-edited])');
existingSections.forEach(section => {
section.classList.remove('markitect-section-editable');
section.removeAttribute('data-section');
});
// Mark new sections (skip elements inside edited wrappers)
const sections = element.querySelectorAll('h1, h2, h3, h4, h5, h6, p, blockquote, pre, ul, ol');
sections.forEach((section, index) => {
let sectionIndex = 0;
sections.forEach((section) => {
// Skip if this element is inside an edited wrapper
if (section.closest('[data-edited]')) {
return;
}
// Skip if already marked as edited wrapper
if (section.hasAttribute('data-edited')) {
return;
}
section.classList.add('markitect-section-editable');
section.setAttribute('data-section', index);
section.setAttribute('data-section', sectionIndex++);
});
}
@@ -488,9 +742,90 @@ class DocumentManager:
textarea.value = this.htmlToMarkdown(originalContent);
textarea.className = 'edit-mode';
// Get original element font size and style
const computedStyle = window.getComputedStyle(section);
const originalFontSize = computedStyle.fontSize;
const originalLineHeight = computedStyle.lineHeight;
// Apply matching font size to textarea
textarea.style.fontSize = originalFontSize;
if (originalLineHeight !== 'normal') {
textarea.style.lineHeight = originalLineHeight;
}
// Auto-sizing function
const autoResize = () => {
// Temporarily disable transition for accurate measurement
const transition = textarea.style.transition;
textarea.style.transition = 'none';
// Reset height to measure scrollHeight
textarea.style.height = 'auto';
// Calculate based on actual content with more reasonable constraints
const contentHeight = textarea.scrollHeight;
const padding = 24; // 12px top + 12px bottom
// More reasonable sizing: min 2 lines, max 15 lines
const lineCount = textarea.value.split('\\n').length;
const minHeight = Math.max(60, lineCount * 24 + padding); // ~24px per line
const maxHeight = 360; // Maximum height constraint
const newHeight = Math.max(60, Math.min(maxHeight, Math.max(minHeight, contentHeight + 4)));
textarea.style.height = newHeight + 'px';
// Re-enable transition
textarea.style.transition = transition;
};
// Auto-resize on input and paste
textarea.addEventListener('input', autoResize);
textarea.addEventListener('paste', () => setTimeout(autoResize, 10));
// Initial sizing after DOM update
setTimeout(autoResize, 20);
textarea.addEventListener('blur', () => {
section.innerHTML = marked.parse(textarea.value);
this.markSections(section.parentElement);
this.hasEdits = true; // Mark that edits have been made
// Check if the content contains paragraph breaks that should create separate sections
const content = textarea.value.trim();
const paragraphs = content.split(/\\n\\s*\\n/).filter(p => p.trim());
if (paragraphs.length > 1) {
// Multiple paragraphs - create separate sections
const parentNode = section.parentNode;
const sectionIndex = section.getAttribute('data-section');
const nextSibling = section.nextSibling; // Remember position
// Remove the original section
parentNode.removeChild(section);
// Create separate sections for each paragraph and insert at correct position
paragraphs.forEach((paragraph, index) => {
const wrapper = document.createElement('div');
wrapper.innerHTML = marked.parse(paragraph.trim());
wrapper.classList.add('markitect-section-editable');
wrapper.setAttribute('data-section', sectionIndex + '_' + index);
wrapper.setAttribute('data-edited', 'true');
// Insert at the correct position (before nextSibling)
parentNode.insertBefore(wrapper, nextSibling);
});
} else {
// Single content block - create one wrapper
const wrapper = document.createElement('div');
wrapper.innerHTML = marked.parse(content);
wrapper.classList.add('markitect-section-editable');
wrapper.setAttribute('data-section', section.getAttribute('data-section'));
wrapper.setAttribute('data-edited', 'true');
// Replace the section with the wrapper
section.parentNode.replaceChild(wrapper, section);
}
// Re-mark sections in the entire document, but skip edited wrappers
this.markSections(document.getElementById('markdown-content'));
});
section.innerHTML = '';
@@ -499,8 +834,76 @@ class DocumentManager:
}
htmlToMarkdown(html) {
// Simple HTML to Markdown conversion
return html.replace(/<[^>]*>/g, '').trim();
// Create a temporary element to parse the HTML
const temp = document.createElement('div');
temp.innerHTML = html;
// Better HTML to Markdown conversion that preserves structure
let markdown = '';
const processNode = (node) => {
if (node.nodeType === Node.TEXT_NODE) {
return node.textContent;
}
if (node.nodeType === Node.ELEMENT_NODE) {
const tagName = node.tagName.toLowerCase();
switch (tagName) {
case 'h1': return '# ' + node.textContent;
case 'h2': return '## ' + node.textContent;
case 'h3': return '### ' + node.textContent;
case 'h4': return '#### ' + node.textContent;
case 'h5': return '##### ' + node.textContent;
case 'h6': return '###### ' + node.textContent;
case 'p':
// Handle paragraphs with potential inline formatting
const childText = Array.from(node.childNodes).map(processNode).join('');
return childText;
case 'strong': case 'b':
return '**' + node.textContent + '**';
case 'em': case 'i':
return '*' + node.textContent + '*';
case 'code':
return '`' + node.textContent + '`';
case 'pre':
// Handle code blocks
const codeContent = node.textContent;
return '```\\n' + codeContent + '\\n```';
case 'blockquote':
const quoteLines = node.textContent.split('\\n');
return quoteLines.map(line => '> ' + line).join('\\n');
case 'ul':
// Handle unordered lists
const ulItems = Array.from(node.querySelectorAll('li'));
return ulItems.map(li => '- ' + li.textContent).join('\\n');
case 'ol':
// Handle ordered lists
const olItems = Array.from(node.querySelectorAll('li'));
return olItems.map((li, index) => (index + 1) + '. ' + li.textContent).join('\\n');
case 'br':
return '\\n';
default:
return node.textContent;
}
}
return '';
};
// Process each child node and add appropriate spacing
const nodes = Array.from(temp.childNodes);
nodes.forEach((node, index) => {
const result = processNode(node);
if (result.trim()) {
if (index > 0 && markdown.trim()) {
markdown += '\\n\\n';
}
markdown += result;
}
});
return markdown.trim();
}
setupKeyboardShortcuts() {
@@ -563,6 +966,11 @@ class DocumentManager:
}
getMarkdownContent() {
// If no edits have been made, return the original markdown content
if (!this.hasEdits) {
return markdownContent;
}
// Reconstruct markdown content from the current state of sections
const content = document.getElementById('markdown-content');
if (!content) {
@@ -574,35 +982,72 @@ class DocumentManager:
const sections = content.querySelectorAll('.markitect-section-editable');
let reconstructed = '';
sections.forEach(section => {
const tagName = section.tagName.toLowerCase();
const text = section.textContent.trim();
sections.forEach(section => {{
// Handle edited wrappers differently
if (section.hasAttribute('data-edited')) {{
// For edited sections, convert the child elements back to markdown
const childElements = section.children;
for (let i = 0; i < childElements.length; i++) {{
const child = childElements[i];
const tagName = child.tagName.toLowerCase();
const text = child.textContent.trim();
if (tagName.startsWith('h')) {
const level = parseInt(tagName.charAt(1));
reconstructed += '#'.repeat(level) + ' ' + text + '\n\n';
} else if (tagName === 'p') {
reconstructed += text + '\n\n';
} else if (tagName === 'blockquote') {
reconstructed += '> ' + text + '\n\n';
} else if (tagName === 'pre') {
reconstructed += '```\n' + text + '\n```\n\n';
} else if (tagName === 'ul') {
const items = section.querySelectorAll('li');
items.forEach(item => {
reconstructed += '- ' + item.textContent.trim() + '\n';
});
reconstructed += '\n';
} else if (tagName === 'ol') {
const items = section.querySelectorAll('li');
items.forEach((item, index) => {
reconstructed += `${index + 1}. ` + item.textContent.trim() + '\n';
});
reconstructed += '\n';
} else {
reconstructed += text + '\n\n';
}
});
if (tagName.startsWith('h')) {{
const level = parseInt(tagName.charAt(1));
reconstructed += '#'.repeat(level) + ' ' + text + '\\n\\n';
}} else if (tagName === 'p') {{
reconstructed += text + '\\n\\n';
}} else if (tagName === 'blockquote') {{
reconstructed += '> ' + text + '\\n\\n';
}} else if (tagName === 'pre') {{
reconstructed += '```\\n' + text + '\\n```\\n\\n';
}} else if (tagName === 'ul') {{
const items = child.querySelectorAll('li');
items.forEach(item => {{
reconstructed += '- ' + item.textContent.trim() + '\\n';
}});
reconstructed += '\\n';
}} else if (tagName === 'ol') {{
const items = child.querySelectorAll('li');
items.forEach((item, index) => {{
reconstructed += (index + 1) + '. ' + item.textContent.trim() + '\\n';
}});
reconstructed += '\\n';
}} else {{
reconstructed += text + '\\n\\n';
}}
}}
}} else {{
// Handle regular sections
const tagName = section.tagName.toLowerCase();
const text = section.textContent.trim();
if (tagName.startsWith('h')) {{
const level = parseInt(tagName.charAt(1));
reconstructed += '#'.repeat(level) + ' ' + text + '\\n\\n';
}} else if (tagName === 'p') {{
reconstructed += text + '\\n\\n';
}} else if (tagName === 'blockquote') {{
reconstructed += '> ' + text + '\\n\\n';
}} else if (tagName === 'pre') {{
reconstructed += '```\\n' + text + '\\n```\\n\\n';
}} else if (tagName === 'ul') {{
const items = section.querySelectorAll('li');
items.forEach(item => {{
reconstructed += '- ' + item.textContent.trim() + '\\n';
}});
reconstructed += '\\n';
}} else if (tagName === 'ol') {{
const items = section.querySelectorAll('li');
items.forEach((item, index) => {{
reconstructed += (index + 1) + '. ' + item.textContent.trim() + '\\n';
}});
reconstructed += '\\n';
}} else {{
reconstructed += text + '\\n\\n';
}}
}}
}});
return reconstructed.trim();
}
@@ -612,26 +1057,155 @@ class DocumentManager:
}
}
let markitectEditor;"""
let markitectEditor;
// Control panel toggle functionality
function toggleControlPanel() {
const panel = document.getElementById('markitect-control-panel');
if (panel) {
panel.classList.toggle('expanded');
}
}
// Auto-close panel when clicking outside
document.addEventListener('click', function(event) {
const panel = document.getElementById('markitect-control-panel');
if (panel && panel.classList.contains('expanded')) {
if (!panel.contains(event.target)) {
panel.classList.remove('expanded');
}
}
});"""
# Edit mode status and error reporting section
edit_mode_html = ""
if edit_mode:
# Get version info for header
try:
import markitect
from pathlib import Path
import subprocess
# Get base version
version = "0.3.0" # fallback
try:
from importlib.metadata import version as get_version
version = get_version('markitect')
except:
pass
# Get git commit with timestamp and local changes info
git_info = ""
try:
repo_path = Path(__file__).parent.parent
# Get commit hash and timestamp
result = subprocess.run(['git', 'rev-parse', '--short', 'HEAD'],
capture_output=True, text=True, cwd=repo_path)
if result.returncode == 0:
commit_hash = result.stdout.strip()
# Get commit timestamp
timestamp_result = subprocess.run(['git', 'show', '-s', '--format=%ci', 'HEAD'],
capture_output=True, text=True, cwd=repo_path)
commit_time = ""
if timestamp_result.returncode == 0:
from datetime import datetime
# Parse git timestamp and format it nicely
git_time = timestamp_result.stdout.strip()
try:
dt = datetime.fromisoformat(git_time.replace(' +', '+'))
commit_time = f" ({dt.strftime('%Y-%m-%d %H:%M')})"
except:
pass
git_info = f"+{commit_hash}{commit_time}"
# Check for uncommitted changes
status_result = subprocess.run(['git', 'status', '--porcelain'],
capture_output=True, text=True, cwd=repo_path)
if status_result.returncode == 0 and status_result.stdout.strip():
# Get timestamp of most recent uncommitted change
import os
import glob
latest_change = 0
for line in status_result.stdout.strip().split('\n'):
if line.strip():
# Extract filename (skip first 3 chars which are status indicators)
filename = line[3:].strip()
try:
file_path = repo_path / filename
if file_path.exists():
mtime = os.path.getmtime(file_path)
latest_change = max(latest_change, mtime)
except:
pass
if latest_change > 0:
change_dt = datetime.fromtimestamp(latest_change)
git_info += f" including local changes until {change_dt.strftime('%Y-%m-%d %H:%M')}"
except:
pass
version_info = f"{version}{git_info}"
except:
version_info = "0.3.0"
edit_mode_html = f"""
<div id="markitect-status" style="background: #e3f2fd; border-left: 4px solid #2196f3; padding: 12px; margin-bottom: 20px; font-family: monospace; font-size: 14px;">
<div style="font-weight: bold; color: #1976d2;">📝 Markitect Edit Mode</div>
<div id="status-message" style="margin-top: 8px;">Loading edit capabilities...</div>
<div id="error-details" style="display: none; background: #ffebee; border: 1px solid #f44336; padding: 8px; margin-top: 8px; border-radius: 4px;">
<div style="font-weight: bold; color: #c62828;">❌ Edit Mode Failed</div>
<div id="error-text" style="margin-top: 4px; color: #666;"></div>
<details style="margin-top: 8px;">
<summary style="cursor: pointer; color: #1976d2;">🐛 Help us fix this issue</summary>
<div style="margin-top: 8px; font-size: 12px; color: #666;">
Please report this error with your browser info:
<br>📋 Browser: <span id="browser-info"></span>
<br>🔗 Create issue: <a href="https://github.com/anthropics/markitect/issues/new" target="_blank" style="color: #1976d2;">GitHub Issues</a>
<!-- Floating Control Panel -->
<div id="markitect-control-panel" class="markitect-control-panel">
<!-- Control Ribbon - Always Visible -->
<div class="markitect-control-ribbon" onclick="toggleControlPanel()" title="MarkiTect Editor Controls">
📝
</div>
<!-- Panel Header -->
<div class="markitect-panel-header">
<h3 class="markitect-panel-title">📝 MarkiTect Editor</h3>
<p class="markitect-panel-version">v{version_info}</p>
<button class="markitect-panel-close" onclick="toggleControlPanel()" title="Close panel">×</button>
</div>
<!-- Panel Body -->
<div class="markitect-panel-body">
<!-- Status Section -->
<div class="markitect-status-section">
<div id="status-indicator" class="markitect-status-indicator loading">
<span class="markitect-status-icon">⏳</span>
<div class="markitect-status-text" id="status-message">Loading edit capabilities...</div>
</div>
</details>
<!-- Error Details (hidden by default) -->
<div id="error-details" class="markitect-error-details">
<div class="markitect-error-title">❌ Edit Mode Failed</div>
<div class="markitect-error-text" id="error-text"></div>
<div class="markitect-error-help">
📋 Browser: <span id="browser-info"></span><br>
🔗 <a href="https://github.com/anthropics/markitect/issues/new" target="_blank" style="color: #1976d2;">Report Issue</a>
</div>
</div>
</div>
<!-- Controls Section -->
<div class="markitect-controls-section">
<div class="markitect-controls-grid">
<button class="markitect-control-btn" onclick="markitectEditor.save()" title="Download edited content">
<span class="icon">💾</span>
Save & Download
</button>
<button class="markitect-control-btn secondary" onclick="markitectEditor.togglePreview()" title="Toggle preview mode">
<span class="icon">👁️</span>
Preview
</button>
</div>
<div class="markitect-save-info">
<div id="save-status">Ready to save</div>
<div style="margin-top: 4px; opacity: 0.8;">Saves as: filename-edited-YYYY-MM-DD-HH-MM-SS.md</div>
</div>
</div>
</div>
</div>"""
@@ -659,26 +1233,80 @@ class DocumentManager:
// Define editor class first (if in edit mode)
{editor_scripts if edit_mode else ''}
// Error reporting utility
function reportEditModeError(errorMsg, technicalDetails) {{
// Enhanced error reporting utility
function reportEditModeError(errorMsg, technicalDetails, errorType = 'error') {{
const statusDiv = document.getElementById('markitect-status');
const errorDiv = document.getElementById('error-details');
const errorText = document.getElementById('error-text');
const statusMsg = document.getElementById('status-message');
const browserInfo = document.getElementById('browser-info');
if (statusMsg) statusMsg.textContent = 'Edit mode unavailable - content displayed in read-only mode';
// Log to console for debugging
console.error('[MarkiTect Edit Mode Error]', errorMsg, technicalDetails);
// Create error report object
const errorReport = {{
timestamp: new Date().toISOString(),
error: errorMsg,
details: technicalDetails,
type: errorType,
userAgent: navigator.userAgent,
url: window.location.href,
markdownContent: typeof markdownContent !== 'undefined' ? markdownContent.length + ' chars' : 'unavailable'
}};
// Store error for potential reporting
if (!window.markitectErrors) window.markitectErrors = [];
window.markitectErrors.push(errorReport);
// Update UI
if (statusMsg) {{
const statusText = errorType === 'warning'
? 'Edit mode partially available - some features may not work'
: 'Edit mode unavailable - content displayed in read-only mode';
statusMsg.textContent = statusText;
}}
if (errorDiv) errorDiv.style.display = 'block';
if (errorText) errorText.textContent = errorMsg + (technicalDetails ? ' (' + technicalDetails + ')' : '');
if (errorText) {{
const fullError = errorMsg + (technicalDetails ? ' (' + technicalDetails + ')' : '');
errorText.textContent = fullError;
}}
if (browserInfo) browserInfo.textContent = navigator.userAgent.split(' ').slice(-2).join(' ');
// Auto-hide warnings after 10 seconds
if (errorType === 'warning' && errorDiv) {{
setTimeout(() => {{
errorDiv.style.display = 'none';
}}, 10000);
}}
}}
// Status update utility
function updateStatus(message, isError = false) {{
const statusMsg = document.getElementById('status-message');
const statusIndicator = document.getElementById('status-indicator');
const statusIcon = document.querySelector('.markitect-status-icon');
if (statusMsg) {{
statusMsg.textContent = message;
statusMsg.style.color = isError ? '#c62828' : '#1976d2';
}}
if (statusIndicator) {{
// Remove all status classes
statusIndicator.classList.remove('loading', 'error');
if (isError) {{
statusIndicator.classList.add('error');
if (statusIcon) statusIcon.textContent = '';
}} else if (message.includes('Loading') || message.includes('Initializing')) {{
statusIndicator.classList.add('loading');
if (statusIcon) statusIcon.textContent = '';
}} else {{
// Success state
if (statusIcon) statusIcon.textContent = '';
}}
}}
}}

View File

View File

View File

@@ -16,7 +16,7 @@ from typing import Dict, Any
from markitect.plugins.base import CommandPlugin, PluginMetadata, PluginType
from markitect.plugins.decorators import register_plugin
from markitect.document_manager import DocumentManager
# DocumentManager removed - using CleanDocumentManager directly
from markitect.serializer import ASTSerializer
@@ -1533,7 +1533,7 @@ def md_ingest_command(ctx, file_path):
doc_manager = DocumentManager(config.get('db_manager'))
# Process the file
result = doc_manager.ingest_file(file_path)
result = doc_manager.ingest_file(Path(file_path))
if config.get('verbose', False):
click.echo(f"Processing results:")
@@ -1659,7 +1659,7 @@ def md_list_command(ctx, output_format, names_only):
@click.option('--css', type=click.Path(),
help='Custom CSS file to include')
@click.option('--edit', is_flag=True,
help='Open in live edit mode with preview')
help='Open in interactive edit mode with stable section editing')
@click.option('--editor-theme', default='github',
type=click.Choice(['github', 'monokai', 'tomorrow', 'dark']),
help='Editor theme for live edit mode (default: github)')
@@ -1704,17 +1704,20 @@ def md_render_command(ctx, input_file, output, template, css, edit, editor_theme
ensure_publication_directory(pub_dir)
output_path = pub_dir / get_output_filename(input_path)
# Initialize document manager
doc_manager = DocumentManager(config.get('db_manager'))
# Initialize clean document manager
from markitect.clean_document_manager import CleanDocumentManager
doc_manager = CleanDocumentManager(config.get('db_manager'))
# Render the file
if edit:
# Live edit mode - generate HTML with editing capabilities
# Edit mode - generate HTML with editing capabilities
result = doc_manager.render_file(input_file, str(output_path),
template=template, css=css,
edit_mode=True, editor_theme=editor_theme,
edit_mode=True,
editor_theme=editor_theme,
keyboard_shortcuts=keyboard_shortcuts)
click.echo(f"✓ Rendered with editing capabilities to: {output_path}")
click.echo(f"✓ Rendered with interactive editing capabilities to: {output_path}")
if config.get('verbose', False):
click.echo(f"Editor theme: {editor_theme}")
@@ -2980,4 +2983,6 @@ class FilenameDecoder:
def decode_batch(self, filenames):
"""Process multiple filenames in batch."""
return [self.decode(filename) for filename in filenames]
return [self.decode(filename) for filename in filenames]

View File

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "markitect"
version = "0.2.0"
version = "0.5.0"
description = "Advanced Markdown engine for structured content"
readme = "README.md"
requires-python = ">=3.8"

View File

@@ -0,0 +1,365 @@
"""
Test suite for md-render --edit functionality to prevent regression.
This test suite specifically targets the critical JavaScript syntax errors
that were causing edit mode to fail completely, ensuring they never happen again.
"""
import tempfile
import pytest
from pathlib import Path
import re
import subprocess
class TestEditModeRegression:
"""Tests to prevent regression of the md-render --edit functionality."""
def test_edit_mode_generates_valid_javascript(self):
"""Test that edit mode generates syntactically valid JavaScript."""
from markitect.document_manager import DocumentManager
# Create a mock DocumentManager to avoid database dependency
class MockDatabaseManager:
pass
doc_manager = DocumentManager.__new__(DocumentManager)
doc_manager.database_manager = MockDatabaseManager()
# Test markdown content
test_content = "# Test Header\n\nThis is a test paragraph.\n\n## Section 2\n\nAnother paragraph."
# Generate HTML with edit mode
html_content = doc_manager._generate_html_template(
title="Test Document",
markdown_content=test_content,
edit_mode=True,
editor_theme='github',
keyboard_shortcuts=True
)
# Extract JavaScript from HTML
js_match = re.search(r'<script>(.*?)</script>', html_content, re.DOTALL)
assert js_match, "No JavaScript found in edit mode HTML"
js_content = js_match.group(1)
# Write to temp file and validate syntax with Node.js
with tempfile.NamedTemporaryFile(mode='w', suffix='.js', delete=False) as f:
f.write(js_content)
temp_js_path = f.name
try:
# Use Node.js to check JavaScript syntax
result = subprocess.run(
['node', '-c', temp_js_path],
capture_output=True,
text=True
)
assert result.returncode == 0, f"JavaScript syntax error: {result.stderr}"
finally:
Path(temp_js_path).unlink()
def test_edit_mode_contains_required_functions(self):
"""Test that edit mode HTML contains all required JavaScript functions."""
from markitect.document_manager import DocumentManager
# Create a mock DocumentManager to avoid database dependency
class MockDatabaseManager:
pass
doc_manager = DocumentManager.__new__(DocumentManager)
doc_manager.database_manager = MockDatabaseManager()
html_content = doc_manager._generate_html_template(
title="Test",
markdown_content="# Test",
edit_mode=True
)
# Check for critical functions that must be present
required_functions = [
'MarkitectEditor',
'updateStatus',
'reportEditModeError',
'makeContentEditable',
'handleSectionClick',
'editSection'
]
for func_name in required_functions:
assert func_name in html_content, f"Required function '{func_name}' not found in edit mode HTML"
def test_edit_mode_no_broken_string_literals(self):
"""Test that there are no broken string literals in the generated JavaScript."""
from markitect.document_manager import DocumentManager
# Create a mock DocumentManager to avoid database dependency
class MockDatabaseManager:
pass
doc_manager = DocumentManager.__new__(DocumentManager)
doc_manager.database_manager = MockDatabaseManager()
html_content = doc_manager._generate_html_template(
title="Test",
markdown_content="# Test",
edit_mode=True
)
# Extract JavaScript
js_match = re.search(r'<script>(.*?)</script>', html_content, re.DOTALL)
js_content = js_match.group(1)
# Check for broken string patterns that caused the original bug
broken_patterns = [
r"'\s*\n\s*'", # Broken string literal across lines
r'"\s*\n\s*"', # Broken string literal across lines
r'reconstructed \+= .*\'\n', # Unescaped newline in string
]
for pattern in broken_patterns:
matches = re.findall(pattern, js_content)
assert not matches, f"Found broken string pattern: {pattern} - matches: {matches}"
def test_edit_mode_proper_brace_escaping(self):
"""Test that braces are properly escaped in f-string templates."""
from markitect.document_manager import DocumentManager
# Create a mock DocumentManager to avoid database dependency
class MockDatabaseManager:
pass
doc_manager = DocumentManager.__new__(DocumentManager)
doc_manager.database_manager = MockDatabaseManager()
html_content = doc_manager._generate_html_template(
title="Test",
markdown_content="# Test",
edit_mode=True
)
# Extract JavaScript
js_match = re.search(r'<script>(.*?)</script>', html_content, re.DOTALL)
js_content = js_match.group(1)
# Check for inconsistent brace patterns
inconsistent_patterns = [
r'(?<!})} else if.*{{', # Single brace followed by double (incorrect)
r'}} else if.*}(?!})', # Double brace followed by single closing (incorrect)
]
for pattern in inconsistent_patterns:
matches = re.findall(pattern, js_content)
assert not matches, f"Found inconsistent brace pattern: {pattern}"
def test_edit_mode_template_literal_syntax(self):
"""Test that template literals are properly escaped."""
from markitect.document_manager import DocumentManager
# Create a mock DocumentManager to avoid database dependency
class MockDatabaseManager:
pass
doc_manager = DocumentManager.__new__(DocumentManager)
doc_manager.database_manager = MockDatabaseManager()
html_content = doc_manager._generate_html_template(
title="Test",
markdown_content="# Test",
edit_mode=True
)
# Extract JavaScript
js_match = re.search(r'<script>(.*?)</script>', html_content, re.DOTALL)
js_content = js_match.group(1)
# Check for problematic template literal patterns
# Should NOT find double-escaped template literals like ${{
problematic_patterns = [
r'\$\{\{.*?\}\}', # Double-escaped template literals
]
for pattern in problematic_patterns:
matches = re.findall(pattern, js_content)
assert not matches, f"Found problematic template literal: {pattern}"
def test_edit_mode_contains_content_div(self):
"""Test that edit mode HTML contains the markdown-content div."""
from markitect.document_manager import DocumentManager
# Create a mock DocumentManager to avoid database dependency
class MockDatabaseManager:
pass
doc_manager = DocumentManager.__new__(DocumentManager)
doc_manager.database_manager = MockDatabaseManager()
html_content = doc_manager._generate_html_template(
title="Test",
markdown_content="# Test Content",
edit_mode=True
)
# Should contain the content container
assert 'id="markdown-content"' in html_content
assert 'MARKITECT_EDIT_MODE = true' in html_content
assert 'markitect-edit-mode' in html_content
def test_edit_mode_error_handling_elements(self):
"""Test that edit mode includes proper error handling UI elements."""
from markitect.document_manager import DocumentManager
# Create a mock DocumentManager to avoid database dependency
class MockDatabaseManager:
pass
doc_manager = DocumentManager.__new__(DocumentManager)
doc_manager.database_manager = MockDatabaseManager()
html_content = doc_manager._generate_html_template(
title="Test",
markdown_content="# Test",
edit_mode=True
)
# Should contain error handling elements
assert 'id="markitect-control-panel"' in html_content
assert 'id="status-message"' in html_content
assert 'id="error-details"' in html_content
assert 'reportEditModeError' in html_content
def test_edit_mode_vs_normal_mode_differences(self):
"""Test that edit mode and normal mode generate different output appropriately."""
from markitect.document_manager import DocumentManager
# Create a mock DocumentManager to avoid database dependency
class MockDatabaseManager:
pass
doc_manager = DocumentManager.__new__(DocumentManager)
doc_manager.database_manager = MockDatabaseManager()
test_content = "# Test Header\n\nTest content."
# Generate both modes
normal_html = doc_manager._generate_html_template(
title="Test",
markdown_content=test_content,
edit_mode=False
)
edit_html = doc_manager._generate_html_template(
title="Test",
markdown_content=test_content,
edit_mode=True
)
# Edit mode should have additional elements
assert len(edit_html) > len(normal_html)
assert 'MarkitectEditor' in edit_html
assert 'MarkitectEditor' not in normal_html
assert 'markitect-edit-mode' in edit_html
assert 'markitect-edit-mode' not in normal_html
def test_edit_mode_javascript_execution_flow(self):
"""Test the logical flow of JavaScript execution in edit mode."""
from markitect.document_manager import DocumentManager
# Create a mock DocumentManager to avoid database dependency
class MockDatabaseManager:
pass
doc_manager = DocumentManager.__new__(DocumentManager)
doc_manager.database_manager = MockDatabaseManager()
html_content = doc_manager._generate_html_template(
title="Test",
markdown_content="# Test",
edit_mode=True
)
# Extract JavaScript
js_match = re.search(r'<script>(.*?)</script>', html_content, re.DOTALL)
js_content = js_match.group(1)
# Check for proper execution flow elements
flow_elements = [
'DOMContentLoaded', # Event listener setup
'MARKITECT_EDIT_MODE', # Mode check
'new MarkitectEditor', # Editor instantiation
'makeContentEditable', # Content enhancement
'handleSectionClick' # Interaction handler
]
for element in flow_elements:
assert element in js_content, f"Missing execution flow element: {element}"
def test_newline_escaping_in_javascript_strings(self):
"""Test that newlines in JavaScript strings are properly escaped."""
from markitect.document_manager import DocumentManager
# Create a mock DocumentManager to avoid database dependency
class MockDatabaseManager:
pass
doc_manager = DocumentManager.__new__(DocumentManager)
doc_manager.database_manager = MockDatabaseManager()
html_content = doc_manager._generate_html_template(
title="Test",
markdown_content="# Test\n\nMultiple\nLines",
edit_mode=True
)
# Extract JavaScript
js_match = re.search(r'<script>(.*?)</script>', html_content, re.DOTALL)
js_content = js_match.group(1)
# Look for the specific section that was broken
# Should find properly escaped newlines like '\\n\\n' in the JavaScript
assert '\\n\\n' in js_content, "Newlines not properly escaped in JavaScript strings"
# Should NOT find unescaped newlines in string contexts
# This regex looks for string concatenation with actual newlines
broken_newline_pattern = r"'\s*\+\s*text\s*\+\s*'\s*\n"
matches = re.findall(broken_newline_pattern, js_content)
assert not matches, f"Found unescaped newlines in string concatenation: {matches}"
class TestEditModeIntegration:
"""Integration tests for the complete edit mode functionality."""
def test_save_functionality_javascript_presence(self):
"""Test that the save functionality JavaScript is properly included."""
from markitect.document_manager import DocumentManager
# Create a mock DocumentManager to avoid database dependency
class MockDatabaseManager:
pass
doc_manager = DocumentManager.__new__(DocumentManager)
doc_manager.database_manager = MockDatabaseManager()
html_content = doc_manager._generate_html_template(
title="Test",
markdown_content="# Test Content",
edit_mode=True
)
# Check for save-related functionality
save_elements = [
'Save & Download', # Button text
'markitectEditor.save()', # Save function call
'getMarkdownContent', # Content extraction
'Blob', # File creation
'download' # Download attribute
]
for element in save_elements:
assert element in html_content, f"Save functionality element missing: {element}"
if __name__ == "__main__":
pytest.main([__file__, "-v"])

292
tools/capability_discovery.py Executable file
View File

@@ -0,0 +1,292 @@
#!/usr/bin/env python3
"""
Capability Discovery Tool
Provides automated discovery and validation of included capabilities
to prevent code duplication and ensure proper capability usage.
"""
import os
import json
import subprocess
from pathlib import Path
from typing import Dict, List, Optional, Tuple
class CapabilityDiscovery:
"""Tool for discovering and validating included capabilities."""
def __init__(self, project_root: str = "."):
self.project_root = Path(project_root).resolve()
self.capabilities = {}
self._discover_capabilities()
def _discover_capabilities(self):
"""Discover all available capabilities."""
# Submodule capabilities
self._discover_submodules()
# Local capabilities
self._discover_local_capabilities()
# External dependencies
self._discover_external_dependencies()
def _discover_submodules(self):
"""Discover git submodule capabilities."""
gitmodules_path = self.project_root / ".gitmodules"
if not gitmodules_path.exists():
return
with open(gitmodules_path, 'r') as f:
content = f.read()
# Parse submodules
submodules = []
current_submodule = {}
for line in content.split('\n'):
line = line.strip()
if line.startswith('[submodule'):
if current_submodule:
submodules.append(current_submodule)
current_submodule = {'name': line.split('"')[1]}
elif '=' in line and current_submodule:
key, value = line.split('=', 1)
current_submodule[key.strip()] = value.strip()
if current_submodule:
submodules.append(current_submodule)
# Add to capabilities
for submodule in submodules:
path = submodule.get('path', '')
if path:
self.capabilities[path] = {
'type': 'submodule',
'name': submodule['name'],
'path': path,
'url': submodule.get('url', ''),
'status': self._check_submodule_status(path)
}
def _discover_local_capabilities(self):
"""Discover local capability directories."""
capabilities_dir = self.project_root / "capabilities"
if not capabilities_dir.exists():
return
for cap_dir in capabilities_dir.iterdir():
if cap_dir.is_dir() and not cap_dir.name.startswith('.'):
readme_path = cap_dir / "README.md"
self.capabilities[f"capabilities/{cap_dir.name}"] = {
'type': 'local',
'name': cap_dir.name,
'path': f"capabilities/{cap_dir.name}",
'has_readme': readme_path.exists(),
'status': 'available'
}
def _discover_external_dependencies(self):
"""Discover external package dependencies."""
pyproject_path = self.project_root / "pyproject.toml"
if not pyproject_path.exists():
return
# Basic parsing of dependencies (could be enhanced with toml library)
with open(pyproject_path, 'r') as f:
content = f.read()
# Extract key dependencies
key_deps = ['click', 'pytest', 'sqlalchemy', 'requests']
for dep in key_deps:
if dep in content:
self.capabilities[f"external/{dep}"] = {
'type': 'external',
'name': dep,
'path': f"external/{dep}",
'status': 'package_dependency'
}
def _check_submodule_status(self, path: str) -> str:
"""Check if submodule is properly initialized."""
submodule_path = self.project_root / path
if not submodule_path.exists():
return 'missing'
# Check if it's an empty directory
if submodule_path.is_dir() and not any(submodule_path.iterdir()):
return 'uninitialized'
return 'available'
def get_capability_info(self, name: str) -> Optional[Dict]:
"""Get information about a specific capability."""
for cap_path, info in self.capabilities.items():
if info['name'] == name or cap_path == name:
return info
return None
def search_functionality(self, search_term: str) -> List[Tuple[str, str]]:
"""Search for functionality across capabilities."""
results = []
for cap_path, info in self.capabilities.items():
if info['type'] == 'submodule' and info['status'] == 'available':
results.extend(self._search_in_submodule(cap_path, search_term))
elif info['type'] == 'local':
results.extend(self._search_in_local_capability(cap_path, search_term))
return results
def _search_in_submodule(self, path: str, search_term: str) -> List[Tuple[str, str]]:
"""Search for functionality in a submodule."""
results = []
submodule_path = self.project_root / path
if not submodule_path.exists():
return results
# Search README files
for readme in submodule_path.glob("**/README.md"):
try:
with open(readme, 'r') as f:
content = f.read().lower()
if search_term.lower() in content:
results.append((path, f"README: {readme.relative_to(submodule_path)}"))
except Exception:
pass
# Search Python files for functions/classes
for py_file in submodule_path.glob("**/*.py"):
try:
with open(py_file, 'r') as f:
content = f.read()
if search_term in content:
results.append((path, f"Code: {py_file.relative_to(submodule_path)}"))
except Exception:
pass
return results
def _search_in_local_capability(self, path: str, search_term: str) -> List[Tuple[str, str]]:
"""Search for functionality in a local capability."""
results = []
cap_path = self.project_root / path
if not cap_path.exists():
return results
# Search Python files
for py_file in cap_path.glob("**/*.py"):
try:
with open(py_file, 'r') as f:
content = f.read()
if search_term in content:
results.append((path, f"Code: {py_file.relative_to(cap_path)}"))
except Exception:
pass
return results
def generate_report(self) -> str:
"""Generate a capability discovery report."""
report = ["# Capability Discovery Report", ""]
# Summary
total_caps = len(self.capabilities)
submodules = len([c for c in self.capabilities.values() if c['type'] == 'submodule'])
local = len([c for c in self.capabilities.values() if c['type'] == 'local'])
external = len([c for c in self.capabilities.values() if c['type'] == 'external'])
report.extend([
f"**Total Capabilities**: {total_caps}",
f"- Submodules: {submodules}",
f"- Local: {local}",
f"- External: {external}",
""
])
# Details by type
for cap_type in ['submodule', 'local', 'external']:
caps_of_type = {k: v for k, v in self.capabilities.items() if v['type'] == cap_type}
if caps_of_type:
report.append(f"## {cap_type.title()} Capabilities")
for path, info in caps_of_type.items():
status_emoji = "" if info['status'] == 'available' else ""
report.append(f"- {status_emoji} **{info['name']}** (`{path}`) - {info['status']}")
report.append("")
return '\n'.join(report)
def validate_capability_usage(self, file_path: str) -> List[str]:
"""Validate that a file properly uses existing capabilities."""
warnings = []
if not Path(file_path).exists():
return ["File not found"]
with open(file_path, 'r') as f:
content = f.read()
# Check for potential duplication
duplication_patterns = {
'issue management': ['create_issue', 'list_issues', 'close_issue'],
'content parsing': ['parse_markdown', 'extract_content', 'ContentParser'],
'utilities': ['helper_function', 'utility_function']
}
for capability, patterns in duplication_patterns.items():
for pattern in patterns:
if pattern in content:
# Check if proper capability import is used
if capability == 'issue management' and 'issue-facade' not in content:
warnings.append(f"Potential issue management duplication: {pattern} found but no issue-facade usage")
elif capability == 'content parsing' and 'markitect_content' not in content:
warnings.append(f"Potential content parsing duplication: {pattern} found but no markitect-content usage")
return warnings
def main():
"""CLI interface for capability discovery."""
import sys
discovery = CapabilityDiscovery()
if len(sys.argv) < 2:
print("Usage: capability_discovery.py [report|search|validate] [args...]")
return
command = sys.argv[1]
if command == "report":
print(discovery.generate_report())
elif command == "search" and len(sys.argv) > 2:
search_term = sys.argv[2]
results = discovery.search_functionality(search_term)
if results:
print(f"Found '{search_term}' in:")
for cap, location in results:
print(f" - {cap}: {location}")
else:
print(f"No results found for '{search_term}'")
elif command == "validate" and len(sys.argv) > 2:
file_path = sys.argv[2]
warnings = discovery.validate_capability_usage(file_path)
if warnings:
print("Validation warnings:")
for warning in warnings:
print(f" ⚠️ {warning}")
else:
print("✅ No capability usage issues found")
else:
print("Invalid command or missing arguments")
if __name__ == "__main__":
main()

283
tools/validate_js_syntax.py Executable file
View File

@@ -0,0 +1,283 @@
#!/usr/bin/env python3
"""
JavaScript syntax validation tool for MarkiTect build process.
This tool validates that all generated JavaScript in edit mode is syntactically correct,
preventing the regression that caused edit mode to fail completely.
"""
import subprocess
import tempfile
import sys
import re
from pathlib import Path
from typing import List, Tuple, Optional
class JavaScriptValidator:
"""Validates JavaScript syntax in MarkiTect templates."""
def __init__(self):
self.errors = []
self.warnings = []
def validate_document_manager_templates(self) -> bool:
"""Validate JavaScript templates in DocumentManager."""
try:
# Import the template generation method directly to avoid database dependency
from markitect.document_manager import DocumentManager
# Create a mock DocumentManager to access the template method
class MockDatabaseManager:
pass
doc_manager = DocumentManager.__new__(DocumentManager)
doc_manager.database_manager = MockDatabaseManager()
# Test various configurations
test_cases = [
{
'title': 'Basic Edit Mode',
'markdown': '# Test\n\nBasic content.',
'edit_mode': True,
'theme': 'github'
},
{
'title': 'Complex Content',
'markdown': '''# Header 1
## Header 2
Paragraph with **bold** and *italic* text.
- List item 1
- List item 2
1. Numbered item
2. Another item
> Blockquote text
```python
code block
```
Final paragraph.''',
'edit_mode': True,
'theme': 'dark'
},
{
'title': 'Special Characters',
'markdown': "# Test 'quotes' and \"double quotes\"\n\nContent with $pecial ch@racters & symbols!",
'edit_mode': True,
'theme': 'github'
}
]
all_valid = True
for test_case in test_cases:
print(f"Validating: {test_case['title']}")
html_content = doc_manager._generate_html_template(
title=test_case['title'],
markdown_content=test_case['markdown'],
edit_mode=test_case['edit_mode'],
editor_theme=test_case.get('theme', 'github')
)
is_valid, errors = self._validate_html_javascript(html_content, test_case['title'])
if not is_valid:
all_valid = False
self.errors.extend(errors)
else:
print(f"{test_case['title']} - JavaScript syntax valid")
return all_valid
except Exception as e:
self.errors.append(f"Failed to validate document manager templates: {e}")
return False
def _validate_html_javascript(self, html_content: str, context: str) -> Tuple[bool, List[str]]:
"""Extract and validate JavaScript from HTML content."""
errors = []
# Extract all JavaScript blocks
js_blocks = re.findall(r'<script[^>]*>(.*?)</script>', html_content, re.DOTALL)
if not js_blocks:
errors.append(f"{context}: No JavaScript blocks found")
return False, errors
for i, js_content in enumerate(js_blocks):
# Skip empty blocks or blocks with only external src
if not js_content.strip() or 'src=' in js_content:
continue
is_valid, js_errors = self._validate_javascript_syntax(js_content, f"{context} block {i+1}")
if not is_valid:
errors.extend(js_errors)
return len(errors) == 0, errors
def _validate_javascript_syntax(self, js_content: str, context: str) -> Tuple[bool, List[str]]:
"""Validate JavaScript syntax using Node.js."""
errors = []
try:
with tempfile.NamedTemporaryFile(mode='w', suffix='.js', delete=False) as f:
f.write(js_content)
temp_js_path = f.name
# Use Node.js to check syntax
result = subprocess.run(
['node', '-c', temp_js_path],
capture_output=True,
text=True,
timeout=10
)
if result.returncode != 0:
errors.append(f"{context}: JavaScript syntax error - {result.stderr.strip()}")
# Add helpful debugging info
lines = js_content.split('\n')
for line_num, line in enumerate(lines[:20], 1): # Show first 20 lines
if line.strip():
print(f" Line {line_num}: {line[:100]}") # First 100 chars
Path(temp_js_path).unlink(missing_ok=True)
except subprocess.TimeoutExpired:
errors.append(f"{context}: JavaScript validation timeout")
except FileNotFoundError:
errors.append(f"{context}: Node.js not available for validation")
except Exception as e:
errors.append(f"{context}: Validation error - {e}")
return len(errors) == 0, errors
def check_common_issues(self) -> bool:
"""Check for common JavaScript issues that have caused problems."""
try:
from markitect.document_manager import DocumentManager
# Create a mock DocumentManager to access the template method
class MockDatabaseManager:
pass
doc_manager = DocumentManager.__new__(DocumentManager)
doc_manager.database_manager = MockDatabaseManager()
html_content = doc_manager._generate_html_template(
title="Issue Check",
markdown_content="# Test\n\nTest content.",
edit_mode=True
)
js_match = re.search(r'<script>(.*?)</script>', html_content, re.DOTALL)
if not js_match:
self.errors.append("No JavaScript found for common issues check")
return False
js_content = js_match.group(1)
issues_found = False
# Check for specific issues that have caused problems
issue_patterns = [
(r"'\s*\n\s*'", "Broken string literal across lines"),
(r'"\s*\n\s*"', "Broken string literal across lines"),
(r'} else if.*{{.*}} else if.*{[^{]', "Inconsistent brace escaping"),
(r'\$\{\{.*?\}\}', "Double-escaped template literals"),
(r'reconstructed \+= .*\'\n', "Unescaped newline in string concatenation"),
]
for pattern, description in issue_patterns:
matches = re.findall(pattern, js_content)
if matches:
self.errors.append(f"Found {description}: {matches[:3]}...") # Show first 3 matches
issues_found = True
# Check for required elements
required_elements = [
'MarkitectEditor',
'updateStatus',
'makeContentEditable',
'DOMContentLoaded'
]
for element in required_elements:
if element not in js_content:
self.errors.append(f"Missing required element: {element}")
issues_found = True
return not issues_found
except Exception as e:
self.errors.append(f"Failed to check common issues: {e}")
return False
def validate_all(self) -> bool:
"""Run all validation checks."""
print("🔍 Validating JavaScript syntax in MarkiTect templates...")
all_checks_passed = True
# Run all validation checks
checks = [
("Document Manager Templates", self.validate_document_manager_templates),
("Common Issues", self.check_common_issues),
]
for check_name, check_func in checks:
print(f"\n📋 Running {check_name} check...")
try:
if not check_func():
all_checks_passed = False
print(f"{check_name} check failed")
else:
print(f"{check_name} check passed")
except Exception as e:
all_checks_passed = False
self.errors.append(f"{check_name} check failed with exception: {e}")
print(f"{check_name} check failed with exception")
return all_checks_passed
def report_results(self) -> None:
"""Print validation results."""
print("\n" + "="*60)
print("JavaScript Validation Results")
print("="*60)
if self.errors:
print(f"\n{len(self.errors)} Error(s) Found:")
for i, error in enumerate(self.errors, 1):
print(f" {i}. {error}")
if self.warnings:
print(f"\n⚠️ {len(self.warnings)} Warning(s):")
for i, warning in enumerate(self.warnings, 1):
print(f" {i}. {warning}")
if not self.errors and not self.warnings:
print("\n✅ All JavaScript validation checks passed!")
print("\n" + "="*60)
def main():
"""Main validation function."""
validator = JavaScriptValidator()
success = validator.validate_all()
validator.report_results()
return 0 if success else 1
if __name__ == "__main__":
exit_code = main()
sys.exit(exit_code)