pi-shazam 0.15.3 → 0.16.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/README.md +1 -1
- package/dist/core/audit-log.d.ts +4 -4
- package/dist/core/audit-log.d.ts.map +1 -1
- package/dist/core/audit-log.js +8 -6
- package/dist/core/audit-log.js.map +1 -1
- package/dist/core/baseline.js +1 -1
- package/dist/core/cache.js +2 -2
- package/dist/core/encoding.d.ts +2 -2
- package/dist/core/encoding.js +4 -4
- package/dist/core/git-hooks.js +10 -10
- package/dist/core/git-utils.d.ts +36 -34
- package/dist/core/git-utils.d.ts.map +1 -1
- package/dist/core/git-utils.js +49 -46
- package/dist/core/git-utils.js.map +1 -1
- package/dist/core/graph.d.ts +1 -1
- package/dist/core/graph.d.ts.map +1 -1
- package/dist/core/graph.js +4 -4
- package/dist/core/output.d.ts.map +1 -1
- package/dist/core/output.js +7 -6
- package/dist/core/output.js.map +1 -1
- package/dist/core/redact.d.ts.map +1 -1
- package/dist/core/redact.js +4 -0
- package/dist/core/redact.js.map +1 -1
- package/dist/core/risk.d.ts +17 -17
- package/dist/core/risk.d.ts.map +1 -1
- package/dist/core/risk.js +15 -15
- package/dist/core/risk.js.map +1 -1
- package/dist/core/scanner.js +10 -10
- package/dist/core/scanner.js.map +1 -1
- package/dist/core/treesitter.d.ts +19 -16
- package/dist/core/treesitter.d.ts.map +1 -1
- package/dist/core/treesitter.js +37 -36
- package/dist/core/treesitter.js.map +1 -1
- package/dist/hooks/_bash-utils.d.ts +1 -1
- package/dist/hooks/_bash-utils.js +4 -4
- package/dist/hooks/_bash-utils.js.map +1 -1
- package/dist/hooks/before-start.d.ts.map +1 -1
- package/dist/hooks/before-start.js +11 -9
- package/dist/hooks/before-start.js.map +1 -1
- package/dist/hooks/impact-state.d.ts +1 -1
- package/dist/hooks/impact-state.js +4 -4
- package/dist/hooks/impact-state.js.map +1 -1
- package/dist/hooks/safety.d.ts.map +1 -1
- package/dist/hooks/safety.js +10 -2
- package/dist/hooks/safety.js.map +1 -1
- package/dist/hooks/shazam-guide.d.ts.map +1 -1
- package/dist/hooks/shazam-guide.js +3 -2
- package/dist/hooks/shazam-guide.js.map +1 -1
- package/dist/hooks/tool-logger.d.ts.map +1 -1
- package/dist/hooks/tool-logger.js +4 -2
- package/dist/hooks/tool-logger.js.map +1 -1
- package/dist/hooks/verify-state.d.ts +1 -1
- package/dist/hooks/verify-state.d.ts.map +1 -1
- package/dist/hooks/verify-state.js +3 -2
- package/dist/hooks/verify-state.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/dist/lsp/client.d.ts.map +1 -1
- package/dist/lsp/client.js +37 -34
- package/dist/lsp/client.js.map +1 -1
- package/dist/lsp/manager.d.ts.map +1 -1
- package/dist/lsp/manager.js +27 -14
- package/dist/lsp/manager.js.map +1 -1
- package/dist/lsp/servers.d.ts +1 -1
- package/dist/lsp/servers.d.ts.map +1 -1
- package/dist/lsp/servers.js +12 -12
- package/dist/lsp/servers.js.map +1 -1
- package/dist/lsp/setup.js +2 -2
- package/dist/mcp/tools.d.ts +1 -1
- package/dist/mcp/tools.js +2 -2
- package/dist/tools/_factory.d.ts +3 -3
- package/dist/tools/_factory.d.ts.map +1 -1
- package/dist/tools/_factory.js +10 -8
- package/dist/tools/_factory.js.map +1 -1
- package/dist/tools/changes.js +1 -1
- package/dist/tools/definitions.d.ts +1 -1
- package/dist/tools/definitions.js +3 -3
- package/dist/tools/format.d.ts.map +1 -1
- package/dist/tools/format.js +5 -8
- package/dist/tools/format.js.map +1 -1
- package/dist/tools/impact.d.ts.map +1 -1
- package/dist/tools/impact.js +8 -4
- package/dist/tools/impact.js.map +1 -1
- package/dist/tools/lookup.d.ts.map +1 -1
- package/dist/tools/lookup.js +35 -21
- package/dist/tools/lookup.js.map +1 -1
- package/dist/tools/lsp_enrich.d.ts +2 -0
- package/dist/tools/lsp_enrich.d.ts.map +1 -1
- package/dist/tools/lsp_enrich.js +39 -22
- package/dist/tools/lsp_enrich.js.map +1 -1
- package/dist/tools/overview.d.ts.map +1 -1
- package/dist/tools/overview.js +19 -14
- package/dist/tools/overview.js.map +1 -1
- package/dist/tools/rename_symbol.d.ts +1 -1
- package/dist/tools/rename_symbol.d.ts.map +1 -1
- package/dist/tools/rename_symbol.js +21 -10
- package/dist/tools/rename_symbol.js.map +1 -1
- package/dist/tools/verify.js +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ Use this only if you are **not** using Pi agent. The MCP interface provides the
|
|
|
43
43
|
"mcpServers": {
|
|
44
44
|
"pi-shazam": {
|
|
45
45
|
"command": "npx",
|
|
46
|
-
"args": ["-y", "-p", "pi-shazam", "pi-shazam-mcp"]
|
|
46
|
+
"args": ["-y", "-p", "pi-shazam@latest", "pi-shazam-mcp"]
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
package/dist/core/audit-log.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Max 10 MB per log file before rotation
|
|
9
9
|
* - Keep up to 5 archived copies (shazam-calls.log.1 through .5)
|
|
10
10
|
* - Max 30 days age for any single log file
|
|
11
|
-
* - On rotation: cascade-rename .4
|
|
11
|
+
* - On rotation: cascade-rename .4->.5, .3->.4, …, .log->.log.1
|
|
12
12
|
* - On age: delete the entire log file (content older than 30 days is stale)
|
|
13
13
|
*/
|
|
14
14
|
/** Default directory for shazam audit logs. */
|
|
@@ -22,9 +22,9 @@ export declare const MAX_AUDIT_LOG_AGE_MS: number;
|
|
|
22
22
|
/**
|
|
23
23
|
* Rotate the audit log at `logPath`.
|
|
24
24
|
*
|
|
25
|
-
* - If file size exceeds MAX_AUDIT_LOG_SIZE
|
|
26
|
-
* (log.4
|
|
27
|
-
* - If file age exceeds MAX_AUDIT_LOG_AGE_MS
|
|
25
|
+
* - If file size exceeds MAX_AUDIT_LOG_SIZE -> cascade-rename archived copies
|
|
26
|
+
* (log.4->log.5, …, log->log.1) and let a new log file be created on next write.
|
|
27
|
+
* - If file age exceeds MAX_AUDIT_LOG_AGE_MS -> delete the file (it will be
|
|
28
28
|
* recreated on next write with fresh content).
|
|
29
29
|
*/
|
|
30
30
|
export declare function rotateAuditLog(logPath: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-log.d.ts","sourceRoot":"","sources":["../../core/audit-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,+CAA+C;AAC/C,eAAO,MAAM,aAAa,QAA2C,CAAC;AAEtE,iDAAiD;AACjD,eAAO,MAAM,kBAAkB,QAAmB,CAAC;AAEnD,mDAAmD;AACnD,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,QAA2B,CAAC;AAE7D;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"audit-log.d.ts","sourceRoot":"","sources":["../../core/audit-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,+CAA+C;AAC/C,eAAO,MAAM,aAAa,QAA2C,CAAC;AAEtE,iDAAiD;AACjD,eAAO,MAAM,kBAAkB,QAAmB,CAAC;AAEnD,mDAAmD;AACnD,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,QAA2B,CAAC;AAE7D;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BnE"}
|
package/dist/core/audit-log.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Max 10 MB per log file before rotation
|
|
9
9
|
* - Keep up to 5 archived copies (shazam-calls.log.1 through .5)
|
|
10
10
|
* - Max 30 days age for any single log file
|
|
11
|
-
* - On rotation: cascade-rename .4
|
|
11
|
+
* - On rotation: cascade-rename .4->.5, .3->.4, …, .log->.log.1
|
|
12
12
|
* - On age: delete the entire log file (content older than 30 days is stale)
|
|
13
13
|
*/
|
|
14
14
|
import { stat, rename, unlink } from "node:fs/promises";
|
|
@@ -25,9 +25,9 @@ export const MAX_AUDIT_LOG_AGE_MS = 30 * 24 * 60 * 60 * 1000;
|
|
|
25
25
|
/**
|
|
26
26
|
* Rotate the audit log at `logPath`.
|
|
27
27
|
*
|
|
28
|
-
* - If file size exceeds MAX_AUDIT_LOG_SIZE
|
|
29
|
-
* (log.4
|
|
30
|
-
* - If file age exceeds MAX_AUDIT_LOG_AGE_MS
|
|
28
|
+
* - If file size exceeds MAX_AUDIT_LOG_SIZE -> cascade-rename archived copies
|
|
29
|
+
* (log.4->log.5, …, log->log.1) and let a new log file be created on next write.
|
|
30
|
+
* - If file age exceeds MAX_AUDIT_LOG_AGE_MS -> delete the file (it will be
|
|
31
31
|
* recreated on next write with fresh content).
|
|
32
32
|
*/
|
|
33
33
|
export async function rotateAuditLog(logPath) {
|
|
@@ -43,8 +43,9 @@ export async function rotateAuditLog(logPath) {
|
|
|
43
43
|
try {
|
|
44
44
|
await rename(src, dst);
|
|
45
45
|
}
|
|
46
|
-
catch {
|
|
46
|
+
catch (err) {
|
|
47
47
|
// file may not exist yet
|
|
48
|
+
console.warn(`[pi-shazam] rotateAuditLog: rename ${src} -> ${dst} failed`, err);
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
// Move current log to .1
|
|
@@ -55,8 +56,9 @@ export async function rotateAuditLog(logPath) {
|
|
|
55
56
|
await unlink(logPath);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
|
-
catch {
|
|
59
|
+
catch (err) {
|
|
59
60
|
// File may not exist yet — first write creates it
|
|
61
|
+
console.warn(`[pi-shazam] rotateAuditLog: stat/unlink failed for ${logPath}`, err);
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
//# sourceM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,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBACnD,MAAM,GAAG,GAAG,GAAG,OAAO,IAAI,CAAC,EAAE,CAAC;gBAC9B,MAAM,GAAG,GAAG,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClC,IAAI,CAAC;oBACJ,MAAM,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACxB,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACd,yBAAyB;oBACzB,OAAO,CAAC,IAAI,CAAC,sCAAsC,GAAG,OAAO,GAAG,SAAS,EAAE,GAAG,CAAC,CAAC;gBACjF,CAAC;YACF,CAAC;YACD,yBAAyB;YACzB,MAAM,MAAM,CAAC,OAAO,EAAE,GAAG,OAAO,IAAI,CAAC,CAAC;QACvC,CAAC;aAAM,IAAI,MAAM,EAAE,CAAC;YACnB,6DAA6D;YAC7D,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;IACF,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,kDAAkD;QAClD,OAAO,CAAC,IAAI,CAAC,sDAAsD,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;IACpF,CAAC;AACF,CAAC"}
|
package/dist/core/baseline.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { getGraphEdgeCount } from "./graph.js";
|
|
13
13
|
import { findOrphans } from "./filter.js";
|
|
14
|
-
//
|
|
14
|
+
// -- Session baseline state (in-memory) ----------------------------------------
|
|
15
15
|
let _baseline = null;
|
|
16
16
|
let _previousOrphans = new Map();
|
|
17
17
|
/**
|
package/dist/core/cache.js
CHANGED
|
@@ -10,7 +10,7 @@ import { join, dirname } from "node:path";
|
|
|
10
10
|
import { homedir } from "node:os";
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
12
12
|
import { serializeGraphV2, deserializeGraphV2 } from "./graph.js";
|
|
13
|
-
//
|
|
13
|
+
// -- Cache directory management -----------------------------------------------
|
|
14
14
|
const CACHE_ROOT = join(homedir(), ".cache", "repomap");
|
|
15
15
|
/**
|
|
16
16
|
* Get the cache directory for a specific project.
|
|
@@ -24,7 +24,7 @@ export function getProjectCacheDir(projectPath) {
|
|
|
24
24
|
mkdirSync(cacheDir, { recursive: true });
|
|
25
25
|
return cacheDir;
|
|
26
26
|
}
|
|
27
|
-
//
|
|
27
|
+
// -- Persistent graph cache (V2) ----------------------------------------------
|
|
28
28
|
/** Max age for a cached graph file before it is considered stale. */
|
|
29
29
|
const CACHE_MAX_AGE_MS = 24 * 60 * 60 * 1000; // 1 day — prevents stale cache in active projects (fixes #100)
|
|
30
30
|
/**
|
package/dist/core/encoding.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* pi-shazam core/encoding — Adaptive file encoding reader.
|
|
3
3
|
*
|
|
4
|
-
* Reads files with UTF-8
|
|
4
|
+
* Reads files with UTF-8 -> GBK -> GB2312 fallback.
|
|
5
5
|
* Includes OOM protection via file size limits (2MB max) and
|
|
6
6
|
* encoding validation on first 64KB chunk to reduce memory pressure.
|
|
7
7
|
*/
|
|
@@ -30,7 +30,7 @@ export declare class FileTooLargeError extends Error {
|
|
|
30
30
|
export declare function readFileAdaptive(filePath: string): string;
|
|
31
31
|
/**
|
|
32
32
|
* Async variant of readFileAdaptive using fs.promises.
|
|
33
|
-
* Same encoding fallback logic (UTF-8
|
|
33
|
+
* Same encoding fallback logic (UTF-8 -> GBK -> GB2312) but non-blocking.
|
|
34
34
|
* Use this in async contexts (e.g., LSP enrichment) to avoid blocking the event loop.
|
|
35
35
|
*/
|
|
36
36
|
export declare function readFileAdaptiveAsync(filePath: string): Promise<string>;
|
package/dist/core/encoding.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* pi-shazam core/encoding — Adaptive file encoding reader.
|
|
3
3
|
*
|
|
4
|
-
* Reads files with UTF-8
|
|
4
|
+
* Reads files with UTF-8 -> GBK -> GB2312 fallback.
|
|
5
5
|
* Includes OOM protection via file size limits (2MB max) and
|
|
6
6
|
* encoding validation on first 64KB chunk to reduce memory pressure.
|
|
7
7
|
*/
|
|
@@ -32,7 +32,7 @@ export class FileTooLargeError extends Error {
|
|
|
32
32
|
// Chunk size for encoding validation — only validate first 64KB
|
|
33
33
|
// to avoid allocating huge strings for large files
|
|
34
34
|
const VALIDATION_CHUNK_SIZE = 64 * 1024;
|
|
35
|
-
//
|
|
35
|
+
// -- Encoding detection and reading -------------------------------------------
|
|
36
36
|
/**
|
|
37
37
|
* Read a file with adaptive encoding fallback:
|
|
38
38
|
* 1. Try UTF-8
|
|
@@ -86,7 +86,7 @@ export function readFileAdaptive(filePath) {
|
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* Async variant of readFileAdaptive using fs.promises.
|
|
89
|
-
* Same encoding fallback logic (UTF-8
|
|
89
|
+
* Same encoding fallback logic (UTF-8 -> GBK -> GB2312) but non-blocking.
|
|
90
90
|
* Use this in async contexts (e.g., LSP enrichment) to avoid blocking the event loop.
|
|
91
91
|
*/
|
|
92
92
|
export async function readFileAdaptiveAsync(filePath) {
|
|
@@ -126,7 +126,7 @@ export async function readFileAdaptiveAsync(filePath) {
|
|
|
126
126
|
// Last resort: UTF-8 with replacement
|
|
127
127
|
return buffer.toString("utf-8");
|
|
128
128
|
}
|
|
129
|
-
//
|
|
129
|
+
// -- Internal helpers ---------------------------------------------------------
|
|
130
130
|
/**
|
|
131
131
|
* Validate that a buffer contains only valid UTF-8 byte sequences.
|
|
132
132
|
* Performs byte-level validation: rejects overlong encodings, lone continuation
|
package/dist/core/git-hooks.js
CHANGED
|
@@ -44,7 +44,7 @@ echo "[shazam] Checking $CHANGED_FILES changed file(s)..."
|
|
|
44
44
|
|
|
45
45
|
ERRORS=0
|
|
46
46
|
|
|
47
|
-
#
|
|
47
|
+
# -- TypeScript/JavaScript ----------------------------------------------
|
|
48
48
|
if [ -f "tsconfig.json" ] || [ -f "package.json" ]; then
|
|
49
49
|
# Type check
|
|
50
50
|
if command -v npx &>/dev/null; then
|
|
@@ -73,7 +73,7 @@ if [ -f "tsconfig.json" ] || [ -f "package.json" ]; then
|
|
|
73
73
|
fi
|
|
74
74
|
fi
|
|
75
75
|
|
|
76
|
-
#
|
|
76
|
+
# -- Rust ---------------------------------------------------------------
|
|
77
77
|
if [ -f "Cargo.toml" ]; then
|
|
78
78
|
if command -v cargo &>/dev/null; then
|
|
79
79
|
echo "[shazam] Running cargo check..."
|
|
@@ -93,7 +93,7 @@ if [ -f "Cargo.toml" ]; then
|
|
|
93
93
|
fi
|
|
94
94
|
fi
|
|
95
95
|
|
|
96
|
-
#
|
|
96
|
+
# -- Go -----------------------------------------------------------------
|
|
97
97
|
if [ -f "go.mod" ]; then
|
|
98
98
|
if command -v go &>/dev/null; then
|
|
99
99
|
echo "[shazam] Running go vet..."
|
|
@@ -113,7 +113,7 @@ if [ -f "go.mod" ]; then
|
|
|
113
113
|
fi
|
|
114
114
|
fi
|
|
115
115
|
|
|
116
|
-
#
|
|
116
|
+
# -- Python -------------------------------------------------------------
|
|
117
117
|
if [ -f "pyproject.toml" ] || [ -f "setup.py" ] || [ -f "requirements.txt" ]; then
|
|
118
118
|
# Type check (pyright or mypy)
|
|
119
119
|
if command -v pyright &>/dev/null; then
|
|
@@ -140,7 +140,7 @@ if [ -f "pyproject.toml" ] || [ -f "setup.py" ] || [ -f "requirements.txt" ]; th
|
|
|
140
140
|
fi
|
|
141
141
|
fi
|
|
142
142
|
|
|
143
|
-
#
|
|
143
|
+
# -- Summary ------------------------------------------------------------
|
|
144
144
|
if [ $ERRORS -gt 0 ]; then
|
|
145
145
|
echo "[shazam] FAIL: $ERRORS check(s) failed."
|
|
146
146
|
echo "[shazam] Fix errors or use 'git commit --no-verify' to bypass."
|
|
@@ -291,7 +291,7 @@ export function runPreCommitVerify(projectRoot) {
|
|
|
291
291
|
}
|
|
292
292
|
const changedFiles = changedOutput.split("\n").filter(Boolean);
|
|
293
293
|
const errors = [];
|
|
294
|
-
//
|
|
294
|
+
// -- TypeScript/JavaScript ------------------------------------------
|
|
295
295
|
if (existsSync(join(projectRoot, "tsconfig.json"))) {
|
|
296
296
|
try {
|
|
297
297
|
execFileSync("npx", ["--no-install", "tsc", "--noEmit"], {
|
|
@@ -306,7 +306,7 @@ export function runPreCommitVerify(projectRoot) {
|
|
|
306
306
|
errors.push(`TypeScript typecheck failed: ${String(stderr).slice(0, 500)}`);
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
-
//
|
|
309
|
+
// -- Rust -----------------------------------------------------------
|
|
310
310
|
if (existsSync(join(projectRoot, "Cargo.toml"))) {
|
|
311
311
|
try {
|
|
312
312
|
execFileSync("cargo", ["check"], {
|
|
@@ -321,7 +321,7 @@ export function runPreCommitVerify(projectRoot) {
|
|
|
321
321
|
errors.push(`cargo check failed: ${String(stderr).slice(0, 500)}`);
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
-
//
|
|
324
|
+
// -- Go -------------------------------------------------------------
|
|
325
325
|
if (existsSync(join(projectRoot, "go.mod"))) {
|
|
326
326
|
try {
|
|
327
327
|
execFileSync("go", ["vet", "./..."], {
|
|
@@ -336,7 +336,7 @@ export function runPreCommitVerify(projectRoot) {
|
|
|
336
336
|
errors.push(`go vet failed: ${String(stderr).slice(0, 500)}`);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
//
|
|
339
|
+
// -- Python ---------------------------------------------------------
|
|
340
340
|
if (existsSync(join(projectRoot, "pyproject.toml")) || existsSync(join(projectRoot, "setup.py"))) {
|
|
341
341
|
// Try pyright first, then mypy
|
|
342
342
|
let pyrightAvailable = false;
|
|
@@ -376,7 +376,7 @@ export function runPreCommitVerify(projectRoot) {
|
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
//
|
|
379
|
+
// -- Summary --------------------------------------------------------
|
|
380
380
|
if (errors.length > 0) {
|
|
381
381
|
return {
|
|
382
382
|
verdict: "FAIL",
|
package/dist/core/git-utils.d.ts
CHANGED
|
@@ -1,63 +1,65 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pi-shazam core/git-utils —
|
|
2
|
+
* pi-shazam core/git-utils — Shared git utility functions.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Fixes issue #350: in non-git-repo directories, the extension would output
|
|
5
|
+
* git's stderr errors ("fatal: not a git repository"), polluting the user's terminal/UI.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* - isGitRepo:
|
|
9
|
-
* - isProjectDir:
|
|
10
|
-
* - safeGitExec:
|
|
7
|
+
* This module provides:
|
|
8
|
+
* - isGitRepo: one-time check whether a directory is a git repo, cached to avoid repeated git process spawns
|
|
9
|
+
* - isProjectDir: check whether a directory is a project directory (has marker files or git repo), for fast short-circuit
|
|
10
|
+
* - safeGitExec: safely execute git commands, auto-suppress stderr, return null for non-git repos
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Check whether a directory is a git repository.
|
|
14
|
+
* Result is cached for the process lifetime; each directory is checked only once.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* stderr
|
|
18
|
-
*
|
|
16
|
+
* Uses `git rev-parse --is-inside-work-tree` for detection,
|
|
17
|
+
* with stderr fully suppressed (stdio: ["ignore", "pipe", "ignore"]),
|
|
18
|
+
* preventing "fatal: not a git repository" from leaking to the user's terminal.
|
|
19
19
|
*/
|
|
20
20
|
export declare function isGitRepo(projectRoot: string): boolean;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* Check whether a directory is a project directory (has marker files or is a git repo).
|
|
23
|
+
* Used for fast short-circuit in the before_agent_start hook.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* Non-project directories (e.g., /tmp, /var, /home) skip scanProject,
|
|
26
|
+
* avoiding synchronous blocking on large temporary directories.
|
|
27
27
|
*/
|
|
28
28
|
export declare function isProjectDir(projectRoot: string): boolean;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
* -
|
|
32
|
-
* -
|
|
33
|
-
*
|
|
34
|
-
* @param args - git
|
|
35
|
-
* @param cwd -
|
|
36
|
-
* @param timeout -
|
|
37
|
-
* @returns stdout
|
|
30
|
+
* Safely execute a git command.
|
|
31
|
+
* - Non-git repo: returns null immediately (no git process spawned)
|
|
32
|
+
* - Git repo: executes command, suppresses stderr, returns stdout; returns null on failure
|
|
33
|
+
*
|
|
34
|
+
* @param args - git subcommand arguments (e.g., ["log", "--oneline", "-10"])
|
|
35
|
+
* @param cwd - working directory
|
|
36
|
+
* @param timeout - timeout in milliseconds (default 5000)
|
|
37
|
+
* @returns stdout string, or null (non-git repo / execution failure)
|
|
38
38
|
*/
|
|
39
39
|
export declare function safeGitExec(args: string[], cwd: string, timeout?: number): string | null;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* Resolve the actual path of the git working directory.
|
|
42
42
|
*
|
|
43
|
-
*
|
|
44
|
-
* worktree
|
|
43
|
+
* Uses `git rev-parse --show-toplevel` for resolution. In a git worktree,
|
|
44
|
+
* this returns the worktree root directory rather than the main repo
|
|
45
|
+
* directory (issue #226).
|
|
45
46
|
*
|
|
46
|
-
*
|
|
47
|
+
* Returns `cwd` when the path is not inside a git repository.
|
|
47
48
|
*/
|
|
48
49
|
export declare function resolveGitWorkdir(cwd: string): string;
|
|
49
50
|
/**
|
|
50
|
-
*
|
|
51
|
+
* Get the list of changed files in the git working tree.
|
|
51
52
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
53
|
+
* Checks both unstaged (`git diff`) and staged (`git diff --cached`) changes,
|
|
54
|
+
* including only added, modified, copied, and renamed change types (ACMR),
|
|
55
|
+
* with automatic deduplication.
|
|
54
56
|
*
|
|
55
|
-
* @param projectRoot -
|
|
56
|
-
* @returns
|
|
57
|
+
* @param projectRoot - project root directory (internally resolves git working directory)
|
|
58
|
+
* @returns array of relative paths of changed files
|
|
57
59
|
*/
|
|
58
60
|
export declare function getGitChangedFiles(projectRoot: string): string[];
|
|
59
61
|
/**
|
|
60
|
-
*
|
|
62
|
+
* Reset git cache. Used only in tests.
|
|
61
63
|
*/
|
|
62
64
|
export declare function _resetGitCache(): void;
|
|
63
65
|
//# sourceMappingURL=git-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-utils.d.ts","sourceRoot":"","sources":["../../core/git-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqCH;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAqBtD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAOzD;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,SAAO,GAAG,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"git-utils.d.ts","sourceRoot":"","sources":["../../core/git-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqCH;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAqBtD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAOzD;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,SAAO,GAAG,MAAM,GAAG,IAAI,CAgBtF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAOhE;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAErC"}
|
package/dist/core/git-utils.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pi-shazam core/git-utils —
|
|
2
|
+
* pi-shazam core/git-utils — Shared git utility functions.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Fixes issue #350: in non-git-repo directories, the extension would output
|
|
5
|
+
* git's stderr errors ("fatal: not a git repository"), polluting the user's terminal/UI.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* - isGitRepo:
|
|
9
|
-
* - isProjectDir:
|
|
10
|
-
* - safeGitExec:
|
|
7
|
+
* This module provides:
|
|
8
|
+
* - isGitRepo: one-time check whether a directory is a git repo, cached to avoid repeated git process spawns
|
|
9
|
+
* - isProjectDir: check whether a directory is a project directory (has marker files or git repo), for fast short-circuit
|
|
10
|
+
* - safeGitExec: safely execute git commands, auto-suppress stderr, return null for non-git repos
|
|
11
11
|
*/
|
|
12
12
|
import { execFileSync } from "node:child_process";
|
|
13
13
|
import { existsSync } from "node:fs";
|
|
14
14
|
import { join } from "node:path";
|
|
15
|
-
//
|
|
15
|
+
// -- Project marker file list ------------------------------------------------
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* Marker files that indicate a directory is a project root.
|
|
18
|
+
* If any of these files exist, the directory is treated as a project directory.
|
|
19
19
|
*/
|
|
20
20
|
const PROJECT_MARKERS = [
|
|
21
21
|
"package.json",
|
|
@@ -31,20 +31,20 @@ const PROJECT_MARKERS = [
|
|
|
31
31
|
"pubspec.yaml", // Dart/Flutter
|
|
32
32
|
".git",
|
|
33
33
|
];
|
|
34
|
-
//
|
|
34
|
+
// -- Git availability cache --------------------------------------------------
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
36
|
+
* Cache of git repo detection results. key = directory absolute path, value = whether it's a git repo.
|
|
37
|
+
* Cached for the process lifetime to avoid repeatedly spawning git processes for the same directory.
|
|
38
38
|
*/
|
|
39
39
|
const gitRepoCache = new Map();
|
|
40
|
-
//
|
|
40
|
+
// -- Core functions ----------------------------------------------------------
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
42
|
+
* Check whether a directory is a git repository.
|
|
43
|
+
* Result is cached for the process lifetime; each directory is checked only once.
|
|
44
44
|
*
|
|
45
|
-
*
|
|
46
|
-
* stderr
|
|
47
|
-
*
|
|
45
|
+
* Uses `git rev-parse --is-inside-work-tree` for detection,
|
|
46
|
+
* with stderr fully suppressed (stdio: ["ignore", "pipe", "ignore"]),
|
|
47
|
+
* preventing "fatal: not a git repository" from leaking to the user's terminal.
|
|
48
48
|
*/
|
|
49
49
|
export function isGitRepo(projectRoot) {
|
|
50
50
|
const cached = gitRepoCache.get(projectRoot);
|
|
@@ -56,24 +56,24 @@ export function isGitRepo(projectRoot) {
|
|
|
56
56
|
cwd: projectRoot,
|
|
57
57
|
encoding: "utf-8",
|
|
58
58
|
timeout: 3000,
|
|
59
|
-
//
|
|
59
|
+
// Suppress stderr to prevent "fatal: not a git repository" from leaking to user's terminal
|
|
60
60
|
stdio: ["ignore", "pipe", "ignore"],
|
|
61
61
|
});
|
|
62
62
|
result = output.trim() === "true";
|
|
63
63
|
}
|
|
64
|
-
catch {
|
|
65
|
-
|
|
64
|
+
catch (err) {
|
|
65
|
+
console.warn(`[pi-shazam] isGitRepo: git rev-parse failed for ${projectRoot}`, err);
|
|
66
66
|
result = false;
|
|
67
67
|
}
|
|
68
68
|
gitRepoCache.set(projectRoot, result);
|
|
69
69
|
return result;
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
72
|
+
* Check whether a directory is a project directory (has marker files or is a git repo).
|
|
73
|
+
* Used for fast short-circuit in the before_agent_start hook.
|
|
74
74
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
75
|
+
* Non-project directories (e.g., /tmp, /var, /home) skip scanProject,
|
|
76
|
+
* avoiding synchronous blocking on large temporary directories.
|
|
77
77
|
*/
|
|
78
78
|
export function isProjectDir(projectRoot) {
|
|
79
79
|
for (const marker of PROJECT_MARKERS) {
|
|
@@ -84,17 +84,17 @@ export function isProjectDir(projectRoot) {
|
|
|
84
84
|
return false;
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
88
|
-
* -
|
|
89
|
-
* -
|
|
87
|
+
* Safely execute a git command.
|
|
88
|
+
* - Non-git repo: returns null immediately (no git process spawned)
|
|
89
|
+
* - Git repo: executes command, suppresses stderr, returns stdout; returns null on failure
|
|
90
90
|
*
|
|
91
|
-
* @param args - git
|
|
92
|
-
* @param cwd -
|
|
93
|
-
* @param timeout -
|
|
94
|
-
* @returns stdout
|
|
91
|
+
* @param args - git subcommand arguments (e.g., ["log", "--oneline", "-10"])
|
|
92
|
+
* @param cwd - working directory
|
|
93
|
+
* @param timeout - timeout in milliseconds (default 5000)
|
|
94
|
+
* @returns stdout string, or null (non-git repo / execution failure)
|
|
95
95
|
*/
|
|
96
96
|
export function safeGitExec(args, cwd, timeout = 5000) {
|
|
97
|
-
//
|
|
97
|
+
// Non-git repo: return early to avoid spawning a git process that will fail
|
|
98
98
|
if (!isGitRepo(cwd))
|
|
99
99
|
return null;
|
|
100
100
|
try {
|
|
@@ -102,34 +102,37 @@ export function safeGitExec(args, cwd, timeout = 5000) {
|
|
|
102
102
|
cwd,
|
|
103
103
|
encoding: "utf-8",
|
|
104
104
|
timeout,
|
|
105
|
-
//
|
|
105
|
+
// Suppress stderr to prevent git error messages from leaking to user's terminal
|
|
106
106
|
stdio: ["ignore", "pipe", "ignore"],
|
|
107
107
|
}).trim();
|
|
108
108
|
}
|
|
109
|
-
catch {
|
|
109
|
+
catch (err) {
|
|
110
|
+
console.warn(`[pi-shazam] safeGitExec: git ${args.join(" ")} failed for ${cwd}`, err);
|
|
110
111
|
return null;
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
/**
|
|
114
|
-
*
|
|
115
|
+
* Resolve the actual path of the git working directory.
|
|
115
116
|
*
|
|
116
|
-
*
|
|
117
|
-
* worktree
|
|
117
|
+
* Uses `git rev-parse --show-toplevel` for resolution. In a git worktree,
|
|
118
|
+
* this returns the worktree root directory rather than the main repo
|
|
119
|
+
* directory (issue #226).
|
|
118
120
|
*
|
|
119
|
-
*
|
|
121
|
+
* Returns `cwd` when the path is not inside a git repository.
|
|
120
122
|
*/
|
|
121
123
|
export function resolveGitWorkdir(cwd) {
|
|
122
124
|
const result = safeGitExec(["rev-parse", "--show-toplevel"], cwd, 5000);
|
|
123
125
|
return result || cwd;
|
|
124
126
|
}
|
|
125
127
|
/**
|
|
126
|
-
*
|
|
128
|
+
* Get the list of changed files in the git working tree.
|
|
127
129
|
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
+
* Checks both unstaged (`git diff`) and staged (`git diff --cached`) changes,
|
|
131
|
+
* including only added, modified, copied, and renamed change types (ACMR),
|
|
132
|
+
* with automatic deduplication.
|
|
130
133
|
*
|
|
131
|
-
* @param projectRoot -
|
|
132
|
-
* @returns
|
|
134
|
+
* @param projectRoot - project root directory (internally resolves git working directory)
|
|
135
|
+
* @returns array of relative paths of changed files
|
|
133
136
|
*/
|
|
134
137
|
export function getGitChangedFiles(projectRoot) {
|
|
135
138
|
const gitDir = resolveGitWorkdir(projectRoot);
|
|
@@ -141,7 +144,7 @@ export function getGitChangedFiles(projectRoot) {
|
|
|
141
144
|
return [...new Set(combined.split("\n").filter(Boolean))];
|
|
142
145
|
}
|
|
143
146
|
/**
|
|
144
|
-
*
|
|
147
|
+
* Reset git cache. Used only in tests.
|
|
145
148
|
*/
|
|
146
149
|
export function _resetGitCache() {
|
|
147
150
|
gitRepoCache.clear();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-utils.js","sourceRoot":"","sources":["../../core/git-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC
|
|
1
|
+
{"version":3,"file":"git-utils.js","sourceRoot":"","sources":["../../core/git-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,eAAe,GAAsB;IAC1C,cAAc;IACd,eAAe;IACf,YAAY;IACZ,QAAQ;IACR,gBAAgB;IAChB,UAAU;IACV,kBAAkB;IAClB,UAAU;IACV,SAAS;IACT,cAAc;IACd,cAAc,EAAE,eAAe;IAC/B,MAAM;CACN,CAAC;AAEF,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,EAAmB,CAAC;AAEhD,+EAA+E;AAE/E;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,WAAmB;IAC5C,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7C,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IAExC,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,CAAC;QACJ,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,uBAAuB,CAAC,EAAE;YAC1E,GAAG,EAAE,WAAW;YAChB,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,IAAI;YACb,2FAA2F;YAC3F,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EA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MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC5C,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,WAAW,EAAE,iBAAiB,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IACxE,OAAO,MAAM,IAAI,GAAG,CAAC;AACtB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAmB;IACrD,MAAM,MAAM,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,MAAM,EAAE,aAAa,EAAE,oBAAoB,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1F,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,oBAAoB,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACpG,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACtE,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IACzB,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC7B,YAAY,CAAC,KAAK,EAAE,CAAC;AACtB,CAAC"}
|
package/dist/core/graph.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export interface RepoGraph {
|
|
|
39
39
|
fileImportBindings: Map<string, JSImportBinding[]>;
|
|
40
40
|
/** Index symbols by name for O(1) lookup in findCalleeSymbols / findSymbolByNameInFile */
|
|
41
41
|
nameIndex: Map<string, Symbol[]>;
|
|
42
|
-
/** Reverse edge index: target symbol ID
|
|
42
|
+
/** Reverse edge index: target symbol ID -> set of source symbol IDs pointing to it, speeds up cross-file edge cleanup in removeEdgesForFile */
|
|
43
43
|
targetToSources: Map<string, Set<string>>;
|
|
44
44
|
}
|
|
45
45
|
/** A JS/TS import binding */
|
package/dist/core/graph.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../core/graph.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,uDAAuD;AACvD,MAAM,WAAW,MAAM;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,8CAA8C;AAC9C,MAAM,WAAW,IAAI;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,mCAAmC;AACnC,MAAM,WAAW,SAAS;IACzB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACnC,WAA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