aios-core 3.5.0 → 3.7.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.
@@ -157,6 +157,7 @@ commands:
157
157
  - document-project: Generate project documentation
158
158
  - execute-checklist {checklist}: Run architecture checklist
159
159
  - research {topic}: Generate deep research prompt
160
+ - analyze-project-structure: Analyze project for new feature implementation (WIS-15)
160
161
 
161
162
  # Document Operations
162
163
  - doc-out: Output complete document
@@ -169,6 +170,7 @@ commands:
169
170
  - exit: Exit architect mode
170
171
  dependencies:
171
172
  tasks:
173
+ - analyze-project-structure.md
172
174
  - architect-analyze-impact.md
173
175
  - collaborative-edit.md
174
176
  - create-deep-research-prompt.md
@@ -299,6 +301,7 @@ dependencies:
299
301
  - `*create-front-end-architecture` - Frontend architecture
300
302
 
301
303
  **Documentation & Analysis:**
304
+ - `*analyze-project-structure` - Analyze project for new feature (WIS-15)
302
305
  - `*document-project` - Generate project docs
303
306
  - `*research {topic}` - Deep research prompt
304
307
 
@@ -331,6 +334,7 @@ Type `*help` to see all commands, or `*yolo` to skip confirmations.
331
334
  - Creating frontend/backend architecture docs
332
335
  - Making technology stack decisions
333
336
  - Brownfield architecture analysis
337
+ - Analyzing project structure for new feature implementation
334
338
 
335
339
  ### Prerequisites
336
340
  1. PRD from @pm with system requirements
@@ -105,6 +105,11 @@ commands:
105
105
  visibility: [full]
106
106
  description: "Planning mode before implementation"
107
107
 
108
+ # Service Generation (WIS-11)
109
+ - name: create-service
110
+ visibility: [full, quick]
111
+ description: "Create new service from Handlebars template (api-integration, utility, agent-tool)"
112
+
108
113
  # Quality & Debt
109
114
  - name: apply-qa-fixes
110
115
  visibility: [quick, key]
@@ -152,6 +157,7 @@ dependencies:
152
157
  - story-dod-checklist.md
153
158
  tasks:
154
159
  - apply-qa-fixes.md
160
+ - create-service.md # WIS-11: Service scaffolding from templates
155
161
  - dev-develop-story.md
156
162
  - execute-checklist.md
157
163
  - dev-improve-code-quality.md
@@ -322,6 +328,7 @@ dependencies:
322
328
  **Story Development:**
323
329
  - `*develop {story-id}` - Implement story tasks
324
330
  - `*run-tests` - Execute linting and tests
331
+ - `*create-service` - Scaffold new service from template
325
332
 
326
333
  **Quality & Debt:**
327
334
  - `*apply-qa-fixes` - Apply QA fixes
