arcvision 0.2.12 → 0.2.15

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 (134) hide show
  1. package/ARCVISION_DIRECTORY_STRUCTURE.md +104 -0
  2. package/CLI_STRUCTURE.md +110 -0
  3. package/CONFIGURATION.md +119 -0
  4. package/IMPLEMENTATION_SUMMARY.md +99 -0
  5. package/README.md +149 -89
  6. package/architecture.authority.ledger.json +46 -0
  7. package/arcvision-0.2.3.tgz +0 -0
  8. package/arcvision-0.2.4.tgz +0 -0
  9. package/arcvision-0.2.5.tgz +0 -0
  10. package/arcvision.context.diff.json +2181 -0
  11. package/arcvision.context.json +1021 -0
  12. package/arcvision.context.v1.json +2163 -0
  13. package/arcvision.context.v2.json +2173 -0
  14. package/arcvision_context/README.md +93 -0
  15. package/arcvision_context/architecture.authority.ledger.json +83 -0
  16. package/arcvision_context/arcvision.context.json +6884 -0
  17. package/debug-cycle-detection.js +56 -0
  18. package/dist/index.js +1626 -25
  19. package/docs/ENHANCED_ACCURACY_SAFETY_PROTOCOL.md +172 -0
  20. package/docs/accuracy-enhancement-artifacts/enhanced-validation-config.json +98 -0
  21. package/docs/acig-robustness-guide.md +164 -0
  22. package/docs/authoritative-gate-implementation.md +168 -0
  23. package/docs/cli-strengthening-summary.md +232 -0
  24. package/docs/invariant-system-summary.md +100 -0
  25. package/docs/invariant-system.md +112 -0
  26. package/generate_large_test.js +42 -0
  27. package/large_test_repo.json +1 -0
  28. package/output1.json +2163 -0
  29. package/output2.json +2163 -0
  30. package/package.json +46 -36
  31. package/scan_calcom_report.txt +0 -0
  32. package/scan_leafmint_report.txt +0 -0
  33. package/scan_output.txt +0 -0
  34. package/scan_trigger_report.txt +0 -0
  35. package/schema/arcvision_context_schema_v1.json +136 -1
  36. package/src/arcvision-guard.js +433 -0
  37. package/src/core/authority-core-detector.js +382 -0
  38. package/src/core/authority-ledger.js +300 -0
  39. package/src/core/blastRadius.js +299 -0
  40. package/src/core/call-resolver.js +196 -0
  41. package/src/core/change-evaluator.js +509 -0
  42. package/src/core/change-evaluator.js.backup +424 -0
  43. package/src/core/change-evaluator.ts +285 -0
  44. package/src/core/chunked-uploader.js +180 -0
  45. package/src/core/circular-dependency-detector.js +404 -0
  46. package/src/core/cli-error-handler.js +458 -0
  47. package/src/core/cli-validator.js +458 -0
  48. package/src/core/compression.js +64 -0
  49. package/src/core/context_builder.js +741 -0
  50. package/src/core/dependency-manager.js +134 -0
  51. package/src/core/di-detector.js +202 -0
  52. package/src/core/diff-analyzer.js +76 -0
  53. package/src/core/example-invariants.js +135 -0
  54. package/src/core/failure-mode-synthesizer.js +341 -0
  55. package/src/core/invariant-analyzer.js +294 -0
  56. package/src/core/invariant-detector.js +548 -0
  57. package/src/core/invariant-enforcer.js +171 -0
  58. package/src/core/invariant-evaluation-utils.js +172 -0
  59. package/src/core/invariant-hooks.js +152 -0
  60. package/src/core/invariant-integration-example.js +186 -0
  61. package/src/core/invariant-registry.js +298 -0
  62. package/src/core/invariant-registry.ts +100 -0
  63. package/src/core/invariant-types.js +66 -0
  64. package/src/core/invariants-index.js +88 -0
  65. package/src/core/method-tracker.js +170 -0
  66. package/src/core/override-handler.js +304 -0
  67. package/src/core/ownership-resolver.js +227 -0
  68. package/src/core/parser-enhanced.js +80 -0
  69. package/src/core/parser.js +610 -0
  70. package/src/core/path-resolver.js +240 -0
  71. package/src/core/pattern-matcher.js +246 -0
  72. package/src/core/progress-tracker.js +71 -0
  73. package/src/core/react-nextjs-detector.js +245 -0
  74. package/src/core/readme-generator.js +167 -0
  75. package/src/core/retry-handler.js +57 -0
  76. package/src/core/scanner.js +289 -0
  77. package/src/core/semantic-analyzer.js +204 -0
  78. package/src/core/structural-context-owner.js +442 -0
  79. package/src/core/symbol-indexer.js +164 -0
  80. package/src/core/tsconfig-utils.js +73 -0
  81. package/src/core/type-analyzer.js +272 -0
  82. package/src/core/watcher.js +18 -0
  83. package/src/core/workspace-scanner.js +88 -0
  84. package/src/engine/context_builder.js +280 -0
  85. package/src/engine/context_sorter.js +59 -0
  86. package/src/engine/context_validator.js +200 -0
  87. package/src/engine/id-generator.js +16 -0
  88. package/src/engine/pass1_facts.js +260 -0
  89. package/src/engine/pass2_semantics.js +333 -0
  90. package/src/engine/pass3_lifter.js +99 -0
  91. package/src/engine/pass4_signals.js +201 -0
  92. package/src/index.js +830 -0
  93. package/src/plugins/express-plugin.js +48 -0
  94. package/src/plugins/plugin-manager.js +58 -0
  95. package/src/plugins/react-plugin.js +54 -0
  96. package/temp_original.js +0 -0
  97. package/test/determinism-test.js +83 -0
  98. package/test-authoritative-context.js +53 -0
  99. package/test-real-authoritative-context.js +118 -0
  100. package/test-upload-enhancements.js +111 -0
  101. package/test_repos/allowed-clean-architecture/.arcvision/invariants.json +57 -0
  102. package/test_repos/allowed-clean-architecture/adapters/controllers/UserController.js +95 -0
  103. package/test_repos/allowed-clean-architecture/adapters/http/HttpServer.js +78 -0
  104. package/test_repos/allowed-clean-architecture/application/dtos/CreateUserRequest.js +37 -0
  105. package/test_repos/allowed-clean-architecture/application/services/UserService.js +61 -0
  106. package/test_repos/allowed-clean-architecture/arcvision_context/README.md +93 -0
  107. package/test_repos/allowed-clean-architecture/arcvision_context/arcvision.context.json +2796 -0
  108. package/test_repos/allowed-clean-architecture/domain/interfaces/UserRepository.js +25 -0
  109. package/test_repos/allowed-clean-architecture/domain/models/User.js +39 -0
  110. package/test_repos/allowed-clean-architecture/index.js +45 -0
  111. package/test_repos/allowed-clean-architecture/infrastructure/database/DatabaseConnection.js +56 -0
  112. package/test_repos/allowed-clean-architecture/infrastructure/repositories/InMemoryUserRepository.js +61 -0
  113. package/test_repos/allowed-clean-architecture/package.json +15 -0
  114. package/test_repos/blocked-legacy-monolith/.arcvision/invariants.json +78 -0
  115. package/test_repos/blocked-legacy-monolith/arcvision_context/README.md +93 -0
  116. package/test_repos/blocked-legacy-monolith/arcvision_context/arcvision.context.json +2882 -0
  117. package/test_repos/blocked-legacy-monolith/database/dbConnection.js +35 -0
  118. package/test_repos/blocked-legacy-monolith/index.js +38 -0
  119. package/test_repos/blocked-legacy-monolith/modules/emailService.js +31 -0
  120. package/test_repos/blocked-legacy-monolith/modules/paymentProcessor.js +37 -0
  121. package/test_repos/blocked-legacy-monolith/package.json +15 -0
  122. package/test_repos/blocked-legacy-monolith/shared/utils.js +19 -0
  123. package/test_repos/blocked-legacy-monolith/utils/helpers.js +23 -0
  124. package/test_repos/risky-microservices-concerns/.arcvision/invariants.json +69 -0
  125. package/test_repos/risky-microservices-concerns/arcvision_context/README.md +93 -0
  126. package/test_repos/risky-microservices-concerns/arcvision_context/arcvision.context.json +3070 -0
  127. package/test_repos/risky-microservices-concerns/common/utils.js +77 -0
  128. package/test_repos/risky-microservices-concerns/gateways/apiGateway.js +84 -0
  129. package/test_repos/risky-microservices-concerns/index.js +20 -0
  130. package/test_repos/risky-microservices-concerns/libs/deprecatedHelper.js +36 -0
  131. package/test_repos/risky-microservices-concerns/package.json +15 -0
  132. package/test_repos/risky-microservices-concerns/services/orderService.js +42 -0
  133. package/test_repos/risky-microservices-concerns/services/userService.js +48 -0
  134. package/verify_engine.js +116 -0
