@voodocs/cli 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +159 -0
- package/README.md +58 -3
- package/cli.py +262 -2
- package/lib/darkarts/annotations/parser.py +64 -0
- package/lib/darkarts/context/__init__.py +84 -0
- package/lib/darkarts/context/ai_instructions.py +734 -0
- package/lib/darkarts/context/ai_integrations.py +619 -0
- package/lib/darkarts/context/checker.py +379 -0
- package/lib/darkarts/context/commands.py +1761 -0
- package/lib/darkarts/context/diagram.py +300 -0
- package/lib/darkarts/context/models.py +200 -0
- package/lib/darkarts/context/yaml_utils.py +342 -0
- package/package.json +2 -1
- package/templates/CONTEXT_TEMPLATE.md +152 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,162 @@
|
|
|
1
|
+
## [0.3.0] - 2025-12-20
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
#### AI-Aware Integration System
|
|
6
|
+
|
|
7
|
+
**Native AI Assistant Integration**
|
|
8
|
+
- Auto-detects existing AI configurations (Claude, Cursor, Copilot, Gemini, Junie)
|
|
9
|
+
- Interactive menu for selecting AI assistant(s) during `voodocs context init`
|
|
10
|
+
- Generates native configuration files for each AI assistant
|
|
11
|
+
- Supports 5+ AI assistants with more coming
|
|
12
|
+
|
|
13
|
+
**Supported AI Assistants:**
|
|
14
|
+
1. **Claude Code** - Generates `.claude/skills/voodocs-context/SKILL.md` (2,341 chars)
|
|
15
|
+
- Full skill with YAML frontmatter
|
|
16
|
+
- On-demand context loading
|
|
17
|
+
- Executable scripts support
|
|
18
|
+
|
|
19
|
+
2. **Cursor** - Generates `.cursor/rules/voodocs-context.mdc` (2,560 chars)
|
|
20
|
+
- Comprehensive rules file
|
|
21
|
+
- Context system commands
|
|
22
|
+
- Workflow best practices
|
|
23
|
+
|
|
24
|
+
3. **GitHub Copilot** - Generates `.github/copilot-instructions.md` (1,981 chars)
|
|
25
|
+
- Project-specific instructions
|
|
26
|
+
- Context integration guide
|
|
27
|
+
- Annotation format examples
|
|
28
|
+
|
|
29
|
+
4. **Windsurf** - Generates `.windsurfrules` (1,180 chars)
|
|
30
|
+
- Concise rules format
|
|
31
|
+
- Essential commands
|
|
32
|
+
- Quick reference
|
|
33
|
+
|
|
34
|
+
5. **Cline** - Generates `.clinerules` (806 chars)
|
|
35
|
+
- Minimal configuration
|
|
36
|
+
- Core workflow
|
|
37
|
+
- Context basics
|
|
38
|
+
|
|
39
|
+
**Integration Features:**
|
|
40
|
+
- Context system overview and commands
|
|
41
|
+
- @voodocs annotation format (Python & TypeScript)
|
|
42
|
+
- Development workflow best practices
|
|
43
|
+
- Invariant checking instructions
|
|
44
|
+
- Architecture diagram generation
|
|
45
|
+
- AI-specific guidance and tips
|
|
46
|
+
|
|
47
|
+
**User Experience:**
|
|
48
|
+
- ✓ markers show detected AI configurations
|
|
49
|
+
- Numbered menu for easy selection
|
|
50
|
+
- Creates parent directories automatically
|
|
51
|
+
- Handles existing files with overwrite prompt
|
|
52
|
+
- Default: generate all integrations
|
|
53
|
+
- Can select individual AIs or all at once
|
|
54
|
+
|
|
55
|
+
**Technical Implementation:**
|
|
56
|
+
- New module: `ai_integrations.py` (685 lines)
|
|
57
|
+
- Detection: `detect_ai_assistants()` function
|
|
58
|
+
- Generation: AI-specific template functions
|
|
59
|
+
- Integration: Updated `cmd_context_init()` command
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
- Enhanced `voodocs context init` with AI assistant detection and integration
|
|
63
|
+
- Improved user prompts with visual markers for detected configurations
|
|
64
|
+
- Updated next steps to include AI-specific guidance
|
|
65
|
+
|
|
66
|
+
### Documentation
|
|
67
|
+
- Added AI integration research notes
|
|
68
|
+
- Created comprehensive AI integration summary
|
|
69
|
+
- Documented all supported AI assistant formats
|
|
70
|
+
|
|
71
|
+
### Impact
|
|
72
|
+
|
|
73
|
+
This release makes VooDocs **truly AI-native**, working seamlessly with any AI assistant. The context system becomes the single source of truth that all AIs understand and respect.
|
|
74
|
+
|
|
75
|
+
**Key Benefits:**
|
|
76
|
+
- One command sets up everything
|
|
77
|
+
- Works with any AI assistant
|
|
78
|
+
- Native format for each AI
|
|
79
|
+
- No manual configuration needed
|
|
80
|
+
- Consistent AI behavior across teams
|
|
81
|
+
- Context-aware development
|
|
82
|
+
|
|
83
|
+
## [0.2.0] - 2025-12-19
|
|
84
|
+
|
|
85
|
+
### Added
|
|
86
|
+
|
|
87
|
+
#### Context System - Phase 4: Verification & Visualization
|
|
88
|
+
|
|
89
|
+
**Invariant Checking (`voodocs context check`)**
|
|
90
|
+
- Automatically validate code against documented invariants
|
|
91
|
+
- Pattern-based detection for 6 common security issues (SQL injection, unhashed passwords, logged secrets, etc.)
|
|
92
|
+
- File and line number reporting for violations
|
|
93
|
+
- JSON output format for CI/CD integration
|
|
94
|
+
- Module and invariant filtering options
|
|
95
|
+
- Severity levels (error, warning, info)
|
|
96
|
+
|
|
97
|
+
**Architecture Diagram Generation (`voodocs context diagram`)**
|
|
98
|
+
- Auto-generate visual diagrams from context files
|
|
99
|
+
- 3 diagram types: modules, dependencies, flow
|
|
100
|
+
- Supports Mermaid and D2 formats
|
|
101
|
+
- Auto-renders to PNG using manus-render-diagram
|
|
102
|
+
- Console output or file export
|
|
103
|
+
|
|
104
|
+
**Enhanced Validation (`voodocs context validate`)**
|
|
105
|
+
- Smart suggestions for missing sections
|
|
106
|
+
- Integrated invariant checking with `--check-invariants` flag
|
|
107
|
+
- Completeness, quality, and consistency checks
|
|
108
|
+
- Actionable recommendations for improvement
|
|
109
|
+
|
|
110
|
+
#### Context System - Phase 3: Auto-Generation & Query
|
|
111
|
+
|
|
112
|
+
**Auto-Generation (`voodocs context generate`)**
|
|
113
|
+
- Automatically extract context from @voodocs annotations
|
|
114
|
+
- Recursively scans codebase for annotations
|
|
115
|
+
- Extracts global invariants, assumptions, and modules
|
|
116
|
+
- Supports multiple languages (Python, TypeScript, JavaScript, Java, C++, Go, Rust)
|
|
117
|
+
|
|
118
|
+
**Query System (`voodocs context query`)**
|
|
119
|
+
- Query context like a database using regex patterns
|
|
120
|
+
- Section filtering and multiple output formats (text, JSON, YAML)
|
|
121
|
+
|
|
122
|
+
**Git Integration**
|
|
123
|
+
- Auto-detects Git commit hash and author
|
|
124
|
+
- Integrated into `update` and `sync` commands
|
|
125
|
+
|
|
126
|
+
#### Context System - Phase 2: Versioning & History
|
|
127
|
+
|
|
128
|
+
**Version Management**
|
|
129
|
+
- `voodocs context update`: Update context and increment version
|
|
130
|
+
- `voodocs context sync`: Sync context with code version
|
|
131
|
+
- `voodocs context history`: Show version history
|
|
132
|
+
- `voodocs context diff`: Compare context versions
|
|
133
|
+
|
|
134
|
+
#### Context System - Phase 1: Foundation
|
|
135
|
+
|
|
136
|
+
**Core Commands**
|
|
137
|
+
- `voodocs context init`: Initialize .voodocs.context file
|
|
138
|
+
- `voodocs context view`: View context as Markdown
|
|
139
|
+
- `voodocs context status`: Show context file status
|
|
140
|
+
|
|
141
|
+
### Changed
|
|
142
|
+
- Enhanced `voodocs context validate` with smart suggestions
|
|
143
|
+
- Improved error messages and user feedback
|
|
144
|
+
|
|
145
|
+
### Documentation
|
|
146
|
+
- Added comprehensive Phase 3 and Phase 4 implementation guides
|
|
147
|
+
- Updated README with new context system commands
|
|
148
|
+
- Added example architecture diagram
|
|
149
|
+
|
|
150
|
+
### Performance
|
|
151
|
+
- Invariant checking: < 1 second for 15 files
|
|
152
|
+
- Diagram generation: < 100ms + 1-2s for PNG rendering
|
|
153
|
+
- Enhanced validation: < 50ms
|
|
154
|
+
|
|
155
|
+
### Code Statistics
|
|
156
|
+
- Total Context System: 3,060 lines across 4 phases
|
|
157
|
+
- 12 context commands implemented
|
|
158
|
+
- 980 lines added in Phase 4
|
|
159
|
+
|
|
1
160
|
## [0.1.2] - 2025-12-19
|
|
2
161
|
|
|
3
162
|
### Fixed
|
package/README.md
CHANGED
|
@@ -84,11 +84,41 @@ voodocs generate ./src --tests-only
|
|
|
84
84
|
|
|
85
85
|
## Core Commands
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
### Documentation & Generation
|
|
88
|
+
- `voodocs init`: Initialize VooDocs in your project
|
|
88
89
|
- `voodocs instruct`: Generate instructions for your AI assistant
|
|
89
90
|
- `voodocs generate <path>`: Generate docs, tests, and API specs from annotations
|
|
90
|
-
- `voodocs status`: Check
|
|
91
|
-
|
|
91
|
+
- `voodocs status`: Check project status and statistics
|
|
92
|
+
|
|
93
|
+
### Context System (Enhanced in v0.3.0)
|
|
94
|
+
- `voodocs context init`: Initialize project context file
|
|
95
|
+
- `voodocs context generate`: Auto-generate context from code annotations
|
|
96
|
+
- `voodocs context check`: Validate code against documented invariants
|
|
97
|
+
- `voodocs context diagram`: Generate architecture diagrams
|
|
98
|
+
- `voodocs context validate`: Validate context file with smart suggestions
|
|
99
|
+
- `voodocs context query`: Query context like a database
|
|
100
|
+
- `voodocs context view`: View context as Markdown
|
|
101
|
+
|
|
102
|
+
### AI Integration (NEW in v0.3.0)
|
|
103
|
+
|
|
104
|
+
VooDocs now **natively integrates** with 5+ AI assistants! When you run `voodocs context init`, it automatically:
|
|
105
|
+
- Detects existing AI configurations (Claude, Cursor, Copilot, etc.)
|
|
106
|
+
- Prompts you to select your AI assistant(s)
|
|
107
|
+
- Generates native configuration files for each AI
|
|
108
|
+
|
|
109
|
+
**Supported AI Assistants:**
|
|
110
|
+
- **Claude Code** - `.claude/skills/voodocs-context/SKILL.md`
|
|
111
|
+
- **Cursor** - `.cursor/rules/voodocs-context.mdc`
|
|
112
|
+
- **GitHub Copilot** - `.github/copilot-instructions.md`
|
|
113
|
+
- **Windsurf** - `.windsurfrules`
|
|
114
|
+
- **Cline** - `.clinerules`
|
|
115
|
+
|
|
116
|
+
Your AI will automatically understand the VooDocs context system and:
|
|
117
|
+
- Check context before making changes
|
|
118
|
+
- Respect documented invariants
|
|
119
|
+
- Update context when adding features
|
|
120
|
+
- Generate architecture diagrams
|
|
121
|
+
- Follow best practices
|
|
92
122
|
|
|
93
123
|
## The DarkArts Language
|
|
94
124
|
|
|
@@ -101,6 +131,29 @@ Voodocs uses the **DarkArts language** - a mathematical and logical notation sys
|
|
|
101
131
|
|
|
102
132
|
Voodocs then translates this precise, machine-readable format into natural language documentation that humans can easily understand.
|
|
103
133
|
|
|
134
|
+
## What's New in v0.2.0
|
|
135
|
+
|
|
136
|
+
### 🔍 Invariant Checking
|
|
137
|
+
Automatically validate that your code respects documented invariants:
|
|
138
|
+
```bash
|
|
139
|
+
voodocs context check
|
|
140
|
+
```
|
|
141
|
+
Detects security issues like SQL injection, unhashed passwords, and logged secrets.
|
|
142
|
+
|
|
143
|
+
### 📊 Architecture Diagrams
|
|
144
|
+
Auto-generate visual diagrams from your context:
|
|
145
|
+
```bash
|
|
146
|
+
voodocs context diagram --type modules --output arch.png --png
|
|
147
|
+
```
|
|
148
|
+
Supports module diagrams, dependency diagrams, and flow diagrams.
|
|
149
|
+
|
|
150
|
+
### ✅ Enhanced Validation
|
|
151
|
+
Smart validation with actionable suggestions:
|
|
152
|
+
```bash
|
|
153
|
+
voodocs context validate --check-invariants
|
|
154
|
+
```
|
|
155
|
+
Provides completeness checks, quality suggestions, and consistency validation.
|
|
156
|
+
|
|
104
157
|
## Why Voodocs?
|
|
105
158
|
|
|
106
159
|
- **AI-First Workflow**: Designed for modern AI-assisted development. Your AI documents as it codes.
|
|
@@ -108,6 +161,8 @@ Voodocs then translates this precise, machine-readable format into natural langu
|
|
|
108
161
|
- **Massive Time Savings**: Eliminate manual documentation work entirely.
|
|
109
162
|
- **Higher Code Quality**: Formal specifications lead to more robust and reliable code.
|
|
110
163
|
- **Precision**: Mathematical notation is unambiguous - no more vague documentation.
|
|
164
|
+
- **Verification**: Automatically check that code respects documented invariants (v0.2.0)
|
|
165
|
+
- **Visualization**: Generate architecture diagrams from context (v0.2.0)
|
|
111
166
|
|
|
112
167
|
## Example Annotation
|
|
113
168
|
|
package/cli.py
CHANGED
|
@@ -137,7 +137,7 @@ Documentation: https://github.com/3vilEnterprises/vooodooo-magic/tree/main/packa
|
|
|
137
137
|
parser.add_argument(
|
|
138
138
|
"--version",
|
|
139
139
|
action="version",
|
|
140
|
-
version="VooDocs 0.
|
|
140
|
+
version="VooDocs 0.3.0"
|
|
141
141
|
)
|
|
142
142
|
|
|
143
143
|
subparsers = parser.add_subparsers(dest="command", help="Available commands")
|
|
@@ -372,6 +372,197 @@ Documentation: https://github.com/3vilEnterprises/vooodooo-magic/tree/main/packa
|
|
|
372
372
|
help="Telemetry action"
|
|
373
373
|
)
|
|
374
374
|
|
|
375
|
+
# context command
|
|
376
|
+
context_parser = subparsers.add_parser(
|
|
377
|
+
"context",
|
|
378
|
+
help="Manage project context for AI assistants"
|
|
379
|
+
)
|
|
380
|
+
context_subparsers = context_parser.add_subparsers(dest="context_action", help="Context actions")
|
|
381
|
+
|
|
382
|
+
# context init
|
|
383
|
+
context_init_parser = context_subparsers.add_parser(
|
|
384
|
+
"init",
|
|
385
|
+
help="Initialize a new .voodocs.context file"
|
|
386
|
+
)
|
|
387
|
+
context_init_parser.add_argument(
|
|
388
|
+
"--force",
|
|
389
|
+
action="store_true",
|
|
390
|
+
help="Overwrite existing context file"
|
|
391
|
+
)
|
|
392
|
+
|
|
393
|
+
# context view
|
|
394
|
+
context_view_parser = context_subparsers.add_parser(
|
|
395
|
+
"view",
|
|
396
|
+
help="View context as human-readable Markdown"
|
|
397
|
+
)
|
|
398
|
+
context_view_parser.add_argument(
|
|
399
|
+
"--output",
|
|
400
|
+
"-o",
|
|
401
|
+
help="Output file path (default: print to console)"
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
# context status
|
|
405
|
+
context_status_parser = context_subparsers.add_parser(
|
|
406
|
+
"status",
|
|
407
|
+
help="Show context file status"
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
# context update
|
|
411
|
+
context_update_parser = context_subparsers.add_parser(
|
|
412
|
+
"update",
|
|
413
|
+
help="Update context and increment version"
|
|
414
|
+
)
|
|
415
|
+
context_update_parser.add_argument(
|
|
416
|
+
"--description",
|
|
417
|
+
"-d",
|
|
418
|
+
help="Description of the changes"
|
|
419
|
+
)
|
|
420
|
+
|
|
421
|
+
# context sync
|
|
422
|
+
context_sync_parser = context_subparsers.add_parser(
|
|
423
|
+
"sync",
|
|
424
|
+
help="Sync context with code version"
|
|
425
|
+
)
|
|
426
|
+
context_sync_parser.add_argument(
|
|
427
|
+
"--code-version",
|
|
428
|
+
"-v",
|
|
429
|
+
help="New code version (e.g., 2.0.0)"
|
|
430
|
+
)
|
|
431
|
+
context_sync_parser.add_argument(
|
|
432
|
+
"--force",
|
|
433
|
+
action="store_true",
|
|
434
|
+
help="Skip confirmation prompts"
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
# context history
|
|
438
|
+
context_history_parser = context_subparsers.add_parser(
|
|
439
|
+
"history",
|
|
440
|
+
help="Show version history"
|
|
441
|
+
)
|
|
442
|
+
|
|
443
|
+
# context diff
|
|
444
|
+
context_diff_parser = context_subparsers.add_parser(
|
|
445
|
+
"diff",
|
|
446
|
+
help="Compare context versions"
|
|
447
|
+
)
|
|
448
|
+
context_diff_parser.add_argument(
|
|
449
|
+
"version1",
|
|
450
|
+
nargs="?",
|
|
451
|
+
help="First version (older)"
|
|
452
|
+
)
|
|
453
|
+
context_diff_parser.add_argument(
|
|
454
|
+
"version2",
|
|
455
|
+
nargs="?",
|
|
456
|
+
help="Second version (newer, default: current)"
|
|
457
|
+
)
|
|
458
|
+
|
|
459
|
+
# context validate
|
|
460
|
+
context_validate_parser = context_subparsers.add_parser(
|
|
461
|
+
"validate",
|
|
462
|
+
help="Validate context file"
|
|
463
|
+
)
|
|
464
|
+
context_validate_parser.add_argument(
|
|
465
|
+
"--check-version",
|
|
466
|
+
action="store_true",
|
|
467
|
+
help="Check if code version matches detected version"
|
|
468
|
+
)
|
|
469
|
+
context_validate_parser.add_argument(
|
|
470
|
+
"--check-invariants",
|
|
471
|
+
action="store_true",
|
|
472
|
+
help="Check if code respects documented invariants"
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
# context generate
|
|
476
|
+
context_generate_parser = context_subparsers.add_parser(
|
|
477
|
+
"generate",
|
|
478
|
+
help="Generate context from code annotations"
|
|
479
|
+
)
|
|
480
|
+
context_generate_parser.add_argument(
|
|
481
|
+
"source_dir",
|
|
482
|
+
nargs="?",
|
|
483
|
+
help="Directory to scan (default: current directory)"
|
|
484
|
+
)
|
|
485
|
+
context_generate_parser.add_argument(
|
|
486
|
+
"--update",
|
|
487
|
+
action="store_true",
|
|
488
|
+
help="Update existing context file"
|
|
489
|
+
)
|
|
490
|
+
|
|
491
|
+
# context query
|
|
492
|
+
context_query_parser = context_subparsers.add_parser(
|
|
493
|
+
"query",
|
|
494
|
+
help="Query context like a database"
|
|
495
|
+
)
|
|
496
|
+
context_query_parser.add_argument(
|
|
497
|
+
"query",
|
|
498
|
+
help="Search query (keyword or regex)"
|
|
499
|
+
)
|
|
500
|
+
context_query_parser.add_argument(
|
|
501
|
+
"--section",
|
|
502
|
+
"-s",
|
|
503
|
+
help="Specific section to search"
|
|
504
|
+
)
|
|
505
|
+
context_query_parser.add_argument(
|
|
506
|
+
"--format",
|
|
507
|
+
"-f",
|
|
508
|
+
choices=["text", "json", "yaml"],
|
|
509
|
+
default="text",
|
|
510
|
+
help="Output format (default: text)"
|
|
511
|
+
)
|
|
512
|
+
|
|
513
|
+
# context check
|
|
514
|
+
context_check_parser = context_subparsers.add_parser(
|
|
515
|
+
"check",
|
|
516
|
+
help="Check that code respects documented invariants"
|
|
517
|
+
)
|
|
518
|
+
context_check_parser.add_argument(
|
|
519
|
+
"--module",
|
|
520
|
+
"-m",
|
|
521
|
+
help="Filter by module name"
|
|
522
|
+
)
|
|
523
|
+
context_check_parser.add_argument(
|
|
524
|
+
"--invariant",
|
|
525
|
+
"-i",
|
|
526
|
+
help="Filter by invariant text"
|
|
527
|
+
)
|
|
528
|
+
context_check_parser.add_argument(
|
|
529
|
+
"--format",
|
|
530
|
+
"-f",
|
|
531
|
+
choices=["text", "json"],
|
|
532
|
+
default="text",
|
|
533
|
+
help="Output format (default: text)"
|
|
534
|
+
)
|
|
535
|
+
|
|
536
|
+
# context diagram
|
|
537
|
+
context_diagram_parser = context_subparsers.add_parser(
|
|
538
|
+
"diagram",
|
|
539
|
+
help="Generate architecture diagrams from context"
|
|
540
|
+
)
|
|
541
|
+
context_diagram_parser.add_argument(
|
|
542
|
+
"--type",
|
|
543
|
+
"-t",
|
|
544
|
+
choices=["modules", "dependencies", "flow", "all"],
|
|
545
|
+
default="modules",
|
|
546
|
+
help="Diagram type (default: modules)"
|
|
547
|
+
)
|
|
548
|
+
context_diagram_parser.add_argument(
|
|
549
|
+
"--format",
|
|
550
|
+
"-f",
|
|
551
|
+
choices=["mermaid", "d2"],
|
|
552
|
+
default="mermaid",
|
|
553
|
+
help="Output format (default: mermaid)"
|
|
554
|
+
)
|
|
555
|
+
context_diagram_parser.add_argument(
|
|
556
|
+
"--output",
|
|
557
|
+
"-o",
|
|
558
|
+
help="Output file path (default: print to console)"
|
|
559
|
+
)
|
|
560
|
+
context_diagram_parser.add_argument(
|
|
561
|
+
"--png",
|
|
562
|
+
action="store_true",
|
|
563
|
+
help="Render to PNG (requires output file)"
|
|
564
|
+
)
|
|
565
|
+
|
|
375
566
|
args = parser.parse_args()
|
|
376
567
|
|
|
377
568
|
# Execute command
|
|
@@ -393,6 +584,8 @@ Documentation: https://github.com/3vilEnterprises/vooodooo-magic/tree/main/packa
|
|
|
393
584
|
cmd_export(args)
|
|
394
585
|
elif args.command == "telemetry":
|
|
395
586
|
cmd_telemetry(args)
|
|
587
|
+
elif args.command == "context":
|
|
588
|
+
cmd_context(args)
|
|
396
589
|
else:
|
|
397
590
|
parser.print_help()
|
|
398
591
|
sys.exit(1)
|
|
@@ -435,7 +628,7 @@ def cmd_init(args):
|
|
|
435
628
|
config = {
|
|
436
629
|
"project_name": project_name,
|
|
437
630
|
"language": language,
|
|
438
|
-
"version": "0.
|
|
631
|
+
"version": "0.2.0",
|
|
439
632
|
"output_dir": "./voodocs-output",
|
|
440
633
|
"test_framework": "pytest",
|
|
441
634
|
"api_format": "openapi",
|
|
@@ -1353,5 +1546,72 @@ def cmd_telemetry(args):
|
|
|
1353
1546
|
client.status()
|
|
1354
1547
|
|
|
1355
1548
|
|
|
1549
|
+
def cmd_context(args):
|
|
1550
|
+
"""Manage project context."""
|
|
1551
|
+
from darkarts.context import (
|
|
1552
|
+
cmd_context_init,
|
|
1553
|
+
cmd_context_view,
|
|
1554
|
+
cmd_context_status,
|
|
1555
|
+
cmd_context_update,
|
|
1556
|
+
cmd_context_sync,
|
|
1557
|
+
cmd_context_history,
|
|
1558
|
+
cmd_context_diff,
|
|
1559
|
+
cmd_context_validate,
|
|
1560
|
+
cmd_context_generate,
|
|
1561
|
+
cmd_context_query,
|
|
1562
|
+
cmd_context_check,
|
|
1563
|
+
cmd_context_diagram
|
|
1564
|
+
)
|
|
1565
|
+
|
|
1566
|
+
if args.context_action == "init":
|
|
1567
|
+
force = getattr(args, 'force', False)
|
|
1568
|
+
sys.exit(cmd_context_init(force=force))
|
|
1569
|
+
elif args.context_action == "view":
|
|
1570
|
+
output_file = getattr(args, 'output', None)
|
|
1571
|
+
sys.exit(cmd_context_view(output_file=output_file))
|
|
1572
|
+
elif args.context_action == "status":
|
|
1573
|
+
sys.exit(cmd_context_status())
|
|
1574
|
+
elif args.context_action == "update":
|
|
1575
|
+
description = getattr(args, 'description', None)
|
|
1576
|
+
sys.exit(cmd_context_update(description=description))
|
|
1577
|
+
elif args.context_action == "sync":
|
|
1578
|
+
code_version = getattr(args, 'code_version', None)
|
|
1579
|
+
force = getattr(args, 'force', False)
|
|
1580
|
+
sys.exit(cmd_context_sync(code_version=code_version, force=force))
|
|
1581
|
+
elif args.context_action == "history":
|
|
1582
|
+
sys.exit(cmd_context_history())
|
|
1583
|
+
elif args.context_action == "diff":
|
|
1584
|
+
version1 = getattr(args, 'version1', None)
|
|
1585
|
+
version2 = getattr(args, 'version2', None)
|
|
1586
|
+
sys.exit(cmd_context_diff(version1=version1, version2=version2))
|
|
1587
|
+
elif args.context_action == "validate":
|
|
1588
|
+
check_version = getattr(args, 'check_version', False)
|
|
1589
|
+
check_invariants = getattr(args, 'check_invariants', False)
|
|
1590
|
+
sys.exit(cmd_context_validate(check_version=check_version, check_invariants=check_invariants))
|
|
1591
|
+
elif args.context_action == "generate":
|
|
1592
|
+
source_dir = getattr(args, 'source_dir', None)
|
|
1593
|
+
update_existing = getattr(args, 'update', False)
|
|
1594
|
+
sys.exit(cmd_context_generate(source_dir=source_dir, update_existing=update_existing))
|
|
1595
|
+
elif args.context_action == "query":
|
|
1596
|
+
query = getattr(args, 'query', '')
|
|
1597
|
+
section = getattr(args, 'section', None)
|
|
1598
|
+
format_type = getattr(args, 'format', 'text')
|
|
1599
|
+
sys.exit(cmd_context_query(query=query, section=section, format=format_type))
|
|
1600
|
+
elif args.context_action == "check":
|
|
1601
|
+
module_filter = getattr(args, 'module', None)
|
|
1602
|
+
invariant_filter = getattr(args, 'invariant', None)
|
|
1603
|
+
format_type = getattr(args, 'format', 'text')
|
|
1604
|
+
sys.exit(cmd_context_check(module_filter=module_filter, invariant_filter=invariant_filter, output_format=format_type))
|
|
1605
|
+
elif args.context_action == "diagram":
|
|
1606
|
+
diagram_type = getattr(args, 'type', 'modules')
|
|
1607
|
+
output_format = getattr(args, 'format', 'mermaid')
|
|
1608
|
+
output_file = getattr(args, 'output', None)
|
|
1609
|
+
render_png = getattr(args, 'png', False)
|
|
1610
|
+
sys.exit(cmd_context_diagram(diagram_type=diagram_type, output_format=output_format, output_file=output_file, render_png=render_png))
|
|
1611
|
+
else:
|
|
1612
|
+
print("Usage: voodocs context {init|view|status|update|sync|history|diff|validate|generate|query|check|diagram}")
|
|
1613
|
+
sys.exit(1)
|
|
1614
|
+
|
|
1615
|
+
|
|
1356
1616
|
if __name__ == "__main__":
|
|
1357
1617
|
main()
|
|
@@ -340,6 +340,17 @@ class AnnotationParser:
|
|
|
340
340
|
if text.startswith('{'):
|
|
341
341
|
return self._parse_object(text)
|
|
342
342
|
|
|
343
|
+
# Check if it's a YAML-style list (multiple lines starting with -)
|
|
344
|
+
if any(line.strip().startswith('-') for line in value_lines):
|
|
345
|
+
items = []
|
|
346
|
+
for line in value_lines:
|
|
347
|
+
line = line.strip()
|
|
348
|
+
if line.startswith('-'):
|
|
349
|
+
item = line[1:].strip()
|
|
350
|
+
if item: # Only add non-empty items
|
|
351
|
+
items.append(item)
|
|
352
|
+
return items if items else text
|
|
353
|
+
|
|
343
354
|
return text
|
|
344
355
|
|
|
345
356
|
def _parse_list(self, text: str) -> List[str]:
|
|
@@ -616,3 +627,56 @@ class AnnotationParser:
|
|
|
616
627
|
func.complexity = self._parse_complexity(annotations['complexity'])
|
|
617
628
|
if 'side_effects' in annotations:
|
|
618
629
|
func.side_effects = annotations['side_effects'] if isinstance(annotations['side_effects'], list) else [annotations['side_effects']]
|
|
630
|
+
|
|
631
|
+
def parse_directory(self, directory: Path) -> List[ParsedAnnotations]:
|
|
632
|
+
"""
|
|
633
|
+
Parse all source files in a directory recursively.
|
|
634
|
+
|
|
635
|
+
Args:
|
|
636
|
+
directory: Path to the directory to scan
|
|
637
|
+
|
|
638
|
+
Returns:
|
|
639
|
+
List of ParsedAnnotations objects, one per file with annotations
|
|
640
|
+
"""
|
|
641
|
+
results = []
|
|
642
|
+
|
|
643
|
+
# Supported file extensions
|
|
644
|
+
extensions = {'.py', '.ts', '.tsx', '.js', '.jsx', '.java', '.cpp', '.cc',
|
|
645
|
+
'.cxx', '.h', '.hpp', '.cs', '.go', '.rs'}
|
|
646
|
+
|
|
647
|
+
# Directories to skip
|
|
648
|
+
skip_dirs = {'node_modules', '.git', '__pycache__', 'venv', '.venv',
|
|
649
|
+
'dist', 'build', 'target', '.next', '.nuxt'}
|
|
650
|
+
|
|
651
|
+
# Recursively find all source files
|
|
652
|
+
for path in directory.rglob('*'):
|
|
653
|
+
# Skip directories
|
|
654
|
+
if path.is_dir():
|
|
655
|
+
continue
|
|
656
|
+
|
|
657
|
+
# Skip if in excluded directory
|
|
658
|
+
if any(skip_dir in path.parts for skip_dir in skip_dirs):
|
|
659
|
+
continue
|
|
660
|
+
|
|
661
|
+
# Check if file has supported extension
|
|
662
|
+
if path.suffix.lower() not in extensions:
|
|
663
|
+
continue
|
|
664
|
+
|
|
665
|
+
try:
|
|
666
|
+
# Parse the file
|
|
667
|
+
parsed = self.parse_file(str(path))
|
|
668
|
+
|
|
669
|
+
# Only include if it has annotations
|
|
670
|
+
if (parsed.module.module_purpose or
|
|
671
|
+
parsed.module.dependencies or
|
|
672
|
+
parsed.module.assumptions or
|
|
673
|
+
parsed.module.classes or
|
|
674
|
+
parsed.module.functions):
|
|
675
|
+
results.append(parsed)
|
|
676
|
+
|
|
677
|
+
except Exception as e:
|
|
678
|
+
# Skip files that fail to parse
|
|
679
|
+
print(f" ⚠️ Skipped {path.relative_to(directory)}: {str(e)}")
|
|
680
|
+
continue
|
|
681
|
+
|
|
682
|
+
return results
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""
|
|
2
|
+
VooDocs Context System
|
|
3
|
+
|
|
4
|
+
A structured, machine-readable knowledge base for software projects.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .models import (
|
|
8
|
+
ContextFile,
|
|
9
|
+
Versioning,
|
|
10
|
+
Project,
|
|
11
|
+
Architecture,
|
|
12
|
+
ArchitectureDecision,
|
|
13
|
+
Module,
|
|
14
|
+
CriticalPath,
|
|
15
|
+
KnownIssue,
|
|
16
|
+
Assumption,
|
|
17
|
+
Change,
|
|
18
|
+
RoadmapItem,
|
|
19
|
+
create_minimal_context
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
from .yaml_utils import (
|
|
23
|
+
write_context_yaml,
|
|
24
|
+
read_context_yaml,
|
|
25
|
+
parse_context_file,
|
|
26
|
+
add_to_gitignore,
|
|
27
|
+
format_context_as_markdown
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
from .commands import (
|
|
31
|
+
cmd_context_init,
|
|
32
|
+
cmd_context_view,
|
|
33
|
+
cmd_context_status,
|
|
34
|
+
cmd_context_update,
|
|
35
|
+
cmd_context_sync,
|
|
36
|
+
cmd_context_history,
|
|
37
|
+
cmd_context_diff,
|
|
38
|
+
cmd_context_validate,
|
|
39
|
+
cmd_context_generate,
|
|
40
|
+
cmd_context_query,
|
|
41
|
+
cmd_context_check,
|
|
42
|
+
cmd_context_diagram,
|
|
43
|
+
get_context_file_path,
|
|
44
|
+
context_file_exists
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
__all__ = [
|
|
48
|
+
# Models
|
|
49
|
+
'ContextFile',
|
|
50
|
+
'Versioning',
|
|
51
|
+
'Project',
|
|
52
|
+
'Architecture',
|
|
53
|
+
'ArchitectureDecision',
|
|
54
|
+
'Module',
|
|
55
|
+
'CriticalPath',
|
|
56
|
+
'KnownIssue',
|
|
57
|
+
'Assumption',
|
|
58
|
+
'Change',
|
|
59
|
+
'RoadmapItem',
|
|
60
|
+
'create_minimal_context',
|
|
61
|
+
|
|
62
|
+
# YAML utilities
|
|
63
|
+
'write_context_yaml',
|
|
64
|
+
'read_context_yaml',
|
|
65
|
+
'parse_context_file',
|
|
66
|
+
'add_to_gitignore',
|
|
67
|
+
'format_context_as_markdown',
|
|
68
|
+
|
|
69
|
+
# Commands
|
|
70
|
+
'cmd_context_init',
|
|
71
|
+
'cmd_context_view',
|
|
72
|
+
'cmd_context_status',
|
|
73
|
+
'cmd_context_update',
|
|
74
|
+
'cmd_context_sync',
|
|
75
|
+
'cmd_context_history',
|
|
76
|
+
'cmd_context_diff',
|
|
77
|
+
'cmd_context_validate',
|
|
78
|
+
'cmd_context_generate',
|
|
79
|
+
'cmd_context_query',
|
|
80
|
+
'cmd_context_check',
|
|
81
|
+
'cmd_context_diagram',
|
|
82
|
+
'get_context_file_path',
|
|
83
|
+
'context_file_exists',
|
|
84
|
+
]
|