@glasstrace/sdk 0.9.0 → 0.9.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/dist/{chunk-UGHMMOM4.js → chunk-4NDQPWDJ.js} +16 -21
- package/dist/chunk-4NDQPWDJ.js.map +1 -0
- package/dist/chunk-DXRZKKSO.js +21 -0
- package/dist/chunk-DXRZKKSO.js.map +1 -0
- package/dist/{chunk-QW6W4CSA.js → chunk-PQWAKVQ5.js} +9 -4
- package/dist/chunk-PQWAKVQ5.js.map +1 -0
- package/dist/{chunk-SALPGSWK.js → chunk-Y6V7BTF3.js} +2 -2
- package/dist/cli/init.cjs +46 -32
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.js +8 -6
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/mcp-add.cjs +25 -15
- package/dist/cli/mcp-add.cjs.map +1 -1
- package/dist/cli/mcp-add.js +6 -4
- package/dist/cli/mcp-add.js.map +1 -1
- package/dist/cli/uninit.cjs +4 -0
- package/dist/cli/uninit.cjs.map +1 -1
- package/dist/cli/uninit.js +3 -1
- package/dist/cli/uninit.js.map +1 -1
- package/dist/index.cjs +52 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +46 -39
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/dist/chunk-QW6W4CSA.js.map +0 -1
- package/dist/chunk-UGHMMOM4.js.map +0 -1
- /package/dist/{chunk-SALPGSWK.js.map → chunk-Y6V7BTF3.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createBuildHash
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PQWAKVQ5.js";
|
|
4
4
|
|
|
5
5
|
// src/import-graph.ts
|
|
6
6
|
import * as fs from "fs/promises";
|
|
@@ -175,4 +175,4 @@ export {
|
|
|
175
175
|
extractImports,
|
|
176
176
|
buildImportGraph
|
|
177
177
|
};
|
|
178
|
-
//# sourceMappingURL=chunk-
|
|
178
|
+
//# sourceMappingURL=chunk-Y6V7BTF3.js.map
|
package/dist/cli/init.cjs
CHANGED
|
@@ -31,6 +31,27 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
));
|
|
32
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
33
|
|
|
34
|
+
// src/cli/constants.ts
|
|
35
|
+
function formatAgentName(name) {
|
|
36
|
+
const displayNames = {
|
|
37
|
+
claude: "Claude Code",
|
|
38
|
+
codex: "Codex",
|
|
39
|
+
gemini: "Gemini",
|
|
40
|
+
cursor: "Cursor",
|
|
41
|
+
windsurf: "Windsurf",
|
|
42
|
+
generic: "Generic"
|
|
43
|
+
};
|
|
44
|
+
return displayNames[name];
|
|
45
|
+
}
|
|
46
|
+
var MCP_ENDPOINT, NEXT_CONFIG_NAMES;
|
|
47
|
+
var init_constants = __esm({
|
|
48
|
+
"src/cli/constants.ts"() {
|
|
49
|
+
"use strict";
|
|
50
|
+
MCP_ENDPOINT = "https://api.glasstrace.dev/mcp";
|
|
51
|
+
NEXT_CONFIG_NAMES = ["next.config.ts", "next.config.js", "next.config.mjs"];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
34
55
|
// src/cli/scaffolder.ts
|
|
35
56
|
function identityFingerprint(token) {
|
|
36
57
|
return `sha256:${(0, import_node_crypto.createHash)("sha256").update(token).digest("hex")}`;
|
|
@@ -72,7 +93,7 @@ ${indent}registerGlasstrace();
|
|
|
72
93
|
} else {
|
|
73
94
|
const existingImports = specifiers.trimEnd();
|
|
74
95
|
const separator = existingImports.endsWith(",") ? " " : ", ";
|
|
75
|
-
const updatedImport = `import {${existingImports}${separator}registerGlasstrace} from "@glasstrace/sdk"`;
|
|
96
|
+
const updatedImport = `import { ${existingImports.trim()}${separator}registerGlasstrace } from "@glasstrace/sdk"`;
|
|
76
97
|
modified = content.replace(importMatch[0], updatedImport);
|
|
77
98
|
const newMatch = registerFnRegex.exec(modified);
|
|
78
99
|
if (newMatch) {
|
|
@@ -275,14 +296,14 @@ async function scaffoldMcpMarker(projectRoot, anonKey) {
|
|
|
275
296
|
fs.chmodSync(markerPath, 384);
|
|
276
297
|
return true;
|
|
277
298
|
}
|
|
278
|
-
var import_node_crypto, fs, path
|
|
299
|
+
var import_node_crypto, fs, path;
|
|
279
300
|
var init_scaffolder = __esm({
|
|
280
301
|
"src/cli/scaffolder.ts"() {
|
|
281
302
|
"use strict";
|
|
282
303
|
import_node_crypto = require("crypto");
|
|
283
304
|
fs = __toESM(require("fs"), 1);
|
|
284
305
|
path = __toESM(require("path"), 1);
|
|
285
|
-
|
|
306
|
+
init_constants();
|
|
286
307
|
}
|
|
287
308
|
});
|
|
288
309
|
|
|
@@ -14859,9 +14880,14 @@ async function getOrCreateAnonKey(projectRoot) {
|
|
|
14859
14880
|
} catch (err) {
|
|
14860
14881
|
const code = err.code;
|
|
14861
14882
|
if (code === "EEXIST") {
|
|
14862
|
-
|
|
14863
|
-
|
|
14864
|
-
|
|
14883
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
14884
|
+
const winnerKey = await readAnonKey(root);
|
|
14885
|
+
if (winnerKey !== null) {
|
|
14886
|
+
return winnerKey;
|
|
14887
|
+
}
|
|
14888
|
+
if (attempt < 2) {
|
|
14889
|
+
await new Promise((resolve2) => setTimeout(resolve2, 50));
|
|
14890
|
+
}
|
|
14865
14891
|
}
|
|
14866
14892
|
try {
|
|
14867
14893
|
await (0, import_promises.writeFile)(keyPath, newKey, { mode: 384 });
|
|
@@ -15075,7 +15101,7 @@ function generateMcpConfig(agent, endpoint, anonKey) {
|
|
|
15075
15101
|
2
|
|
15076
15102
|
);
|
|
15077
15103
|
case "codex": {
|
|
15078
|
-
const safeEndpoint = endpoint.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
15104
|
+
const safeEndpoint = endpoint.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
|
|
15079
15105
|
return [
|
|
15080
15106
|
"[mcp_servers.glasstrace]",
|
|
15081
15107
|
`url = "${safeEndpoint}"`,
|
|
@@ -15143,6 +15169,10 @@ function generateMcpConfig(agent, endpoint, anonKey) {
|
|
|
15143
15169
|
null,
|
|
15144
15170
|
2
|
|
15145
15171
|
);
|
|
15172
|
+
default: {
|
|
15173
|
+
const _exhaustive = agent.name;
|
|
15174
|
+
throw new Error(`Unknown agent: ${_exhaustive}`);
|
|
15175
|
+
}
|
|
15146
15176
|
}
|
|
15147
15177
|
}
|
|
15148
15178
|
function htmlMarkers() {
|
|
@@ -15200,6 +15230,10 @@ ${content}${m.end}
|
|
|
15200
15230
|
case "windsurf":
|
|
15201
15231
|
case "generic":
|
|
15202
15232
|
return "";
|
|
15233
|
+
default: {
|
|
15234
|
+
const _exhaustive = agent.name;
|
|
15235
|
+
throw new Error(`Unknown agent: ${_exhaustive}`);
|
|
15236
|
+
}
|
|
15203
15237
|
}
|
|
15204
15238
|
}
|
|
15205
15239
|
var init_configs = __esm({
|
|
@@ -15391,26 +15425,6 @@ var init_inject = __esm({
|
|
|
15391
15425
|
}
|
|
15392
15426
|
});
|
|
15393
15427
|
|
|
15394
|
-
// src/cli/constants.ts
|
|
15395
|
-
function formatAgentName(name) {
|
|
15396
|
-
const displayNames = {
|
|
15397
|
-
claude: "Claude Code",
|
|
15398
|
-
codex: "Codex",
|
|
15399
|
-
gemini: "Gemini",
|
|
15400
|
-
cursor: "Cursor",
|
|
15401
|
-
windsurf: "Windsurf",
|
|
15402
|
-
generic: "Generic"
|
|
15403
|
-
};
|
|
15404
|
-
return displayNames[name];
|
|
15405
|
-
}
|
|
15406
|
-
var MCP_ENDPOINT;
|
|
15407
|
-
var init_constants = __esm({
|
|
15408
|
-
"src/cli/constants.ts"() {
|
|
15409
|
-
"use strict";
|
|
15410
|
-
MCP_ENDPOINT = "https://api.glasstrace.dev/mcp";
|
|
15411
|
-
}
|
|
15412
|
-
});
|
|
15413
|
-
|
|
15414
15428
|
// src/cli/mcp-add.ts
|
|
15415
15429
|
var mcp_add_exports = {};
|
|
15416
15430
|
__export(mcp_add_exports, {
|
|
@@ -15933,7 +15947,7 @@ async function runUninit(options) {
|
|
|
15933
15947
|
const prefix = dryRun ? "[dry run] " : "";
|
|
15934
15948
|
try {
|
|
15935
15949
|
let configHandled = false;
|
|
15936
|
-
for (const name of
|
|
15950
|
+
for (const name of NEXT_CONFIG_NAMES) {
|
|
15937
15951
|
const configPath = path5.join(projectRoot, name);
|
|
15938
15952
|
if (!fs5.existsSync(configPath)) {
|
|
15939
15953
|
continue;
|
|
@@ -16170,14 +16184,14 @@ async function runUninit(options) {
|
|
|
16170
16184
|
}
|
|
16171
16185
|
return { exitCode: errors.length > 0 ? 1 : 0, summary, warnings, errors };
|
|
16172
16186
|
}
|
|
16173
|
-
var fs5, os, path5,
|
|
16187
|
+
var fs5, os, path5, MCP_CONFIG_FILES, AGENT_INFO_FILES;
|
|
16174
16188
|
var init_uninit = __esm({
|
|
16175
16189
|
"src/cli/uninit.ts"() {
|
|
16176
16190
|
"use strict";
|
|
16177
16191
|
fs5 = __toESM(require("fs"), 1);
|
|
16178
16192
|
os = __toESM(require("os"), 1);
|
|
16179
16193
|
path5 = __toESM(require("path"), 1);
|
|
16180
|
-
|
|
16194
|
+
init_constants();
|
|
16181
16195
|
MCP_CONFIG_FILES = [".mcp.json", ".cursor/mcp.json", ".gemini/settings.json"];
|
|
16182
16196
|
AGENT_INFO_FILES = [
|
|
16183
16197
|
"CLAUDE.md",
|
|
@@ -16378,7 +16392,7 @@ init_constants();
|
|
|
16378
16392
|
// src/cli/monorepo.ts
|
|
16379
16393
|
var fs3 = __toESM(require("fs"), 1);
|
|
16380
16394
|
var path3 = __toESM(require("path"), 1);
|
|
16381
|
-
|
|
16395
|
+
init_constants();
|
|
16382
16396
|
function resolveProjectRoot(cwd) {
|
|
16383
16397
|
if (hasNextConfig(cwd)) {
|
|
16384
16398
|
return { projectRoot: cwd, isMonorepo: false };
|
|
@@ -16414,7 +16428,7 @@ Run init from the specific app directory you want to instrument.`
|
|
|
16414
16428
|
);
|
|
16415
16429
|
}
|
|
16416
16430
|
function hasNextConfig(dir) {
|
|
16417
|
-
return
|
|
16431
|
+
return NEXT_CONFIG_NAMES.some(
|
|
16418
16432
|
(name) => fs3.existsSync(path3.join(dir, name))
|
|
16419
16433
|
);
|
|
16420
16434
|
}
|