arcvision 0.2.16 → 0.2.20

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 (63) hide show
  1. package/.arcvision/logs/errors.log +5 -0
  2. package/arcvision_context/architecture.authority.ledger.json +6 -63
  3. package/bin/arcvision.js +12 -0
  4. package/package.json +3 -2
  5. package/src/core/artifact-manager.js +143 -0
  6. package/src/core/command-base.js +107 -0
  7. package/src/core/config-validator.js +199 -0
  8. package/src/core/error-handler.js +106 -0
  9. package/src/core/feature-manager.js +218 -0
  10. package/src/core/feedback-generator.js +260 -0
  11. package/src/core/invariant-analyzer.js +22 -2
  12. package/src/core/invariant-detector.js +236 -3
  13. package/src/core/parser.js +85 -1
  14. package/src/core/scanner.js +18 -6
  15. package/src/engine/context_builder.js +21 -3
  16. package/src/engine/context_validator.js +7 -1
  17. package/src/engine/pass1_facts.js +2 -2
  18. package/src/index.js +41 -13
  19. package/test-block-functionality.js +40 -0
  20. package/test-dev-project/.arcvision/invariants.json +19 -0
  21. package/{arcvision_context → test-dev-project/arcvision_context}/README.md +9 -9
  22. package/test-dev-project/arcvision_context/architecture.authority.ledger.json +45 -0
  23. package/{arcvision.context.json → test-dev-project/arcvision_context/arcvision.context.json} +498 -496
  24. package/test-dev-project/src/core/data-service.js +0 -0
  25. package/test-dev-project/src/ui/user-profile.js +0 -0
  26. package/test-dev-project/src/utils/helpers.js +0 -0
  27. package/ARCVISION_DIRECTORY_STRUCTURE.md +0 -104
  28. package/CLI_STRUCTURE.md +0 -110
  29. package/CONFIGURATION.md +0 -119
  30. package/IMPLEMENTATION_SUMMARY.md +0 -99
  31. package/README.md +0 -149
  32. package/architecture.authority.ledger.json +0 -46
  33. package/arcvision-0.2.3.tgz +0 -0
  34. package/arcvision-0.2.4.tgz +0 -0
  35. package/arcvision-0.2.5.tgz +0 -0
  36. package/arcvision.context.diff.json +0 -2181
  37. package/arcvision.context.v1.json +0 -2163
  38. package/arcvision.context.v2.json +0 -2173
  39. package/arcvision_context/arcvision.context.json +0 -6884
  40. package/debug-cycle-detection.js +0 -56
  41. package/docs/ENHANCED_ACCURACY_SAFETY_PROTOCOL.md +0 -172
  42. package/docs/accuracy-enhancement-artifacts/enhanced-validation-config.json +0 -98
  43. package/docs/acig-robustness-guide.md +0 -164
  44. package/docs/authoritative-gate-implementation.md +0 -168
  45. package/docs/blast-radius-implementation.md +0 -76
  46. package/docs/blast-radius.md +0 -44
  47. package/docs/cli-strengthening-summary.md +0 -232
  48. package/docs/invariant-system-summary.md +0 -100
  49. package/docs/invariant-system.md +0 -112
  50. package/generate_large_test.js +0 -42
  51. package/large_test_repo.json +0 -1
  52. package/output1.json +0 -2163
  53. package/output2.json +0 -2163
  54. package/scan_calcom_report.txt +0 -0
  55. package/scan_leafmint_report.txt +0 -0
  56. package/scan_output.txt +0 -0
  57. package/scan_trigger_report.txt +0 -0
  58. package/temp_original.js +0 -0
  59. package/test/determinism-test.js +0 -83
  60. package/test-authoritative-context.js +0 -53
  61. package/test-real-authoritative-context.js +0 -118
  62. package/test-upload-enhancements.js +0 -111
  63. package/verify_engine.js +0 -116
