@voodocs/cli 1.0.4 → 1.0.5
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 +39 -0
- package/lib/cli/__init__.py +1 -1
- package/lib/cli/instruct.py +81 -60
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
+
## v1.0.5 (2024-12-21)
|
|
2
|
+
|
|
3
|
+
### 🐛 Bug Fix: Instruct Command Import Error
|
|
4
|
+
|
|
5
|
+
**Problem:** The `voodocs instruct` command failed with `ModuleNotFoundError: No module named 'darkarts.instruction_generator'` when trying to generate AI instructions.
|
|
6
|
+
|
|
7
|
+
**Root Cause:** The instruct command was trying to import complex modules (`InstructionGenerator`, `AIEnvironment`) that had dependencies issues in the npm package.
|
|
8
|
+
|
|
9
|
+
**Fix:** Simplified the instruct command to directly read template files without complex module dependencies.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
### Changes
|
|
14
|
+
|
|
15
|
+
- Rewrote `lib/cli/instruct.py` to be self-contained
|
|
16
|
+
- Removed dependency on `darkarts.instruction_generator` and `darkarts.ai_detector`
|
|
17
|
+
- Simplified AI environment detection
|
|
18
|
+
- All functionality preserved
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
### Testing
|
|
23
|
+
|
|
24
|
+
| Test Case | Status |
|
|
25
|
+
|-----------|--------|
|
|
26
|
+
| `voodocs instruct --list-templates` | ✅ Pass |
|
|
27
|
+
| `voodocs instruct --ai cursor` | ✅ Pass |
|
|
28
|
+
| `voodocs instruct --ai claude` | ✅ Pass |
|
|
29
|
+
| `voodocs instruct --output .cursorrules` | ✅ Pass |
|
|
30
|
+
| AI auto-detection | ✅ Pass |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
### Upgrade
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install -g @voodocs/cli@1.0.5
|
|
38
|
+
```
|
|
39
|
+
|
|
1
40
|
## v1.0.4 (2024-12-21)
|
|
2
41
|
|
|
3
42
|
### 🐛 Critical Bug Fixes: Documentation Generation
|
package/lib/cli/__init__.py
CHANGED
package/lib/cli/instruct.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""@darkarts
|
|
2
2
|
⊢{cli:instruct}
|
|
3
|
-
∂{click,pathlib,
|
|
3
|
+
∂{click,pathlib,os}
|
|
4
4
|
⚠{write-access:cwd}
|
|
5
5
|
⊨{idempotent:instruction-generation}
|
|
6
6
|
🔒{read-write:filesystem}
|
|
@@ -15,94 +15,115 @@ Generate AI-specific instructions for writing @darkarts annotations.
|
|
|
15
15
|
|
|
16
16
|
import click
|
|
17
17
|
from pathlib import Path
|
|
18
|
-
import
|
|
19
|
-
from pathlib import Path
|
|
20
|
-
|
|
21
|
-
# Add parent directory to path for imports
|
|
22
|
-
parent_dir = Path(__file__).parent.parent
|
|
23
|
-
sys.path.insert(0, str(parent_dir))
|
|
24
|
-
|
|
25
|
-
from darkarts.instruction_generator import InstructionGenerator
|
|
26
|
-
from darkarts.ai_detector import AIEnvironment, detect_ai_environment
|
|
18
|
+
import os
|
|
27
19
|
|
|
28
20
|
|
|
29
21
|
@click.command()
|
|
30
22
|
@click.option(
|
|
31
23
|
'--ai',
|
|
32
|
-
type=click.Choice([
|
|
33
|
-
|
|
34
|
-
help='Specify the AI environment (e.g., cursor, claude, gemini). Auto-detects if not provided.'
|
|
24
|
+
type=click.Choice(['cursor', 'claude', 'default'], case_sensitive=False),
|
|
25
|
+
help='Target AI assistant (auto-detects if not specified)'
|
|
35
26
|
)
|
|
36
27
|
@click.option(
|
|
37
28
|
'--output',
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
help='Output file path
|
|
29
|
+
'-o',
|
|
30
|
+
type=click.Path(),
|
|
31
|
+
help='Output file path (prints to console if not specified)'
|
|
41
32
|
)
|
|
42
33
|
@click.option(
|
|
43
34
|
'--list-templates',
|
|
44
35
|
is_flag=True,
|
|
45
|
-
help='List
|
|
36
|
+
help='List available instruction templates'
|
|
46
37
|
)
|
|
47
38
|
def instruct(ai, output, list_templates):
|
|
48
39
|
"""
|
|
49
|
-
Generate AI instructions for writing
|
|
40
|
+
Generate AI-specific instructions for writing @darkarts annotations.
|
|
50
41
|
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
This command generates tailored instructions for AI assistants to help them
|
|
43
|
+
write correct symbolic DarkArts annotations in your codebase.
|
|
53
44
|
|
|
54
45
|
Examples:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
voodocs instruct
|
|
58
|
-
|
|
46
|
+
|
|
47
|
+
# Auto-detect AI and print instructions
|
|
48
|
+
voodocs instruct
|
|
49
|
+
|
|
50
|
+
# Generate for Cursor and save to .cursorrules
|
|
51
|
+
voodocs instruct --ai cursor --output .cursorrules
|
|
52
|
+
|
|
53
|
+
# Generate for Claude
|
|
54
|
+
voodocs instruct --ai claude
|
|
55
|
+
|
|
56
|
+
# List available templates
|
|
57
|
+
voodocs instruct --list-templates
|
|
59
58
|
"""
|
|
60
|
-
generator = InstructionGenerator()
|
|
61
59
|
|
|
60
|
+
# Get the instructions directory
|
|
61
|
+
cli_dir = Path(__file__).parent
|
|
62
|
+
instructions_dir = cli_dir.parent / 'darkarts' / 'instructions'
|
|
63
|
+
|
|
64
|
+
if not instructions_dir.exists():
|
|
65
|
+
click.secho("Error: Instructions directory not found", fg='red')
|
|
66
|
+
click.echo(f"Expected at: {instructions_dir}")
|
|
67
|
+
return
|
|
68
|
+
|
|
69
|
+
# List templates if requested
|
|
62
70
|
if list_templates:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
click.echo(click.style('Available AI instruction templates:', fg='green', bold=True))
|
|
71
|
+
click.echo("Available instruction templates:")
|
|
72
|
+
click.echo()
|
|
73
|
+
templates = list(instructions_dir.glob('*.md'))
|
|
69
74
|
for template in templates:
|
|
70
|
-
click.echo(f
|
|
75
|
+
click.echo(f" • {template.stem}")
|
|
76
|
+
click.echo()
|
|
77
|
+
click.echo(f"Total: {len(templates)} templates")
|
|
71
78
|
return
|
|
72
79
|
|
|
73
|
-
#
|
|
74
|
-
if ai:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
# Auto-detect AI if not specified
|
|
81
|
+
if not ai:
|
|
82
|
+
ai = _detect_ai_environment()
|
|
83
|
+
if ai:
|
|
84
|
+
click.echo(f"Detected AI environment: {ai}")
|
|
85
|
+
else:
|
|
86
|
+
ai = 'default'
|
|
87
|
+
click.echo("Using default instructions (AI environment not detected)")
|
|
88
|
+
click.echo()
|
|
89
|
+
|
|
90
|
+
# Load the appropriate template
|
|
91
|
+
template_file = instructions_dir / f"{ai}.md"
|
|
92
|
+
|
|
93
|
+
if not template_file.exists():
|
|
94
|
+
click.secho(f"Warning: Template '{ai}.md' not found, using default", fg='yellow')
|
|
95
|
+
template_file = instructions_dir / "default.md"
|
|
96
|
+
|
|
97
|
+
if not template_file.exists():
|
|
98
|
+
click.secho("Error: No instruction templates found", fg='red')
|
|
99
|
+
return
|
|
84
100
|
|
|
85
|
-
#
|
|
86
|
-
|
|
87
|
-
instructions = generator.generate(environment)
|
|
88
|
-
except FileNotFoundError:
|
|
89
|
-
click.echo(click.style(f'Error: No instruction template found for {environment.value}', fg='red'))
|
|
90
|
-
click.echo(f'Defaulting to generic instructions...')
|
|
91
|
-
environment = AIEnvironment.DEFAULT
|
|
92
|
-
instructions = generator.generate(environment)
|
|
101
|
+
# Read the template
|
|
102
|
+
instructions = template_file.read_text(encoding='utf-8')
|
|
93
103
|
|
|
94
|
-
# Output instructions
|
|
104
|
+
# Output the instructions
|
|
95
105
|
if output:
|
|
96
106
|
output_path = Path(output)
|
|
97
|
-
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
98
107
|
output_path.write_text(instructions, encoding='utf-8')
|
|
99
|
-
click.
|
|
108
|
+
click.secho(f"✅ Instructions written to: {output_path}", fg='green')
|
|
109
|
+
click.echo()
|
|
110
|
+
click.echo("Your AI assistant will now write symbolic DarkArts annotations!")
|
|
100
111
|
else:
|
|
101
|
-
click.echo('\n' + '-'*20 + ' AI Instructions ' + '-'*20 + '\n')
|
|
102
112
|
click.echo(instructions)
|
|
103
|
-
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _detect_ai_environment():
|
|
116
|
+
"""Detect which AI environment is being used."""
|
|
117
|
+
# Check for Cursor
|
|
118
|
+
if os.environ.get('CURSOR_USER') or os.path.exists('.cursorrules'):
|
|
119
|
+
return 'cursor'
|
|
120
|
+
|
|
121
|
+
# Check for Claude
|
|
122
|
+
if os.environ.get('CLAUDE_API_KEY') or os.path.exists('.claude'):
|
|
123
|
+
return 'claude'
|
|
124
|
+
|
|
125
|
+
# Check for other AI indicators
|
|
126
|
+
if os.environ.get('OPENAI_API_KEY'):
|
|
127
|
+
return 'default'
|
|
104
128
|
|
|
105
|
-
|
|
106
|
-
click.echo(click.style('Tip: Save these instructions to a .cursorrules file in your project root.', fg='yellow'))
|
|
107
|
-
elif environment == AIEnvironment.CLAUDE and not output:
|
|
108
|
-
click.echo(click.style('Tip: Add these instructions to your Claude project settings.', fg='yellow'))
|
|
129
|
+
return None
|
package/package.json
CHANGED