@glasstrace/sdk 1.4.0 → 1.5.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.
Files changed (43) hide show
  1. package/README.md +56 -0
  2. package/dist/{chunk-JZ475QRH.js → chunk-D3QXU2VM.js} +22 -191
  3. package/dist/chunk-D3QXU2VM.js.map +1 -0
  4. package/dist/{chunk-VQDYXXVS.js → chunk-N3XIVM2U.js} +154 -8
  5. package/dist/chunk-N3XIVM2U.js.map +1 -0
  6. package/dist/{chunk-VJQIFY33.js → chunk-YLY7AGLC.js} +7 -4
  7. package/dist/chunk-YLY7AGLC.js.map +1 -0
  8. package/dist/chunk-ZBQQXVHD.js +208 -0
  9. package/dist/chunk-ZBQQXVHD.js.map +1 -0
  10. package/dist/cli/init.cjs +206 -34
  11. package/dist/cli/init.cjs.map +1 -1
  12. package/dist/cli/init.js +65 -8
  13. package/dist/cli/init.js.map +1 -1
  14. package/dist/cli/mcp-add.cjs +45 -25
  15. package/dist/cli/mcp-add.cjs.map +1 -1
  16. package/dist/cli/mcp-add.js +10 -7
  17. package/dist/cli/mcp-add.js.map +1 -1
  18. package/dist/cli/status.cjs +33 -3
  19. package/dist/cli/status.cjs.map +1 -1
  20. package/dist/cli/status.js +12 -3
  21. package/dist/cli/status.js.map +1 -1
  22. package/dist/cli/uninit.cjs +27 -3
  23. package/dist/cli/uninit.cjs.map +1 -1
  24. package/dist/cli/uninit.d.cts +10 -2
  25. package/dist/cli/uninit.d.ts +10 -2
  26. package/dist/cli/uninit.js +2 -1
  27. package/dist/cli/upgrade-instructions.cjs +440 -0
  28. package/dist/cli/upgrade-instructions.cjs.map +1 -0
  29. package/dist/cli/upgrade-instructions.d.cts +48 -0
  30. package/dist/cli/upgrade-instructions.d.ts +48 -0
  31. package/dist/cli/upgrade-instructions.js +80 -0
  32. package/dist/cli/upgrade-instructions.js.map +1 -0
  33. package/dist/index.cjs +229 -60
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.js +2 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/node-entry.cjs +237 -68
  38. package/dist/node-entry.cjs.map +1 -1
  39. package/dist/node-entry.js +2 -1
  40. package/package.json +1 -1
  41. package/dist/chunk-JZ475QRH.js.map +0 -1
  42. package/dist/chunk-VJQIFY33.js.map +0 -1
  43. package/dist/chunk-VQDYXXVS.js.map +0 -1
package/dist/cli/init.js CHANGED
@@ -21,15 +21,12 @@ import {
21
21
  unwrapCJSExport,
22
22
  unwrapExport,
23
23
  writeDiscoveryFile
24
- } from "../chunk-VJQIFY33.js";
24
+ } from "../chunk-YLY7AGLC.js";
25
25
  import {
26
26
  detectAgents,
27
27
  generateInfoSection,
28
- generateMcpConfig,
29
- injectInfoSection,
30
- updateGitignore,
31
- writeMcpConfig
32
- } from "../chunk-JZ475QRH.js";
28
+ generateMcpConfig
29
+ } from "../chunk-D3QXU2VM.js";
33
30
  import {
34
31
  MCP_ENDPOINT,
35
32
  getOrCreateAnonKey,
@@ -46,6 +43,11 @@ import {
46
43
  NEXT_CONFIG_NAMES,
47
44
  formatAgentName
48
45
  } from "../chunk-NB7GJE4S.js";
46
+ import {
47
+ injectInfoSection,
48
+ updateGitignore,
49
+ writeMcpConfig
50
+ } from "../chunk-ZBQQXVHD.js";
49
51
  import "../chunk-NSBPE2FW.js";
50
52
 
51
53
  // src/cli/init.ts
@@ -896,7 +898,12 @@ Then add this as the first statement in your register() function:
896
898
  }
