@voodocs/cli 1.0.1 → 1.0.2

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 CHANGED
@@ -1,3 +1,89 @@
1
+ ## v1.0.2 (2024-12-21)
2
+
3
+ ### 🔧 Critical Bug Fixes
4
+
5
+ This patch release fixes critical issues that prevented @voodocs/cli from working out of the box in standard environments.
6
+
7
+ ---
8
+
9
+ ### Fixed
10
+
11
+ #### 1. CLI Entry Point (ModuleNotFoundError)
12
+ - **Fixed:** CLI entry point now correctly resolves symlinks for npm global installs
13
+ - **Before:** `voodocs` command failed with `ModuleNotFoundError: No module named 'cli'`
14
+ - **After:** Works correctly when installed globally via npm
15
+ - **Root Cause:** `Path(__file__).parent` didn't resolve symlinks created by npm in `.bin/`
16
+ - **Solution:** Added `.resolve()` to follow symlinks to actual package location
17
+
18
+ #### 2. Missing `init` Command
19
+ - **Fixed:** Implemented and registered the `voodocs init` command
20
+ - **Before:** Command referenced in documentation but didn't exist
21
+ - **After:** `voodocs init` creates `.voodocs.json` config and example files
22
+ - **Features:**
23
+ - Creates configuration file with sensible defaults
24
+ - Generates example annotated files (TypeScript and Python)
25
+ - Supports both `@voodocs` and `@darkarts` formats
26
+ - `--config-only` flag to skip example generation
27
+
28
+ #### 3. Annotation Parsing Failure for TypeScript
29
+ - **Fixed:** TypeScript parser now correctly identifies `/**@voodocs` and `/**@darkarts` blocks
30
+ - **Before:** Parser looked for `/*@voodocs` (single asterisk) and failed to find annotations
31
+ - **After:** Correctly matches JSDoc-style comments with `/**@voodocs` (double asterisk)
32
+ - **Impact:** All TypeScript/JavaScript annotations now parse correctly
33
+
34
+ #### 4. Inconsistent Terminology
35
+ - **Fixed:** Standardized support for both `@voodocs` and `@darkarts` tags
36
+ - **Before:** README used `@voodocs`, but CLI complained about missing `@darkarts`
37
+ - **After:** Both tags are supported and documented
38
+ - **Changes:**
39
+ - Parser accepts both `/**@voodocs` and `/**@darkarts`
40
+ - CLI help text clarifies support for both formats
41
+ - README updated with current v1.0.2 functionality
42
+ - Outdated commands removed from documentation
43
+
44
+ ---
45
+
46
+ ### Added
47
+
48
+ - **DarkArts Symbolic Format Guide:** New comprehensive guide at `docs/darkarts/DARKARTS_SYMBOLIC_GUIDE.md`
49
+ - **Symbol Quick Reference:** Complete reference for all symbolic annotations
50
+ - **Updated README:** Matches current v1.0.2 functionality with correct commands
51
+
52
+ ---
53
+
54
+ ### Improved
55
+
56
+ - **Better Error Messages:** More helpful error messages when annotations are missing
57
+ - **Documentation Accuracy:** All documentation now matches actual CLI functionality
58
+ - **CI/CD Example:** Added GitHub Actions workflow example for validation
59
+
60
+ ---
61
+
62
+ ### Testing
63
+
64
+ All fixes have been tested and verified:
65
+ - ✅ CLI entry point works with global npm install
66
+ - ✅ `voodocs init` creates config and examples
67
+ - ✅ TypeScript annotation parsing works correctly
68
+ - ✅ Both `@voodocs` and `@darkarts` tags are recognized
69
+
70
+ ---
71
+
72
+ ### Upgrade Notes
73
+
74
+ If you're upgrading from v1.0.1:
75
+
76
+ 1. **No breaking changes** - All existing annotations continue to work
77
+ 2. **New `init` command** - Use `voodocs init` to set up new projects
78
+ 3. **Better TypeScript support** - Annotations will now be detected correctly
79
+ 4. **Both formats supported** - Use either `@voodocs` or `@darkarts` tags
80
+
81
+ ---
82
+
83
+ ### Known Issues
84
+
85
+ None - all critical issues from v1.0.1 have been resolved.
86
+
1
87
  ## v1.0.1 (2024-12-21)
2
88
 
3
89
  ### 🔧 Bug Fixes: DarkArts Convert Command