Binary file
Binary file
package/scan_output.txt DELETED
Binary file
Binary file
package/temp_original.js DELETED
File without changes
@@ -1,83 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const { scan } = require('../src/core/scanner');
4
-
5
- /**
6
- * Test to verify that the scanner produces deterministic output
7
- * Run the scanner twice on the same directory and compare outputs
8
- */
9
- async function runDeterminismTest() {
10
- console.log('Running determinism test...');
11
-
12
- try {
13
- // Get the current directory as the test directory
14
- const testDir = process.cwd();
15
-
16
- // Run the scanner twice
17
- const result1 = await scan(testDir);
18
- const result2 = await scan(testDir);
19
-
20
- // Create copies without the generated_at fields for comparison
21
- const result1ForComparison = { ...result1 };
22
- const result2ForComparison = { ...result2 };
23
-
24
- // Remove the generated_at fields as they will differ between runs
25
- delete result1ForComparison.generated_at;
26
- delete result2ForComparison.generated_at;
27
-
28
- // Also remove generated_at from source field if it exists
29
- if (result1ForComparison.source && result1ForComparison.source.generated_at) {
30
- result1ForComparison.source = { ...result1ForComparison.source };
31
- delete result1ForComparison.source.generated_at;
32
- }
33
- if (result2ForComparison.source && result2ForComparison.source.generated_at) {
34
- result2ForComparison.source = { ...result2ForComparison.source };
35
- delete result2ForComparison.source.generated_at;
36
- }
37
-
38
- // Also remove integrity field since it contains hash of the object itself
39
- if (result1ForComparison.integrity) {
40
- delete result1ForComparison.integrity;
41
- }
42
- if (result2ForComparison.integrity) {
43
- delete result2ForComparison.integrity;
44
- }
45
-
46
- // Compare the results as JSON strings
47
- const json1 = JSON.stringify(result1ForComparison, null, 2);
48
- const json2 = JSON.stringify(result2ForComparison, null, 2);
49
-
50
- if (json1 === json2) {
51
- console.log('✅ Determinism test PASSED: Outputs are identical (ignoring timestamp)');
52
- console.log(`Schema version: ${result1.schema_version}`);
53
- console.log(`Generated at (run 1): ${result1.generated_at}`);
54
- console.log(`Generated at (run 2): ${result2.generated_at}`);
55
- console.log(`Nodes: ${result1.nodes.length}`);
56
- console.log(`Edges: ${result1.edges.length}`);
57
- return true;
58
- } else {
59
- console.log('❌ Determinism test FAILED: Outputs differ');
60
-
61
- // Write both outputs to files for comparison
62
- fs.writeFileSync('output1.json', JSON.stringify(result1, null, 2));
63
- fs.writeFileSync('output2.json', JSON.stringify(result2, null, 2));
64
-
65
- console.log('Output 1 written to output1.json');
66
- console.log('Output 2 written to output2.json');
67
- console.log('Run: diff output1.json output2.json');
68
- return false;
69
- }
70
- } catch (error) {
71
- console.error('❌ Determinism test ERROR:', error.message);
72
- return false;
73
- }
74
- }
75
-
76
- // Run the test if this file is executed directly
77
- if (require.main === module) {
78
- runDeterminismTest().then(success => {
79
- process.exit(success ? 0 : 1);
80
- });
81
- }
82
-
83
- module.exports = { runDeterminismTest };
@@ -1,53 +0,0 @@
1
- const { generateAuthoritativeContext } = require('./src/core/structural-context-owner');
2
-
3
- // Test data simulating architecture map
4
- const testArchitectureMap = {
5
- nodes: [
6
- {
7
- path: 'src/lib/utils.ts',
8
- role: 'utility',
9
- layer: 'shared',
10
- signals: {
11
- blast_radius: 62,
12
- criticality: 15.5,
13
- incoming_deps: 62,
14
- outgoing_deps: 5
15
- }
16
- },
17
- {
18
- path: 'src/components/ui/button.tsx',
19
- role: 'component',
20
- layer: 'ui',
21
- signals: {
22
- blast_radius: 49,
23
- criticality: 12.3,
24
- incoming_deps: 49,
25
- outgoing_deps: 3
26
- }
27
- },
28
- {
29
- path: 'src/lib/supabase/client.ts',
30
- role: 'service',
31
- layer: 'data',
32
- signals: {
33
- blast_radius: 45,
34
- criticality: 18.7,
35
- incoming_deps: 45,
36
- outgoing_deps: 8
37
- }
38
- }
39
- ],
40
- edges: []
41
- };
42
-
43
- // Generate authoritative context
44
- const authoritativeContext = generateAuthoritativeContext(testArchitectureMap, {
45
- projectName: 'LEAF_MINT_TEST',
46
- rootPath: '/test/path',
47
- commitHash: 'abc123',
48
- timestamp: new Date().toISOString(),
49
- version: '1.0.0'
50
- });
51
-
52
- console.log('=== AUTHORITATIVE STRUCTURAL CONTEXT ===');
53
- console.log(JSON.stringify(authoritativeContext, null, 2));
@@ -1,118 +0,0 @@
1
- // Test the authoritative context generation with real data
2
- const fs = require('fs');
3
- const path = require('path');
4
-
5
- // Import the actual functions
6
- const { generateAuthoritativeContext } = require('./src/core/structural-context-owner');
7
-
8
- // Create a realistic test architecture map
9
- const testArchitectureMap = {
10
- nodes: [
11
- {
12
- id: 'src/index.ts',
13
- path: 'src/index.ts',
14
- role: 'entrypoint',
15
- layer: 'app',
16
- signals: {
17
- blast_radius: 15,
18
- criticality: 25.5,
19
- incoming_deps: 0,
20
- outgoing_deps: 8
21
- }
22
- },
23
- {
24
- id: 'src/lib/auth.ts',
25
- path: 'src/lib/auth.ts',
26
- role: 'service',
27
- layer: 'business',
28
- signals: {
29
- blast_radius: 12,
30
- criticality: 22.3,
31
- incoming_deps: 12,
32
- outgoing_deps: 5
33
- }
34
- },
35
- {
36
- id: 'src/components/LoginForm.tsx',
37
- path: 'src/components/LoginForm.tsx',
38
- role: 'component',
39
- layer: 'ui',
40
- signals: {
41
- blast_radius: 8,
42
- criticality: 15.7,
43
- incoming_deps: 8,
44
- outgoing_deps: 3
45
- }
46
- },
47
- {
48
- id: 'src/utils/helpers.ts',
49
- path: 'src/utils/helpers.ts',
50
- role: 'utility',
51
- layer: 'shared',
52
- signals: {
53
- blast_radius: 22,
54
- criticality: 31.2,
55
- incoming_deps: 22,
56
- outgoing_deps: 4
57
- }
58
- }
59
- ],
60
- edges: [
61
- { from: 'src/index.ts', to: 'src/lib/auth.ts' },
62
- { from: 'src/index.ts', to: 'src/components/LoginForm.tsx' },
63
- { from: 'src/lib/auth.ts', to: 'src/utils/helpers.ts' },
64
- { from: 'src/components/LoginForm.tsx', to: 'src/lib/auth.ts' },
65
- { from: 'src/components/LoginForm.tsx', to: 'src/utils/helpers.ts' }
66
- ]
67
- };
68
-
69
- console.log('Testing ArcVision Authoritative Context Generation...');
70
- console.log('=====================================================');
71
-
72
- try {
73
- // Generate the authoritative context
74
- const authoritativeContext = generateAuthoritativeContext(testArchitectureMap, {
75
- projectName: 'next-auth-test',
76
- rootPath: '/test/projects/next-auth-test',
77
- commitHash: 'a1b2c3d4e5f6',
78
- timestamp: new Date().toISOString(),
79
- version: '1.0.0'
80
- });
81
-
82
- console.log('\n✅ Authoritative Context Generated Successfully!');
83
- console.log('\nKey Results:');
84
- console.log(`- Language Detected: ${authoritativeContext.system_identity.language}`);
85
- console.log(`- Architectural Archetype: ${authoritativeContext.system_identity.architectural_archetype.primary_type}`);
86
- console.log(`- Confidence Level: ${authoritativeContext.system_identity.architectural_archetype.confidence}`);
87
- console.log(`- Authority Cores Found: ${authoritativeContext.structural_context.authority_cores.length}`);
88
- console.log(`- Structural Hubs Found: ${authoritativeContext.structural_context.structural_hubs.length}`);
89
- console.log(`- Content Hash: ${authoritativeContext.integrity.content_hash.substring(0, 16)}...`);
90
-
91
- // Show some specific insights
92
- if (authoritativeContext.structural_context.authority_cores.length > 0) {
93
- console.log('\nAuthority Cores:');
94
- authoritativeContext.structural_context.authority_cores.forEach(core => {
95
- console.log(` 🔑 ${core.file} (Score: ${core.authority_score})`);
96
- });
97
- }
98
-
99
- if (authoritativeContext.structural_context.structural_hubs.length > 0) {
100
- console.log('\nStructural Hubs:');
101
- authoritativeContext.structural_context.structural_hubs.forEach(hub => {
102
- console.log(` 🔄 ${hub.file} (Blast Radius: ${hub.blast_radius})`);
103
- });
104
- }
105
-
106
- console.log('\nArchitectural Boundaries:');
107
- Object.entries(authoritativeContext.structural_context.architectural_boundaries).forEach(([layer, info]) => {
108
- console.log(` 📁 ${layer}: ${info.files} files, ${info.authority_cores.length} authority cores`);
109
- });
110
-
111
- console.log('\n✅ ArcVision is successfully owning the structural context!');
112
- console.log('This demonstrates that ArcVision generates authoritative,');
113
- console.log('canonical structural context that both AI and humans can trust.');
114
-
115
- } catch (error) {
116
- console.error('❌ Error generating authoritative context:', error.message);
117
- console.error(error.stack);
118
- }
@@ -1,111 +0,0 @@
1
- /**
2
- * Test script to verify the enhanced upload functionality
3
- */
4
-
5
- const { ChunkedUploader } = require('./src/core/chunked-uploader');
6
- const CompressionUtil = require('./src/core/compression');
7
- const ProgressTracker = require('./src/core/progress-tracker');
8
- const RetryHandler = require('./src/core/retry-handler');
9
-
10
- async function runTests() {
11
- console.log('🧪 Testing Enhanced Upload Functionality...\n');
12
-
13
- // Test 1: Compression functionality
14
- console.log('📋 Test 1: Compression functionality');
15
- try {
16
- const testData = {
17
- nodes: Array.from({length: 1000}, (_, i) => ({id: `node-${i}`, name: `Node ${i}`, type: 'component'})),
18
- edges: Array.from({length: 500}, (_, i) => ({from: `node-${i}`, to: `node-${i+1}`})),
19
- metadata: { version: '1.0', generated: new Date().toISOString() }
20
- };
21
-
22
- const originalSize = Buffer.byteLength(JSON.stringify(testData));
23
- console.log(` Original size: ~${Math.round(originalSize / 1024)} KB`);
24
-
25
- const compressed = await CompressionUtil.compress(testData);
26
- const compressedSize = Buffer.byteLength(compressed);
27
- console.log(` Compressed size: ~${Math.round(compressedSize / 1024)} KB`);
28
- console.log(` Compression ratio: ${(originalSize / compressedSize).toFixed(2)}x`);
29
-
30
- const decompressed = await CompressionUtil.decompress(compressed);
31
- console.log(` Decompression successful: ${JSON.stringify(testData) === JSON.stringify(decompressed)}`);
32
- console.log('✅ Compression test passed\n');
33
- } catch (error) {
34
- console.log(`❌ Compression test failed: ${error.message}\n`);
35
- }
36
-
37
- // Test 2: Chunked uploader functionality (without actual upload)
38
- console.log('📋 Test 2: Chunked upload functionality');
39
- try {
40
- const testData = {
41
- nodes: Array.from({length: 100}, (_, i) => ({id: `node-${i}`, name: `Node ${i}`, type: 'component'})),
42
- edges: Array.from({length: 50}, (_, i) => ({from: `node-${i}`, to: `node-${i+1}`})),
43
- metadata: { version: '1.0', generated: new Date().toISOString() }
44
- };
45
-
46
- const uploader = new ChunkedUploader(1024); // Small chunk size for testing
47
- const chunks = uploader.splitIntoChunks(testData);
48
-
49
- console.log(` Original data size: ~${Math.round(uploader.calculateByteSize(testData) / 1024)} KB`);
50
- console.log(` Number of chunks: ${chunks.length}`);
51
- console.log(` Average chunk size: ~${Math.round(chunks.reduce((sum, chunk) => sum + chunk.data.length, 0) / chunks.length)} chars`);
52
-
53
- const reconstructed = uploader.reconstructFromChunks(chunks);
54
- console.log(` Reconstruction successful: ${JSON.stringify(testData) === JSON.stringify(reconstructed)}`);
55
- console.log('✅ Chunked upload test passed\n');
56
- } catch (error) {
57
- console.log(`❌ Chunked upload test failed: ${error.message}\n`);
58
- }
59
-
60
- // Test 3: Progress tracking
61
- console.log('📋 Test 3: Progress tracking functionality');
62
- try {
63
- const tracker = new ProgressTracker(10);
64
-
65
- for (let i = 1; i <= 10; i++) {
66
- tracker.update(i, `Processing step ${i}/10`);
67
- // Simulate work
68
- await new Promise(resolve => setTimeout(resolve, 50));
69
- }
70
-
71
- tracker.complete('All steps completed');
72
- console.log('✅ Progress tracking test passed\n');
73
- } catch (error) {
74
- console.log(`❌ Progress tracking test failed: ${error.message}\n`);
75
- }
76
-
77
- // Test 4: Retry handler functionality
78
- console.log('📋 Test 4: Retry mechanism functionality');
79
- try {
80
- const retryHandler = new RetryHandler(2, 100, 1); // 2 retries, 100ms delay, no backoff
81
-
82
- let attemptCount = 0;
83
- const operation = async () => {
84
- attemptCount++;
85
- if (attemptCount < 2) {
86
- throw new Error('Simulated failure');
87
- }
88
- return { success: true, attempt: attemptCount };
89
- };
90
-
91
- const result = await retryHandler.executeWithRetry(operation, 'test operation');
92
-
93
- console.log(` Attempts made: ${result.attempts}`);
94
- console.log(` Success: ${result.success}`);
95
- console.log(` Final result: ${JSON.stringify(result.result)}`);
96
- console.log('✅ Retry mechanism test passed\n');
97
- } catch (error) {
98
- console.log(`❌ Retry mechanism test failed: ${error.message}\n`);
99
- }
100
-
101
- console.log('🎉 All tests completed!');
102
- console.log('\n🚀 The enhanced upload functionality is ready:');
103
- console.log(' • Compression reduces payload size by 60-80%');
104
- console.log(' • Chunked uploads handle files >3MB');
105
- console.log(' • Progress tracking provides user feedback');
106
- console.log(' • Retry mechanisms handle transient failures');
107
- console.log(' • Server-side support for compressed & chunked uploads');
108
- }
109
-
110
- // Run tests
111
- runTests().catch(console.error);
package/verify_engine.js DELETED
@@ -1,116 +0,0 @@
1
- const { scan } = require('./src/core/scanner');
2
- const path = require('path');
3
- const fs = require('fs');
4
-
5
- async function testEngine() {
6
- try {
7
- console.log("🧪 STARTING ENGINE VERIFICATION...");
8
-
9
- // Target: arcvision-dashboard (sibling directory)
10
- const targetDir = path.resolve(__dirname, '../arcvision-dashboard');
11
-
12
- if (!fs.existsSync(targetDir)) {
13
- console.log(`⚠️ Target directory not found: ${targetDir}`);
14
- console.log("Testing with src/core instead...");
15
-
16
- // Test with local src/core directory
17
- const localTarget = path.resolve(__dirname, './src/core');
18
- if (!fs.existsSync(localTarget)) {
19
- console.error(`❌ Local test directory not found: ${localTarget}`);
20
- process.exit(1);
21
- }
22
- const context = await scan(localTarget);
23
- await validateContext(context);
24
- return;
25
- }
26
-
27
- const context = await scan(targetDir);
28
-
29
- // Validation Checks
30
- console.log("\n🧪 VERIFICATION CHECKS:");
31
-
32
- // 1. Check for Nodes
33
- if (context.nodes.length > 0) {
34
- console.log(`✅ Nodes found: ${context.nodes.length}`);
35
- } else {
36
- console.error("❌ No nodes found!");
37
- }
38
-
39
- // 2. Check for Edges
40
- if (context.edges.length > 0) {
41
- console.log(`✅ Edges found: ${context.edges.length}`);
42
- } else {
43
- console.warn("⚠️ No edges found (might be expected if no dependencies, but unlikely)");
44
- }
45
-
46
- // 3. Check for Pass 3 Roles
47
- const services = context.nodes.filter(n => n.role === 'service' || n.role === 'controller');
48
- if (services.length > 0) {
49
- console.log(`✅ Structural Roles Inferred: Found ${services.length} services/controllers`);
50
- } else {
51
- console.log(`ℹ️ No specific roles inferred (found ${context.nodes.length} total nodes with roles)`);
52
- }
53
-
54
- // 4. Check for Pass 2 Semantic Edges
55
- const semanticEdges = context.edges.filter(e => e.relation === 'calls' || e.relation === 'depends_on');
56
- if (semanticEdges.length > 0) {
57
- console.log(`✅ Semantic Edges Resolved: ${semanticEdges.length} (calls/depends_on)`);
58
- } else {
59
- console.log(`ℹ️ No semantic edges found. ${context.edges.length - semanticEdges.length} import edges only.`);
60
- }
61
-
62
- // 5. Check for Pass 4 Signals
63
- const criticalFiles = context.nodes.filter(n => n.blast_radius > 0);
64
- if (criticalFiles.length > 0) {
65
- console.log(`✅ Signals Computed: ${criticalFiles.length} files have dependencies`);
66
- } else {
67
- console.warn("⚠️ Blast radius appears to be 0 for all files");
68
- }
69
-
70
- console.log("\n✨ VERIFICATION COMPLETE");
71
- process.exit(0);
72
-
73
- } catch (e) {
74
- console.error("❌ VERIFICATION FAILED:", e);
75
- process.exit(1);
76
- }
77
- }
78
-
79
- async function validateContext(context) {
80
- console.log("\n🧪 CONTEXT VALIDATION:");
81
-
82
- // Basic structure checks
83
- if (!context.nodes || !Array.isArray(context.nodes)) {
84
- console.error("❌ Missing or invalid nodes array");
85
- return;
86
- }
87
-
88
- if (!context.edges || !Array.isArray(context.edges)) {
89
- console.error("❌ Missing or invalid edges array");
90
- return;
91
- }
92
-
93
- if (!context.metrics) {
94
- console.error("❌ Missing metrics object");
95
- return;
96
- }
97
-
98
- console.log(`✅ Nodes: ${context.nodes.length}`);
99
- console.log(`✅ Edges: ${context.edges.length}`);
100
- console.log(`✅ Schema version: ${context.schema_version || 'missing'}`);
101
- console.log(`✅ Metrics present: ${!!context.metrics}`);
102
-
103
- // Check for expected multi-pass outputs
104
- const nodesWithRoles = context.nodes.filter(n => n.role);
105
- const nodesWithLayers = context.nodes.filter(n => n.layer);
106
- const nodesWithSignals = context.nodes.filter(n => n.blast_radius !== undefined);
107
-
108
- console.log(`✅ Nodes with roles: ${nodesWithRoles.length}`);
109
- console.log(`✅ Nodes with layers: ${nodesWithLayers.length}`);
110
- console.log(`✅ Nodes with signals: ${nodesWithSignals.length}`);
111
-
112
- console.log("\n✨ VALIDATION COMPLETE");
113
- process.exit(0);
114
- }
115
-
116
- testEngine();