@codeyam/codeyam-cli 0.1.0-staging.79ef713 → 0.1.0-staging.7c30edc
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/packages/ai/src/lib/astScopes/processExpression.ts +101 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +6 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +176 -8
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +46 -6
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +33 -15
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +32 -5
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +38 -2
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +359 -142
- package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +24 -4
- package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/analysisToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/branchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/commitToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/fileToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +6 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
- package/analyzer-template/packages/database/src/lib/projectToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/saveFiles.ts +1 -1
- package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +3 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts +23 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +4 -0
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +7 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +4 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/background/src/lib/local/createLocalAnalyzer.js +1 -1
- package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
- package/codeyam-cli/src/cli.js +2 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/codeyam-cli.js +18 -2
- package/codeyam-cli/src/codeyam-cli.js.map +1 -1
- package/codeyam-cli/src/commands/analyze.js +2 -0
- package/codeyam-cli/src/commands/analyze.js.map +1 -1
- package/codeyam-cli/src/commands/baseline.js +2 -0
- package/codeyam-cli/src/commands/baseline.js.map +1 -1
- package/codeyam-cli/src/commands/debug.js +2 -0
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/commands/default.js +25 -19
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/detect-universal-mocks.js +2 -0
- package/codeyam-cli/src/commands/detect-universal-mocks.js.map +1 -1
- package/codeyam-cli/src/commands/init.js +49 -257
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/memory.js +9 -9
- package/codeyam-cli/src/commands/memory.js.map +1 -1
- package/codeyam-cli/src/commands/recapture.js +2 -0
- package/codeyam-cli/src/commands/recapture.js.map +1 -1
- package/codeyam-cli/src/commands/setup-sandbox.js +2 -0
- package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -1
- package/codeyam-cli/src/commands/setup-simulations.js +284 -0
- package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
- package/codeyam-cli/src/commands/test-startup.js +2 -0
- package/codeyam-cli/src/commands/test-startup.js.map +1 -1
- package/codeyam-cli/src/commands/verify.js +2 -0
- package/codeyam-cli/src/commands/verify.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +127 -85
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analyzer.js +7 -0
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/install-skills.js +41 -61
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/labsAutoCheck.js +48 -0
- package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -0
- package/codeyam-cli/src/utils/progress.js +7 -0
- package/codeyam-cli/src/utils/progress.js.map +1 -1
- package/codeyam-cli/src/utils/requireSimulations.js +10 -0
- package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +4 -4
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +95 -2
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +4 -4
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +3 -3
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -1
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +23 -23
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -1
- package/codeyam-cli/src/utils/rules/parser.js +5 -0
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -1
- package/codeyam-cli/src/utils/rules/ruleState.js +10 -10
- package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -1
- package/codeyam-cli/src/utils/rules/staleness.js +6 -6
- package/codeyam-cli/src/utils/rules/staleness.js.map +1 -1
- package/codeyam-cli/src/utils/serverState.js +37 -10
- package/codeyam-cli/src/utils/serverState.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +19 -42
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js +14 -3
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/backgroundServer.js +31 -0
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-CN61MOMa.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.labs-survey-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.labs-unlock-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-CuCsBc3b.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/labs-CB3MGcys.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{manifest-87319d0f.js → manifest-de6ccaf4.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/memory-DCA-kLYt.js +81 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-F7e6dvys.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/settings-BejnUJ6R.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/{index-9ox9LcrG.js → index-CFKHuovO.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BQe9Dh4p.js +260 -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-hook.sh +14 -14
- package/codeyam-cli/templates/codeyam:diagnose.md +193 -515
- package/codeyam-cli/templates/codeyam:memory.md +9 -21
- package/codeyam-cli/templates/codeyam:setup.md +12 -0
- package/codeyam-cli/templates/rule-reflection-hook.py +64 -27
- package/codeyam-cli/templates/rules-instructions.md +50 -41
- package/package.json +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +78 -1
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/astScopes/sharedPatterns.js +25 -0
- package/packages/ai/src/lib/astScopes/sharedPatterns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +128 -7
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +40 -6
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
- package/packages/ai/src/lib/dataStructureChunking.js +26 -11
- package/packages/ai/src/lib/dataStructureChunking.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +22 -3
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +16 -2
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +242 -81
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
- package/packages/ai/src/lib/mergeJsonTypeDefinitions.js +5 -0
- package/packages/ai/src/lib/mergeJsonTypeDefinitions.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js +97 -0
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +17 -2
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/database/src/lib/analysisBranchToDb.js +1 -1
- package/packages/database/src/lib/analysisBranchToDb.js.map +1 -1
- package/packages/database/src/lib/analysisToDb.js +1 -1
- package/packages/database/src/lib/analysisToDb.js.map +1 -1
- package/packages/database/src/lib/branchToDb.js +1 -1
- package/packages/database/src/lib/branchToDb.js.map +1 -1
- package/packages/database/src/lib/commitBranchToDb.js +1 -1
- package/packages/database/src/lib/commitBranchToDb.js.map +1 -1
- package/packages/database/src/lib/commitToDb.js +1 -1
- package/packages/database/src/lib/commitToDb.js.map +1 -1
- package/packages/database/src/lib/fileToDb.js +1 -1
- package/packages/database/src/lib/fileToDb.js.map +1 -1
- package/packages/database/src/lib/kysely/db.js +3 -0
- package/packages/database/src/lib/kysely/db.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
- package/packages/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
- package/packages/database/src/lib/projectToDb.js +1 -1
- package/packages/database/src/lib/projectToDb.js.map +1 -1
- package/packages/database/src/lib/saveFiles.js +1 -1
- package/packages/database/src/lib/saveFiles.js.map +1 -1
- package/packages/database/src/lib/scenarioToDb.js +1 -1
- package/packages/database/src/lib/scenarioToDb.js.map +1 -1
- package/scripts/finalize-analyzer.cjs +8 -76
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DfKzxuoe.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/globals-Bh6jH0cL.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-CdVUfvji.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/memory-CPIDnDEj.js +0 -76
- package/codeyam-cli/src/webserver/build/client/assets/root-D6oziHts.js +0 -62
- package/codeyam-cli/src/webserver/build/client/assets/settings-eBI36Yv5.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-Cq5Vqcob.js +0 -260
|
@@ -181,6 +181,7 @@ const SILENTLY_IGNORED_EQUIVALENCY_REASONS = new Set([
|
|
|
181
181
|
'transformed non-object function equivalency - implicit parent equivalency - rerouted via useCallback',
|
|
182
182
|
'transformed non-object function equivalency - Array.from() equivalency',
|
|
183
183
|
'Spread operator equivalency key update: Explicit array deconstruction equivalency value',
|
|
184
|
+
// 'transformed non-object function equivalency - Explicit array deconstruction equivalency value',
|
|
184
185
|
]);
|
|
185
186
|
export class ScopeDataStructure {
|
|
186
187
|
// Getter for backward compatibility - returns the tree structure
|
|
@@ -1925,6 +1926,8 @@ export class ScopeDataStructure {
|
|
|
1925
1926
|
return;
|
|
1926
1927
|
}
|
|
1927
1928
|
const usageScopeNode = this.getScopeOrFunctionCallInfo(usageEquivalency.scopeNodeName);
|
|
1929
|
+
if (!usageScopeNode)
|
|
1930
|
+
continue;
|
|
1928
1931
|
// Guard against infinite recursion by tracking which paths we've already
|
|
1929
1932
|
// added from addComplexSourcePathVariables
|
|
1930
1933
|
if (this.visitedTracker.checkAndMarkComplexSourceVisited(usageScopeNode.name, newUsageEquivalentPath)) {
|
|
@@ -1973,6 +1976,8 @@ export class ScopeDataStructure {
|
|
|
1973
1976
|
continue;
|
|
1974
1977
|
}
|
|
1975
1978
|
const usageScopeNode = this.getScopeOrFunctionCallInfo(usageEquivalency.scopeNodeName);
|
|
1979
|
+
if (!usageScopeNode)
|
|
1980
|
+
continue;
|
|
1976
1981
|
// This is put in place to avoid propagating array functions like 'filter' through complex equivalencies
|
|
1977
1982
|
// but may cause problems if the funtion call is not on a known object (e.g. string or array)
|
|
1978
1983
|
if (newUsageEquivalentPath.endsWith(')') ||
|
|
@@ -2703,21 +2708,91 @@ export class ScopeDataStructure {
|
|
|
2703
2708
|
}
|
|
2704
2709
|
return [source];
|
|
2705
2710
|
};
|
|
2706
|
-
|
|
2711
|
+
const acc = entries.reduce((result, entry) => {
|
|
2707
2712
|
var _a;
|
|
2708
2713
|
if (entry.sourceCandidates.length === 0)
|
|
2709
|
-
return
|
|
2714
|
+
return result;
|
|
2710
2715
|
const usages = entry.usages.filter(usageMatchesScope);
|
|
2711
2716
|
for (const usage of usages) {
|
|
2712
|
-
|
|
2717
|
+
result[_a = usage.schemaPath] || (result[_a] = []);
|
|
2713
2718
|
// Resolve each source candidate through the equivalency chain
|
|
2714
2719
|
for (const source of entry.sourceCandidates) {
|
|
2715
2720
|
const resolvedSources = resolveToSignature(source, new Set());
|
|
2716
|
-
|
|
2721
|
+
result[usage.schemaPath].push(...resolvedSources);
|
|
2717
2722
|
}
|
|
2718
2723
|
}
|
|
2719
|
-
return
|
|
2724
|
+
return result;
|
|
2720
2725
|
}, {});
|
|
2726
|
+
// Post-processing: enrich useState-backed sources with co-located external
|
|
2727
|
+
// function calls. When a useState value resolves to a setter variable that
|
|
2728
|
+
// lives in the same scope as a fetch/API call, that fetch is a data source.
|
|
2729
|
+
this.enrichUseStateSourcesWithCoLocatedCalls(acc);
|
|
2730
|
+
return acc;
|
|
2731
|
+
}
|
|
2732
|
+
/**
|
|
2733
|
+
* For each source that ends at a useState path, check if the setter was called
|
|
2734
|
+
* from a scope that also contains external function calls (like fetch).
|
|
2735
|
+
* If so, add those external calls as additional source candidates.
|
|
2736
|
+
*/
|
|
2737
|
+
enrichUseStateSourcesWithCoLocatedCalls(acc) {
|
|
2738
|
+
const rootScopeName = this.scopeTreeManager.getRootName();
|
|
2739
|
+
const rootScope = this.scopeNodes[rootScopeName];
|
|
2740
|
+
if (!rootScope)
|
|
2741
|
+
return;
|
|
2742
|
+
// Collect all descendants for each scope node
|
|
2743
|
+
const getAllDescendants = (node) => {
|
|
2744
|
+
const names = new Set([node.name]);
|
|
2745
|
+
for (const child of node.children) {
|
|
2746
|
+
for (const name of getAllDescendants(child)) {
|
|
2747
|
+
names.add(name);
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2750
|
+
return names;
|
|
2751
|
+
};
|
|
2752
|
+
for (const [usagePath, sources] of Object.entries(acc)) {
|
|
2753
|
+
const additionalSources = [];
|
|
2754
|
+
for (const source of sources) {
|
|
2755
|
+
// Check if this source is a useState-related terminal path
|
|
2756
|
+
// (e.g., useState(X).functionCallReturnValue[1] or useState(X).signature[0])
|
|
2757
|
+
if (!source.schemaPath.match(/^useState\([^)]*\)\./))
|
|
2758
|
+
continue;
|
|
2759
|
+
// Find the useState call from the source path
|
|
2760
|
+
const useStateCallMatch = source.schemaPath.match(/^(useState\([^)]*\))\./);
|
|
2761
|
+
if (!useStateCallMatch)
|
|
2762
|
+
continue;
|
|
2763
|
+
const useStateCall = useStateCallMatch[1];
|
|
2764
|
+
// Look in the root scope for the useState value equivalency
|
|
2765
|
+
// which tells us where the setter was called from
|
|
2766
|
+
const valuePath = `${useStateCall}.functionCallReturnValue[0]`;
|
|
2767
|
+
const valueEquivs = rootScope.equivalencies[valuePath];
|
|
2768
|
+
if (!valueEquivs)
|
|
2769
|
+
continue;
|
|
2770
|
+
for (const equiv of valueEquivs) {
|
|
2771
|
+
// Find the scope where the setter was called
|
|
2772
|
+
const setterScopeName = equiv.scopeNodeName;
|
|
2773
|
+
const setterScopeTree = this.scopeTreeManager.findNode(setterScopeName);
|
|
2774
|
+
if (!setterScopeTree)
|
|
2775
|
+
continue;
|
|
2776
|
+
// Get all descendant scope names from the setter scope
|
|
2777
|
+
const relatedScopes = getAllDescendants(setterScopeTree);
|
|
2778
|
+
// Find external function calls in those scopes whose return values
|
|
2779
|
+
// are actually consumed (assigned to a variable). This excludes
|
|
2780
|
+
// fire-and-forget calls like analytics.track() or console.log().
|
|
2781
|
+
const coLocatedCalls = this.externalFunctionCalls.filter((efc) => relatedScopes.has(efc.callScope) &&
|
|
2782
|
+
efc.receivingVariableNames &&
|
|
2783
|
+
efc.receivingVariableNames.length > 0);
|
|
2784
|
+
for (const call of coLocatedCalls) {
|
|
2785
|
+
additionalSources.push({
|
|
2786
|
+
scopeNodeName: call.callScope,
|
|
2787
|
+
schemaPath: `${call.callSignature}.functionCallReturnValue`,
|
|
2788
|
+
});
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
if (additionalSources.length > 0) {
|
|
2793
|
+
acc[usagePath].push(...additionalSources);
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
2721
2796
|
}
|
|
2722
2797
|
getUsageEquivalencies(functionName) {
|
|
2723
2798
|
const scopeNode = this.getScopeOrFunctionCallInfo(functionName);
|
|
@@ -3114,6 +3189,13 @@ export class ScopeDataStructure {
|
|
|
3114
3189
|
!equivalentValue.schemaPath.startsWith('signature[') && // not a signature path
|
|
3115
3190
|
!equivalentValue.schemaPath.endsWith('.functionCallReturnValue') // not already handled above
|
|
3116
3191
|
) {
|
|
3192
|
+
// Skip bare "returnValue" from child scopes — this is the child's return value,
|
|
3193
|
+
// not a meaningful data source path in the parent scope
|
|
3194
|
+
if (equivalentValue.schemaPath === 'returnValue' &&
|
|
3195
|
+
equivalentValue.scopeNodeName !==
|
|
3196
|
+
this.scopeTreeManager.getRootName()) {
|
|
3197
|
+
continue;
|
|
3198
|
+
}
|
|
3117
3199
|
// Add equivalency (will accumulate if multiple values for OR expressions)
|
|
3118
3200
|
addEquivalency(path, equivalentValue.schemaPath);
|
|
3119
3201
|
}
|
|
@@ -3673,6 +3755,7 @@ export class ScopeDataStructure {
|
|
|
3673
3755
|
*/
|
|
3674
3756
|
getEnrichedConditionalUsages() {
|
|
3675
3757
|
const enriched = {};
|
|
3758
|
+
console.log(`[getEnrichedConditionalUsages] Processing ${Object.keys(this.rawConditionalUsages).length} conditional paths: [${Object.keys(this.rawConditionalUsages).join(', ')}]`);
|
|
3676
3759
|
for (const [path, usages] of Object.entries(this.rawConditionalUsages)) {
|
|
3677
3760
|
// Try to trace this path back to a data source
|
|
3678
3761
|
// First, try the root scope
|
|
@@ -3680,9 +3763,47 @@ export class ScopeDataStructure {
|
|
|
3680
3763
|
const explanation = this.explainPath(rootScopeName, path);
|
|
3681
3764
|
let sourceDataPath;
|
|
3682
3765
|
if (explanation.source) {
|
|
3683
|
-
|
|
3684
|
-
|
|
3766
|
+
const { scope, path: sourcePath } = explanation.source;
|
|
3767
|
+
// Build initial path — avoid redundant prefix when path already contains the scope call
|
|
3768
|
+
let fullPath;
|
|
3769
|
+
if (sourcePath.startsWith(`${scope}(`)) {
|
|
3770
|
+
fullPath = sourcePath;
|
|
3771
|
+
}
|
|
3772
|
+
else {
|
|
3773
|
+
fullPath = `${scope}.${sourcePath}`;
|
|
3774
|
+
}
|
|
3775
|
+
sourceDataPath = fullPath;
|
|
3776
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" explainPath → scope="${scope}", sourcePath="${sourcePath}" → sourceDataPath="${sourceDataPath}"`);
|
|
3777
|
+
}
|
|
3778
|
+
else {
|
|
3779
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" explainPath → no source found`);
|
|
3780
|
+
}
|
|
3781
|
+
// If explainPath didn't find a useful external source (e.g., it traced to
|
|
3782
|
+
// useState or just to the component scope itself), check sourceEquivalencies
|
|
3783
|
+
// for an external function call source like a fetch call
|
|
3784
|
+
const hasExternalSource = sourceDataPath?.includes('.functionCallReturnValue');
|
|
3785
|
+
if (!hasExternalSource) {
|
|
3786
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" no external source (sourceDataPath="${sourceDataPath}"), checking sourceEquivalencies fallback...`);
|
|
3787
|
+
const sourceEquiv = this.getSourceEquivalencies();
|
|
3788
|
+
const returnValueKey = `returnValue.${path}`;
|
|
3789
|
+
const sources = sourceEquiv[returnValueKey];
|
|
3790
|
+
if (sources) {
|
|
3791
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" sourceEquivalencies["${returnValueKey}"] has ${sources.length} sources: [${sources.map((s) => s.schemaPath).join(', ')}]`);
|
|
3792
|
+
const externalSource = sources.find((s) => s.schemaPath.includes('.functionCallReturnValue') &&
|
|
3793
|
+
!s.schemaPath.startsWith('useState('));
|
|
3794
|
+
if (externalSource) {
|
|
3795
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" sourceEquivalencies fallback found external source: "${externalSource.schemaPath}"`);
|
|
3796
|
+
sourceDataPath = externalSource.schemaPath;
|
|
3797
|
+
}
|
|
3798
|
+
else {
|
|
3799
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" sourceEquivalencies fallback found no external function call source`);
|
|
3800
|
+
}
|
|
3801
|
+
}
|
|
3802
|
+
else {
|
|
3803
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" sourceEquivalencies["${returnValueKey}"] not found`);
|
|
3804
|
+
}
|
|
3685
3805
|
}
|
|
3806
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" FINAL sourceDataPath="${sourceDataPath ?? '(none)'}" (${usages.length} usages)`);
|
|
3686
3807
|
enriched[path] = usages.map((usage) => ({
|
|
3687
3808
|
...usage,
|
|
3688
3809
|
sourceDataPath,
|