@codeyam/codeyam-cli 0.1.0-staging.323686 → 0.1.0-staging.483fdc2
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/analyzer-template/.build-info.json +7 -7
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +2 -2
- package/analyzer-template/packages/ai/index.ts +6 -1
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +39 -17
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +67 -9
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +308 -50
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +15 -6
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +664 -242
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +16 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +6 -4
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +20 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +35 -13
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +160 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +289 -83
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +269 -1
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +9 -5
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +11 -3
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +297 -7
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +90 -96
- package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +10 -7
- package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +25 -13
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +4 -3
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +65 -59
- package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +113 -26
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +20 -6
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +14 -4
- package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +0 -3
- package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +4 -5
- package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +14 -12
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +57 -13
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +29 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +35 -4
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +117 -9
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +199 -17
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
- package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
- package/analyzer-template/packages/aws/package.json +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +5 -5
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/package.json +1 -1
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +6 -5
- package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +5 -5
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
- package/analyzer-template/project/constructMockCode.ts +54 -9
- package/analyzer-template/project/writeMockDataTsx.ts +73 -2
- package/background/src/lib/virtualized/project/constructMockCode.js +45 -3
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +71 -2
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +146 -0
- package/codeyam-cli/scripts/apply-setup.js.map +1 -1
- package/codeyam-cli/src/commands/debug.js +7 -5
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/utils/install-skills.js +22 -0
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/reviewedRules.js +92 -0
- package/codeyam-cli/src/utils/reviewedRules.js.map +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-CX9f-5xM.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{manifest-7522edd4.js → manifest-bba56ec1.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/memory-DuTFSyJ2.js +92 -0
- package/codeyam-cli/src/webserver/build/client/assets/{root-eVAaavTS.js → root-DTfSQARG.js} +6 -6
- package/codeyam-cli/src/webserver/build/server/assets/{index-DVzYx8PN.js → index-TD1f-DHV.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BQ-1XyEa.js +258 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/templates/codeyam:memory.md +174 -233
- package/codeyam-cli/templates/codeyam:new-rule.md +41 -2
- package/codeyam-cli/templates/rule-reflection-hook.py +161 -0
- package/codeyam-cli/templates/rules-instructions.md +126 -0
- package/package.json +1 -1
- package/packages/ai/index.js +2 -1
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +29 -12
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +54 -8
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +239 -43
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +503 -165
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +13 -3
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +22 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +34 -9
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +159 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
- package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +237 -73
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +195 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +7 -1
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +10 -2
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +209 -3
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
- package/packages/ai/src/lib/mergeStatements.js +70 -51
- package/packages/ai/src/lib/mergeStatements.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +10 -4
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
- package/packages/ai/src/lib/resolvePathToControllable.js +24 -14
- package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/FileAnalyzer.js +60 -36
- package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/ProjectAnalyzer.js +96 -26
- package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +13 -5
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +14 -4
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +2 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +0 -3
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeRemixRoute.js +3 -2
- package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
- package/packages/analyze/src/lib/files/getImportedExports.js +11 -7
- package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +52 -10
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +25 -8
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +34 -4
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +56 -8
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +168 -9
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/setImportedExports.js +2 -1
- package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
- package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-D3yhhV8x.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/memory-yxFcrxBX.js +0 -92
- package/codeyam-cli/src/webserver/build/server/assets/server-build-4Cr0uToj.js +0 -257
package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts
ADDED
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { splitOutsideParenthesesAndArrays } from '~codeyam/ai';
|
|
2
|
+
import { DataStructure } from '~codeyam/types';
|
|
3
|
+
|
|
4
|
+
// Safety limits to prevent combinatorial explosion
|
|
5
|
+
const MAX_SCHEMA_PATHS = 15000; // Don't propagate if schema already has this many paths
|
|
6
|
+
const MAX_PATHS_TO_ADD = 5000; // Stop adding paths after this many new paths
|
|
7
|
+
const MAX_ARRAY_NESTING_DEPTH = 3; // Don't propagate paths with more than this many [] levels
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Count the number of array levels in a path.
|
|
11
|
+
* e.g., "entities[].analyses[].scenarios[]" has 3 levels
|
|
12
|
+
*/
|
|
13
|
+
function countArrayLevels(path: string): number {
|
|
14
|
+
return (path.match(/\[\]/g) || []).length;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Check if appending suffix to prefix would create a recursive path.
|
|
19
|
+
* A path is recursive if it contains the same array name twice.
|
|
20
|
+
* e.g., "entities[].analyses[].scenarios[].analyses[]" has "analyses" twice.
|
|
21
|
+
*/
|
|
22
|
+
function wouldCreateRecursivePath(prefix: string, suffix: string): boolean {
|
|
23
|
+
// Extract array names from prefix (names that appear before [])
|
|
24
|
+
const prefixArrayNames = new Set<string>();
|
|
25
|
+
const prefixMatches = prefix.matchAll(/\.?([a-zA-Z_][a-zA-Z0-9_]*)\[\]/g);
|
|
26
|
+
for (const match of prefixMatches) {
|
|
27
|
+
prefixArrayNames.add(match[1].toLowerCase());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Check if any array name in suffix already exists in prefix
|
|
31
|
+
const suffixMatches = suffix.matchAll(/\.?([a-zA-Z_][a-zA-Z0-9_]*)\[\]/g);
|
|
32
|
+
for (const match of suffixMatches) {
|
|
33
|
+
if (prefixArrayNames.has(match[1].toLowerCase())) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Propagates array item schemas between arrays that likely have the same type.
|
|
43
|
+
*
|
|
44
|
+
* When the Rust analyzer traces property accesses, it may trace item properties for
|
|
45
|
+
* one array but not another, even though they have the same TypeScript type. This
|
|
46
|
+
* happens when:
|
|
47
|
+
* - One array is accessed directly in code (e.g., `entities.forEach(e => e.name)`)
|
|
48
|
+
* - Another array is only used as a fallback in an OR expression
|
|
49
|
+
* (e.g., `const displayEntities = currentlyExecuting?.entities || currentEntities`)
|
|
50
|
+
*
|
|
51
|
+
* In this case, `entities` gets `entities[]`, `entities[].name`, etc. traced,
|
|
52
|
+
* but `currentEntities` only gets `currentEntities: "array"` with no item schema.
|
|
53
|
+
*
|
|
54
|
+
* This function finds arrays without item schemas and copies item schemas from
|
|
55
|
+
* other arrays that appear to have the same type based on naming conventions.
|
|
56
|
+
*
|
|
57
|
+
* Heuristics for matching arrays:
|
|
58
|
+
* 1. Same suffix (e.g., `currentEntities` matches `entities`, `queueJobs[].entities` matches `entities`)
|
|
59
|
+
* 2. One name is a plural/singular form of the other
|
|
60
|
+
*/
|
|
61
|
+
export default function propagateArrayItemSchemas(
|
|
62
|
+
dependencySchemas: DataStructure['dependencySchemas'],
|
|
63
|
+
): void {
|
|
64
|
+
if (!dependencySchemas) {
|
|
65
|
+
console.log('[PROPAGATE] No dependencySchemas provided');
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Log what we're working with
|
|
70
|
+
const packages = Object.keys(dependencySchemas);
|
|
71
|
+
console.log('[PROPAGATE] Processing packages:', packages);
|
|
72
|
+
|
|
73
|
+
// PHASE 1: Run per-entity propagation (original behavior)
|
|
74
|
+
// This propagates array item schemas within each entity's own schema.
|
|
75
|
+
console.log('[PROPAGATE] === PHASE 1: Per-entity propagation ===');
|
|
76
|
+
for (const filePath in dependencySchemas) {
|
|
77
|
+
for (const entityName in dependencySchemas[filePath]) {
|
|
78
|
+
const schema = dependencySchemas[filePath][entityName]?.returnValueSchema;
|
|
79
|
+
if (!schema) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const beforeCount = Object.keys(schema).length;
|
|
83
|
+
|
|
84
|
+
propagateArrayItemSchemasInSchema(schema);
|
|
85
|
+
|
|
86
|
+
const afterCount = Object.keys(schema).length;
|
|
87
|
+
|
|
88
|
+
if (beforeCount !== afterCount) {
|
|
89
|
+
console.log(
|
|
90
|
+
`[PROPAGATE] PHASE1 ${filePath}/${entityName}: ${beforeCount} -> ${afterCount} paths`,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// PHASE 2: Cross-entity propagation within the same package
|
|
97
|
+
// When we have call-specific entities like `useLoaderData<typeof loader>()`,
|
|
98
|
+
// they may be missing array item paths that exist in the base entity `useLoaderData`.
|
|
99
|
+
// Copy array item paths from base entities to call-specific entities.
|
|
100
|
+
console.log('[PROPAGATE] === PHASE 2: Cross-entity propagation ===');
|
|
101
|
+
for (const filePath in dependencySchemas) {
|
|
102
|
+
const entities = dependencySchemas[filePath];
|
|
103
|
+
const entityNames = Object.keys(entities);
|
|
104
|
+
|
|
105
|
+
for (const entityName of entityNames) {
|
|
106
|
+
// Check if this is a call-specific entity (ends with function call syntax)
|
|
107
|
+
if (!entityName.includes('(')) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Find the base entity name (e.g., "useLoaderData<typeof loader>()" -> "useLoaderData")
|
|
112
|
+
const baseEntityName = entityName.split(/[(<]/)[0];
|
|
113
|
+
|
|
114
|
+
if (!baseEntityName || !entities[baseEntityName]) {
|
|
115
|
+
console.log(
|
|
116
|
+
`[PROPAGATE] PHASE2: No base entity '${baseEntityName}' for '${entityName}'`,
|
|
117
|
+
);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const callSpecificSchema = entities[entityName]?.returnValueSchema;
|
|
122
|
+
const baseSchema = entities[baseEntityName]?.returnValueSchema;
|
|
123
|
+
|
|
124
|
+
if (!callSpecificSchema || !baseSchema) {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
console.log(
|
|
129
|
+
`[PROPAGATE] PHASE2: Copying from '${baseEntityName}' (${Object.keys(baseSchema).length} paths) to '${entityName}' (${Object.keys(callSpecificSchema).length} paths)`,
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
// Check what paths exist in base but not in call-specific
|
|
133
|
+
const baseHasEntitiesFilePath = Object.keys(baseSchema).some((p) =>
|
|
134
|
+
p.includes('currentlyExecuting.entities[].filePath'),
|
|
135
|
+
);
|
|
136
|
+
const callSpecificHasEntitiesFilePath = Object.keys(
|
|
137
|
+
callSpecificSchema,
|
|
138
|
+
).some((p) => p.includes('currentlyExecuting.entities[].filePath'));
|
|
139
|
+
|
|
140
|
+
console.log(
|
|
141
|
+
`[PROPAGATE] PHASE2: base has currentlyExecuting.entities[].filePath: ${baseHasEntitiesFilePath}`,
|
|
142
|
+
);
|
|
143
|
+
console.log(
|
|
144
|
+
`[PROPAGATE] PHASE2: callSpecific has currentlyExecuting.entities[].filePath: ${callSpecificHasEntitiesFilePath}`,
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
// Copy any array item paths from base schema to call-specific schema
|
|
148
|
+
// that are missing in the call-specific schema
|
|
149
|
+
let copiedCount = 0;
|
|
150
|
+
const copiedPaths: string[] = [];
|
|
151
|
+
for (const path in baseSchema) {
|
|
152
|
+
// Only copy paths that include array element notation
|
|
153
|
+
if (!path.includes('[]')) continue;
|
|
154
|
+
// Only copy if not already present
|
|
155
|
+
if (callSpecificSchema[path]) continue;
|
|
156
|
+
|
|
157
|
+
callSpecificSchema[path] = baseSchema[path];
|
|
158
|
+
copiedCount++;
|
|
159
|
+
|
|
160
|
+
// Track specific paths we care about
|
|
161
|
+
if (path.includes('currentlyExecuting.entities[]')) {
|
|
162
|
+
copiedPaths.push(path);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
console.log(`[PROPAGATE] PHASE2: Copied ${copiedCount} paths`);
|
|
167
|
+
if (copiedPaths.length > 0) {
|
|
168
|
+
console.log(
|
|
169
|
+
'[PROPAGATE] PHASE2: Copied currentlyExecuting.entities paths:',
|
|
170
|
+
copiedPaths,
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Verify after copy
|
|
175
|
+
const afterHasEntitiesFilePath = Object.keys(callSpecificSchema).some(
|
|
176
|
+
(p) => p.includes('currentlyExecuting.entities[].filePath'),
|
|
177
|
+
);
|
|
178
|
+
console.log(
|
|
179
|
+
`[PROPAGATE] PHASE2: AFTER copy, callSpecific has currentlyExecuting.entities[].filePath: ${afterHasEntitiesFilePath}`,
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
console.log('[PROPAGATE] === DONE ===');
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Helper to extract the "base name" from an array path for matching purposes.
|
|
189
|
+
* e.g., "currentEntities" -> "entities"
|
|
190
|
+
* e.g., "validCurrentEntities" -> "entities"
|
|
191
|
+
* e.g., "queueJobs[].entities" -> "entities"
|
|
192
|
+
* e.g., "entities" -> "entities"
|
|
193
|
+
*/
|
|
194
|
+
function extractArrayBaseName(path: string): string {
|
|
195
|
+
// Get the last segment of the path (after the last dot, if any)
|
|
196
|
+
const parts = splitOutsideParenthesesAndArrays(path);
|
|
197
|
+
const lastPart = parts[parts.length - 1] || path;
|
|
198
|
+
|
|
199
|
+
// Remove trailing [] if present
|
|
200
|
+
const name = lastPart.replace(/\[\]$/, '');
|
|
201
|
+
|
|
202
|
+
// Common prefixes that can be stripped for matching
|
|
203
|
+
const prefixes = [
|
|
204
|
+
'current',
|
|
205
|
+
'valid',
|
|
206
|
+
'filtered',
|
|
207
|
+
'all',
|
|
208
|
+
'new',
|
|
209
|
+
'old',
|
|
210
|
+
'display',
|
|
211
|
+
'active',
|
|
212
|
+
'selected',
|
|
213
|
+
'loaded',
|
|
214
|
+
'fetched',
|
|
215
|
+
];
|
|
216
|
+
|
|
217
|
+
// Keep stripping prefixes until no more match
|
|
218
|
+
let baseName = name;
|
|
219
|
+
let changed = true;
|
|
220
|
+
while (changed) {
|
|
221
|
+
changed = false;
|
|
222
|
+
for (const prefix of prefixes) {
|
|
223
|
+
if (
|
|
224
|
+
baseName.toLowerCase().startsWith(prefix) &&
|
|
225
|
+
baseName.length > prefix.length
|
|
226
|
+
) {
|
|
227
|
+
// Remove prefix and lowercase the first char
|
|
228
|
+
baseName = baseName.slice(prefix.length);
|
|
229
|
+
baseName = baseName.charAt(0).toLowerCase() + baseName.slice(1);
|
|
230
|
+
changed = true;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return baseName.toLowerCase();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Check if two array names likely refer to the same type.
|
|
241
|
+
*/
|
|
242
|
+
function arrayNamesMatch(name1: string, name2: string): boolean {
|
|
243
|
+
const base1 = extractArrayBaseName(name1);
|
|
244
|
+
const base2 = extractArrayBaseName(name2);
|
|
245
|
+
|
|
246
|
+
if (base1 === base2) return true;
|
|
247
|
+
|
|
248
|
+
// Check singular/plural relationships
|
|
249
|
+
if (base1 + 's' === base2 || base2 + 's' === base1) return true;
|
|
250
|
+
if (base1 + 'es' === base2 || base2 + 'es' === base1) return true;
|
|
251
|
+
|
|
252
|
+
// Handle "ies" plural (e.g., entity -> entities)
|
|
253
|
+
if (base1.endsWith('ies') && base1.slice(0, -3) + 'y' === base2) return true;
|
|
254
|
+
if (base2.endsWith('ies') && base2.slice(0, -3) + 'y' === base1) return true;
|
|
255
|
+
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Count the number of item properties an array has in the schema.
|
|
261
|
+
*/
|
|
262
|
+
function countArrayItemProperties(
|
|
263
|
+
schema: Record<string, string>,
|
|
264
|
+
arrayPath: string,
|
|
265
|
+
): number {
|
|
266
|
+
const elementPrefix = arrayPath + '[]';
|
|
267
|
+
let count = 0;
|
|
268
|
+
for (const path in schema) {
|
|
269
|
+
if (path.startsWith(elementPrefix)) {
|
|
270
|
+
count++;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return count;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function propagateArrayItemSchemasInSchema(
|
|
277
|
+
schema: Record<string, string>,
|
|
278
|
+
): void {
|
|
279
|
+
// Safety check: Don't propagate if schema is already very large
|
|
280
|
+
const initialPathCount = Object.keys(schema).length;
|
|
281
|
+
if (initialPathCount > MAX_SCHEMA_PATHS) {
|
|
282
|
+
console.log(
|
|
283
|
+
`[PROPAGATE] SKIPPING: Schema already has ${initialPathCount} paths (limit: ${MAX_SCHEMA_PATHS})`,
|
|
284
|
+
);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
let totalPathsAdded = 0;
|
|
289
|
+
|
|
290
|
+
// Find all array paths and categorize them
|
|
291
|
+
const arraysWithItemSchema: string[] = [];
|
|
292
|
+
const arraysWithoutItemSchema: string[] = [];
|
|
293
|
+
|
|
294
|
+
for (const path in schema) {
|
|
295
|
+
const type = schema[path];
|
|
296
|
+
|
|
297
|
+
// Check if this is an array type (including "array | undefined", etc.)
|
|
298
|
+
if (!type.startsWith('array')) continue;
|
|
299
|
+
|
|
300
|
+
// Check if this is an array element path (ends with [])
|
|
301
|
+
if (path.endsWith('[]')) continue;
|
|
302
|
+
|
|
303
|
+
// This is an array declaration, not an element. Check if it has item schema.
|
|
304
|
+
const elementPath = path + '[]';
|
|
305
|
+
if (schema[elementPath]) {
|
|
306
|
+
arraysWithItemSchema.push(path);
|
|
307
|
+
} else {
|
|
308
|
+
arraysWithoutItemSchema.push(path);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// For each array without item schema, try to find a matching array with schema
|
|
313
|
+
for (const emptyArrayPath of arraysWithoutItemSchema) {
|
|
314
|
+
let bestMatch: string | null = null;
|
|
315
|
+
let bestMatchScore = 0;
|
|
316
|
+
|
|
317
|
+
for (const richArrayPath of arraysWithItemSchema) {
|
|
318
|
+
if (!arrayNamesMatch(emptyArrayPath, richArrayPath)) continue;
|
|
319
|
+
|
|
320
|
+
// Score the match - prefer shorter paths (less nested) as they're more likely primary
|
|
321
|
+
// and prefer paths that are more similar in structure
|
|
322
|
+
const emptyDepth = emptyArrayPath.split('.').length;
|
|
323
|
+
const richDepth = richArrayPath.split('.').length;
|
|
324
|
+
const depthDiff = Math.abs(emptyDepth - richDepth);
|
|
325
|
+
const score = 100 - depthDiff * 10 - richDepth;
|
|
326
|
+
|
|
327
|
+
if (score > bestMatchScore) {
|
|
328
|
+
bestMatchScore = score;
|
|
329
|
+
bestMatch = richArrayPath;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
if (bestMatch) {
|
|
334
|
+
// Safety check: Stop if we've added too many paths
|
|
335
|
+
if (totalPathsAdded >= MAX_PATHS_TO_ADD) {
|
|
336
|
+
console.log(
|
|
337
|
+
`[PROPAGATE] STOPPING FIRST PASS: Already added ${totalPathsAdded} paths (limit: ${MAX_PATHS_TO_ADD})`,
|
|
338
|
+
);
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// Copy item schema from the rich array to the empty array
|
|
343
|
+
const richElementPrefix = bestMatch + '[]';
|
|
344
|
+
const emptyElementPrefix = emptyArrayPath + '[]';
|
|
345
|
+
|
|
346
|
+
// Find all paths that start with the rich array's element path
|
|
347
|
+
const pathsToCheck = Object.keys(schema);
|
|
348
|
+
|
|
349
|
+
for (const path of pathsToCheck) {
|
|
350
|
+
if (path.startsWith(richElementPrefix)) {
|
|
351
|
+
const suffix = path.slice(richElementPrefix.length);
|
|
352
|
+
const newPath = emptyElementPrefix + suffix;
|
|
353
|
+
|
|
354
|
+
// Skip if this would create a recursive path (suffix contains array names that are already in the prefix)
|
|
355
|
+
if (wouldCreateRecursivePath(emptyElementPrefix, suffix)) {
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// Skip if the new path would have too many array levels
|
|
360
|
+
if (countArrayLevels(newPath) > MAX_ARRAY_NESTING_DEPTH) {
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// Safety check: Stop if we've added too many paths
|
|
365
|
+
if (totalPathsAdded >= MAX_PATHS_TO_ADD) {
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// Only add if the path doesn't already exist
|
|
370
|
+
if (!schema[newPath]) {
|
|
371
|
+
schema[newPath] = schema[path];
|
|
372
|
+
totalPathsAdded++;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// SECOND PASS: For arrays that have PARTIAL item schemas (some but not all properties),
|
|
380
|
+
// propagate missing properties from matching arrays with more complete schemas.
|
|
381
|
+
// This handles the case where e.g. currentlyExecuting.entities has sha traced
|
|
382
|
+
// but is missing filePath, name, etc. that entities[] has.
|
|
383
|
+
|
|
384
|
+
// Safety check: Skip second pass if we've already hit the limit
|
|
385
|
+
if (totalPathsAdded >= MAX_PATHS_TO_ADD) {
|
|
386
|
+
console.log(
|
|
387
|
+
`[PROPAGATE] SKIPPING SECOND PASS: Already added ${totalPathsAdded} paths`,
|
|
388
|
+
);
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
for (const partialArrayPath of arraysWithItemSchema) {
|
|
393
|
+
// Safety check: Stop if we've added too many paths
|
|
394
|
+
if (totalPathsAdded >= MAX_PATHS_TO_ADD) {
|
|
395
|
+
console.log(
|
|
396
|
+
`[PROPAGATE] STOPPING SECOND PASS: Already added ${totalPathsAdded} paths (limit: ${MAX_PATHS_TO_ADD})`,
|
|
397
|
+
);
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
const partialCount = countArrayItemProperties(schema, partialArrayPath);
|
|
402
|
+
|
|
403
|
+
// Find the best matching array with MORE properties
|
|
404
|
+
let bestMatch: string | null = null;
|
|
405
|
+
let bestMatchScore = 0;
|
|
406
|
+
let bestMatchCount = partialCount;
|
|
407
|
+
|
|
408
|
+
for (const richArrayPath of arraysWithItemSchema) {
|
|
409
|
+
if (richArrayPath === partialArrayPath) continue;
|
|
410
|
+
if (!arrayNamesMatch(partialArrayPath, richArrayPath)) continue;
|
|
411
|
+
|
|
412
|
+
const richCount = countArrayItemProperties(schema, richArrayPath);
|
|
413
|
+
|
|
414
|
+
// Only consider arrays with MORE properties
|
|
415
|
+
if (richCount <= partialCount) continue;
|
|
416
|
+
|
|
417
|
+
// Score the match - prefer arrays with more properties and shallower depth
|
|
418
|
+
const partialDepth = partialArrayPath.split('.').length;
|
|
419
|
+
const richDepth = richArrayPath.split('.').length;
|
|
420
|
+
const depthDiff = Math.abs(partialDepth - richDepth);
|
|
421
|
+
const score = richCount * 10 - depthDiff * 5 - richDepth;
|
|
422
|
+
|
|
423
|
+
if (score > bestMatchScore || richCount > bestMatchCount) {
|
|
424
|
+
bestMatchScore = score;
|
|
425
|
+
bestMatch = richArrayPath;
|
|
426
|
+
bestMatchCount = richCount;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
if (bestMatch) {
|
|
431
|
+
// Copy MISSING item properties from the rich array to the partial array
|
|
432
|
+
const richElementPrefix = bestMatch + '[]';
|
|
433
|
+
const partialElementPrefix = partialArrayPath + '[]';
|
|
434
|
+
|
|
435
|
+
const pathsToCheck = Object.keys(schema);
|
|
436
|
+
|
|
437
|
+
for (const path of pathsToCheck) {
|
|
438
|
+
if (path.startsWith(richElementPrefix)) {
|
|
439
|
+
const suffix = path.slice(richElementPrefix.length);
|
|
440
|
+
const newPath = partialElementPrefix + suffix;
|
|
441
|
+
|
|
442
|
+
// Skip if this would create a recursive path
|
|
443
|
+
if (wouldCreateRecursivePath(partialElementPrefix, suffix)) {
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// Skip if the new path would have too many array levels
|
|
448
|
+
if (countArrayLevels(newPath) > MAX_ARRAY_NESTING_DEPTH) {
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// Safety check: Stop if we've added too many paths
|
|
453
|
+
if (totalPathsAdded >= MAX_PATHS_TO_ADD) {
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// Only add if the path doesn't already exist (don't overwrite)
|
|
458
|
+
if (!schema[newPath]) {
|
|
459
|
+
schema[newPath] = schema[path];
|
|
460
|
+
totalPathsAdded++;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// Log final stats
|
|
468
|
+
if (totalPathsAdded > 0) {
|
|
469
|
+
const finalPathCount = Object.keys(schema).length;
|
|
470
|
+
console.log(
|
|
471
|
+
`[PROPAGATE] Added ${totalPathsAdded} paths (${initialPathCount} -> ${finalPathCount})`,
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Commit, Entity, File } from '~codeyam/types';
|
|
2
2
|
import { ProjectAnalyzer } from '../ProjectAnalyzer';
|
|
3
|
+
import { getFileByPathSafe } from '../utils/getFileByPath';
|
|
3
4
|
import getImportedExports from './getImportedExports';
|
|
4
5
|
import { getFrameworkForFile, isFrameworkRoute } from '~codeyam/utils';
|
|
5
6
|
import findOrCreateEntity from './analyze/findOrCreateEntity';
|
|
@@ -149,7 +150,7 @@ export default async function setImportedExports({
|
|
|
149
150
|
// Use fileStore for O(1) lookup when available, fallback to O(n) find
|
|
150
151
|
const relevantFile =
|
|
151
152
|
fileStore?.getByPath(resolvedFilePath) ??
|
|
152
|
-
|
|
153
|
+
getFileByPathSafe(projectAnalyzer, resolvedFilePath);
|
|
153
154
|
|
|
154
155
|
if (relevantFile) {
|
|
155
156
|
const relevantFileAnalyzer =
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { File } from '~codeyam/types';
|
|
2
|
+
import { ProjectAnalyzer } from '../ProjectAnalyzer';
|
|
3
|
+
|
|
4
|
+
export function getFileByPathSafe(
|
|
5
|
+
projectAnalyzer: ProjectAnalyzer,
|
|
6
|
+
filePath: string,
|
|
7
|
+
): File | undefined {
|
|
8
|
+
const maybeGetFileByPath = (projectAnalyzer as any).getFileByPath;
|
|
9
|
+
if (typeof maybeGetFileByPath === 'function') {
|
|
10
|
+
return maybeGetFileByPath.call(projectAnalyzer, filePath);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const projectFiles = (projectAnalyzer as any).project?.files;
|
|
14
|
+
if (Array.isArray(projectFiles)) {
|
|
15
|
+
return projectFiles.find((file: File) => file.path === filePath);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@aws-sdk/client-codebuild": "^3.948.0",
|
|
15
|
-
"@aws-sdk/client-cloudwatch-logs": "^3.
|
|
15
|
+
"@aws-sdk/client-cloudwatch-logs": "^3.980.0",
|
|
16
16
|
"@aws-sdk/client-dynamodb": "^3.956.0",
|
|
17
17
|
"@aws-sdk/client-ecr": "^3.948.0",
|
|
18
18
|
"@aws-sdk/client-ecs": "^3.956.0",
|
|
@@ -14,8 +14,8 @@ export interface ConditionalUsage {
|
|
|
14
14
|
conditionType: 'truthiness' | 'comparison' | 'switch';
|
|
15
15
|
/** For comparison conditions, the literal values being compared against */
|
|
16
16
|
comparedValues?: string[];
|
|
17
|
-
/** Where this conditional usage occurs */
|
|
18
|
-
location: 'if' | 'ternary' | 'logical-and' | 'switch';
|
|
17
|
+
/** Where this conditional usage occurs. 'unconditional' is for always-rendered children with data props. */
|
|
18
|
+
location: 'if' | 'ternary' | 'logical-and' | 'switch' | 'unconditional';
|
|
19
19
|
/** Source location information for this conditional usage */
|
|
20
20
|
sourceLocation?: {
|
|
21
21
|
/** Line number (1-based) */
|
|
@@ -91,8 +91,8 @@ export interface CompoundConditional {
|
|
|
91
91
|
/** Required value for this condition to be true */
|
|
92
92
|
requiredValue?: string | boolean;
|
|
93
93
|
}[];
|
|
94
|
-
/** Where this compound conditional occurs */
|
|
95
|
-
location: 'if' | 'ternary' | 'logical-and' | 'switch';
|
|
94
|
+
/** Where this compound conditional occurs. 'unconditional' is for always-rendered children. */
|
|
95
|
+
location: 'if' | 'ternary' | 'logical-and' | 'switch' | 'unconditional';
|
|
96
96
|
/** Source location for the entire compound expression */
|
|
97
97
|
sourceLocation: {
|
|
98
98
|
lineNumber: number;
|
|
@@ -175,7 +175,7 @@ export interface DataStructure {
|
|
|
175
175
|
[key: string]: string;
|
|
176
176
|
};
|
|
177
177
|
equivalentSignatureVariables: {
|
|
178
|
-
[key: string]: string;
|
|
178
|
+
[key: string]: string | string[];
|
|
179
179
|
};
|
|
180
180
|
usageEquivalencies?: {
|
|
181
181
|
[key: string]: {
|
package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScenariosDataStructure.d.ts","sourceRoot":"","sources":["../../../../../types/src/types/ScenariosDataStructure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACjC,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,aAAa,EAAE,YAAY,GAAG,YAAY,GAAG,QAAQ,CAAC;IACtD,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,
|
|
1
|
+
{"version":3,"file":"ScenariosDataStructure.d.ts","sourceRoot":"","sources":["../../../../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;YACtB,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;YACvB,SAAS,EACL,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,IAAI,GACJ,KAAK,GACL,eAAe,GACf,WAAW,GACX,YAAY,GACZ,aAAa,CAAC;YAClB,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB,CAAC;KACH,CAAC;IACF,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,kBAAkB,CAAC,EAAE,GAAG,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,aAAa,EAAE,WAAW,GAAG,oBAAoB,CAAC;IAClD,oDAAoD;IACpD,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC3C,kCAAkC;IAClC,cAAc,CAAC,EAAE;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH"}
|
|
@@ -4,8 +4,13 @@ export interface ScopeAnalysis {
|
|
|
4
4
|
isolatedStructure: {
|
|
5
5
|
[key: string]: string;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Maps variable names to their equivalent paths.
|
|
9
|
+
* Supports multiple equivalencies per key (e.g., for OR expressions like `x = a || b`
|
|
10
|
+
* where x is equivalent to both a and b).
|
|
11
|
+
*/
|
|
7
12
|
isolatedEquivalentVariables: {
|
|
8
|
-
[key: string]: string;
|
|
13
|
+
[key: string]: string | string[];
|
|
9
14
|
};
|
|
10
15
|
llmCalls: LlmCall[];
|
|
11
16
|
environmentVariables: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScopeAnalysis.d.ts","sourceRoot":"","sources":["../../../../../types/src/types/ScopeAnalysis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,aAAa;IAC5B,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,iBAAiB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC7C,2BAA2B,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ScopeAnalysis.d.ts","sourceRoot":"","sources":["../../../../../types/src/types/ScopeAnalysis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,aAAa;IAC5B,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,iBAAiB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC7C;;;;OAIG;IACH,2BAA2B,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC;IAClE,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC"}
|
|
@@ -16,8 +16,8 @@ export interface ConditionalUsage {
|
|
|
16
16
|
conditionType: 'truthiness' | 'comparison' | 'switch';
|
|
17
17
|
/** For comparison conditions, the literal values being compared against */
|
|
18
18
|
comparedValues?: string[];
|
|
19
|
-
/** Where this conditional usage occurs */
|
|
20
|
-
location: 'if' | 'ternary' | 'logical-and' | 'switch';
|
|
19
|
+
/** Where this conditional usage occurs. 'unconditional' is for always-rendered children with data props. */
|
|
20
|
+
location: 'if' | 'ternary' | 'logical-and' | 'switch' | 'unconditional';
|
|
21
21
|
/** Source location information for this conditional usage */
|
|
22
22
|
sourceLocation?: {
|
|
23
23
|
/** Line number (1-based) */
|
|
@@ -106,8 +106,8 @@ export interface CompoundConditional {
|
|
|
106
106
|
/** Required value for this condition to be true */
|
|
107
107
|
requiredValue?: string | boolean;
|
|
108
108
|
}[];
|
|
109
|
-
/** Where this compound conditional occurs */
|
|
110
|
-
location: 'if' | 'ternary' | 'logical-and' | 'switch';
|
|
109
|
+
/** Where this compound conditional occurs. 'unconditional' is for always-rendered children. */
|
|
110
|
+
location: 'if' | 'ternary' | 'logical-and' | 'switch' | 'unconditional';
|
|
111
111
|
/** Source location for the entire compound expression */
|
|
112
112
|
sourceLocation: {
|
|
113
113
|
lineNumber: number;
|
|
@@ -190,7 +190,8 @@ export interface ConditionalEffect {
|
|
|
190
190
|
export interface DataStructure {
|
|
191
191
|
signatureSchema: { [key: string]: string };
|
|
192
192
|
returnValueSchema: { [key: string]: string };
|
|
193
|
-
|
|
193
|
+
// Values can be arrays for OR expressions where a variable maps to multiple sources
|
|
194
|
+
equivalentSignatureVariables: { [key: string]: string | string[] };
|
|
194
195
|
usageEquivalencies?: {
|
|
195
196
|
[key: string]: { scopeNodeName: string; schemaPath: string }[];
|
|
196
197
|
};
|
|
@@ -3,7 +3,12 @@ import { LlmCall } from './LlmCall';
|
|
|
3
3
|
export interface ScopeAnalysis {
|
|
4
4
|
instantiatedVariables: string[];
|
|
5
5
|
isolatedStructure: { [key: string]: string };
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Maps variable names to their equivalent paths.
|
|
8
|
+
* Supports multiple equivalencies per key (e.g., for OR expressions like `x = a || b`
|
|
9
|
+
* where x is equivalent to both a and b).
|
|
10
|
+
*/
|
|
11
|
+
isolatedEquivalentVariables: { [key: string]: string | string[] };
|
|
7
12
|
llmCalls: LlmCall[];
|
|
8
13
|
environmentVariables: string[];
|
|
9
14
|
}
|