aibridge-context 1.4.1 → 1.5.2

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/core/init.js CHANGED
@@ -4,6 +4,7 @@ const path = require('path');
4
4
  const fsp = require('fs/promises');
5
5
 
6
6
  const {
7
+ bootstrapProjectAnalysis,
7
8
  createDefaultChangelog,
8
9
  createDefaultState,
9
10
  detectProjectMetadata,
@@ -45,10 +46,34 @@ async function initProject(projectRoot, options) {
45
46
  const templateState = JSON.parse(stateTemplate);
46
47
  const templateChangelog = JSON.parse(changelogTemplate);
47
48
  let enableGitSync = false;
48
-
49
- const initialState = Object.assign({}, templateState, existingState || createDefaultState(projectRoot), {
49
+ const bootstrapState = createDefaultState(projectRoot);
50
+ const bootstrapAnalysis = bootstrapProjectAnalysis(projectRoot);
51
+ const mergedArchitecturePatterns =
52
+ Array.isArray(bootstrapAnalysis.architecturePatterns) &&
53
+ bootstrapAnalysis.architecturePatterns.length > 0
54
+ ? bootstrapAnalysis.architecturePatterns
55
+ : Array.isArray(existingState && existingState.architecture_patterns)
56
+ ? existingState.architecture_patterns
57
+ : [];
58
+ const mergedImplementationDetails =
59
+ Array.isArray(bootstrapAnalysis.implementationDetails) &&
60
+ bootstrapAnalysis.implementationDetails.length > 0
61
+ ? bootstrapAnalysis.implementationDetails
62
+ : Array.isArray(existingState && existingState.implementation_details)
63
+ ? existingState.implementation_details
64
+ : [];
65
+
66
+ const initialState = Object.assign({}, templateState, existingState || bootstrapState, {
50
67
  project: metadata.project,
51
- version: metadata.version
68
+ version: metadata.version,
69
+ ai_summary: bootstrapState.ai_summary,
70
+ tech_stack: bootstrapAnalysis.techStack,
71
+ architecture_patterns: mergedArchitecturePatterns,
72
+ implementation_details: mergedImplementationDetails,
73
+ current_stage: bootstrapState.current_stage,
74
+ key_features: bootstrapState.key_features,
75
+ known_issues: bootstrapState.known_issues,
76
+ next_steps: bootstrapState.next_steps
52
77
  });
53
78
 
54
79
  const initialContext = renderTemplate(contextTemplate, {