@mrclrchtr/supi-review 4.8.0 → 4.10.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/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/README.md +3 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +8 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/debug-timing.ts +120 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/README.md +3 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +8 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-timing.ts +120 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +155 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +70 -34
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +104 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/README.md +10 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/README.md +3 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +8 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-timing.ts +120 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +4 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +4 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/package.json +4 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime.ts +106 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/package.json +5 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/refactor/apply.ts +14 -19
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/refactor/position.ts +47 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/refactor/safety.ts +18 -10
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/ast-scan-timing.ts +57 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/pattern-analysis.ts +230 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/pattern.ts +22 -224
- package/node_modules/@mrclrchtr/supi-core/README.md +3 -1
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +8 -0
- package/node_modules/@mrclrchtr/supi-core/src/debug-timing.ts +120 -0
- package/package.json +3 -3
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { performance } from "node:perf_hooks";
|
|
2
|
+
import {
|
|
3
|
+
type DebugEvent,
|
|
4
|
+
type DebugEventInput,
|
|
5
|
+
isDebugRegistryEnabled,
|
|
6
|
+
recordDebugEvent,
|
|
7
|
+
} from "./debug-registry.ts";
|
|
8
|
+
|
|
9
|
+
/** Monotonic duration data added to a timed debug event. */
|
|
10
|
+
export interface DebugTiming {
|
|
11
|
+
readonly durationMs: number;
|
|
12
|
+
readonly phasesMs: Readonly<Record<string, number>>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Debug event input whose data can receive the reserved `timing` field. */
|
|
16
|
+
export interface TimedDebugEventInput extends Omit<DebugEventInput, "data"> {
|
|
17
|
+
readonly data?: Readonly<Record<string, unknown>>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Test seam for the monotonic clock used by a debug timer. */
|
|
21
|
+
export interface DebugTimerOptions {
|
|
22
|
+
readonly now?: () => number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Lazy timed-event input that is not evaluated when Debug is disabled. */
|
|
26
|
+
export type TimedDebugEventFactory = () => TimedDebugEventInput;
|
|
27
|
+
|
|
28
|
+
/** One-shot debug timer with optional sequential phase measurements. */
|
|
29
|
+
export interface DebugTimer {
|
|
30
|
+
/** Whether this timer sampled Debug as enabled when it started. */
|
|
31
|
+
readonly enabled: boolean;
|
|
32
|
+
/** Finish the current phase and start the next unnamed interval. */
|
|
33
|
+
mark(phase: string): void;
|
|
34
|
+
/** Record one event. A second call returns `null` without recording another event. */
|
|
35
|
+
finish(
|
|
36
|
+
input: TimedDebugEventInput | TimedDebugEventFactory,
|
|
37
|
+
finalPhase?: string,
|
|
38
|
+
): DebugEvent | null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Start a monotonic timer for one debug event.
|
|
43
|
+
*
|
|
44
|
+
* Each `mark(name)` stores the interval since the previous mark. `finish()`
|
|
45
|
+
* stores the total duration and can name the final interval. Repeated phase
|
|
46
|
+
* names are accumulated. Event data reserves the `timing` field. When Debug is
|
|
47
|
+
* disabled at start, this returns a no-op timer and does not read the clock.
|
|
48
|
+
* Pass a factory to `finish()` to avoid event-data construction when disabled.
|
|
49
|
+
* Clock, event-construction, and registry failures are isolated from the
|
|
50
|
+
* measured operation and make the timer a no-op.
|
|
51
|
+
*/
|
|
52
|
+
export function startDebugTimer(options: DebugTimerOptions = {}): DebugTimer {
|
|
53
|
+
if (!isDebugRegistryEnabled()) return DISABLED_DEBUG_TIMER;
|
|
54
|
+
const now = options.now ?? performance.now.bind(performance);
|
|
55
|
+
let startedAt: number;
|
|
56
|
+
try {
|
|
57
|
+
startedAt = now();
|
|
58
|
+
} catch {
|
|
59
|
+
return DISABLED_DEBUG_TIMER;
|
|
60
|
+
}
|
|
61
|
+
let previousAt = startedAt;
|
|
62
|
+
let finished = false;
|
|
63
|
+
let failed = false;
|
|
64
|
+
const phases = new Map<string, number>();
|
|
65
|
+
|
|
66
|
+
const markAt = (phase: string, current: number): void => {
|
|
67
|
+
const name = phase.trim();
|
|
68
|
+
if (!name) return;
|
|
69
|
+
phases.set(name, (phases.get(name) ?? 0) + Math.max(0, current - previousAt));
|
|
70
|
+
previousAt = current;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
enabled: true,
|
|
75
|
+
mark(phase) {
|
|
76
|
+
if (finished || failed) return;
|
|
77
|
+
try {
|
|
78
|
+
markAt(phase, now());
|
|
79
|
+
} catch {
|
|
80
|
+
failed = true;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
finish(input, finalPhase) {
|
|
84
|
+
if (finished || failed) return null;
|
|
85
|
+
finished = true;
|
|
86
|
+
try {
|
|
87
|
+
if (!isDebugRegistryEnabled()) return null;
|
|
88
|
+
const completedAt = now();
|
|
89
|
+
if (finalPhase) markAt(finalPhase, completedAt);
|
|
90
|
+
const phasesMs = Object.fromEntries(
|
|
91
|
+
[...phases.entries()].map(([name, value]) => [name, duration(value)]),
|
|
92
|
+
);
|
|
93
|
+
const timing: DebugTiming = {
|
|
94
|
+
durationMs: duration(completedAt - startedAt),
|
|
95
|
+
phasesMs,
|
|
96
|
+
};
|
|
97
|
+
const eventInput = typeof input === "function" ? input() : input;
|
|
98
|
+
return recordDebugEvent({
|
|
99
|
+
...eventInput,
|
|
100
|
+
data: { ...eventInput.data, timing },
|
|
101
|
+
});
|
|
102
|
+
} catch {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const DISABLED_DEBUG_TIMER: DebugTimer = Object.freeze({
|
|
110
|
+
enabled: false,
|
|
111
|
+
mark() {},
|
|
112
|
+
finish() {
|
|
113
|
+
return null;
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
function duration(value: number): number {
|
|
118
|
+
if (!Number.isFinite(value)) return 0;
|
|
119
|
+
return Math.round(Math.max(0, value) * 10) / 10;
|
|
120
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-review",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.0",
|
|
4
4
|
"description": "Parallel isolated reviews of trees, comparisons, and commits",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"README.md"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@mrclrchtr/supi-core": "4.
|
|
35
|
-
"@mrclrchtr/supi-code-intelligence": "4.
|
|
34
|
+
"@mrclrchtr/supi-core": "4.10.0",
|
|
35
|
+
"@mrclrchtr/supi-code-intelligence": "4.10.0"
|
|
36
36
|
},
|
|
37
37
|
"bundledDependencies": [
|
|
38
38
|
"@mrclrchtr/supi-code-intelligence",
|