package/README.md CHANGED
@@ -1,28 +1,27 @@
1
- # Voodocs - AI-Native Documentation System
1
+ # VooDocs - AI-Native Documentation with Validation
2
2
 
3
3
  [![NPM Version](https://img.shields.io/npm/v/@voodocs/cli.svg)](https://www.npmjs.com/package/@voodocs/cli)
4
4
  [![License](https://img.shields.io/npm/l/@voodocs/cli.svg)](https://voodocs.com/terms)
5
5
  [![Support](https://img.shields.io/badge/support-priority-blue.svg)](https://voodocs.com/support)
6
6
 
7
- **Voodocs** is a revolutionary AI-native documentation system that transforms how software is documented, tested, and specified. It teaches AI coding assistants (like Cursor and Claude Code) to write precise, machine-readable specifications in `@voodocs` annotations using the **DarkArtsAI language** - the mathematical and logical notation that AI naturally understands. These annotations are then automatically translated into human-readable documentation, automated tests, and API specifications.
7
+ **VooDocs** is the only documentation tool that validates your annotations and guarantees accuracy. It combines AI-native symbolic documentation with semantic validation, performance verification, and automatic error correction.
8
8
 
9
- This is the future of software development: **AI documents your code in its native language, Voodocs translates it for humans.**
9
+ ## What Makes VooDocs Unique?
10
10
 
11
- ## How It Works
11
+ **Semantic Validation** - Verifies that your documentation matches your code
12
+ ✅ **Performance Validation** - Checks that complexity claims are accurate
13
+ ✅ **Auto-Fix** - Automatically corrects common documentation errors
14
+ ✅ **Benchmarking** - Validates performance claims with real execution data
15
+ ✅ **Two Formats** - Natural language (`@voodocs`) or symbolic (`@darkarts`)
16
+ ✅ **CI/CD Ready** - Strict mode with exit codes for continuous integration
12
17
 
13
- 1. **Install**: Add Voodocs to your project with `npm install -g @voodocs/cli`
14
- 2. **Instruct**: Run `voodocs instruct` to generate AI instructions for your coding assistant
15
- 3. **Code**: Your AI assistant (Cursor, Claude Code, etc.) automatically adds `@voodocs` annotations as it writes code
16
- 4. **Generate**: Run `voodocs generate` to produce:
17
- - **Markdown Documentation**: Beautiful, human-readable docs
18
- - **Automated Tests**: Comprehensive test suites (pytest, unittest, Jest)
19
- - **API Specifications**: OpenAPI 3.0 and GraphQL schemas
18
+ ---
20
19
 
21
20
  ## Quick Start
22
21
 
23
22
  ### 1. Installation
24
23
 
25
- Install the CLI globally using `npm` or `pnpm`:
24
+ Install the CLI globally using `npm`:
26
25
 
27
26
  ```bash
28
27
  npm install -g @voodocs/cli
@@ -30,179 +29,348 @@ npm install -g @voodocs/cli
30
29
 
31
30
  ### 2. Initialize Your Project
32
31
 
33
- Navigate to your project directory and initialize Voodocs:
32
+ Navigate to your project directory and initialize VooDocs:
34
33
 
35
34
  ```bash
36
35
  voodocs init
37
36
  ```
38
37
 
39
- This will prompt you for your API key and set up the configuration.
40
-
41
- ### 3. Generate AI Instructions
42
-
43
- Create instructions for your AI coding assistant:
44
-
45
- ```bash
46
- voodocs instruct
47
- ```
48
-
49
- This creates a `VOODOCS_INSTRUCTIONS.md` file. Provide this to your AI assistant (add to `.cursorrules`, Claude project instructions, etc.).
38
+ This creates a `.voodocs.json` configuration file and example annotated files.
50
39
 
51
- ### 4. Let AI Document Your Code
40
+ ### 3. Add Annotations to Your Code
52
41
 
53
- As you code with your AI assistant, it will automatically add `@voodocs` annotations:
42
+ #### Natural Language Format (`@voodocs`)
54
43
 
55
44
  ```typescript
56
45
  /**@voodocs
57
46
  module_purpose: "User authentication service with JWT token generation"
58
47
  dependencies: [
59
- "bcrypt: Password hashing",
60
- "jsonwebtoken: JWT token generation"
48
+ "bcrypt: Password hashing",
49
+ "jsonwebtoken: JWT token generation"
61
50
  ]
62
51
  assumptions: [
63
- "Database connection is established",
64
- "User model exists with email and password fields"
52
+ "Database connection is established",
53
+ "User model exists with email and password fields"
54
+ ]
55
+ */
56
+
57
+ /**@voodocs
58
+ preconditions: [
59
+ "email must be a valid email format",
60
+ "password must be at least 8 characters"
61
+ ]
62
+ postconditions: [
63
+ "Returns a JWT token",
64
+ "User is authenticated in the database"
65
65
  ]
66
- security_model: "Passwords hashed with bcrypt, tokens expire in 24h"
66
+ invariants: [
67
+ "Does not modify existing user records"
68
+ ]
69
+ side_effects: [
70
+ "Creates a new session in the database"
71
+ ]
72
+ complexity: "O(1)"
73
+ */
74
+ export async function login(email: string, password: string): Promise<string> {
75
+ // ...
76
+ }
77
+ ```
78
+
79
+ #### Symbolic Format (`@darkarts`)
80
+
81
+ ```typescript
82
+ /**@darkarts
83
+ ⊢{User authentication service with JWT token generation}
84
+ ∂{
85
+ bcrypt: Password hashing
86
+ jsonwebtoken: JWT token generation
87
+ }
88
+ ⚠{
89
+ Database connection is established
90
+ User model ∃ with email ∧ password fields
91
+ }
92
+ */
93
+
94
+ /**@darkarts
95
+ ⊳{
96
+ email must be a valid email format
97
+ password.length ≥ 8
98
+ }
99
+ ⊲{
100
+ Returns a JWT token
101
+ User is authenticated ∈ database
102
+ }
103
+ ⊨{
104
+ Does ¬ modify existing user records
105
+ }
106
+ ⚡{
107
+ Creates a new session ∈ database
108
+ }
67
109
  */
110
+ export async function login(email: string, password: string): Promise<string> {
111
+ // ...
112
+ }
113
+ ```
114
+
115
+ ### 4. Validate Your Annotations
116
+
117
+ Run validation to ensure your documentation is accurate:
118
+
119
+ ```bash
120
+ voodocs validate ./src --recursive
68
121
  ```
69
122
 
70
- ### 5. Generate Documentation
123
+ This checks:
124
+ - **Semantic validation**: Dependencies match imports
125
+ - **Performance validation**: Complexity claims are accurate
126
+ - **Consistency**: All required fields are present
71
127
 
72
- Run the generate command to create documentation, tests, and API specs:
128
+ ### 5. Auto-Fix Issues
129
+
130
+ Automatically fix common errors:
73
131
 
74
132
  ```bash
75
- # Generate everything
76
- voodocs generate ./src
133
+ voodocs fix ./src --recursive
134
+ ```
77
135
 
78
- # Generate only documentation
79
- voodocs generate ./src --docs-only
136
+ ### 6. Generate Documentation
80
137
 
81
- # Generate only tests
82
- voodocs generate ./src --tests-only
138
+ Create beautiful documentation from your annotations:
139
+
140
+ ```bash
141
+ voodocs generate ./src ./docs --recursive
83
142
  ```
84
143
 
144
+ ---
145
+
85
146
  ## Core Commands
86
147
 
87
- ### Documentation & Generation
88
- - `voodocs init`: Initialize VooDocs in your project
89
- - `voodocs instruct`: Generate instructions for your AI assistant
90
- - `voodocs generate <path>`: Generate docs, tests, and API specs from annotations
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
122
-
123
- ## The DarkArts Language
124
-
125
- Voodocs uses the **DarkArts language** - a mathematical and logical notation system that represents how AI naturally thinks about code. Instead of forcing AI to write verbose human documentation, Voodocs lets AI express concepts precisely using:
126
-
127
- - **Mathematical notation**: ∀, ∃, ∈, ⇒, ⇔
128
- - **Formal logic**: Preconditions, postconditions, invariants
129
- - **Declarative relationships**: What IS, not what to DO
130
- - **Conditional reasoning**: Case-based specifications
131
-
132
- Voodocs then translates this precise, machine-readable format into natural language documentation that humans can easily understand.
133
-
134
- ## What's New in v0.2.0
135
-
136
- ### 🔍 Invariant Checking
137
- Automatically validate that your code respects documented invariants:
148
+ ### `voodocs init`
149
+
150
+ Initialize a new project with VooDocs configuration and example files.
151
+
138
152
  ```bash
139
- voodocs context check
153
+ voodocs init # Initialize with @voodocs format
154
+ voodocs init --format darkarts # Initialize with symbolic @darkarts format
155
+ voodocs init --config-only # Only create config file
140
156
  ```
141
- Detects security issues like SQL injection, unhashed passwords, and logged secrets.
142
157
 
143
- ### 📊 Architecture Diagrams
144
- Auto-generate visual diagrams from your context:
158
+ ### `voodocs validate`
159
+
160
+ Validate annotations against your code.
161
+
145
162
  ```bash
146
- voodocs context diagram --type modules --output arch.png --png
163
+ voodocs validate <path> [options]
164
+
165
+ Options:
166
+ -r, --recursive Process directories recursively
167
+ -s, --strict Exit with error code if validation fails
168
+ -f, --format <format> Output format: text, json, html (default: text)
169
+ --semantic-only Only run semantic validation
170
+ --performance-only Only run performance validation
147
171
  ```
148
- Supports module diagrams, dependency diagrams, and flow diagrams.
149
172
 
150
- ### ✅ Enhanced Validation
151
- Smart validation with actionable suggestions:
173
+ **Example:**
152
174
  ```bash
153
- voodocs context validate --check-invariants
175
+ voodocs validate ./src --recursive --strict
154
176
  ```
155
- Provides completeness checks, quality suggestions, and consistency validation.
156
177
 
157
- ## Why Voodocs?
178
+ ### `voodocs fix`
158
179
 
159
- - **AI-First Workflow**: Designed for modern AI-assisted development. Your AI documents as it codes.
160
- - **Single Source of Truth**: Code annotations drive docs, tests, and specs - always in sync.
161
- - **Massive Time Savings**: Eliminate manual documentation work entirely.
162
- - **Higher Code Quality**: Formal specifications lead to more robust and reliable code.
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)
180
+ Automatically fix validation errors.
166
181
 
167
- ## Example Annotation
182
+ ```bash
183
+ voodocs fix <path> [options]
168
184
 
169
- ```typescript
170
- /**@voodocs
171
- preconditions: [
172
- "user must be authenticated",
173
- "user must have 'admin' role",
174
- "Database connection must be active"
175
- ]
176
- postconditions: [
177
- "returns true user is admin ∧ MFA enabled",
178
- "returns false ⇔ user lacks admin role ∨ MFA disabled ∨ any error",
179
- "∀ errors: function returns false (fail-safe behavior)"
180
- ]
181
- security_implications: [
182
- "CRITICAL: Gates all admin functionality",
183
- "Fail-safe design: errors → deny access"
184
- ]
185
- complexity: "O(1) - Single database query with indexed lookup"
186
- */
187
- export async function isAdmin(userId: string): Promise<boolean> {
188
- // implementation
185
+ Options:
186
+ -r, --recursive Process directories recursively
187
+ -d, --dry-run Show what would be fixed without making changes
188
+ -b, --backup Create backup files before fixing
189
+ ```
190
+
191
+ **Example:**
192
+ ```bash
193
+ voodocs fix ./src --recursive --backup
194
+ ```
195
+
196
+ ### `voodocs generate`
197
+
198
+ Generate documentation from annotations.
199
+
200
+ ```bash
201
+ voodocs generate <input> <output> [options]
202
+
203
+ Options:
204
+ -r, --recursive Process directories recursively
205
+ -f, --format <format> Output format: markdown, html (default: markdown)
206
+ -v, --validate Validate annotations before generating
207
+ --include-toc Include table of contents
208
+ ```
209
+
210
+ **Example:**
211
+ ```bash
212
+ voodocs generate ./src ./docs --recursive --validate
213
+ ```
214
+
215
+ ### `voodocs benchmark`
216
+
217
+ Run performance benchmarks to validate complexity claims.
218
+
219
+ ```bash
220
+ voodocs benchmark <path> [options]
221
+
222
+ Options:
223
+ -r, --recursive Process directories recursively
224
+ -f, --format <format> Output format: text, json, html (default: text)
225
+ --iterations <n> Number of benchmark iterations (default: 100)
226
+ ```
227
+
228
+ **Example:**
229
+ ```bash
230
+ voodocs benchmark ./src --recursive --format json
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Annotation Fields
236
+
237
+ ### Module-Level Annotations
238
+
239
+ | Field | Symbol | Description |
240
+ |-------|--------|-------------|
241
+ | `module_purpose` | `⊢` | Concise statement of the module's responsibility |
242
+ | `dependencies` | `∂` | List of critical internal or external dependencies |
243
+ | `assumptions` | `⚠` | Key assumptions about environment or inputs |
244
+ | `invariants` | `⊨` | Properties that remain unchanged |
245
+ | `security_model` | `🔒` | Security considerations |
246
+ | `performance_model` | `⚡` | Performance characteristics |
247
+
248
+ ### Function/Interface-Level Annotations
249
+
250
+ | Field | Symbol | Description |
251
+ |-------|--------|-------------|
252
+ | `preconditions` | `⊳` | Conditions that must be true before execution |
253
+ | `postconditions` | `⊲` | Conditions that will be true after execution |
254
+ | `invariants` | `⊨` | Properties that remain unchanged |
255
+ | `side_effects` | `⚡` | Observable effects outside the return value |
256
+ | `security_implications` | `🔒` | Security-related considerations |
257
+ | `complexity` | `⚡` | Computational complexity (e.g., O(n)) |
258
+
259
+ ---
260
+
261
+ ## Symbolic Format Reference
262
+
263
+ ### Logic Symbols
264
+
265
+ | Symbol | Meaning | Example |
266
+ |--------|---------|---------|
267
+ | `∧` | and | `authenticated ∧ hasPermission` |
268
+ | `∨` | or | `isAdmin ∨ isOwner` |
269
+ | `¬` | not | `¬isGuest` |
270
+ | `∈` | in | `userId ∈ validIds` |
271
+ | `∃` | exists | `∃ user: user.id = userId` |
272
+ | `∀` | for all | `∀ item: item.price > 0` |
273
+ | `⇒` | implies | `isLoggedIn ⇒ hasSession` |
274
+ | `⇔` | if and only if | `isActive ⇔ lastLogin < 24h` |
275
+
276
+ ---
277
+
278
+ ## CI/CD Integration
279
+
280
+ Use VooDocs in your continuous integration pipeline:
281
+
282
+ ```yaml
283
+ # .github/workflows/validate-docs.yml
284
+ name: Validate Documentation
285
+
286
+ on: [push, pull_request]
287
+
288
+ jobs:
289
+ validate:
290
+ runs-on: ubuntu-latest
291
+ steps:
292
+ - uses: actions/checkout@v2
293
+
294
+ - name: Setup Node.js
295
+ uses: actions/setup-node@v2
296
+ with:
297
+ node-version: '18'
298
+
299
+ - name: Install VooDocs
300
+ run: npm install -g @voodocs/cli
301
+
302
+ - name: Validate Annotations
303
+ run: voodocs validate ./src --recursive --strict
304
+ ```
305
+
306
+ ---
307
+
308
+ ## Configuration
309
+
310
+ Create a `.voodocs.json` file in your project root:
311
+
312
+ ```json
313
+ {
314
+ "version": "1.0",
315
+ "format": "voodocs",
316
+ "validation": {
317
+ "semantic": true,
318
+ "performance": true,
319
+ "strict": false
320
+ },
321
+ "generation": {
322
+ "output_format": "markdown",
323
+ "include_toc": true,
324
+ "include_examples": true
325
+ },
326
+ "exclude": [
327
+ "node_modules",
328
+ "dist",
329
+ "build",
330
+ "__pycache__",
331
+ ".git"
332
+ ]
189
333
  }
190
334
  ```
191
335
 
192
- ## Licensing
336
+ ---
193
337
 
194
- Voodocs is a commercial product. A valid API key is required to use the software. We offer:
338
+ ## Documentation
195
339
 
196
- - **Free Tier**: For hobbyists and students
197
- - **Pro Plan**: For professional developers
198
- - **Enterprise**: For teams and organizations
340
+ - **User Guide**: [docs/darkarts/USER_GUIDE.md](docs/darkarts/USER_GUIDE.md)
341
+ - **API Reference**: [docs/darkarts/API_REFERENCE.md](docs/darkarts/API_REFERENCE.md)
342
+ - **Tutorials**: [docs/darkarts/TUTORIALS.md](docs/darkarts/TUTORIALS.md)
343
+ - **Symbolic Format Guide**: [docs/darkarts/DARKARTS_SYMBOLIC_GUIDE.md](docs/darkarts/DARKARTS_SYMBOLIC_GUIDE.md)
199
344
 
200
- For more details, see our [Pricing Page](https://voodocs.com/pricing).
345
+ ---
201
346
 
202
347
  ## Support
203
348
 
204
- Need help? Visit our [Support Center](https://voodocs.com/support) or email us at [support@voodocs.com](mailto:support@voodocs.com).
349
+ - **Issues**: [GitHub Issues](https://github.com/3vilEnterprises/vooodooo-magic/issues)
350
+ - **Email**: contact@3vil.enterprises
351
+ - **Website**: [voodocs.com](https://voodocs.com)
352
+
353
+ ---
354
+
355
+ ## License
356
+
357
+ Commercial - See [LICENSE](LICENSE) for details.
358
+
359
+ ---
360
+
361
+ ## What's New in v1.0.1
362
+
363
+ ### Bug Fixes
364
+ - ✅ Fixed CLI entry point (ModuleNotFoundError)
365
+ - ✅ Added missing `init` command
366
+ - ✅ Fixed annotation parsing for TypeScript files
367
+ - ✅ Standardized terminology (@voodocs and @darkarts both supported)
368
+
369
+ ### Improvements
370
+ - ✅ Better error messages
371
+ - ✅ Improved documentation
372
+ - ✅ Enhanced validation accuracy
205
373
 
206
374
  ---
207
375
 
208
- **DarkArt Intelligence** 🚀
376
+ **VooDocs - The only documentation tool that validates your annotations and guarantees accuracy.**
@@ -16,7 +16,7 @@ This module provides the command-line interface for VooDocs.
16
16
  import click
17
17
  from typing import Optional
18
18
 
19
- __version__ = "1.0.0"
19
+ __version__ = "1.0.2"
20
20
 
21
21
 
22
22
  @click.group()
@@ -26,18 +26,22 @@ def cli(ctx):
26
26
  """
27
27
  VooDocs - AI-Native Documentation Generator with Validation
28
28
 
29
- Generate and validate @darkarts annotations in your codebase.
29
+ Generate and validate @voodocs and @darkarts annotations in your codebase.
30
+
31
+ Supports both natural language (@voodocs) and symbolic (@darkarts) formats.
30
32
  """
31
33
  ctx.ensure_object(dict)
32
34
 
33
35
 
34
36
  # Import subcommands
37
+ from .init import init
35
38
  from .validate import validate
36
39
  from .generate import generate
37
40
  from .benchmark import benchmark
38
41
  from .fix import fix
39
42
 
40
43
  # Register commands
44
+ cli.add_command(init)
41
45
  cli.add_command(validate)
42
46
  cli.add_command(generate)
43
47
  cli.add_command(benchmark)
@@ -0,0 +1,228 @@
1
+ """@darkarts
2
+ ⊢{cli:init}
3
+ ∂{click,pathlib,json}
4
+ ⚠{write-access:cwd}
5
+ ⊨{idempotent:config-creation}
6
+ 🔒{read-write:filesystem}
7
+ ⚡{O(1):file-creation}
8
+ """
9
+
10
+ """
11
+ VooDocs Init Command
12
+
13
+ Initialize a new project with VooDocs configuration and example annotations.
14
+ """
15
+
16
+ import click
17
+ import json
18
+ from pathlib import Path
19
+
20
+
21
+ @click.command()
22
+ @click.option(
23
+ '--format',
24
+ type=click.Choice(['voodocs', 'darkarts'], case_sensitive=False),
25
+ default='voodocs',
26
+ help='Annotation format to use (voodocs or darkarts symbolic)'
27
+ )
28
+ @click.option(
29
+ '--config-only',
30
+ is_flag=True,
31
+ help='Only create configuration file, skip example files'
32
+ )
33
+ def init(format, config_only):
34
+ """
35
+ Initialize a new project with VooDocs.
36
+
37
+ Creates a .voodocs.json configuration file and optionally generates
38
+ example annotated files to help you get started.
39
+
40
+ Examples:
41
+ voodocs init # Initialize with @voodocs format
42
+ voodocs init --format darkarts # Initialize with symbolic @darkarts format
43
+ voodocs init --config-only # Only create config file
44
+ """
45
+ cwd = Path.cwd()
46
+ config_path = cwd / '.voodocs.json'
47
+
48
+ # Check if config already exists
49
+ if config_path.exists():
50
+ click.echo(click.style('⚠ .voodocs.json already exists', fg='yellow'))
51
+ if not click.confirm('Overwrite existing configuration?'):
52
+ click.echo('Aborted.')
53
+ return
54
+
55
+ # Create default configuration
56
+ config = {
57
+ "version": "1.0",
58
+ "format": format,
59
+ "validation": {
60
+ "semantic": True,
61
+ "performance": True,
62
+ "strict": False
63
+ },
64
+ "generation": {
65
+ "output_format": "markdown",
66
+ "include_toc": True,
67
+ "include_examples": True
68
+ },
69
+ "exclude": [
70
+ "node_modules",
71
+ "dist",
72
+ "build",
73
+ "__pycache__",
74
+ ".git",
75
+ "*.min.js"
76
+ ]
77
+ }
78
+
79
+ # Write configuration
80
+ with open(config_path, 'w') as f:
81
+ json.dump(config, f, indent=2)
82
+
83
+ click.echo(click.style('✓ Created .voodocs.json', fg='green'))
84
+
85
+ if not config_only:
86
+ # Create example files
87
+ examples_dir = cwd / 'voodocs-examples'
88
+ examples_dir.mkdir(exist_ok=True)
89
+
90
+ if format == 'voodocs':
91
+ create_voodocs_example(examples_dir)
92
+ else:
93
+ create_darkarts_example(examples_dir)
94
+
95
+ click.echo(click.style(f'✓ Created example files in {examples_dir}/', fg='green'))
96
+
97
+ click.echo()
98
+ click.echo(click.style('🎉 VooDocs initialized successfully!', fg='green', bold=True))
99
+ click.echo()
100
+ click.echo('Next steps:')
101
+ click.echo(' 1. Review .voodocs.json configuration')
102
+ click.echo(' 2. Add annotations to your code')
103
+ click.echo(' 3. Run: voodocs validate .')
104
+ click.echo(' 4. Run: voodocs generate . ./docs')
105
+ click.echo()
106
+ click.echo('Documentation: https://voodocs.com/docs')
107
+
108
+
109
+ def create_voodocs_example(examples_dir: Path):
110
+ """Create example files with @voodocs annotations."""
111
+
112
+ # TypeScript example
113
+ ts_example = '''/**@voodocs
114
+ module_purpose: "Example TypeScript module demonstrating @voodocs annotations"
115
+ dependencies: []
116
+ assumptions: ["TypeScript environment available"]
117
+ */
118
+
119
+ /**@voodocs
120
+ preconditions: [
121
+ "name must be a non-empty string",
122
+ "age must be a positive number"
123
+ ]
124
+ postconditions: [
125
+ "Returns a greeting message",
126
+ "Message includes the provided name"
127
+ ]
128
+ invariants: [
129
+ "Does not modify input parameters"
130
+ ]
131
+ side_effects: []
132
+ complexity: "O(1)"
133
+ */
134
+ export function greet(name: string, age: number): string {
135
+ return `Hello, ${name}! You are ${age} years old.`;
136
+ }
137
+ '''
138
+
139
+ (examples_dir / 'example.ts').write_text(ts_example)
140
+
141
+ # Python example
142
+ py_example = '''"""@voodocs
143
+ module_purpose: "Example Python module demonstrating @voodocs annotations"
144
+ dependencies: []
145
+ assumptions: ["Python 3.7+"]
146
+ """
147
+
148
+ def calculate_total(prices: list[float], tax_rate: float) -> float:
149
+ """@voodocs
150
+ preconditions: [
151
+ "prices is a non-empty list of positive numbers",
152
+ "tax_rate is between 0 and 1"
153
+ ]
154
+ postconditions: [
155
+ "Returns the total with tax applied",
156
+ "Result is greater than or equal to sum of prices"
157
+ ]
158
+ invariants: [
159
+ "Does not modify the prices list"
160
+ ]
161
+ side_effects: []
162
+ complexity: "O(n) where n is the length of prices"
163
+ """
164
+ subtotal = sum(prices)
165
+ return subtotal * (1 + tax_rate)
166
+ '''
167
+
168
+ (examples_dir / 'example.py').write_text(py_example)
169
+
170
+
171
+ def create_darkarts_example(examples_dir: Path):
172
+ """Create example files with symbolic @darkarts annotations."""
173
+
174
+ # TypeScript example
175
+ ts_example = '''/**@darkarts
176
+ ⊢{Example TypeScript module demonstrating symbolic @darkarts annotations}
177
+ ∂{}
178
+ ⚠{TypeScript environment available}
179
+ */
180
+
181
+ /**@darkarts
182
+ ⊳{
183
+ name must be a non-empty string
184
+ age must be a positive number
185
+ }
186
+ ⊲{
187
+ Returns a greeting message
188
+ Message includes the provided name
189
+ }
190
+ ⊨{
191
+ Does ¬ modify input parameters
192
+ }
193
+ ⚡{}
194
+ */
195
+ export function greet(name: string, age: number): string {
196
+ return `Hello, ${name}! You are ${age} years old.`;
197
+ }
198
+ '''
199
+
200
+ (examples_dir / 'example.ts').write_text(ts_example)
201
+
202
+ # Python example
203
+ py_example = '''"""@darkarts
204
+ ⊢{Example Python module demonstrating symbolic @darkarts annotations}
205
+ ∂{}
206
+ ⚠{Python 3.7+}
207
+ """
208
+
209
+ def calculate_total(prices: list[float], tax_rate: float) -> float:
210
+ """@darkarts
211
+ ⊳{
212
+ prices is a non-empty list ∧ ∀ p ∈ prices: p > 0
213
+ tax_rate ∈ [0, 1]
214
+ }
215
+ ⊲{
216
+ Returns the total with tax applied
217
+ result ≥ sum(prices)
218
+ }
219
+ ⊨{
220
+ Does ¬ modify the prices list
221
+ }
222
+ ⚡{O(n) where n = len(prices)}
223
+ """
224
+ subtotal = sum(prices)
225
+ return subtotal * (1 + tax_rate)
226
+ '''
227
+
228
+ (examples_dir / 'example.py').write_text(py_example)
@@ -50,16 +50,16 @@ class AnnotationParser:
50
50
  Language.PYTHON: r'"""@voodocs\s*(.*?)\s*"""',
51
51
  }
52
52
 
53
- # DarkArts patterns (symbolic annotations)
53
+ # DarkArts patterns (symbolic annotations) - support both @voodocs and @darkarts
54
54
  DARKARTS_PATTERNS = {
55
- Language.PYTHON: r'"""@darkarts\s*(.*?)\s*"""',
56
- Language.TYPESCRIPT: r'/\*@voodocs\s*(.*?)\s*\*/',
57
- Language.JAVASCRIPT: r'/\*@voodocs\s*(.*?)\s*\*/',
58
- Language.JAVA: r'/\*@voodocs\s*(.*?)\s*\*/',
59
- Language.CPP: r'/\*@voodocs\s*(.*?)\s*\*/',
60
- Language.CSHARP: r'/\*@voodocs\s*(.*?)\s*\*/',
61
- Language.GO: r'/\*@voodocs\s*(.*?)\s*\*/',
62
- Language.RUST: r'/\*@voodocs\s*(.*?)\s*\*/',
55
+ Language.PYTHON: r'"""@(?:darkarts|voodocs)\s*(.*?)\s*"""',
56
+ Language.TYPESCRIPT: r'/\*\*@(?:darkarts|voodocs)\s*(.*?)\s*\*/',
57
+ Language.JAVASCRIPT: r'/\*\*@(?:darkarts|voodocs)\s*(.*?)\s*\*/',
58
+ Language.JAVA: r'/\*\*@(?:darkarts|voodocs)\s*(.*?)\s*\*/',
59
+ Language.CPP: r'/\*\*@(?:darkarts|voodocs)\s*(.*?)\s*\*/',
60
+ Language.CSHARP: r'/\*\*@(?:darkarts|voodocs)\s*(.*?)\s*\*/',
61
+ Language.GO: r'/\*\*@(?:darkarts|voodocs)\s*(.*?)\s*\*/',
62
+ Language.RUST: r'/\*\*@(?:darkarts|voodocs)\s*(.*?)\s*\*/',
63
63
  }
64
64
 
65
65
  def __init__(self):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voodocs/cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "AI-Native Documentation System with Validation - The only documentation tool that validates your annotations and guarantees accuracy",
5
5
  "main": "voodocs_cli.py",
6
6
  "bin": {
package/voodocs_cli.py CHANGED
@@ -17,8 +17,9 @@ This is the main entry point for the voodocs command-line tool.
17
17
  import sys
18
18
  from pathlib import Path
19
19
 
20
- # Add lib to path
21
- lib_path = Path(__file__).parent / "lib"
20
+ # Add lib to path - resolve symlinks for npm global installs
21
+ script_path = Path(__file__).resolve()
22
+ lib_path = script_path.parent / "lib"
22
23
  sys.path.insert(0, str(lib_path))
23
24
 
24
25
  # Import and run CLI