aios-core 2.1.5 → 2.1.6

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.
Files changed (29) hide show
  1. package/.aios-core/development/tasks/analyze-brownfield.md +456 -0
  2. package/.aios-core/development/tasks/setup-project-docs.md +440 -0
  3. package/.aios-core/infrastructure/scripts/documentation-integrity/brownfield-analyzer.js +501 -0
  4. package/.aios-core/infrastructure/scripts/documentation-integrity/config-generator.js +368 -0
  5. package/.aios-core/infrastructure/scripts/documentation-integrity/deployment-config-loader.js +308 -0
  6. package/.aios-core/infrastructure/scripts/documentation-integrity/doc-generator.js +331 -0
  7. package/.aios-core/infrastructure/scripts/documentation-integrity/gitignore-generator.js +312 -0
  8. package/.aios-core/infrastructure/scripts/documentation-integrity/index.js +74 -0
  9. package/.aios-core/infrastructure/scripts/documentation-integrity/mode-detector.js +389 -0
  10. package/.aios-core/infrastructure/templates/core-config/core-config-brownfield.tmpl.yaml +176 -0
  11. package/.aios-core/infrastructure/templates/core-config/core-config-greenfield.tmpl.yaml +127 -0
  12. package/.aios-core/infrastructure/templates/gitignore/gitignore-aios-base.tmpl +63 -0
  13. package/.aios-core/infrastructure/templates/gitignore/gitignore-brownfield-merge.tmpl +18 -0
  14. package/.aios-core/infrastructure/templates/gitignore/gitignore-node.tmpl +85 -0
  15. package/.aios-core/infrastructure/templates/gitignore/gitignore-python.tmpl +145 -0
  16. package/.aios-core/infrastructure/templates/project-docs/coding-standards-tmpl.md +346 -0
  17. package/.aios-core/infrastructure/templates/project-docs/source-tree-tmpl.md +177 -0
  18. package/.aios-core/infrastructure/templates/project-docs/tech-stack-tmpl.md +267 -0
  19. package/package.json +1 -1
  20. package/packages/installer/src/config/templates/env-template.js +2 -2
  21. package/packages/installer/src/wizard/wizard.js +185 -34
  22. package/packages/installer/tests/integration/environment-configuration.test.js +2 -1
  23. package/packages/installer/tests/unit/env-template.test.js +3 -2
  24. package/.aios-core/development/tasks/validate-structure.md +0 -243
  25. package/.aios-core/infrastructure/scripts/source-tree-guardian/index.js +0 -375
  26. package/.aios-core/infrastructure/scripts/source-tree-guardian/manifest-generator.js +0 -410
  27. package/.aios-core/infrastructure/scripts/source-tree-guardian/rules/naming-rules.yaml +0 -285
  28. package/.aios-core/infrastructure/scripts/source-tree-guardian/rules/placement-rules.yaml +0 -262
  29. package/.aios-core/infrastructure/scripts/source-tree-guardian/validator.js +0 -468
