@opensip-cli/graph 0.1.10 → 0.1.12
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/README.md +4 -2
- package/dist/__tests__/cache/engine-version.test.js +4 -4
- package/dist/__tests__/cache/engine-version.test.js.map +1 -1
- package/dist/__tests__/cli/graph.test.d.ts.map +1 -1
- package/dist/__tests__/cli/graph.test.js +0 -1
- package/dist/__tests__/cli/graph.test.js.map +1 -1
- package/dist/__tests__/internal-surface.test.js +1 -1
- package/dist/__tests__/internal-surface.test.js.map +1 -1
- package/dist/__tests__/public-api.test.js +14 -0
- package/dist/__tests__/public-api.test.js.map +1 -1
- package/dist/__tests__/render/catalog-json.test.d.ts.map +1 -1
- package/dist/__tests__/render/catalog-json.test.js +0 -1
- package/dist/__tests__/render/catalog-json.test.js.map +1 -1
- package/dist/__tests__/rules/registry.test.js +1 -0
- package/dist/__tests__/rules/registry.test.js.map +1 -1
- package/dist/cache/engine-version.d.ts.map +1 -1
- package/dist/cache/engine-version.js +5 -1
- package/dist/cache/engine-version.js.map +1 -1
- package/dist/cli/__tests__/equivalence-diagnostic.test.d.ts +7 -0
- package/dist/cli/__tests__/equivalence-diagnostic.test.d.ts.map +1 -0
- package/dist/cli/__tests__/equivalence-diagnostic.test.js +136 -0
- package/dist/cli/__tests__/equivalence-diagnostic.test.js.map +1 -0
- package/dist/cli/__tests__/graph-envelope-view.test.js +9 -9
- package/dist/cli/__tests__/graph-envelope-view.test.js.map +1 -1
- package/dist/cli/__tests__/graph-runner.test.d.ts +5 -0
- package/dist/cli/__tests__/graph-runner.test.d.ts.map +1 -0
- package/dist/cli/__tests__/graph-runner.test.js +100 -0
- package/dist/cli/__tests__/graph-runner.test.js.map +1 -0
- package/dist/cli/equivalence-check-command.d.ts.map +1 -1
- package/dist/cli/equivalence-check-command.js +35 -6
- package/dist/cli/equivalence-check-command.js.map +1 -1
- package/dist/cli/equivalence-diagnostic.d.ts +100 -0
- package/dist/cli/equivalence-diagnostic.d.ts.map +1 -0
- package/dist/cli/equivalence-diagnostic.js +138 -0
- package/dist/cli/equivalence-diagnostic.js.map +1 -0
- package/dist/cli/graph/graph-aux-command-specs.d.ts +0 -25
- package/dist/cli/graph/graph-aux-command-specs.d.ts.map +1 -1
- package/dist/cli/graph/graph-aux-command-specs.js +6 -12
- package/dist/cli/graph/graph-aux-command-specs.js.map +1 -1
- package/dist/cli/graph/graph-command-spec.d.ts +3 -3
- package/dist/cli/graph/graph-command-spec.d.ts.map +1 -1
- package/dist/cli/graph/graph-command-spec.js +7 -4
- package/dist/cli/graph/graph-command-spec.js.map +1 -1
- package/dist/cli/graph-config-schema.d.ts +3 -0
- package/dist/cli/graph-config-schema.d.ts.map +1 -1
- package/dist/cli/graph-config-schema.js +11 -1
- package/dist/cli/graph-config-schema.js.map +1 -1
- package/dist/cli/graph-config.d.ts.map +1 -1
- package/dist/cli/graph-config.js +5 -10
- package/dist/cli/graph-config.js.map +1 -1
- package/dist/cli/graph-envelope-view.d.ts +7 -36
- package/dist/cli/graph-envelope-view.d.ts.map +1 -1
- package/dist/cli/graph-envelope-view.js +7 -102
- package/dist/cli/graph-envelope-view.js.map +1 -1
- package/dist/cli/graph-modes.d.ts.map +1 -1
- package/dist/cli/graph-modes.js +6 -5
- package/dist/cli/graph-modes.js.map +1 -1
- package/dist/cli/graph-report.d.ts +4 -6
- package/dist/cli/graph-report.d.ts.map +1 -1
- package/dist/cli/graph-report.js +2 -2
- package/dist/cli/graph-report.js.map +1 -1
- package/dist/cli/graph-result-delivery.d.ts +30 -0
- package/dist/cli/graph-result-delivery.d.ts.map +1 -0
- package/dist/cli/graph-result-delivery.js +231 -0
- package/dist/cli/graph-result-delivery.js.map +1 -0
- package/dist/cli/graph-runner.d.ts +2 -83
- package/dist/cli/graph-runner.d.ts.map +1 -1
- package/dist/cli/graph-runner.js +71 -215
- package/dist/cli/graph-runner.js.map +1 -1
- package/dist/cli/graph-session-contribution.d.ts.map +1 -1
- package/dist/cli/graph-session-contribution.js +6 -2
- package/dist/cli/graph-session-contribution.js.map +1 -1
- package/dist/cli/graph-sharded-engine.d.ts.map +1 -1
- package/dist/cli/graph-sharded-engine.js +0 -1
- package/dist/cli/graph-sharded-engine.js.map +1 -1
- package/dist/cli/graph-single-run-mode.d.ts.map +1 -1
- package/dist/cli/graph-single-run-mode.js +0 -4
- package/dist/cli/graph-single-run-mode.js.map +1 -1
- package/dist/cli/graph-worker.d.ts.map +1 -1
- package/dist/cli/graph-worker.js +0 -1
- package/dist/cli/graph-worker.js.map +1 -1
- package/dist/cli/graph.d.ts +2 -22
- package/dist/cli/graph.d.ts.map +1 -1
- package/dist/cli/graph.js +3 -256
- package/dist/cli/graph.js.map +1 -1
- package/dist/cli/list-files.d.ts.map +1 -1
- package/dist/cli/list-files.js +0 -2
- package/dist/cli/list-files.js.map +1 -1
- package/dist/cli/orchestrate/__tests__/cross-shard-resolve.test.js +76 -0
- package/dist/cli/orchestrate/__tests__/cross-shard-resolve.test.js.map +1 -1
- package/dist/cli/orchestrate/cache-orchestrator.d.ts.map +1 -1
- package/dist/cli/orchestrate/cache-orchestrator.js +0 -1
- package/dist/cli/orchestrate/cache-orchestrator.js.map +1 -1
- package/dist/cli/orchestrate/catalog-stats.d.ts.map +1 -1
- package/dist/cli/orchestrate/catalog-stats.js +0 -1
- package/dist/cli/orchestrate/catalog-stats.js.map +1 -1
- package/dist/cli/orchestrate/cross-shard-resolve.d.ts.map +1 -1
- package/dist/cli/orchestrate/cross-shard-resolve.js +77 -2
- package/dist/cli/orchestrate/cross-shard-resolve.js.map +1 -1
- package/dist/cli/orchestrate/flat-monorepo-strategy.d.ts.map +1 -1
- package/dist/cli/orchestrate/flat-monorepo-strategy.js +0 -1
- package/dist/cli/orchestrate/flat-monorepo-strategy.js.map +1 -1
- package/dist/cli/orchestrate/sharded-graph.js +0 -4
- package/dist/cli/orchestrate/sharded-graph.js.map +1 -1
- package/dist/cli/orchestrate.d.ts.map +1 -1
- package/dist/cli/orchestrate.js +0 -1
- package/dist/cli/orchestrate.js.map +1 -1
- package/dist/cli/pressure-monitor.d.ts +2 -0
- package/dist/cli/pressure-monitor.d.ts.map +1 -1
- package/dist/cli/pressure-monitor.js +15 -1
- package/dist/cli/pressure-monitor.js.map +1 -1
- package/dist/cli/report-data.d.ts.map +1 -1
- package/dist/cli/report-data.js +0 -1
- package/dist/cli/report-data.js.map +1 -1
- package/dist/cli/workspace-runner.d.ts.map +1 -1
- package/dist/cli/workspace-runner.js +0 -1
- package/dist/cli/workspace-runner.js.map +1 -1
- package/dist/identity.d.ts +5 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +6 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +4 -6
- package/dist/internal.js.map +1 -1
- package/dist/lang-adapter/__tests__/language-of-file.test.d.ts +2 -0
- package/dist/lang-adapter/__tests__/language-of-file.test.d.ts.map +1 -0
- package/dist/lang-adapter/__tests__/language-of-file.test.js +36 -0
- package/dist/lang-adapter/__tests__/language-of-file.test.js.map +1 -0
- package/dist/lang-adapter/__tests__/near-duplicate-signature.test.d.ts +2 -0
- package/dist/lang-adapter/__tests__/near-duplicate-signature.test.d.ts.map +1 -0
- package/dist/lang-adapter/__tests__/near-duplicate-signature.test.js +78 -0
- package/dist/lang-adapter/__tests__/near-duplicate-signature.test.js.map +1 -0
- package/dist/lang-adapter/body-digest.d.ts +9 -41
- package/dist/lang-adapter/body-digest.d.ts.map +1 -1
- package/dist/lang-adapter/body-digest.js +9 -44
- package/dist/lang-adapter/body-digest.js.map +1 -1
- package/dist/lang-adapter/language-of-file.d.ts +15 -0
- package/dist/lang-adapter/language-of-file.d.ts.map +1 -0
- package/dist/lang-adapter/language-of-file.js +43 -0
- package/dist/lang-adapter/language-of-file.js.map +1 -0
- package/dist/lang-adapter/near-duplicate-signature.d.ts +12 -0
- package/dist/lang-adapter/near-duplicate-signature.d.ts.map +1 -0
- package/dist/lang-adapter/near-duplicate-signature.js +12 -0
- package/dist/lang-adapter/near-duplicate-signature.js.map +1 -0
- package/dist/lang-adapter/read-source.d.ts +20 -0
- package/dist/lang-adapter/read-source.d.ts.map +1 -0
- package/dist/lang-adapter/read-source.js +48 -0
- package/dist/lang-adapter/read-source.js.map +1 -0
- package/dist/lang-adapter/read-source.test.d.ts +2 -0
- package/dist/lang-adapter/read-source.test.d.ts.map +1 -0
- package/dist/lang-adapter/read-source.test.js +41 -0
- package/dist/lang-adapter/read-source.test.js.map +1 -0
- package/dist/lang-adapter/registry.d.ts.map +1 -1
- package/dist/lang-adapter/registry.js +0 -1
- package/dist/lang-adapter/registry.js.map +1 -1
- package/dist/persistence/catalog-repo.d.ts.map +1 -1
- package/dist/persistence/catalog-repo.js +1 -0
- package/dist/persistence/catalog-repo.js.map +1 -1
- package/dist/persistence/session-payload.d.ts.map +1 -1
- package/dist/persistence/session-payload.js +0 -1
- package/dist/persistence/session-payload.js.map +1 -1
- package/dist/persistence/session-replay.d.ts.map +1 -1
- package/dist/persistence/session-replay.js +10 -25
- package/dist/persistence/session-replay.js.map +1 -1
- package/dist/pipeline/feature-deps.d.ts.map +1 -1
- package/dist/pipeline/feature-deps.js +0 -1
- package/dist/pipeline/feature-deps.js.map +1 -1
- package/dist/pipeline/features.d.ts.map +1 -1
- package/dist/pipeline/features.js +0 -1
- package/dist/pipeline/features.js.map +1 -1
- package/dist/pipeline/indexes.d.ts.map +1 -1
- package/dist/pipeline/indexes.js +0 -1
- package/dist/pipeline/indexes.js.map +1 -1
- package/dist/recipes/resolve.d.ts.map +1 -1
- package/dist/recipes/resolve.js +0 -1
- package/dist/recipes/resolve.js.map +1 -1
- package/dist/render/rule-id-mapping.d.ts.map +1 -1
- package/dist/render/rule-id-mapping.js +1 -0
- package/dist/render/rule-id-mapping.js.map +1 -1
- package/dist/rules/__tests__/near-duplicate-function-body.test.d.ts +2 -0
- package/dist/rules/__tests__/near-duplicate-function-body.test.d.ts.map +1 -0
- package/dist/rules/__tests__/near-duplicate-function-body.test.js +142 -0
- package/dist/rules/__tests__/near-duplicate-function-body.test.js.map +1 -0
- package/dist/rules/_entry-points.d.ts.map +1 -1
- package/dist/rules/_entry-points.js +0 -1
- package/dist/rules/_entry-points.js.map +1 -1
- package/dist/rules/define-rule.d.ts.map +1 -1
- package/dist/rules/define-rule.js +0 -3
- package/dist/rules/define-rule.js.map +1 -1
- package/dist/rules/duplicated-function-body.d.ts +12 -34
- package/dist/rules/duplicated-function-body.d.ts.map +1 -1
- package/dist/rules/duplicated-function-body.js +83 -233
- package/dist/rules/duplicated-function-body.js.map +1 -1
- package/dist/rules/near-duplicate-function-body.d.ts +11 -0
- package/dist/rules/near-duplicate-function-body.d.ts.map +1 -0
- package/dist/rules/near-duplicate-function-body.js +74 -0
- package/dist/rules/near-duplicate-function-body.js.map +1 -0
- package/dist/rules/registry.d.ts.map +1 -1
- package/dist/rules/registry.js +2 -1
- package/dist/rules/registry.js.map +1 -1
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +8 -4
- package/dist/tool.js.map +1 -1
- package/dist/types.d.ts +21 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +16 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-envelope-view.test.js","sourceRoot":"","sources":["../../../src/cli/__tests__/graph-envelope-view.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"graph-envelope-view.test.js","sourceRoot":"","sources":["../../../src/cli/__tests__/graph-envelope-view.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,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AC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runner.test.d.ts","sourceRoot":"","sources":["../../../src/cli/__tests__/graph-runner.test.tsx"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* graph-runner produce() mapping — summary, verbose lines/table gates.
|
|
3
|
+
*/
|
|
4
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
5
|
+
import { renderGraphLive } from '../graph-runner.js';
|
|
6
|
+
const runToolLiveView = vi.hoisted(() => vi.fn());
|
|
7
|
+
const runOffThreadOrInProcess = vi.hoisted(() => vi.fn());
|
|
8
|
+
vi.mock('@opensip-cli/cli-live', () => ({
|
|
9
|
+
runToolLiveView,
|
|
10
|
+
}));
|
|
11
|
+
vi.mock('@opensip-cli/core', async (importOriginal) => {
|
|
12
|
+
const actual = await importOriginal();
|
|
13
|
+
return {
|
|
14
|
+
...actual,
|
|
15
|
+
runOffThreadOrInProcess,
|
|
16
|
+
currentScope: vi.fn(() => ({ runId: 'RUN_graph_test' })),
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
function liveGraphOutput() {
|
|
20
|
+
const signals = [
|
|
21
|
+
{
|
|
22
|
+
id: 'sig_cycle',
|
|
23
|
+
source: 'graph:cycle',
|
|
24
|
+
provider: 'opensip-cli',
|
|
25
|
+
severity: 'high',
|
|
26
|
+
category: 'architecture',
|
|
27
|
+
ruleId: 'graph:cycle',
|
|
28
|
+
message: 'cycle detected',
|
|
29
|
+
filePath: 'src/a.ts',
|
|
30
|
+
line: 1,
|
|
31
|
+
metadata: {},
|
|
32
|
+
createdAt: '2026-06-04T00:00:00.000Z',
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
return {
|
|
36
|
+
signals,
|
|
37
|
+
suppressedCount: 0,
|
|
38
|
+
reportLines: ['Graph catalog line'],
|
|
39
|
+
resolutionMode: 'fast',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
let capturedSpec;
|
|
43
|
+
beforeEach(() => {
|
|
44
|
+
capturedSpec = undefined;
|
|
45
|
+
runToolLiveView.mockReset();
|
|
46
|
+
runOffThreadOrInProcess.mockReset();
|
|
47
|
+
runOffThreadOrInProcess.mockImplementation(({ inProcess }) => ({
|
|
48
|
+
onProgress: vi.fn(),
|
|
49
|
+
result: Promise.resolve(inProcess(vi.fn())),
|
|
50
|
+
}));
|
|
51
|
+
runToolLiveView.mockImplementation((spec) => {
|
|
52
|
+
capturedSpec = spec;
|
|
53
|
+
return Promise.resolve({});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
describe('renderGraphLive produce mapping', () => {
|
|
57
|
+
it('routes through runToolLiveView with the graph tool key', async () => {
|
|
58
|
+
await renderGraphLive({ cwd: '/proj' });
|
|
59
|
+
expect(runToolLiveView).toHaveBeenCalledTimes(1);
|
|
60
|
+
expect(capturedSpec?.tool).toBe('graph');
|
|
61
|
+
});
|
|
62
|
+
it('omits verbose lines and table on compact runs', async () => {
|
|
63
|
+
runOffThreadOrInProcess.mockImplementation(() => ({
|
|
64
|
+
onProgress: vi.fn(),
|
|
65
|
+
result: Promise.resolve(liveGraphOutput()),
|
|
66
|
+
}));
|
|
67
|
+
await renderGraphLive({ cwd: '/proj', verbose: false });
|
|
68
|
+
const outcome = await capturedSpec.produce(vi.fn(), {
|
|
69
|
+
setRunning: vi.fn(),
|
|
70
|
+
setHeaderMetadata: vi.fn(),
|
|
71
|
+
setShowRunHeader: vi.fn(),
|
|
72
|
+
});
|
|
73
|
+
expect(outcome.kind).toBe('done');
|
|
74
|
+
if (outcome.kind !== 'done')
|
|
75
|
+
return;
|
|
76
|
+
expect(outcome.done.verboseLines).toBeUndefined();
|
|
77
|
+
expect(outcome.done.table).toBeUndefined();
|
|
78
|
+
expect(outcome.done.summary).toMatchObject({ passed: false, errors: 1, warnings: 0 });
|
|
79
|
+
expect(outcome.session?.tool).toBe('graph');
|
|
80
|
+
});
|
|
81
|
+
it('includes verbose lines and the per-rule table when --verbose', async () => {
|
|
82
|
+
runOffThreadOrInProcess.mockImplementation(() => ({
|
|
83
|
+
onProgress: vi.fn(),
|
|
84
|
+
result: Promise.resolve(liveGraphOutput()),
|
|
85
|
+
}));
|
|
86
|
+
await renderGraphLive({ cwd: '/proj', verbose: true });
|
|
87
|
+
const outcome = await capturedSpec.produce(vi.fn(), {
|
|
88
|
+
setRunning: vi.fn(),
|
|
89
|
+
setHeaderMetadata: vi.fn(),
|
|
90
|
+
setShowRunHeader: vi.fn(),
|
|
91
|
+
});
|
|
92
|
+
expect(outcome.kind).toBe('done');
|
|
93
|
+
if (outcome.kind !== 'done')
|
|
94
|
+
return;
|
|
95
|
+
expect(outcome.done.verboseLines).toEqual(['Graph catalog line']);
|
|
96
|
+
expect(outcome.done.table?.length).toBeGreaterThan(0);
|
|
97
|
+
expect(String(outcome.done.banner)).toMatch(/fast/i);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
//# sourceMappingURL=graph-runner.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runner.test.js","sourceRoot":"","sources":["../../../src/cli/__tests__/graph-runner.test.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAOrD,MAAM,eAAe,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAClD,MAAM,uBAAuB,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAE1D,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,GAAG,EAAE,CAAC,CAAC;IACtC,eAAe;CAChB,CAA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C,KAAK,EAAE,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equivalence-check-command.d.ts","sourceRoot":"","sources":["../../src/cli/equivalence-check-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;
|
|
1
|
+
{"version":3,"file":"equivalence-check-command.d.ts","sourceRoot":"","sources":["../../src/cli/equivalence-check-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAwBH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOxD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,2EAA2E;IAC3E,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACjC;AAwFD;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,uBAAuB,EAC7B,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,IAAI,CAAC,CA8Ef"}
|
|
@@ -31,9 +31,11 @@ import { dirname, resolve } from 'node:path';
|
|
|
31
31
|
import { EXIT_CODES } from '@opensip-cli/contracts';
|
|
32
32
|
import { logger } from '@opensip-cli/core';
|
|
33
33
|
import { pickAdapter } from '../lang-adapter/registry.js';
|
|
34
|
+
import { buildEquivalenceDiagnostic } from './equivalence-diagnostic.js';
|
|
34
35
|
import { resolveShardsForCwd } from './graph.js';
|
|
35
36
|
import { buildEquivalenceReport, judgeEquivalence, } from './orchestrate/equivalence-check.js';
|
|
36
37
|
import { runGraph, runShardedGraph } from './orchestrate.js';
|
|
38
|
+
import { readGraphEnv } from './pressure-monitor.js';
|
|
37
39
|
const MODULE = 'graph:cli';
|
|
38
40
|
/** Default committed budget path, relative to the target repo root. */
|
|
39
41
|
const DEFAULT_BUDGET_REL = '.config/graph-equivalence-budget.json';
|
|
@@ -116,7 +118,6 @@ async function buildShardedCatalog(input) {
|
|
|
116
118
|
* missing/invalid budget) is caught locally and converted to
|
|
117
119
|
* `EXIT_CODES.RUNTIME_ERROR` — so this function does not throw to its caller.
|
|
118
120
|
*/
|
|
119
|
-
// @fitness-ignore-next-line throws-documentation -- All throws in the body are caught by this function's own try/catch and converted to an exit code; the function never propagates an error to its caller, so a caller-facing @throws tag would be inaccurate.
|
|
120
121
|
export async function executeEquivalenceCheck(opts, cli) {
|
|
121
122
|
const cwd = resolve(opts.cwd);
|
|
122
123
|
const budgetPath = opts.budget ? resolve(cwd, opts.budget) : resolve(cwd, DEFAULT_BUDGET_REL);
|
|
@@ -132,13 +133,27 @@ export async function executeEquivalenceCheck(opts, cli) {
|
|
|
132
133
|
'The comparison requires a multi-package (shardable) repo so the sharded and ' +
|
|
133
134
|
'exact engines actually diverge through real dist/*.d.ts resolution.');
|
|
134
135
|
}
|
|
136
|
+
// Transparent passthrough wrappers: capture both catalogs ONLY to feed the
|
|
137
|
+
// optional GRAPH_EQUIV_DIAG dump. Behaviourally identical to passing the
|
|
138
|
+
// builders directly when the diagnostic is not requested.
|
|
139
|
+
let exactCatalog = null;
|
|
140
|
+
let shardedCatalog = null;
|
|
135
141
|
const report = await buildEquivalenceReport({
|
|
136
142
|
cwd,
|
|
137
143
|
shards,
|
|
138
144
|
cliScript,
|
|
139
|
-
buildExact:
|
|
140
|
-
|
|
145
|
+
buildExact: async (root) => {
|
|
146
|
+
const c = await buildExactCatalog(root);
|
|
147
|
+
exactCatalog = c;
|
|
148
|
+
return c;
|
|
149
|
+
},
|
|
150
|
+
buildSharded: async (input) => {
|
|
151
|
+
const c = await buildShardedCatalog(input);
|
|
152
|
+
shardedCatalog = c;
|
|
153
|
+
return c;
|
|
154
|
+
},
|
|
141
155
|
});
|
|
156
|
+
maybeWriteEquivalenceDiagnostic(report, exactCatalog, shardedCatalog, shards);
|
|
142
157
|
const seedMissing = opts.updateBudget === true && !existsSync(budgetPath);
|
|
143
158
|
const budget = seedMissing
|
|
144
159
|
? {
|
|
@@ -152,7 +167,6 @@ export async function executeEquivalenceCheck(opts, cli) {
|
|
|
152
167
|
for (const line of verdict.lines)
|
|
153
168
|
process.stdout.write(`${line}\n`);
|
|
154
169
|
if (opts.updateBudget === true) {
|
|
155
|
-
// @fitness-ignore-next-line detached-promises -- writeBudget is a synchronous void helper (writeFileSync); there is no promise to await.
|
|
156
170
|
writeBudget(budgetPath, verdict);
|
|
157
171
|
process.stdout.write(`Wrote budget phantom=${String(verdict.phantomCount)} ` +
|
|
158
172
|
`decline=${String(verdict.declineCount)} conflict=${String(verdict.conflictCount)} ` +
|
|
@@ -161,12 +175,10 @@ export async function executeEquivalenceCheck(opts, cli) {
|
|
|
161
175
|
// exit 0 so a maintainer can record the new floor without the (now-stale)
|
|
162
176
|
// budget failing the same invocation.
|
|
163
177
|
cli.setExitCode(EXIT_CODES.SUCCESS);
|
|
164
|
-
// @fitness-ignore-next-line detached-promises -- logEnd is a synchronous void helper (logger.info); there is no promise to await.
|
|
165
178
|
logEnd(report, verdict, false);
|
|
166
179
|
return;
|
|
167
180
|
}
|
|
168
181
|
cli.setExitCode(verdict.failed ? EXIT_CODES.RUNTIME_ERROR : EXIT_CODES.SUCCESS);
|
|
169
|
-
// @fitness-ignore-next-line detached-promises -- logEnd is a synchronous void helper (logger.info); there is no promise to await.
|
|
170
182
|
logEnd(report, verdict, verdict.failed);
|
|
171
183
|
}
|
|
172
184
|
catch (error) {
|
|
@@ -176,6 +188,23 @@ export async function executeEquivalenceCheck(opts, cli) {
|
|
|
176
188
|
cli.setExitCode(EXIT_CODES.RUNTIME_ERROR);
|
|
177
189
|
}
|
|
178
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Write the structured equivalence diagnostic to the path named by the
|
|
193
|
+
* `GRAPH_EQUIV_DIAG` env var (read through the governed {@link GRAPH_ENV}
|
|
194
|
+
* registry), if set and both catalogs were captured. Inert otherwise. Effectful
|
|
195
|
+
* seam (env gate + file + stdout) — the analysis itself is the pure
|
|
196
|
+
* {@link buildEquivalenceDiagnostic}. Mirrors {@link writeBudget}'s direct file
|
|
197
|
+
* write; this is a host CI/diagnostic command, not a tool action body.
|
|
198
|
+
*/
|
|
199
|
+
function maybeWriteEquivalenceDiagnostic(report, exact, sharded, shards) {
|
|
200
|
+
const outPath = readGraphEnv('GRAPH_EQUIV_DIAG');
|
|
201
|
+
if (outPath === undefined || outPath.length === 0 || exact === null || sharded === null)
|
|
202
|
+
return;
|
|
203
|
+
const diagnostic = buildEquivalenceDiagnostic({ report, exact, sharded, shards });
|
|
204
|
+
const payload = { generatedAt: new Date().toISOString(), ...diagnostic };
|
|
205
|
+
writeFileSync(outPath, `${JSON.stringify(payload, null, 2)}\n`, 'utf8');
|
|
206
|
+
process.stdout.write(`Wrote graph equivalence diagnostic to ${outPath}\n`);
|
|
207
|
+
}
|
|
179
208
|
function logEnd(report, verdict, failed) {
|
|
180
209
|
logger.info({
|
|
181
210
|
evt: 'graph.cli.equivalence_check.complete',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equivalence-check-command.js","sourceRoot":"","sources":["../../src/cli/equivalence-check-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MA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AI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,yCAAyC,OAAO,IAAI,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,MAAM,CACb,MAKC,EACD,OAA2B,EAC3B,MAAe;IAEf,MAAM,CAAC,IAAI,CAAC;QACV,GAAG,EAAE,sCAAsC;QAC3C,MAAM,EAAE,MAAM;QACd,MAAM;QACN,kBAAkB,EAAE,MAAM,CAAC,6BAA6B,CAAC,MAAM;QAC/D,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,QAAQ,EAAE,OAAO,CAAC,aAAa;QAC/B,YAAY,EAAE,MAAM,CAAC,uBAAuB,CAAC,MAAM;QACnD,UAAU,EAAE,MAAM,CAAC,qBAAqB,CAAC,MAAM;QAC/C,GAAG,EAAE,MAAM,CAAC,cAAc,CAAC,MAAM;QACjC,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Equivalence-divergence diagnostic builder (pure).
|
|
3
|
+
*
|
|
4
|
+
* When `graph-equivalence-check` reports production decline/phantom divergences,
|
|
5
|
+
* this turns each divergence into a fully-described record — owner occurrence,
|
|
6
|
+
* resolved target occurrences, and the actual call edge on BOTH engines (plus the
|
|
7
|
+
* same-call-site edge whatever its resolution) — so a maintainer can see exactly
|
|
8
|
+
* how exact and sharded disagreed at a call site, not just the bodyHash deltas.
|
|
9
|
+
*
|
|
10
|
+
* It is the structured form of the throwaway instrumentation that originally
|
|
11
|
+
* root-caused the 118-decline asymmetry (exact resolves workspace deps via
|
|
12
|
+
* symlinked `packages/X/dist`, sharded via pnpm's injected `.pnpm/...@file+...`).
|
|
13
|
+
* Keeping it as a maintained, env-gated artifact makes the NEXT equivalence
|
|
14
|
+
* regression debuggable in minutes instead of hours.
|
|
15
|
+
*
|
|
16
|
+
* This module is PURE — no `fs`, no `process`, no `Date`. The host command
|
|
17
|
+
* (`equivalence-check-command.ts`) owns the env gate + file/stdout effects, so
|
|
18
|
+
* the analysis is unit-testable in isolation.
|
|
19
|
+
*/
|
|
20
|
+
import type { Catalog, CallEdge, FunctionOccurrence } from '../types.js';
|
|
21
|
+
import type { EdgeDifference } from './orchestrate/cross-shard-resolve.js';
|
|
22
|
+
/** Compact occurrence projection for the diagnostic JSON. */
|
|
23
|
+
export interface OccurrenceSummary {
|
|
24
|
+
readonly simpleName: string;
|
|
25
|
+
readonly qualifiedName: string;
|
|
26
|
+
readonly filePath: string;
|
|
27
|
+
readonly line: number;
|
|
28
|
+
readonly column: number;
|
|
29
|
+
readonly kind: FunctionOccurrence['kind'];
|
|
30
|
+
readonly visibility: FunctionOccurrence['visibility'];
|
|
31
|
+
readonly package: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
/** Compact call-edge projection for the diagnostic JSON. */
|
|
34
|
+
export interface EdgeSummary {
|
|
35
|
+
readonly to: readonly string[];
|
|
36
|
+
readonly line: number;
|
|
37
|
+
readonly column: number;
|
|
38
|
+
readonly resolution: CallEdge['resolution'];
|
|
39
|
+
readonly confidence: CallEdge['confidence'];
|
|
40
|
+
readonly text: string;
|
|
41
|
+
readonly crossShard: boolean;
|
|
42
|
+
readonly discarded: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** One resolved target bodyHash and every occurrence that shares it. */
|
|
45
|
+
export interface TargetSummary {
|
|
46
|
+
readonly hash: string;
|
|
47
|
+
readonly occurrences: readonly OccurrenceSummary[];
|
|
48
|
+
}
|
|
49
|
+
/** A single divergence, described symmetrically across both engines. */
|
|
50
|
+
export interface DiffDiagnostic {
|
|
51
|
+
readonly owner: {
|
|
52
|
+
readonly hash: string;
|
|
53
|
+
readonly filePath: string;
|
|
54
|
+
readonly line: number;
|
|
55
|
+
readonly column: number;
|
|
56
|
+
readonly exact: OccurrenceSummary | null;
|
|
57
|
+
readonly sharded: OccurrenceSummary | null;
|
|
58
|
+
};
|
|
59
|
+
readonly exactTo: readonly TargetSummary[];
|
|
60
|
+
readonly shardedTo: readonly TargetSummary[];
|
|
61
|
+
/** The edge whose target set exactly matches this divergence's recorded `to`. */
|
|
62
|
+
readonly exactEdge: EdgeSummary | null;
|
|
63
|
+
readonly shardedEdge: EdgeSummary | null;
|
|
64
|
+
/** The edge at the same call site regardless of its resolved target set. */
|
|
65
|
+
readonly exactSameSite: EdgeSummary | null;
|
|
66
|
+
readonly shardedSameSite: EdgeSummary | null;
|
|
67
|
+
}
|
|
68
|
+
export interface EquivalenceDiagnostic {
|
|
69
|
+
readonly counts: {
|
|
70
|
+
readonly productionDecline: number;
|
|
71
|
+
readonly productionPhantom: number;
|
|
72
|
+
};
|
|
73
|
+
readonly shards: readonly {
|
|
74
|
+
readonly id: string;
|
|
75
|
+
readonly rootDir: string;
|
|
76
|
+
readonly fileCount: number;
|
|
77
|
+
}[];
|
|
78
|
+
/** Histogram: `<resolution>:<crossShard>` of the exact edge for each decline. */
|
|
79
|
+
readonly declineByExactResolution: Record<string, number>;
|
|
80
|
+
/** Histogram: `<resolution>:<crossShard>` of the sharded edge for each phantom. */
|
|
81
|
+
readonly phantomByShardedResolution: Record<string, number>;
|
|
82
|
+
readonly decline: readonly DiffDiagnostic[];
|
|
83
|
+
readonly phantom: readonly DiffDiagnostic[];
|
|
84
|
+
}
|
|
85
|
+
export interface BuildEquivalenceDiagnosticInput {
|
|
86
|
+
readonly report: {
|
|
87
|
+
readonly productionDecline: readonly EdgeDifference[];
|
|
88
|
+
readonly productionPhantom: readonly EdgeDifference[];
|
|
89
|
+
};
|
|
90
|
+
readonly exact: Catalog;
|
|
91
|
+
readonly sharded: Catalog;
|
|
92
|
+
readonly shards: readonly {
|
|
93
|
+
readonly id: string;
|
|
94
|
+
readonly rootDir: string;
|
|
95
|
+
readonly files: readonly string[];
|
|
96
|
+
}[];
|
|
97
|
+
}
|
|
98
|
+
/** Build the structured equivalence diagnostic. Pure: no I/O, no clock. */
|
|
99
|
+
export declare function buildEquivalenceDiagnostic(input: BuildEquivalenceDiagnosticInput): EquivalenceDiagnostic;
|
|
100
|
+
//# sourceMappingURL=equivalence-diagnostic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equivalence-diagnostic.d.ts","sourceRoot":"","sources":["../../src/cli/equivalence-diagnostic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAE3E,6DAA6D;AAC7D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;IACtD,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,4DAA4D;AAC5D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC5C,QAAQ,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AE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;KAC5B,EAAE,CAAC;IACJ,iFAAiF;IACjF,QAAQ,CAAC,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1D,mFAAmF;IACnF,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5D,QAAQ,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,iBAAiB,EAAE,SAAS,cAAc,EAAE,CAAC;QACtD,QAAQ,CAAC,iBAAiB,EAAE,SAAS,cAAc,EAAE,CAAC;KACvD,CAAC;IACF,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS;QACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;KACnC,EAAE,CAAC;CACL;AAED,2EAA2E;AAC3E,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,+BAA+B,GACrC,qBAAqB,CAevB"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Equivalence-divergence diagnostic builder (pure).
|
|
3
|
+
*
|
|
4
|
+
* When `graph-equivalence-check` reports production decline/phantom divergences,
|
|
5
|
+
* this turns each divergence into a fully-described record — owner occurrence,
|
|
6
|
+
* resolved target occurrences, and the actual call edge on BOTH engines (plus the
|
|
7
|
+
* same-call-site edge whatever its resolution) — so a maintainer can see exactly
|
|
8
|
+
* how exact and sharded disagreed at a call site, not just the bodyHash deltas.
|
|
9
|
+
*
|
|
10
|
+
* It is the structured form of the throwaway instrumentation that originally
|
|
11
|
+
* root-caused the 118-decline asymmetry (exact resolves workspace deps via
|
|
12
|
+
* symlinked `packages/X/dist`, sharded via pnpm's injected `.pnpm/...@file+...`).
|
|
13
|
+
* Keeping it as a maintained, env-gated artifact makes the NEXT equivalence
|
|
14
|
+
* regression debuggable in minutes instead of hours.
|
|
15
|
+
*
|
|
16
|
+
* This module is PURE — no `fs`, no `process`, no `Date`. The host command
|
|
17
|
+
* (`equivalence-check-command.ts`) owns the env gate + file/stdout effects, so
|
|
18
|
+
* the analysis is unit-testable in isolation.
|
|
19
|
+
*/
|
|
20
|
+
/** Build the structured equivalence diagnostic. Pure: no I/O, no clock. */
|
|
21
|
+
export function buildEquivalenceDiagnostic(input) {
|
|
22
|
+
const exactTargets = indexOccurrencesByHash(input.exact);
|
|
23
|
+
const shardedTargets = indexOccurrencesByHash(input.sharded);
|
|
24
|
+
const describe = (d) => describeDifference(d, input.exact, input.sharded, exactTargets, shardedTargets);
|
|
25
|
+
const decline = input.report.productionDecline.map(describe);
|
|
26
|
+
const phantom = input.report.productionPhantom.map(describe);
|
|
27
|
+
return {
|
|
28
|
+
counts: { productionDecline: decline.length, productionPhantom: phantom.length },
|
|
29
|
+
shards: input.shards.map((s) => ({ id: s.id, rootDir: s.rootDir, fileCount: s.files.length })),
|
|
30
|
+
declineByExactResolution: countBy(decline, (d) => edgeResolutionKey(d.exactEdge)),
|
|
31
|
+
phantomByShardedResolution: countBy(phantom, (d) => edgeResolutionKey(d.shardedEdge)),
|
|
32
|
+
decline,
|
|
33
|
+
phantom,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function edgeResolutionKey(edge) {
|
|
37
|
+
return `${edge?.resolution ?? 'missing'}:${String(edge?.crossShard ?? false)}`;
|
|
38
|
+
}
|
|
39
|
+
function countBy(items, keyOf) {
|
|
40
|
+
const out = {};
|
|
41
|
+
for (const item of items) {
|
|
42
|
+
const key = keyOf(item);
|
|
43
|
+
out[key] = (out[key] ?? 0) + 1;
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
function describeDifference(diff, exact, sharded, exactTargets, shardedTargets) {
|
|
48
|
+
const atSign = diff.key.indexOf('@');
|
|
49
|
+
const ownerHash = atSign === -1 ? diff.key : diff.key.slice(0, atSign);
|
|
50
|
+
const exactOwner = findOccurrence(exact, ownerHash, diff.ownerFilePath);
|
|
51
|
+
const shardedOwner = findOccurrence(sharded, ownerHash, diff.ownerFilePath);
|
|
52
|
+
return {
|
|
53
|
+
owner: {
|
|
54
|
+
hash: ownerHash,
|
|
55
|
+
filePath: diff.ownerFilePath,
|
|
56
|
+
line: diff.line,
|
|
57
|
+
column: diff.column,
|
|
58
|
+
exact: exactOwner === undefined ? null : summarizeOccurrence(exactOwner),
|
|
59
|
+
sharded: shardedOwner === undefined ? null : summarizeOccurrence(shardedOwner),
|
|
60
|
+
},
|
|
61
|
+
exactTo: splitTargets(diff.toA).map((hash) => summarizeTargets(hash, exactTargets)),
|
|
62
|
+
shardedTo: splitTargets(diff.toB).map((hash) => summarizeTargets(hash, shardedTargets)),
|
|
63
|
+
exactEdge: nullableEdge(findEdge(exactOwner, diff.line, diff.column, diff.toA)),
|
|
64
|
+
shardedEdge: nullableEdge(findEdge(shardedOwner, diff.line, diff.column, diff.toB)),
|
|
65
|
+
exactSameSite: nullableEdge(findAnyEdge(exactOwner, diff.line, diff.column)),
|
|
66
|
+
shardedSameSite: nullableEdge(findAnyEdge(shardedOwner, diff.line, diff.column)),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function nullableEdge(edge) {
|
|
70
|
+
return edge === undefined ? null : summarizeEdge(edge);
|
|
71
|
+
}
|
|
72
|
+
function indexOccurrencesByHash(catalog) {
|
|
73
|
+
const out = new Map();
|
|
74
|
+
for (const occs of Object.values(catalog.functions)) {
|
|
75
|
+
for (const occ of occs ?? []) {
|
|
76
|
+
const bucket = out.get(occ.bodyHash);
|
|
77
|
+
if (bucket)
|
|
78
|
+
bucket.push(occ);
|
|
79
|
+
else
|
|
80
|
+
out.set(occ.bodyHash, [occ]);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
function findOccurrence(catalog, bodyHash, filePath) {
|
|
86
|
+
for (const occs of Object.values(catalog.functions)) {
|
|
87
|
+
for (const occ of occs ?? []) {
|
|
88
|
+
if (occ.bodyHash === bodyHash && occ.filePath === filePath)
|
|
89
|
+
return occ;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
function findEdge(occ, line, column, toJoined) {
|
|
95
|
+
if (occ === undefined)
|
|
96
|
+
return undefined;
|
|
97
|
+
for (const edge of occ.calls) {
|
|
98
|
+
if (edge.line !== line || edge.column !== column)
|
|
99
|
+
continue;
|
|
100
|
+
if ([...edge.to].sort().join(',') === toJoined)
|
|
101
|
+
return edge;
|
|
102
|
+
}
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
function findAnyEdge(occ, line, column) {
|
|
106
|
+
return occ?.calls.find((edge) => edge.line === line && edge.column === column);
|
|
107
|
+
}
|
|
108
|
+
function splitTargets(toJoined) {
|
|
109
|
+
return toJoined.length === 0 ? [] : toJoined.split(',');
|
|
110
|
+
}
|
|
111
|
+
function summarizeTargets(hash, targets) {
|
|
112
|
+
return { hash, occurrences: (targets.get(hash) ?? []).map(summarizeOccurrence) };
|
|
113
|
+
}
|
|
114
|
+
function summarizeOccurrence(occ) {
|
|
115
|
+
return {
|
|
116
|
+
simpleName: occ.simpleName,
|
|
117
|
+
qualifiedName: occ.qualifiedName,
|
|
118
|
+
filePath: occ.filePath,
|
|
119
|
+
line: occ.line,
|
|
120
|
+
column: occ.column,
|
|
121
|
+
kind: occ.kind,
|
|
122
|
+
visibility: occ.visibility,
|
|
123
|
+
package: occ.package,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function summarizeEdge(edge) {
|
|
127
|
+
return {
|
|
128
|
+
to: edge.to,
|
|
129
|
+
line: edge.line,
|
|
130
|
+
column: edge.column,
|
|
131
|
+
resolution: edge.resolution,
|
|
132
|
+
confidence: edge.confidence,
|
|
133
|
+
text: edge.text,
|
|
134
|
+
crossShard: edge.crossShard ?? false,
|
|
135
|
+
discarded: edge.discarded ?? false,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=equivalence-diagnostic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equivalence-diagnostic.js","sourceRoot":"","sources":["../../src/cli/equivalence-diagnostic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAuFH,2EAA2E;AAC3E,MAAM,UAAU,0BAA0B,CACxC,KAAsC;IAEtC,MAAM,YAAY,GAAG,sBAAsB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACzD,MAAM,cAAc,GAAG,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7D,MAAM,QAAQ,GAAG,CAAC,CAAiB,EAAkB,EAAE,CACrD,kBAAkB,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;IAClF,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7D,OAAO;QACL,MAAM,EAAE,EAAE,iBAAiB,EAAE,OAAO,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,MAAM,EAAE;QAChF,MAAM,EAAE,K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AQ;QACtB,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,OAAO,EAAE,GAAG,CAAC,OAAO;KACrB,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,IAAc;IACnC,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,KAAK;QACpC,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,KAAK;KACnC,CAAC;AACJ,CAAC"}
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* graph-aux-command-specs — the declarative graph auxiliary commands.
|
|
3
|
-
*
|
|
4
|
-
* The host mounts each spec via `mountCommandSpec`; the tool no longer touches
|
|
5
|
-
* Commander. Each helper's raw `.option()`/`.argument()` calls translate 1:1 to
|
|
6
|
-
* `OptionSpec`/`ArgSpec`; positional arguments arrive on the parsed-opts object
|
|
7
|
-
* under the `_args` key (the host's uniform positional convention — see
|
|
8
|
-
* `mountCommandSpec`).
|
|
9
|
-
*
|
|
10
|
-
* The canonical surface is the nested `<tool> <verb>` grammar — `graph recipes`
|
|
11
|
-
* / `graph lookup` / `graph index` / `graph list` / `graph export` all mount as
|
|
12
|
-
* children of the `graph` primary (`parent: 'graph'`). The legacy flat-root
|
|
13
|
-
* aliases (`graph-recipes` / `graph-lookup` / `graph-symbol-index` /
|
|
14
|
-
* `graph-baseline-export` / `catalog-export` / `sarif-export`) were removed once
|
|
15
|
-
* their deprecation window closed.
|
|
16
|
-
*
|
|
17
|
-
* Output modes:
|
|
18
|
-
* - `graph recipes` / `graph list` → `command-result`: the handler returns the
|
|
19
|
-
* list result; the host dispatches it through the shared seam (`--json` →
|
|
20
|
-
* JSON, else render). Byte-identical to the former `if (json) emitJson else
|
|
21
|
-
* render` body.
|
|
22
|
-
* - every other aux command → `raw-stream`: each owns its full IO (writes a
|
|
23
|
-
* file and/or prints a line, sets its own exit code, owns its `--json`
|
|
24
|
-
* branch) — the documented non-Ink exception. The host renders nothing.
|
|
25
|
-
*/
|
|
26
1
|
import type { CommandSpec, ToolCliContext } from '@opensip-cli/core';
|
|
27
2
|
/** `graph-shard-worker` — [internal] build one shard from a spec file. */
|
|
28
3
|
export declare const graphShardWorkerCommandSpec: CommandSpec<unknown, ToolCliContext>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-aux-command-specs.d.ts","sourceRoot":"","sources":["../../../src/cli/graph/graph-aux-command-specs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graph-aux-command-specs.d.ts","sourceRoot":"","sources":["../../../src/cli/graph/graph-aux-command-specs.ts"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAmQrE,0EAA0E;AAC1E,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,OAAO,EAAE,cAAc,CAgB3E,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC,EAAE,WAAW,CAAC,OAAO,EAAE,cAAc,CAqChF,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,2CAA4C,CAAC;AAoC9E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,OAAO,EAAE,cAAc,CAkEtE,CAAC;AAYH;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,EAAE,WAAW,CAAC,OAAO,EAAE,cAAc,CAQ5E,CAAC;AAEL,2EAA2E;AAC3E,eAAO,MAAM,6BAA6B,EAAE,WAAW,CAAC,OAAO,EAAE,cAAc,CAa3E,CAAC;AAEL;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,WAAW,CAAC,OAAO,EAAE,cAAc,CAmC1E,CAAC;AAEL;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,OAAO,EAAE,cAAc,CAUpE,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// @fitness-ignore-file no-direct-stdout-in-tool-engine -- auxiliary subcommand status line: `graph export --format baseline` writes the JSON baseline to a file and prints a one-line "Exported graph baseline to <path>" confirmation (the --json path uses cli.emitJson). This is not the signal-envelope run output (ADR-0011), which routes through the composition root.
|
|
2
|
-
// @fitness-ignore-file detached-promises -- async command handlers invoke synchronous helpers (runCatalogJsonMode/runSarifExportMode/handleGraphError all return void); the heuristic flags them inside the async handlers. Matches the sibling graph CLI files (graph.ts, graph-modes.ts, orchestrate.ts).
|
|
3
2
|
// @fitness-ignore-file only-documented-toolcli-seams -- same rationale as the no-direct-stdout waiver above: the one-line "Exported graph baseline to <path>" status confirmation after a file write; the --json path uses cli.emitJson. Not run output through a ToolCliContext seam.
|
|
4
3
|
/**
|
|
5
4
|
* graph-aux-command-specs — the declarative graph auxiliary commands.
|
|
@@ -27,7 +26,7 @@
|
|
|
27
26
|
* branch) — the documented non-Ink exception. The host renders nothing.
|
|
28
27
|
*/
|
|
29
28
|
import { commonFlags, EXIT_CODES } from '@opensip-cli/contracts';
|
|
30
|
-
import { ConfigurationError, defineCommand, logger } from '@opensip-cli/core';
|
|
29
|
+
import { ConfigurationError, defineCommand, defineNestedCommand, logger } from '@opensip-cli/core';
|
|
31
30
|
import { executeEquivalenceCheck } from '../equivalence-check-command.js';
|
|
32
31
|
import { listGraphRules } from '../graph-list.js';
|
|
33
32
|
import { runCatalogJsonMode } from '../graph-modes.js';
|
|
@@ -330,9 +329,8 @@ function requireExportFlags(format, present, required, cli) {
|
|
|
330
329
|
* required subset per format at runtime (`requireExportFlags` →
|
|
331
330
|
* ConfigurationError → exit 2).
|
|
332
331
|
*/
|
|
333
|
-
export const graphExportCommandSpec =
|
|
332
|
+
export const graphExportCommandSpec = defineNestedCommand({
|
|
334
333
|
name: 'export',
|
|
335
|
-
parent: 'graph',
|
|
336
334
|
description: 'Export graph analysis artifacts: --format sarif (SARIF v2.1.0 findings), catalog (CatalogExport JSON), or baseline (gate fingerprint JSON)',
|
|
337
335
|
commonFlags: ['cwd', 'json'],
|
|
338
336
|
options: [
|
|
@@ -400,9 +398,8 @@ export const graphExportCommandSpec = defineCommand({
|
|
|
400
398
|
* `command-result`: the host dispatches the returned result through the shared
|
|
401
399
|
* seam (`--json` → JSON, else render).
|
|
402
400
|
*/
|
|
403
|
-
export const graphRecipesGroupedCommandSpec =
|
|
401
|
+
export const graphRecipesGroupedCommandSpec = defineNestedCommand({
|
|
404
402
|
name: 'recipes',
|
|
405
|
-
parent: 'graph',
|
|
406
403
|
description: 'List available graph recipes',
|
|
407
404
|
commonFlags: ['json'],
|
|
408
405
|
scope: 'project',
|
|
@@ -410,9 +407,8 @@ export const graphRecipesGroupedCommandSpec = defineCommand({
|
|
|
410
407
|
handler: async () => listGraphRecipes(),
|
|
411
408
|
});
|
|
412
409
|
/** `graph lookup <name>` — look up function occurrences by simple name. */
|
|
413
|
-
export const graphLookupGroupedCommandSpec =
|
|
410
|
+
export const graphLookupGroupedCommandSpec = defineNestedCommand({
|
|
414
411
|
name: 'lookup',
|
|
415
|
-
parent: 'graph',
|
|
416
412
|
description: 'Look up function occurrences by simple name from the persisted catalog',
|
|
417
413
|
commonFlags: ['json'],
|
|
418
414
|
args: [{ name: 'name', description: 'Function simple name to look up (e.g. "saveBaseline")' }],
|
|
@@ -429,9 +425,8 @@ export const graphLookupGroupedCommandSpec = defineCommand({
|
|
|
429
425
|
* file→names). Default (query): read the persisted catalog only. `--build`:
|
|
430
426
|
* run the graph pipeline first, then emit from the refreshed catalog (Q7).
|
|
431
427
|
*/
|
|
432
|
-
export const graphIndexGroupedCommandSpec =
|
|
428
|
+
export const graphIndexGroupedCommandSpec = defineNestedCommand({
|
|
433
429
|
name: 'index',
|
|
434
|
-
parent: 'graph',
|
|
435
430
|
description: 'Emit a symbolindex.json artifact (name→file:line and file→names); --build refreshes the catalog first',
|
|
436
431
|
commonFlags: [],
|
|
437
432
|
options: [
|
|
@@ -473,9 +468,8 @@ export const graphIndexGroupedCommandSpec = defineCommand({
|
|
|
473
468
|
* `viewListChecks` renderer with the graph-supplied title) — the same path
|
|
474
469
|
* `graph recipes` / `fit list` use.
|
|
475
470
|
*/
|
|
476
|
-
export const graphListCommandSpec =
|
|
471
|
+
export const graphListCommandSpec = defineNestedCommand({
|
|
477
472
|
name: 'list',
|
|
478
|
-
parent: 'graph',
|
|
479
473
|
description: 'List available graph rules',
|
|
480
474
|
commonFlags: ['cwd', 'json'],
|
|
481
475
|
scope: 'project',
|