@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
package/dist/cli/mcp-add.js
CHANGED
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
} from "../chunk-HAU66QBQ.js";
|
|
9
9
|
import {
|
|
10
10
|
readAnonKey
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-5N2IR4EO.js";
|
|
11
|
+
} from "../chunk-IP4NMDJK.js";
|
|
13
12
|
import {
|
|
14
13
|
scaffoldMcpMarker
|
|
15
14
|
} from "../chunk-O63DJKIJ.js";
|
|
15
|
+
import "../chunk-TQ54WLCZ.js";
|
|
16
16
|
import {
|
|
17
17
|
MCP_ENDPOINT,
|
|
18
18
|
formatAgentName
|
package/dist/cli/uninit.cjs
CHANGED
|
@@ -45,9 +45,9 @@ __export(uninit_exports, {
|
|
|
45
45
|
writeShutdownMarker: () => writeShutdownMarker
|
|
46
46
|
});
|
|
47
47
|
module.exports = __toCommonJS(uninit_exports);
|
|
48
|
-
var
|
|
48
|
+
var fs2 = __toESM(require("node:fs"), 1);
|
|
49
49
|
var os = __toESM(require("node:os"), 1);
|
|
50
|
-
var
|
|
50
|
+
var path2 = __toESM(require("node:path"), 1);
|
|
51
51
|
|
|
52
52
|
// src/cli/constants.ts
|
|
53
53
|
var NEXT_CONFIG_NAMES = ["next.config.ts", "next.config.js", "next.config.mjs"];
|
|
@@ -71,6 +71,97 @@ function isDevApiKey(value) {
|
|
|
71
71
|
return value.trim().startsWith("gt_dev_");
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
// src/cli/discovery-file.ts
|
|
75
|
+
var fs = __toESM(require("node:fs"), 1);
|
|
76
|
+
var path = __toESM(require("node:path"), 1);
|
|
77
|
+
var WELL_KNOWN_GLASSTRACE_PATH = ".well-known/glasstrace.json";
|
|
78
|
+
function resolveStaticRoot(projectRoot) {
|
|
79
|
+
if (isSvelteKitProject(projectRoot)) {
|
|
80
|
+
return {
|
|
81
|
+
absolutePath: path.join(projectRoot, "static"),
|
|
82
|
+
layout: "static"
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
absolutePath: path.join(projectRoot, "public"),
|
|
87
|
+
layout: "public"
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function isSvelteKitProject(projectRoot) {
|
|
91
|
+
const pkgPath = path.join(projectRoot, "package.json");
|
|
92
|
+
let isEsm = false;
|
|
93
|
+
try {
|
|
94
|
+
const pkgContent = fs.readFileSync(pkgPath, "utf-8");
|
|
95
|
+
const parsed = JSON.parse(pkgContent);
|
|
96
|
+
isEsm = parsed.type === "module";
|
|
97
|
+
} catch {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
if (!isEsm) return false;
|
|
101
|
+
const svelteConfigJs = path.join(projectRoot, "svelte.config.js");
|
|
102
|
+
const svelteConfigTs = path.join(projectRoot, "svelte.config.ts");
|
|
103
|
+
const appHtml = path.join(projectRoot, "src", "app.html");
|
|
104
|
+
return fs.existsSync(svelteConfigJs) || fs.existsSync(svelteConfigTs) || fs.existsSync(appHtml);
|
|
105
|
+
}
|
|
106
|
+
function relativeDiscoveryPath(layout) {
|
|
107
|
+
const rootDir = layout === "static" ? "static" : "public";
|
|
108
|
+
return `${rootDir}/${WELL_KNOWN_GLASSTRACE_PATH}`;
|
|
109
|
+
}
|
|
110
|
+
function removeDiscoveryFile(projectRoot) {
|
|
111
|
+
const { layout: inferredLayout } = resolveStaticRoot(projectRoot);
|
|
112
|
+
const layouts = ["public", "static"];
|
|
113
|
+
const outcomes = [];
|
|
114
|
+
for (const layout of layouts) {
|
|
115
|
+
const staticRoot = path.join(projectRoot, layout);
|
|
116
|
+
const wellKnownDir = path.join(staticRoot, ".well-known");
|
|
117
|
+
const filePath = path.join(wellKnownDir, "glasstrace.json");
|
|
118
|
+
let removed = false;
|
|
119
|
+
try {
|
|
120
|
+
if (fs.existsSync(filePath)) {
|
|
121
|
+
fs.unlinkSync(filePath);
|
|
122
|
+
removed = true;
|
|
123
|
+
}
|
|
124
|
+
} catch (err) {
|
|
125
|
+
return {
|
|
126
|
+
action: "failed",
|
|
127
|
+
filePath,
|
|
128
|
+
layout,
|
|
129
|
+
directoryRemoved: false,
|
|
130
|
+
error: err instanceof Error ? err.message : String(err)
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
let directoryRemoved = false;
|
|
134
|
+
if (removed) {
|
|
135
|
+
try {
|
|
136
|
+
if (fs.existsSync(wellKnownDir)) {
|
|
137
|
+
const entries = fs.readdirSync(wellKnownDir);
|
|
138
|
+
if (entries.length === 0) {
|
|
139
|
+
fs.rmdirSync(wellKnownDir);
|
|
140
|
+
directoryRemoved = true;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
} catch {
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
outcomes.push({ layout, filePath, removed, directoryRemoved });
|
|
147
|
+
}
|
|
148
|
+
const removals = outcomes.filter((o) => o.removed);
|
|
149
|
+
const chosen = (() => {
|
|
150
|
+
if (removals.length === 0) {
|
|
151
|
+
return outcomes.find((o) => o.layout === inferredLayout) ?? outcomes[0];
|
|
152
|
+
}
|
|
153
|
+
if (removals.length === 1) return removals[0];
|
|
154
|
+
return removals.find((o) => o.layout === inferredLayout) ?? removals[0];
|
|
155
|
+
})();
|
|
156
|
+
const anyDirectoryRemoved = outcomes.some((o) => o.directoryRemoved);
|
|
157
|
+
return {
|
|
158
|
+
action: removals.length > 0 ? "removed" : "not-found",
|
|
159
|
+
filePath: chosen.filePath,
|
|
160
|
+
layout: chosen.layout,
|
|
161
|
+
directoryRemoved: chosen.directoryRemoved || anyDirectoryRemoved
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
74
165
|
// src/cli/uninit.ts
|
|
75
166
|
var MCP_CONFIG_FILES = [".mcp.json", ".cursor/mcp.json", ".gemini/settings.json"];
|
|
76
167
|
var AGENT_INFO_FILES = [
|
|
@@ -378,24 +469,24 @@ function processTomlMcpConfig(content) {
|
|
|
378
469
|
return { action: "removed-section", content: result + "\n" };
|
|
379
470
|
}
|
|
380
471
|
function writeShutdownMarker(projectRoot) {
|
|
381
|
-
const dirPath =
|
|
382
|
-
if (!
|
|
472
|
+
const dirPath = path2.join(projectRoot, ".glasstrace");
|
|
473
|
+
if (!fs2.existsSync(dirPath)) {
|
|
383
474
|
return false;
|
|
384
475
|
}
|
|
385
|
-
const markerPath =
|
|
476
|
+
const markerPath = path2.join(dirPath, "shutdown-requested");
|
|
386
477
|
const tmpPath = `${markerPath}.tmp`;
|
|
387
478
|
const body = JSON.stringify({ requestedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
388
479
|
try {
|
|
389
|
-
|
|
480
|
+
fs2.writeFileSync(tmpPath, body, { encoding: "utf-8", mode: 384 });
|
|
390
481
|
try {
|
|
391
|
-
|
|
482
|
+
fs2.chmodSync(tmpPath, 384);
|
|
392
483
|
} catch {
|
|
393
484
|
}
|
|
394
|
-
|
|
485
|
+
fs2.renameSync(tmpPath, markerPath);
|
|
395
486
|
return true;
|
|
396
487
|
} catch {
|
|
397
488
|
try {
|
|
398
|
-
|
|
489
|
+
fs2.unlinkSync(tmpPath);
|
|
399
490
|
} catch {
|
|
400
491
|
}
|
|
401
492
|
return false;
|
|
@@ -436,8 +527,8 @@ async function runUninit(options) {
|
|
|
436
527
|
summary.push("Wrote .glasstrace/shutdown-requested marker");
|
|
437
528
|
}
|
|
438
529
|
} else {
|
|
439
|
-
const dirPath =
|
|
440
|
-
if (
|
|
530
|
+
const dirPath = path2.join(projectRoot, ".glasstrace");
|
|
531
|
+
if (fs2.existsSync(dirPath)) {
|
|
441
532
|
summary.push(`${prefix}Would write .glasstrace/shutdown-requested marker`);
|
|
442
533
|
}
|
|
443
534
|
}
|
|
@@ -449,11 +540,11 @@ async function runUninit(options) {
|
|
|
449
540
|
try {
|
|
450
541
|
let configHandled = false;
|
|
451
542
|
for (const name of NEXT_CONFIG_NAMES) {
|
|
452
|
-
const configPath =
|
|
453
|
-
if (!
|
|
543
|
+
const configPath = path2.join(projectRoot, name);
|
|
544
|
+
if (!fs2.existsSync(configPath)) {
|
|
454
545
|
continue;
|
|
455
546
|
}
|
|
456
|
-
const content =
|
|
547
|
+
const content = fs2.readFileSync(configPath, "utf-8");
|
|
457
548
|
if (!content.includes("withGlasstraceConfig")) {
|
|
458
549
|
continue;
|
|
459
550
|
}
|
|
@@ -463,7 +554,7 @@ async function runUninit(options) {
|
|
|
463
554
|
const cleaned = removeGlasstraceConfigImport(unwrapResult.content);
|
|
464
555
|
const final = cleanLeadingBlankLines(cleaned);
|
|
465
556
|
if (!dryRun) {
|
|
466
|
-
|
|
557
|
+
fs2.writeFileSync(configPath, final, "utf-8");
|
|
467
558
|
}
|
|
468
559
|
summary.push(`${prefix}Unwrapped withGlasstraceConfig from ${name}`);
|
|
469
560
|
configHandled = true;
|
|
@@ -484,20 +575,20 @@ async function runUninit(options) {
|
|
|
484
575
|
);
|
|
485
576
|
}
|
|
486
577
|
try {
|
|
487
|
-
const instrPath =
|
|
488
|
-
if (
|
|
489
|
-
const content =
|
|
578
|
+
const instrPath = path2.join(projectRoot, "instrumentation.ts");
|
|
579
|
+
if (fs2.existsSync(instrPath)) {
|
|
580
|
+
const content = fs2.readFileSync(instrPath, "utf-8");
|
|
490
581
|
if (content.includes("registerGlasstrace") || content.includes("@glasstrace/sdk")) {
|
|
491
582
|
if (isInitCreatedInstrumentation(content)) {
|
|
492
583
|
if (!dryRun) {
|
|
493
|
-
|
|
584
|
+
fs2.unlinkSync(instrPath);
|
|
494
585
|
}
|
|
495
586
|
summary.push(`${prefix}Deleted instrumentation.ts (init-created)`);
|
|
496
587
|
} else {
|
|
497
588
|
const cleaned = removeRegisterGlasstrace(content);
|
|
498
589
|
if (cleaned !== content) {
|
|
499
590
|
if (!dryRun) {
|
|
500
|
-
|
|
591
|
+
fs2.writeFileSync(instrPath, cleaned, "utf-8");
|
|
501
592
|
}
|
|
502
593
|
summary.push(
|
|
503
594
|
`${prefix}Removed registerGlasstrace() from instrumentation.ts`
|
|
@@ -512,10 +603,10 @@ async function runUninit(options) {
|
|
|
512
603
|
);
|
|
513
604
|
}
|
|
514
605
|
try {
|
|
515
|
-
const glasstraceDir =
|
|
516
|
-
if (
|
|
606
|
+
const glasstraceDir = path2.join(projectRoot, ".glasstrace");
|
|
607
|
+
if (fs2.existsSync(glasstraceDir)) {
|
|
517
608
|
if (!dryRun) {
|
|
518
|
-
|
|
609
|
+
fs2.rmSync(glasstraceDir, { recursive: true, force: true });
|
|
519
610
|
}
|
|
520
611
|
summary.push(`${prefix}Removed .glasstrace/ directory`);
|
|
521
612
|
}
|
|
@@ -525,9 +616,38 @@ async function runUninit(options) {
|
|
|
525
616
|
);
|
|
526
617
|
}
|
|
527
618
|
try {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
619
|
+
if (dryRun) {
|
|
620
|
+
for (const previewLayout of ["public", "static"]) {
|
|
621
|
+
const relPath = relativeDiscoveryPath(previewLayout);
|
|
622
|
+
const absPath = path2.join(projectRoot, relPath);
|
|
623
|
+
if (fs2.existsSync(absPath)) {
|
|
624
|
+
summary.push(`${prefix}Would remove ${relPath}`);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
} else {
|
|
628
|
+
const result = removeDiscoveryFile(projectRoot);
|
|
629
|
+
if (result.action === "removed") {
|
|
630
|
+
const relPath = relativeDiscoveryPath(result.layout);
|
|
631
|
+
summary.push(`Removed ${relPath}`);
|
|
632
|
+
if (result.directoryRemoved) {
|
|
633
|
+
const dirRel = relPath.replace(/\/glasstrace\.json$/, "/");
|
|
634
|
+
summary.push(`Removed empty ${dirRel}`);
|
|
635
|
+
}
|
|
636
|
+
} else if (result.action === "failed") {
|
|
637
|
+
warnings.push(
|
|
638
|
+
`Failed to remove ${relativeDiscoveryPath(result.layout)}${result.error !== void 0 ? `: ${result.error}` : ""}`
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
} catch (err) {
|
|
643
|
+
warnings.push(
|
|
644
|
+
`Failed to remove discovery file: ${err instanceof Error ? err.message : String(err)}`
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
try {
|
|
648
|
+
const envPath = path2.join(projectRoot, ".env.local");
|
|
649
|
+
if (fs2.existsSync(envPath)) {
|
|
650
|
+
const content = fs2.readFileSync(envPath, "utf-8");
|
|
531
651
|
const existingKey = readEnvLocalApiKey(content);
|
|
532
652
|
const hasDevKey = isDevApiKey(existingKey);
|
|
533
653
|
let proceed = true;
|
|
@@ -560,12 +680,12 @@ async function runUninit(options) {
|
|
|
560
680
|
const result = filtered.join("\n");
|
|
561
681
|
if (result.trim().length === 0) {
|
|
562
682
|
if (!dryRun) {
|
|
563
|
-
|
|
683
|
+
fs2.unlinkSync(envPath);
|
|
564
684
|
}
|
|
565
685
|
summary.push(`${prefix}Deleted .env.local (no remaining entries)`);
|
|
566
686
|
} else {
|
|
567
687
|
if (!dryRun) {
|
|
568
|
-
|
|
688
|
+
fs2.writeFileSync(envPath, result, "utf-8");
|
|
569
689
|
}
|
|
570
690
|
let devKeyAnnotation = "";
|
|
571
691
|
if (devKeyPath === "interactive-confirmed") {
|
|
@@ -588,9 +708,9 @@ async function runUninit(options) {
|
|
|
588
708
|
);
|
|
589
709
|
}
|
|
590
710
|
try {
|
|
591
|
-
const gitignorePath =
|
|
592
|
-
if (
|
|
593
|
-
const content =
|
|
711
|
+
const gitignorePath = path2.join(projectRoot, ".gitignore");
|
|
712
|
+
if (fs2.existsSync(gitignorePath)) {
|
|
713
|
+
const content = fs2.readFileSync(gitignorePath, "utf-8");
|
|
594
714
|
const lines = content.split("\n");
|
|
595
715
|
const mcpGitignoreEntries = /* @__PURE__ */ new Set([
|
|
596
716
|
".glasstrace/",
|
|
@@ -606,12 +726,12 @@ async function runUninit(options) {
|
|
|
606
726
|
const result = filtered.join("\n");
|
|
607
727
|
if (result.trim().length === 0) {
|
|
608
728
|
if (!dryRun) {
|
|
609
|
-
|
|
729
|
+
fs2.unlinkSync(gitignorePath);
|
|
610
730
|
}
|
|
611
731
|
summary.push(`${prefix}Deleted .gitignore (no remaining entries)`);
|
|
612
732
|
} else {
|
|
613
733
|
if (!dryRun) {
|
|
614
|
-
|
|
734
|
+
fs2.writeFileSync(gitignorePath, result, "utf-8");
|
|
615
735
|
}
|
|
616
736
|
summary.push(`${prefix}Removed Glasstrace entries from .gitignore`);
|
|
617
737
|
}
|
|
@@ -624,63 +744,63 @@ async function runUninit(options) {
|
|
|
624
744
|
}
|
|
625
745
|
try {
|
|
626
746
|
for (const configFile of MCP_CONFIG_FILES) {
|
|
627
|
-
const configPath =
|
|
628
|
-
if (!
|
|
747
|
+
const configPath = path2.join(projectRoot, configFile);
|
|
748
|
+
if (!fs2.existsSync(configPath)) {
|
|
629
749
|
continue;
|
|
630
750
|
}
|
|
631
|
-
const content =
|
|
751
|
+
const content = fs2.readFileSync(configPath, "utf-8");
|
|
632
752
|
const result = processJsonMcpConfig(content);
|
|
633
753
|
if (result.action === "deleted") {
|
|
634
754
|
if (!dryRun) {
|
|
635
|
-
|
|
755
|
+
fs2.unlinkSync(configPath);
|
|
636
756
|
}
|
|
637
757
|
summary.push(`${prefix}Deleted ${configFile}`);
|
|
638
758
|
} else if (result.action === "removed-key" && result.content !== void 0) {
|
|
639
759
|
if (!dryRun) {
|
|
640
|
-
|
|
760
|
+
fs2.writeFileSync(configPath, result.content, "utf-8");
|
|
641
761
|
}
|
|
642
762
|
summary.push(`${prefix}Removed glasstrace from ${configFile}`);
|
|
643
763
|
}
|
|
644
764
|
}
|
|
645
|
-
const codexConfigPath =
|
|
646
|
-
if (
|
|
647
|
-
const content =
|
|
765
|
+
const codexConfigPath = path2.join(projectRoot, ".codex", "config.toml");
|
|
766
|
+
if (fs2.existsSync(codexConfigPath)) {
|
|
767
|
+
const content = fs2.readFileSync(codexConfigPath, "utf-8");
|
|
648
768
|
const tomlResult = processTomlMcpConfig(content);
|
|
649
769
|
if (tomlResult.action === "deleted") {
|
|
650
770
|
if (!dryRun) {
|
|
651
|
-
|
|
771
|
+
fs2.unlinkSync(codexConfigPath);
|
|
652
772
|
}
|
|
653
773
|
summary.push(`${prefix}Deleted .codex/config.toml`);
|
|
654
774
|
} else if (tomlResult.action === "removed-section" && tomlResult.content !== void 0) {
|
|
655
775
|
if (!dryRun) {
|
|
656
|
-
|
|
776
|
+
fs2.writeFileSync(codexConfigPath, tomlResult.content, "utf-8");
|
|
657
777
|
}
|
|
658
778
|
summary.push(`${prefix}Removed glasstrace from .codex/config.toml`);
|
|
659
779
|
}
|
|
660
780
|
}
|
|
661
|
-
const hasWindsurfMarkers =
|
|
781
|
+
const hasWindsurfMarkers = fs2.existsSync(path2.join(projectRoot, ".windsurfrules")) || fs2.existsSync(path2.join(projectRoot, ".windsurf"));
|
|
662
782
|
if (hasWindsurfMarkers) {
|
|
663
|
-
const windsurfConfigPath =
|
|
783
|
+
const windsurfConfigPath = path2.join(
|
|
664
784
|
os.homedir(),
|
|
665
785
|
".codeium",
|
|
666
786
|
"windsurf",
|
|
667
787
|
"mcp_config.json"
|
|
668
788
|
);
|
|
669
|
-
if (
|
|
670
|
-
const content =
|
|
789
|
+
if (fs2.existsSync(windsurfConfigPath)) {
|
|
790
|
+
const content = fs2.readFileSync(windsurfConfigPath, "utf-8");
|
|
671
791
|
const windsurfResult = processJsonMcpConfig(content);
|
|
672
792
|
const home = os.homedir();
|
|
673
793
|
const displayPath = windsurfConfigPath.startsWith(home) ? "~" + windsurfConfigPath.slice(home.length) : windsurfConfigPath;
|
|
674
794
|
if (windsurfResult.action === "deleted") {
|
|
675
795
|
if (!dryRun) {
|
|
676
|
-
|
|
796
|
+
fs2.unlinkSync(windsurfConfigPath);
|
|
677
797
|
}
|
|
678
798
|
summary.push(
|
|
679
799
|
`${prefix}Deleted global Windsurf config (${displayPath})`
|
|
680
800
|
);
|
|
681
801
|
} else if (windsurfResult.action === "removed-key" && windsurfResult.content !== void 0) {
|
|
682
802
|
if (!dryRun) {
|
|
683
|
-
|
|
803
|
+
fs2.writeFileSync(windsurfConfigPath, windsurfResult.content, "utf-8");
|
|
684
804
|
}
|
|
685
805
|
summary.push(
|
|
686
806
|
`${prefix}Removed glasstrace from global Windsurf config (${displayPath})`
|
|
@@ -695,21 +815,21 @@ async function runUninit(options) {
|
|
|
695
815
|
}
|
|
696
816
|
try {
|
|
697
817
|
for (const infoFile of AGENT_INFO_FILES) {
|
|
698
|
-
const filePath =
|
|
699
|
-
if (!
|
|
818
|
+
const filePath = path2.join(projectRoot, infoFile);
|
|
819
|
+
if (!fs2.existsSync(filePath)) {
|
|
700
820
|
continue;
|
|
701
821
|
}
|
|
702
|
-
const content =
|
|
822
|
+
const content = fs2.readFileSync(filePath, "utf-8");
|
|
703
823
|
const result = removeMarkerSection(content);
|
|
704
824
|
if (result.removed) {
|
|
705
825
|
if (result.content.trim().length === 0) {
|
|
706
826
|
if (!dryRun) {
|
|
707
|
-
|
|
827
|
+
fs2.unlinkSync(filePath);
|
|
708
828
|
}
|
|
709
829
|
summary.push(`${prefix}Deleted ${infoFile} (only contained Glasstrace section)`);
|
|
710
830
|
} else {
|
|
711
831
|
if (!dryRun) {
|
|
712
|
-
|
|
832
|
+
fs2.writeFileSync(filePath, result.content, "utf-8");
|
|
713
833
|
}
|
|
714
834
|
summary.push(`${prefix}Removed Glasstrace section from ${infoFile}`);
|
|
715
835
|
}
|