aios-core 4.0.4 → 4.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.
- package/.aios-core/cli/commands/migrate/analyze.js +6 -6
- package/.aios-core/cli/commands/migrate/backup.js +2 -2
- package/.aios-core/cli/commands/migrate/execute.js +4 -4
- package/.aios-core/cli/commands/migrate/index.js +5 -5
- package/.aios-core/cli/commands/migrate/rollback.js +6 -6
- package/.aios-core/cli/commands/migrate/update-imports.js +2 -2
- package/.aios-core/cli/commands/migrate/validate.js +2 -2
- package/.aios-core/cli/commands/pro/index.js +52 -0
- package/.aios-core/cli/index.js +1 -1
- package/.aios-core/core/ids/registry-updater.js +29 -3
- package/.aios-core/core/migration/migration-config.yaml +2 -2
- package/.aios-core/core/migration/module-mapping.yaml +2 -2
- package/.aios-core/core/registry/README.md +2 -2
- package/.aios-core/core/synapse/context/context-builder.js +34 -0
- package/.aios-core/core/synapse/diagnostics/collectors/consistency-collector.js +168 -0
- package/.aios-core/core/synapse/diagnostics/collectors/hook-collector.js +129 -0
- package/.aios-core/core/synapse/diagnostics/collectors/manifest-collector.js +82 -0
- package/.aios-core/core/synapse/diagnostics/collectors/output-analyzer.js +134 -0
- package/.aios-core/core/synapse/diagnostics/collectors/pipeline-collector.js +75 -0
- package/.aios-core/core/synapse/diagnostics/collectors/quality-collector.js +252 -0
- package/.aios-core/core/synapse/diagnostics/collectors/relevance-matrix.js +174 -0
- package/.aios-core/core/synapse/diagnostics/collectors/safe-read-json.js +31 -0
- package/.aios-core/core/synapse/diagnostics/collectors/session-collector.js +102 -0
- package/.aios-core/core/synapse/diagnostics/collectors/timing-collector.js +126 -0
- package/.aios-core/core/synapse/diagnostics/collectors/uap-collector.js +83 -0
- package/.aios-core/core/synapse/diagnostics/report-formatter.js +484 -0
- package/.aios-core/core/synapse/diagnostics/synapse-diagnostics.js +95 -0
- package/.aios-core/core/synapse/engine.js +73 -20
- package/.aios-core/core/synapse/runtime/hook-runtime.js +60 -0
- package/.aios-core/core-config.yaml +6 -0
- package/.aios-core/data/agent-config-requirements.yaml +2 -2
- package/.aios-core/data/aios-kb.md +4 -4
- package/.aios-core/data/entity-registry.yaml +210 -10
- package/.aios-core/data/registry-update-log.jsonl +52 -0
- package/.aios-core/development/agents/architect.md +10 -10
- package/.aios-core/development/agents/devops.md +93 -50
- package/.aios-core/development/agents/qa.md +94 -40
- package/.aios-core/development/agents/ux-design-expert.md +25 -25
- package/.aios-core/development/scripts/activation-runtime.js +63 -0
- package/.aios-core/development/scripts/generate-greeting.js +9 -8
- package/.aios-core/development/scripts/unified-activation-pipeline.js +102 -2
- package/.aios-core/development/tasks/{db-expansion-pack-integration.md → db-squad-integration.md} +5 -5
- package/.aios-core/development/tasks/{integrate-expansion-pack.md → integrate-squad.md} +2 -2
- package/.aios-core/development/tasks/next.md +3 -3
- package/.aios-core/development/tasks/pr-automation.md +2 -2
- package/.aios-core/development/tasks/publish-npm.md +257 -0
- package/.aios-core/development/tasks/release-management.md +4 -4
- package/.aios-core/development/tasks/setup-github.md +1 -1
- package/.aios-core/development/tasks/squad-creator-migrate.md +1 -1
- package/.aios-core/development/tasks/squad-creator-sync-ide-command.md +14 -14
- package/.aios-core/development/tasks/update-aios.md +1 -1
- package/.aios-core/development/tasks/validate-next-story.md +99 -2
- package/.aios-core/docs/standards/AIOS-COLOR-PALETTE-QUICK-REFERENCE.md +1 -1
- package/.aios-core/docs/standards/AIOS-COLOR-PALETTE-V2.1.md +5 -5
- package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO-V2.1-COMPLETE.md +21 -21
- package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO-V2.2-SUMMARY.md +25 -25
- package/.aios-core/docs/standards/OPEN-SOURCE-VS-SERVICE-DIFFERENCES.md +4 -4
- package/.aios-core/docs/standards/QUALITY-GATES-SPECIFICATION.md +3 -3
- package/.aios-core/docs/standards/STANDARDS-INDEX.md +13 -13
- package/.aios-core/docs/standards/STORY-TEMPLATE-V2-SPECIFICATION.md +1 -1
- package/.aios-core/framework-config.yaml +4 -0
- package/.aios-core/infrastructure/scripts/codex-skills-sync/index.js +182 -0
- package/.aios-core/infrastructure/scripts/codex-skills-sync/validate.js +172 -0
- package/.aios-core/infrastructure/scripts/ide-sync/README.md +14 -0
- package/.aios-core/infrastructure/scripts/ide-sync/index.js +6 -0
- package/.aios-core/infrastructure/scripts/tool-resolver.js +4 -4
- package/.aios-core/infrastructure/scripts/validate-paths.js +142 -0
- package/.aios-core/infrastructure/templates/aios-sync.yaml.template +11 -11
- package/.aios-core/infrastructure/templates/github-workflows/README.md +1 -1
- package/.aios-core/install-manifest.yaml +193 -109
- package/.aios-core/local-config.yaml.template +2 -0
- package/.aios-core/manifests/agents.csv +29 -1
- package/.aios-core/manifests/tasks.csv +80 -3
- package/.aios-core/product/README.md +2 -2
- package/.aios-core/product/data/integration-patterns.md +1 -1
- package/.aios-core/product/templates/ide-rules/cline-rules.md +1 -1
- package/.aios-core/product/templates/ide-rules/codex-rules.md +65 -0
- package/.aios-core/product/templates/ide-rules/copilot-rules.md +1 -1
- package/.aios-core/product/templates/ide-rules/roo-rules.md +1 -1
- package/.aios-core/user-guide.md +15 -14
- package/.aios-core/workflow-intelligence/engine/output-formatter.js +1 -1
- package/.claude/hooks/synapse-engine.js +9 -20
- package/README.md +14 -7
- package/bin/aios-init.js +255 -184
- package/bin/aios-minimal.js +2 -2
- package/bin/aios.js +4 -4
- package/package.json +6 -1
- package/packages/aios-pro-cli/bin/aios-pro.js +75 -2
- package/packages/aios-pro-cli/package.json +5 -1
- package/packages/aios-pro-cli/src/recover.js +100 -0
- package/packages/installer/src/__tests__/performance-benchmark.js +382 -0
- package/packages/installer/src/config/ide-configs.js +12 -1
- package/packages/installer/src/config/templates/core-config-template.js +2 -2
- package/packages/installer/src/installer/aios-core-installer.js +2 -2
- package/packages/installer/src/installer/file-hasher.js +97 -0
- package/packages/installer/src/installer/post-install-validator.js +41 -1
- package/packages/installer/src/pro/pro-scaffolder.js +335 -0
- package/packages/installer/src/utils/aios-colors.js +2 -2
- package/packages/installer/src/wizard/feedback.js +1 -1
- package/packages/installer/src/wizard/ide-config-generator.js +2 -2
- package/packages/installer/src/wizard/index.js +58 -19
- package/packages/installer/src/wizard/pro-setup.js +931 -0
- package/packages/installer/src/wizard/questions.js +20 -14
- package/packages/installer/src/wizard/validators.js +1 -1
- package/scripts/code-intel-health-check.js +343 -0
- package/scripts/package-synapse.js +323 -0
- package/scripts/validate-package-completeness.js +317 -0
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Migration Structure Analysis Module
|
|
3
3
|
*
|
|
4
4
|
* Detects v2.0 structure and generates migration plan
|
|
5
|
-
* for v2.0 →
|
|
5
|
+
* for v2.0 → v4.0.4 migration.
|
|
6
6
|
*
|
|
7
7
|
* @module cli/commands/migrate/analyze
|
|
8
8
|
* @version 1.0.0
|
|
9
|
-
* @story 2.14 - Migration Script v2.0 →
|
|
9
|
+
* @story 2.14 - Migration Script v2.0 → v4.0.4
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
const fs = require('fs');
|
|
@@ -14,7 +14,7 @@ const path = require('path');
|
|
|
14
14
|
const { getAllFiles } = require('./backup');
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Module mapping configuration for v2.0 →
|
|
17
|
+
* Module mapping configuration for v2.0 → v4.0.4 migration
|
|
18
18
|
*/
|
|
19
19
|
const MODULE_MAPPING = {
|
|
20
20
|
core: {
|
|
@@ -81,7 +81,7 @@ async function detectV2Structure(projectRoot) {
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
// Check for
|
|
84
|
+
// Check for v4.0.4 modular structure (core, development, product, infrastructure dirs)
|
|
85
85
|
const v21Modules = ['core', 'development', 'product', 'infrastructure'];
|
|
86
86
|
const hasV21Structure = v21Modules.every(module =>
|
|
87
87
|
fs.existsSync(path.join(aiosCoreDir, module)),
|
|
@@ -92,7 +92,7 @@ async function detectV2Structure(projectRoot) {
|
|
|
92
92
|
isV2: false,
|
|
93
93
|
isV21: true,
|
|
94
94
|
version: '2.1',
|
|
95
|
-
message: 'Project already has
|
|
95
|
+
message: 'Project already has v4.0.4 modular structure',
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -211,7 +211,7 @@ async function analyzeMigrationPlan(projectRoot, options = {}) {
|
|
|
211
211
|
plan.totalSize += stats.size;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
// Check for potential conflicts (existing
|
|
214
|
+
// Check for potential conflicts (existing v4.0.4 directories)
|
|
215
215
|
for (const moduleName of Object.keys(plan.modules)) {
|
|
216
216
|
const targetDir = path.join(aiosCoreDir, moduleName);
|
|
217
217
|
if (fs.existsSync(targetDir)) {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Migration Backup Module
|
|
3
3
|
*
|
|
4
4
|
* Handles backup creation, verification, and manifest generation
|
|
5
|
-
* for v2.0 →
|
|
5
|
+
* for v2.0 → v4.0.4 migration.
|
|
6
6
|
*
|
|
7
7
|
* @module cli/commands/migrate/backup
|
|
8
8
|
* @version 1.0.0
|
|
9
|
-
* @story 2.14 - Migration Script v2.0 →
|
|
9
|
+
* @story 2.14 - Migration Script v2.0 → v4.0.4
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
const fs = require('fs');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Migration Execution Module
|
|
3
3
|
*
|
|
4
|
-
* Executes the migration from v2.0 →
|
|
4
|
+
* Executes the migration from v2.0 → v4.0.4 structure.
|
|
5
5
|
*
|
|
6
6
|
* @module cli/commands/migrate/execute
|
|
7
7
|
* @version 1.0.0
|
|
8
|
-
* @story 2.14 - Migration Script v2.0 →
|
|
8
|
+
* @story 2.14 - Migration Script v2.0 → v4.0.4
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
const fs = require('fs');
|
|
@@ -14,7 +14,7 @@ const { copyFileWithMetadata } = require('./backup');
|
|
|
14
14
|
const { MODULE_MAPPING } = require('./analyze');
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Create module directories for
|
|
17
|
+
* Create module directories for v4.0.4 structure
|
|
18
18
|
* @param {string} aiosCoreDir - Path to .aios-core
|
|
19
19
|
* @param {Object} options - Options
|
|
20
20
|
* @returns {Promise<Object>} Created directories
|
|
@@ -102,7 +102,7 @@ async function migrateModule(moduleData, moduleName, aiosCoreDir, options = {})
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
|
-
* Execute full migration from v2.0 to
|
|
105
|
+
* Execute full migration from v2.0 to v4.0.4
|
|
106
106
|
* @param {Object} plan - Migration plan from analyzeMigrationPlan
|
|
107
107
|
* @param {Object} options - Execution options
|
|
108
108
|
* @returns {Promise<Object>} Migration result
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AIOS Migration Command
|
|
3
3
|
*
|
|
4
|
-
* CLI command for migrating from v2.0 to
|
|
4
|
+
* CLI command for migrating from v2.0 to v4.0.4 modular structure.
|
|
5
5
|
*
|
|
6
6
|
* @module cli/commands/migrate
|
|
7
7
|
* @version 1.0.0
|
|
8
|
-
* @story 2.14 - Migration Script v2.0 →
|
|
8
|
+
* @story 2.14 - Migration Script v2.0 → v4.0.4
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
const { Command } = require('commander');
|
|
@@ -91,7 +91,7 @@ async function runMigration(options) {
|
|
|
91
91
|
|
|
92
92
|
if (!versionInfo.isV2) {
|
|
93
93
|
if (versionInfo.isV21) {
|
|
94
|
-
console.log('ℹ️ Project already has
|
|
94
|
+
console.log('ℹ️ Project already has v4.0.4 structure. No migration needed.');
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
console.error(`❌ ${versionInfo.error || 'Cannot detect AIOS version'}`);
|
|
@@ -118,7 +118,7 @@ async function runMigration(options) {
|
|
|
118
118
|
// Check for conflicts
|
|
119
119
|
if (plan.conflicts.length > 0) {
|
|
120
120
|
console.log('');
|
|
121
|
-
console.log('⚠️ Conflicts detected. Some
|
|
121
|
+
console.log('⚠️ Conflicts detected. Some v4.0.4 directories already exist.');
|
|
122
122
|
|
|
123
123
|
if (!yes) {
|
|
124
124
|
const proceed = await askConfirmation('Continue anyway?');
|
|
@@ -363,7 +363,7 @@ function createMigrateCommand() {
|
|
|
363
363
|
const migrate = new Command('migrate');
|
|
364
364
|
|
|
365
365
|
migrate
|
|
366
|
-
.description('Migrate AIOS from v2.0 to
|
|
366
|
+
.description('Migrate AIOS from v2.0 to v4.0.4 modular structure')
|
|
367
367
|
.option('--from <version>', 'Source version', '2.0')
|
|
368
368
|
.option('--to <version>', 'Target version', '2.1')
|
|
369
369
|
.option('--dry-run', 'Show migration plan without executing')
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Migration Rollback Module
|
|
3
3
|
*
|
|
4
|
-
* Handles rollback from
|
|
4
|
+
* Handles rollback from v4.0.4 back to v2.0 structure using backup.
|
|
5
5
|
*
|
|
6
6
|
* @module cli/commands/migrate/rollback
|
|
7
7
|
* @version 1.0.0
|
|
8
|
-
* @story 2.14 - Migration Script v2.0 →
|
|
8
|
+
* @story 2.14 - Migration Script v2.0 → v4.0.4
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
const fs = require('fs');
|
|
@@ -14,7 +14,7 @@ const { findLatestBackup, verifyBackup, copyFileWithMetadata } = require('./back
|
|
|
14
14
|
const { clearMigrationState } = require('./execute');
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Remove
|
|
17
|
+
* Remove v4.0.4 module directories
|
|
18
18
|
* @param {string} aiosCoreDir - Path to .aios-core
|
|
19
19
|
* @param {Object} options - Options
|
|
20
20
|
* @returns {Promise<Object>} Removal result
|
|
@@ -28,7 +28,7 @@ async function removeV21Structure(aiosCoreDir, options = {}) {
|
|
|
28
28
|
errors: [],
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
onProgress({ phase: 'remove', message: '✓ Removing
|
|
31
|
+
onProgress({ phase: 'remove', message: '✓ Removing v4.0.4 structure...' });
|
|
32
32
|
|
|
33
33
|
for (const moduleName of v21Modules) {
|
|
34
34
|
const moduleDir = path.join(aiosCoreDir, moduleName);
|
|
@@ -182,7 +182,7 @@ async function executeRollback(projectRoot, options = {}) {
|
|
|
182
182
|
},
|
|
183
183
|
});
|
|
184
184
|
|
|
185
|
-
// Step 1: Remove
|
|
185
|
+
// Step 1: Remove v4.0.4 structure
|
|
186
186
|
const aiosCoreDir = path.join(projectRoot, '.aios-core');
|
|
187
187
|
result.removal = await removeV21Structure(aiosCoreDir, { onProgress });
|
|
188
188
|
|
|
@@ -273,7 +273,7 @@ function formatRollbackSummary(result) {
|
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
if (result.removal?.removed?.length > 0) {
|
|
276
|
-
lines.push(`Removed: ${result.removal.removed.length}
|
|
276
|
+
lines.push(`Removed: ${result.removal.removed.length} v4.0.4 directories`);
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
return lines.join('\n');
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module cli/commands/migrate/update-imports
|
|
7
7
|
* @version 1.0.0
|
|
8
|
-
* @story 2.14 - Migration Script v2.0 →
|
|
8
|
+
* @story 2.14 - Migration Script v2.0 → v4.0.4
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
const fs = require('fs');
|
|
@@ -86,7 +86,7 @@ async function scanFileImports(filePath) {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
|
-
* Transform an import path from v2.0 to
|
|
89
|
+
* Transform an import path from v2.0 to v4.0.4 structure
|
|
90
90
|
* @param {string} importPath - Original import path
|
|
91
91
|
* @param {string} currentFileModule - Module of the file containing the import
|
|
92
92
|
* @param {string} currentFilePath - Path of the file containing the import
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module cli/commands/migrate/validate
|
|
7
7
|
* @version 1.0.0
|
|
8
|
-
* @story 2.14 - Migration Script v2.0 →
|
|
8
|
+
* @story 2.14 - Migration Script v2.0 → v4.0.4
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
const fs = require('fs');
|
|
@@ -17,7 +17,7 @@ const { verifyImports } = require('./update-imports');
|
|
|
17
17
|
// const { formatSize } = require('./analyze');
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Validate the
|
|
20
|
+
* Validate the v4.0.4 module structure exists
|
|
21
21
|
* @param {string} aiosCoreDir - Path to .aios-core
|
|
22
22
|
* @returns {Promise<Object>} Validation result
|
|
23
23
|
*/
|
|
@@ -214,6 +214,58 @@ async function activateAction(options) {
|
|
|
214
214
|
console.log(` Cache: ${result.cacheValidDays} days offline operation`);
|
|
215
215
|
console.log('');
|
|
216
216
|
|
|
217
|
+
// Scaffold pro content into project (Story INS-3.1)
|
|
218
|
+
// Lazy-load to avoid crashing if pro-scaffolder or js-yaml is unavailable
|
|
219
|
+
const projectRoot = path.resolve(__dirname, '..', '..', '..', '..');
|
|
220
|
+
const proSourceDir = path.join(projectRoot, 'node_modules', '@aios-fullstack', 'pro');
|
|
221
|
+
|
|
222
|
+
if (fs.existsSync(proSourceDir)) {
|
|
223
|
+
let scaffoldProContent;
|
|
224
|
+
try {
|
|
225
|
+
({ scaffoldProContent } = require('../../../../packages/installer/src/pro/pro-scaffolder'));
|
|
226
|
+
} catch {
|
|
227
|
+
console.log('Note: Pro scaffolder not available. Skipping content scaffolding.');
|
|
228
|
+
console.log('');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (scaffoldProContent) {
|
|
232
|
+
console.log('Scaffolding pro content...');
|
|
233
|
+
const scaffoldResult = await scaffoldProContent(projectRoot, proSourceDir, {
|
|
234
|
+
onProgress: ({ item, status, message }) => {
|
|
235
|
+
if (status === 'done') {
|
|
236
|
+
console.log(` + ${message}`);
|
|
237
|
+
} else if (status === 'warning') {
|
|
238
|
+
console.log(` ! ${message}`);
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
if (scaffoldResult.success) {
|
|
244
|
+
console.log(`\nPro content installed (${scaffoldResult.copiedFiles.length} files)`);
|
|
245
|
+
if (scaffoldResult.skippedFiles.length > 0) {
|
|
246
|
+
console.log(` ${scaffoldResult.skippedFiles.length} files unchanged (already up to date)`);
|
|
247
|
+
}
|
|
248
|
+
if (scaffoldResult.warnings.length > 0) {
|
|
249
|
+
for (const warning of scaffoldResult.warnings) {
|
|
250
|
+
console.log(` Warning: ${warning}`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
} else {
|
|
254
|
+
console.error('\nWarning: Pro content scaffolding failed.');
|
|
255
|
+
for (const err of scaffoldResult.errors) {
|
|
256
|
+
console.error(` ${err}`);
|
|
257
|
+
}
|
|
258
|
+
console.error('Pro features are activated but content was not copied.');
|
|
259
|
+
console.error('Try running "aios pro activate" again to retry scaffolding.');
|
|
260
|
+
}
|
|
261
|
+
console.log('');
|
|
262
|
+
}
|
|
263
|
+
} else {
|
|
264
|
+
console.log('Note: @aios-fullstack/pro package not found in node_modules.');
|
|
265
|
+
console.log('Pro content will be scaffolded when the package is installed.');
|
|
266
|
+
console.log('');
|
|
267
|
+
}
|
|
268
|
+
|
|
217
269
|
} catch (error) {
|
|
218
270
|
if (error instanceof LicenseActivationError) {
|
|
219
271
|
console.error(`\nActivation failed: ${error.message}`);
|
package/.aios-core/cli/index.js
CHANGED
|
@@ -54,7 +54,7 @@ Commands:
|
|
|
54
54
|
config Manage layered configuration (show, diff, migrate, validate)
|
|
55
55
|
pro AIOS Pro license management (activate, status, deactivate, features)
|
|
56
56
|
mcp Manage global MCP configuration
|
|
57
|
-
migrate Migrate from v2.0 to
|
|
57
|
+
migrate Migrate from v2.0 to v4.0.4 structure
|
|
58
58
|
generate Generate documents from templates (prd, adr, pmdr, etc.)
|
|
59
59
|
install Install AIOS in current project
|
|
60
60
|
init <name> Create new AIOS project
|
|
@@ -47,7 +47,14 @@ const EXCLUDE_PATTERNS = [
|
|
|
47
47
|
class RegistryUpdater {
|
|
48
48
|
constructor(options = {}) {
|
|
49
49
|
this._registryPath = options.registryPath || REGISTRY_PATH;
|
|
50
|
-
|
|
50
|
+
// Resolve repoRoot to real path to handle macOS /var -> /private/var symlink
|
|
51
|
+
// This ensures path.relative() works correctly with resolved file paths
|
|
52
|
+
const rawRepoRoot = options.repoRoot || REPO_ROOT;
|
|
53
|
+
try {
|
|
54
|
+
this._repoRoot = fs.realpathSync(rawRepoRoot);
|
|
55
|
+
} catch {
|
|
56
|
+
this._repoRoot = rawRepoRoot;
|
|
57
|
+
}
|
|
51
58
|
this._debounceMs = options.debounceMs ?? DEBOUNCE_MS;
|
|
52
59
|
this._auditLogPath = options.auditLogPath || AUDIT_LOG_PATH;
|
|
53
60
|
this._lockFile = options.lockFile || LOCK_FILE;
|
|
@@ -126,9 +133,28 @@ class RegistryUpdater {
|
|
|
126
133
|
const abs = path.isAbsolute(c.filePath)
|
|
127
134
|
? c.filePath
|
|
128
135
|
: path.resolve(this._repoRoot, c.filePath);
|
|
129
|
-
|
|
136
|
+
// For unlink, file doesn't exist so _resolveSymlink returns original path
|
|
137
|
+
// We need to manually resolve the path to match _repoRoot format on macOS
|
|
138
|
+
let resolved = this._resolveSymlink(abs);
|
|
139
|
+
if (c.action === 'unlink' && resolved === abs) {
|
|
140
|
+
// File doesn't exist - normalize path manually for macOS /var -> /private/var
|
|
141
|
+
// This ensures path.relative() works correctly with _repoRoot
|
|
142
|
+
resolved = abs.replace(/^\/var\//, '/private/var/');
|
|
143
|
+
}
|
|
144
|
+
return { action: c.action, filePath: resolved };
|
|
130
145
|
})
|
|
131
|
-
.filter((c) =>
|
|
146
|
+
.filter((c) => {
|
|
147
|
+
// For unlink (delete), skip file existence checks - the file no longer exists
|
|
148
|
+
// We only need to verify the path would be in scope and not excluded
|
|
149
|
+
if (c.action === 'unlink') {
|
|
150
|
+
if (this._isExcluded(c.filePath)) return false;
|
|
151
|
+
// For deletions, check if path matches any known category pattern
|
|
152
|
+
const relPath = path.relative(this._repoRoot, c.filePath).replace(/\\/g, '/');
|
|
153
|
+
return this._detectCategory(relPath) !== null;
|
|
154
|
+
}
|
|
155
|
+
// For add/change, use standard inclusion check
|
|
156
|
+
return !this._isExcluded(c.filePath) && this._isIncluded(c.filePath);
|
|
157
|
+
});
|
|
132
158
|
|
|
133
159
|
if (validChanges.length === 0) return { updated: 0, errors: [] };
|
|
134
160
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# AIOS Migration Configuration
|
|
2
|
-
# Story 2.14 - Migration Script v2.0 →
|
|
2
|
+
# Story 2.14 - Migration Script v2.0 → v4.0.4
|
|
3
3
|
|
|
4
4
|
version: "1.0.0"
|
|
5
5
|
story: "2.14"
|
|
@@ -29,7 +29,7 @@ backup:
|
|
|
29
29
|
algorithm: "md5"
|
|
30
30
|
parallel: true
|
|
31
31
|
|
|
32
|
-
# Module configuration for
|
|
32
|
+
# Module configuration for v4.0.4
|
|
33
33
|
modules:
|
|
34
34
|
core:
|
|
35
35
|
description: "Core framework utilities and runtime"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# AIOS Module Mapping v2.0 →
|
|
1
|
+
# AIOS Module Mapping v2.0 → v4.0.4
|
|
2
2
|
# Story 2.14 - Migration Script
|
|
3
3
|
|
|
4
4
|
version: "1.0.0"
|
|
5
5
|
|
|
6
|
-
# Mapping of v2.0 directories to
|
|
6
|
+
# Mapping of v2.0 directories to v4.0.4 modules
|
|
7
7
|
mapping:
|
|
8
8
|
core:
|
|
9
9
|
source: ".aios-core/"
|
|
@@ -172,8 +172,8 @@ The registry integrates with:
|
|
|
172
172
|
|
|
173
173
|
## Story Reference
|
|
174
174
|
|
|
175
|
-
Created in [Story 2.6 - Service Registry Creation](../../../../docs/stories/
|
|
175
|
+
Created in [Story 2.6 - Service Registry Creation](../../../../docs/stories/v4.0.4/sprint-2/story-2.6-service-registry.md)
|
|
176
176
|
|
|
177
177
|
---
|
|
178
178
|
|
|
179
|
-
*Generated by AIOS Framework
|
|
179
|
+
*Generated by AIOS Framework v4.0.4*
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Build a normalized context payload for SYNAPSE layer execution.
|
|
5
|
+
*
|
|
6
|
+
* Centralizing this shape avoids drift between engine callers and ensures
|
|
7
|
+
* all layers always receive the same contract.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object} params
|
|
10
|
+
* @param {string} params.prompt
|
|
11
|
+
* @param {Object} params.session
|
|
12
|
+
* @param {Object} params.config
|
|
13
|
+
* @param {string} params.synapsePath
|
|
14
|
+
* @param {Object} [params.manifest]
|
|
15
|
+
* @param {Array<Object>} [params.previousLayers]
|
|
16
|
+
* @returns {{prompt: string, session: Object, config: Object, previousLayers: Array<Object>}}
|
|
17
|
+
*/
|
|
18
|
+
function buildLayerContext(params) {
|
|
19
|
+
const safeParams = params || {};
|
|
20
|
+
return {
|
|
21
|
+
prompt: safeParams.prompt || '',
|
|
22
|
+
session: safeParams.session || {},
|
|
23
|
+
config: {
|
|
24
|
+
...(safeParams.config || {}),
|
|
25
|
+
synapsePath: safeParams.synapsePath,
|
|
26
|
+
manifest: safeParams.manifest || {},
|
|
27
|
+
},
|
|
28
|
+
previousLayers: Array.isArray(safeParams.previousLayers) ? safeParams.previousLayers : [],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = {
|
|
33
|
+
buildLayerContext,
|
|
34
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consistency Collector — Cross-validates UAP and Hook metrics for coherence.
|
|
3
|
+
*
|
|
4
|
+
* Performs 4 consistency checks between the two pipeline metrics files:
|
|
5
|
+
* 1. Bracket consistency — Hook bracket matches expected for session state
|
|
6
|
+
* 2. Agent consistency — UAP agentId matches Hook session active_agent
|
|
7
|
+
* 3. Timestamp consistency — Both metrics from same activation window
|
|
8
|
+
* 4. Quality consistency — UAP quality aligns with Hook layer count
|
|
9
|
+
*
|
|
10
|
+
* @module core/synapse/diagnostics/collectors/consistency-collector
|
|
11
|
+
* @version 1.0.0
|
|
12
|
+
* @created Story SYN-14
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
'use strict';
|
|
16
|
+
|
|
17
|
+
const path = require('path');
|
|
18
|
+
const { safeReadJson } = require('./safe-read-json');
|
|
19
|
+
|
|
20
|
+
/** Maximum time gap (ms) between UAP and Hook timestamps to be considered consistent.
|
|
21
|
+
* UAP writes once at activation; Hook writes every prompt. Gaps of several minutes are normal.
|
|
22
|
+
*/
|
|
23
|
+
const MAX_TIMESTAMP_GAP_MS = 10 * 60 * 1000;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Collect cross-pipeline consistency checks.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} projectRoot - Absolute path to project root
|
|
29
|
+
* @returns {{
|
|
30
|
+
* available: boolean,
|
|
31
|
+
* checks: Array<{ name: string, status: string, detail: string }>,
|
|
32
|
+
* score: number,
|
|
33
|
+
* maxScore: number
|
|
34
|
+
* }}
|
|
35
|
+
*/
|
|
36
|
+
function collectConsistencyMetrics(projectRoot) {
|
|
37
|
+
const metricsDir = path.join(projectRoot, '.synapse', 'metrics');
|
|
38
|
+
|
|
39
|
+
const uapData = safeReadJson(path.join(metricsDir, 'uap-metrics.json'));
|
|
40
|
+
const hookData = safeReadJson(path.join(metricsDir, 'hook-metrics.json'));
|
|
41
|
+
|
|
42
|
+
if (!uapData && !hookData) {
|
|
43
|
+
return { available: false, checks: [], score: 0, maxScore: 0 };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// If only one side exists, partial consistency is possible
|
|
47
|
+
if (!uapData || !hookData) {
|
|
48
|
+
return {
|
|
49
|
+
available: true,
|
|
50
|
+
checks: [{
|
|
51
|
+
name: 'data-completeness',
|
|
52
|
+
status: 'WARN',
|
|
53
|
+
detail: !uapData ? 'UAP metrics missing — only Hook available' : 'Hook metrics missing — only UAP available',
|
|
54
|
+
}],
|
|
55
|
+
score: 0,
|
|
56
|
+
maxScore: 4,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const checks = [];
|
|
61
|
+
let score = 0;
|
|
62
|
+
const maxScore = 4;
|
|
63
|
+
|
|
64
|
+
// Check 1: Bracket consistency
|
|
65
|
+
const bracketCheck = _checkBracket(hookData);
|
|
66
|
+
checks.push(bracketCheck);
|
|
67
|
+
if (bracketCheck.status === 'PASS') score++;
|
|
68
|
+
|
|
69
|
+
// Check 2: Agent consistency
|
|
70
|
+
const agentCheck = _checkAgent(uapData, projectRoot);
|
|
71
|
+
checks.push(agentCheck);
|
|
72
|
+
if (agentCheck.status === 'PASS') score++;
|
|
73
|
+
|
|
74
|
+
// Check 3: Timestamp consistency
|
|
75
|
+
const timestampCheck = _checkTimestamp(uapData, hookData);
|
|
76
|
+
checks.push(timestampCheck);
|
|
77
|
+
if (timestampCheck.status === 'PASS') score++;
|
|
78
|
+
|
|
79
|
+
// Check 4: Quality consistency
|
|
80
|
+
const qualityCheck = _checkQuality(uapData, hookData);
|
|
81
|
+
checks.push(qualityCheck);
|
|
82
|
+
if (qualityCheck.status === 'PASS') score++;
|
|
83
|
+
|
|
84
|
+
return { available: true, checks, score, maxScore };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Check 1: Bracket is a known value.
|
|
89
|
+
* @param {Object} hookData
|
|
90
|
+
* @returns {{ name: string, status: string, detail: string }}
|
|
91
|
+
*/
|
|
92
|
+
function _checkBracket(hookData) {
|
|
93
|
+
const validBrackets = ['FRESH', 'MODERATE', 'DEPLETED', 'CRITICAL'];
|
|
94
|
+
const bracket = hookData.bracket;
|
|
95
|
+
if (validBrackets.includes(bracket)) {
|
|
96
|
+
return { name: 'bracket', status: 'PASS', detail: `Hook bracket: ${bracket}` };
|
|
97
|
+
}
|
|
98
|
+
return { name: 'bracket', status: 'FAIL', detail: `Unknown bracket: ${bracket || 'undefined'}` };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Check 2: UAP agentId matches _active-agent.json bridge file.
|
|
103
|
+
* @param {Object} uapData
|
|
104
|
+
* @param {string} projectRoot
|
|
105
|
+
* @returns {{ name: string, status: string, detail: string }}
|
|
106
|
+
*/
|
|
107
|
+
function _checkAgent(uapData, projectRoot) {
|
|
108
|
+
const bridgePath = path.join(projectRoot, '.synapse', 'sessions', '_active-agent.json');
|
|
109
|
+
const bridgeData = safeReadJson(bridgePath);
|
|
110
|
+
|
|
111
|
+
if (!bridgeData || !bridgeData.id) {
|
|
112
|
+
return { name: 'agent', status: 'WARN', detail: 'No active-agent bridge file found' };
|
|
113
|
+
}
|
|
114
|
+
if (uapData.agentId === bridgeData.id) {
|
|
115
|
+
return { name: 'agent', status: 'PASS', detail: `Agent match: ${uapData.agentId}` };
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
name: 'agent',
|
|
119
|
+
status: 'FAIL',
|
|
120
|
+
detail: `UAP agent (${uapData.agentId}) != bridge agent (${bridgeData.id})`,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Check 3: UAP and Hook timestamps are within MAX_TIMESTAMP_GAP_MS.
|
|
126
|
+
* @param {Object} uapData
|
|
127
|
+
* @param {Object} hookData
|
|
128
|
+
* @returns {{ name: string, status: string, detail: string }}
|
|
129
|
+
*/
|
|
130
|
+
function _checkTimestamp(uapData, hookData) {
|
|
131
|
+
if (!uapData.timestamp || !hookData.timestamp) {
|
|
132
|
+
return { name: 'timestamp', status: 'WARN', detail: 'Missing timestamp in one or both metrics' };
|
|
133
|
+
}
|
|
134
|
+
const gap = Math.abs(new Date(uapData.timestamp).getTime() - new Date(hookData.timestamp).getTime());
|
|
135
|
+
if (gap <= MAX_TIMESTAMP_GAP_MS) {
|
|
136
|
+
return { name: 'timestamp', status: 'PASS', detail: `Gap: ${Math.round(gap / 1000)}s (within ${MAX_TIMESTAMP_GAP_MS / 1000}s)` };
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
name: 'timestamp',
|
|
140
|
+
status: 'FAIL',
|
|
141
|
+
detail: `Gap: ${Math.round(gap / 1000)}s (exceeds ${MAX_TIMESTAMP_GAP_MS / 1000}s threshold)`,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Check 4: UAP quality aligns with Hook layer count.
|
|
147
|
+
* 'full' quality should have layers loaded; 'fallback' may have zero.
|
|
148
|
+
* @param {Object} uapData
|
|
149
|
+
* @param {Object} hookData
|
|
150
|
+
* @returns {{ name: string, status: string, detail: string }}
|
|
151
|
+
*/
|
|
152
|
+
function _checkQuality(uapData, hookData) {
|
|
153
|
+
const quality = uapData.quality;
|
|
154
|
+
const layersLoaded = hookData.layersLoaded || 0;
|
|
155
|
+
|
|
156
|
+
if (quality === 'fallback' && layersLoaded > 0) {
|
|
157
|
+
return { name: 'quality', status: 'PASS', detail: `UAP fallback but Hook loaded ${layersLoaded} layers (Hook independent)` };
|
|
158
|
+
}
|
|
159
|
+
if (quality === 'full' && layersLoaded === 0) {
|
|
160
|
+
return { name: 'quality', status: 'WARN', detail: 'UAP full quality but Hook loaded 0 layers' };
|
|
161
|
+
}
|
|
162
|
+
if (quality === 'full' && layersLoaded > 0) {
|
|
163
|
+
return { name: 'quality', status: 'PASS', detail: `UAP ${quality}, Hook ${layersLoaded} layers` };
|
|
164
|
+
}
|
|
165
|
+
return { name: 'quality', status: 'PASS', detail: `UAP ${quality || 'unknown'}, Hook ${layersLoaded} layers` };
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
module.exports = { collectConsistencyMetrics, MAX_TIMESTAMP_GAP_MS };
|