@glasstrace/sdk 1.6.1 → 1.7.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 CHANGED
@@ -83,7 +83,7 @@ init-hang cannot leave your installation in a broken state.
83
83
  | Exit code | Meaning |
84
84
  |-----------|---------|
85
85
  | `0` | Scaffolding succeeded AND the server confirmed the anon key. |
86
- | `1` | Scaffolding failed. No verification attempted. |
86
+ | `1` | Scaffolding failed, OR the static-discovery file at `public/.well-known/glasstrace.json` could not be written. The browser extension cannot discover the project until that file is written; rerun `glasstrace init` after fixing the underlying error (most commonly: the static root is missing or read-only). |
87
87
  | `2` | Scaffolding succeeded but server verification failed. Safe to re-run. |
88
88
 
89
89
  On a non-zero verification exit, the error message distinguishes three
@@ -98,6 +98,18 @@ total cap). HTTP 4xx/5xx and malformed responses are surfaced
98
98
  immediately. Set `GLASSTRACE_SKIP_INIT_VERIFY=1` to skip verification
99
99
  for offline installs.
100
100
 
101
+ ## Getting help
102
+
103
+ ```bash
104
+ glasstrace --help # or: glasstrace -h
105
+ glasstrace init --help # same; help short-circuits subcommand routing
106
+ ```
107
+
108
+ Help invocations print the command list and exit cleanly without
109
+ modifying the project. Help is detected anywhere in the argv slice,
110
+ including composite invocations like `glasstrace init --yes --help`
111
+ (the `--yes` is ignored — the user asked for help).
112
+
101
113
  ## Refreshing agent instruction guidance
102
114
 
103
115
  `glasstrace init` and `glasstrace mcp add` write a managed Glasstrace
