aios-core 3.0.0 → 3.2.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.
@@ -0,0 +1,299 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://synkra.dev/schemas/squad-design.json",
4
+ "title": "Squad Design Blueprint",
5
+ "description": "Schema for squad design blueprints generated by *design-squad",
6
+ "type": "object",
7
+ "required": ["squad", "recommendations", "metadata"],
8
+ "properties": {
9
+ "squad": {
10
+ "type": "object",
11
+ "description": "Basic squad information",
12
+ "required": ["name", "domain"],
13
+ "properties": {
14
+ "name": {
15
+ "type": "string",
16
+ "pattern": "^[a-z][a-z0-9-]*[a-z0-9](-squad)?$",
17
+ "minLength": 2,
18
+ "maxLength": 64,
19
+ "description": "Squad name in kebab-case"
20
+ },
21
+ "description": {
22
+ "type": "string",
23
+ "maxLength": 500,
24
+ "description": "Human-readable description of the squad"
25
+ },
26
+ "domain": {
27
+ "type": "string",
28
+ "pattern": "^[a-z][a-z0-9-]*[a-z0-9]$",
29
+ "minLength": 2,
30
+ "maxLength": 50,
31
+ "description": "Domain identifier in kebab-case"
32
+ }
33
+ }
34
+ },
35
+ "analysis": {
36
+ "type": "object",
37
+ "description": "Domain analysis results",
38
+ "properties": {
39
+ "entities": {
40
+ "type": "array",
41
+ "items": {
42
+ "type": "string",
43
+ "minLength": 1,
44
+ "maxLength": 100
45
+ },
46
+ "maxItems": 50,
47
+ "description": "Extracted domain entities"
48
+ },
49
+ "workflows": {
50
+ "type": "array",
51
+ "items": {
52
+ "type": "string",
53
+ "pattern": "^[a-z][a-z0-9-]*[a-z0-9]$",
54
+ "minLength": 2,
55
+ "maxLength": 100
56
+ },
57
+ "maxItems": 50,
58
+ "description": "Identified workflows in kebab-case"
59
+ },
60
+ "integrations": {
61
+ "type": "array",
62
+ "items": {
63
+ "type": "string",
64
+ "minLength": 1,
65
+ "maxLength": 100
66
+ },
67
+ "maxItems": 30,
68
+ "description": "External integrations detected"
69
+ },
70
+ "stakeholders": {
71
+ "type": "array",
72
+ "items": {
73
+ "type": "string",
74
+ "minLength": 1,
75
+ "maxLength": 100
76
+ },
77
+ "maxItems": 20,
78
+ "description": "Stakeholder roles identified"
79
+ }
80
+ }
81
+ },
82
+ "recommendations": {
83
+ "type": "object",
84
+ "description": "Generated recommendations",
85
+ "required": ["agents", "tasks"],
86
+ "properties": {
87
+ "agents": {
88
+ "type": "array",
89
+ "items": {
90
+ "$ref": "#/definitions/agentRecommendation"
91
+ },
92
+ "minItems": 0,
93
+ "maxItems": 10,
94
+ "description": "Recommended agents"
95
+ },
96
+ "tasks": {
97
+ "type": "array",
98
+ "items": {
99
+ "$ref": "#/definitions/taskRecommendation"
100
+ },
101
+ "minItems": 0,
102
+ "maxItems": 50,
103
+ "description": "Recommended tasks"
104
+ },
105
+ "template": {
106
+ "type": "string",
107
+ "enum": ["basic", "etl", "agent-only", "custom"],
108
+ "default": "basic",
109
+ "description": "Recommended squad template"
110
+ },
111
+ "config_mode": {
112
+ "type": "string",
113
+ "enum": ["extend", "override", "none"],
114
+ "default": "extend",
115
+ "description": "Configuration inheritance mode"
116
+ }
117
+ }
118
+ },
119
+ "metadata": {
120
+ "type": "object",
121
+ "description": "Blueprint metadata",
122
+ "required": ["created_at"],
123
+ "properties": {
124
+ "created_at": {
125
+ "type": "string",
126
+ "format": "date-time",
127
+ "description": "ISO 8601 timestamp of blueprint creation"
128
+ },
129
+ "source_docs": {
130
+ "type": "array",
131
+ "items": {
132
+ "type": "string"
133
+ },
134
+ "description": "Paths to source documentation files"
135
+ },
136
+ "user_adjustments": {
137
+ "type": "integer",
138
+ "minimum": 0,
139
+ "default": 0,
140
+ "description": "Number of user modifications made"
141
+ },
142
+ "overall_confidence": {
143
+ "type": "number",
144
+ "minimum": 0,
145
+ "maximum": 1,
146
+ "description": "Overall confidence score (0-1)"
147
+ }
148
+ }
149
+ }
150
+ },
151
+ "definitions": {
152
+ "agentRecommendation": {
153
+ "type": "object",
154
+ "required": ["id", "role", "confidence"],
155
+ "properties": {
156
+ "id": {
157
+ "type": "string",
158
+ "pattern": "^[a-z][a-z0-9-]*[a-z0-9]$",
159
+ "minLength": 2,
160
+ "maxLength": 64,
161
+ "description": "Agent identifier in kebab-case"
162
+ },
163
+ "role": {
164
+ "type": "string",
165
+ "minLength": 5,
166
+ "maxLength": 200,
167
+ "description": "Agent role description"
168
+ },
169
+ "commands": {
170
+ "type": "array",
171
+ "items": {
172
+ "type": "string",
173
+ "pattern": "^[a-z][a-z0-9-]*[a-z0-9]$",
174
+ "minLength": 2,
175
+ "maxLength": 64
176
+ },
177
+ "maxItems": 20,
178
+ "description": "Agent commands in kebab-case"
179
+ },
180
+ "confidence": {
181
+ "type": "number",
182
+ "minimum": 0,
183
+ "maximum": 1,
184
+ "description": "Recommendation confidence score (0-1)"
185
+ },
186
+ "user_added": {
187
+ "type": "boolean",
188
+ "default": false,
189
+ "description": "Whether this agent was added by user"
190
+ },
191
+ "user_modified": {
192
+ "type": "boolean",
193
+ "default": false,
194
+ "description": "Whether this agent was modified by user"
195
+ }
196
+ }
197
+ },
198
+ "taskRecommendation": {
199
+ "type": "object",
200
+ "required": ["name", "agent", "confidence"],
201
+ "properties": {
202
+ "name": {
203
+ "type": "string",
204
+ "pattern": "^[a-z][a-z0-9-]*[a-z0-9]$",
205
+ "minLength": 2,
206
+ "maxLength": 64,
207
+ "description": "Task name in kebab-case (without .md extension)"
208
+ },
209
+ "agent": {
210
+ "type": "string",
211
+ "pattern": "^[a-z][a-z0-9-]*[a-z0-9]$",
212
+ "minLength": 2,
213
+ "maxLength": 64,
214
+ "description": "Owning agent identifier"
215
+ },
216
+ "entrada": {
217
+ "type": "array",
218
+ "items": {
219
+ "type": "string",
220
+ "minLength": 1,
221
+ "maxLength": 100
222
+ },
223
+ "maxItems": 20,
224
+ "description": "Task input parameters"
225
+ },
226
+ "saida": {
227
+ "type": "array",
228
+ "items": {
229
+ "type": "string",
230
+ "minLength": 1,
231
+ "maxLength": 100
232
+ },
233
+ "maxItems": 20,
234
+ "description": "Task output parameters"
235
+ },
236
+ "confidence": {
237
+ "type": "number",
238
+ "minimum": 0,
239
+ "maximum": 1,
240
+ "description": "Recommendation confidence score (0-1)"
241
+ },
242
+ "checklist": {
243
+ "type": "array",
244
+ "items": {
245
+ "type": "string",
246
+ "minLength": 1,
247
+ "maxLength": 200
248
+ },
249
+ "maxItems": 20,
250
+ "description": "Task checklist items"
251
+ }
252
+ }
253
+ }
254
+ },
255
+ "examples": [
256
+ {
257
+ "squad": {
258
+ "name": "order-management-squad",
259
+ "description": "Squad for order management system",
260
+ "domain": "order-management"
261
+ },
262
+ "analysis": {
263
+ "entities": ["Order", "Customer", "Product", "Payment"],
264
+ "workflows": ["create-order", "process-payment", "ship-order"],
265
+ "integrations": ["Stripe API", "Inventory Service"],
266
+ "stakeholders": ["Customer", "Admin", "Support"]
267
+ },
268
+ "recommendations": {
269
+ "agents": [
270
+ {
271
+ "id": "order-manager",
272
+ "role": "Manages order lifecycle from creation to fulfillment",
273
+ "commands": ["create-order", "update-order", "cancel-order"],
274
+ "confidence": 0.92,
275
+ "user_added": false,
276
+ "user_modified": false
277
+ }
278
+ ],
279
+ "tasks": [
280
+ {
281
+ "name": "create-order",
282
+ "agent": "order-manager",
283
+ "entrada": ["customer_id", "items", "payment_method"],
284
+ "saida": ["order_id", "status"],
285
+ "confidence": 0.88
286
+ }
287
+ ],
288
+ "template": "basic",
289
+ "config_mode": "extend"
290
+ },
291
+ "metadata": {
292
+ "created_at": "2025-12-18T00:00:00Z",
293
+ "source_docs": ["./docs/prd/orders.md"],
294
+ "user_adjustments": 2,
295
+ "overall_confidence": 0.87
296
+ }
297
+ }
298
+ ]
299
+ }
package/bin/aios-init.js CHANGED
@@ -60,6 +60,15 @@ const { detectRepositoryContext } = resolveAiosCoreModule('scripts/repository-de
60
60
  // const { GitHubProjectsAdapter } = resolveAiosCoreModule('utils/pm-adapters/github-adapter');
61
61
  // const { JiraAdapter } = resolveAiosCoreModule('utils/pm-adapters/jira-adapter');
62
62
 
63
+ // Brownfield upgrade module (Story 6.18)
64
+ let brownfieldUpgrader;
65
+ try {
66
+ brownfieldUpgrader = require('../src/installer/brownfield-upgrader');
67
+ } catch (_err) {
68
+ // Module may not be available in older installations
69
+ brownfieldUpgrader = null;
70
+ }
71
+
63
72
  async function main() {
64
73
  console.clear();
65
74
 
@@ -142,6 +151,108 @@ async function main() {
142
151
  console.log(chalk.cyan('📦 Package:') + ` ${context.packageName}`);
143
152
  console.log('');
144
153
 
154
+ // Check for existing installation (Story 6.18 - Brownfield Upgrade)
155
+ const installedManifestPath = path.join(projectRoot, '.aios-core', '.installed-manifest.yaml');
156
+ const hasExistingInstall = fs.existsSync(installedManifestPath);
157
+
158
+ if (hasExistingInstall && brownfieldUpgrader) {
159
+ console.log(chalk.yellow('🔄 Existing AIOS installation detected!'));
160
+ console.log('');
161
+
162
+ const sourceDir = path.join(context.frameworkLocation, '.aios-core');
163
+ const upgradeCheck = brownfieldUpgrader.checkUpgradeAvailable(sourceDir, projectRoot);
164
+
165
+ if (upgradeCheck.available) {
166
+ console.log(chalk.green(` Upgrade available: ${upgradeCheck.from} → ${upgradeCheck.to}`));
167
+ console.log('');
168
+
169
+ // Generate upgrade report for display
170
+ const sourceManifest = brownfieldUpgrader.loadSourceManifest(sourceDir);
171
+ const installedManifest = brownfieldUpgrader.loadInstalledManifest(projectRoot);
172
+ const report = brownfieldUpgrader.generateUpgradeReport(sourceManifest, installedManifest, projectRoot);
173
+
174
+ console.log(chalk.gray('─'.repeat(80)));
175
+ const { upgradeChoice } = await inquirer.prompt([
176
+ {
177
+ type: 'list',
178
+ name: 'upgradeChoice',
179
+ message: chalk.white('What would you like to do?'),
180
+ choices: [
181
+ {
182
+ name: ` Upgrade to ${upgradeCheck.to} ` + chalk.gray(`(${report.newFiles.length} new, ${report.modifiedFiles.length} updated files)`),
183
+ value: 'upgrade',
184
+ },
185
+ {
186
+ name: ' Dry Run ' + chalk.gray('(Show what would be changed without applying)'),
187
+ value: 'dry-run',
188
+ },
189
+ {
190
+ name: ' Fresh Install ' + chalk.gray('(Reinstall everything, overwrite all files)'),
191
+ value: 'fresh',
192
+ },
193
+ {
194
+ name: ' Cancel ' + chalk.gray('(Exit without changes)'),
195
+ value: 'cancel',
196
+ },
197
+ ],
198
+ },
199
+ ]);
200
+
201
+ if (upgradeChoice === 'cancel') {
202
+ console.log(chalk.yellow('\nInstallation cancelled.'));
203
+ process.exit(0);
204
+ }
205
+
206
+ if (upgradeChoice === 'dry-run') {
207
+ console.log('');
208
+ console.log(brownfieldUpgrader.formatUpgradeReport(report));
209
+ console.log('');
210
+ console.log(chalk.yellow('This was a dry run. No files were changed.'));
211
+ console.log(chalk.gray('Run again and select "Upgrade" to apply changes.'));
212
+ process.exit(0);
213
+ }
214
+
215
+ if (upgradeChoice === 'upgrade') {
216
+ console.log('');
217
+ console.log(chalk.blue('📦 Applying upgrade...'));
218
+
219
+ const result = await brownfieldUpgrader.applyUpgrade(report, sourceDir, projectRoot, { dryRun: false });
220
+
221
+ if (result.success) {
222
+ // Update installed manifest
223
+ const packageJson = require(path.join(context.frameworkLocation, 'package.json'));
224
+ brownfieldUpgrader.updateInstalledManifest(projectRoot, sourceManifest, `aios-core@${packageJson.version}`);
225
+
226
+ console.log(chalk.green('✓') + ` Upgraded ${result.filesInstalled.length} files`);
227
+ if (result.filesSkipped.length > 0) {
228
+ console.log(chalk.yellow('⚠') + ` Preserved ${result.filesSkipped.length} user-modified files`);
229
+ }
230
+ console.log('');
231
+ console.log(chalk.green('✅ Upgrade complete!'));
232
+ console.log(chalk.gray(` From: ${upgradeCheck.from}`));
233
+ console.log(chalk.gray(` To: ${upgradeCheck.to}`));
234
+ process.exit(0);
235
+ } else {
236
+ console.error(chalk.red('✗') + ' Upgrade failed with errors:');
237
+ for (const err of result.errors) {
238
+ console.error(chalk.red(` - ${err.path}: ${err.error}`));
239
+ }
240
+ process.exit(1);
241
+ }
242
+ }
243
+
244
+ // If 'fresh' was selected, continue with normal installation flow below
245
+ if (upgradeChoice === 'fresh') {
246
+ console.log(chalk.yellow('\nProceeding with fresh installation...'));
247
+ console.log('');
248
+ }
249
+ } else {
250
+ console.log(chalk.green(` Current version: ${upgradeCheck.from || 'unknown'}`));
251
+ console.log(chalk.gray(' No upgrade available. You can proceed with fresh install if needed.'));
252
+ console.log('');
253
+ }
254
+ }
255
+
145
256
  // Step 1: Installation Mode
146
257
  console.log(chalk.gray('─'.repeat(80)));
147
258
  const { installMode } = await inquirer.prompt([
@@ -251,6 +362,21 @@ async function main() {
251
362
  if (fs.existsSync(sourceCoreDir)) {
252
363
  await fse.copy(sourceCoreDir, targetCoreDir);
253
364
  console.log(chalk.green('✓') + ' AIOS Core files installed ' + chalk.gray('(11 agents, 68 tasks, 23 templates)'));
365
+
366
+ // Create installed manifest for brownfield upgrades (Story 6.18)
367
+ if (brownfieldUpgrader) {
368
+ try {
369
+ const sourceManifest = brownfieldUpgrader.loadSourceManifest(sourceCoreDir);
370
+ if (sourceManifest) {
371
+ const packageJson = require(path.join(context.frameworkLocation, 'package.json'));
372
+ brownfieldUpgrader.updateInstalledManifest(context.projectRoot, sourceManifest, `aios-core@${packageJson.version}`);
373
+ console.log(chalk.green('✓') + ' Installation manifest created ' + chalk.gray('(enables future upgrades)'));
374
+ }
375
+ } catch (manifestErr) {
376
+ // Non-critical - just log warning
377
+ console.log(chalk.yellow('⚠') + ' Could not create installation manifest ' + chalk.gray('(brownfield upgrades may not work)'));
378
+ }
379
+ }
254
380
  } else {
255
381
  console.error(chalk.red('✗') + ' AIOS Core files not found');
256
382
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aios-core",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "Synkra AIOS: AI-Orchestrated System for Full Stack Development - Core Framework",
5
5
  "main": "index.js",
6
6
  "module": "index.esm.js",
@@ -78,6 +78,9 @@
78
78
  "version:expansion:all:patch": "node tools/bump-all-versions.js patch",
79
79
  "release": "semantic-release",
80
80
  "release:test": "semantic-release --dry-run --no-ci || echo 'Config test complete - authentication errors are expected locally'",
81
+ "generate:manifest": "node scripts/generate-install-manifest.js",
82
+ "validate:manifest": "node scripts/validate-manifest.js",
83
+ "prepublishOnly": "npm run generate:manifest && npm run validate:manifest",
81
84
  "prepare": "echo 'Skipping husky - not needed for NPM publish'"
82
85
  },
83
86
  "dependencies": {