@@ -0,0 +1,35 @@
1
+ // Database Connection Module
2
+ // This violates architectural rules by importing utility functions
3
+
4
+ const utils = require('../utils/helpers');
5
+ const fs = require('fs');
6
+
7
+ class DBConnection {
8
+ constructor() {
9
+ this.connectionString = 'mysql://localhost:3306/mydb';
10
+ // Violation: Database layer importing utility functions
11
+ this.logger = utils.createLogger('database');
12
+ }
13
+
14
+ async query(sql, params) {
15
+ // Database query logic
16
+ this.logger.info(`Executing query: ${sql}`);
17
+ return { rows: [], rowCount: 0 };
18
+ }
19
+
20
+ async executePayment(amount, userId) {
21
+ // Payment execution logic
22
+ const transactionId = utils.generateTransactionId();
23
+ this.logger.info(`Processing payment ${transactionId}`);
24
+
25
+ return {
26
+ id: transactionId,
27
+ amount,
28
+ userId,
29
+ userEmail: 'user@example.com',
30
+ paymentId: utils.generateId()
31
+ };
32
+ }
33
+ }
34
+
35
+ module.exports = new DBConnection();
@@ -0,0 +1,38 @@
1
+ // Main Application Entry Point
2
+ // Legacy monolith with architectural violations
3
+
4
+ const express = require('express');
5
+ const emailService = require('./modules/emailService');
6
+ const paymentProcessor = require('./modules/paymentProcessor');
7
+ const db = require('./database/dbConnection');
8
+
9
+ const app = express();
10
+ const PORT = 3000;
11
+
12
+ app.use(express.json());
13
+
14
+ // Violation: UI layer accessing database directly
15
+ app.get('/payments/:id', async (req, res) => {
16
+ try {
17
+ // Direct database access from "UI" endpoint
18
+ const payment = await db.query('SELECT * FROM payments WHERE id = ?', [req.params.id]);
19
+ res.json(payment);
20
+ } catch (error) {
21
+ res.status(500).json({ error: error.message });
22
+ }
23
+ });
24
+
25
+ app.post('/process-payment', async (req, res) => {
26
+ try {
27
+ const { amount, userId } = req.body;
28
+ const result = await paymentProcessor.processPayment(amount, userId);
29
+ res.json(result);
30
+ } catch (error) {
31
+ res.status(500).json({ error: error.message });
32
+ }
33
+ });
34
+
35
+ app.listen(PORT, () => {
36
+ console.log(`Legacy monolith server running on port ${PORT}`);
37
+ console.log('WARNING: This application contains multiple architectural violations!');
38
+ });
@@ -0,0 +1,31 @@
1
+ // Email Service Module - Part of legacy monolith
2
+ // This module violates architectural rules by importing from database layer directly
3
+
4
+ const database = require('../database/dbConnection');
5
+ const paymentProcessor = require('./paymentProcessor');
6
+
7
+ class EmailService {
8
+ constructor() {
9
+ this.db = database;
10
+ this.paymentProcessor = paymentProcessor;
11
+ }
12
+
13
+ async sendPaymentConfirmation(email, paymentId) {
14
+ // Violation 1: Direct database access from service layer
15
+ const payment = await this.db.query(`SELECT * FROM payments WHERE id = ?`, [paymentId]);
16
+
17
+ // Violation 2: Circular dependency - emailService imports paymentProcessor
18
+ // and paymentProcessor imports emailService (created below)
19
+ await this.paymentProcessor.processEmailNotification(payment);
20
+
21
+ // Send email logic here
22
+ console.log(`Sending payment confirmation to ${email}`);
23
+ }
24
+
25
+ async sendWelcomeEmail(user) {
26
+ // More email sending logic
27
+ console.log(`Sending welcome email to ${user.email}`);
28
+ }
29
+ }
30
+
31
+ module.exports = new EmailService();
@@ -0,0 +1,37 @@
1
+ // Payment Processor Module - Part of legacy monolith
2
+ // This creates circular dependency with emailService
3
+
4
+ const emailService = require('./emailService');
5
+ const database = require('../database/dbConnection');
6
+ const sharedUtils = require('../shared/utils');
7
+
8
+ class PaymentProcessor {
9
+ constructor() {
10
+ this.emailService = emailService;
11
+ this.db = database;
12
+ }
13
+
14
+ async processPayment(amount, userId) {
15
+ // Violation 1: Importing from shared directory (forbidden)
16
+ const transactionId = sharedUtils.generateId();
17
+
18
+ // Process payment logic
19
+ const result = await this.db.executePayment(amount, userId);
20
+
21
+ // Violation 2: Circular dependency - paymentProcessor imports emailService
22
+ await this.emailService.sendPaymentConfirmation(result.userEmail, result.paymentId);
23
+
24
+ return {
25
+ transactionId,
26
+ amount,
27
+ status: 'completed'
28
+ };
29
+ }
30
+
31
+ async processEmailNotification(payment) {
32
+ // Email notification logic
33
+ console.log(`Processing email notification for payment ${payment.id}`);
34
+ }
35
+ }
36
+
37
+ module.exports = new PaymentProcessor();
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "blocked-legacy-monolith",
3
+ "version": "1.0.0",
4
+ "description": "Legacy monolith with architectural violations for ArcVision testing",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "start": "node index.js",
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "dependencies": {
11
+ "express": "^4.18.2"
12
+ },
13
+ "author": "ArcVision Test Suite",
14
+ "license": "MIT"
15
+ }
@@ -0,0 +1,19 @@
1
+ // Shared Utilities - These should not be imported by modules according to architecture rules
2
+
3
+ function generateId() {
4
+ return Math.random().toString(36).substr(2, 9);
5
+ }
6
+
7
+ function formatDate(date) {
8
+ return date.toISOString();
9
+ }
10
+
11
+ function validateEmail(email) {
12
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
13
+ }
14
+
15
+ module.exports = {
16
+ generateId,
17
+ formatDate,
18
+ validateEmail
19
+ };
@@ -0,0 +1,23 @@
1
+ // Utility Helpers - These should not be imported by database layer
2
+
3
+ function createLogger(name) {
4
+ return {
5
+ info: (message) => console.log(`[${name}] INFO: ${message}`),
6
+ error: (message) => console.error(`[${name}] ERROR: ${message}`)
7
+ };
8
+ }
9
+
10
+ function generateTransactionId() {
11
+ return `txn_${Date.now()}_${Math.random().toString(36).substr(2, 5)}`;
12
+ }
13
+
14
+ function sanitizeInput(input) {
15
+ // Input sanitization logic
16
+ return input.replace(/[^a-zA-Z0-9]/g, '');
17
+ }
18
+
19
+ module.exports = {
20
+ createLogger,
21
+ generateTransactionId,
22
+ sanitizeInput
23
+ };
@@ -0,0 +1,69 @@
1
+ {
2
+ "version": "1.0",
3
+ "project_specific_invariants": [
4
+ {
5
+ "id": "limit-common-module-size",
6
+ "system": "risky-microservices-concerns",
7
+ "description": "Common modules should not grow beyond reasonable size limits",
8
+ "severity": "risk",
9
+ "scope": {
10
+ "files": ["common/*"]
11
+ },
12
+ "rule": {
13
+ "type": "pattern",
14
+ "condition": {
15
+ "pattern": "TODO.*refactor|FIXME.*split"
16
+ }
17
+ }
18
+ },
19
+ {
20
+ "id": "avoid-service-interdependence",
21
+ "system": "risky-microservices-concerns",
22
+ "description": "Services should minimize direct dependencies on each other",
23
+ "severity": "risk",
24
+ "scope": {
25
+ "files": ["services/*"]
26
+ },
27
+ "rule": {
28
+ "type": "dependency",
29
+ "condition": {
30
+ "forbiddenDependency": {
31
+ "from": "userService",
32
+ "to": "orderService"
33
+ }
34
+ }
35
+ }
36
+ },
37
+ {
38
+ "id": "gateway-complexity-warning",
39
+ "system": "risky-microservices-concerns",
40
+ "description": "Gateway modules approaching concerning complexity levels",
41
+ "severity": "risk",
42
+ "scope": {
43
+ "files": ["gateways/*"]
44
+ },
45
+ "rule": {
46
+ "type": "pattern",
47
+ "condition": {
48
+ "pattern": "complexRoutingLogic|manualLoadBalancing"
49
+ }
50
+ }
51
+ },
52
+ {
53
+ "id": "library-version-drift",
54
+ "system": "risky-microservices-concerns",
55
+ "description": "Libraries showing signs of version drift or inconsistent usage",
56
+ "severity": "risk",
57
+ "scope": {
58
+ "files": ["libs/*"]
59
+ },
60
+ "rule": {
61
+ "type": "existence",
62
+ "condition": {
63
+ "mustExist": "deprecatedHelper.js"
64
+ }
65
+ }
66
+ }
67
+ ],
68
+ "generated_at": "2026-01-22T12:00:00Z"
69
+ }
@@ -0,0 +1,93 @@
1
+ # ArcVision System Context Artifact
2
+
3
+
4
+ ## What This Is [arcvision.context.json](./arcvision.context.json)
5
+
6
+ This file is the **canonical structural context** of this codebase.
7
+ It represents how the system actually works — not how it is described.
8
+
9
+ It is generated directly from source code by ArcVision.
10
+
11
+ ## What This Replaces
12
+
13
+ This artifact replaces:
14
+ - Manual repository scanning
15
+ - Tribal knowledge held by senior engineers
16
+ - Re-explaining the system to new developers
17
+ - Re-prompting LLMs with partial or incorrect context
18
+ - Guessing blast radius of changes
19
+
20
+ ## When You Must Use This
21
+
22
+ Use this artifact when:
23
+ - Onboarding a new developer
24
+ - Prompting an AI assistant about this codebase
25
+ - Making architectural changes
26
+ - Investigating unexpected behavior
27
+ - Assessing risk before modifying core modules
28
+
29
+ ## What This Artifact Contains
30
+
31
+ - Canonical module and dependency graph
32
+ - Execution and data flow relationships
33
+ - Structural roles (service, store, boundary, etc.)
34
+ - Invariants inferred from the system
35
+ - Impact metrics (blast radius, coupling)
36
+ - Authority core identification
37
+ - Hidden coupling detection
38
+ - Architectural archetype classification
39
+ - Analysis completeness metrics
40
+
41
+ ## Determinism & Trust
42
+
43
+ - Generated from commit: ae164d81a70b781ce2aa48702aa493acc245b50c
44
+ - Generation timestamp: 2026-01-22T06:51:00.837Z
45
+ - Tool version: 0.2.14
46
+ - Deterministic: same input → same output
47
+ - Explicit assumptions listed inside the artifact
48
+
49
+ If this artifact conflicts with human memory, **trust the artifact**.
50
+
51
+ ## Structural Context Hubs
52
+
53
+ The following files have the highest blast radius and represent critical structural hubs in the system:
54
+
55
+ - **services/orderService.js**
56
+ - Blast Radius: 3 files (42.86% of codebase)
57
+ - Risk: Changes here may silently propagate across the system.
58
+
59
+ - **services/userService.js**
60
+ - Blast Radius: 3 files (42.86% of codebase)
61
+ - Risk: Acts as a coordination layer between components.
62
+
63
+ - **common/utils.js**
64
+ - Blast Radius: 2 files (28.57% of codebase)
65
+ - Risk: Modifications can cause widespread inconsistencies.
66
+
67
+
68
+
69
+ ## How to Use With AI
70
+
71
+ When prompting AI tools, include this file as system context.
72
+ Do not ask the AI to infer architecture without it.
73
+
74
+ ## When to Regenerate
75
+
76
+ Regenerate this artifact when:
77
+ - Core modules change
78
+ - New services are added
79
+ - Dependency structure shifts
80
+
81
+ Run:
82
+
83
+ ```
84
+ arcvision scan --upload
85
+ ```
86
+
87
+ ## Source of Truth
88
+
89
+ This artifact is the **source of truth** for system structure.
90
+ All explanations, decisions, and AI reasoning should reference it.
91
+
92
+ Some execution script invocations are dynamically assembled at runtime and may not be statically traceable; such scripts are included
93
+ as execution boundaries without guaranteed call-site resolution