hanzi-browse 2.2.2 → 2.2.3

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/cli/setup.js CHANGED
@@ -14,6 +14,7 @@ import { randomUUID } from 'crypto';
14
14
  import { isRelayRunning } from '../relay/auto-start.js';
15
15
  import { WebSocketClient } from '../ipc/websocket-client.js';
16
16
  import { detectCredentialSources as detectSources, checkCredentialFlowResult, } from './detect-credentials.js';
17
+ import { initTelemetry, trackEvent, shutdownTelemetry } from '../telemetry.js';
17
18
  // ── Style ──────────────────────────────────────────────────────────────
18
19
  const c = {
19
20
  green: (s) => `\x1b[32m${s}\x1b[0m`,
@@ -695,6 +696,8 @@ async function installSkills(agents, isInteractive) {
695
696
  }
696
697
  // ── Main ───────────────────────────────────────────────────────────────
697
698
  export async function runSetup(options = {}) {
699
+ initTelemetry();
700
+ trackEvent("setup_started");
698
701
  const registry = getAgentRegistry();
699
702
  const only = options.only;
700
703
  const interactive = options.yes ? false : (process.stdin.isTTY ?? false);
@@ -746,8 +749,10 @@ export async function runSetup(options = {}) {
746
749
  for (const agent of registry) {
747
750
  if (only && agent.slug !== only)
748
751
  continue;
749
- if (agent.detect())
752
+ if (agent.detect()) {
750
753
  detected.push(agent);
754
+ trackEvent("setup_agent_detected", { agent: agent.name });
755
+ }
751
756
  }
752
757
  sp1.stop(interactive
753
758
  ? `${c.green('✓')} Found ${c.bold(String(detected.length))} agent${detected.length === 1 ? '' : 's'} on this machine`
@@ -780,6 +785,8 @@ export async function runSetup(options = {}) {
780
785
  else {
781
786
  log(` ● No agents found. Add manually: ${JSON.stringify({ mcpServers: { "hanzi-browser": MCP_ENTRY } })}`);
782
787
  }
788
+ trackEvent("setup_failed", { error_category: "no_agents_detected" });
789
+ await shutdownTelemetry();
783
790
  return;
784
791
  }
785
792
  // ── Step 2: Configure agents ──
@@ -910,6 +917,8 @@ export async function runSetup(options = {}) {
910
917
  log(` ${errors} agent(s) failed — check errors above.`);
911
918
  log('');
912
919
  }
920
+ trackEvent("setup_completed", { agent: detected.map(a => a.name).join(", ") });
921
+ await shutdownTelemetry();
913
922
  rl?.close();
914
923
  setTimeout(() => process.exit(0), 200);
915
924
  }