aios-core 3.7.0 → 3.9.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/.aios-core/core/session/context-detector.js +3 -0
- package/.aios-core/core/session/context-loader.js +154 -0
- package/.aios-core/data/learned-patterns.yaml +3 -0
- package/.aios-core/data/workflow-patterns.yaml +347 -3
- package/.aios-core/development/agents/dev.md +6 -0
- package/.aios-core/development/agents/squad-creator.md +30 -0
- package/.aios-core/development/scripts/squad/squad-analyzer.js +638 -0
- package/.aios-core/development/scripts/squad/squad-extender.js +871 -0
- package/.aios-core/development/scripts/squad/squad-generator.js +107 -19
- package/.aios-core/development/scripts/squad/squad-migrator.js +3 -5
- package/.aios-core/development/scripts/squad/squad-validator.js +98 -0
- package/.aios-core/development/tasks/next.md +294 -0
- package/.aios-core/development/tasks/patterns.md +334 -0
- package/.aios-core/development/tasks/squad-creator-analyze.md +315 -0
- package/.aios-core/development/tasks/squad-creator-create.md +26 -3
- package/.aios-core/development/tasks/squad-creator-extend.md +411 -0
- package/.aios-core/development/tasks/squad-creator-validate.md +9 -1
- package/.aios-core/development/tasks/waves.md +205 -0
- package/.aios-core/development/templates/squad/agent-template.md +69 -0
- package/.aios-core/development/templates/squad/checklist-template.md +82 -0
- package/.aios-core/development/templates/squad/data-template.yaml +105 -0
- package/.aios-core/development/templates/squad/script-template.js +179 -0
- package/.aios-core/development/templates/squad/task-template.md +125 -0
- package/.aios-core/development/templates/squad/template-template.md +97 -0
- package/.aios-core/development/templates/squad/tool-template.js +103 -0
- package/.aios-core/development/templates/squad/workflow-template.yaml +108 -0
- package/.aios-core/infrastructure/scripts/test-generator.js +8 -8
- package/.aios-core/infrastructure/scripts/test-quality-assessment.js +5 -5
- package/.aios-core/infrastructure/scripts/test-utilities.js +3 -3
- package/.aios-core/install-manifest.yaml +97 -33
- package/.aios-core/quality/metrics-collector.js +27 -0
- package/.aios-core/scripts/session-context-loader.js +13 -254
- package/.aios-core/scripts/test-template-system.js +6 -6
- package/.aios-core/utils/aios-validator.js +25 -0
- package/.aios-core/workflow-intelligence/__tests__/confidence-scorer.test.js +334 -0
- package/.aios-core/workflow-intelligence/__tests__/integration.test.js +337 -0
- package/.aios-core/workflow-intelligence/__tests__/suggestion-engine.test.js +431 -0
- package/.aios-core/workflow-intelligence/__tests__/wave-analyzer.test.js +458 -0
- package/.aios-core/workflow-intelligence/__tests__/workflow-registry.test.js +302 -0
- package/.aios-core/workflow-intelligence/engine/confidence-scorer.js +305 -0
- package/.aios-core/workflow-intelligence/engine/output-formatter.js +285 -0
- package/.aios-core/workflow-intelligence/engine/suggestion-engine.js +603 -0
- package/.aios-core/workflow-intelligence/engine/wave-analyzer.js +676 -0
- package/.aios-core/workflow-intelligence/index.js +327 -0
- package/.aios-core/workflow-intelligence/learning/capture-hook.js +147 -0
- package/.aios-core/workflow-intelligence/learning/index.js +230 -0
- package/.aios-core/workflow-intelligence/learning/pattern-capture.js +340 -0
- package/.aios-core/workflow-intelligence/learning/pattern-store.js +498 -0
- package/.aios-core/workflow-intelligence/learning/pattern-validator.js +309 -0
- package/.aios-core/workflow-intelligence/registry/workflow-registry.js +358 -0
- package/package.json +1 -1
- package/src/installer/brownfield-upgrader.js +1 -1
- package/bin/aios-init.backup-v1.1.4.js +0 -352
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
# Learned Patterns Management
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
View, manage, and review learned workflow patterns captured by the Workflow Intelligence System (WIS). Patterns are learned from successful workflow executions and boost suggestion confidence.
|
|
6
|
+
|
|
7
|
+
## Task Definition (AIOS Task Format V1.0)
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
task: patterns()
|
|
11
|
+
agent: "@dev"
|
|
12
|
+
responsável: Dex (Developer)
|
|
13
|
+
responsavel_type: Agente
|
|
14
|
+
atomic_layer: Workflow
|
|
15
|
+
|
|
16
|
+
elicit: false
|
|
17
|
+
|
|
18
|
+
inputs:
|
|
19
|
+
- name: subcommand
|
|
20
|
+
type: enum
|
|
21
|
+
required: false
|
|
22
|
+
default: list
|
|
23
|
+
options: [list, stats, prune, review]
|
|
24
|
+
description: Action to perform
|
|
25
|
+
|
|
26
|
+
- name: status
|
|
27
|
+
type: enum
|
|
28
|
+
required: false
|
|
29
|
+
options: [pending, active, promoted, deprecated]
|
|
30
|
+
description: Filter patterns by status
|
|
31
|
+
|
|
32
|
+
- name: limit
|
|
33
|
+
type: number
|
|
34
|
+
required: false
|
|
35
|
+
default: 10
|
|
36
|
+
description: Maximum patterns to display
|
|
37
|
+
|
|
38
|
+
- name: help
|
|
39
|
+
type: flag
|
|
40
|
+
required: false
|
|
41
|
+
default: false
|
|
42
|
+
description: Show usage documentation
|
|
43
|
+
|
|
44
|
+
outputs:
|
|
45
|
+
- name: patterns
|
|
46
|
+
type: array
|
|
47
|
+
destino: Console
|
|
48
|
+
persistido: false
|
|
49
|
+
|
|
50
|
+
- name: stats
|
|
51
|
+
type: object
|
|
52
|
+
destino: Console
|
|
53
|
+
persistido: false
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Pre-Conditions
|
|
59
|
+
|
|
60
|
+
```yaml
|
|
61
|
+
pre-conditions:
|
|
62
|
+
- [ ] Learning module is available
|
|
63
|
+
tipo: pre-condition
|
|
64
|
+
blocker: true
|
|
65
|
+
validação: Check workflow-intelligence/learning module loads
|
|
66
|
+
error_message: "Pattern learning module not available."
|
|
67
|
+
|
|
68
|
+
- [ ] Pattern storage exists
|
|
69
|
+
tipo: pre-condition
|
|
70
|
+
blocker: false
|
|
71
|
+
validação: Check .aios-core/data/learned-patterns.yaml exists
|
|
72
|
+
error_message: "No patterns stored yet."
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Implementation Steps
|
|
78
|
+
|
|
79
|
+
### Step 1: Check Help Flag
|
|
80
|
+
```javascript
|
|
81
|
+
if (args.help) {
|
|
82
|
+
displayHelp();
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Step 2: Load Learning Module
|
|
88
|
+
```javascript
|
|
89
|
+
const learning = require('.aios-core/workflow-intelligence/learning');
|
|
90
|
+
const store = learning.getDefaultStore();
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Step 3: Execute Subcommand
|
|
94
|
+
|
|
95
|
+
#### List Patterns
|
|
96
|
+
```javascript
|
|
97
|
+
if (args.subcommand === 'list' || !args.subcommand) {
|
|
98
|
+
const data = store.load();
|
|
99
|
+
let patterns = data.patterns;
|
|
100
|
+
|
|
101
|
+
// Filter by status if provided
|
|
102
|
+
if (args.status) {
|
|
103
|
+
patterns = patterns.filter(p => p.status === args.status);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Sort by occurrences (descending)
|
|
107
|
+
patterns.sort((a, b) => (b.occurrences || 1) - (a.occurrences || 1));
|
|
108
|
+
|
|
109
|
+
// Limit results
|
|
110
|
+
patterns = patterns.slice(0, args.limit || 10);
|
|
111
|
+
|
|
112
|
+
displayPatternList(patterns);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### Show Stats
|
|
117
|
+
```javascript
|
|
118
|
+
if (args.subcommand === 'stats') {
|
|
119
|
+
const stats = store.getStats();
|
|
120
|
+
displayStats(stats);
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### Prune Patterns
|
|
125
|
+
```javascript
|
|
126
|
+
if (args.subcommand === 'prune') {
|
|
127
|
+
const result = store.prune();
|
|
128
|
+
console.log(`✓ Pruned ${result.pruned} patterns. ${result.remaining} remaining.`);
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### Review Patterns
|
|
133
|
+
```javascript
|
|
134
|
+
if (args.subcommand === 'review') {
|
|
135
|
+
const pendingPatterns = store.getByStatus('pending');
|
|
136
|
+
|
|
137
|
+
if (pendingPatterns.length === 0) {
|
|
138
|
+
console.log('No patterns pending review.');
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Interactive review (uses elicitation)
|
|
143
|
+
for (const pattern of pendingPatterns) {
|
|
144
|
+
const action = await promptReviewAction(pattern);
|
|
145
|
+
if (action === 'quit') break;
|
|
146
|
+
|
|
147
|
+
store.updateStatus(pattern.id, action === 'promote' ? 'active' : action);
|
|
148
|
+
console.log(`✓ Pattern ${action}d.`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Help Text
|
|
156
|
+
|
|
157
|
+
```text
|
|
158
|
+
Usage: *patterns [subcommand] [options]
|
|
159
|
+
|
|
160
|
+
Manage learned workflow patterns.
|
|
161
|
+
|
|
162
|
+
Subcommands:
|
|
163
|
+
list List all learned patterns (default)
|
|
164
|
+
stats Show pattern statistics
|
|
165
|
+
prune Remove stale/low-value patterns
|
|
166
|
+
review Interactive review of pending patterns
|
|
167
|
+
|
|
168
|
+
Options:
|
|
169
|
+
--status <status> Filter by status (pending, active, promoted, deprecated)
|
|
170
|
+
--limit <n> Limit results (default: 10)
|
|
171
|
+
--help Show this help message
|
|
172
|
+
|
|
173
|
+
Examples:
|
|
174
|
+
*patterns # List top 10 patterns
|
|
175
|
+
*patterns list --status active # List active patterns only
|
|
176
|
+
*patterns stats # Show statistics
|
|
177
|
+
*patterns prune # Remove stale patterns
|
|
178
|
+
*patterns review # Review pending patterns
|
|
179
|
+
|
|
180
|
+
Pattern Lifecycle:
|
|
181
|
+
1. pending - Newly captured, awaiting review
|
|
182
|
+
2. active - Validated, used in suggestions
|
|
183
|
+
3. promoted - High-value, prioritized in suggestions
|
|
184
|
+
4. deprecated - Marked for removal
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Output Formats
|
|
190
|
+
|
|
191
|
+
### List Output
|
|
192
|
+
```text
|
|
193
|
+
Learned Patterns (15 total)
|
|
194
|
+
═══════════════════════════
|
|
195
|
+
|
|
196
|
+
Top Patterns by Occurrence:
|
|
197
|
+
1. validate-story-draft → develop → review-qa
|
|
198
|
+
Occurrences: 12 | Success: 95% | Status: promoted
|
|
199
|
+
Workflow: story_development | Last seen: 2h ago
|
|
200
|
+
|
|
201
|
+
2. develop → review-qa → apply-qa-fixes
|
|
202
|
+
Occurrences: 8 | Success: 88% | Status: active
|
|
203
|
+
Workflow: story_development | Last seen: 1d ago
|
|
204
|
+
|
|
205
|
+
3. create-story → validate-story-draft → develop
|
|
206
|
+
Occurrences: 6 | Success: 100% | Status: active
|
|
207
|
+
Workflow: story_creation | Last seen: 3d ago
|
|
208
|
+
|
|
209
|
+
Showing 3 of 15 patterns. Use --limit to see more.
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Stats Output
|
|
213
|
+
```text
|
|
214
|
+
Pattern Learning Statistics
|
|
215
|
+
═══════════════════════════
|
|
216
|
+
|
|
217
|
+
Storage:
|
|
218
|
+
Total patterns: 15
|
|
219
|
+
Max patterns: 100
|
|
220
|
+
Utilization: 15%
|
|
221
|
+
|
|
222
|
+
By Status:
|
|
223
|
+
Pending: 3
|
|
224
|
+
Active: 9
|
|
225
|
+
Promoted: 2
|
|
226
|
+
Deprecated: 1
|
|
227
|
+
|
|
228
|
+
Quality:
|
|
229
|
+
Avg success rate: 92%
|
|
230
|
+
Total occurrences: 45
|
|
231
|
+
|
|
232
|
+
Storage file: .aios-core/data/learned-patterns.yaml
|
|
233
|
+
Last updated: 2025-12-26T10:30:00Z
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Review Output
|
|
237
|
+
```text
|
|
238
|
+
*patterns review
|
|
239
|
+
|
|
240
|
+
Patterns Pending Review (3)
|
|
241
|
+
═══════════════════════════
|
|
242
|
+
|
|
243
|
+
Pattern #1: develop → run-tests → review-qa
|
|
244
|
+
Occurrences: 4 | Success Rate: 100% | First Seen: 2 days ago
|
|
245
|
+
[P]romote [S]kip [D]eprecate [Q]uit
|
|
246
|
+
|
|
247
|
+
> p
|
|
248
|
+
|
|
249
|
+
✓ Pattern promoted to active status
|
|
250
|
+
|
|
251
|
+
Pattern #2: create-story → develop
|
|
252
|
+
Occurrences: 2 | Success Rate: 50% | First Seen: 5 days ago
|
|
253
|
+
[P]romote [S]kip [D]eprecate [Q]uit
|
|
254
|
+
|
|
255
|
+
> d
|
|
256
|
+
|
|
257
|
+
✓ Pattern deprecated
|
|
258
|
+
|
|
259
|
+
Review complete. 1 promoted, 0 skipped, 1 deprecated.
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Post-Conditions
|
|
265
|
+
|
|
266
|
+
```yaml
|
|
267
|
+
post-conditions:
|
|
268
|
+
- [ ] Output displayed correctly
|
|
269
|
+
tipo: post-condition
|
|
270
|
+
blocker: false
|
|
271
|
+
validação: Verify console output matches expected format
|
|
272
|
+
|
|
273
|
+
- [ ] Storage updated for prune/review
|
|
274
|
+
tipo: post-condition
|
|
275
|
+
blocker: true
|
|
276
|
+
validação: Check learned-patterns.yaml was modified
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Error Handling
|
|
282
|
+
|
|
283
|
+
| Error | Cause | Resolution |
|
|
284
|
+
|-------|-------|------------|
|
|
285
|
+
| Learning module not found | Missing dependency | Show error message |
|
|
286
|
+
| Storage file corrupt | Invalid YAML | Reset to empty, show warning |
|
|
287
|
+
| No patterns found | Empty storage | Show "no patterns" message |
|
|
288
|
+
| Review cancelled | User quit | Save any changes made |
|
|
289
|
+
|
|
290
|
+
**Error Recovery Strategy:**
|
|
291
|
+
```javascript
|
|
292
|
+
try {
|
|
293
|
+
const stats = store.getStats();
|
|
294
|
+
displayStats(stats);
|
|
295
|
+
} catch (error) {
|
|
296
|
+
console.error(`⚠️ Error reading patterns: ${error.message}`);
|
|
297
|
+
console.log('Try running: rm .aios-core/data/learned-patterns.yaml');
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## Performance
|
|
304
|
+
|
|
305
|
+
```yaml
|
|
306
|
+
duration_expected: <50ms
|
|
307
|
+
cost_estimated: $0.00 (local file only)
|
|
308
|
+
token_usage: 0
|
|
309
|
+
|
|
310
|
+
optimizations:
|
|
311
|
+
- Cached pattern loading (5s TTL)
|
|
312
|
+
- Lazy parsing of YAML
|
|
313
|
+
- Streamed display for large lists
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Metadata
|
|
319
|
+
|
|
320
|
+
```yaml
|
|
321
|
+
story: WIS-5
|
|
322
|
+
version: 1.0.0
|
|
323
|
+
created: 2025-12-26
|
|
324
|
+
author: "@dev (Dex)"
|
|
325
|
+
dependencies:
|
|
326
|
+
modules:
|
|
327
|
+
- workflow-intelligence/learning
|
|
328
|
+
tasks: []
|
|
329
|
+
tags:
|
|
330
|
+
- workflow-intelligence
|
|
331
|
+
- patterns
|
|
332
|
+
- learning
|
|
333
|
+
- management
|
|
334
|
+
```
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
---
|
|
2
|
+
task: analyzeSquad()
|
|
3
|
+
responsavel: "@squad-creator"
|
|
4
|
+
responsavel_type: Agent
|
|
5
|
+
atomic_layer: Task
|
|
6
|
+
elicit: true
|
|
7
|
+
|
|
8
|
+
Entrada:
|
|
9
|
+
- campo: squad_name
|
|
10
|
+
tipo: string
|
|
11
|
+
origem: User Input
|
|
12
|
+
obrigatorio: true
|
|
13
|
+
validacao: Squad must exist in ./squads/ directory
|
|
14
|
+
|
|
15
|
+
- campo: output_format
|
|
16
|
+
tipo: string
|
|
17
|
+
origem: User Input
|
|
18
|
+
obrigatorio: false
|
|
19
|
+
validacao: "console | markdown | json (default: console)"
|
|
20
|
+
|
|
21
|
+
- campo: verbose
|
|
22
|
+
tipo: boolean
|
|
23
|
+
origem: User Input
|
|
24
|
+
obrigatorio: false
|
|
25
|
+
validacao: "Include file details (default: false)"
|
|
26
|
+
|
|
27
|
+
- campo: suggestions
|
|
28
|
+
tipo: boolean
|
|
29
|
+
origem: User Input
|
|
30
|
+
obrigatorio: false
|
|
31
|
+
validacao: "Include improvement suggestions (default: true)"
|
|
32
|
+
|
|
33
|
+
Saida:
|
|
34
|
+
- campo: analysis_report
|
|
35
|
+
tipo: object
|
|
36
|
+
destino: Console or file
|
|
37
|
+
persistido: false
|
|
38
|
+
|
|
39
|
+
- campo: component_inventory
|
|
40
|
+
tipo: object
|
|
41
|
+
destino: Return value
|
|
42
|
+
persistido: false
|
|
43
|
+
|
|
44
|
+
- campo: coverage_metrics
|
|
45
|
+
tipo: object
|
|
46
|
+
destino: Return value
|
|
47
|
+
persistido: false
|
|
48
|
+
|
|
49
|
+
- campo: suggestions
|
|
50
|
+
tipo: array
|
|
51
|
+
destino: Return value
|
|
52
|
+
persistido: false
|
|
53
|
+
|
|
54
|
+
Checklist:
|
|
55
|
+
- "[ ] Validate squad exists"
|
|
56
|
+
- "[ ] Load squad.yaml manifest"
|
|
57
|
+
- "[ ] Inventory components by type"
|
|
58
|
+
- "[ ] Calculate coverage metrics"
|
|
59
|
+
- "[ ] Generate improvement suggestions"
|
|
60
|
+
- "[ ] Format and display report"
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
# Analyze Squad Task
|
|
64
|
+
|
|
65
|
+
## Purpose
|
|
66
|
+
|
|
67
|
+
Analyze an existing squad's structure, components, and coverage to provide insights and improvement suggestions. This task enables developers to understand what a squad contains and identify opportunities for enhancement.
|
|
68
|
+
|
|
69
|
+
## Story Reference
|
|
70
|
+
|
|
71
|
+
- **Story:** SQS-11 - Squad Analyze & Extend
|
|
72
|
+
- **Epic:** SQS - Squad System Enhancement
|
|
73
|
+
|
|
74
|
+
## Pre-Conditions
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
pre-conditions:
|
|
78
|
+
- [ ] Squad exists in ./squads/ directory
|
|
79
|
+
tipo: pre-condition
|
|
80
|
+
blocker: true
|
|
81
|
+
validacao: |
|
|
82
|
+
Check if squad directory exists with valid manifest
|
|
83
|
+
error_message: "Squad not found. Use *list-squads to see available squads."
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Elicitation Flow
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
@squad-creator
|
|
90
|
+
|
|
91
|
+
*analyze-squad
|
|
92
|
+
|
|
93
|
+
? Squad name: _________________
|
|
94
|
+
(Tab to autocomplete from available squads)
|
|
95
|
+
|
|
96
|
+
? Output format:
|
|
97
|
+
> 1. console (default) - Display in terminal
|
|
98
|
+
2. markdown - Save to file
|
|
99
|
+
3. json - Machine readable
|
|
100
|
+
|
|
101
|
+
? Include suggestions? (Y/n): Y
|
|
102
|
+
|
|
103
|
+
Analyzing squad...
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Execution Steps
|
|
107
|
+
|
|
108
|
+
### Step 1: Validate Squad Exists
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
const { SquadLoader } = require('../scripts/squad/squad-loader');
|
|
112
|
+
const loader = new SquadLoader();
|
|
113
|
+
|
|
114
|
+
const squadPath = path.join('./squads', squadName);
|
|
115
|
+
const exists = await loader.squadExists(squadName);
|
|
116
|
+
|
|
117
|
+
if (!exists) {
|
|
118
|
+
throw new Error(`Squad "${squadName}" not found. Use *list-squads to see available squads.`);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Step 2: Load Squad Manifest
|
|
123
|
+
|
|
124
|
+
```javascript
|
|
125
|
+
const manifest = await loader.loadManifest(squadName);
|
|
126
|
+
|
|
127
|
+
// Extract overview
|
|
128
|
+
const overview = {
|
|
129
|
+
name: manifest.name,
|
|
130
|
+
version: manifest.version,
|
|
131
|
+
author: manifest.author,
|
|
132
|
+
license: manifest.license,
|
|
133
|
+
aiosMinVersion: manifest.aios?.minVersion || 'N/A',
|
|
134
|
+
description: manifest.description
|
|
135
|
+
};
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Step 3: Inventory Components
|
|
139
|
+
|
|
140
|
+
```javascript
|
|
141
|
+
const { SquadAnalyzer } = require('../scripts/squad/squad-analyzer');
|
|
142
|
+
const analyzer = new SquadAnalyzer();
|
|
143
|
+
|
|
144
|
+
const inventory = await analyzer.inventoryComponents(squadPath);
|
|
145
|
+
|
|
146
|
+
// Expected structure:
|
|
147
|
+
// {
|
|
148
|
+
// agents: ['lead-agent.md', 'helper-agent.md'],
|
|
149
|
+
// tasks: ['lead-agent-task1.md', 'lead-agent-task2.md'],
|
|
150
|
+
// workflows: [],
|
|
151
|
+
// checklists: [],
|
|
152
|
+
// templates: ['report-template.md'],
|
|
153
|
+
// tools: [],
|
|
154
|
+
// scripts: [],
|
|
155
|
+
// data: []
|
|
156
|
+
// }
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Step 4: Calculate Coverage Metrics
|
|
160
|
+
|
|
161
|
+
```javascript
|
|
162
|
+
const coverage = analyzer.calculateCoverage(inventory, manifest);
|
|
163
|
+
|
|
164
|
+
// Expected structure:
|
|
165
|
+
// {
|
|
166
|
+
// agents: { total: 2, withTasks: 2, percentage: 100 },
|
|
167
|
+
// tasks: { total: 3, percentage: 75 },
|
|
168
|
+
// config: { hasReadme: true, hasTechStack: false, percentage: 60 },
|
|
169
|
+
// directories: { populated: 3, empty: 5, percentage: 37.5 }
|
|
170
|
+
// }
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Step 5: Generate Suggestions
|
|
174
|
+
|
|
175
|
+
```javascript
|
|
176
|
+
const suggestions = analyzer.generateSuggestions(inventory, coverage);
|
|
177
|
+
|
|
178
|
+
// Expected structure:
|
|
179
|
+
// [
|
|
180
|
+
// { priority: 'high', message: 'Add tasks for helper-agent (currently has only 1)' },
|
|
181
|
+
// { priority: 'medium', message: 'Create workflows for common sequences' },
|
|
182
|
+
// { priority: 'low', message: 'Add checklists for validation' }
|
|
183
|
+
// ]
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Step 6: Format and Display Report
|
|
187
|
+
|
|
188
|
+
```javascript
|
|
189
|
+
const report = analyzer.formatReport({
|
|
190
|
+
overview,
|
|
191
|
+
inventory,
|
|
192
|
+
coverage,
|
|
193
|
+
suggestions
|
|
194
|
+
}, outputFormat);
|
|
195
|
+
|
|
196
|
+
if (outputFormat === 'console') {
|
|
197
|
+
console.log(report);
|
|
198
|
+
} else if (outputFormat === 'markdown') {
|
|
199
|
+
const outputPath = path.join(squadPath, 'ANALYSIS.md');
|
|
200
|
+
await fs.writeFile(outputPath, report);
|
|
201
|
+
console.log(`Analysis saved to: ${outputPath}`);
|
|
202
|
+
} else if (outputFormat === 'json') {
|
|
203
|
+
console.log(JSON.stringify({ overview, inventory, coverage, suggestions }, null, 2));
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Output Format (Console)
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
=== Squad Analysis: {squad-name} ===
|
|
211
|
+
|
|
212
|
+
Overview
|
|
213
|
+
Name: {name}
|
|
214
|
+
Version: {version}
|
|
215
|
+
Author: {author}
|
|
216
|
+
License: {license}
|
|
217
|
+
AIOS Min Version: {aiosMinVersion}
|
|
218
|
+
|
|
219
|
+
Components
|
|
220
|
+
Agents ({count})
|
|
221
|
+
{agent-file-1}
|
|
222
|
+
{agent-file-2}
|
|
223
|
+
Tasks ({count})
|
|
224
|
+
{task-file-1}
|
|
225
|
+
{task-file-2}
|
|
226
|
+
Workflows ({count}) {empty-indicator}
|
|
227
|
+
Checklists ({count}) {empty-indicator}
|
|
228
|
+
Templates ({count})
|
|
229
|
+
Tools ({count}) {empty-indicator}
|
|
230
|
+
Scripts ({count}) {empty-indicator}
|
|
231
|
+
Data ({count}) {empty-indicator}
|
|
232
|
+
|
|
233
|
+
Coverage
|
|
234
|
+
Agents: {bar} {percentage}% ({details})
|
|
235
|
+
Tasks: {bar} {percentage}% ({details})
|
|
236
|
+
Config: {bar} {percentage}% ({details})
|
|
237
|
+
Docs: {bar} {percentage}% ({details})
|
|
238
|
+
|
|
239
|
+
Suggestions
|
|
240
|
+
1. {suggestion-1}
|
|
241
|
+
2. {suggestion-2}
|
|
242
|
+
3. {suggestion-3}
|
|
243
|
+
|
|
244
|
+
Next: *extend-squad {squad-name}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Error Handling
|
|
248
|
+
|
|
249
|
+
### Error 1: Squad Not Found
|
|
250
|
+
|
|
251
|
+
```yaml
|
|
252
|
+
error: SQUAD_NOT_FOUND
|
|
253
|
+
cause: Squad directory does not exist
|
|
254
|
+
resolution: Use *list-squads to see available squads
|
|
255
|
+
recovery: Suggest *create-squad to create new squad
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Error 2: Invalid Manifest
|
|
259
|
+
|
|
260
|
+
```yaml
|
|
261
|
+
error: MANIFEST_PARSE_ERROR
|
|
262
|
+
cause: squad.yaml contains invalid YAML
|
|
263
|
+
resolution: Fix YAML syntax errors
|
|
264
|
+
recovery: Run *validate-squad for detailed validation
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Error 3: Permission Denied
|
|
268
|
+
|
|
269
|
+
```yaml
|
|
270
|
+
error: PERMISSION_DENIED
|
|
271
|
+
cause: Cannot read squad directory or files
|
|
272
|
+
resolution: Check file permissions
|
|
273
|
+
recovery: chmod 644 for files, 755 for directories
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Post-Conditions
|
|
277
|
+
|
|
278
|
+
```yaml
|
|
279
|
+
post-conditions:
|
|
280
|
+
- [ ] Analysis report generated successfully
|
|
281
|
+
tipo: post-condition
|
|
282
|
+
blocker: false
|
|
283
|
+
validacao: |
|
|
284
|
+
Verify all components were inventoried
|
|
285
|
+
error_message: "Analysis incomplete - some components may not be listed"
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Dependencies
|
|
289
|
+
|
|
290
|
+
- **Scripts:**
|
|
291
|
+
- `.aios-core/development/scripts/squad/squad-loader.js`
|
|
292
|
+
- `.aios-core/development/scripts/squad/squad-analyzer.js`
|
|
293
|
+
|
|
294
|
+
- **Tools:**
|
|
295
|
+
- js-yaml (YAML parsing)
|
|
296
|
+
- fs (file system operations)
|
|
297
|
+
|
|
298
|
+
## Metadata
|
|
299
|
+
|
|
300
|
+
```yaml
|
|
301
|
+
story: SQS-11
|
|
302
|
+
version: 1.0.0
|
|
303
|
+
created: 2025-12-26
|
|
304
|
+
updated: 2025-12-26
|
|
305
|
+
author: Dex (dev)
|
|
306
|
+
tags:
|
|
307
|
+
- squad
|
|
308
|
+
- analysis
|
|
309
|
+
- inventory
|
|
310
|
+
- coverage
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
*Task definition for *analyze-squad command*
|
|
@@ -92,6 +92,28 @@ Cria um novo squad seguindo a arquitetura task-first do AIOS.
|
|
|
92
92
|
|
|
93
93
|
## Estrutura Gerada
|
|
94
94
|
|
|
95
|
+
### Com Project Configs (SQS-10)
|
|
96
|
+
|
|
97
|
+
Quando o projeto tem `docs/framework/` com arquivos de config (CODING-STANDARDS.md, etc.),
|
|
98
|
+
o squad referencia esses arquivos ao invés de criar cópias locais:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
./squads/meu-dominio-squad/
|
|
102
|
+
├── squad.yaml # Manifest (referencia docs/framework/)
|
|
103
|
+
├── README.md # Documentacao
|
|
104
|
+
├── config/
|
|
105
|
+
│ └── .gitkeep # Configs em docs/framework/
|
|
106
|
+
├── agents/
|
|
107
|
+
│ └── example-agent.md # Agente de exemplo
|
|
108
|
+
├── tasks/
|
|
109
|
+
│ └── example-agent-task.md # Task de exemplo
|
|
110
|
+
...
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Sem Project Configs (Fallback)
|
|
114
|
+
|
|
115
|
+
Quando o projeto NÃO tem `docs/framework/`, cria arquivos locais:
|
|
116
|
+
|
|
95
117
|
```
|
|
96
118
|
./squads/meu-dominio-squad/
|
|
97
119
|
├── squad.yaml # Manifest
|
|
@@ -145,9 +167,10 @@ components:
|
|
|
145
167
|
|
|
146
168
|
config:
|
|
147
169
|
extends: extend
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
170
|
+
# SQS-10: References project-level files when docs/framework/ exists
|
|
171
|
+
coding-standards: ../../docs/framework/CODING-STANDARDS.md # or config/coding-standards.md
|
|
172
|
+
tech-stack: ../../docs/framework/TECH-STACK.md # or config/tech-stack.md
|
|
173
|
+
source-tree: ../../docs/framework/SOURCE-TREE.md # or config/source-tree.md
|
|
151
174
|
|
|
152
175
|
dependencies:
|
|
153
176
|
node: []
|