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.
- package/ARCVISION_DIRECTORY_STRUCTURE.md +104 -0
- package/CLI_STRUCTURE.md +110 -0
- package/CONFIGURATION.md +119 -0
- package/IMPLEMENTATION_SUMMARY.md +99 -0
- package/README.md +149 -89
- package/architecture.authority.ledger.json +46 -0
- package/arcvision-0.2.3.tgz +0 -0
- package/arcvision-0.2.4.tgz +0 -0
- package/arcvision-0.2.5.tgz +0 -0
- package/arcvision.context.diff.json +2181 -0
- package/arcvision.context.json +1021 -0
- package/arcvision.context.v1.json +2163 -0
- package/arcvision.context.v2.json +2173 -0
- package/arcvision_context/README.md +93 -0
- package/arcvision_context/architecture.authority.ledger.json +83 -0
- package/arcvision_context/arcvision.context.json +6884 -0
- package/debug-cycle-detection.js +56 -0
- package/dist/index.js +1626 -25
- package/docs/ENHANCED_ACCURACY_SAFETY_PROTOCOL.md +172 -0
- package/docs/accuracy-enhancement-artifacts/enhanced-validation-config.json +98 -0
- package/docs/acig-robustness-guide.md +164 -0
- package/docs/authoritative-gate-implementation.md +168 -0
- package/docs/cli-strengthening-summary.md +232 -0
- package/docs/invariant-system-summary.md +100 -0
- package/docs/invariant-system.md +112 -0
- package/generate_large_test.js +42 -0
- package/large_test_repo.json +1 -0
- package/output1.json +2163 -0
- package/output2.json +2163 -0
- package/package.json +46 -36
- package/scan_calcom_report.txt +0 -0
- package/scan_leafmint_report.txt +0 -0
- package/scan_output.txt +0 -0
- package/scan_trigger_report.txt +0 -0
- package/schema/arcvision_context_schema_v1.json +136 -1
- package/src/arcvision-guard.js +433 -0
- package/src/core/authority-core-detector.js +382 -0
- package/src/core/authority-ledger.js +300 -0
- package/src/core/blastRadius.js +299 -0
- package/src/core/call-resolver.js +196 -0
- package/src/core/change-evaluator.js +509 -0
- package/src/core/change-evaluator.js.backup +424 -0
- package/src/core/change-evaluator.ts +285 -0
- package/src/core/chunked-uploader.js +180 -0
- package/src/core/circular-dependency-detector.js +404 -0
- package/src/core/cli-error-handler.js +458 -0
- package/src/core/cli-validator.js +458 -0
- package/src/core/compression.js +64 -0
- package/src/core/context_builder.js +741 -0
- package/src/core/dependency-manager.js +134 -0
- package/src/core/di-detector.js +202 -0
- package/src/core/diff-analyzer.js +76 -0
- package/src/core/example-invariants.js +135 -0
- package/src/core/failure-mode-synthesizer.js +341 -0
- package/src/core/invariant-analyzer.js +294 -0
- package/src/core/invariant-detector.js +548 -0
- package/src/core/invariant-enforcer.js +171 -0
- package/src/core/invariant-evaluation-utils.js +172 -0
- package/src/core/invariant-hooks.js +152 -0
- package/src/core/invariant-integration-example.js +186 -0
- package/src/core/invariant-registry.js +298 -0
- package/src/core/invariant-registry.ts +100 -0
- package/src/core/invariant-types.js +66 -0
- package/src/core/invariants-index.js +88 -0
- package/src/core/method-tracker.js +170 -0
- package/src/core/override-handler.js +304 -0
- package/src/core/ownership-resolver.js +227 -0
- package/src/core/parser-enhanced.js +80 -0
- package/src/core/parser.js +610 -0
- package/src/core/path-resolver.js +240 -0
- package/src/core/pattern-matcher.js +246 -0
- package/src/core/progress-tracker.js +71 -0
- package/src/core/react-nextjs-detector.js +245 -0
- package/src/core/readme-generator.js +167 -0
- package/src/core/retry-handler.js +57 -0
- package/src/core/scanner.js +289 -0
- package/src/core/semantic-analyzer.js +204 -0
- package/src/core/structural-context-owner.js +442 -0
- package/src/core/symbol-indexer.js +164 -0
- package/src/core/tsconfig-utils.js +73 -0
- package/src/core/type-analyzer.js +272 -0
- package/src/core/watcher.js +18 -0
- package/src/core/workspace-scanner.js +88 -0
- package/src/engine/context_builder.js +280 -0
- package/src/engine/context_sorter.js +59 -0
- package/src/engine/context_validator.js +200 -0
- package/src/engine/id-generator.js +16 -0
- package/src/engine/pass1_facts.js +260 -0
- package/src/engine/pass2_semantics.js +333 -0
- package/src/engine/pass3_lifter.js +99 -0
- package/src/engine/pass4_signals.js +201 -0
- package/src/index.js +830 -0
- package/src/plugins/express-plugin.js +48 -0
- package/src/plugins/plugin-manager.js +58 -0
- package/src/plugins/react-plugin.js +54 -0
- package/temp_original.js +0 -0
- package/test/determinism-test.js +83 -0
- package/test-authoritative-context.js +53 -0
- package/test-real-authoritative-context.js +118 -0
- package/test-upload-enhancements.js +111 -0
- package/test_repos/allowed-clean-architecture/.arcvision/invariants.json +57 -0
- package/test_repos/allowed-clean-architecture/adapters/controllers/UserController.js +95 -0
- package/test_repos/allowed-clean-architecture/adapters/http/HttpServer.js +78 -0
- package/test_repos/allowed-clean-architecture/application/dtos/CreateUserRequest.js +37 -0
- package/test_repos/allowed-clean-architecture/application/services/UserService.js +61 -0
- package/test_repos/allowed-clean-architecture/arcvision_context/README.md +93 -0
- package/test_repos/allowed-clean-architecture/arcvision_context/arcvision.context.json +2796 -0
- package/test_repos/allowed-clean-architecture/domain/interfaces/UserRepository.js +25 -0
- package/test_repos/allowed-clean-architecture/domain/models/User.js +39 -0
- package/test_repos/allowed-clean-architecture/index.js +45 -0
- package/test_repos/allowed-clean-architecture/infrastructure/database/DatabaseConnection.js +56 -0
- package/test_repos/allowed-clean-architecture/infrastructure/repositories/InMemoryUserRepository.js +61 -0
- package/test_repos/allowed-clean-architecture/package.json +15 -0
- package/test_repos/blocked-legacy-monolith/.arcvision/invariants.json +78 -0
- package/test_repos/blocked-legacy-monolith/arcvision_context/README.md +93 -0
- package/test_repos/blocked-legacy-monolith/arcvision_context/arcvision.context.json +2882 -0
- package/test_repos/blocked-legacy-monolith/database/dbConnection.js +35 -0
- package/test_repos/blocked-legacy-monolith/index.js +38 -0
- package/test_repos/blocked-legacy-monolith/modules/emailService.js +31 -0
- package/test_repos/blocked-legacy-monolith/modules/paymentProcessor.js +37 -0
- package/test_repos/blocked-legacy-monolith/package.json +15 -0
- package/test_repos/blocked-legacy-monolith/shared/utils.js +19 -0
- package/test_repos/blocked-legacy-monolith/utils/helpers.js +23 -0
- package/test_repos/risky-microservices-concerns/.arcvision/invariants.json +69 -0
- package/test_repos/risky-microservices-concerns/arcvision_context/README.md +93 -0
- package/test_repos/risky-microservices-concerns/arcvision_context/arcvision.context.json +3070 -0
- package/test_repos/risky-microservices-concerns/common/utils.js +77 -0
- package/test_repos/risky-microservices-concerns/gateways/apiGateway.js +84 -0
- package/test_repos/risky-microservices-concerns/index.js +20 -0
- package/test_repos/risky-microservices-concerns/libs/deprecatedHelper.js +36 -0
- package/test_repos/risky-microservices-concerns/package.json +15 -0
- package/test_repos/risky-microservices-concerns/services/orderService.js +42 -0
- package/test_repos/risky-microservices-concerns/services/userService.js +48 -0
- package/verify_engine.js +116 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Express HTTP Server - Clean architecture adapter
|
|
2
|
+
|
|
3
|
+
const express = require('express');
|
|
4
|
+
const UserController = require('./controllers/UserController');
|
|
5
|
+
|
|
6
|
+
class HttpServer {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.app = express();
|
|
9
|
+
this.userController = new UserController();
|
|
10
|
+
this.setupMiddleware();
|
|
11
|
+
this.setupRoutes();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
setupMiddleware() {
|
|
15
|
+
this.app.use(express.json());
|
|
16
|
+
this.app.use(express.urlencoded({ extended: true }));
|
|
17
|
+
|
|
18
|
+
// Logging middleware
|
|
19
|
+
this.app.use((req, res, next) => {
|
|
20
|
+
console.log(`${new Date().toISOString()} - ${req.method} ${req.path}`);
|
|
21
|
+
next();
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
setupRoutes() {
|
|
26
|
+
// Health check endpoint
|
|
27
|
+
this.app.get('/health', (req, res) => {
|
|
28
|
+
res.json({ status: 'ok', timestamp: new Date().toISOString() });
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// User routes
|
|
32
|
+
this.app.post('/api/users', (req, res) =>
|
|
33
|
+
this.userController.createUser(req, res));
|
|
34
|
+
|
|
35
|
+
this.app.get('/api/users/:id', (req, res) =>
|
|
36
|
+
this.userController.getUser(req, res));
|
|
37
|
+
|
|
38
|
+
this.app.put('/api/users/:id', (req, res) =>
|
|
39
|
+
this.userController.updateUser(req, res));
|
|
40
|
+
|
|
41
|
+
this.app.delete('/api/users/:id', (req, res) =>
|
|
42
|
+
this.userController.deleteUser(req, res));
|
|
43
|
+
|
|
44
|
+
// Catch-all for undefined routes
|
|
45
|
+
this.app.use('*', (req, res) => {
|
|
46
|
+
res.status(404).json({ error: 'Route not found' });
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Error handling middleware
|
|
50
|
+
this.app.use((error, req, res, next) => {
|
|
51
|
+
console.error('Unhandled error:', error);
|
|
52
|
+
res.status(500).json({ error: 'Internal server error' });
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async start(port = 3002) {
|
|
57
|
+
return new Promise((resolve) => {
|
|
58
|
+
this.server = this.app.listen(port, () => {
|
|
59
|
+
console.log(`Clean Architecture Server running on port ${port}`);
|
|
60
|
+
console.log('✅ Clean architecture boundaries maintained');
|
|
61
|
+
resolve(this.server);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async stop() {
|
|
67
|
+
if (this.server) {
|
|
68
|
+
return new Promise((resolve) => {
|
|
69
|
+
this.server.close(() => {
|
|
70
|
+
console.log('Server stopped');
|
|
71
|
+
resolve();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
module.exports = HttpServer;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// CreateUserRequest DTO - Data Transfer Object for user creation
|
|
2
|
+
|
|
3
|
+
class CreateUserRequest {
|
|
4
|
+
constructor(name, email) {
|
|
5
|
+
this.name = name;
|
|
6
|
+
this.email = email;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
static fromJson(json) {
|
|
10
|
+
return new CreateUserRequest(json.name, json.email);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
validate() {
|
|
14
|
+
const errors = [];
|
|
15
|
+
|
|
16
|
+
if (!this.name || this.name.trim().length === 0) {
|
|
17
|
+
errors.push('Name is required');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!this.email || this.email.trim().length === 0) {
|
|
21
|
+
errors.push('Email is required');
|
|
22
|
+
} else if (!this.isValidEmail(this.email)) {
|
|
23
|
+
errors.push('Invalid email format');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
isValid: errors.length === 0,
|
|
28
|
+
errors
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
isValidEmail(email) {
|
|
33
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = CreateUserRequest;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// User Application Service - Orchestrates business logic
|
|
2
|
+
|
|
3
|
+
const User = require('../../domain/models/User');
|
|
4
|
+
const UserRepository = require('../../domain/interfaces/UserRepository');
|
|
5
|
+
|
|
6
|
+
class UserService {
|
|
7
|
+
constructor(userRepository) {
|
|
8
|
+
if (!(userRepository instanceof UserRepository)) {
|
|
9
|
+
throw new Error('UserRepository interface must be implemented');
|
|
10
|
+
}
|
|
11
|
+
this.userRepository = userRepository;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async createUser(userData) {
|
|
15
|
+
// Business logic validation
|
|
16
|
+
const { name, email } = userData;
|
|
17
|
+
|
|
18
|
+
if (!name || !email) {
|
|
19
|
+
throw new Error('Name and email are required');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Create domain entity
|
|
23
|
+
const user = User.create(name, email);
|
|
24
|
+
|
|
25
|
+
if (!user.isValid()) {
|
|
26
|
+
throw new Error('Invalid user data');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Save through repository abstraction
|
|
30
|
+
return await this.userRepository.save(user);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async getUserById(id) {
|
|
34
|
+
return await this.userRepository.findById(id);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async updateUser(id, updateData) {
|
|
38
|
+
const existingUser = await this.userRepository.findById(id);
|
|
39
|
+
|
|
40
|
+
if (!existingUser) {
|
|
41
|
+
throw new Error('User not found');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Apply updates based on business rules
|
|
45
|
+
if (updateData.name) {
|
|
46
|
+
existingUser.updateName(updateData.name);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (updateData.email) {
|
|
50
|
+
existingUser.updateEmail(updateData.email);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return await this.userRepository.update(existingUser);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async deleteUser(id) {
|
|
57
|
+
return await this.userRepository.delete(id);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = UserService;
|
|
@@ -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:47.253Z
|
|
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
|
+
- **domain/interfaces/UserRepository.js**
|
|
56
|
+
- Blast Radius: 2 files (20% of codebase)
|
|
57
|
+
- Risk: Changes here may silently propagate across the system.
|
|
58
|
+
|
|
59
|
+
- **domain/models/User.js**
|
|
60
|
+
- Blast Radius: 2 files (20% of codebase)
|
|
61
|
+
- Risk: Acts as a coordination layer between components.
|
|
62
|
+
|
|
63
|
+
- **adapters/http/HttpServer.js**
|
|
64
|
+
- Blast Radius: 1 files (10% 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
|