@hongmaple0820/scale-engine 0.43.0 → 0.44.0

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/dist/api/cli.js CHANGED
@@ -17,7 +17,7 @@ import { ProjectAnatomy } from '../context/ProjectAnatomy.js';
17
17
  import { buildContextPack, doctorContextBudget, scanContextBudget, writeContextBudgetReport, } from '../context/ContextBudget.js';
18
18
  import { resolvePromptCachePolicy } from '../routing/PromptCachePolicy.js';
19
19
  import { CerebrumManager } from '../knowledge/CerebrumManager.js';
20
- import { buildCodeGraphContext, createCodeGraphRoiReport, impactCodeGraph, inspectCodeIntelligence, queryCodeGraph, writeCodeIntelligenceConfig, } from '../codegraph/CodeIntelligence.js';
20
+ import { buildCodeGraphContext, createCodeGraphRoiReport, dumpCodeGraphData, impactCodeGraph, inspectCodeIntelligence, queryCodeGraph, writeCodeIntelligenceConfig, } from '../codegraph/CodeIntelligence.js';
21
21
  import { WorkflowEvalStore, compareWorkflowEvalRuns, renderWorkflowEvalReport, runWorkflowEvalSuite, } from '../eval/WorkflowEval.js';
22
22
  import { FSMAgentBridge } from '../fsm/FSMAgentBridge.js';
23
23
  import { CapabilityRegistry } from '../capabilities/CapabilityRegistry.js';
@@ -1380,9 +1380,31 @@ function printCodeGraphReport(report) {
1380
1380
  for (const warning of report.warnings)
1381
1381
  console.log(` warning: ${warning}`);
1382
1382
  }
1383
+ const codegraphDump = defineCommand({
1384
+ meta: { name: 'dump', description: 'Dump full topology graph (nodes + edges) for visualization' },
1385
+ args: {
1386
+ dir: { type: 'string', default: PROJECT_DIR, description: 'Project directory' },
1387
+ out: { type: 'string', description: 'Output file path (default: stdout as JSON)' },
1388
+ },
1389
+ run({ args }) {
1390
+ const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
1391
+ const scaleDir = resolveScaleDirForProject(projectDir);
1392
+ const graph = dumpCodeGraphData({ projectDir, scaleDir });
1393
+ const json = JSON.stringify(graph, null, 2);
1394
+ const outPath = args.out ? resolve(String(args.out)) : undefined;
1395
+ if (outPath) {
1396
+ mkdirSync(dirname(outPath), { recursive: true });
1397
+ writeFileSync(outPath, json, 'utf-8');
1398
+ console.log(`Topology written to ${outPath} (${graph.nodes.length} nodes, ${graph.edges.length} edges)`);
1399
+ }
1400
+ else {
1401
+ console.log(json);
1402
+ }
1403
+ },
1404
+ });
1383
1405
  const codegraph = defineCommand({
1384
1406
  meta: { name: 'codegraph', description: 'Adapter-first code intelligence and exploration ROI' },
1385
- subCommands: { status: codegraphStatus, init: codegraphInit, query: codegraphQuery, impact: codegraphImpact, context: codegraphContext, roi: codegraphRoi },
1407
+ subCommands: { status: codegraphStatus, init: codegraphInit, query: codegraphQuery, impact: codegraphImpact, context: codegraphContext, roi: codegraphRoi, dump: codegraphDump },
1386
1408
  });
1387
1409
  // ============================================================================
1388
1410
  // eval command - Workflow eval baseline and failure replay