arcvision 0.2.28 → 0.2.29

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.
@@ -1,6 +1,7 @@
1
1
  const path = require('path');
2
2
  const crypto = require('crypto');
3
3
  const { stableId } = require('./id-generator');
4
+ const { emptyIntelligenceBlock } = require('../engine/pass5_intelligence');
4
5
 
5
6
  /**
6
7
  * Generate integrity hash for the context
@@ -24,7 +25,7 @@ function generateIntegrityHash(nodes, edges) {
24
25
  return a.to.localeCompare(b.to);
25
26
  })
26
27
  });
27
-
28
+
28
29
  return crypto.createHash('sha256').update(content).digest('hex');
29
30
  }
30
31
 
@@ -174,11 +175,11 @@ function buildContext(files, edges, options = {}) {
174
175
  symbols: options.symbols || [],
175
176
  metrics,
176
177
  contextSurface: options.contextSurface || {},
177
-
178
+
178
179
  // Authority core detection results
179
180
  authority_cores: options.authorityCores || [],
180
181
  hidden_coupling: options.hiddenCoupling || [],
181
-
182
+
182
183
  // Completeness metrics
183
184
  completeness_metrics: options.completenessMetrics || {
184
185
  totalFilesFound: nodes.length,
@@ -186,7 +187,7 @@ function buildContext(files, edges, options = {}) {
186
187
  coveragePercentage: 100,
187
188
  missingCriticalFiles: []
188
189
  },
189
-
190
+
190
191
  // Assumptions about analysis limitations
191
192
  assumptions: [
192
193
  'Analysis excludes node_modules and build artifacts',
@@ -194,7 +195,7 @@ function buildContext(files, edges, options = {}) {
194
195
  'Circular dependencies may not be fully detected',
195
196
  'Dynamic imports may not be fully resolved'
196
197
  ],
197
-
198
+
198
199
  // Source repository information
199
200
  source: {
200
201
  repo: options.rootPath || path.resolve(directory),
@@ -202,12 +203,12 @@ function buildContext(files, edges, options = {}) {
202
203
  generated_at: new Date().toISOString(),
203
204
  arcvision_version: options.arcvisionVersion || '1.0.0'
204
205
  },
205
-
206
+
206
207
  // Integrity hash
207
208
  integrity: {
208
209
  sha256: generateIntegrityHash(nodes, edges)
209
210
  },
210
-
211
+
211
212
  // Structural layers analysis
212
213
  structural_layers: {
213
214
  runtime_code: {
@@ -235,7 +236,7 @@ function buildContext(files, edges, options = {}) {
235
236
  description: 'Asset files (images, fonts, etc.)'
236
237
  }
237
238
  },
238
-
239
+
239
240
  // Project envelope
240
241
  project_envelope: {
241
242
  configuration_files: nodes
@@ -247,7 +248,7 @@ function buildContext(files, edges, options = {}) {
247
248
  documentation: [],
248
249
  build_tools: []
249
250
  },
250
-
251
+
251
252
  // Diff summary placeholder
252
253
  diff_summary: null
253
254
  };
@@ -256,11 +257,11 @@ function buildContext(files, edges, options = {}) {
256
257
  context.metrics.files_with_functions = nodes.filter(n => n.role === 'Implementation').length;
257
258
  context.metrics.files_with_high_blast_radius = nodes.filter(n => n.blast_radius > 5).length;
258
259
  context.metrics.total_dependencies = schemaEdges.length;
259
-
260
+
260
261
  // Include automatically detected invariants in the context first
261
262
  if (options.autoDetectedInvariants !== undefined && Array.isArray(options.autoDetectedInvariants) && options.autoDetectedInvariants.length > 0) {
262
263
  context.auto_detected_invariants = options.autoDetectedInvariants;
263
-
264
+
264
265
  // Initialize context.invariants with auto-detected invariants if not already set
265
266
  if (!context.invariants || !Array.isArray(context.invariants)) {
266
267
  context.invariants = [...options.autoDetectedInvariants];
@@ -269,7 +270,7 @@ function buildContext(files, edges, options = {}) {
269
270
  context.invariants = [...context.invariants, ...options.autoDetectedInvariants];
270
271
  }
271
272
  }
272
-
273
+
273
274
  // Add new canonical sections if provided in options - this will add Pass 4 invariants if they exist
274
275
  if (options.invariants !== undefined && Array.isArray(options.invariants) && options.invariants.length > 0) {
275
276
  if (!context.invariants) {
@@ -279,19 +280,27 @@ function buildContext(files, edges, options = {}) {
279
280
  context.invariants = [...context.invariants, ...options.invariants];
280
281
  }
281
282
  }
282
-
283
+
283
284
  if (options.ownership !== undefined) {
284
285
  context.ownership = options.ownership;
285
286
  }
286
-
287
+
287
288
  if (options.failure_modes !== undefined) {
288
289
  context.failure_modes = options.failure_modes;
289
290
  }
290
-
291
+
291
292
  if (options.decision_guidance !== undefined) {
292
293
  context.decision_guidance = options.decision_guidance;
293
294
  }
294
295
 
296
+ // Intelligence block — always populated, never null
297
+ // This is the canonical architecture intelligence layer from Pass 5.
298
+ if (options.intelligence !== undefined && options.intelligence !== null) {
299
+ context.intelligence = options.intelligence;
300
+ } else {
301
+ context.intelligence = emptyIntelligenceBlock();
302
+ }
303
+
295
304
  return context;
296
305
  }
297
306