aios-core 2.1.1 → 2.1.3
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/.aios-core/development/tasks/analyze-brownfield.md +456 -0
- package/.aios-core/development/tasks/setup-project-docs.md +444 -0
- package/.aios-core/infrastructure/scripts/documentation-integrity/brownfield-analyzer.js +6 -6
- package/.aios-core/infrastructure/scripts/documentation-integrity/gitignore-generator.js +3 -4
- package/.aios-core/infrastructure/scripts/documentation-integrity/mode-detector.js +3 -3
- package/.aios-core/infrastructure/scripts/llm-routing/install-llm-routing.js +6 -6
- package/.aios-core/infrastructure/scripts/source-tree-guardian/manifest-generator.js +2 -2
- package/.aios-core/infrastructure/scripts/source-tree-guardian/validator.js +1 -1
- package/.claude/rules/mcp-usage.md +54 -0
- package/package.json +1 -1
- package/packages/installer/src/config/templates/env-template.js +176 -56
- package/src/wizard/ide-config-generator.js +48 -0
- package/src/wizard/index.js +2 -2
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
## Execution Modes
|
|
4
|
+
|
|
5
|
+
**Choose your execution mode:**
|
|
6
|
+
|
|
7
|
+
### 1. YOLO Mode - Fast, Autonomous (0-1 prompts)
|
|
8
|
+
- Quick scan with default recommendations
|
|
9
|
+
- Minimal user interaction
|
|
10
|
+
- **Best for:** Initial assessment, quick checks
|
|
11
|
+
|
|
12
|
+
### 2. Interactive Mode - Balanced, Educational (5-10 prompts) **[DEFAULT]**
|
|
13
|
+
- Detailed analysis with explanation
|
|
14
|
+
- User confirmation on recommendations
|
|
15
|
+
- **Best for:** First-time brownfield integration
|
|
16
|
+
|
|
17
|
+
### 3. Pre-Flight Planning - Comprehensive Upfront Planning
|
|
18
|
+
- Full conflict analysis
|
|
19
|
+
- Manual review items prioritized
|
|
20
|
+
- **Best for:** Large existing projects, enterprise codebases
|
|
21
|
+
|
|
22
|
+
**Parameter:** `mode` (optional, default: `interactive`)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Task Definition (AIOS Task Format V1.0)
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
task: analyzeBrownfield()
|
|
30
|
+
responsável: architect (Architect)
|
|
31
|
+
responsavel_type: Agente
|
|
32
|
+
atomic_layer: Analysis
|
|
33
|
+
|
|
34
|
+
**Entrada:**
|
|
35
|
+
- campo: targetDir
|
|
36
|
+
tipo: string
|
|
37
|
+
origem: User Input or cwd
|
|
38
|
+
obrigatório: false
|
|
39
|
+
validação: Valid directory path with existing project
|
|
40
|
+
|
|
41
|
+
- campo: outputFormat
|
|
42
|
+
tipo: string
|
|
43
|
+
origem: User Input
|
|
44
|
+
obrigatório: false
|
|
45
|
+
validação: report|json|summary
|
|
46
|
+
|
|
47
|
+
- campo: executionMode
|
|
48
|
+
tipo: string
|
|
49
|
+
origem: User Input
|
|
50
|
+
obrigatório: false
|
|
51
|
+
validação: yolo|interactive|pre-flight
|
|
52
|
+
|
|
53
|
+
**Saída:**
|
|
54
|
+
- campo: analysis
|
|
55
|
+
tipo: BrownfieldAnalysis
|
|
56
|
+
destino: Memory/Console
|
|
57
|
+
persistido: false
|
|
58
|
+
|
|
59
|
+
- campo: report
|
|
60
|
+
tipo: string
|
|
61
|
+
destino: Console or File
|
|
62
|
+
persistido: optional
|
|
63
|
+
|
|
64
|
+
- campo: recommendations
|
|
65
|
+
tipo: array
|
|
66
|
+
destino: Memory
|
|
67
|
+
persistido: false
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Pre-Conditions
|
|
73
|
+
|
|
74
|
+
**Purpose:** Validate prerequisites BEFORE task execution (blocking)
|
|
75
|
+
|
|
76
|
+
**Checklist:**
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
pre-conditions:
|
|
80
|
+
- [ ] Target directory exists and contains a project
|
|
81
|
+
tipo: pre-condition
|
|
82
|
+
blocker: true
|
|
83
|
+
validação: |
|
|
84
|
+
Check target directory exists and has project markers (package.json, go.mod, etc.)
|
|
85
|
+
error_message: "Pre-condition failed: No project found in target directory"
|
|
86
|
+
|
|
87
|
+
- [ ] Brownfield Analyzer module is available
|
|
88
|
+
tipo: pre-condition
|
|
89
|
+
blocker: true
|
|
90
|
+
validação: |
|
|
91
|
+
Verify .aios-core/infrastructure/scripts/documentation-integrity/brownfield-analyzer.js exists
|
|
92
|
+
error_message: "Pre-condition failed: Brownfield Analyzer module not found"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Post-Conditions
|
|
98
|
+
|
|
99
|
+
**Purpose:** Validate execution success AFTER task completes
|
|
100
|
+
|
|
101
|
+
**Checklist:**
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
post-conditions:
|
|
105
|
+
- [ ] Analysis completed with tech stack detection
|
|
106
|
+
tipo: post-condition
|
|
107
|
+
blocker: true
|
|
108
|
+
validação: |
|
|
109
|
+
Verify analysis.techStack is populated
|
|
110
|
+
error_message: "Post-condition failed: Tech stack detection incomplete"
|
|
111
|
+
|
|
112
|
+
- [ ] Merge strategy determined
|
|
113
|
+
tipo: post-condition
|
|
114
|
+
blocker: true
|
|
115
|
+
validação: |
|
|
116
|
+
Verify analysis.mergeStrategy is set
|
|
117
|
+
error_message: "Post-condition failed: Merge strategy not determined"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Acceptance Criteria
|
|
123
|
+
|
|
124
|
+
**Purpose:** Definitive pass/fail criteria for task completion
|
|
125
|
+
|
|
126
|
+
**Checklist:**
|
|
127
|
+
|
|
128
|
+
```yaml
|
|
129
|
+
acceptance-criteria:
|
|
130
|
+
- [ ] All project markers analyzed
|
|
131
|
+
tipo: acceptance-criterion
|
|
132
|
+
blocker: true
|
|
133
|
+
validação: |
|
|
134
|
+
Assert tech stack, frameworks, standards, workflows analyzed
|
|
135
|
+
error_message: "Acceptance criterion not met: Incomplete analysis"
|
|
136
|
+
|
|
137
|
+
- [ ] Recommendations generated
|
|
138
|
+
tipo: acceptance-criterion
|
|
139
|
+
blocker: true
|
|
140
|
+
validação: |
|
|
141
|
+
Assert analysis.recommendations has at least one item
|
|
142
|
+
error_message: "Acceptance criterion not met: No recommendations generated"
|
|
143
|
+
|
|
144
|
+
- [ ] Conflicts identified if present
|
|
145
|
+
tipo: acceptance-criterion
|
|
146
|
+
blocker: false
|
|
147
|
+
validação: |
|
|
148
|
+
Assert potential conflicts flagged for review
|
|
149
|
+
error_message: "Warning: Conflict detection may be incomplete"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Tools
|
|
155
|
+
|
|
156
|
+
**External/shared resources used by this task:**
|
|
157
|
+
|
|
158
|
+
- **Tool:** brownfield-analyzer
|
|
159
|
+
- **Purpose:** Analyze existing project structure and standards
|
|
160
|
+
- **Source:** .aios-core/infrastructure/scripts/documentation-integrity/brownfield-analyzer.js
|
|
161
|
+
|
|
162
|
+
- **Tool:** mode-detector
|
|
163
|
+
- **Purpose:** Collect project markers for analysis
|
|
164
|
+
- **Source:** .aios-core/infrastructure/scripts/documentation-integrity/mode-detector.js
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Scripts
|
|
169
|
+
|
|
170
|
+
**Agent-specific code for this task:**
|
|
171
|
+
|
|
172
|
+
- **Script:** brownfield-analyzer.js
|
|
173
|
+
- **Purpose:** Core analysis functions
|
|
174
|
+
- **Language:** JavaScript
|
|
175
|
+
- **Location:** .aios-core/infrastructure/scripts/documentation-integrity/brownfield-analyzer.js
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Error Handling
|
|
180
|
+
|
|
181
|
+
**Strategy:** graceful-degradation
|
|
182
|
+
|
|
183
|
+
**Common Errors:**
|
|
184
|
+
|
|
185
|
+
1. **Error:** No Project Markers Found
|
|
186
|
+
- **Cause:** Empty directory or unrecognized project type
|
|
187
|
+
- **Resolution:** Check directory contains project files
|
|
188
|
+
- **Recovery:** Return minimal analysis with recommendations
|
|
189
|
+
|
|
190
|
+
2. **Error:** Config Parse Error
|
|
191
|
+
- **Cause:** Malformed config file (package.json, tsconfig.json, etc.)
|
|
192
|
+
- **Resolution:** Skip problematic file, continue analysis
|
|
193
|
+
- **Recovery:** Log warning, proceed with partial analysis
|
|
194
|
+
|
|
195
|
+
3. **Error:** Permission Denied
|
|
196
|
+
- **Cause:** Cannot read certain directories
|
|
197
|
+
- **Resolution:** Request elevated permissions or skip
|
|
198
|
+
- **Recovery:** Note inaccessible areas in manual review items
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Performance
|
|
203
|
+
|
|
204
|
+
**Expected Metrics:**
|
|
205
|
+
|
|
206
|
+
```yaml
|
|
207
|
+
duration_expected: 30s-2 min (estimated)
|
|
208
|
+
cost_estimated: $0.001-0.002
|
|
209
|
+
token_usage: ~300-1,000 tokens
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Optimization Notes:**
|
|
213
|
+
- File existence checks are fast
|
|
214
|
+
- JSON parsing cached per file
|
|
215
|
+
- Directory structure scan is O(n) for root level
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Metadata
|
|
220
|
+
|
|
221
|
+
```yaml
|
|
222
|
+
story: 6.9
|
|
223
|
+
version: 1.0.0
|
|
224
|
+
dependencies:
|
|
225
|
+
- documentation-integrity module
|
|
226
|
+
tags:
|
|
227
|
+
- analysis
|
|
228
|
+
- brownfield
|
|
229
|
+
- migration
|
|
230
|
+
updated_at: 2025-12-14
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
tools:
|
|
236
|
+
- filesystem # Read project files
|
|
237
|
+
- brownfield-analyzer # Core module for this task
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
# Analyze Brownfield Project
|
|
241
|
+
|
|
242
|
+
## Purpose
|
|
243
|
+
|
|
244
|
+
Analyze an existing project to understand its structure, tech stack, coding standards, and CI/CD workflows before AIOS integration. This task provides recommendations for safe integration and identifies potential conflicts.
|
|
245
|
+
|
|
246
|
+
## Task Instructions
|
|
247
|
+
|
|
248
|
+
### 1. Run Project Analysis
|
|
249
|
+
|
|
250
|
+
Execute the brownfield analyzer on the target project:
|
|
251
|
+
|
|
252
|
+
```javascript
|
|
253
|
+
const { analyzeProject, formatMigrationReport } = require('./.aios-core/infrastructure/scripts/documentation-integrity/brownfield-analyzer');
|
|
254
|
+
|
|
255
|
+
const targetDir = process.cwd(); // or specified directory
|
|
256
|
+
const analysis = analyzeProject(targetDir);
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### 2. Review Analysis Results
|
|
260
|
+
|
|
261
|
+
The analysis returns comprehensive information about the project:
|
|
262
|
+
|
|
263
|
+
**BrownfieldAnalysis Structure:**
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
interface BrownfieldAnalysis {
|
|
267
|
+
// Basic flags
|
|
268
|
+
hasExistingStructure: boolean; // Has src/, lib/, tests/, etc.
|
|
269
|
+
hasExistingWorkflows: boolean; // Has CI/CD configurations
|
|
270
|
+
hasExistingStandards: boolean; // Has linting/formatting configs
|
|
271
|
+
|
|
272
|
+
// Merge strategy
|
|
273
|
+
mergeStrategy: 'parallel' | 'manual'; // Recommended approach
|
|
274
|
+
|
|
275
|
+
// Detected stack
|
|
276
|
+
techStack: string[]; // ['Node.js', 'TypeScript', 'Python', 'Go', 'Rust']
|
|
277
|
+
frameworks: string[]; // ['React', 'Vue', 'Angular', 'Next.js', 'Express', etc.]
|
|
278
|
+
version: string | null; // Project version from package.json
|
|
279
|
+
|
|
280
|
+
// Config paths
|
|
281
|
+
configs: {
|
|
282
|
+
eslint: string | null;
|
|
283
|
+
prettier: string | null;
|
|
284
|
+
tsconfig: string | null;
|
|
285
|
+
flake8: string | null;
|
|
286
|
+
packageJson: string | null;
|
|
287
|
+
requirements: string | null;
|
|
288
|
+
goMod: string | null;
|
|
289
|
+
githubWorkflows: string | null;
|
|
290
|
+
gitlabCi: string | null;
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
// Detected settings
|
|
294
|
+
linting: string; // 'ESLint', 'Flake8', 'none'
|
|
295
|
+
formatting: string; // 'Prettier', 'Black', 'none'
|
|
296
|
+
testing: string; // 'Jest', 'Vitest', 'pytest', 'none'
|
|
297
|
+
|
|
298
|
+
// Integration guidance
|
|
299
|
+
recommendations: string[];
|
|
300
|
+
conflicts: string[];
|
|
301
|
+
manualReviewItems: string[];
|
|
302
|
+
|
|
303
|
+
// Summary
|
|
304
|
+
summary: string;
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### 3. Display Migration Report
|
|
309
|
+
|
|
310
|
+
Show the formatted analysis report:
|
|
311
|
+
|
|
312
|
+
```javascript
|
|
313
|
+
const report = formatMigrationReport(analysis);
|
|
314
|
+
console.log(report);
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
**Sample Report Output:**
|
|
318
|
+
|
|
319
|
+
```
|
|
320
|
+
╔══════════════════════════════════════════════════════════════════════╗
|
|
321
|
+
║ BROWNFIELD ANALYSIS REPORT ║
|
|
322
|
+
╠══════════════════════════════════════════════════════════════════════╣
|
|
323
|
+
║ ║
|
|
324
|
+
║ Tech Stack: Node.js, TypeScript ║
|
|
325
|
+
║ Frameworks: React, Next.js ║
|
|
326
|
+
║ ║
|
|
327
|
+
║ Linting: ESLint ║
|
|
328
|
+
║ Formatting: Prettier ║
|
|
329
|
+
║ Testing: Jest ║
|
|
330
|
+
║ ║
|
|
331
|
+
║ Existing Workflows: Yes ║
|
|
332
|
+
║ Merge Strategy: manual ║
|
|
333
|
+
╠══════════════════════════════════════════════════════════════════════╣
|
|
334
|
+
║ RECOMMENDATIONS ║
|
|
335
|
+
╠══════════════════════════════════════════════════════════════════════╣
|
|
336
|
+
║ ║
|
|
337
|
+
║ • Preserve existing ESLint configuration - AIOS will adapt ║
|
|
338
|
+
║ • Keep existing Prettier settings - AIOS coding-standards.md will d ║
|
|
339
|
+
║ • Review existing CI/CD before adding AIOS workflows ║
|
|
340
|
+
║ • AIOS will use existing tsconfig.json settings ║
|
|
341
|
+
║ • Next.js detected - use pages/ or app/ structure ║
|
|
342
|
+
╠══════════════════════════════════════════════════════════════════════╣
|
|
343
|
+
║ 📋 MANUAL REVIEW REQUIRED ║
|
|
344
|
+
╠══════════════════════════════════════════════════════════════════════╣
|
|
345
|
+
║ ║
|
|
346
|
+
║ • Review 3 existing GitHub workflow(s) for potential conflicts ║
|
|
347
|
+
╚══════════════════════════════════════════════════════════════════════╝
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### 4. Interpret Merge Strategy
|
|
351
|
+
|
|
352
|
+
Based on the analysis, follow the recommended merge strategy:
|
|
353
|
+
|
|
354
|
+
| Strategy | Meaning | Actions |
|
|
355
|
+
|----------|---------|---------|
|
|
356
|
+
| `parallel` | Safe to proceed with standard AIOS setup | Use `*setup-project-docs` directly |
|
|
357
|
+
| `manual` | Existing CI/CD requires careful review | Review workflows, then proceed |
|
|
358
|
+
|
|
359
|
+
### 5. Address Manual Review Items
|
|
360
|
+
|
|
361
|
+
For each item in `analysis.manualReviewItems`:
|
|
362
|
+
|
|
363
|
+
1. **Review GitHub Workflows:**
|
|
364
|
+
```bash
|
|
365
|
+
# List existing workflows
|
|
366
|
+
ls -la .github/workflows/
|
|
367
|
+
|
|
368
|
+
# Check for potential conflicts with AIOS workflows
|
|
369
|
+
# Look for: quality-gate.yml, release.yml, staging.yml
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
2. **Review GitLab CI:**
|
|
373
|
+
```bash
|
|
374
|
+
# Check .gitlab-ci.yml for existing stages
|
|
375
|
+
cat .gitlab-ci.yml | grep -E "^[a-z]+:"
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
3. **Review CircleCI:**
|
|
379
|
+
```bash
|
|
380
|
+
# Check CircleCI config
|
|
381
|
+
cat .circleci/config.yml
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### 6. Handle Conflicts
|
|
385
|
+
|
|
386
|
+
For each item in `analysis.conflicts`:
|
|
387
|
+
|
|
388
|
+
1. **docs/architecture/ exists:**
|
|
389
|
+
- Decide: Keep existing or merge with AIOS docs
|
|
390
|
+
- Option A: Rename existing to `docs/legacy-architecture/`
|
|
391
|
+
- Option B: Configure AIOS to use alternate path
|
|
392
|
+
|
|
393
|
+
2. **Other conflicts:**
|
|
394
|
+
- Document decision in story or task
|
|
395
|
+
- Consider creating backup before integration
|
|
396
|
+
|
|
397
|
+
### 7. Proceed with Integration
|
|
398
|
+
|
|
399
|
+
After analysis and review, proceed based on findings:
|
|
400
|
+
|
|
401
|
+
**If mergeStrategy is 'parallel':**
|
|
402
|
+
```bash
|
|
403
|
+
# Direct integration
|
|
404
|
+
*setup-project-docs
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
**If mergeStrategy is 'manual':**
|
|
408
|
+
```bash
|
|
409
|
+
# First review workflows, then
|
|
410
|
+
*setup-project-docs --merge
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
## Success Criteria
|
|
414
|
+
|
|
415
|
+
- [ ] Tech stack correctly identified
|
|
416
|
+
- [ ] Frameworks detected from dependencies
|
|
417
|
+
- [ ] Existing code standards found
|
|
418
|
+
- [ ] CI/CD workflows catalogued
|
|
419
|
+
- [ ] Merge strategy determined
|
|
420
|
+
- [ ] Recommendations generated
|
|
421
|
+
- [ ] Conflicts identified
|
|
422
|
+
- [ ] Manual review items listed
|
|
423
|
+
|
|
424
|
+
## Output Options
|
|
425
|
+
|
|
426
|
+
**Console Report (default):**
|
|
427
|
+
```bash
|
|
428
|
+
*analyze-brownfield
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
**JSON Output:**
|
|
432
|
+
```bash
|
|
433
|
+
*analyze-brownfield --format json > analysis.json
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
**Summary Only:**
|
|
437
|
+
```bash
|
|
438
|
+
*analyze-brownfield --format summary
|
|
439
|
+
# Output: Tech Stack: Node.js, TypeScript | Frameworks: React | Standards: ESLint/Prettier | CI/CD: Existing workflows detected | Recommended Strategy: manual
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
## Integration with Other Tasks
|
|
443
|
+
|
|
444
|
+
This task is typically followed by:
|
|
445
|
+
|
|
446
|
+
1. **`*setup-project-docs`** - Generate project documentation
|
|
447
|
+
2. **`*document-project`** - Create comprehensive brownfield architecture doc
|
|
448
|
+
3. **`*create-brownfield-story`** - Create enhancement stories for existing projects
|
|
449
|
+
|
|
450
|
+
## Notes
|
|
451
|
+
|
|
452
|
+
- Analysis is read-only; no files are modified
|
|
453
|
+
- Run this task BEFORE any AIOS integration
|
|
454
|
+
- For large projects, analysis may take 1-2 minutes
|
|
455
|
+
- Recommendations are suggestions, not requirements
|
|
456
|
+
- Use manual review items to plan integration work
|