@@ -4616,11 +4616,11 @@ function registerGlasstrace(options) {
4616
4616
  setCoreState(CoreState.REGISTERING);
4617
4617
  maybeWarnStaleAgentInstructions({
4618
4618
  projectRoot: process.cwd(),
4619
- sdkVersion: "1.6.1"
4619
+ sdkVersion: "1.7.0"
4620
4620
  });
4621
4621
  startRuntimeStateWriter({
4622
4622
  projectRoot: process.cwd(),
4623
- sdkVersion: "1.6.1"
4623
+ sdkVersion: "1.7.0"
4624
4624
  });
4625
4625
  const config = resolveConfig(options);
4626
4626
  if (config.verbose) {
@@ -4787,8 +4787,8 @@ async function backgroundInit(config, anonKeyForInit, generation) {
4787
4787
  if (config.verbose) {
4788
4788
  console.info("[glasstrace] Background init firing.");
4789
4789
  }
4790
- const healthReport = collectHealthReport("1.6.1");
4791
- const initResult = await performInit(config, anonKeyForInit, "1.6.1", healthReport);
4790
+ const healthReport = collectHealthReport("1.7.0");
4791
+ const initResult = await performInit(config, anonKeyForInit, "1.7.0", healthReport);
4792
4792
  if (generation !== registrationGeneration) return;
4793
4793
  const currentState = getCoreState();
4794
4794
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -4811,7 +4811,7 @@ async function backgroundInit(config, anonKeyForInit, generation) {
4811
4811
  }
4812
4812
  maybeInstallConsoleCapture();
4813
4813
  if (didLastInitSucceed()) {
4814
- startHeartbeat(config, anonKeyForInit, "1.6.1", generation, (newApiKey, accountId) => {
4814
+ startHeartbeat(config, anonKeyForInit, "1.7.0", generation, (newApiKey, accountId) => {
4815
4815
  setAuthState(AuthState.CLAIMING);
4816
4816
  emitLifecycleEvent("auth:claim_started", { accountId });
4817
4817
  setResolvedApiKey(newApiKey);
@@ -5211,4 +5211,4 @@ export {
5211
5211
  withGlasstraceConfig,
5212
5212
  captureError
5213
5213
  };
5214
- //# sourceMappingURL=chunk-SYNQJZZY.js.map
5214
+ //# sourceMappingURL=chunk-OWPA7GHV.js.map
package/dist/cli/init.cjs CHANGED
@@ -16994,7 +16994,7 @@ async function mcpAdd(options) {
16994
16994
  const bearer = resolved.effective.key;
16995
16995
  for (const agent of targetAgents) {
16996
16996
  const name = formatAgentName(agent.name);
16997
- const sdkVersion = true ? "1.6.1" : "0.0.0-dev";
16997
+ const sdkVersion = true ? "1.7.0" : "0.0.0-dev";
16998
16998
  if (agent.name !== "generic") {
16999
16999
  const cliSuccess = await registerViaCli(agent, bearer);
17000
17000
  if (cliSuccess) {
@@ -17262,7 +17262,7 @@ async function runUpgradeInstructions(options) {
17262
17262
  );
17263
17263
  return { exitCode: 1, refreshed, skipped, warnings, errors };
17264
17264
  }
17265
- const sdkVersion = true ? "1.6.1" : "0.0.0-dev";
17265
+ const sdkVersion = true ? "1.7.0" : "0.0.0-dev";
17266
17266
  for (const agent of agents) {
17267
17267
  if (agent.infoFilePath === null) {
17268
17268
  continue;
@@ -17517,6 +17517,7 @@ var init_exports = {};
17517
17517
  __export(init_exports, {
17518
17518
  decideMcpConfigAction: () => decideMcpConfigAction,
17519
17519
  gitignoreExcludesDiscoveryFile: () => gitignoreExcludesDiscoveryFile,
17520
+ isHelpInvocation: () => isHelpInvocation,
17520
17521
  meetsNodeVersion: () => meetsNodeVersion,
17521
17522
  rollbackSteps: () => rollbackSteps,
17522
17523
  runInit: () => runInit,
@@ -18625,6 +18626,7 @@ async function runInit(options) {
18625
18626
  const summary = [];
18626
18627
  const warnings = [];
18627
18628
  const errors = [];
18629
+ let discoveryFileWriteFailed = false;
18628
18630
  let projectRoot;
18629
18631
  try {
18630
18632
  const classification = resolveProjectRoot(options.projectRoot);
@@ -18801,6 +18803,7 @@ Then add this as the first statement in your register() function:
18801
18803
  warnings.push(
18802
18804
  `Failed to write ${relPath}${discoveryResult.error !== void 0 ? `: ${discoveryResult.error}` : ""}. The Glasstrace browser extension cannot discover this project until the file is written; rerun \`glasstrace init\` after fixing the underlying error.`
18803
18805
  );
18806
+ discoveryFileWriteFailed = true;
18804
18807
  break;
18805
18808
  }
18806
18809
  const gitignorePath = path9.join(projectRoot, ".gitignore");
@@ -18821,6 +18824,7 @@ Then add this as the first statement in your register() function:
18821
18824
  resolveStaticRoot(projectRoot).layout
18822
18825
  )}: ${err instanceof Error ? err.message : String(err)}`
18823
18826
  );
18827
+ discoveryFileWriteFailed = true;
18824
18828
  }
18825
18829
  let anyConfigWritten = false;
18826
18830
  let anyConfigRewrittenWithBearer = false;
@@ -18898,7 +18902,7 @@ Then add this as the first statement in your register() function:
18898
18902
  }
18899
18903
  anyConfigWritten = true;
18900
18904
  anyConfigRewrittenWithBearer = true;
18901
- const sdkVersionForInject = true ? "1.6.1" : "0.0.0-dev";
18905
+ const sdkVersionForInject = true ? "1.7.0" : "0.0.0-dev";
18902
18906
  const infoContent = generateInfoSection(
18903
18907
  agent,
18904
18908
  MCP_ENDPOINT,
@@ -18980,6 +18984,9 @@ Then add this as the first statement in your register() function:
18980
18984
  summary.push("Skipped anon key verification (no anon key on disk)");
18981
18985
  }
18982
18986
  }
18987
+ if (discoveryFileWriteFailed) {
18988
+ return { exitCode: 1, summary, warnings, errors };
18989
+ }
18983
18990
  return { exitCode: 0, summary, warnings, errors };
18984
18991
  }
18985
18992
  async function verifyAnonKeyRegistration(projectRoot) {
@@ -19001,7 +19008,7 @@ async function verifyAnonKeyRegistration(projectRoot) {
19001
19008
  }
19002
19009
  const baseConfig = resolveConfig({ apiKey: devKey });
19003
19010
  const config2 = { ...baseConfig, apiKey: devKey };
19004
- const sdkVersion = true ? "1.6.1" : "0.0.0-dev";
19011
+ const sdkVersion = true ? "1.7.0" : "0.0.0-dev";
19005
19012
  const result = await verifyInitReachable(config2, anonKey, sdkVersion);
19006
19013
  if (result.ok) {
19007
19014
  return { outcome: "verified" };
@@ -19051,7 +19058,11 @@ function parseArgs(argv) {
19051
19058
  }
19052
19059
  var scriptPath = typeof process !== "undefined" && process.argv[1] !== void 0 ? process.argv[1].replace(/\\/g, "/") : void 0;
19053
19060
  var scriptBasename = scriptPath !== void 0 ? path9.basename(scriptPath) : void 0;
19054
- var isDirectExecution = scriptPath !== void 0 && (scriptPath.endsWith("/cli/init.js") || scriptPath.endsWith("/cli/init.ts") || scriptBasename === "glasstrace");
19061
+ var isDirectExecution = scriptPath !== void 0 && (scriptPath.endsWith("/cli/init.js") || scriptPath.endsWith("/cli/init.cjs") || scriptPath.endsWith("/cli/init.ts") || scriptBasename === "glasstrace");
19062
+ function isHelpInvocation(argv) {
19063
+ return argv.some((arg) => arg === "--help" || arg === "-h");
19064
+ }
19065
+ var HELP_TEXT = "glasstrace \u2014 Glasstrace SDK CLI\n\nUsage:\n glasstrace init [--yes] [--coverage-map] [--force] [--validate]\n glasstrace uninit [--dry-run] [--force]\n glasstrace status [--json]\n glasstrace mcp add [--force] [--dry-run]\n glasstrace upgrade-instructions\n\nRun a command without arguments to see its defaults.\nDocs: https://glasstrace.dev/docs/cli\n";
19055
19066
  if (isDirectExecution) {
19056
19067
  if (!meetsNodeVersion(20)) {
19057
19068
  process.stderr.write(
@@ -19060,6 +19071,10 @@ if (isDirectExecution) {
19060
19071
  );
19061
19072
  process.exit(1);
19062
19073
  }
19074
+ if (isHelpInvocation(process.argv.slice(2))) {
19075
+ process.stdout.write(HELP_TEXT);
19076
+ process.exit(0);
19077
+ }
19063
19078
  const subcommand = process.argv[2];
19064
19079
  if (subcommand === "mcp") {
19065
19080
  if (process.argv[3] === "add") {
@@ -19302,6 +19317,7 @@ Usage:
19302
19317
  0 && (module.exports = {
19303
19318
  decideMcpConfigAction,
19304
19319
  gitignoreExcludesDiscoveryFile,
19320
+ isHelpInvocation,
19305
19321
  meetsNodeVersion,
19306
19322
  rollbackSteps,
19307
19323
  runInit,