@glasstrace/sdk 0.14.2 → 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 +84 -1
- package/dist/adapters/drizzle.js +2 -5
- package/dist/adapters/drizzle.js.map +1 -1
- package/dist/{chunk-PD2SKFQQ.js → chunk-55FBXXER.js} +4 -8
- package/dist/{chunk-PD2SKFQQ.js.map → chunk-55FBXXER.js.map} +1 -1
- package/dist/chunk-5C2TJFLB.js +851 -0
- package/dist/chunk-5C2TJFLB.js.map +1 -0
- package/dist/{chunk-YMEXDDTA.js → chunk-7JBKXSBU.js} +3 -99
- package/dist/chunk-7JBKXSBU.js.map +1 -0
- package/dist/{chunk-2LDBR3F3.js → chunk-BANTDXUT.js} +15 -74
- package/dist/chunk-BANTDXUT.js.map +1 -0
- package/dist/{chunk-WV3NIPWJ.js → chunk-CTJI2YKA.js} +23 -288
- package/dist/chunk-CTJI2YKA.js.map +1 -0
- package/dist/{chunk-WK7MPK2T.js → chunk-DQ25VOKK.js} +1 -89
- package/dist/chunk-DQ25VOKK.js.map +1 -0
- package/dist/{chunk-BL3YDC6V.js → chunk-DXRZKKSO.js} +1 -6
- package/dist/{chunk-BL3YDC6V.js.map → chunk-DXRZKKSO.js.map} +1 -1
- package/dist/{chunk-BGZ7J74D.js → chunk-NSBPE2FW.js} +2 -16
- package/dist/chunk-O63DJKIJ.js +460 -0
- package/dist/chunk-O63DJKIJ.js.map +1 -0
- package/dist/{chunk-ECEN724Y.js → chunk-TM5NKZTO.js} +4 -8
- package/dist/{chunk-ECEN724Y.js.map → chunk-TM5NKZTO.js.map} +1 -1
- package/dist/chunk-VUZCLMIX.js +57 -0
- package/dist/chunk-VUZCLMIX.js.map +1 -0
- package/dist/{chunk-OSXIUKD5.js → chunk-WZXVS2EO.js} +1 -6
- package/dist/{chunk-OSXIUKD5.js.map → chunk-WZXVS2EO.js.map} +1 -1
- package/dist/{chunk-ARAOZCZT.js → chunk-XNDHQN4S.js} +122 -24
- package/dist/chunk-XNDHQN4S.js.map +1 -0
- package/dist/cli/init.cjs +1110 -255
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts +86 -1
- package/dist/cli/init.d.ts +86 -1
- package/dist/cli/init.js +277 -66
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/mcp-add.cjs +16 -16
- package/dist/cli/mcp-add.cjs.map +1 -1
- package/dist/cli/mcp-add.js +12 -13
- package/dist/cli/mcp-add.js.map +1 -1
- package/dist/cli/status.cjs +2 -2
- package/dist/cli/status.js +4 -7
- package/dist/cli/status.js.map +1 -1
- package/dist/cli/uninit.cjs +138 -20
- package/dist/cli/uninit.cjs.map +1 -1
- package/dist/cli/uninit.d.cts +38 -8
- package/dist/cli/uninit.d.ts +38 -8
- package/dist/cli/uninit.js +8 -5
- package/dist/cli/validate.cjs +135 -0
- package/dist/cli/validate.cjs.map +1 -0
- package/dist/cli/validate.d.cts +60 -0
- package/dist/cli/validate.d.ts +60 -0
- package/dist/cli/validate.js +100 -0
- package/dist/cli/validate.js.map +1 -0
- package/dist/{esm-MDK7CZID.js → esm-KBPHCVB4.js} +3 -3
- package/dist/{getMachineId-bsd-4NIRBWME.js → getMachineId-bsd-345PYXFX.js} +4 -7
- package/dist/{getMachineId-bsd-4NIRBWME.js.map → getMachineId-bsd-345PYXFX.js.map} +1 -1
- package/dist/{getMachineId-darwin-2XNOCCJQ.js → getMachineId-darwin-5L2D25AD.js} +4 -7
- package/dist/{getMachineId-darwin-2XNOCCJQ.js.map → getMachineId-darwin-5L2D25AD.js.map} +1 -1
- package/dist/{getMachineId-linux-V6YSQEY7.js → getMachineId-linux-KJR4P5HN.js} +3 -6
- package/dist/{getMachineId-linux-V6YSQEY7.js.map → getMachineId-linux-KJR4P5HN.js.map} +1 -1
- package/dist/{getMachineId-unsupported-4FKBJNVO.js → getMachineId-unsupported-NDNXDYDY.js} +3 -6
- package/dist/{getMachineId-unsupported-4FKBJNVO.js.map → getMachineId-unsupported-NDNXDYDY.js.map} +1 -1
- package/dist/{getMachineId-win-WLRZBKVG.js → getMachineId-win-T7PJNJXG.js} +4 -7
- package/dist/{getMachineId-win-WLRZBKVG.js.map → getMachineId-win-T7PJNJXG.js.map} +1 -1
- package/dist/index.cjs +519 -494
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -6
- package/dist/index.d.ts +47 -6
- package/dist/index.js +250 -719
- package/dist/index.js.map +1 -1
- package/dist/{monorepo-YILKGQXQ.js → monorepo-N5Z63XP7.js} +4 -4
- package/dist/{source-map-uploader-3GWUQDTS.js → source-map-uploader-MUZPI2S5.js} +5 -4
- package/dist/source-map-uploader-MUZPI2S5.js.map +1 -0
- package/package.json +6 -4
- package/dist/chunk-2LDBR3F3.js.map +0 -1
- package/dist/chunk-ARAOZCZT.js.map +0 -1
- package/dist/chunk-BGZ7J74D.js.map +0 -1
- package/dist/chunk-UPS5BGER.js +0 -182
- package/dist/chunk-UPS5BGER.js.map +0 -1
- package/dist/chunk-WK7MPK2T.js.map +0 -1
- package/dist/chunk-WV3NIPWJ.js.map +0 -1
- package/dist/chunk-YMEXDDTA.js.map +0 -1
- /package/dist/{esm-MDK7CZID.js.map → chunk-NSBPE2FW.js.map} +0 -0
- /package/dist/{monorepo-YILKGQXQ.js.map → esm-KBPHCVB4.js.map} +0 -0
- /package/dist/{source-map-uploader-3GWUQDTS.js.map → monorepo-N5Z63XP7.js.map} +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/cli/validate.ts
|
|
31
|
+
var validate_exports = {};
|
|
32
|
+
__export(validate_exports, {
|
|
33
|
+
hasGlasstraceImport: () => hasGlasstraceImport,
|
|
34
|
+
hasRegisterGlasstraceImport: () => hasRegisterGlasstraceImport,
|
|
35
|
+
runValidate: () => runValidate
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(validate_exports);
|
|
38
|
+
var fs = __toESM(require("node:fs"), 1);
|
|
39
|
+
var path = __toESM(require("node:path"), 1);
|
|
40
|
+
var MCP_CONFIG_CANDIDATES = [
|
|
41
|
+
".mcp.json",
|
|
42
|
+
".cursor/mcp.json",
|
|
43
|
+
".gemini/settings.json",
|
|
44
|
+
".codex/config.toml"
|
|
45
|
+
];
|
|
46
|
+
function hasGlasstraceImport(content) {
|
|
47
|
+
return /@glasstrace\/sdk/.test(content);
|
|
48
|
+
}
|
|
49
|
+
function hasRegisterGlasstraceImport(content) {
|
|
50
|
+
const match = /import\s*\{([^}]+)\}\s*from\s*["']@glasstrace\/sdk["']/;
|
|
51
|
+
const importMatch = match.exec(content);
|
|
52
|
+
if (!importMatch) return false;
|
|
53
|
+
return importMatch[1].split(",").map((s) => s.trim()).includes("registerGlasstrace");
|
|
54
|
+
}
|
|
55
|
+
function runValidate(options) {
|
|
56
|
+
const { projectRoot } = options;
|
|
57
|
+
const issues = [];
|
|
58
|
+
const glasstraceDir = path.join(projectRoot, ".glasstrace");
|
|
59
|
+
const instrumentationPath = path.join(projectRoot, "instrumentation.ts");
|
|
60
|
+
const markerPath = path.join(glasstraceDir, "mcp-connected");
|
|
61
|
+
const glasstraceDirExists = isDirectorySafe(glasstraceDir);
|
|
62
|
+
const instrumentationExists = fs.existsSync(instrumentationPath);
|
|
63
|
+
const instrumentationContent = instrumentationExists ? safeReadFile(instrumentationPath) : null;
|
|
64
|
+
const markerExists = fs.existsSync(markerPath);
|
|
65
|
+
const mcpConfigsPresent = MCP_CONFIG_CANDIDATES.filter(
|
|
66
|
+
(rel) => fs.existsSync(path.join(projectRoot, rel))
|
|
67
|
+
);
|
|
68
|
+
if (glasstraceDirExists) {
|
|
69
|
+
if (instrumentationContent === null || !hasRegisterGlasstraceImport(instrumentationContent)) {
|
|
70
|
+
issues.push({
|
|
71
|
+
code: "glasstrace-dir-without-register-import",
|
|
72
|
+
message: ".glasstrace/ exists but instrumentation.ts is missing the registerGlasstrace import.",
|
|
73
|
+
fix: "Run `npx glasstrace init` to re-scaffold instrumentation.ts, or remove .glasstrace/ if the SDK is no longer in use."
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (!glasstraceDirExists && instrumentationContent !== null) {
|
|
78
|
+
if (hasGlasstraceImport(instrumentationContent)) {
|
|
79
|
+
issues.push({
|
|
80
|
+
code: "sdk-import-without-glasstrace-dir",
|
|
81
|
+
message: "instrumentation.ts imports from @glasstrace/sdk but .glasstrace/ is missing.",
|
|
82
|
+
fix: "Run `npx glasstrace init` to recreate .glasstrace/, or `npx glasstrace uninit` to fully remove the SDK."
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (markerExists && mcpConfigsPresent.length === 0) {
|
|
87
|
+
issues.push({
|
|
88
|
+
code: "mcp-marker-without-configs",
|
|
89
|
+
message: ".glasstrace/mcp-connected marker is present but no MCP config files were found.",
|
|
90
|
+
fix: "Run `npx glasstrace mcp add --force` to regenerate MCP configs, or delete .glasstrace/mcp-connected."
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (!markerExists && mcpConfigsPresent.length > 0) {
|
|
94
|
+
issues.push({
|
|
95
|
+
code: "mcp-configs-without-marker",
|
|
96
|
+
message: `MCP config files exist (${mcpConfigsPresent.join(", ")}) but .glasstrace/mcp-connected marker is missing.`,
|
|
97
|
+
fix: "Run `npx glasstrace init` to re-register the marker, or `npx glasstrace uninit` to fully remove MCP configuration."
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
const summary = [];
|
|
101
|
+
if (issues.length === 0) {
|
|
102
|
+
summary.push("Glasstrace install state is consistent.");
|
|
103
|
+
} else {
|
|
104
|
+
summary.push(
|
|
105
|
+
`Detected ${issues.length} inconsistenc${issues.length === 1 ? "y" : "ies"} in Glasstrace install state:`
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
exitCode: issues.length > 0 ? 1 : 0,
|
|
110
|
+
summary,
|
|
111
|
+
issues
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function safeReadFile(filePath) {
|
|
115
|
+
try {
|
|
116
|
+
return fs.readFileSync(filePath, "utf-8");
|
|
117
|
+
} catch {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function isDirectorySafe(dirPath) {
|
|
122
|
+
try {
|
|
123
|
+
if (!fs.existsSync(dirPath)) return false;
|
|
124
|
+
return fs.statSync(dirPath).isDirectory();
|
|
125
|
+
} catch {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
130
|
+
0 && (module.exports = {
|
|
131
|
+
hasGlasstraceImport,
|
|
132
|
+
hasRegisterGlasstraceImport,
|
|
133
|
+
runValidate
|
|
134
|
+
});
|
|
135
|
+
//# sourceMappingURL=validate.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/cli/validate.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\n/**\n * A single artifact-state inconsistency detected by `sdk init --validate`.\n */\nexport interface ValidationIssue {\n /** Stable machine-readable identifier for the issue class. */\n code:\n | \"glasstrace-dir-without-register-import\"\n | \"sdk-import-without-glasstrace-dir\"\n | \"mcp-marker-without-configs\"\n | \"mcp-configs-without-marker\";\n /** Human-readable message describing the inconsistency. */\n message: string;\n /** Suggested command or manual action to resolve the issue. */\n fix: string;\n}\n\n/** Options for `runValidate`. */\nexport interface ValidateOptions {\n projectRoot: string;\n}\n\n/** Structured result of running the validator. */\nexport interface ValidateResult {\n /** Zero when no issues; non-zero when any issue is detected. */\n exitCode: number;\n /** Ordered lines of human-friendly summary output. */\n summary: string[];\n /** Detailed per-issue findings. */\n issues: ValidationIssue[];\n}\n\n/** MCP config files init may create. Used to detect stale state. */\nconst MCP_CONFIG_CANDIDATES = [\n \".mcp.json\",\n \".cursor/mcp.json\",\n \".gemini/settings.json\",\n \".codex/config.toml\",\n] as const;\n\n/**\n * Returns true when the given instrumentation file imports\n * `@glasstrace/sdk` (which includes the `registerGlasstrace` import\n * emitted by `sdk init`).\n *\n * @internal Exported for unit testing only.\n */\nexport function hasGlasstraceImport(content: string): boolean {\n return /@glasstrace\\/sdk/.test(content);\n}\n\n/**\n * Returns true when the file imports `registerGlasstrace` specifically\n * (as opposed to other named exports such as `withGlasstraceConfig`).\n *\n * @internal Exported for unit testing only.\n */\nexport function hasRegisterGlasstraceImport(content: string): boolean {\n // Single- or multi-specifier imports from @glasstrace/sdk that include\n // `registerGlasstrace` as a named export.\n const match = /import\\s*\\{([^}]+)\\}\\s*from\\s*[\"']@glasstrace\\/sdk[\"']/;\n const importMatch = match.exec(content);\n if (!importMatch) return false;\n return importMatch[1]\n .split(\",\")\n .map((s) => s.trim())\n .includes(\"registerGlasstrace\");\n}\n\n/**\n * Validates consistency between the filesystem artifacts that `sdk init`\n * produces (DISC-1247 Scenario 4). Detects four classes of inconsistency:\n *\n * 1. `.glasstrace/` exists but `instrumentation.ts` does not import\n * `registerGlasstrace` from `@glasstrace/sdk`.\n * 2. `.glasstrace/` is missing but `instrumentation.ts` still imports\n * from `@glasstrace/sdk`.\n * 3. `.glasstrace/mcp-connected` marker exists but no MCP config files.\n * 4. MCP config files exist but no `.glasstrace/mcp-connected` marker.\n *\n * Each issue includes a stable `code`, a message, and a suggested fix.\n * Exit code is non-zero whenever any issue is detected so CI pipelines\n * can gate on `sdk init --validate`.\n *\n * @param options - Configuration for the validator.\n * @returns A structured result describing detected inconsistencies.\n */\nexport function runValidate(options: ValidateOptions): ValidateResult {\n const { projectRoot } = options;\n const issues: ValidationIssue[] = [];\n\n const glasstraceDir = path.join(projectRoot, \".glasstrace\");\n const instrumentationPath = path.join(projectRoot, \"instrumentation.ts\");\n const markerPath = path.join(glasstraceDir, \"mcp-connected\");\n\n const glasstraceDirExists = isDirectorySafe(glasstraceDir);\n const instrumentationExists = fs.existsSync(instrumentationPath);\n const instrumentationContent = instrumentationExists\n ? safeReadFile(instrumentationPath)\n : null;\n const markerExists = fs.existsSync(markerPath);\n\n const mcpConfigsPresent = MCP_CONFIG_CANDIDATES.filter((rel) =>\n fs.existsSync(path.join(projectRoot, rel)),\n );\n\n // 1. .glasstrace/ present but instrumentation missing the SDK import\n if (glasstraceDirExists) {\n if (\n instrumentationContent === null ||\n !hasRegisterGlasstraceImport(instrumentationContent)\n ) {\n issues.push({\n code: \"glasstrace-dir-without-register-import\",\n message:\n \".glasstrace/ exists but instrumentation.ts is missing the registerGlasstrace import.\",\n fix: \"Run `npx glasstrace init` to re-scaffold instrumentation.ts, or remove .glasstrace/ if the SDK is no longer in use.\",\n });\n }\n }\n\n // 2. .glasstrace/ missing but instrumentation still imports the SDK\n if (!glasstraceDirExists && instrumentationContent !== null) {\n if (hasGlasstraceImport(instrumentationContent)) {\n issues.push({\n code: \"sdk-import-without-glasstrace-dir\",\n message:\n \"instrumentation.ts imports from @glasstrace/sdk but .glasstrace/ is missing.\",\n fix: \"Run `npx glasstrace init` to recreate .glasstrace/, or `npx glasstrace uninit` to fully remove the SDK.\",\n });\n }\n }\n\n // 3. MCP marker present but no MCP config files exist\n if (markerExists && mcpConfigsPresent.length === 0) {\n issues.push({\n code: \"mcp-marker-without-configs\",\n message:\n \".glasstrace/mcp-connected marker is present but no MCP config files were found.\",\n fix: \"Run `npx glasstrace mcp add --force` to regenerate MCP configs, or delete .glasstrace/mcp-connected.\",\n });\n }\n\n // 4. MCP config files exist but no marker\n if (!markerExists && mcpConfigsPresent.length > 0) {\n issues.push({\n code: \"mcp-configs-without-marker\",\n message: `MCP config files exist (${mcpConfigsPresent.join(\", \")}) but .glasstrace/mcp-connected marker is missing.`,\n fix: \"Run `npx glasstrace init` to re-register the marker, or `npx glasstrace uninit` to fully remove MCP configuration.\",\n });\n }\n\n const summary: string[] = [];\n if (issues.length === 0) {\n summary.push(\"Glasstrace install state is consistent.\");\n } else {\n summary.push(\n `Detected ${issues.length} inconsistenc${issues.length === 1 ? \"y\" : \"ies\"} in Glasstrace install state:`,\n );\n }\n\n return {\n exitCode: issues.length > 0 ? 1 : 0,\n summary,\n issues,\n };\n}\n\n/**\n * Reads a file as UTF-8, returning `null` if the file cannot be read.\n */\nfunction safeReadFile(filePath: string): string | null {\n try {\n return fs.readFileSync(filePath, \"utf-8\");\n } catch {\n return null;\n }\n}\n\n/**\n * Returns true when the path exists and is a directory. Returns false\n * when the path is missing, is not a directory, or when `statSync`\n * throws (permission denied, TOCTOU race between existsSync and\n * statSync, etc). Validation is best-effort and must not throw — a\n * crash here would turn a reporting tool into a hard failure.\n */\nfunction isDirectorySafe(dirPath: string): boolean {\n try {\n if (!fs.existsSync(dirPath)) return false;\n return fs.statSync(dirPath).isDirectory();\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,WAAsB;AAkCtB,IAAM,wBAAwB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AASO,SAAS,oBAAoB,SAA0B;AAC5D,SAAO,mBAAmB,KAAK,OAAO;AACxC;AAQO,SAAS,4BAA4B,SAA0B;AAGpE,QAAM,QAAQ;AACd,QAAM,cAAc,MAAM,KAAK,OAAO;AACtC,MAAI,CAAC,YAAa,QAAO;AACzB,SAAO,YAAY,CAAC,EACjB,MAAM,GAAG,EACT,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,SAAS,oBAAoB;AAClC;AAoBO,SAAS,YAAY,SAA0C;AACpE,QAAM,EAAE,YAAY,IAAI;AACxB,QAAM,SAA4B,CAAC;AAEnC,QAAM,gBAAqB,UAAK,aAAa,aAAa;AAC1D,QAAM,sBAA2B,UAAK,aAAa,oBAAoB;AACvE,QAAM,aAAkB,UAAK,eAAe,eAAe;AAE3D,QAAM,sBAAsB,gBAAgB,aAAa;AACzD,QAAM,wBAA2B,cAAW,mBAAmB;AAC/D,QAAM,yBAAyB,wBAC3B,aAAa,mBAAmB,IAChC;AACJ,QAAM,eAAkB,cAAW,UAAU;AAE7C,QAAM,oBAAoB,sBAAsB;AAAA,IAAO,CAAC,QACnD,cAAgB,UAAK,aAAa,GAAG,CAAC;AAAA,EAC3C;AAGA,MAAI,qBAAqB;AACvB,QACE,2BAA2B,QAC3B,CAAC,4BAA4B,sBAAsB,GACnD;AACA,aAAO,KAAK;AAAA,QACV,MAAM;AAAA,QACN,SACE;AAAA,QACF,KAAK;AAAA,MACP,CAAC;AAAA,IACH;AAAA,EACF;AAGA,MAAI,CAAC,uBAAuB,2BAA2B,MAAM;AAC3D,QAAI,oBAAoB,sBAAsB,GAAG;AAC/C,aAAO,KAAK;AAAA,QACV,MAAM;AAAA,QACN,SACE;AAAA,QACF,KAAK;AAAA,MACP,CAAC;AAAA,IACH;AAAA,EACF;AAGA,MAAI,gBAAgB,kBAAkB,WAAW,GAAG;AAClD,WAAO,KAAK;AAAA,MACV,MAAM;AAAA,MACN,SACE;AAAA,MACF,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAGA,MAAI,CAAC,gBAAgB,kBAAkB,SAAS,GAAG;AACjD,WAAO,KAAK;AAAA,MACV,MAAM;AAAA,MACN,SAAS,2BAA2B,kBAAkB,KAAK,IAAI,CAAC;AAAA,MAChE,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,QAAM,UAAoB,CAAC;AAC3B,MAAI,OAAO,WAAW,GAAG;AACvB,YAAQ,KAAK,yCAAyC;AAAA,EACxD,OAAO;AACL,YAAQ;AAAA,MACN,YAAY,OAAO,MAAM,gBAAgB,OAAO,WAAW,IAAI,MAAM,KAAK;AAAA,IAC5E;AAAA,EACF;AAEA,SAAO;AAAA,IACL,UAAU,OAAO,SAAS,IAAI,IAAI;AAAA,IAClC;AAAA,IACA;AAAA,EACF;AACF;AAKA,SAAS,aAAa,UAAiC;AACrD,MAAI;AACF,WAAU,gBAAa,UAAU,OAAO;AAAA,EAC1C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AASA,SAAS,gBAAgB,SAA0B;AACjD,MAAI;AACF,QAAI,CAAI,cAAW,OAAO,EAAG,QAAO;AACpC,WAAU,YAAS,OAAO,EAAE,YAAY;AAAA,EAC1C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single artifact-state inconsistency detected by `sdk init --validate`.
|
|
3
|
+
*/
|
|
4
|
+
interface ValidationIssue {
|
|
5
|
+
/** Stable machine-readable identifier for the issue class. */
|
|
6
|
+
code: "glasstrace-dir-without-register-import" | "sdk-import-without-glasstrace-dir" | "mcp-marker-without-configs" | "mcp-configs-without-marker";
|
|
7
|
+
/** Human-readable message describing the inconsistency. */
|
|
8
|
+
message: string;
|
|
9
|
+
/** Suggested command or manual action to resolve the issue. */
|
|
10
|
+
fix: string;
|
|
11
|
+
}
|
|
12
|
+
/** Options for `runValidate`. */
|
|
13
|
+
interface ValidateOptions {
|
|
14
|
+
projectRoot: string;
|
|
15
|
+
}
|
|
16
|
+
/** Structured result of running the validator. */
|
|
17
|
+
interface ValidateResult {
|
|
18
|
+
/** Zero when no issues; non-zero when any issue is detected. */
|
|
19
|
+
exitCode: number;
|
|
20
|
+
/** Ordered lines of human-friendly summary output. */
|
|
21
|
+
summary: string[];
|
|
22
|
+
/** Detailed per-issue findings. */
|
|
23
|
+
issues: ValidationIssue[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns true when the given instrumentation file imports
|
|
27
|
+
* `@glasstrace/sdk` (which includes the `registerGlasstrace` import
|
|
28
|
+
* emitted by `sdk init`).
|
|
29
|
+
*
|
|
30
|
+
* @internal Exported for unit testing only.
|
|
31
|
+
*/
|
|
32
|
+
declare function hasGlasstraceImport(content: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Returns true when the file imports `registerGlasstrace` specifically
|
|
35
|
+
* (as opposed to other named exports such as `withGlasstraceConfig`).
|
|
36
|
+
*
|
|
37
|
+
* @internal Exported for unit testing only.
|
|
38
|
+
*/
|
|
39
|
+
declare function hasRegisterGlasstraceImport(content: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Validates consistency between the filesystem artifacts that `sdk init`
|
|
42
|
+
* produces (DISC-1247 Scenario 4). Detects four classes of inconsistency:
|
|
43
|
+
*
|
|
44
|
+
* 1. `.glasstrace/` exists but `instrumentation.ts` does not import
|
|
45
|
+
* `registerGlasstrace` from `@glasstrace/sdk`.
|
|
46
|
+
* 2. `.glasstrace/` is missing but `instrumentation.ts` still imports
|
|
47
|
+
* from `@glasstrace/sdk`.
|
|
48
|
+
* 3. `.glasstrace/mcp-connected` marker exists but no MCP config files.
|
|
49
|
+
* 4. MCP config files exist but no `.glasstrace/mcp-connected` marker.
|
|
50
|
+
*
|
|
51
|
+
* Each issue includes a stable `code`, a message, and a suggested fix.
|
|
52
|
+
* Exit code is non-zero whenever any issue is detected so CI pipelines
|
|
53
|
+
* can gate on `sdk init --validate`.
|
|
54
|
+
*
|
|
55
|
+
* @param options - Configuration for the validator.
|
|
56
|
+
* @returns A structured result describing detected inconsistencies.
|
|
57
|
+
*/
|
|
58
|
+
declare function runValidate(options: ValidateOptions): ValidateResult;
|
|
59
|
+
|
|
60
|
+
export { type ValidateOptions, type ValidateResult, type ValidationIssue, hasGlasstraceImport, hasRegisterGlasstraceImport, runValidate };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single artifact-state inconsistency detected by `sdk init --validate`.
|
|
3
|
+
*/
|
|
4
|
+
interface ValidationIssue {
|
|
5
|
+
/** Stable machine-readable identifier for the issue class. */
|
|
6
|
+
code: "glasstrace-dir-without-register-import" | "sdk-import-without-glasstrace-dir" | "mcp-marker-without-configs" | "mcp-configs-without-marker";
|
|
7
|
+
/** Human-readable message describing the inconsistency. */
|
|
8
|
+
message: string;
|
|
9
|
+
/** Suggested command or manual action to resolve the issue. */
|
|
10
|
+
fix: string;
|
|
11
|
+
}
|
|
12
|
+
/** Options for `runValidate`. */
|
|
13
|
+
interface ValidateOptions {
|
|
14
|
+
projectRoot: string;
|
|
15
|
+
}
|
|
16
|
+
/** Structured result of running the validator. */
|
|
17
|
+
interface ValidateResult {
|
|
18
|
+
/** Zero when no issues; non-zero when any issue is detected. */
|
|
19
|
+
exitCode: number;
|
|
20
|
+
/** Ordered lines of human-friendly summary output. */
|
|
21
|
+
summary: string[];
|
|
22
|
+
/** Detailed per-issue findings. */
|
|
23
|
+
issues: ValidationIssue[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns true when the given instrumentation file imports
|
|
27
|
+
* `@glasstrace/sdk` (which includes the `registerGlasstrace` import
|
|
28
|
+
* emitted by `sdk init`).
|
|
29
|
+
*
|
|
30
|
+
* @internal Exported for unit testing only.
|
|
31
|
+
*/
|
|
32
|
+
declare function hasGlasstraceImport(content: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Returns true when the file imports `registerGlasstrace` specifically
|
|
35
|
+
* (as opposed to other named exports such as `withGlasstraceConfig`).
|
|
36
|
+
*
|
|
37
|
+
* @internal Exported for unit testing only.
|
|
38
|
+
*/
|
|
39
|
+
declare function hasRegisterGlasstraceImport(content: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Validates consistency between the filesystem artifacts that `sdk init`
|
|
42
|
+
* produces (DISC-1247 Scenario 4). Detects four classes of inconsistency:
|
|
43
|
+
*
|
|
44
|
+
* 1. `.glasstrace/` exists but `instrumentation.ts` does not import
|
|
45
|
+
* `registerGlasstrace` from `@glasstrace/sdk`.
|
|
46
|
+
* 2. `.glasstrace/` is missing but `instrumentation.ts` still imports
|
|
47
|
+
* from `@glasstrace/sdk`.
|
|
48
|
+
* 3. `.glasstrace/mcp-connected` marker exists but no MCP config files.
|
|
49
|
+
* 4. MCP config files exist but no `.glasstrace/mcp-connected` marker.
|
|
50
|
+
*
|
|
51
|
+
* Each issue includes a stable `code`, a message, and a suggested fix.
|
|
52
|
+
* Exit code is non-zero whenever any issue is detected so CI pipelines
|
|
53
|
+
* can gate on `sdk init --validate`.
|
|
54
|
+
*
|
|
55
|
+
* @param options - Configuration for the validator.
|
|
56
|
+
* @returns A structured result describing detected inconsistencies.
|
|
57
|
+
*/
|
|
58
|
+
declare function runValidate(options: ValidateOptions): ValidateResult;
|
|
59
|
+
|
|
60
|
+
export { type ValidateOptions, type ValidateResult, type ValidationIssue, hasGlasstraceImport, hasRegisterGlasstraceImport, runValidate };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import "../chunk-NSBPE2FW.js";
|
|
2
|
+
|
|
3
|
+
// src/cli/validate.ts
|
|
4
|
+
import * as fs from "node:fs";
|
|
5
|
+
import * as path from "node:path";
|
|
6
|
+
var MCP_CONFIG_CANDIDATES = [
|
|
7
|
+
".mcp.json",
|
|
8
|
+
".cursor/mcp.json",
|
|
9
|
+
".gemini/settings.json",
|
|
10
|
+
".codex/config.toml"
|
|
11
|
+
];
|
|
12
|
+
function hasGlasstraceImport(content) {
|
|
13
|
+
return /@glasstrace\/sdk/.test(content);
|
|
14
|
+
}
|
|
15
|
+
function hasRegisterGlasstraceImport(content) {
|
|
16
|
+
const match = /import\s*\{([^}]+)\}\s*from\s*["']@glasstrace\/sdk["']/;
|
|
17
|
+
const importMatch = match.exec(content);
|
|
18
|
+
if (!importMatch) return false;
|
|
19
|
+
return importMatch[1].split(",").map((s) => s.trim()).includes("registerGlasstrace");
|
|
20
|
+
}
|
|
21
|
+
function runValidate(options) {
|
|
22
|
+
const { projectRoot } = options;
|
|
23
|
+
const issues = [];
|
|
24
|
+
const glasstraceDir = path.join(projectRoot, ".glasstrace");
|
|
25
|
+
const instrumentationPath = path.join(projectRoot, "instrumentation.ts");
|
|
26
|
+
const markerPath = path.join(glasstraceDir, "mcp-connected");
|
|
27
|
+
const glasstraceDirExists = isDirectorySafe(glasstraceDir);
|
|
28
|
+
const instrumentationExists = fs.existsSync(instrumentationPath);
|
|
29
|
+
const instrumentationContent = instrumentationExists ? safeReadFile(instrumentationPath) : null;
|
|
30
|
+
const markerExists = fs.existsSync(markerPath);
|
|
31
|
+
const mcpConfigsPresent = MCP_CONFIG_CANDIDATES.filter(
|
|
32
|
+
(rel) => fs.existsSync(path.join(projectRoot, rel))
|
|
33
|
+
);
|
|
34
|
+
if (glasstraceDirExists) {
|
|
35
|
+
if (instrumentationContent === null || !hasRegisterGlasstraceImport(instrumentationContent)) {
|
|
36
|
+
issues.push({
|
|
37
|
+
code: "glasstrace-dir-without-register-import",
|
|
38
|
+
message: ".glasstrace/ exists but instrumentation.ts is missing the registerGlasstrace import.",
|
|
39
|
+
fix: "Run `npx glasstrace init` to re-scaffold instrumentation.ts, or remove .glasstrace/ if the SDK is no longer in use."
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (!glasstraceDirExists && instrumentationContent !== null) {
|
|
44
|
+
if (hasGlasstraceImport(instrumentationContent)) {
|
|
45
|
+
issues.push({
|
|
46
|
+
code: "sdk-import-without-glasstrace-dir",
|
|
47
|
+
message: "instrumentation.ts imports from @glasstrace/sdk but .glasstrace/ is missing.",
|
|
48
|
+
fix: "Run `npx glasstrace init` to recreate .glasstrace/, or `npx glasstrace uninit` to fully remove the SDK."
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (markerExists && mcpConfigsPresent.length === 0) {
|
|
53
|
+
issues.push({
|
|
54
|
+
code: "mcp-marker-without-configs",
|
|
55
|
+
message: ".glasstrace/mcp-connected marker is present but no MCP config files were found.",
|
|
56
|
+
fix: "Run `npx glasstrace mcp add --force` to regenerate MCP configs, or delete .glasstrace/mcp-connected."
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (!markerExists && mcpConfigsPresent.length > 0) {
|
|
60
|
+
issues.push({
|
|
61
|
+
code: "mcp-configs-without-marker",
|
|
62
|
+
message: `MCP config files exist (${mcpConfigsPresent.join(", ")}) but .glasstrace/mcp-connected marker is missing.`,
|
|
63
|
+
fix: "Run `npx glasstrace init` to re-register the marker, or `npx glasstrace uninit` to fully remove MCP configuration."
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const summary = [];
|
|
67
|
+
if (issues.length === 0) {
|
|
68
|
+
summary.push("Glasstrace install state is consistent.");
|
|
69
|
+
} else {
|
|
70
|
+
summary.push(
|
|
71
|
+
`Detected ${issues.length} inconsistenc${issues.length === 1 ? "y" : "ies"} in Glasstrace install state:`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
exitCode: issues.length > 0 ? 1 : 0,
|
|
76
|
+
summary,
|
|
77
|
+
issues
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function safeReadFile(filePath) {
|
|
81
|
+
try {
|
|
82
|
+
return fs.readFileSync(filePath, "utf-8");
|
|
83
|
+
} catch {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function isDirectorySafe(dirPath) {
|
|
88
|
+
try {
|
|
89
|
+
if (!fs.existsSync(dirPath)) return false;
|
|
90
|
+
return fs.statSync(dirPath).isDirectory();
|
|
91
|
+
} catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
hasGlasstraceImport,
|
|
97
|
+
hasRegisterGlasstraceImport,
|
|
98
|
+
runValidate
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/cli/validate.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\n/**\n * A single artifact-state inconsistency detected by `sdk init --validate`.\n */\nexport interface ValidationIssue {\n /** Stable machine-readable identifier for the issue class. */\n code:\n | \"glasstrace-dir-without-register-import\"\n | \"sdk-import-without-glasstrace-dir\"\n | \"mcp-marker-without-configs\"\n | \"mcp-configs-without-marker\";\n /** Human-readable message describing the inconsistency. */\n message: string;\n /** Suggested command or manual action to resolve the issue. */\n fix: string;\n}\n\n/** Options for `runValidate`. */\nexport interface ValidateOptions {\n projectRoot: string;\n}\n\n/** Structured result of running the validator. */\nexport interface ValidateResult {\n /** Zero when no issues; non-zero when any issue is detected. */\n exitCode: number;\n /** Ordered lines of human-friendly summary output. */\n summary: string[];\n /** Detailed per-issue findings. */\n issues: ValidationIssue[];\n}\n\n/** MCP config files init may create. Used to detect stale state. */\nconst MCP_CONFIG_CANDIDATES = [\n \".mcp.json\",\n \".cursor/mcp.json\",\n \".gemini/settings.json\",\n \".codex/config.toml\",\n] as const;\n\n/**\n * Returns true when the given instrumentation file imports\n * `@glasstrace/sdk` (which includes the `registerGlasstrace` import\n * emitted by `sdk init`).\n *\n * @internal Exported for unit testing only.\n */\nexport function hasGlasstraceImport(content: string): boolean {\n return /@glasstrace\\/sdk/.test(content);\n}\n\n/**\n * Returns true when the file imports `registerGlasstrace` specifically\n * (as opposed to other named exports such as `withGlasstraceConfig`).\n *\n * @internal Exported for unit testing only.\n */\nexport function hasRegisterGlasstraceImport(content: string): boolean {\n // Single- or multi-specifier imports from @glasstrace/sdk that include\n // `registerGlasstrace` as a named export.\n const match = /import\\s*\\{([^}]+)\\}\\s*from\\s*[\"']@glasstrace\\/sdk[\"']/;\n const importMatch = match.exec(content);\n if (!importMatch) return false;\n return importMatch[1]\n .split(\",\")\n .map((s) => s.trim())\n .includes(\"registerGlasstrace\");\n}\n\n/**\n * Validates consistency between the filesystem artifacts that `sdk init`\n * produces (DISC-1247 Scenario 4). Detects four classes of inconsistency:\n *\n * 1. `.glasstrace/` exists but `instrumentation.ts` does not import\n * `registerGlasstrace` from `@glasstrace/sdk`.\n * 2. `.glasstrace/` is missing but `instrumentation.ts` still imports\n * from `@glasstrace/sdk`.\n * 3. `.glasstrace/mcp-connected` marker exists but no MCP config files.\n * 4. MCP config files exist but no `.glasstrace/mcp-connected` marker.\n *\n * Each issue includes a stable `code`, a message, and a suggested fix.\n * Exit code is non-zero whenever any issue is detected so CI pipelines\n * can gate on `sdk init --validate`.\n *\n * @param options - Configuration for the validator.\n * @returns A structured result describing detected inconsistencies.\n */\nexport function runValidate(options: ValidateOptions): ValidateResult {\n const { projectRoot } = options;\n const issues: ValidationIssue[] = [];\n\n const glasstraceDir = path.join(projectRoot, \".glasstrace\");\n const instrumentationPath = path.join(projectRoot, \"instrumentation.ts\");\n const markerPath = path.join(glasstraceDir, \"mcp-connected\");\n\n const glasstraceDirExists = isDirectorySafe(glasstraceDir);\n const instrumentationExists = fs.existsSync(instrumentationPath);\n const instrumentationContent = instrumentationExists\n ? safeReadFile(instrumentationPath)\n : null;\n const markerExists = fs.existsSync(markerPath);\n\n const mcpConfigsPresent = MCP_CONFIG_CANDIDATES.filter((rel) =>\n fs.existsSync(path.join(projectRoot, rel)),\n );\n\n // 1. .glasstrace/ present but instrumentation missing the SDK import\n if (glasstraceDirExists) {\n if (\n instrumentationContent === null ||\n !hasRegisterGlasstraceImport(instrumentationContent)\n ) {\n issues.push({\n code: \"glasstrace-dir-without-register-import\",\n message:\n \".glasstrace/ exists but instrumentation.ts is missing the registerGlasstrace import.\",\n fix: \"Run `npx glasstrace init` to re-scaffold instrumentation.ts, or remove .glasstrace/ if the SDK is no longer in use.\",\n });\n }\n }\n\n // 2. .glasstrace/ missing but instrumentation still imports the SDK\n if (!glasstraceDirExists && instrumentationContent !== null) {\n if (hasGlasstraceImport(instrumentationContent)) {\n issues.push({\n code: \"sdk-import-without-glasstrace-dir\",\n message:\n \"instrumentation.ts imports from @glasstrace/sdk but .glasstrace/ is missing.\",\n fix: \"Run `npx glasstrace init` to recreate .glasstrace/, or `npx glasstrace uninit` to fully remove the SDK.\",\n });\n }\n }\n\n // 3. MCP marker present but no MCP config files exist\n if (markerExists && mcpConfigsPresent.length === 0) {\n issues.push({\n code: \"mcp-marker-without-configs\",\n message:\n \".glasstrace/mcp-connected marker is present but no MCP config files were found.\",\n fix: \"Run `npx glasstrace mcp add --force` to regenerate MCP configs, or delete .glasstrace/mcp-connected.\",\n });\n }\n\n // 4. MCP config files exist but no marker\n if (!markerExists && mcpConfigsPresent.length > 0) {\n issues.push({\n code: \"mcp-configs-without-marker\",\n message: `MCP config files exist (${mcpConfigsPresent.join(\", \")}) but .glasstrace/mcp-connected marker is missing.`,\n fix: \"Run `npx glasstrace init` to re-register the marker, or `npx glasstrace uninit` to fully remove MCP configuration.\",\n });\n }\n\n const summary: string[] = [];\n if (issues.length === 0) {\n summary.push(\"Glasstrace install state is consistent.\");\n } else {\n summary.push(\n `Detected ${issues.length} inconsistenc${issues.length === 1 ? \"y\" : \"ies\"} in Glasstrace install state:`,\n );\n }\n\n return {\n exitCode: issues.length > 0 ? 1 : 0,\n summary,\n issues,\n };\n}\n\n/**\n * Reads a file as UTF-8, returning `null` if the file cannot be read.\n */\nfunction safeReadFile(filePath: string): string | null {\n try {\n return fs.readFileSync(filePath, \"utf-8\");\n } catch {\n return null;\n }\n}\n\n/**\n * Returns true when the path exists and is a directory. Returns false\n * when the path is missing, is not a directory, or when `statSync`\n * throws (permission denied, TOCTOU race between existsSync and\n * statSync, etc). Validation is best-effort and must not throw — a\n * crash here would turn a reporting tool into a hard failure.\n */\nfunction isDirectorySafe(dirPath: string): boolean {\n try {\n if (!fs.existsSync(dirPath)) return false;\n return fs.statSync(dirPath).isDirectory();\n } catch {\n return false;\n }\n}\n"],"mappings":";;;AAAA,YAAY,QAAQ;AACpB,YAAY,UAAU;AAkCtB,IAAM,wBAAwB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AASO,SAAS,oBAAoB,SAA0B;AAC5D,SAAO,mBAAmB,KAAK,OAAO;AACxC;AAQO,SAAS,4BAA4B,SAA0B;AAGpE,QAAM,QAAQ;AACd,QAAM,cAAc,MAAM,KAAK,OAAO;AACtC,MAAI,CAAC,YAAa,QAAO;AACzB,SAAO,YAAY,CAAC,EACjB,MAAM,GAAG,EACT,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,SAAS,oBAAoB;AAClC;AAoBO,SAAS,YAAY,SAA0C;AACpE,QAAM,EAAE,YAAY,IAAI;AACxB,QAAM,SAA4B,CAAC;AAEnC,QAAM,gBAAqB,UAAK,aAAa,aAAa;AAC1D,QAAM,sBAA2B,UAAK,aAAa,oBAAoB;AACvE,QAAM,aAAkB,UAAK,eAAe,eAAe;AAE3D,QAAM,sBAAsB,gBAAgB,aAAa;AACzD,QAAM,wBAA2B,cAAW,mBAAmB;AAC/D,QAAM,yBAAyB,wBAC3B,aAAa,mBAAmB,IAChC;AACJ,QAAM,eAAkB,cAAW,UAAU;AAE7C,QAAM,oBAAoB,sBAAsB;AAAA,IAAO,CAAC,QACnD,cAAgB,UAAK,aAAa,GAAG,CAAC;AAAA,EAC3C;AAGA,MAAI,qBAAqB;AACvB,QACE,2BAA2B,QAC3B,CAAC,4BAA4B,sBAAsB,GACnD;AACA,aAAO,KAAK;AAAA,QACV,MAAM;AAAA,QACN,SACE;AAAA,QACF,KAAK;AAAA,MACP,CAAC;AAAA,IACH;AAAA,EACF;AAGA,MAAI,CAAC,uBAAuB,2BAA2B,MAAM;AAC3D,QAAI,oBAAoB,sBAAsB,GAAG;AAC/C,aAAO,KAAK;AAAA,QACV,MAAM;AAAA,QACN,SACE;AAAA,QACF,KAAK;AAAA,MACP,CAAC;AAAA,IACH;AAAA,EACF;AAGA,MAAI,gBAAgB,kBAAkB,WAAW,GAAG;AAClD,WAAO,KAAK;AAAA,MACV,MAAM;AAAA,MACN,SACE;AAAA,MACF,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAGA,MAAI,CAAC,gBAAgB,kBAAkB,SAAS,GAAG;AACjD,WAAO,KAAK;AAAA,MACV,MAAM;AAAA,MACN,SAAS,2BAA2B,kBAAkB,KAAK,IAAI,CAAC;AAAA,MAChE,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,QAAM,UAAoB,CAAC;AAC3B,MAAI,OAAO,WAAW,GAAG;AACvB,YAAQ,KAAK,yCAAyC;AAAA,EACxD,OAAO;AACL,YAAQ;AAAA,MACN,YAAY,OAAO,MAAM,gBAAgB,OAAO,WAAW,IAAI,MAAM,KAAK;AAAA,IAC5E;AAAA,EACF;AAEA,SAAO;AAAA,IACL,UAAU,OAAO,SAAS,IAAI,IAAI;AAAA,IAClC;AAAA,IACA;AAAA,EACF;AACF;AAKA,SAAS,aAAa,UAAiC;AACrD,MAAI;AACF,WAAU,gBAAa,UAAU,OAAO;AAAA,EAC1C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AASA,SAAS,gBAAgB,SAA0B;AACjD,MAAI;AACF,QAAI,CAAI,cAAW,OAAO,EAAG,QAAO;AACpC,WAAU,YAAS,OAAO,EAAE,YAAY;AAAA,EAC1C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -27,8 +27,8 @@ import {
|
|
|
27
27
|
metrics,
|
|
28
28
|
propagation,
|
|
29
29
|
trace
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import "./chunk-
|
|
30
|
+
} from "./chunk-DQ25VOKK.js";
|
|
31
|
+
import "./chunk-NSBPE2FW.js";
|
|
32
32
|
export {
|
|
33
33
|
DiagConsoleLogger,
|
|
34
34
|
DiagLogLevel,
|
|
@@ -59,4 +59,4 @@ export {
|
|
|
59
59
|
propagation,
|
|
60
60
|
trace
|
|
61
61
|
};
|
|
62
|
-
//# sourceMappingURL=esm-
|
|
62
|
+
//# sourceMappingURL=esm-KBPHCVB4.js.map
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
execAsync
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WZXVS2EO.js";
|
|
4
4
|
import {
|
|
5
5
|
diag
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import
|
|
8
|
-
init_esm_shims
|
|
9
|
-
} from "./chunk-BGZ7J74D.js";
|
|
6
|
+
} from "./chunk-DQ25VOKK.js";
|
|
7
|
+
import "./chunk-NSBPE2FW.js";
|
|
10
8
|
|
|
11
9
|
// ../../node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/getMachineId-bsd.js
|
|
12
|
-
init_esm_shims();
|
|
13
10
|
import { promises as fs } from "fs";
|
|
14
11
|
async function getMachineId() {
|
|
15
12
|
try {
|
|
@@ -29,4 +26,4 @@ async function getMachineId() {
|
|
|
29
26
|
export {
|
|
30
27
|
getMachineId
|
|
31
28
|
};
|
|
32
|
-
//# sourceMappingURL=getMachineId-bsd-
|
|
29
|
+
//# sourceMappingURL=getMachineId-bsd-345PYXFX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-bsd.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { promises as fs } from 'fs';\nimport { execAsync } from './execAsync';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n try {\n const result = await fs.readFile('/etc/hostid', { encoding: 'utf8' });\n return result.trim();\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n try {\n const result = await execAsync('kenv -q smbios.system.uuid');\n return result.stdout.trim();\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n return undefined;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-bsd.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { promises as fs } from 'fs';\nimport { execAsync } from './execAsync';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n try {\n const result = await fs.readFile('/etc/hostid', { encoding: 'utf8' });\n return result.trim();\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n try {\n const result = await execAsync('kenv -q smbios.system.uuid');\n return result.stdout.trim();\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;AAKA,SAAS,YAAY,UAAU;AAI/B,eAAsB,eAAY;AAChC,MAAI;AACF,UAAM,SAAS,MAAM,GAAG,SAAS,eAAe,EAAE,UAAU,OAAM,CAAE;AACpE,WAAO,OAAO,KAAI;WACX,GAAG;AACV,SAAK,MAAM,6BAA6B,CAAC,EAAE;;AAG7C,MAAI;AACF,UAAM,SAAS,MAAM,UAAU,4BAA4B;AAC3D,WAAO,OAAO,OAAO,KAAI;WAClB,GAAG;AACV,SAAK,MAAM,6BAA6B,CAAC,EAAE;;AAG7C,SAAO;AACT;","names":[]}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
execAsync
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WZXVS2EO.js";
|
|
4
4
|
import {
|
|
5
5
|
diag
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import
|
|
8
|
-
init_esm_shims
|
|
9
|
-
} from "./chunk-BGZ7J74D.js";
|
|
6
|
+
} from "./chunk-DQ25VOKK.js";
|
|
7
|
+
import "./chunk-NSBPE2FW.js";
|
|
10
8
|
|
|
11
9
|
// ../../node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/getMachineId-darwin.js
|
|
12
|
-
init_esm_shims();
|
|
13
10
|
async function getMachineId() {
|
|
14
11
|
try {
|
|
15
12
|
const result = await execAsync('ioreg -rd1 -c "IOPlatformExpertDevice"');
|
|
@@ -29,4 +26,4 @@ async function getMachineId() {
|
|
|
29
26
|
export {
|
|
30
27
|
getMachineId
|
|
31
28
|
};
|
|
32
|
-
//# sourceMappingURL=getMachineId-darwin-
|
|
29
|
+
//# sourceMappingURL=getMachineId-darwin-5L2D25AD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-darwin.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { execAsync } from './execAsync';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n try {\n const result = await execAsync('ioreg -rd1 -c \"IOPlatformExpertDevice\"');\n\n const idLine = result.stdout\n .split('\\n')\n .find(line => line.includes('IOPlatformUUID'));\n\n if (!idLine) {\n return undefined;\n }\n\n const parts = idLine.split('\" = \"');\n if (parts.length === 2) {\n return parts[1].slice(0, -1);\n }\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n return undefined;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-darwin.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { execAsync } from './execAsync';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n try {\n const result = await execAsync('ioreg -rd1 -c \"IOPlatformExpertDevice\"');\n\n const idLine = result.stdout\n .split('\\n')\n .find(line => line.includes('IOPlatformUUID'));\n\n if (!idLine) {\n return undefined;\n }\n\n const parts = idLine.split('\" = \"');\n if (parts.length === 2) {\n return parts[1].slice(0, -1);\n }\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;AAQA,eAAsB,eAAY;AAChC,MAAI;AACF,UAAM,SAAS,MAAM,UAAU,wCAAwC;AAEvE,UAAM,SAAS,OAAO,OACnB,MAAM,IAAI,EACV,KAAK,UAAQ,KAAK,SAAS,gBAAgB,CAAC;AAE/C,QAAI,CAAC,QAAQ;AACX,aAAO;;AAGT,UAAM,QAAQ,OAAO,MAAM,OAAO;AAClC,QAAI,MAAM,WAAW,GAAG;AACtB,aAAO,MAAM,CAAC,EAAE,MAAM,GAAG,EAAE;;WAEtB,GAAG;AACV,SAAK,MAAM,6BAA6B,CAAC,EAAE;;AAG7C,SAAO;AACT;","names":[]}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
diag
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import
|
|
5
|
-
init_esm_shims
|
|
6
|
-
} from "./chunk-BGZ7J74D.js";
|
|
3
|
+
} from "./chunk-DQ25VOKK.js";
|
|
4
|
+
import "./chunk-NSBPE2FW.js";
|
|
7
5
|
|
|
8
6
|
// ../../node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/getMachineId-linux.js
|
|
9
|
-
init_esm_shims();
|
|
10
7
|
import { promises as fs } from "fs";
|
|
11
8
|
async function getMachineId() {
|
|
12
9
|
const paths = ["/etc/machine-id", "/var/lib/dbus/machine-id"];
|
|
@@ -23,4 +20,4 @@ async function getMachineId() {
|
|
|
23
20
|
export {
|
|
24
21
|
getMachineId
|
|
25
22
|
};
|
|
26
|
-
//# sourceMappingURL=getMachineId-linux-
|
|
23
|
+
//# sourceMappingURL=getMachineId-linux-KJR4P5HN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-linux.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { promises as fs } from 'fs';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n const paths = ['/etc/machine-id', '/var/lib/dbus/machine-id'];\n\n for (const path of paths) {\n try {\n const result = await fs.readFile(path, { encoding: 'utf8' });\n return result.trim();\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n }\n\n return undefined;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-linux.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { promises as fs } from 'fs';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n const paths = ['/etc/machine-id', '/var/lib/dbus/machine-id'];\n\n for (const path of paths) {\n try {\n const result = await fs.readFile(path, { encoding: 'utf8' });\n return result.trim();\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;AAIA,SAAS,YAAY,UAAU;AAG/B,eAAsB,eAAY;AAChC,QAAM,QAAQ,CAAC,mBAAmB,0BAA0B;AAE5D,aAAW,QAAQ,OAAO;AACxB,QAAI;AACF,YAAM,SAAS,MAAM,GAAG,SAAS,MAAM,EAAE,UAAU,OAAM,CAAE;AAC3D,aAAO,OAAO,KAAI;aACX,GAAG;AACV,WAAK,MAAM,6BAA6B,CAAC,EAAE;;;AAI/C,SAAO;AACT;","names":[]}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
diag
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import
|
|
5
|
-
init_esm_shims
|
|
6
|
-
} from "./chunk-BGZ7J74D.js";
|
|
3
|
+
} from "./chunk-DQ25VOKK.js";
|
|
4
|
+
import "./chunk-NSBPE2FW.js";
|
|
7
5
|
|
|
8
6
|
// ../../node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/getMachineId-unsupported.js
|
|
9
|
-
init_esm_shims();
|
|
10
7
|
async function getMachineId() {
|
|
11
8
|
diag.debug("could not read machine-id: unsupported platform");
|
|
12
9
|
return void 0;
|
|
@@ -14,4 +11,4 @@ async function getMachineId() {
|
|
|
14
11
|
export {
|
|
15
12
|
getMachineId
|
|
16
13
|
};
|
|
17
|
-
//# sourceMappingURL=getMachineId-unsupported-
|
|
14
|
+
//# sourceMappingURL=getMachineId-unsupported-NDNXDYDY.js.map
|
package/dist/{getMachineId-unsupported-4FKBJNVO.js.map → getMachineId-unsupported-NDNXDYDY.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-unsupported.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n diag.debug('could not read machine-id: unsupported platform');\n return undefined;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-unsupported.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n diag.debug('could not read machine-id: unsupported platform');\n return undefined;\n}\n"],"mappings":";;;;;;AAOA,eAAsB,eAAY;AAChC,OAAK,MAAM,iDAAiD;AAC5D,SAAO;AACT;","names":[]}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
execAsync
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WZXVS2EO.js";
|
|
4
4
|
import {
|
|
5
5
|
diag
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import
|
|
8
|
-
init_esm_shims
|
|
9
|
-
} from "./chunk-BGZ7J74D.js";
|
|
6
|
+
} from "./chunk-DQ25VOKK.js";
|
|
7
|
+
import "./chunk-NSBPE2FW.js";
|
|
10
8
|
|
|
11
9
|
// ../../node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/getMachineId-win.js
|
|
12
|
-
init_esm_shims();
|
|
13
10
|
import * as process from "process";
|
|
14
11
|
async function getMachineId() {
|
|
15
12
|
const args = "QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid";
|
|
@@ -31,4 +28,4 @@ async function getMachineId() {
|
|
|
31
28
|
export {
|
|
32
29
|
getMachineId
|
|
33
30
|
};
|
|
34
|
-
//# sourceMappingURL=getMachineId-win-
|
|
31
|
+
//# sourceMappingURL=getMachineId-win-T7PJNJXG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-win.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as process from 'process';\nimport { execAsync } from './execAsync';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n const args =\n 'QUERY HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Cryptography /v MachineGuid';\n let command = '%windir%\\\\System32\\\\REG.exe';\n if (process.arch === 'ia32' && 'PROCESSOR_ARCHITEW6432' in process.env) {\n command = '%windir%\\\\sysnative\\\\cmd.exe /c ' + command;\n }\n\n try {\n const result = await execAsync(`${command} ${args}`);\n const parts = result.stdout.split('REG_SZ');\n if (parts.length === 2) {\n return parts[1].trim();\n }\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n return undefined;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-win.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as process from 'process';\nimport { execAsync } from './execAsync';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n const args =\n 'QUERY HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Cryptography /v MachineGuid';\n let command = '%windir%\\\\System32\\\\REG.exe';\n if (process.arch === 'ia32' && 'PROCESSOR_ARCHITEW6432' in process.env) {\n command = '%windir%\\\\sysnative\\\\cmd.exe /c ' + command;\n }\n\n try {\n const result = await execAsync(`${command} ${args}`);\n const parts = result.stdout.split('REG_SZ');\n if (parts.length === 2) {\n return parts[1].trim();\n }\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;AAKA,YAAY,aAAa;AAIzB,eAAsB,eAAY;AAChC,QAAM,OACJ;AACF,MAAI,UAAU;AACd,MAAY,iBAAS,UAAU,4BAAoC,aAAK;AACtE,cAAU,qCAAqC;;AAGjD,MAAI;AACF,UAAM,SAAS,MAAM,UAAU,GAAG,OAAO,IAAI,IAAI,EAAE;AACnD,UAAM,QAAQ,OAAO,OAAO,MAAM,QAAQ;AAC1C,QAAI,MAAM,WAAW,GAAG;AACtB,aAAO,MAAM,CAAC,EAAE,KAAI;;WAEf,GAAG;AACV,SAAK,MAAM,6BAA6B,CAAC,EAAE;;AAG7C,SAAO;AACT;","names":[]}
|