@@ -0,0 +1,621 @@
1
+ # Analyze Project Structure
2
+
3
+ **Purpose:** Analyze an existing AIOS project to understand its structure, services, patterns, and provide recommendations for implementing new features. This is Phase 1 of the Incremental Feature Workflow.
4
+
5
+ ---
6
+
7
+ ## Execution Modes
8
+
9
+ **Choose your execution mode:**
10
+
11
+ ### 1. YOLO Mode - Fast, Autonomous (0-1 prompts)
12
+ - Quick scan with default recommendations
13
+ - Minimal user interaction
14
+ - **Best for:** Quick assessments, familiar projects
15
+
16
+ ### 2. Interactive Mode - Balanced, Educational (3-5 prompts) **[DEFAULT]**
17
+ - Detailed analysis with explanation
18
+ - User input on feature requirements
19
+ - **Best for:** First-time analysis, new features
20
+
21
+ ### 3. Comprehensive Mode - Full Analysis
22
+ - Complete project scan
23
+ - All patterns documented
24
+ - **Best for:** Large projects, major features
25
+
26
+ **Parameter:** `mode` (optional, default: `interactive`)
27
+
28
+ ---
29
+
30
+ ## Task Definition (AIOS Task Format V1.0)
31
+
32
+ ```yaml
33
+ task: analyzeProjectStructure()
34
+ responsible: architect (Aria)
35
+ responsible_type: Agent
36
+ atomic_layer: Analysis
37
+ elicit: true
38
+
39
+ inputs:
40
+ - field: feature_description
41
+ type: string
42
+ source: User Input
43
+ required: true
44
+ validation: Non-empty string describing the feature to add
45
+
46
+ - field: project_path
47
+ type: string
48
+ source: User Input or cwd
49
+ required: false
50
+ validation: Valid directory path with .aios-core/
51
+
52
+ - field: executionMode
53
+ type: string
54
+ source: User Input
55
+ required: false
56
+ validation: yolo|interactive|comprehensive
57
+
58
+ outputs:
59
+ - field: project_analysis
60
+ type: markdown
61
+ destination: docs/architecture/project-analysis.md
62
+ persisted: true
63
+
64
+ - field: recommended_approach
65
+ type: markdown
66
+ destination: docs/architecture/recommended-approach.md
67
+ persisted: true
68
+
69
+ - field: service_inventory
70
+ type: array
71
+ destination: Memory
72
+ persisted: false
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Pre-Conditions
78
+
79
+ **Purpose:** Validate prerequisites BEFORE task execution (blocking)
80
+
81
+ **Checklist:**
82
+
83
+ ```yaml
84
+ pre-conditions:
85
+ - [ ] Project has .aios-core/ directory
86
+ type: pre-condition
87
+ blocker: true
88
+ validation: |
89
+ Check .aios-core/ directory exists in project root
90
+ error_message: "Pre-condition failed: Not an AIOS project (.aios-core/ not found)"
91
+
92
+ - [ ] Project path is accessible
93
+ type: pre-condition
94
+ blocker: true
95
+ validation: |
96
+ Verify project directory exists and is readable
97
+ error_message: "Pre-condition failed: Project path not accessible"
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Post-Conditions
103
+
104
+ **Purpose:** Validate execution success AFTER task completes
105
+
106
+ **Checklist:**
107
+
108
+ ```yaml
109
+ post-conditions:
110
+ - [ ] Project analysis document generated
111
+ type: post-condition
112
+ blocker: true
113
+ validation: |
114
+ Verify docs/architecture/project-analysis.md exists and is populated
115
+ error_message: "Post-condition failed: Project analysis not generated"
116
+
117
+ - [ ] Recommended approach document generated
118
+ type: post-condition
119
+ blocker: true
120
+ validation: |
121
+ Verify docs/architecture/recommended-approach.md exists and is populated
122
+ error_message: "Post-condition failed: Recommended approach not generated"
123
+
124
+ - [ ] Service inventory captured
125
+ type: post-condition
126
+ blocker: false
127
+ validation: |
128
+ Verify at least basic project structure was analyzed
129
+ error_message: "Warning: Service inventory may be incomplete"
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Acceptance Criteria
135
+
136
+ **Purpose:** Definitive pass/fail criteria for task completion
137
+
138
+ **Checklist:**
139
+
140
+ ```yaml
141
+ acceptance-criteria:
142
+ - [ ] Project structure scanned
143
+ type: acceptance-criterion
144
+ blocker: true
145
+ validation: |
146
+ Assert .aios-core/ configuration analyzed
147
+ error_message: "Acceptance criterion not met: Project structure not scanned"
148
+
149
+ - [ ] Service inventory complete
150
+ type: acceptance-criterion
151
+ blocker: true
152
+ validation: |
153
+ Assert services in infrastructure/services/ listed
154
+ error_message: "Acceptance criterion not met: Service inventory incomplete"
155
+
156
+ - [ ] Pattern analysis performed
157
+ type: acceptance-criterion
158
+ blocker: true
159
+ validation: |
160
+ Assert language, testing, and configuration patterns identified
161
+ error_message: "Acceptance criterion not met: Pattern analysis not performed"
162
+
163
+ - [ ] Recommendations generated
164
+ type: acceptance-criterion
165
+ blocker: true
166
+ validation: |
167
+ Assert recommended_approach document has service type and implementation steps
168
+ error_message: "Acceptance criterion not met: Recommendations not generated"
169
+ ```
170
+
171
+ ---
172
+
173
+ ## Tools
174
+
175
+ **External/shared resources used by this task:**
176
+
177
+ - **Tool:** filesystem
178
+ - **Purpose:** Read project files and directory structure
179
+
180
+ - **Tool:** glob
181
+ - **Purpose:** Find files matching patterns
182
+
183
+ - **Tool:** grep
184
+ - **Purpose:** Search file contents for patterns
185
+
186
+ ---
187
+
188
+ ## Error Handling
189
+
190
+ **Strategy:** graceful-degradation
191
+
192
+ **Common Errors:**
193
+
194
+ 1. **Error:** No .aios-core/ Directory
195
+ - **Cause:** Not an AIOS project
196
+ - **Resolution:** Initialize AIOS first or check directory
197
+ - **Recovery:** Exit with clear message
198
+
199
+ 2. **Error:** No Services Found
200
+ - **Cause:** New project or services in different location
201
+ - **Resolution:** Proceed with minimal analysis
202
+ - **Recovery:** Generate analysis noting "No existing services"
203
+
204
+ 3. **Error:** Permission Denied
205
+ - **Cause:** Cannot read certain directories
206
+ - **Resolution:** Skip inaccessible areas
207
+ - **Recovery:** Note in analysis, continue with accessible files
208
+
209
+ ---
210
+
211
+ ## Performance
212
+
213
+ **Expected Metrics:**
214
+
215
+ ```yaml
216
+ duration_expected: 30s-2min
217
+ cost_estimated: $0.001-0.003
218
+ token_usage: ~500-1,500 tokens
219
+ ```
220
+
221
+ **Optimization Notes:**
222
+ - Directory scans are O(n) for service directories
223
+ - File reads are cached during analysis
224
+ - Pattern detection uses efficient regex
225
+
226
+ ---
227
+
228
+ ## Metadata
229
+
230
+ ```yaml
231
+ story: WIS-15
232
+ version: 1.0.0
233
+ dependencies:
234
+ - filesystem access
235
+ - glob tool
236
+ tags:
237
+ - analysis
238
+ - architecture
239
+ - incremental-feature
240
+ - wis
241
+ created_at: 2025-12-23
242
+ updated_at: 2025-12-23
243
+ ```
244
+
245
+ ---
246
+
247
+ ## Task Instructions
248
+
249
+ ### Step 1: Elicitation - Gather Requirements
250
+
251
+ **Required Information:**
252
+
253
+ Present these prompts to the user:
254
+
255
+ ```
256
+ 1. "What feature/service needs to be added?"
257
+ [TEXT INPUT - Required]
258
+ Example: "TikTok API integration for creator management"
259
+
260
+ 2. "Does this feature require external API integration?"
261
+ [CHOICE: Yes / No / Unsure]
262
+
263
+ 3. "Will this feature need database changes?"
264
+ [CHOICE: Yes / No / Unsure]
265
+ ```
266
+
267
+ **Store responses for recommendation generation.**
268
+
269
+ ---
270
+
271
+ ### Step 2: Project Structure Scan
272
+
273
+ **Scan the following locations:**
274
+
275
+ ```javascript
276
+ // Core AIOS structure
277
+ const scanLocations = {
278
+ aiosCore: '.aios-core/',
279
+ services: '.aios-core/infrastructure/services/',
280
+ squads: '.aios-core/squads/',
281
+ agents: '.aios-core/development/agents/',
282
+ tasks: '.aios-core/development/tasks/',
283
+ data: '.aios-core/data/'
284
+ };
285
+ ```
286
+
287
+ **For each location, identify:**
288
+ - Directory exists (boolean)
289
+ - Files/subdirectories present
290
+ - Key configuration files
291
+
292
+ **Service Inventory:**
293
+
294
+ For each service in `infrastructure/services/`:
295
+ 1. Service name (directory name)
296
+ 2. Language (JS vs TS - check for .ts files)
297
+ 3. Has tests (check for __tests__/ or *.test.* files)
298
+ 4. Has README (check for README.md)
299
+ 5. Entry point (index.ts or index.js)
300
+
301
+ ---
302
+
303
+ ### Step 3: Pattern Analysis
304
+
305
+ **Analyze the following patterns:**
306
+
307
+ #### 3.1 Language Usage
308
+ ```javascript
309
+ // Count file extensions
310
+ const languagePatterns = {
311
+ typescript: glob('**/*.ts').length,
312
+ javascript: glob('**/*.js').length,
313
+ ratio: typescript / (typescript + javascript)
314
+ };
315
+
316
+ // Determine primary language
317
+ const primaryLanguage = ratio > 0.5 ? 'TypeScript' : 'JavaScript';
318
+ ```
319
+
320
+ #### 3.2 Testing Approach
321
+ ```javascript
322
+ // Check for test frameworks
323
+ const testingPatterns = {
324
+ jest: exists('jest.config.js') || exists('jest.config.ts'),
325
+ vitest: exists('vitest.config.ts'),
326
+ mocha: exists('.mocharc.js'),
327
+ hasTests: glob('**/*.test.{ts,js}').length > 0 ||
328
+ glob('**/*.spec.{ts,js}').length > 0
329
+ };
330
+
331
+ // Determine testing framework
332
+ const testFramework = jest ? 'Jest' : vitest ? 'Vitest' : 'None detected';
333
+ ```
334
+
335
+ #### 3.3 Documentation Style
336
+ ```javascript
337
+ // Check documentation patterns
338
+ const docPatterns = {
339
+ hasReadmes: glob('**/README.md').length,
340
+ hasJSDoc: grep('@param|@returns|@example', '**/*.{ts,js}').length > 0,
341
+ hasTypedoc: exists('typedoc.json')
342
+ };
343
+ ```
344
+
345
+ #### 3.4 Configuration Patterns
346
+ ```javascript
347
+ // Check configuration approaches
348
+ const configPatterns = {
349
+ envVars: exists('.env.example') || exists('.env.local'),
350
+ configFile: exists('aios.config.js') || exists('.aios-core/core-config.yaml'),
351
+ envPrefix: grep('process.env', '**/*.{ts,js}').length > 0
352
+ };
353
+ ```
354
+
355
+ ---
356
+
357
+ ### Step 4: Generate Recommendations
358
+
359
+ Based on elicitation responses and pattern analysis:
360
+
361
+ #### 4.1 Service Type Recommendation
362
+
363
+ | User Response | Detected Pattern | Recommendation |
364
+ |---------------|------------------|----------------|
365
+ | External API = Yes | Existing API services | **API Integration** |
366
+ | External API = No, DB = Yes | Data services exist | **Utility Service** |
367
+ | Unsure | No clear pattern | **Utility Service** (default) |
368
+ | Agent tooling mentioned | Squads configured | **Agent Tool (MCP)** |
369
+
370
+ #### 4.2 File Structure Suggestion
371
+
372
+ Based on existing service patterns, suggest structure:
373
+
374
+ ```
375
+ .aios-core/infrastructure/services/{service-name}/
376
+ ├── README.md # Documentation
377
+ ├── index.ts # Entry point (factory + exports)
378
+ ├── client.ts # HTTP client (if API integration)
379
+ ├── types.ts # TypeScript interfaces
380
+ ├── errors.ts # Error classes
381
+ ├── __tests__/ # Test directory
382
+ │ └── index.test.ts
383
+ ├── package.json # Dependencies
384
+ └── tsconfig.json # TypeScript config
385
+ ```
386
+
387
+ #### 4.3 Agent Assignment
388
+
389
+ | Service Type | Primary Agent | Support Agent |
390
+ |--------------|---------------|---------------|
391
+ | API Integration | @dev | @qa |
392
+ | Utility Service | @dev | @architect |
393
+ | Agent Tool | @dev | @devops |
394
+ | Database-heavy | @data-engineer | @dev |
395
+
396
+ ---
397
+
398
+ ### Step 5: Generate Output Documents
399
+
400
+ #### 5.1 Project Analysis Document
401
+
402
+ Generate `docs/architecture/project-analysis.md`:
403
+
404
+ ```markdown
405
+ # Project Analysis: {feature_name}
406
+
407
+ **Generated:** {date}
408
+ **Generated By:** @architect (Aria)
409
+ **Story:** WIS-15
410
+
411
+ ---
412
+
413
+ ## Project Structure
414
+
415
+ | Aspect | Value |
416
+ |--------|-------|
417
+ | Framework | AIOS-FullStack |
418
+ | Primary Language | {primaryLanguage} |
419
+ | Existing Services | {serviceCount} |
420
+ | Testing Framework | {testFramework} |
421
+ | Configuration | {configApproach} |
422
+
423
+ ---
424
+
425
+ ## Existing Services
426
+
427
+ | Service | Type | Language | Tests | README |
428
+ |---------|------|----------|-------|--------|
429
+ {for each service}
430
+ | {name} | {type} | {language} | {hasTests} | {hasReadme} |
431
+ {end for}
432
+
433
+ ---
434
+
435
+ ## Pattern Summary
436
+
437
+ ### Language Distribution
438
+ - **TypeScript:** {tsCount} files ({tsPercent}%)
439
+ - **JavaScript:** {jsCount} files ({jsPercent}%)
440
+
441
+ ### Testing
442
+ - **Framework:** {testFramework}
443
+ - **Test Files:** {testFileCount}
444
+ - **Coverage:** {coverageNote}
445
+
446
+ ### Configuration
447
+ - **Environment Variables:** {envVarsUsed}
448
+ - **Config Files:** {configFilesUsed}
449
+
450
+ ---
451
+
452
+ ## Squad Configuration
453
+
454
+ {if squads exist}
455
+ | Squad | Agents | Services |
456
+ |-------|--------|----------|
457
+ {for each squad}
458
+ | {squadName} | {agentCount} | {serviceCount} |
459
+ {end for}
460
+ {else}
461
+ No squads configured.
462
+ {end if}
463
+ ```
464
+
465
+ #### 5.2 Recommended Approach Document
466
+
467
+ Generate `docs/architecture/recommended-approach.md`:
468
+
469
+ ```markdown
470
+ # Recommended Approach: {feature_name}
471
+
472
+ **Generated:** {date}
473
+ **Generated By:** @architect (Aria)
474
+ **Story:** WIS-15
475
+
476
+ ---
477
+
478
+ ## Feature Requirements
479
+
480
+ **Description:** {feature_description}
481
+ **API Integration Required:** {apiRequired}
482
+ **Database Changes Required:** {dbRequired}
483
+
484
+ ---
485
+
486
+ ## Service Type
487
+
488
+ **Recommendation:** {serviceType}
489
+
490
+ **Rationale:** {rationale based on analysis}
491
+
492
+ ---
493
+
494
+ ## Suggested Structure
495
+
496
+ ```
497
+ .aios-core/infrastructure/services/{service_name}/
498
+ ├── README.md
499
+ ├── index.ts
500
+ ├── client.ts {if apiIntegration}
501
+ ├── types.ts
502
+ ├── errors.ts
503
+ ├── __tests__/
504
+ │ └── index.test.ts
505
+ ├── package.json
506
+ └── tsconfig.json
507
+ ```
508
+
509
+ ---
510
+
511
+ ## Implementation Steps
512
+
513
+ 1. **Scaffold Service**
514
+ - Use `*create-service` task to generate structure
515
+ - Select type: {serviceType}
516
+
517
+ 2. **Implement Core Logic**
518
+ - Create {mainModules}
519
+ - Follow existing patterns from {referenceService}
520
+
521
+ 3. **Add Tests**
522
+ - Use {testFramework}
523
+ - Target >70% coverage
524
+
525
+ 4. **Documentation**
526
+ - Update README.md
527
+ - Add JSDoc comments
528
+
529
+ 5. **Integration**
530
+ - {integrationSteps based on type}
531
+
532
+ ---
533
+
534
+ ## Agent Assignment
535
+
536
+ | Role | Agent | Responsibilities |
537
+ |------|-------|------------------|
538
+ | Primary | @{primaryAgent} | {primaryResponsibilities} |
539
+ | Support | @{supportAgent} | {supportResponsibilities} |
540
+
541
+ ---
542
+
543
+ ## Dependencies
544
+
545
+ {list of dependencies based on service type}
546
+
547
+ ---
548
+
549
+ ## Next Steps
550
+
551
+ After this analysis:
552
+ 1. Review and approve this approach
553
+ 2. Run `*create-service {service_name}` to scaffold
554
+ 3. Implement following the steps above
555
+ ```
556
+
557
+ ---
558
+
559
+ ### Step 6: Present Results
560
+
561
+ Display summary to user:
562
+
563
+ ```
564
+ === Project Analysis Complete ===
565
+
566
+ Project: {projectName}
567
+ Services Found: {serviceCount}
568
+ Primary Language: {primaryLanguage}
569
+ Testing: {testFramework}
570
+
571
+ === Recommendation ===
572
+
573
+ Feature: {feature_name}
574
+ Service Type: {serviceType}
575
+ Primary Agent: @{primaryAgent}
576
+
577
+ Documents Generated:
578
+ 1. docs/architecture/project-analysis.md
579
+ 2. docs/architecture/recommended-approach.md
580
+
581
+ Next Steps:
582
+ 1. Review the recommended approach
583
+ 2. Run `*create-service {service_name}` to scaffold
584
+ 3. Begin implementation with @{primaryAgent}
585
+
586
+ Would you like me to proceed with `*create-service`?
587
+ ```
588
+
589
+ ---
590
+
591
+ ## Success Criteria
592
+
593
+ - [ ] Feature requirements captured from user
594
+ - [ ] Project structure scanned completely
595
+ - [ ] All existing services inventoried
596
+ - [ ] Language and testing patterns identified
597
+ - [ ] Service type recommendation provided
598
+ - [ ] File structure suggestion based on patterns
599
+ - [ ] Agent assignment recommended
600
+ - [ ] project-analysis.md generated
601
+ - [ ] recommended-approach.md generated
602
+
603
+ ---
604
+
605
+ ## Integration with Other Tasks
606
+
607
+ This task is typically followed by:
608
+
609
+ 1. **`*create-service`** - Scaffold the new service (WIS-11)
610
+ 2. **`*create-integration`** - For API integrations (WIS-12)
611
+ 3. **`*extend-squad-tools`** - Add to squad if needed (WIS-13)
612
+
613
+ ---
614
+
615
+ ## Notes
616
+
617
+ - This task is read-only; no project files are modified
618
+ - Run this BEFORE creating new services
619
+ - Recommendations are suggestions, not requirements
620
+ - For large projects, analysis may take 1-2 minutes
621
+ - Always review generated documents before proceeding