@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
package/dist/cli/init.d.cts
CHANGED
|
@@ -9,6 +9,14 @@ interface InitOptions {
|
|
|
9
9
|
projectRoot: string;
|
|
10
10
|
yes: boolean;
|
|
11
11
|
coverageMap: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* When true, skip interactive confirmation and overwrite existing
|
|
14
|
+
* MCP configuration files without prompting. Preservation of the
|
|
15
|
+
* anonymous key, config cache, and developer API key still applies
|
|
16
|
+
* regardless of this flag — `--force` only affects the MCP diff
|
|
17
|
+
* prompt (DISC-1247 Scenario 2c). Defaults to `false`.
|
|
18
|
+
*/
|
|
19
|
+
force?: boolean;
|
|
12
20
|
}
|
|
13
21
|
/** Result of running the init command. */
|
|
14
22
|
interface InitResult {
|
|
@@ -17,6 +25,30 @@ interface InitResult {
|
|
|
17
25
|
warnings: string[];
|
|
18
26
|
errors: string[];
|
|
19
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Decides whether the MCP config at `configPath` should be overwritten
|
|
30
|
+
* during re-init. Returns the action to take.
|
|
31
|
+
*
|
|
32
|
+
* - `"write"` — file does not exist, or existing content already matches
|
|
33
|
+
* the expected content. Safe to write.
|
|
34
|
+
* - `"skip"` — existing file differs AND the user chose to keep it, or
|
|
35
|
+
* we are in a non-interactive environment without `--force`.
|
|
36
|
+
* - `"force-overwrite"` — `force === true` (or user accepted the prompt)
|
|
37
|
+
* and content differs; overwrite.
|
|
38
|
+
*
|
|
39
|
+
* The prompt is skipped entirely when `force` is true (non-interactive
|
|
40
|
+
* overwrite) or when there is no existing file / content already matches.
|
|
41
|
+
*
|
|
42
|
+
* @internal Exported for unit testing only.
|
|
43
|
+
*/
|
|
44
|
+
declare function decideMcpConfigAction(options: {
|
|
45
|
+
configPath: string | null;
|
|
46
|
+
expectedContent: string;
|
|
47
|
+
force: boolean;
|
|
48
|
+
readFile?: (p: string) => string;
|
|
49
|
+
existsSync?: (p: string) => boolean;
|
|
50
|
+
prompt?: (question: string, defaultValue: boolean) => Promise<boolean>;
|
|
51
|
+
}): Promise<"write" | "skip" | "force-overwrite">;
|
|
20
52
|
/**
|
|
21
53
|
* Identifies a scaffolding step that can be reversed during rollback.
|
|
22
54
|
* Steps are tracked in execution order and rolled back in reverse.
|
|
@@ -29,6 +61,15 @@ type CompletedStep = "instrumentation" | "next-config" | "env-local" | "gitignor
|
|
|
29
61
|
*/
|
|
30
62
|
interface RollbackState {
|
|
31
63
|
steps: CompletedStep[];
|
|
64
|
+
/**
|
|
65
|
+
* Absolute path of the instrumentation file that the scaffolder
|
|
66
|
+
* wrote to. May be either `{root}/instrumentation.ts` or
|
|
67
|
+
* `{root}/src/instrumentation.ts` depending on the project layout
|
|
68
|
+
* (DISC-493 Issue 1). When absent, rollback falls back to the
|
|
69
|
+
* root path for backward compatibility with callers that do not
|
|
70
|
+
* populate this field.
|
|
71
|
+
*/
|
|
72
|
+
instrumentationPath?: string;
|
|
32
73
|
/** Original instrumentation.ts content saved before injection.
|
|
33
74
|
* When present, rollback restores this instead of using removeRegisterGlasstrace. */
|
|
34
75
|
originalInstrumentationContent?: string;
|
|
@@ -46,5 +87,49 @@ declare function rollbackSteps(steps: CompletedStep[], projectRoot: string, stat
|
|
|
46
87
|
* bottom calls this function and translates the result to process.exit().
|
|
47
88
|
*/
|
|
48
89
|
declare function runInit(options: InitOptions): Promise<InitResult>;
|
|
90
|
+
/**
|
|
91
|
+
* Outcome of {@link verifyAnonKeyRegistration}:
|
|
92
|
+
*
|
|
93
|
+
* - `"verified"` — the server registered the anon key (HTTP 2xx with a
|
|
94
|
+
* schema-valid response body).
|
|
95
|
+
* - `"skipped"` — no anon key was on disk, so no verification request
|
|
96
|
+
* was sent. Typically means MCP auto-configuration failed earlier
|
|
97
|
+
* (warnings were already emitted) — distinct from a verification
|
|
98
|
+
* success.
|
|
99
|
+
* - `"failed"` — the verification request was sent and failed.
|
|
100
|
+
* `error` is a user-facing message distinguishing the failure class
|
|
101
|
+
* (`fetch failed: ...`, `server rejected the key ...`, or
|
|
102
|
+
* `server returned malformed response ...`) with no anon key bytes.
|
|
103
|
+
*/
|
|
104
|
+
type VerifyAnonKeyOutcome = {
|
|
105
|
+
outcome: "verified";
|
|
106
|
+
} | {
|
|
107
|
+
outcome: "skipped";
|
|
108
|
+
} | {
|
|
109
|
+
outcome: "failed";
|
|
110
|
+
error: string;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Verifies that the anonymous key written by init is registered
|
|
114
|
+
* server-side. Called at the end of the scaffold flow so that when it
|
|
115
|
+
* fails, the user sees an actionable error rather than a misleading
|
|
116
|
+
* "initialized successfully" followed by silent MCP authentication
|
|
117
|
+
* failures (DISC-494).
|
|
118
|
+
*
|
|
119
|
+
* Returns a discriminated outcome so the CLI can distinguish a genuine
|
|
120
|
+
* verification pass from the "no anon key on disk" skip case. On
|
|
121
|
+
* failure the error message distinguishes three classes:
|
|
122
|
+
* - "fetch failed" — transport error (DNS, TCP, TLS, timeout)
|
|
123
|
+
* - "server rejected the key" — HTTP 4xx/5xx
|
|
124
|
+
* - "server returned malformed response" — HTTP 2xx with unparseable
|
|
125
|
+
* body
|
|
126
|
+
*
|
|
127
|
+
* The anon key is NEVER included in the returned message. Callers
|
|
128
|
+
* (the CLI entry point) render it verbatim to stderr via the errors
|
|
129
|
+
* array and exit non-zero.
|
|
130
|
+
*
|
|
131
|
+
* @internal Exported for testability.
|
|
132
|
+
*/
|
|
133
|
+
declare function verifyAnonKeyRegistration(projectRoot: string): Promise<VerifyAnonKeyOutcome>;
|
|
49
134
|
|
|
50
|
-
export { type InitOptions, type InitResult, meetsNodeVersion, rollbackSteps, runInit };
|
|
135
|
+
export { type InitOptions, type InitResult, type VerifyAnonKeyOutcome, decideMcpConfigAction, meetsNodeVersion, rollbackSteps, runInit, verifyAnonKeyRegistration };
|
package/dist/cli/init.d.ts
CHANGED
|
@@ -9,6 +9,14 @@ interface InitOptions {
|
|
|
9
9
|
projectRoot: string;
|
|
10
10
|
yes: boolean;
|
|
11
11
|
coverageMap: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* When true, skip interactive confirmation and overwrite existing
|
|
14
|
+
* MCP configuration files without prompting. Preservation of the
|
|
15
|
+
* anonymous key, config cache, and developer API key still applies
|
|
16
|
+
* regardless of this flag — `--force` only affects the MCP diff
|
|
17
|
+
* prompt (DISC-1247 Scenario 2c). Defaults to `false`.
|
|
18
|
+
*/
|
|
19
|
+
force?: boolean;
|
|
12
20
|
}
|
|
13
21
|
/** Result of running the init command. */
|
|
14
22
|
interface InitResult {
|
|
@@ -17,6 +25,30 @@ interface InitResult {
|
|
|
17
25
|
warnings: string[];
|
|
18
26
|
errors: string[];
|
|
19
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Decides whether the MCP config at `configPath` should be overwritten
|
|
30
|
+
* during re-init. Returns the action to take.
|
|
31
|
+
*
|
|
32
|
+
* - `"write"` — file does not exist, or existing content already matches
|
|
33
|
+
* the expected content. Safe to write.
|
|
34
|
+
* - `"skip"` — existing file differs AND the user chose to keep it, or
|
|
35
|
+
* we are in a non-interactive environment without `--force`.
|
|
36
|
+
* - `"force-overwrite"` — `force === true` (or user accepted the prompt)
|
|
37
|
+
* and content differs; overwrite.
|
|
38
|
+
*
|
|
39
|
+
* The prompt is skipped entirely when `force` is true (non-interactive
|
|
40
|
+
* overwrite) or when there is no existing file / content already matches.
|
|
41
|
+
*
|
|
42
|
+
* @internal Exported for unit testing only.
|
|
43
|
+
*/
|
|
44
|
+
declare function decideMcpConfigAction(options: {
|
|
45
|
+
configPath: string | null;
|
|
46
|
+
expectedContent: string;
|
|
47
|
+
force: boolean;
|
|
48
|
+
readFile?: (p: string) => string;
|
|
49
|
+
existsSync?: (p: string) => boolean;
|
|
50
|
+
prompt?: (question: string, defaultValue: boolean) => Promise<boolean>;
|
|
51
|
+
}): Promise<"write" | "skip" | "force-overwrite">;
|
|
20
52
|
/**
|
|
21
53
|
* Identifies a scaffolding step that can be reversed during rollback.
|
|
22
54
|
* Steps are tracked in execution order and rolled back in reverse.
|
|
@@ -29,6 +61,15 @@ type CompletedStep = "instrumentation" | "next-config" | "env-local" | "gitignor
|
|
|
29
61
|
*/
|
|
30
62
|
interface RollbackState {
|
|
31
63
|
steps: CompletedStep[];
|
|
64
|
+
/**
|
|
65
|
+
* Absolute path of the instrumentation file that the scaffolder
|
|
66
|
+
* wrote to. May be either `{root}/instrumentation.ts` or
|
|
67
|
+
* `{root}/src/instrumentation.ts` depending on the project layout
|
|
68
|
+
* (DISC-493 Issue 1). When absent, rollback falls back to the
|
|
69
|
+
* root path for backward compatibility with callers that do not
|
|
70
|
+
* populate this field.
|
|
71
|
+
*/
|
|
72
|
+
instrumentationPath?: string;
|
|
32
73
|
/** Original instrumentation.ts content saved before injection.
|
|
33
74
|
* When present, rollback restores this instead of using removeRegisterGlasstrace. */
|
|
34
75
|
originalInstrumentationContent?: string;
|
|
@@ -46,5 +87,49 @@ declare function rollbackSteps(steps: CompletedStep[], projectRoot: string, stat
|
|
|
46
87
|
* bottom calls this function and translates the result to process.exit().
|
|
47
88
|
*/
|
|
48
89
|
declare function runInit(options: InitOptions): Promise<InitResult>;
|
|
90
|
+
/**
|
|
91
|
+
* Outcome of {@link verifyAnonKeyRegistration}:
|
|
92
|
+
*
|
|
93
|
+
* - `"verified"` — the server registered the anon key (HTTP 2xx with a
|
|
94
|
+
* schema-valid response body).
|
|
95
|
+
* - `"skipped"` — no anon key was on disk, so no verification request
|
|
96
|
+
* was sent. Typically means MCP auto-configuration failed earlier
|
|
97
|
+
* (warnings were already emitted) — distinct from a verification
|
|
98
|
+
* success.
|
|
99
|
+
* - `"failed"` — the verification request was sent and failed.
|
|
100
|
+
* `error` is a user-facing message distinguishing the failure class
|
|
101
|
+
* (`fetch failed: ...`, `server rejected the key ...`, or
|
|
102
|
+
* `server returned malformed response ...`) with no anon key bytes.
|
|
103
|
+
*/
|
|
104
|
+
type VerifyAnonKeyOutcome = {
|
|
105
|
+
outcome: "verified";
|
|
106
|
+
} | {
|
|
107
|
+
outcome: "skipped";
|
|
108
|
+
} | {
|
|
109
|
+
outcome: "failed";
|
|
110
|
+
error: string;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Verifies that the anonymous key written by init is registered
|
|
114
|
+
* server-side. Called at the end of the scaffold flow so that when it
|
|
115
|
+
* fails, the user sees an actionable error rather than a misleading
|
|
116
|
+
* "initialized successfully" followed by silent MCP authentication
|
|
117
|
+
* failures (DISC-494).
|
|
118
|
+
*
|
|
119
|
+
* Returns a discriminated outcome so the CLI can distinguish a genuine
|
|
120
|
+
* verification pass from the "no anon key on disk" skip case. On
|
|
121
|
+
* failure the error message distinguishes three classes:
|
|
122
|
+
* - "fetch failed" — transport error (DNS, TCP, TLS, timeout)
|
|
123
|
+
* - "server rejected the key" — HTTP 4xx/5xx
|
|
124
|
+
* - "server returned malformed response" — HTTP 2xx with unparseable
|
|
125
|
+
* body
|
|
126
|
+
*
|
|
127
|
+
* The anon key is NEVER included in the returned message. Callers
|
|
128
|
+
* (the CLI entry point) render it verbatim to stderr via the errors
|
|
129
|
+
* array and exit non-zero.
|
|
130
|
+
*
|
|
131
|
+
* @internal Exported for testability.
|
|
132
|
+
*/
|
|
133
|
+
declare function verifyAnonKeyRegistration(projectRoot: string): Promise<VerifyAnonKeyOutcome>;
|
|
49
134
|
|
|
50
|
-
export { type InitOptions, type InitResult, meetsNodeVersion, rollbackSteps, runInit };
|
|
135
|
+
export { type InitOptions, type InitResult, type VerifyAnonKeyOutcome, decideMcpConfigAction, meetsNodeVersion, rollbackSteps, runInit, verifyAnonKeyRegistration };
|