@glasstrace/sdk 0.19.0 → 0.20.1
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 +79 -0
- package/dist/chunk-BT2OCXCG.js +178 -0
- package/dist/chunk-BT2OCXCG.js.map +1 -0
- package/dist/{chunk-F2TZRBEH.js → chunk-DO2YPMQ5.js} +9 -181
- package/dist/chunk-DO2YPMQ5.js.map +1 -0
- package/dist/{chunk-YPXW2TN3.js → chunk-IP4NMDJK.js} +2 -2
- package/dist/{chunk-VN3GZDV6.js → chunk-IQN6TRMQ.js} +2 -2
- package/dist/{chunk-XNDHQN4S.js → chunk-LU3PPAOQ.js} +288 -54
- package/dist/chunk-LU3PPAOQ.js.map +1 -0
- package/dist/chunk-R4DAIPXD.js +4461 -0
- package/dist/chunk-R4DAIPXD.js.map +1 -0
- package/dist/{chunk-5N2IR4EO.js → chunk-TQ54WLCZ.js} +1 -1
- package/dist/{chunk-5N2IR4EO.js.map → chunk-TQ54WLCZ.js.map} +1 -1
- package/dist/chunk-Z2EGETTT.js +204 -0
- package/dist/chunk-Z2EGETTT.js.map +1 -0
- package/dist/cli/init.cjs +483 -152
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts +48 -2
- package/dist/cli/init.d.ts +48 -2
- package/dist/cli/init.js +109 -7
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/mcp-add.cjs.map +1 -1
- package/dist/cli/mcp-add.js +2 -2
- package/dist/cli/uninit.cjs +174 -54
- package/dist/cli/uninit.cjs.map +1 -1
- package/dist/cli/uninit.d.cts +2 -0
- package/dist/cli/uninit.d.ts +2 -0
- package/dist/cli/uninit.js +2 -1
- package/dist/edge-entry-Ds2fNOeh.d.ts +157 -0
- package/dist/edge-entry-FJFKkeFF.d.cts +157 -0
- package/dist/edge-entry.cjs +14939 -0
- package/dist/edge-entry.cjs.map +1 -0
- package/dist/edge-entry.d.cts +6 -0
- package/dist/edge-entry.d.ts +6 -0
- package/dist/edge-entry.js +16 -0
- package/dist/index.cjs +13 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d-DgeH-pNJ.d.cts +191 -0
- package/dist/index.d-DgeH-pNJ.d.ts +191 -0
- package/dist/index.d.cts +9 -461
- package/dist/index.d.ts +9 -461
- package/dist/index.js +32 -4609
- package/dist/index.js.map +1 -1
- package/dist/node-entry.cjs +22492 -0
- package/dist/node-entry.cjs.map +1 -0
- package/dist/node-entry.d.cts +10 -0
- package/dist/node-entry.d.ts +10 -0
- package/dist/node-entry.js +101 -0
- package/dist/node-entry.js.map +1 -0
- package/dist/node-subpath.cjs +14506 -0
- package/dist/node-subpath.cjs.map +1 -0
- package/dist/node-subpath.d.cts +132 -0
- package/dist/node-subpath.d.ts +132 -0
- package/dist/node-subpath.js +30 -0
- package/dist/node-subpath.js.map +1 -0
- package/dist/{source-map-uploader-VPDZWWM2.js → source-map-uploader-YXWO6JLN.js} +3 -3
- package/dist/source-map-uploader-YXWO6JLN.js.map +1 -0
- package/package.json +4 -1
- package/dist/chunk-F2TZRBEH.js.map +0 -1
- package/dist/chunk-XNDHQN4S.js.map +0 -1
- /package/dist/{chunk-YPXW2TN3.js.map → chunk-IP4NMDJK.js.map} +0 -0
- /package/dist/{chunk-VN3GZDV6.js.map → chunk-IQN6TRMQ.js.map} +0 -0
- /package/dist/{source-map-uploader-VPDZWWM2.js.map → edge-entry.js.map} +0 -0
|
@@ -2,14 +2,215 @@ import {
|
|
|
2
2
|
isDevApiKey,
|
|
3
3
|
readEnvLocalApiKey
|
|
4
4
|
} from "./chunk-O63DJKIJ.js";
|
|
5
|
+
import {
|
|
6
|
+
AnonApiKeySchema
|
|
7
|
+
} from "./chunk-TQ54WLCZ.js";
|
|
5
8
|
import {
|
|
6
9
|
NEXT_CONFIG_NAMES
|
|
7
10
|
} from "./chunk-DXRZKKSO.js";
|
|
8
11
|
|
|
9
12
|
// src/cli/uninit.ts
|
|
10
|
-
import * as
|
|
13
|
+
import * as fs2 from "node:fs";
|
|
11
14
|
import * as os from "node:os";
|
|
15
|
+
import * as path2 from "node:path";
|
|
16
|
+
|
|
17
|
+
// src/cli/discovery-file.ts
|
|
18
|
+
import * as fs from "node:fs";
|
|
12
19
|
import * as path from "node:path";
|
|
20
|
+
var WELL_KNOWN_GLASSTRACE_PATH = ".well-known/glasstrace.json";
|
|
21
|
+
var DISCOVERY_FILE_VERSION = 1;
|
|
22
|
+
function resolveStaticRoot(projectRoot) {
|
|
23
|
+
if (isSvelteKitProject(projectRoot)) {
|
|
24
|
+
return {
|
|
25
|
+
absolutePath: path.join(projectRoot, "static"),
|
|
26
|
+
layout: "static"
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
absolutePath: path.join(projectRoot, "public"),
|
|
31
|
+
layout: "public"
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function isSvelteKitProject(projectRoot) {
|
|
35
|
+
const pkgPath = path.join(projectRoot, "package.json");
|
|
36
|
+
let isEsm = false;
|
|
37
|
+
try {
|
|
38
|
+
const pkgContent = fs.readFileSync(pkgPath, "utf-8");
|
|
39
|
+
const parsed = JSON.parse(pkgContent);
|
|
40
|
+
isEsm = parsed.type === "module";
|
|
41
|
+
} catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (!isEsm) return false;
|
|
45
|
+
const svelteConfigJs = path.join(projectRoot, "svelte.config.js");
|
|
46
|
+
const svelteConfigTs = path.join(projectRoot, "svelte.config.ts");
|
|
47
|
+
const appHtml = path.join(projectRoot, "src", "app.html");
|
|
48
|
+
return fs.existsSync(svelteConfigJs) || fs.existsSync(svelteConfigTs) || fs.existsSync(appHtml);
|
|
49
|
+
}
|
|
50
|
+
function relativeDiscoveryPath(layout) {
|
|
51
|
+
const rootDir = layout === "static" ? "static" : "public";
|
|
52
|
+
return `${rootDir}/${WELL_KNOWN_GLASSTRACE_PATH}`;
|
|
53
|
+
}
|
|
54
|
+
function readExistingDiscoveryFile(filePath) {
|
|
55
|
+
let raw;
|
|
56
|
+
try {
|
|
57
|
+
raw = fs.readFileSync(filePath, "utf-8");
|
|
58
|
+
} catch {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
let parsed;
|
|
62
|
+
try {
|
|
63
|
+
parsed = JSON.parse(raw);
|
|
64
|
+
} catch {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const obj = parsed;
|
|
71
|
+
const versionRaw = obj.version;
|
|
72
|
+
if (typeof versionRaw !== "number" || !Number.isInteger(versionRaw) || versionRaw < 1) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
const keyResult = AnonApiKeySchema.safeParse(obj.key);
|
|
76
|
+
if (!keyResult.success) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const extras = {};
|
|
80
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
81
|
+
if (k === "version" || k === "key") continue;
|
|
82
|
+
extras[k] = v;
|
|
83
|
+
}
|
|
84
|
+
return { key: keyResult.data, extras };
|
|
85
|
+
}
|
|
86
|
+
function serializeDiscoveryPayload(key, extras) {
|
|
87
|
+
const payload = {
|
|
88
|
+
version: DISCOVERY_FILE_VERSION,
|
|
89
|
+
key,
|
|
90
|
+
...extras
|
|
91
|
+
};
|
|
92
|
+
return JSON.stringify(payload, null, 2) + "\n";
|
|
93
|
+
}
|
|
94
|
+
function writeDiscoveryFile(projectRoot, anonKey) {
|
|
95
|
+
const { absolutePath: staticRoot, layout } = resolveStaticRoot(projectRoot);
|
|
96
|
+
const wellKnownDir = path.join(staticRoot, ".well-known");
|
|
97
|
+
const filePath = path.join(wellKnownDir, "glasstrace.json");
|
|
98
|
+
let existingAction;
|
|
99
|
+
let extras = {};
|
|
100
|
+
if (fs.existsSync(filePath)) {
|
|
101
|
+
const existing = readExistingDiscoveryFile(filePath);
|
|
102
|
+
if (existing === null) {
|
|
103
|
+
existingAction = "skipped-foreign";
|
|
104
|
+
} else if (existing.key === anonKey) {
|
|
105
|
+
return {
|
|
106
|
+
action: "skipped-matches",
|
|
107
|
+
filePath,
|
|
108
|
+
layout
|
|
109
|
+
};
|
|
110
|
+
} else {
|
|
111
|
+
extras = existing.extras;
|
|
112
|
+
existingAction = "updated-stale";
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
existingAction = "created";
|
|
116
|
+
}
|
|
117
|
+
const tmpPath = `${filePath}.tmp-${process.pid}`;
|
|
118
|
+
const needsWindowsReplace = process.platform === "win32" && fs.existsSync(filePath);
|
|
119
|
+
const backupPath = needsWindowsReplace ? `${filePath}.bak-${process.pid}` : null;
|
|
120
|
+
try {
|
|
121
|
+
fs.mkdirSync(wellKnownDir, { recursive: true });
|
|
122
|
+
const payload = serializeDiscoveryPayload(anonKey, extras);
|
|
123
|
+
fs.writeFileSync(tmpPath, payload, { encoding: "utf-8" });
|
|
124
|
+
if (backupPath !== null) {
|
|
125
|
+
fs.renameSync(filePath, backupPath);
|
|
126
|
+
try {
|
|
127
|
+
fs.renameSync(tmpPath, filePath);
|
|
128
|
+
} catch (renameErr) {
|
|
129
|
+
try {
|
|
130
|
+
fs.renameSync(backupPath, filePath);
|
|
131
|
+
} catch {
|
|
132
|
+
}
|
|
133
|
+
throw renameErr;
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
fs.unlinkSync(backupPath);
|
|
137
|
+
} catch {
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
fs.renameSync(tmpPath, filePath);
|
|
141
|
+
}
|
|
142
|
+
return { action: existingAction, filePath, layout };
|
|
143
|
+
} catch (err) {
|
|
144
|
+
try {
|
|
145
|
+
if (fs.existsSync(tmpPath)) {
|
|
146
|
+
fs.unlinkSync(tmpPath);
|
|
147
|
+
}
|
|
148
|
+
} catch {
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
action: "failed",
|
|
152
|
+
filePath,
|
|
153
|
+
layout,
|
|
154
|
+
error: err instanceof Error ? err.message : String(err)
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function removeDiscoveryFile(projectRoot) {
|
|
159
|
+
const { layout: inferredLayout } = resolveStaticRoot(projectRoot);
|
|
160
|
+
const layouts = ["public", "static"];
|
|
161
|
+
const outcomes = [];
|
|
162
|
+
for (const layout of layouts) {
|
|
163
|
+
const staticRoot = path.join(projectRoot, layout);
|
|
164
|
+
const wellKnownDir = path.join(staticRoot, ".well-known");
|
|
165
|
+
const filePath = path.join(wellKnownDir, "glasstrace.json");
|
|
166
|
+
let removed = false;
|
|
167
|
+
try {
|
|
168
|
+
if (fs.existsSync(filePath)) {
|
|
169
|
+
fs.unlinkSync(filePath);
|
|
170
|
+
removed = true;
|
|
171
|
+
}
|
|
172
|
+
} catch (err) {
|
|
173
|
+
return {
|
|
174
|
+
action: "failed",
|
|
175
|
+
filePath,
|
|
176
|
+
layout,
|
|
177
|
+
directoryRemoved: false,
|
|
178
|
+
error: err instanceof Error ? err.message : String(err)
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
let directoryRemoved = false;
|
|
182
|
+
if (removed) {
|
|
183
|
+
try {
|
|
184
|
+
if (fs.existsSync(wellKnownDir)) {
|
|
185
|
+
const entries = fs.readdirSync(wellKnownDir);
|
|
186
|
+
if (entries.length === 0) {
|
|
187
|
+
fs.rmdirSync(wellKnownDir);
|
|
188
|
+
directoryRemoved = true;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
} catch {
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
outcomes.push({ layout, filePath, removed, directoryRemoved });
|
|
195
|
+
}
|
|
196
|
+
const removals = outcomes.filter((o) => o.removed);
|
|
197
|
+
const chosen = (() => {
|
|
198
|
+
if (removals.length === 0) {
|
|
199
|
+
return outcomes.find((o) => o.layout === inferredLayout) ?? outcomes[0];
|
|
200
|
+
}
|
|
201
|
+
if (removals.length === 1) return removals[0];
|
|
202
|
+
return removals.find((o) => o.layout === inferredLayout) ?? removals[0];
|
|
203
|
+
})();
|
|
204
|
+
const anyDirectoryRemoved = outcomes.some((o) => o.directoryRemoved);
|
|
205
|
+
return {
|
|
206
|
+
action: removals.length > 0 ? "removed" : "not-found",
|
|
207
|
+
filePath: chosen.filePath,
|
|
208
|
+
layout: chosen.layout,
|
|
209
|
+
directoryRemoved: chosen.directoryRemoved || anyDirectoryRemoved
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// src/cli/uninit.ts
|
|
13
214
|
var MCP_CONFIG_FILES = [".mcp.json", ".cursor/mcp.json", ".gemini/settings.json"];
|
|
14
215
|
var AGENT_INFO_FILES = [
|
|
15
216
|
"CLAUDE.md",
|
|
@@ -316,24 +517,24 @@ function processTomlMcpConfig(content) {
|
|
|
316
517
|
return { action: "removed-section", content: result + "\n" };
|
|
317
518
|
}
|
|
318
519
|
function writeShutdownMarker(projectRoot) {
|
|
319
|
-
const dirPath =
|
|
320
|
-
if (!
|
|
520
|
+
const dirPath = path2.join(projectRoot, ".glasstrace");
|
|
521
|
+
if (!fs2.existsSync(dirPath)) {
|
|
321
522
|
return false;
|
|
322
523
|
}
|
|
323
|
-
const markerPath =
|
|
524
|
+
const markerPath = path2.join(dirPath, "shutdown-requested");
|
|
324
525
|
const tmpPath = `${markerPath}.tmp`;
|
|
325
526
|
const body = JSON.stringify({ requestedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
326
527
|
try {
|
|
327
|
-
|
|
528
|
+
fs2.writeFileSync(tmpPath, body, { encoding: "utf-8", mode: 384 });
|
|
328
529
|
try {
|
|
329
|
-
|
|
530
|
+
fs2.chmodSync(tmpPath, 384);
|
|
330
531
|
} catch {
|
|
331
532
|
}
|
|
332
|
-
|
|
533
|
+
fs2.renameSync(tmpPath, markerPath);
|
|
333
534
|
return true;
|
|
334
535
|
} catch {
|
|
335
536
|
try {
|
|
336
|
-
|
|
537
|
+
fs2.unlinkSync(tmpPath);
|
|
337
538
|
} catch {
|
|
338
539
|
}
|
|
339
540
|
return false;
|
|
@@ -374,8 +575,8 @@ async function runUninit(options) {
|
|
|
374
575
|
summary.push("Wrote .glasstrace/shutdown-requested marker");
|
|
375
576
|
}
|
|
376
577
|
} else {
|
|
377
|
-
const dirPath =
|
|
378
|
-
if (
|
|
578
|
+
const dirPath = path2.join(projectRoot, ".glasstrace");
|
|
579
|
+
if (fs2.existsSync(dirPath)) {
|
|
379
580
|
summary.push(`${prefix}Would write .glasstrace/shutdown-requested marker`);
|
|
380
581
|
}
|
|
381
582
|
}
|
|
@@ -387,11 +588,11 @@ async function runUninit(options) {
|
|
|
387
588
|
try {
|
|
388
589
|
let configHandled = false;
|
|
389
590
|
for (const name of NEXT_CONFIG_NAMES) {
|
|
390
|
-
const configPath =
|
|
391
|
-
if (!
|
|
591
|
+
const configPath = path2.join(projectRoot, name);
|
|
592
|
+
if (!fs2.existsSync(configPath)) {
|
|
392
593
|
continue;
|
|
393
594
|
}
|
|
394
|
-
const content =
|
|
595
|
+
const content = fs2.readFileSync(configPath, "utf-8");
|
|
395
596
|
if (!content.includes("withGlasstraceConfig")) {
|
|
396
597
|
continue;
|
|
397
598
|
}
|
|
@@ -401,7 +602,7 @@ async function runUninit(options) {
|
|
|
401
602
|
const cleaned = removeGlasstraceConfigImport(unwrapResult.content);
|
|
402
603
|
const final = cleanLeadingBlankLines(cleaned);
|
|
403
604
|
if (!dryRun) {
|
|
404
|
-
|
|
605
|
+
fs2.writeFileSync(configPath, final, "utf-8");
|
|
405
606
|
}
|
|
406
607
|
summary.push(`${prefix}Unwrapped withGlasstraceConfig from ${name}`);
|
|
407
608
|
configHandled = true;
|
|
@@ -422,20 +623,20 @@ async function runUninit(options) {
|
|
|
422
623
|
);
|
|
423
624
|
}
|
|
424
625
|
try {
|
|
425
|
-
const instrPath =
|
|
426
|
-
if (
|
|
427
|
-
const content =
|
|
626
|
+
const instrPath = path2.join(projectRoot, "instrumentation.ts");
|
|
627
|
+
if (fs2.existsSync(instrPath)) {
|
|
628
|
+
const content = fs2.readFileSync(instrPath, "utf-8");
|
|
428
629
|
if (content.includes("registerGlasstrace") || content.includes("@glasstrace/sdk")) {
|
|
429
630
|
if (isInitCreatedInstrumentation(content)) {
|
|
430
631
|
if (!dryRun) {
|
|
431
|
-
|
|
632
|
+
fs2.unlinkSync(instrPath);
|
|
432
633
|
}
|
|
433
634
|
summary.push(`${prefix}Deleted instrumentation.ts (init-created)`);
|
|
434
635
|
} else {
|
|
435
636
|
const cleaned = removeRegisterGlasstrace(content);
|
|
436
637
|
if (cleaned !== content) {
|
|
437
638
|
if (!dryRun) {
|
|
438
|
-
|
|
639
|
+
fs2.writeFileSync(instrPath, cleaned, "utf-8");
|
|
439
640
|
}
|
|
440
641
|
summary.push(
|
|
441
642
|
`${prefix}Removed registerGlasstrace() from instrumentation.ts`
|
|
@@ -450,10 +651,10 @@ async function runUninit(options) {
|
|
|
450
651
|
);
|
|
451
652
|
}
|
|
452
653
|
try {
|
|
453
|
-
const glasstraceDir =
|
|
454
|
-
if (
|
|
654
|
+
const glasstraceDir = path2.join(projectRoot, ".glasstrace");
|
|
655
|
+
if (fs2.existsSync(glasstraceDir)) {
|
|
455
656
|
if (!dryRun) {
|
|
456
|
-
|
|
657
|
+
fs2.rmSync(glasstraceDir, { recursive: true, force: true });
|
|
457
658
|
}
|
|
458
659
|
summary.push(`${prefix}Removed .glasstrace/ directory`);
|
|
459
660
|
}
|
|
@@ -463,9 +664,38 @@ async function runUninit(options) {
|
|
|
463
664
|
);
|
|
464
665
|
}
|
|
465
666
|
try {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
667
|
+
if (dryRun) {
|
|
668
|
+
for (const previewLayout of ["public", "static"]) {
|
|
669
|
+
const relPath = relativeDiscoveryPath(previewLayout);
|
|
670
|
+
const absPath = path2.join(projectRoot, relPath);
|
|
671
|
+
if (fs2.existsSync(absPath)) {
|
|
672
|
+
summary.push(`${prefix}Would remove ${relPath}`);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
} else {
|
|
676
|
+
const result = removeDiscoveryFile(projectRoot);
|
|
677
|
+
if (result.action === "removed") {
|
|
678
|
+
const relPath = relativeDiscoveryPath(result.layout);
|
|
679
|
+
summary.push(`Removed ${relPath}`);
|
|
680
|
+
if (result.directoryRemoved) {
|
|
681
|
+
const dirRel = relPath.replace(/\/glasstrace\.json$/, "/");
|
|
682
|
+
summary.push(`Removed empty ${dirRel}`);
|
|
683
|
+
}
|
|
684
|
+
} else if (result.action === "failed") {
|
|
685
|
+
warnings.push(
|
|
686
|
+
`Failed to remove ${relativeDiscoveryPath(result.layout)}${result.error !== void 0 ? `: ${result.error}` : ""}`
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
} catch (err) {
|
|
691
|
+
warnings.push(
|
|
692
|
+
`Failed to remove discovery file: ${err instanceof Error ? err.message : String(err)}`
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
try {
|
|
696
|
+
const envPath = path2.join(projectRoot, ".env.local");
|
|
697
|
+
if (fs2.existsSync(envPath)) {
|
|
698
|
+
const content = fs2.readFileSync(envPath, "utf-8");
|
|
469
699
|
const existingKey = readEnvLocalApiKey(content);
|
|
470
700
|
const hasDevKey = isDevApiKey(existingKey);
|
|
471
701
|
let proceed = true;
|
|
@@ -498,12 +728,12 @@ async function runUninit(options) {
|
|
|
498
728
|
const result = filtered.join("\n");
|
|
499
729
|
if (result.trim().length === 0) {
|
|
500
730
|
if (!dryRun) {
|
|
501
|
-
|
|
731
|
+
fs2.unlinkSync(envPath);
|
|
502
732
|
}
|
|
503
733
|
summary.push(`${prefix}Deleted .env.local (no remaining entries)`);
|
|
504
734
|
} else {
|
|
505
735
|
if (!dryRun) {
|
|
506
|
-
|
|
736
|
+
fs2.writeFileSync(envPath, result, "utf-8");
|
|
507
737
|
}
|
|
508
738
|
let devKeyAnnotation = "";
|
|
509
739
|
if (devKeyPath === "interactive-confirmed") {
|
|
@@ -526,9 +756,9 @@ async function runUninit(options) {
|
|
|
526
756
|
);
|
|
527
757
|
}
|
|
528
758
|
try {
|
|
529
|
-
const gitignorePath =
|
|
530
|
-
if (
|
|
531
|
-
const content =
|
|
759
|
+
const gitignorePath = path2.join(projectRoot, ".gitignore");
|
|
760
|
+
if (fs2.existsSync(gitignorePath)) {
|
|
761
|
+
const content = fs2.readFileSync(gitignorePath, "utf-8");
|
|
532
762
|
const lines = content.split("\n");
|
|
533
763
|
const mcpGitignoreEntries = /* @__PURE__ */ new Set([
|
|
534
764
|
".glasstrace/",
|
|
@@ -544,12 +774,12 @@ async function runUninit(options) {
|
|
|
544
774
|
const result = filtered.join("\n");
|
|
545
775
|
if (result.trim().length === 0) {
|
|
546
776
|
if (!dryRun) {
|
|
547
|
-
|
|
777
|
+
fs2.unlinkSync(gitignorePath);
|
|
548
778
|
}
|
|
549
779
|
summary.push(`${prefix}Deleted .gitignore (no remaining entries)`);
|
|
550
780
|
} else {
|
|
551
781
|
if (!dryRun) {
|
|
552
|
-
|
|
782
|
+
fs2.writeFileSync(gitignorePath, result, "utf-8");
|
|
553
783
|
}
|
|
554
784
|
summary.push(`${prefix}Removed Glasstrace entries from .gitignore`);
|
|
555
785
|
}
|
|
@@ -562,63 +792,63 @@ async function runUninit(options) {
|
|
|
562
792
|
}
|
|
563
793
|
try {
|
|
564
794
|
for (const configFile of MCP_CONFIG_FILES) {
|
|
565
|
-
const configPath =
|
|
566
|
-
if (!
|
|
795
|
+
const configPath = path2.join(projectRoot, configFile);
|
|
796
|
+
if (!fs2.existsSync(configPath)) {
|
|
567
797
|
continue;
|
|
568
798
|
}
|
|
569
|
-
const content =
|
|
799
|
+
const content = fs2.readFileSync(configPath, "utf-8");
|
|
570
800
|
const result = processJsonMcpConfig(content);
|
|
571
801
|
if (result.action === "deleted") {
|
|
572
802
|
if (!dryRun) {
|
|
573
|
-
|
|
803
|
+
fs2.unlinkSync(configPath);
|
|
574
804
|
}
|
|
575
805
|
summary.push(`${prefix}Deleted ${configFile}`);
|
|
576
806
|
} else if (result.action === "removed-key" && result.content !== void 0) {
|
|
577
807
|
if (!dryRun) {
|
|
578
|
-
|
|
808
|
+
fs2.writeFileSync(configPath, result.content, "utf-8");
|
|
579
809
|
}
|
|
580
810
|
summary.push(`${prefix}Removed glasstrace from ${configFile}`);
|
|
581
811
|
}
|
|
582
812
|
}
|
|
583
|
-
const codexConfigPath =
|
|
584
|
-
if (
|
|
585
|
-
const content =
|
|
813
|
+
const codexConfigPath = path2.join(projectRoot, ".codex", "config.toml");
|
|
814
|
+
if (fs2.existsSync(codexConfigPath)) {
|
|
815
|
+
const content = fs2.readFileSync(codexConfigPath, "utf-8");
|
|
586
816
|
const tomlResult = processTomlMcpConfig(content);
|
|
587
817
|
if (tomlResult.action === "deleted") {
|
|
588
818
|
if (!dryRun) {
|
|
589
|
-
|
|
819
|
+
fs2.unlinkSync(codexConfigPath);
|
|
590
820
|
}
|
|
591
821
|
summary.push(`${prefix}Deleted .codex/config.toml`);
|
|
592
822
|
} else if (tomlResult.action === "removed-section" && tomlResult.content !== void 0) {
|
|
593
823
|
if (!dryRun) {
|
|
594
|
-
|
|
824
|
+
fs2.writeFileSync(codexConfigPath, tomlResult.content, "utf-8");
|
|
595
825
|
}
|
|
596
826
|
summary.push(`${prefix}Removed glasstrace from .codex/config.toml`);
|
|
597
827
|
}
|
|
598
828
|
}
|
|
599
|
-
const hasWindsurfMarkers =
|
|
829
|
+
const hasWindsurfMarkers = fs2.existsSync(path2.join(projectRoot, ".windsurfrules")) || fs2.existsSync(path2.join(projectRoot, ".windsurf"));
|
|
600
830
|
if (hasWindsurfMarkers) {
|
|
601
|
-
const windsurfConfigPath =
|
|
831
|
+
const windsurfConfigPath = path2.join(
|
|
602
832
|
os.homedir(),
|
|
603
833
|
".codeium",
|
|
604
834
|
"windsurf",
|
|
605
835
|
"mcp_config.json"
|
|
606
836
|
);
|
|
607
|
-
if (
|
|
608
|
-
const content =
|
|
837
|
+
if (fs2.existsSync(windsurfConfigPath)) {
|
|
838
|
+
const content = fs2.readFileSync(windsurfConfigPath, "utf-8");
|
|
609
839
|
const windsurfResult = processJsonMcpConfig(content);
|
|
610
840
|
const home = os.homedir();
|
|
611
841
|
const displayPath = windsurfConfigPath.startsWith(home) ? "~" + windsurfConfigPath.slice(home.length) : windsurfConfigPath;
|
|
612
842
|
if (windsurfResult.action === "deleted") {
|
|
613
843
|
if (!dryRun) {
|
|
614
|
-
|
|
844
|
+
fs2.unlinkSync(windsurfConfigPath);
|
|
615
845
|
}
|
|
616
846
|
summary.push(
|
|
617
847
|
`${prefix}Deleted global Windsurf config (${displayPath})`
|
|
618
848
|
);
|
|
619
849
|
} else if (windsurfResult.action === "removed-key" && windsurfResult.content !== void 0) {
|
|
620
850
|
if (!dryRun) {
|
|
621
|
-
|
|
851
|
+
fs2.writeFileSync(windsurfConfigPath, windsurfResult.content, "utf-8");
|
|
622
852
|
}
|
|
623
853
|
summary.push(
|
|
624
854
|
`${prefix}Removed glasstrace from global Windsurf config (${displayPath})`
|
|
@@ -633,21 +863,21 @@ async function runUninit(options) {
|
|
|
633
863
|
}
|
|
634
864
|
try {
|
|
635
865
|
for (const infoFile of AGENT_INFO_FILES) {
|
|
636
|
-
const filePath =
|
|
637
|
-
if (!
|
|
866
|
+
const filePath = path2.join(projectRoot, infoFile);
|
|
867
|
+
if (!fs2.existsSync(filePath)) {
|
|
638
868
|
continue;
|
|
639
869
|
}
|
|
640
|
-
const content =
|
|
870
|
+
const content = fs2.readFileSync(filePath, "utf-8");
|
|
641
871
|
const result = removeMarkerSection(content);
|
|
642
872
|
if (result.removed) {
|
|
643
873
|
if (result.content.trim().length === 0) {
|
|
644
874
|
if (!dryRun) {
|
|
645
|
-
|
|
875
|
+
fs2.unlinkSync(filePath);
|
|
646
876
|
}
|
|
647
877
|
summary.push(`${prefix}Deleted ${infoFile} (only contained Glasstrace section)`);
|
|
648
878
|
} else {
|
|
649
879
|
if (!dryRun) {
|
|
650
|
-
|
|
880
|
+
fs2.writeFileSync(filePath, result.content, "utf-8");
|
|
651
881
|
}
|
|
652
882
|
summary.push(`${prefix}Removed Glasstrace section from ${infoFile}`);
|
|
653
883
|
}
|
|
@@ -665,6 +895,10 @@ async function runUninit(options) {
|
|
|
665
895
|
}
|
|
666
896
|
|
|
667
897
|
export {
|
|
898
|
+
resolveStaticRoot,
|
|
899
|
+
relativeDiscoveryPath,
|
|
900
|
+
writeDiscoveryFile,
|
|
901
|
+
removeDiscoveryFile,
|
|
668
902
|
skipString,
|
|
669
903
|
findMatchingDelimiter,
|
|
670
904
|
findMatchingParen,
|
|
@@ -679,4 +913,4 @@ export {
|
|
|
679
913
|
writeShutdownMarker,
|
|
680
914
|
runUninit
|
|
681
915
|
};
|
|
682
|
-
//# sourceMappingURL=chunk-
|
|
916
|
+
//# sourceMappingURL=chunk-LU3PPAOQ.js.map
|