@el-j/magic-agent-helix 4.0.0-beta.1
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/README.md +319 -0
- package/dist/cli.mjs +1083 -0
- package/dist/cli.mjs.map +1 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# ✨ MagicAgentHelix CLI ✨
|
|
2
|
+
|
|
3
|
+
A powerful CLI tool that inspects your project and generates granular, path-specific AI instructions for agents like GitHub Copilot.
|
|
4
|
+
|
|
5
|
+
## 🚀 Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install globally
|
|
9
|
+
npm install -g @el-j/magic-agent-helix
|
|
10
|
+
|
|
11
|
+
# Or use with npx (no installation required)
|
|
12
|
+
npx @el-j/magic-agent-helix run
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 📦 Installation
|
|
16
|
+
|
|
17
|
+
### Global Installation
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g @el-j/magic-agent-helix
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Project-Specific Installation
|
|
23
|
+
```bash
|
|
24
|
+
npm install --save-dev @el-j/magic-agent-helix
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then add to your `package.json` scripts:
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"scripts": {
|
|
31
|
+
"align": "magic-helix run"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 🎯 Commands
|
|
37
|
+
|
|
38
|
+
### `run` - Generate Instruction Files
|
|
39
|
+
|
|
40
|
+
Scans your project and generates AI instruction files based on detected technologies.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
magic-helix run [options]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Options:**
|
|
47
|
+
- `--dry-run` - Preview what would be generated without writing files
|
|
48
|
+
- `--force` - Overwrite files and prune without prompting
|
|
49
|
+
- `--skip-pruning` - Don't ask to remove old files
|
|
50
|
+
- `--output-dir <path>` - Custom output directory (default: `.github/instructions`)
|
|
51
|
+
- `--config <path>` - Path to custom config file
|
|
52
|
+
- `--verbose` - Show detailed output
|
|
53
|
+
- `--quiet` - Show minimal output
|
|
54
|
+
- `--project <name>` - Target a specific project only
|
|
55
|
+
|
|
56
|
+
**Examples:**
|
|
57
|
+
```bash
|
|
58
|
+
# Basic usage
|
|
59
|
+
magic-helix run
|
|
60
|
+
|
|
61
|
+
# Dry run to see what would be generated
|
|
62
|
+
magic-helix run --dry-run
|
|
63
|
+
|
|
64
|
+
# Generate for specific project only
|
|
65
|
+
magic-helix run --project my-app
|
|
66
|
+
|
|
67
|
+
# Use custom output directory
|
|
68
|
+
magic-helix run --output-dir .ai/instructions
|
|
69
|
+
|
|
70
|
+
# Quiet mode with force overwrite
|
|
71
|
+
magic-helix run --quiet --force
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### `refresh` (alias: `resync`) - Update Instruction Files
|
|
75
|
+
|
|
76
|
+
Rescans your project and updates existing instruction files with new information.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
magic-helix refresh [options]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Options:**
|
|
83
|
+
- `--config <path>` - Path to custom config file
|
|
84
|
+
- `--verbose` - Show detailed output
|
|
85
|
+
- `--quiet` - Show minimal output
|
|
86
|
+
- `--project <name>` - Target a specific project only
|
|
87
|
+
|
|
88
|
+
**Examples:**
|
|
89
|
+
```bash
|
|
90
|
+
# Refresh all instruction files
|
|
91
|
+
magic-helix refresh
|
|
92
|
+
|
|
93
|
+
# Refresh specific project
|
|
94
|
+
magic-helix refresh --project my-app
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### `list` - Show Project Information
|
|
98
|
+
|
|
99
|
+
Lists detected projects, tags, and templates without generating files.
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
magic-helix list
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Example Output:**
|
|
106
|
+
```
|
|
107
|
+
📦 my-app
|
|
108
|
+
Path: packages/my-app
|
|
109
|
+
Tags: framework-vue, style-tailwind, test-vitest, lang-typescript
|
|
110
|
+
Would generate: my-app.vue-core.md, my-app.style-tailwind.md, ...
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### `validate` - Check Instruction Files
|
|
114
|
+
|
|
115
|
+
Validates instruction files for common issues and integrity.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
magic-helix validate
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Checks performed:**
|
|
122
|
+
- Frontmatter presence and structure
|
|
123
|
+
- Required `applyTo` field
|
|
124
|
+
- Content after frontmatter
|
|
125
|
+
- Glob pattern validity
|
|
126
|
+
|
|
127
|
+
### `clean` - Remove Generated Files
|
|
128
|
+
|
|
129
|
+
Removes all generated instruction files with confirmation.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
magic-helix clean
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### `init` - Initialize Custom Configuration
|
|
136
|
+
|
|
137
|
+
Creates a minimal configuration file for extending built-in rules.
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
magic-helix init
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Creates:
|
|
144
|
+
- `magic-helix.config.json` - Configuration file (legacy: `ai-aligner.config.json` still supported)
|
|
145
|
+
- `ai_templates/` - Directory for custom templates
|
|
146
|
+
|
|
147
|
+
## ⚙️ Configuration
|
|
148
|
+
|
|
149
|
+
### Built-in Detection
|
|
150
|
+
|
|
151
|
+
MagicAgentHelix automatically detects:
|
|
152
|
+
|
|
153
|
+
**Frameworks:**
|
|
154
|
+
- Vue.js, React, Angular, NestJS
|
|
155
|
+
|
|
156
|
+
**Styling:**
|
|
157
|
+
- Tailwind CSS, PrimeVue, Material-UI, Quasar
|
|
158
|
+
|
|
159
|
+
**Testing:**
|
|
160
|
+
- Vitest, Jest, Cypress, Playwright
|
|
161
|
+
|
|
162
|
+
**State Management:**
|
|
163
|
+
- RxJS, Pinia, Redux, Zustand
|
|
164
|
+
|
|
165
|
+
**Languages:**
|
|
166
|
+
- TypeScript, JavaScript, Go, Python
|
|
167
|
+
|
|
168
|
+
### Custom Configuration
|
|
169
|
+
|
|
170
|
+
Create `magic-helix.config.json` to extend or override:
|
|
171
|
+
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"target": "github-copilot",
|
|
175
|
+
"templateDirectory": "ai_templates",
|
|
176
|
+
"outputDirectory": ".github/instructions",
|
|
177
|
+
"dependencyTagMap": {
|
|
178
|
+
"my-internal-package": "domain-my-rules"
|
|
179
|
+
},
|
|
180
|
+
"configFileTagMap": {
|
|
181
|
+
"my-custom-config.json": "domain-my-rules"
|
|
182
|
+
},
|
|
183
|
+
"fileGlobTagMap": {
|
|
184
|
+
"src/specific-folder/**/*.ts": "domain-my-rules"
|
|
185
|
+
},
|
|
186
|
+
"tagTemplateMap": {
|
|
187
|
+
"domain-my-rules": [
|
|
188
|
+
{ "template": "my-custom-rule.md", "suffix": "my-rule.md" }
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## 🎨 Custom Templates
|
|
195
|
+
|
|
196
|
+
1. Run `magic-helix init` to create the template directory
|
|
197
|
+
2. Add your custom `.md` files in `ai_templates/`
|
|
198
|
+
3. Reference them in your config's `tagTemplateMap`
|
|
199
|
+
|
|
200
|
+
Template format:
|
|
201
|
+
```markdown
|
|
202
|
+
# My Custom Rule
|
|
203
|
+
|
|
204
|
+
- Follow this pattern
|
|
205
|
+
- Use this convention
|
|
206
|
+
- Avoid that anti-pattern
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## 🔧 VS Code + GitHub Copilot Integration
|
|
210
|
+
|
|
211
|
+
Add to your `.vscode/settings.json`:
|
|
212
|
+
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"github.copilot.advanced": {
|
|
216
|
+
"instructions": ".github/instructions"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
This ensures Copilot always reads your instruction files. Restart VS Code after adding.
|
|
222
|
+
|
|
223
|
+
## 📊 Generated File Format
|
|
224
|
+
|
|
225
|
+
Generated instruction files include frontmatter with precise file targeting:
|
|
226
|
+
|
|
227
|
+
```markdown
|
|
228
|
+
---
|
|
229
|
+
# Auto-generated by ai-aligner for: my-app
|
|
230
|
+
# Source Template: vue/vue-core.md
|
|
231
|
+
# Generated: 2025-10-27T10:30:00.000Z
|
|
232
|
+
applyTo: "packages/my-app/src/**/*.{vue}"
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
# Vue 3 Composition API Guidelines
|
|
236
|
+
|
|
237
|
+
- Use `<script setup>` syntax
|
|
238
|
+
- Prefer Composition API over Options API
|
|
239
|
+
...
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## 🚀 CI/CD Integration
|
|
243
|
+
|
|
244
|
+
### GitHub Actions
|
|
245
|
+
|
|
246
|
+
```yaml
|
|
247
|
+
name: Update AI Instructions
|
|
248
|
+
|
|
249
|
+
on:
|
|
250
|
+
push:
|
|
251
|
+
branches: [main]
|
|
252
|
+
|
|
253
|
+
jobs:
|
|
254
|
+
update-instructions:
|
|
255
|
+
runs-on: ubuntu-latest
|
|
256
|
+
steps:
|
|
257
|
+
- uses: actions/checkout@v3
|
|
258
|
+
- uses: actions/setup-node@v3
|
|
259
|
+
with:
|
|
260
|
+
node-version: '20'
|
|
261
|
+
- run: npx @el-j/magic-agent-helix run --force
|
|
262
|
+
- uses: stefanzweifel/git-auto-commit-action@v4
|
|
263
|
+
with:
|
|
264
|
+
commit_message: "chore: update AI instructions"
|
|
265
|
+
file_pattern: ".github/instructions/*.md"
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## 📚 Examples
|
|
269
|
+
|
|
270
|
+
### Monorepo with Multiple Frameworks
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
# List all detected projects
|
|
274
|
+
magic-helix list
|
|
275
|
+
|
|
276
|
+
# Generate instructions for all projects
|
|
277
|
+
magic-helix run
|
|
278
|
+
|
|
279
|
+
# Update just the frontend project
|
|
280
|
+
magic-helix refresh --project my-frontend
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Single Project
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Generate instructions
|
|
287
|
+
magic-helix run
|
|
288
|
+
|
|
289
|
+
# Validate they're correct
|
|
290
|
+
magic-helix validate
|
|
291
|
+
|
|
292
|
+
# Clean up if needed
|
|
293
|
+
magic-helix clean
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## 🛠️ Troubleshooting
|
|
297
|
+
|
|
298
|
+
### No files generated?
|
|
299
|
+
|
|
300
|
+
Run `magic-helix list` to see if your project is detected and what tags are found.
|
|
301
|
+
|
|
302
|
+
### Wrong file extensions in `applyTo`?
|
|
303
|
+
|
|
304
|
+
The CLI now automatically detects the right extensions based on your project's technologies.
|
|
305
|
+
|
|
306
|
+
### Need to regenerate everything?
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
magic-helix clean
|
|
310
|
+
magic-helix run
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## 📖 More Information
|
|
314
|
+
|
|
315
|
+
See the [monorepo root README.md](../../README.md) for full development and testing instructions.
|
|
316
|
+
|
|
317
|
+
## 📄 License
|
|
318
|
+
|
|
319
|
+
MIT
|