897
899
  anyConfigWritten = true;
898
900
  anyConfigRewrittenWithBearer = true;
899
- const infoContent = generateInfoSection(agent, MCP_ENDPOINT);
901
+ const sdkVersionForInject = true ? "1.5.0" : "0.0.0-dev";
902
+ const infoContent = generateInfoSection(
903
+ agent,
904
+ MCP_ENDPOINT,
905
+ sdkVersionForInject
906
+ );
900
907
  if (infoContent !== "") {
901
908
  await injectInfoSection(agent, infoContent, projectRoot);
902
909
  }
@@ -994,7 +1001,7 @@ async function verifyAnonKeyRegistration(projectRoot) {
994
1001
  }
995
1002
  const baseConfig = resolveConfig({ apiKey: devKey });
996
1003
  const config = { ...baseConfig, apiKey: devKey };
997
- const sdkVersion = true ? "1.4.0" : "0.0.0-dev";
1004
+ const sdkVersion = true ? "1.5.0" : "0.0.0-dev";
998
1005
  const result = await verifyInitReachable(config, anonKey, sdkVersion);
999
1006
  if (result.ok) {
1000
1007
  return { outcome: "verified" };
@@ -1183,6 +1190,55 @@ Usage: glasstrace mcp add [--force] [--dry-run]
1183
1190
  }).catch((err) => {
1184
1191
  process.stderr.write(
1185
1192
  `Fatal error: ${err instanceof Error ? err.message : String(err)}
1193
+ `
1194
+ );
1195
+ process.exit(1);
1196
+ });
1197
+ } else if (subcommand === "upgrade-instructions") {
1198
+ Promise.all([
1199
+ import("./upgrade-instructions.js"),
1200
+ import("../monorepo-PFVNPQ6X.js")
1201
+ ]).then(([{ runUpgradeInstructions }, { resolveProjectRoot: resolve }]) => {
1202
+ let projectRoot = process.cwd();
1203
+ try {
1204
+ projectRoot = resolve(projectRoot).projectRoot;
1205
+ } catch {
1206
+ }
1207
+ return runUpgradeInstructions({ projectRoot });
1208
+ }).then((result) => {
1209
+ for (const err of result.errors) {
1210
+ process.stderr.write(`Error: ${err}
1211
+ `);
1212
+ }
1213
+ for (const warn of result.warnings) {
1214
+ process.stderr.write(`Warning: ${warn}
1215
+ `);
1216
+ }
1217
+ if (result.refreshed.length > 0) {
1218
+ process.stderr.write("\nRefreshed agent instruction files:\n");
1219
+ for (const file of result.refreshed) {
1220
+ process.stderr.write(` - ${file}
1221
+ `);
1222
+ }
1223
+ }
1224
+ if (result.skipped.length > 0) {
1225
+ process.stderr.write(
1226
+ "\nSkipped (no Glasstrace managed section present):\n"
1227
+ );
1228
+ for (const file of result.skipped) {
1229
+ process.stderr.write(` - ${file}
1230
+ `);
1231
+ }
1232
+ }
1233
+ if (result.refreshed.length === 0 && result.skipped.length === 0 && result.errors.length === 0) {
1234
+ process.stderr.write(
1235
+ "\nNo agent instruction files detected with a Glasstrace managed section. Run `npx glasstrace init` or `npx glasstrace mcp add` to install one.\n"
1236
+ );
1237
+ }
1238
+ process.exit(result.exitCode);
1239
+ }).catch((err) => {
1240
+ process.stderr.write(
1241
+ `Fatal error: ${err instanceof Error ? err.message : String(err)}
1186
1242
  `
1187
1243
  );
1188
1244
  process.exit(1);
@@ -1236,6 +1292,7 @@ Usage:
1236
1292
  glasstrace uninit [--dry-run] [--force]
1237
1293
  glasstrace status [--json]
1238
1294
  glasstrace mcp add [--force] [--dry-run]
1295
+ glasstrace upgrade-instructions
1239
1296
  `
1240
1297
  );
1241
1298
  process.exit(1);