@voodocs/cli 0.1.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/LICENSE +37 -0
- package/README.md +153 -0
- package/USAGE.md +314 -0
- package/cli.py +1340 -0
- package/examples/.cursorrules +437 -0
- package/examples/instructions/.claude/instructions.md +372 -0
- package/examples/instructions/.cursorrules +437 -0
- package/examples/instructions/.windsurfrules +437 -0
- package/examples/instructions/VOODOCS_INSTRUCTIONS.md +437 -0
- package/examples/math_example.py +41 -0
- package/examples/phase2_test.py +24 -0
- package/examples/test_compound_conditions.py +40 -0
- package/examples/test_math_example.py +186 -0
- package/lib/darkarts/README.md +115 -0
- package/lib/darkarts/__init__.py +16 -0
- package/lib/darkarts/annotations/__init__.py +34 -0
- package/lib/darkarts/annotations/parser.py +618 -0
- package/lib/darkarts/annotations/types.py +181 -0
- package/lib/darkarts/cli.py +128 -0
- package/lib/darkarts/core/__init__.py +32 -0
- package/lib/darkarts/core/interface.py +256 -0
- package/lib/darkarts/core/loader.py +231 -0
- package/lib/darkarts/core/plugin.py +215 -0
- package/lib/darkarts/core/registry.py +146 -0
- package/lib/darkarts/exceptions.py +51 -0
- package/lib/darkarts/parsers/typescript/dist/cli.d.ts +9 -0
- package/lib/darkarts/parsers/typescript/dist/cli.d.ts.map +1 -0
- package/lib/darkarts/parsers/typescript/dist/cli.js +69 -0
- package/lib/darkarts/parsers/typescript/dist/cli.js.map +1 -0
- package/lib/darkarts/parsers/typescript/dist/parser.d.ts +111 -0
- package/lib/darkarts/parsers/typescript/dist/parser.d.ts.map +1 -0
- package/lib/darkarts/parsers/typescript/dist/parser.js +365 -0
- package/lib/darkarts/parsers/typescript/dist/parser.js.map +1 -0
- package/lib/darkarts/parsers/typescript/package-lock.json +51 -0
- package/lib/darkarts/parsers/typescript/package.json +19 -0
- package/lib/darkarts/parsers/typescript/src/cli.ts +41 -0
- package/lib/darkarts/parsers/typescript/src/parser.ts +408 -0
- package/lib/darkarts/parsers/typescript/tsconfig.json +19 -0
- package/lib/darkarts/plugins/voodocs/__init__.py +379 -0
- package/lib/darkarts/plugins/voodocs/ai_native_plugin.py +151 -0
- package/lib/darkarts/plugins/voodocs/annotation_validator.py +280 -0
- package/lib/darkarts/plugins/voodocs/api_spec_generator.py +486 -0
- package/lib/darkarts/plugins/voodocs/documentation_generator.py +610 -0
- package/lib/darkarts/plugins/voodocs/html_exporter.py +260 -0
- package/lib/darkarts/plugins/voodocs/instruction_generator.py +706 -0
- package/lib/darkarts/plugins/voodocs/pdf_exporter.py +66 -0
- package/lib/darkarts/plugins/voodocs/test_generator.py +636 -0
- package/package.json +70 -0
- package/requirements.txt +13 -0
- package/templates/ci/github-actions.yml +73 -0
- package/templates/ci/gitlab-ci.yml +35 -0
- package/templates/ci/pre-commit-hook.sh +26 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
VooDocs Commercial License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 3vilEnterprises
|
|
4
|
+
|
|
5
|
+
All rights reserved.
|
|
6
|
+
|
|
7
|
+
This software and associated documentation files (the "Software") are proprietary
|
|
8
|
+
and confidential to 3vilEnterprises.
|
|
9
|
+
|
|
10
|
+
NOTICE: This Software is licensed, not sold. By installing, copying, or otherwise
|
|
11
|
+
using the Software, you agree to be bound by the terms of this license.
|
|
12
|
+
|
|
13
|
+
GRANT OF LICENSE: Subject to the terms and conditions of this license and payment
|
|
14
|
+
of applicable fees, 3vilEnterprises grants you a limited, non-exclusive,
|
|
15
|
+
non-transferable license to use the Software.
|
|
16
|
+
|
|
17
|
+
RESTRICTIONS: You may not:
|
|
18
|
+
- Modify, adapt, translate, reverse engineer, decompile, or disassemble the Software
|
|
19
|
+
- Remove or alter any proprietary notices or labels on the Software
|
|
20
|
+
- Distribute, sublicense, lease, rent, loan, or otherwise transfer the Software
|
|
21
|
+
- Use the Software for any unlawful purpose
|
|
22
|
+
|
|
23
|
+
TERMINATION: This license is effective until terminated. Your rights under this
|
|
24
|
+
license will terminate automatically without notice if you fail to comply with
|
|
25
|
+
any term of this license.
|
|
26
|
+
|
|
27
|
+
DISCLAIMER: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
28
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
30
|
+
|
|
31
|
+
LIMITATION OF LIABILITY: IN NO EVENT SHALL 3VILENTERPRISES BE LIABLE FOR ANY
|
|
32
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
33
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
|
34
|
+
OR OTHER DEALINGS IN THE SOFTWARE.
|
|
35
|
+
|
|
36
|
+
For licensing inquiries, please contact: contact@3vil.enterprises
|
|
37
|
+
For more information, visit: https://voodocs.com
|
package/README.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# VooDocs - AI-Native Documentation System
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@voodocs/cli)
|
|
4
|
+
[](https://voodocs.com/terms)
|
|
5
|
+
[](https://voodocs.com/support)
|
|
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.
|
|
8
|
+
|
|
9
|
+
This is the future of software development: **AI documents your code in its native language, VooDocs translates it for humans.**
|
|
10
|
+
|
|
11
|
+
## How It Works
|
|
12
|
+
|
|
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
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### 1. Installation
|
|
24
|
+
|
|
25
|
+
Install the CLI globally using `npm` or `pnpm`:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g @voodocs/cli
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. Initialize Your Project
|
|
32
|
+
|
|
33
|
+
Navigate to your project directory and initialize VooDocs:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
voodocs init
|
|
37
|
+
```
|
|
38
|
+
|
|
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.).
|
|
50
|
+
|
|
51
|
+
### 4. Let AI Document Your Code
|
|
52
|
+
|
|
53
|
+
As you code with your AI assistant, it will automatically add `@voodocs` annotations:
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
/**@voodocs
|
|
57
|
+
module_purpose: "User authentication service with JWT token generation"
|
|
58
|
+
dependencies: [
|
|
59
|
+
"bcrypt: Password hashing",
|
|
60
|
+
"jsonwebtoken: JWT token generation"
|
|
61
|
+
]
|
|
62
|
+
assumptions: [
|
|
63
|
+
"Database connection is established",
|
|
64
|
+
"User model exists with email and password fields"
|
|
65
|
+
]
|
|
66
|
+
security_model: "Passwords hashed with bcrypt, tokens expire in 24h"
|
|
67
|
+
*/
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 5. Generate Documentation
|
|
71
|
+
|
|
72
|
+
Run the generate command to create documentation, tests, and API specs:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Generate everything
|
|
76
|
+
voodocs generate ./src
|
|
77
|
+
|
|
78
|
+
# Generate only documentation
|
|
79
|
+
voodocs generate ./src --docs-only
|
|
80
|
+
|
|
81
|
+
# Generate only tests
|
|
82
|
+
voodocs generate ./src --tests-only
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Core Commands
|
|
86
|
+
|
|
87
|
+
- `voodocs init`: Configure your API key and activate your license
|
|
88
|
+
- `voodocs instruct`: Generate instructions for your AI assistant
|
|
89
|
+
- `voodocs generate <path>`: Generate docs, tests, and API specs from annotations
|
|
90
|
+
- `voodocs status`: Check your current license status and usage
|
|
91
|
+
- `voodocs upgrade`: Get information on upgrading your plan
|
|
92
|
+
|
|
93
|
+
## The DarkArts Language
|
|
94
|
+
|
|
95
|
+
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:
|
|
96
|
+
|
|
97
|
+
- **Mathematical notation**: ∀, ∃, ∈, ⇒, ⇔
|
|
98
|
+
- **Formal logic**: Preconditions, postconditions, invariants
|
|
99
|
+
- **Declarative relationships**: What IS, not what to DO
|
|
100
|
+
- **Conditional reasoning**: Case-based specifications
|
|
101
|
+
|
|
102
|
+
VooDocs then translates this precise, machine-readable format into natural language documentation that humans can easily understand.
|
|
103
|
+
|
|
104
|
+
## Why Voodocs?
|
|
105
|
+
|
|
106
|
+
- **AI-First Workflow**: Designed for modern AI-assisted development. Your AI documents as it codes.
|
|
107
|
+
- **Single Source of Truth**: Code annotations drive docs, tests, and specs - always in sync.
|
|
108
|
+
- **Massive Time Savings**: Eliminate manual documentation work entirely.
|
|
109
|
+
- **Higher Code Quality**: Formal specifications lead to more robust and reliable code.
|
|
110
|
+
- **Precision**: Mathematical notation is unambiguous - no more vague documentation.
|
|
111
|
+
|
|
112
|
+
## Example Annotation
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
/**@voodocs
|
|
116
|
+
preconditions: [
|
|
117
|
+
"user must be authenticated",
|
|
118
|
+
"user must have 'admin' role",
|
|
119
|
+
"Database connection must be active"
|
|
120
|
+
]
|
|
121
|
+
postconditions: [
|
|
122
|
+
"returns true ⇔ user is admin ∧ MFA enabled",
|
|
123
|
+
"returns false ⇔ user lacks admin role ∨ MFA disabled ∨ any error",
|
|
124
|
+
"∀ errors: function returns false (fail-safe behavior)"
|
|
125
|
+
]
|
|
126
|
+
security_implications: [
|
|
127
|
+
"CRITICAL: Gates all admin functionality",
|
|
128
|
+
"Fail-safe design: errors → deny access"
|
|
129
|
+
]
|
|
130
|
+
complexity: "O(1) - Single database query with indexed lookup"
|
|
131
|
+
*/
|
|
132
|
+
export async function isAdmin(userId: string): Promise<boolean> {
|
|
133
|
+
// implementation
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Licensing
|
|
138
|
+
|
|
139
|
+
Voodocs is a commercial product. A valid API key is required to use the software. We offer:
|
|
140
|
+
|
|
141
|
+
- **Free Tier**: For hobbyists and students
|
|
142
|
+
- **Pro Plan**: For professional developers
|
|
143
|
+
- **Enterprise**: For teams and organizations
|
|
144
|
+
|
|
145
|
+
For more details, see our [Pricing Page](https://voodocs.com/pricing).
|
|
146
|
+
|
|
147
|
+
## Support
|
|
148
|
+
|
|
149
|
+
Need help? Visit our [Support Center](https://voodocs.com/support) or email us at [support@voodocs.com](mailto:support@voodocs.com).
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
**DarkArt Intelligence** 🚀
|
package/USAGE.md
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
# VooDocs Usage Guide
|
|
2
|
+
|
|
3
|
+
**Version**: v0.1.0
|
|
4
|
+
|
|
5
|
+
This guide provides a comprehensive overview of VooDocs, its commands, and best practices for using it in your projects.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Quick Start](#quick-start)
|
|
13
|
+
- [CLI Commands](#cli-commands)
|
|
14
|
+
- [init](#init)
|
|
15
|
+
- [instruct](#instruct)
|
|
16
|
+
- [generate](#generate)
|
|
17
|
+
- [status](#status)
|
|
18
|
+
- [watch](#watch)
|
|
19
|
+
- [validate](#validate)
|
|
20
|
+
- [check](#check)
|
|
21
|
+
- [export](#export)
|
|
22
|
+
- [Configuration](#configuration)
|
|
23
|
+
- [Writing Annotations](#writing-annotations)
|
|
24
|
+
- [Annotation Syntax](#annotation-syntax)
|
|
25
|
+
- [Annotation Fields](#annotation-fields)
|
|
26
|
+
- [DarkArts Language](#darkarts-language)
|
|
27
|
+
- [Examples](#examples)
|
|
28
|
+
- [Python Example](#python-example)
|
|
29
|
+
- [TypeScript Example](#typescript-example)
|
|
30
|
+
- [CI/CD Integration](#cicd-integration)
|
|
31
|
+
- [Troubleshooting](#troubleshooting)
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
Install the VooDocs CLI globally using `npm` or `pnpm`:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g @voodocs/cli
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
This will make the `voodocs` command available in your terminal.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
1. **Initialize VooDocs** in your project:
|
|
50
|
+
```bash
|
|
51
|
+
voodocs init
|
|
52
|
+
```
|
|
53
|
+
This will create a `.voodocs/config.json` file.
|
|
54
|
+
|
|
55
|
+
2. **Generate AI Instructions** for your coding assistant:
|
|
56
|
+
```bash
|
|
57
|
+
voodocs instruct
|
|
58
|
+
```
|
|
59
|
+
This creates a `VOODOCS_INSTRUCTIONS.md` file. Provide this to your AI assistant (e.g., add to `.cursorrules`).
|
|
60
|
+
|
|
61
|
+
3. **Start Coding** with `@voodocs` annotations. Your AI assistant will help you write them.
|
|
62
|
+
|
|
63
|
+
4. **Generate Documentation**:
|
|
64
|
+
```bash
|
|
65
|
+
voodocs generate src/
|
|
66
|
+
```
|
|
67
|
+
This will generate docs, tests, and API specs in the `voodocs-output/` directory.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## CLI Commands
|
|
72
|
+
|
|
73
|
+
### `init`
|
|
74
|
+
|
|
75
|
+
Initialize VooDocs in a project. Creates a `.voodocs/config.json` file.
|
|
76
|
+
|
|
77
|
+
**Usage**:
|
|
78
|
+
```bash
|
|
79
|
+
voodocs init [--project-name <name>] [--language <lang>]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Arguments**:
|
|
83
|
+
- `--project-name`: The name of the project (defaults to current directory name).
|
|
84
|
+
- `--language`: The primary language of the project (`python`, `typescript`, `javascript`).
|
|
85
|
+
|
|
86
|
+
If arguments are not provided, `init` will run in interactive mode.
|
|
87
|
+
|
|
88
|
+
### `instruct`
|
|
89
|
+
|
|
90
|
+
Generate AI assistant instructions.
|
|
91
|
+
|
|
92
|
+
**Usage**:
|
|
93
|
+
```bash
|
|
94
|
+
voodocs instruct [--assistant <name>] [--output <file>]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Arguments**:
|
|
98
|
+
- `--assistant`: The AI assistant to generate instructions for (`cursor`, `claude`, `copilot`, `windsurf`, `generic`).
|
|
99
|
+
- `--output`: The output file path (defaults to `.cursorrules`, `.claude/instructions.md`, etc.).
|
|
100
|
+
|
|
101
|
+
### `generate`
|
|
102
|
+
|
|
103
|
+
Generate docs, tests, and API specs from annotations.
|
|
104
|
+
|
|
105
|
+
**Usage**:
|
|
106
|
+
```bash
|
|
107
|
+
voodocs generate <path> [--output <dir>] [--docs-only] [--tests-only] [--api-only] [--verbose]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Arguments**:
|
|
111
|
+
- `<path>`: The path to the source code to process.
|
|
112
|
+
- `--output`: The output directory (defaults to `./voodocs-output`).
|
|
113
|
+
- `--docs-only`: Generate only documentation.
|
|
114
|
+
- `--tests-only`: Generate only tests.
|
|
115
|
+
- `--api-only`: Generate only API specs.
|
|
116
|
+
- `--verbose`: Show detailed output.
|
|
117
|
+
|
|
118
|
+
### `status`
|
|
119
|
+
|
|
120
|
+
Show project status and statistics.
|
|
121
|
+
|
|
122
|
+
**Usage**:
|
|
123
|
+
```bash
|
|
124
|
+
voodocs status [<path>]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Output**:
|
|
128
|
+
- Annotation coverage percentage
|
|
129
|
+
- Quality score (0-100)
|
|
130
|
+
- Breakdown of annotated vs. unannotated functions/classes
|
|
131
|
+
|
|
132
|
+
### `watch`
|
|
133
|
+
|
|
134
|
+
Watch files and automatically regenerate documentation on changes.
|
|
135
|
+
|
|
136
|
+
**Usage**:
|
|
137
|
+
```bash
|
|
138
|
+
voodocs watch <path> [--interval <seconds>]
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Arguments**:
|
|
142
|
+
- `<path>`: The path to watch for changes.
|
|
143
|
+
- `--interval`: The watch interval in seconds (defaults to 2).
|
|
144
|
+
|
|
145
|
+
### `validate`
|
|
146
|
+
|
|
147
|
+
Validate annotation quality and correctness.
|
|
148
|
+
|
|
149
|
+
**Usage**:
|
|
150
|
+
```bash
|
|
151
|
+
voodocs validate <path> [--strict] [--format <fmt>]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Arguments**:
|
|
155
|
+
- `<path>`: The path to validate.
|
|
156
|
+
- `--strict`: Treat warnings as errors.
|
|
157
|
+
- `--format`: Output format (`text` or `json`).
|
|
158
|
+
|
|
159
|
+
### `check`
|
|
160
|
+
|
|
161
|
+
Check annotation coverage and quality (for CI/CD).
|
|
162
|
+
|
|
163
|
+
**Usage**:
|
|
164
|
+
```bash
|
|
165
|
+
voodocs check <path> [--min-coverage <pct>] [--min-quality <pct>]
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Arguments**:
|
|
169
|
+
- `<path>`: The path to check.
|
|
170
|
+
- `--min-coverage`: The minimum required annotation coverage (0-100).
|
|
171
|
+
- `--min-quality`: The minimum required quality score (0-100).
|
|
172
|
+
|
|
173
|
+
Exits with code 1 if checks fail.
|
|
174
|
+
|
|
175
|
+
### `export`
|
|
176
|
+
|
|
177
|
+
Export documentation to different formats.
|
|
178
|
+
|
|
179
|
+
**Usage**:
|
|
180
|
+
```bash
|
|
181
|
+
voodocs export <file> --format <fmt> [--output <file>]
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Arguments**:
|
|
185
|
+
- `<file>`: The Markdown documentation file to export.
|
|
186
|
+
- `--format`: The export format (`html` or `pdf`).
|
|
187
|
+
- `--output`: The output file path.
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Configuration
|
|
192
|
+
|
|
193
|
+
VooDocs is configured via the `.voodocs/config.json` file. The following options are available:
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"project_name": "my-project",
|
|
198
|
+
"language": "python",
|
|
199
|
+
"version": "0.1.0",
|
|
200
|
+
"output_dir": "./voodocs-output",
|
|
201
|
+
"test_framework": "pytest",
|
|
202
|
+
"api_format": "openapi",
|
|
203
|
+
"exclude_patterns": [
|
|
204
|
+
"**/test_*.py",
|
|
205
|
+
"**/node_modules/**"
|
|
206
|
+
],
|
|
207
|
+
"include_patterns": [],
|
|
208
|
+
"annotation_coverage_threshold": 50
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Writing Annotations
|
|
215
|
+
|
|
216
|
+
### Annotation Syntax
|
|
217
|
+
|
|
218
|
+
**Python**:
|
|
219
|
+
```python
|
|
220
|
+
def my_function(x):
|
|
221
|
+
"""
|
|
222
|
+
@voodocs
|
|
223
|
+
preconditions: ["x > 0"]
|
|
224
|
+
postconditions: ["result > 0"]
|
|
225
|
+
"""
|
|
226
|
+
return x + 1
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**TypeScript/JavaScript**:
|
|
230
|
+
```typescript
|
|
231
|
+
/**
|
|
232
|
+
* @voodocs
|
|
233
|
+
* preconditions: ["x > 0"]
|
|
234
|
+
* postconditions: ["result > 0"]
|
|
235
|
+
*/
|
|
236
|
+
function myFunction(x: number): number {
|
|
237
|
+
return x + 1;
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Annotation Fields
|
|
242
|
+
|
|
243
|
+
| Field | Description |
|
|
244
|
+
|---|---|
|
|
245
|
+
| `module_purpose` | High-level purpose of the module. |
|
|
246
|
+
| `dependencies` | Key dependencies of the module. |
|
|
247
|
+
| `assumptions` | Assumptions made by the module. |
|
|
248
|
+
| `preconditions` | Conditions that must be true before a function is called. |
|
|
249
|
+
| `postconditions` | Conditions that must be true after a function returns. |
|
|
250
|
+
| `invariants` | Conditions that must always be true for a class. |
|
|
251
|
+
| `complexity` | Time and space complexity of an algorithm. |
|
|
252
|
+
| `error_cases` | How the function behaves in error scenarios. |
|
|
253
|
+
| `security_model` | Security implications and threat model. |
|
|
254
|
+
| `thread_safety` | Thread safety guarantees. |
|
|
255
|
+
| `state_transitions` | How the state of a class changes. |
|
|
256
|
+
| `examples` | Example usage of the function. |
|
|
257
|
+
|
|
258
|
+
### DarkArts Language
|
|
259
|
+
|
|
260
|
+
The DarkArts language is a formal notation used in annotations. It includes:
|
|
261
|
+
|
|
262
|
+
- **Logical Operators**: `∧` (and), `∨` (or), `¬` (not), `⇒` (implies), `⇔` (if and only if)
|
|
263
|
+
- **Quantifiers**: `∀` (for all), `∃` (there exists)
|
|
264
|
+
- **Set Theory**: `∈` (in), `∉` (not in), `⊂` (subset), `∪` (union), `∩` (intersection)
|
|
265
|
+
- **Mathematical Symbols**: `ℝ` (reals), `ℤ` (integers), `ℕ` (naturals), `∞` (infinity)
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Examples
|
|
270
|
+
|
|
271
|
+
See the `examples/` directory for complete examples in Python and TypeScript.
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## CI/CD Integration
|
|
276
|
+
|
|
277
|
+
Use the `voodocs check` command in your CI/CD pipeline to enforce documentation standards.
|
|
278
|
+
|
|
279
|
+
**GitHub Actions Example**:
|
|
280
|
+
```yaml
|
|
281
|
+
name: VooDocs Check
|
|
282
|
+
|
|
283
|
+
on: [push, pull_request]
|
|
284
|
+
|
|
285
|
+
jobs:
|
|
286
|
+
voodocs-check:
|
|
287
|
+
runs-on: ubuntu-latest
|
|
288
|
+
steps:
|
|
289
|
+
- uses: actions/checkout@v3
|
|
290
|
+
- uses: actions/setup-node@v3
|
|
291
|
+
with:
|
|
292
|
+
node-version: 16
|
|
293
|
+
- run: npm install -g @voodocs/cli
|
|
294
|
+
- run: voodocs check . --min-coverage 80 --min-quality 70
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## Troubleshooting
|
|
300
|
+
|
|
301
|
+
**Problem**: `voodocs: command not found`
|
|
302
|
+
**Solution**: Make sure you have installed the CLI globally (`npm install -g @voodocs/cli`) and that your `npm` global bin directory is in your `PATH`.
|
|
303
|
+
|
|
304
|
+
**Problem**: TypeScript parser not working.
|
|
305
|
+
**Solution**: The TypeScript parser is built automatically on `postinstall`. If it fails, you can build it manually:
|
|
306
|
+
```bash
|
|
307
|
+
# Navigate to the VooDocs installation directory
|
|
308
|
+
cd $(npm root -g)/@voodocs/cli
|
|
309
|
+
|
|
310
|
+
# Build the parser
|
|
311
|
+
npm run build-ts-parser
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
For more help, visit our [support page](https://voodocs.com/support).
|