@@ -0,0 +1,440 @@
1
+ ---
2
+
3
+ ## Execution Modes
4
+
5
+ **Choose your execution mode:**
6
+
7
+ ### 1. YOLO Mode - Fast, Autonomous (0-1 prompts)
8
+ - Autonomous decision making with logging
9
+ - Minimal user interaction
10
+ - **Best for:** Greenfield projects, quick setup
11
+
12
+ ### 2. Interactive Mode - Balanced, Educational (5-10 prompts) **[DEFAULT]**
13
+ - Explicit decision checkpoints
14
+ - Educational explanations
15
+ - **Best for:** Brownfield projects, complex configurations
16
+
17
+ ### 3. Pre-Flight Planning - Comprehensive Upfront Planning
18
+ - Task analysis phase (identify all ambiguities)
19
+ - Zero ambiguity execution
20
+ - **Best for:** Critical projects, enterprise setups
21
+
22
+ **Parameter:** `mode` (optional, default: `interactive`)
23
+
24
+ ---
25
+
26
+ ## Task Definition (AIOS Task Format V1.0)
27
+
28
+ ```yaml
29
+ task: setupProjectDocs()
30
+ responsible: dev (Developer)
31
+ responsible_type: Agent
32
+ atomic_layer: Documentation
33
+
34
+ inputs:
35
+ - field: targetDir
36
+ type: string
37
+ source: User Input or cwd
38
+ required: false
39
+ validation: Valid directory path
40
+
41
+ - field: projectName
42
+ type: string
43
+ source: User Input or package.json
44
+ required: false
45
+ validation: Non-empty string
46
+
47
+ - field: mode
48
+ type: string
49
+ source: User Input
50
+ required: false
51
+ validation: greenfield|brownfield|framework-dev
52
+
53
+ - field: executionMode
54
+ type: string
55
+ source: User Input
56
+ required: false
57
+ validation: yolo|interactive|pre-flight
58
+
59
+ outputs:
60
+ - field: docs_generated
61
+ type: array
62
+ destination: docs/architecture/
63
+ persisted: true
64
+
65
+ - field: core_config
66
+ type: file
67
+ destination: .aios-core/core-config.yaml
68
+ persisted: true
69
+
70
+ - field: gitignore
71
+ type: file
72
+ destination: .gitignore
73
+ persisted: true
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Pre-Conditions
79
+
80
+ **Purpose:** Validate prerequisites BEFORE task execution (blocking)
81
+
82
+ **Checklist:**
83
+
84
+ ```yaml
85
+ pre-conditions:
86
+ - [ ] Target directory exists and is writable
87
+ type: pre-condition
88
+ blocker: true
89
+ validation: |
90
+ Check target directory exists and has write permissions
91
+ error_message: "Pre-condition failed: Target directory not accessible"
92
+
93
+ - [ ] Documentation Integrity module is available
94
+ type: pre-condition
95
+ blocker: true
96
+ validation: |
97
+ Verify .aios-core/infrastructure/scripts/documentation-integrity/index.js exists
98
+ error_message: "Pre-condition failed: Documentation Integrity module not found"
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Post-Conditions
104
+
105
+ **Purpose:** Validate execution success AFTER task completes
106
+
107
+ **Checklist:**
108
+
109
+ ```yaml
110
+ post-conditions:
111
+ - [ ] Project docs created in docs/architecture/
112
+ type: post-condition
113
+ blocker: true
114
+ validation: |
115
+ Verify source-tree.md, coding-standards.md, tech-stack.md exist in docs/architecture/
116
+ error_message: "Post-condition failed: Documentation files not created"
117
+
118
+ - [ ] core-config.yaml created with valid deployment section
119
+ type: post-condition
120
+ blocker: true
121
+ validation: |
122
+ Verify .aios-core/core-config.yaml exists and has deployment configuration
123
+ error_message: "Post-condition failed: core-config.yaml not properly configured"
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Acceptance Criteria
129
+
130
+ **Purpose:** Definitive pass/fail criteria for task completion
131
+
132
+ **Checklist:**
133
+
134
+ ```yaml
135
+ acceptance-criteria:
136
+ - [ ] All documentation files generated from templates
137
+ type: acceptance-criterion
138
+ blocker: true
139
+ validation: |
140
+ Assert docs contain project-specific content, not placeholders
141
+ error_message: "Acceptance criterion not met: Docs contain unresolved placeholders"
142
+
143
+ - [ ] .gitignore properly configured for project
144
+ type: acceptance-criterion
145
+ blocker: true
146
+ validation: |
147
+ Assert .gitignore includes AIOS ignores and tech stack ignores
148
+ error_message: "Acceptance criterion not met: .gitignore incomplete"
149
+
150
+ - [ ] Configuration-Driven Architecture pattern applied
151
+ type: acceptance-criterion
152
+ blocker: true
153
+ validation: |
154
+ Assert core-config.yaml contains project-specific values
155
+ error_message: "Acceptance criterion not met: core-config.yaml not configuration-driven"
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Tools
161
+
162
+ **External/shared resources used by this task:**
163
+
164
+ - **Tool:** documentation-integrity
165
+ - **Purpose:** Mode detection, doc generation, config generation
166
+ - **Source:** .aios-core/infrastructure/scripts/documentation-integrity/index.js
167
+
168
+ - **Tool:** deployment-config-loader
169
+ - **Purpose:** Load and validate deployment configuration
170
+ - **Source:** .aios-core/infrastructure/scripts/documentation-integrity/deployment-config-loader.js
171
+
172
+ ---
173
+
174
+ ## Scripts
175
+
176
+ **Agent-specific code for this task:**
177
+
178
+ - **Script:** mode-detector.js
179
+ - **Purpose:** Detect installation mode from project markers
180
+ - **Language:** JavaScript
181
+ - **Location:** .aios-core/infrastructure/scripts/documentation-integrity/mode-detector.js
182
+
183
+ - **Script:** doc-generator.js
184
+ - **Purpose:** Generate project documentation from templates
185
+ - **Language:** JavaScript
186
+ - **Location:** .aios-core/infrastructure/scripts/documentation-integrity/doc-generator.js
187
+
188
+ - **Script:** config-generator.js
189
+ - **Purpose:** Generate core-config.yaml
190
+ - **Language:** JavaScript
191
+ - **Location:** .aios-core/infrastructure/scripts/documentation-integrity/config-generator.js
192
+
193
+ - **Script:** gitignore-generator.js
194
+ - **Purpose:** Generate or merge .gitignore
195
+ - **Language:** JavaScript
196
+ - **Location:** .aios-core/infrastructure/scripts/documentation-integrity/gitignore-generator.js
197
+
198
+ ---
199
+
200
+ ## Error Handling
201
+
202
+ **Strategy:** fallback-defaults
203
+
204
+ **Common Errors:**
205
+
206
+ 1. **Error:** Mode Detection Failed
207
+ - **Cause:** Unable to determine project type from markers
208
+ - **Resolution:** Use default mode (greenfield) or prompt user
209
+ - **Recovery:** Provide mode selection options
210
+
211
+ 2. **Error:** Template Not Found
212
+ - **Cause:** Template file missing from templates directory
213
+ - **Resolution:** Check template paths in templates/project-docs/
214
+ - **Recovery:** Use inline fallback templates
215
+
216
+ 3. **Error:** Config Write Failed
217
+ - **Cause:** Permission denied or disk full
218
+ - **Resolution:** Check directory permissions
219
+ - **Recovery:** Output config to console for manual creation
220
+
221
+ ---
222
+
223
+ ## Performance
224
+
225
+ **Expected Metrics:**
226
+
227
+ ```yaml
228
+ duration_expected: 1-3 min (estimated)
229
+ cost_estimated: $0.001-0.003
230
+ token_usage: ~500-2,000 tokens
231
+ ```
232
+
233
+ **Optimization Notes:**
234
+ - Uses template-based generation for fast execution
235
+ - Minimal file I/O with batched writes
236
+ - Configuration-Driven Architecture reduces runtime decisions
237
+
238
+ ---
239
+
240
+ ## Metadata
241
+
242
+ ```yaml
243
+ story: 6.9
244
+ version: 1.0.0
245
+ dependencies:
246
+ - documentation-integrity module
247
+ tags:
248
+ - documentation
249
+ - setup
250
+ - configuration
251
+ updated_at: 2025-12-14
252
+ ```
253
+
254
+ ---
255
+
256
+ tools:
257
+ - filesystem # Read/write project files
258
+ - documentation-integrity # Core module for this task
259
+ ---
260
+
261
+ # Setup Project Documentation
262
+
263
+ ## Purpose
264
+
265
+ Generate project-specific documentation and configuration using the Documentation Integrity System. This task creates the foundational docs that enable AI agents to understand project structure, coding standards, and deployment configuration.
266
+
267
+ ## Task Instructions
268
+
269
+ ### 1. Detect Installation Mode
270
+
271
+ First, determine the installation mode based on project markers:
272
+
273
+ ```javascript
274
+ const { detectInstallationMode, collectMarkers } = require('./.aios-core/infrastructure/scripts/documentation-integrity');
275
+
276
+ const targetDir = process.cwd(); // or specified directory
277
+ const detected = detectInstallationMode(targetDir);
278
+ const markers = collectMarkers(targetDir);
279
+
280
+ console.log(`Detected Mode: ${detected.mode}`);
281
+ console.log(`Confidence: ${detected.confidence}`);
282
+ console.log(`Reason: ${detected.reason}`);
283
+ ```
284
+
285
+ **Mode Descriptions:**
286
+
287
+ | Mode | Description | Actions |
288
+ |------|-------------|---------|
289
+ | `framework-dev` | Contributing to aios-core itself | Skip project setup, use existing config |
290
+ | `greenfield` | New empty project | Full scaffolding, deployment config wizard |
291
+ | `brownfield` | Existing project | Analyze and adapt, merge configurations |
292
+
293
+ ### 2. Elicit Deployment Configuration (Greenfield/Brownfield)
294
+
295
+ For greenfield and brownfield projects, gather deployment preferences:
296
+
297
+ **Key Questions:**
298
+
299
+ 1. **Deployment Workflow:**
300
+ - `staging-first`: All changes go to staging before production
301
+ - `direct-to-main`: Feature branches merge directly to main
302
+
303
+ 2. **Deployment Platform:**
304
+ - `Vercel`: Vercel deployment
305
+ - `AWS`: AWS (S3/CloudFront, ECS, Lambda)
306
+ - `Railway`: Railway.app
307
+ - `Docker`: Docker-based deployment
308
+ - `None`: No deployment platform configured
309
+
310
+ 3. **Branch Configuration:**
311
+ - Staging branch name (default: `staging`)
312
+ - Production branch name (default: `main`)
313
+
314
+ 4. **Quality Gates:**
315
+ - Enable lint check? (default: yes)
316
+ - Enable typecheck? (default: yes for TypeScript projects)
317
+ - Enable tests? (default: yes)
318
+ - Enable security scan? (default: no)
319
+
320
+ ### 3. Generate Documentation
321
+
322
+ Using the gathered context, generate project documentation:
323
+
324
+ ```javascript
325
+ const { buildDocContext, generateDocs } = require('./.aios-core/infrastructure/scripts/documentation-integrity');
326
+
327
+ const context = buildDocContext(projectName, mode, markers, {
328
+ // Custom overrides if needed
329
+ });
330
+
331
+ const result = generateDocs(targetDir, context, {
332
+ dryRun: false, // Set true to preview
333
+ });
334
+
335
+ console.log(`Generated ${result.filesCreated.length} documentation files`);
336
+ ```
337
+
338
+ **Files Generated:**
339
+
340
+ | File | Purpose |
341
+ |------|---------|
342
+ | `docs/architecture/source-tree.md` | Project structure documentation |
343
+ | `docs/architecture/coding-standards.md` | Coding conventions and patterns |
344
+ | `docs/architecture/tech-stack.md` | Technology stack reference |
345
+
346
+ ### 4. Generate Core Configuration
347
+
348
+ Create the core-config.yaml with deployment settings:
349
+
350
+ ```javascript
351
+ const { buildConfigContext, generateConfig, DeploymentWorkflow, DeploymentPlatform } = require('./.aios-core/infrastructure/scripts/documentation-integrity');
352
+
353
+ const configContext = buildConfigContext(projectName, mode, {
354
+ workflow: DeploymentWorkflow.STAGING_FIRST,
355
+ platform: DeploymentPlatform.VERCEL,
356
+ stagingBranch: 'staging',
357
+ productionBranch: 'main',
358
+ qualityGates: {
359
+ lint: true,
360
+ typecheck: true,
361
+ tests: true,
362
+ security: false,
363
+ },
364
+ });
365
+
366
+ const configResult = generateConfig(targetDir, mode, configContext);
367
+ ```
368
+
369
+ ### 5. Generate/Merge .gitignore
370
+
371
+ Handle .gitignore based on project state:
372
+
373
+ ```javascript
374
+ const { generateGitignoreFile, hasAiosIntegration } = require('./.aios-core/infrastructure/scripts/documentation-integrity');
375
+
376
+ const gitignoreResult = generateGitignoreFile(targetDir, markers, {
377
+ projectName,
378
+ merge: mode === 'brownfield', // Merge with existing for brownfield
379
+ });
380
+
381
+ console.log(`Gitignore ${gitignoreResult.mode}: ${gitignoreResult.path}`);
382
+ ```
383
+
384
+ ### 6. Verify Configuration-Driven Architecture
385
+
386
+ Confirm the deployment config can be loaded by other tasks:
387
+
388
+ ```javascript
389
+ const { loadDeploymentConfig, validateDeploymentConfig } = require('./.aios-core/infrastructure/scripts/documentation-integrity');
390
+
391
+ const deployConfig = loadDeploymentConfig(targetDir);
392
+ const validation = validateDeploymentConfig(deployConfig);
393
+
394
+ if (validation.isValid) {
395
+ console.log('Configuration-Driven Architecture ready');
396
+ console.log(`Workflow: ${deployConfig.workflow}`);
397
+ console.log(`Platform: ${deployConfig.platform}`);
398
+ } else {
399
+ console.error('Configuration validation failed:', validation.errors);
400
+ }
401
+ ```
402
+
403
+ ## Success Criteria
404
+
405
+ - [ ] Installation mode correctly detected
406
+ - [ ] Project documentation generated in `docs/architecture/`
407
+ - [ ] `core-config.yaml` created with deployment section
408
+ - [ ] `.gitignore` properly configured (created or merged)
409
+ - [ ] Configuration passes validation
410
+ - [ ] No unresolved template placeholders in generated files
411
+
412
+ ## Output
413
+
414
+ After successful execution:
415
+
416
+ ```
417
+ Project Documentation Setup Complete
418
+ =====================================
419
+ Mode: greenfield
420
+ Project: my-awesome-app
421
+
422
+ Generated Files:
423
+ ✓ docs/architecture/source-tree.md
424
+ ✓ docs/architecture/coding-standards.md
425
+ ✓ docs/architecture/tech-stack.md
426
+ ✓ .aios-core/core-config.yaml
427
+ ✓ .gitignore (created)
428
+
429
+ Deployment Configuration:
430
+ Workflow: staging-first
431
+ Platform: vercel
432
+ Quality Gates: lint, typecheck, tests
433
+ ```
434
+
435
+ ## Notes
436
+
437
+ - This task implements the Configuration-Driven Architecture pattern
438
+ - Tasks read project-specific values from `core-config.yaml`
439
+ - For brownfield projects, existing configurations are preserved
440
+ - Use `*analyze-brownfield` task first for complex existing projects