agent-react-devtools 0.4.0-canary-20260402222730 → 0.4.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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # agent-react-devtools
2
2
 
3
- ## 0.4.0-canary-20260402222730
3
+ ## 0.4.0
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -35,6 +35,24 @@
35
35
  - **`--sort duration`**: Sort commits by render duration (slowest first) instead of chronological order.
36
36
  - **Paginated header**: Output shows `Commit timeline (showing 1–20 of 87):` when paginated, or `Commit timeline (87 commits):` when all results fit on one page.
37
37
 
38
+ - a1bed65: Smart tree truncation and subtree extraction for large component trees
39
+
40
+ Large React apps (500-2000+ components) now produce much smaller `get tree` output:
41
+
42
+ - **Host filtering by default**: `<div>`, `<span>`, and other host components are hidden (use `--all` to show them). Host components with keys or custom element names are always shown.
43
+ - **Sibling collapsing**: When a parent has many children with the same display name (e.g. list items), only the first 3 are shown with a `... +N more ComponentName` summary.
44
+ - **Summary footer**: Output ends with `N components shown (M total)` so the agent knows how much was filtered.
45
+ - **`--max-lines N` flag**: Hard cap on output lines to stay within context budgets.
46
+ - **Subtree extraction**: `get tree @c5` shows only the subtree rooted at a specific component. Labels are re-assigned starting from `@c1` within the subtree. Combine with `--depth N` to limit depth within the subtree.
47
+
48
+ - c7127db: Add `uninit` command to reverse framework configuration
49
+
50
+ `agent-react-devtools uninit` removes the changes made by `init` — restoring your config files to their original state.
51
+
52
+ - Supports all frameworks: Vite, Next.js (Pages Router and App Router), CRA
53
+ - `--dry-run` flag previews what would be removed without writing any files
54
+ - Safe to run on projects not configured by `init` (no-op)
55
+
38
56
  ### Patch Changes
39
57
 
40
58
  - 68bd0fc: Auto-restart daemon when CLI detects the binary has been rebuilt since the daemon started. Previously, rebuilding the package required manually stopping and restarting the daemon for changes to take effect.
package/README.md CHANGED
@@ -52,8 +52,25 @@ agent-react-devtools get tree --depth 3
52
52
  ├─ @c5 [fn] TodoList
53
53
  │ ├─ @c6 [fn] TodoItem key=1
54
54
  │ ├─ @c7 [fn] TodoItem key=2
55
- └─ @c8 [fn] TodoItem key=3
55
+ ├─ @c8 [fn] TodoItem key=3
56
+ │ └─ ... +47 more TodoItem
56
57
  └─ @c9 [fn] Footer
58
+ 53 components shown (1,843 total)
59
+ ```
60
+
61
+ Host components (`<div>`, `<span>`, etc.) are filtered by default to keep output compact. Use `--all` to include them. Host components with keys or custom element names (e.g. `<my-widget>`) are always shown.
62
+
63
+ View a subtree rooted at a specific component:
64
+
65
+ ```sh
66
+ agent-react-devtools get tree @c5 --depth 2
67
+ ```
68
+
69
+ ```
70
+ @c1 [fn] TodoList
71
+ ├─ @c2 [fn] TodoItem key=1
72
+ ├─ @c3 [fn] TodoItem key=2
73
+ └─ @c4 [fn] TodoItem key=3
57
74
  ```
58
75
 
59
76
  Inspect a component's props, state, and hooks:
@@ -115,13 +132,18 @@ agent-react-devtools status # Connection status
115
132
  ### Components
116
133
 
117
134
  ```sh
118
- agent-react-devtools get tree [--depth N] # Component hierarchy
135
+ agent-react-devtools get tree [@c1 | id] [--depth N] [--all] [--max-lines N] # Component hierarchy (subtree)
119
136
  agent-react-devtools get component <@c1 | id> # Props, state, hooks
120
137
  agent-react-devtools find <name> [--exact] # Search by display name
121
138
  agent-react-devtools count # Component count by type
122
139
  agent-react-devtools errors # Components with errors/warnings
123
140
  ```
124
141
 
142
+ Tree output flags:
143
+ - `--depth N` — limit tree depth
144
+ - `--all` — include host components (filtered by default)
145
+ - `--max-lines N` — hard cap on output lines
146
+
125
147
  Components are labeled `@c1`, `@c2`, etc. You can use these labels or numeric IDs interchangeably.
126
148
 
127
149
  Components with errors or warnings are annotated in tree and search output:
@@ -178,6 +200,12 @@ npx agent-react-devtools init
178
200
 
179
201
  This detects your framework (Vite, Next.js, CRA) and patches the appropriate config file.
180
202
 
203
+ To undo these changes:
204
+
205
+ ```sh
206
+ npx agent-react-devtools uninit
207
+ ```
208
+
181
209
  ### One-line import
182
210
 
183
211
  Add a single import as the first line of your entry point (e.g. `src/main.tsx`):
@@ -244,7 +272,7 @@ agent-react-devtools status # Should show "Apps: 1 connected"
244
272
  Add the skill to your AI coding assistant for richer context:
245
273
 
246
274
  ```sh
247
- npx skills add piotrski/agent-react-devtools
275
+ npx skills add callstackincubator/agent-react-devtools
248
276
  ```
249
277
 
250
278
  This works with Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Goose, OpenCode, and Windsurf.
@@ -254,7 +282,7 @@ This works with Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Goose, O
254
282
  You can also install via the Claude Code plugin marketplace:
255
283
 
256
284
  ```
257
- /plugin marketplace add piotrski/agent-react-devtools
285
+ /plugin marketplace add callstackincubator/agent-react-devtools
258
286
  /plugin install agent-react-devtools@piotrski
259
287
  ```
260
288
 
@@ -276,6 +304,7 @@ This project uses agent-react-devtools to inspect the running React app.
276
304
  - `agent-react-devtools start` — start the daemon
277
305
  - `agent-react-devtools status` — check if the app is connected
278
306
  - `agent-react-devtools get tree` — see the component hierarchy
307
+ - `agent-react-devtools get tree @c5` — see subtree from a specific component
279
308
  - `agent-react-devtools get component @c1` — inspect a specific component
280
309
  - `agent-react-devtools find <Name>` — search for components
281
310
  - `agent-react-devtools errors` — list components with errors or warnings
package/dist/cli.js CHANGED
@@ -164,12 +164,17 @@ var PIPE = "\u2502 ";
164
164
  var TEE = "\u251C\u2500 ";
165
165
  var ELBOW = "\u2514\u2500 ";
166
166
  var SPACE = " ";
167
- function formatTree(nodes, hint) {
167
+ var COLLAPSE_THRESHOLD = 3;
168
+ function formatTree(nodes, hintOrOpts) {
169
+ const opts = typeof hintOrOpts === "string" ? { hint: hintOrOpts } : hintOrOpts || {};
170
+ const { hint, totalCount, maxLines } = opts;
168
171
  if (nodes.length === 0) {
169
172
  return hint ? `No components (${hint})` : "No components (is a React app connected?)";
170
173
  }
171
174
  const childrenMap = /* @__PURE__ */ new Map();
175
+ const nodeMap = /* @__PURE__ */ new Map();
172
176
  for (const node of nodes) {
177
+ nodeMap.set(node.id, node);
173
178
  const parentId = node.parentId;
174
179
  let siblings = childrenMap.get(parentId);
175
180
  if (!siblings) {
@@ -179,21 +184,72 @@ function formatTree(nodes, hint) {
179
184
  siblings.push(node);
180
185
  }
181
186
  const lines = [];
187
+ let truncated = false;
188
+ const lineLimit = maxLines !== void 0 ? maxLines - (totalCount !== void 0 ? 1 : 0) : Infinity;
189
+ function addLine(line) {
190
+ if (lines.length >= lineLimit) {
191
+ truncated = true;
192
+ return false;
193
+ }
194
+ lines.push(line);
195
+ return true;
196
+ }
182
197
  function walk(nodeId, prefix, isLast, isRoot) {
183
- const node = nodes.find((n) => n.id === nodeId);
184
- if (!node) return;
198
+ const node = nodeMap.get(nodeId);
199
+ if (!node) return true;
185
200
  const connector = isRoot ? "" : isLast ? ELBOW : TEE;
186
201
  const line = formatRef({ label: node.label, type: node.type, name: node.displayName, key: node.key, errors: node.errors, warnings: node.warnings });
187
- lines.push(`${prefix}${connector}${line}`);
202
+ if (!addLine(`${prefix}${connector}${line}`)) return false;
188
203
  const children = childrenMap.get(node.id) || [];
189
204
  const childPrefix = isRoot ? "" : prefix + (isLast ? SPACE : PIPE);
190
- for (let i = 0; i < children.length; i++) {
191
- walk(children[i].id, childPrefix, i === children.length - 1, false);
205
+ let i = 0;
206
+ while (i < children.length) {
207
+ let runEnd = i + 1;
208
+ while (runEnd < children.length && children[runEnd].displayName === children[i].displayName) {
209
+ runEnd++;
210
+ }
211
+ const runLen = runEnd - i;
212
+ if (runLen > COLLAPSE_THRESHOLD) {
213
+ for (let j = 0; j < COLLAPSE_THRESHOLD; j++) {
214
+ if (!walk(children[i + j].id, childPrefix, false, false)) return false;
215
+ }
216
+ const remaining = runLen - COLLAPSE_THRESHOLD;
217
+ const isLastGroup = runEnd === children.length;
218
+ const summaryConnector = isLastGroup ? ELBOW : TEE;
219
+ if (!addLine(`${childPrefix}${summaryConnector}... +${remaining} more ${children[i].displayName}`)) return false;
220
+ i = runEnd;
221
+ } else {
222
+ for (let j = i; j < runEnd; j++) {
223
+ const isLastChild = j === children.length - 1;
224
+ if (!walk(children[j].id, childPrefix, isLastChild, false)) return false;
225
+ }
226
+ i = runEnd;
227
+ }
192
228
  }
229
+ return true;
193
230
  }
194
231
  const roots = childrenMap.get(null) || [];
195
232
  for (let i = 0; i < roots.length; i++) {
196
- walk(roots[i].id, "", i === roots.length - 1, true);
233
+ if (!walk(roots[i].id, "", i === roots.length - 1, true)) break;
234
+ }
235
+ if (truncated) {
236
+ if (totalCount !== void 0) {
237
+ lines.push(`... output truncated at ${maxLines} lines (${totalCount.toLocaleString()} total components)`);
238
+ } else {
239
+ if (lines.length > 0) {
240
+ lines[lines.length - 1] = `... output truncated at ${maxLines} lines`;
241
+ } else {
242
+ lines.push(`... output truncated at ${maxLines} lines`);
243
+ }
244
+ }
245
+ } else if (totalCount !== void 0) {
246
+ const shown = nodes.length;
247
+ const totalFormatted = totalCount.toLocaleString();
248
+ if (shown < totalCount) {
249
+ lines.push(`${shown} components shown (${totalFormatted} total)`);
250
+ } else {
251
+ lines.push(`${totalFormatted} components`);
252
+ }
197
253
  }
198
254
  return lines.join("\n");
199
255
  }
@@ -472,6 +528,7 @@ function usage() {
472
528
 
473
529
  Setup:
474
530
  init [--dry-run] Auto-configure your React app
531
+ uninit [--dry-run] Remove configuration added by init
475
532
 
476
533
  Daemon:
477
534
  start [--port 8097] Start daemon
@@ -479,7 +536,7 @@ Daemon:
479
536
  status Show daemon status
480
537
 
481
538
  Components:
482
- get tree [--depth N] Component hierarchy
539
+ get tree [@c1 | id] [--depth N] [--all] [--max-lines N] Component hierarchy
483
540
  get component <@c1 | id> Props, state, hooks
484
541
  find <name> [--exact] Search by display name
485
542
  count Component count by type
@@ -548,10 +605,15 @@ async function main() {
548
605
  const cmd1 = command[1];
549
606
  try {
550
607
  if (cmd0 === "init") {
551
- const { runInit } = await import("./init-7IJ2VXT7.js");
608
+ const { runInit } = await import("./init-TDSG2Z3U.js");
552
609
  await runInit(process.cwd(), flags["dry-run"] === true);
553
610
  return;
554
611
  }
612
+ if (cmd0 === "uninit") {
613
+ const { runUninit } = await import("./init-TDSG2Z3U.js");
614
+ await runUninit(process.cwd(), flags["dry-run"] === true);
615
+ return;
616
+ }
555
617
  if (cmd0 === "profile" && cmd1 === "diff") {
556
618
  const fileA = command[2];
557
619
  const fileB = command[3];
@@ -617,10 +679,22 @@ async function main() {
617
679
  await ensureDaemon();
618
680
  if (cmd0 === "get" && cmd1 === "tree") {
619
681
  const depth = parseNumericFlag(flags, "depth");
620
- const ipcCmd = { type: "get-tree", depth };
682
+ const maxLines = parseNumericFlag(flags, "max-lines");
683
+ const noHost = flags["all"] !== true;
684
+ const rawRoot = command[2];
685
+ let root;
686
+ if (rawRoot) {
687
+ root = rawRoot.startsWith("@") ? rawRoot : parseInt(rawRoot, 10);
688
+ if (typeof root === "number" && isNaN(root)) {
689
+ console.error("Usage: devtools get tree [@c1 | id] [--depth N] [--all] [--max-lines N]");
690
+ process.exit(1);
691
+ }
692
+ }
693
+ const ipcCmd = { type: "get-tree", depth, noHost, maxLines, root };
621
694
  const resp = await sendCommand(ipcCmd);
622
695
  if (resp.ok) {
623
- console.log(formatTree(resp.data, resp.hint));
696
+ const { nodes, totalCount } = resp.data;
697
+ console.log(formatTree(nodes, { hint: resp.hint, totalCount, maxLines }));
624
698
  } else {
625
699
  console.error(resp.error);
626
700
  process.exit(1);
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/daemon-client.ts","../src/formatters.ts","../src/cli.ts"],"sourcesContent":["import net from 'node:net';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { spawn } from 'node:child_process';\nimport type { IpcCommand, IpcResponse, DaemonInfo } from './types.js';\n\nconst DEFAULT_STATE_DIR = path.join(\n process.env.HOME || process.env.USERPROFILE || '/tmp',\n '.agent-react-devtools',\n);\n\nlet stateDir = DEFAULT_STATE_DIR;\n\nexport function setStateDir(dir: string): void {\n stateDir = dir;\n}\n\nfunction getDaemonInfoPath(): string {\n return path.join(stateDir, 'daemon.json');\n}\n\nfunction getSocketPath(): string {\n return path.join(stateDir, 'daemon.sock');\n}\n\nexport function readDaemonInfo(): DaemonInfo | null {\n try {\n const raw = fs.readFileSync(getDaemonInfoPath(), 'utf-8');\n return JSON.parse(raw) as DaemonInfo;\n } catch {\n return null;\n }\n}\n\nfunction isDaemonAlive(info: DaemonInfo): boolean {\n try {\n // Signal 0 doesn't kill, just checks if process exists\n process.kill(info.pid, 0);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function ensureDaemon(port?: number): Promise<void> {\n const info = readDaemonInfo();\n if (info && isDaemonAlive(info)) {\n const daemonScript = path.join(\n path.dirname(new URL(import.meta.url).pathname),\n 'daemon.js',\n );\n try {\n const stat = fs.statSync(daemonScript);\n const stale = info.buildMtime !== undefined\n ? stat.mtimeMs !== info.buildMtime\n : stat.mtimeMs > info.startedAt;\n if (stale) {\n port = port ?? info.port;\n stopDaemon();\n } else {\n return;\n }\n } catch {\n return;\n }\n }\n\n // Clean up stale files\n try {\n fs.unlinkSync(getDaemonInfoPath());\n } catch {\n // ignore\n }\n try {\n fs.unlinkSync(getSocketPath());\n } catch {\n // ignore\n }\n\n // Start daemon as detached child process\n const daemonScript = path.join(\n path.dirname(new URL(import.meta.url).pathname),\n 'daemon.js',\n );\n\n const args = [];\n if (port) args.push(`--port=${port}`);\n if (stateDir !== DEFAULT_STATE_DIR) args.push(`--state-dir=${stateDir}`);\n\n const child = spawn(process.execPath, [daemonScript, ...args], {\n detached: true,\n stdio: 'ignore',\n });\n child.unref();\n\n // Wait for daemon to be ready (up to 5 seconds)\n const deadline = Date.now() + 5000;\n while (Date.now() < deadline) {\n await new Promise((r) => setTimeout(r, 100));\n try {\n await sendCommand({ type: 'ping' });\n return;\n } catch {\n // not ready yet\n }\n }\n throw new Error('Daemon failed to start within 5 seconds');\n}\n\nexport function stopDaemon(): boolean {\n const info = readDaemonInfo();\n if (!info) return false;\n\n try {\n process.kill(info.pid, 'SIGTERM');\n // Clean up files\n try {\n fs.unlinkSync(getDaemonInfoPath());\n } catch {\n // ignore\n }\n return true;\n } catch {\n return false;\n }\n}\n\nexport function sendCommand(cmd: IpcCommand, socketTimeout = 30_000): Promise<IpcResponse> {\n return new Promise((resolve, reject) => {\n const socketPath = getSocketPath();\n\n const conn = net.createConnection(socketPath, () => {\n conn.write(JSON.stringify(cmd) + '\\n');\n });\n\n let buffer = '';\n conn.on('data', (chunk) => {\n buffer += chunk.toString();\n const newlineIdx = buffer.indexOf('\\n');\n if (newlineIdx !== -1) {\n const line = buffer.slice(0, newlineIdx);\n conn.end();\n try {\n resolve(JSON.parse(line) as IpcResponse);\n } catch {\n reject(new Error('Invalid response from daemon'));\n }\n }\n });\n\n conn.on('error', (err) => {\n reject(new Error(`Cannot connect to daemon: ${err.message}`));\n });\n\n conn.setTimeout(socketTimeout, () => {\n conn.destroy();\n reject(new Error('Command timed out'));\n });\n });\n}\n","import type {\n StatusInfo,\n InspectedElement,\n ComponentRenderReport,\n ChangedKeys,\n} from './types.js';\nimport type { TreeNode } from './component-tree.js';\nimport type { ProfileSummary, TimelineResult, CommitDetail } from './profiler.js';\nimport type { ProfileDiffResult, DiffEntry } from './profile-diff.js';\n\n// ── Abbreviations for component types ──\nconst TYPE_ABBREV: Record<string, string> = {\n function: 'fn',\n class: 'cls',\n host: 'host',\n memo: 'memo',\n forwardRef: 'fRef',\n profiler: 'prof',\n suspense: 'susp',\n context: 'ctx',\n other: '?',\n};\n\nfunction typeTag(type: string): string {\n return TYPE_ABBREV[type] || type;\n}\n\n/**\n * Format a consistent component reference: `@c1 [fn] Name` or `@c1 [fn] Name key=x`\n * When errors/warnings are non-zero, appends annotations like `⚠2 ✗1`.\n */\nfunction formatRef(opts: { label?: string; type?: string; name: string; key?: string | null; errors?: number; warnings?: number }): string {\n const ref = opts.label || '?';\n const tag = typeTag(opts.type || 'other');\n let s = `${ref} [${tag}] ${opts.name}`;\n if (opts.key) s += ` key=${opts.key}`;\n const annotations = formatErrorAnnotations(opts.errors, opts.warnings);\n if (annotations) s += ` ${annotations}`;\n return s;\n}\n\n/**\n * Format error/warning count annotations (e.g., `⚠2 ✗1`).\n * Returns empty string if both counts are zero or undefined.\n */\nfunction formatErrorAnnotations(errors?: number, warnings?: number): string {\n const parts: string[] = [];\n if (warnings && warnings > 0) parts.push(`⚠${warnings}`);\n if (errors && errors > 0) parts.push(`✗${errors}`);\n return parts.join(' ');\n}\n\n// ── Tree connector characters ──\nconst PIPE = '│ ';\nconst TEE = '├─ ';\nconst ELBOW = '└─ ';\nconst SPACE = ' ';\n\nexport function formatTree(nodes: TreeNode[], hint?: string): string {\n if (nodes.length === 0) {\n return hint ? `No components (${hint})` : 'No components (is a React app connected?)';\n }\n\n // Build tree structure from the flat list\n const childrenMap = new Map<number | null, TreeNode[]>();\n for (const node of nodes) {\n const parentId = node.parentId;\n let siblings = childrenMap.get(parentId);\n if (!siblings) {\n siblings = [];\n childrenMap.set(parentId, siblings);\n }\n siblings.push(node);\n }\n\n const lines: string[] = [];\n\n function walk(nodeId: number, prefix: string, isLast: boolean, isRoot: boolean): void {\n const node = nodes.find((n) => n.id === nodeId);\n if (!node) return;\n\n const connector = isRoot ? '' : isLast ? ELBOW : TEE;\n const line = formatRef({ label: node.label, type: node.type, name: node.displayName, key: node.key, errors: node.errors, warnings: node.warnings });\n\n lines.push(`${prefix}${connector}${line}`);\n\n const children = childrenMap.get(node.id) || [];\n const childPrefix = isRoot ? '' : prefix + (isLast ? SPACE : PIPE);\n\n for (let i = 0; i < children.length; i++) {\n walk(children[i].id, childPrefix, i === children.length - 1, false);\n }\n }\n\n // Find root nodes\n const roots = childrenMap.get(null) || [];\n for (let i = 0; i < roots.length; i++) {\n walk(roots[i].id, '', i === roots.length - 1, true);\n }\n\n return lines.join('\\n');\n}\n\nexport function formatErrors(nodes: TreeNode[]): string {\n if (nodes.length === 0) return 'No components with errors or warnings';\n\n const lines: string[] = [];\n for (const n of nodes) {\n const ref = formatRef({ label: n.label, type: n.type, name: n.displayName, key: n.key, errors: n.errors, warnings: n.warnings });\n lines.push(ref);\n }\n return lines.join('\\n');\n}\n\nexport function formatComponent(element: InspectedElement & { errors?: number; warnings?: number }, label?: string): string {\n const lines: string[] = [];\n\n lines.push(formatRef({ label: label || `#${element.id}`, type: element.type, name: element.displayName, key: element.key, errors: element.errors, warnings: element.warnings }));\n\n // Props\n if (element.props && Object.keys(element.props).length > 0) {\n lines.push('props:');\n for (const [key, value] of Object.entries(element.props)) {\n lines.push(` ${key}: ${formatCompactValue(value) ?? 'undefined'}`);\n }\n }\n\n // State\n if (element.state && Object.keys(element.state).length > 0) {\n lines.push('state:');\n for (const [key, value] of Object.entries(element.state)) {\n lines.push(` ${key}: ${formatCompactValue(value) ?? 'undefined'}`);\n }\n }\n\n // Hooks\n if (element.hooks && element.hooks.length > 0) {\n lines.push('hooks:');\n for (const h of element.hooks) {\n const val = formatCompactValue(h.value);\n lines.push(val !== undefined ? ` ${h.name}: ${val}` : ` ${h.name}`);\n if (h.subHooks && h.subHooks.length > 0) {\n for (const sh of h.subHooks) {\n const sval = formatCompactValue(sh.value);\n lines.push(sval !== undefined ? ` ${sh.name}: ${sval}` : ` ${sh.name}`);\n }\n }\n }\n }\n\n return lines.join('\\n');\n}\n\nexport function formatSearchResults(results: TreeNode[]): string {\n if (results.length === 0) return 'No components found';\n\n return results\n .map((n) => {\n // Use numeric id as label when @c label isn't resolved (e.g., tree not traversed)\n const effectiveLabel = n.label === '@c?' ? `@c?(id:${n.id})` : n.label;\n return formatRef({ label: effectiveLabel, type: n.type, name: n.displayName, key: n.key, errors: n.errors, warnings: n.warnings });\n })\n .join('\\n');\n}\n\nexport function formatCount(counts: Record<string, number>): string {\n const total = Object.values(counts).reduce((a, b) => a + b, 0);\n const parts = Object.entries(counts)\n .sort((a, b) => b[1] - a[1])\n .map(([type, count]) => `${typeTag(type)}:${count}`)\n .join(' ');\n return `${total} components (${parts})`;\n}\n\nexport function formatStatus(status: StatusInfo): string {\n const lines: string[] = [];\n lines.push(`Daemon: running (port ${status.port})`);\n lines.push(\n `Apps: ${status.connectedApps} connected, ${status.componentCount} components`,\n );\n if (status.profilingActive) {\n lines.push('Profiling: active');\n }\n const upSec = Math.round(status.uptime / 1000);\n lines.push(`Uptime: ${upSec}s`);\n if (status.connection?.recentEvents?.length > 0) {\n const last = status.connection.recentEvents[status.connection.recentEvents.length - 1];\n const ago = formatAgo(Date.now() - last.timestamp);\n lines.push(`Last event: app ${last.type} ${ago}`);\n }\n return lines.join('\\n');\n}\n\nexport function formatAgo(ms: number): string {\n const sec = Math.round(ms / 1000);\n if (sec < 60) return `${sec}s ago`;\n const min = Math.round(sec / 60);\n if (min < 60) return `${min}m ago`;\n const hr = Math.round(min / 60);\n return `${hr}h ago`;\n}\n\nexport function formatProfileSummary(summary: ProfileSummary): string {\n const lines: string[] = [];\n const durSec = (summary.duration / 1000).toFixed(1);\n lines.push(\n `Profile \"${summary.name}\" (${durSec}s, ${summary.commitCount} commits)`,\n );\n\n if (summary.componentRenderCounts.length > 0) {\n lines.push('');\n lines.push('Top renders:');\n for (const c of summary.componentRenderCounts.slice(0, 10)) {\n const ref = formatRef({ label: c.label, type: c.type, name: c.displayName || `#${c.id}` });\n lines.push(` ${ref} ${c.count} renders`);\n }\n }\n\n return lines.join('\\n');\n}\n\nexport function formatProfileReport(report: ComponentRenderReport, label?: string): string {\n const lines: string[] = [];\n lines.push(formatRef({ label: label || report.label || `#${report.id}`, type: report.type, name: report.displayName }));\n lines.push(\n `renders:${report.renderCount} avg:${report.avgDuration.toFixed(1)}ms max:${report.maxDuration.toFixed(1)}ms total:${report.totalDuration.toFixed(1)}ms`,\n );\n if (report.causes.length > 0) {\n lines.push(`causes: ${report.causes.join(', ')}`);\n }\n const keys = formatChangedKeys(report.changedKeys);\n if (keys) {\n lines.push(`changed: ${keys}`);\n }\n return lines.join('\\n');\n}\n\nexport function formatSlowest(reports: ComponentRenderReport[]): string {\n if (reports.length === 0) return 'No profiling data';\n\n const lines: string[] = ['Slowest (by avg render time):'];\n for (const r of reports) {\n const ref = formatRef({ label: r.label, type: r.type, name: r.displayName });\n const causes = r.causes.length > 0 ? r.causes.join(', ') : '?';\n let line = ` ${ref} avg:${r.avgDuration.toFixed(1)}ms max:${r.maxDuration.toFixed(1)}ms renders:${r.renderCount} causes:${causes}`;\n const keys = formatChangedKeys(r.changedKeys);\n if (keys) line += ` changed: ${keys}`;\n lines.push(line);\n }\n return lines.join('\\n');\n}\n\nexport function formatRerenders(reports: ComponentRenderReport[]): string {\n if (reports.length === 0) return 'No profiling data';\n\n const lines: string[] = ['Most re-renders:'];\n for (const r of reports) {\n const ref = formatRef({ label: r.label, type: r.type, name: r.displayName });\n const causes = r.causes.length > 0 ? r.causes.join(', ') : '?';\n let line = ` ${ref} ${r.renderCount} renders causes:${causes}`;\n const keys = formatChangedKeys(r.changedKeys);\n if (keys) line += ` changed: ${keys}`;\n lines.push(line);\n }\n return lines.join('\\n');\n}\n\nexport function formatTimeline(result: TimelineResult): string {\n if (result.total === 0) return 'No profiling data';\n\n const { entries, total, offset } = result;\n\n if (entries.length === 0) {\n return `Commit timeline (showing 0 of ${total}): offset past end`;\n }\n\n let header: string;\n if (entries.length === total) {\n header = `Commit timeline (${total} commits):`;\n } else {\n const from = offset + 1;\n const to = offset + entries.length;\n header = `Commit timeline (showing ${from}–${to} of ${total}):`;\n }\n\n const lines: string[] = [header];\n for (const e of entries) {\n lines.push(\n ` #${e.index} ${e.duration.toFixed(1)}ms ${e.componentCount} components`,\n );\n }\n return lines.join('\\n');\n}\n\nexport function formatCommitDetail(detail: CommitDetail): string {\n const lines: string[] = [];\n lines.push(`Commit #${detail.index} ${detail.duration.toFixed(1)}ms ${detail.totalComponents} components`);\n lines.push('');\n for (const c of detail.components) {\n const ref = formatRef({ label: c.label, type: c.type, name: c.displayName });\n const causes = c.causes.length > 0 ? c.causes.join(', ') : '?';\n let line = ` ${ref} self:${c.selfDuration.toFixed(1)}ms total:${c.actualDuration.toFixed(1)}ms causes:${causes}`;\n const keys = formatChangedKeys(c.changedKeys);\n if (keys) line += ` changed: ${keys}`;\n lines.push(line);\n }\n const hidden = detail.totalComponents - detail.components.length;\n if (hidden > 0) {\n lines.push(` ... ${hidden} more (use --limit to show more)`);\n }\n return lines.join('\\n');\n}\n\n// ── Changed-keys helper ──\n\nexport function formatChangedKeys(keys: ChangedKeys | undefined): string {\n if (!keys) return '';\n const parts: string[] = [];\n if (keys.props.length > 0) parts.push(`props: ${keys.props.join(', ')}`);\n if (keys.state.length > 0) parts.push(`state: ${keys.state.join(', ')}`);\n if (keys.hooks.length > 0) parts.push(`hooks: ${keys.hooks.map((h) => `#${h}`).join(', ')}`);\n return parts.join(' ');\n}\n\n// ── Helpers ──\n\nfunction formatCompactValue(val: unknown): string | undefined {\n if (val === undefined) return undefined;\n if (val === null) return 'null';\n if (typeof val === 'function') return 'ƒ';\n if (typeof val === 'string') return `\"${val}\"`;\n if (typeof val === 'number' || typeof val === 'boolean') return String(val);\n try {\n const s = JSON.stringify(val, replacer, 0);\n if (s && s.length > 60) return s.slice(0, 57) + '...';\n return s || String(val);\n } catch {\n return String(val);\n }\n}\n\nfunction replacer(_key: string, value: unknown): unknown {\n if (typeof value === 'function') return 'ƒ';\n return value;\n}\n\n// ── Profile Diff ──\n\nfunction fmtMs(ms: number): string {\n return ms.toFixed(1) + 'ms';\n}\n\nfunction fmtPct(pct: number | null): string {\n if (pct === null) return '';\n const sign = pct > 0 ? '+' : '';\n return `${sign}${pct.toFixed(0)}%`;\n}\n\nfunction fmtDiffLine(e: DiffEntry): string {\n const before = e.before ? fmtMs(e.before.avgDuration) : '-';\n const after = e.after ? fmtMs(e.after.avgDuration) : '-';\n const pct = fmtPct(e.avgDurationDeltaPct);\n const rendersBefore = e.before ? String(e.before.renderCount) : '-';\n const rendersAfter = e.after ? String(e.after.renderCount) : '-';\n return ` ${e.displayName.padEnd(30)} avg: ${before.padStart(8)} -> ${after.padStart(8)} ${pct.padStart(6)} renders: ${rendersBefore} -> ${rendersAfter}`;\n}\n\nexport function formatProfileDiff(diff: ProfileDiffResult, limit?: number): string {\n const lines: string[] = [];\n const s = diff.summary;\n\n lines.push(`Before: ${s.totalCommitsBefore} commits, ${fmtMs(s.totalDurationBefore)} total`);\n lines.push(`After: ${s.totalCommitsAfter} commits, ${fmtMs(s.totalDurationAfter)} total`);\n\n const durDelta = s.totalDurationAfter - s.totalDurationBefore;\n const durPct = s.totalDurationBefore > 0 ? (durDelta / s.totalDurationBefore) * 100 : 0;\n lines.push(`Delta: ${fmtMs(durDelta)} (${fmtPct(durPct)})`);\n\n if (diff.regressed.length > 0) {\n lines.push('');\n lines.push(`Regressed (${diff.regressed.length}):`);\n for (const e of diff.regressed.slice(0, limit)) {\n lines.push(fmtDiffLine(e));\n }\n const hidden = diff.regressed.length - (limit ?? diff.regressed.length);\n if (hidden > 0) lines.push(` ... ${hidden} more`);\n }\n\n if (diff.improved.length > 0) {\n lines.push('');\n lines.push(`Improved (${diff.improved.length}):`);\n for (const e of diff.improved.slice(0, limit)) {\n lines.push(fmtDiffLine(e));\n }\n const hidden = diff.improved.length - (limit ?? diff.improved.length);\n if (hidden > 0) lines.push(` ... ${hidden} more`);\n }\n\n if (diff.added.length > 0) {\n lines.push('');\n lines.push(`New (${diff.added.length}):`);\n for (const e of diff.added.slice(0, limit)) {\n lines.push(fmtDiffLine(e));\n }\n const hidden = diff.added.length - (limit ?? diff.added.length);\n if (hidden > 0) lines.push(` ... ${hidden} more`);\n }\n\n if (diff.removed.length > 0) {\n lines.push('');\n lines.push(`Removed (${diff.removed.length}):`);\n for (const e of diff.removed.slice(0, limit)) {\n lines.push(fmtDiffLine(e));\n }\n const hidden = diff.removed.length - (limit ?? diff.removed.length);\n if (hidden > 0) lines.push(` ... ${hidden} more`);\n }\n\n if (diff.regressed.length === 0 && diff.improved.length === 0 && diff.added.length === 0 && diff.removed.length === 0) {\n lines.push('');\n lines.push(`No significant changes (all within ${s.thresholdPct}% threshold)`);\n }\n\n return lines.join('\\n');\n}\n","import {\n ensureDaemon,\n sendCommand,\n stopDaemon,\n readDaemonInfo,\n setStateDir,\n} from './daemon-client.js';\nimport {\n formatTree,\n formatComponent,\n formatSearchResults,\n formatCount,\n formatErrors,\n formatStatus,\n formatProfileSummary,\n formatProfileReport,\n formatSlowest,\n formatRerenders,\n formatTimeline,\n formatCommitDetail,\n formatProfileDiff,\n} from './formatters.js';\nimport { writeFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport type { IpcCommand } from './types.js';\n\nfunction usage(): string {\n return `Usage: devtools <command> [options]\n\nSetup:\n init [--dry-run] Auto-configure your React app\n\nDaemon:\n start [--port 8097] Start daemon\n stop Stop daemon\n status Show daemon status\n\nComponents:\n get tree [--depth N] Component hierarchy\n get component <@c1 | id> Props, state, hooks\n find <name> [--exact] Search by display name\n count Component count by type\n errors Components with errors/warnings\n\nWait:\n wait --connected [--timeout S] Block until an app connects\n wait --component <name> [--timeout S] Block until a component appears\n\nProfiling:\n profile start [name] Start profiling session\n profile stop Stop profiling, collect data\n profile report <@c1 | id> Render report for component\n profile slow [--limit N] Slowest components (by avg)\n profile rerenders [--limit N] Most re-rendered components\n profile timeline [--limit N] Commit timeline\n profile commit <N | #N> [--limit N] Detail for specific commit\n profile export <file> Export as React DevTools JSON\n profile diff <before.json> <after.json> [--limit N] [--threshold N] Compare two exports`;\n}\n\nfunction parseArgs(argv: string[]): {\n command: string[];\n flags: Record<string, string | boolean>;\n} {\n const command: string[] = [];\n const flags: Record<string, string | boolean> = {};\n\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i];\n if (arg.startsWith('--')) {\n const key = arg.slice(2);\n const eqIdx = key.indexOf('=');\n if (eqIdx !== -1) {\n flags[key.slice(0, eqIdx)] = key.slice(eqIdx + 1);\n } else {\n // Check if next arg is a value\n const next = argv[i + 1];\n if (next && !next.startsWith('--')) {\n flags[key] = next;\n i++;\n } else {\n flags[key] = true;\n }\n }\n } else {\n command.push(arg);\n }\n }\n return { command, flags };\n}\n\nfunction parseNumericFlag(\n flags: Record<string, string | boolean>,\n name: string,\n defaultValue?: number,\n): number | undefined {\n const raw = flags[name];\n if (raw === undefined || raw === true) return defaultValue;\n const n = parseInt(raw as string, 10);\n if (isNaN(n)) {\n console.error(`Invalid value for --${name}: expected a number`);\n process.exit(1);\n }\n return n;\n}\n\nasync function main(): Promise<void> {\n const { command, flags } = parseArgs(process.argv.slice(2));\n\n if (command.length === 0 || flags['help']) {\n console.log(usage());\n process.exit(0);\n }\n\n // Configure custom state directory (for test isolation)\n if (typeof flags['state-dir'] === 'string') {\n setStateDir(flags['state-dir']);\n }\n\n const cmd0 = command[0];\n const cmd1 = command[1];\n\n try {\n // ── Init ──\n if (cmd0 === 'init') {\n const { runInit } = await import('./init.js');\n await runInit(process.cwd(), flags['dry-run'] === true);\n return;\n }\n\n // ── Profile diff (no daemon needed) ──\n if (cmd0 === 'profile' && cmd1 === 'diff') {\n const fileA = command[2];\n const fileB = command[3];\n if (!fileA || !fileB) {\n console.error('Usage: devtools profile diff <before.json> <after.json> [--limit N] [--threshold N]');\n process.exit(1);\n }\n const { loadExportFile, diffProfiles } = await import('./profile-diff.js');\n let before: ReturnType<typeof loadExportFile>;\n let after: ReturnType<typeof loadExportFile>;\n try {\n before = loadExportFile(resolve(fileA));\n } catch (e) {\n console.error(`Error reading ${fileA}: ${(e as Error).message}`);\n process.exit(1);\n }\n try {\n after = loadExportFile(resolve(fileB));\n } catch (e) {\n console.error(`Error reading ${fileB}: ${(e as Error).message}`);\n process.exit(1);\n }\n const limit = parseNumericFlag(flags, 'limit');\n const threshold = parseNumericFlag(flags, 'threshold');\n const diff = diffProfiles(before, after, threshold);\n console.log(formatProfileDiff(diff, limit));\n return;\n }\n\n // ── Daemon management ──\n if (cmd0 === 'start') {\n const port = parseNumericFlag(flags, 'port');\n await ensureDaemon(port);\n const resp = await sendCommand({ type: 'status' });\n if (resp.ok) {\n console.log(formatStatus(resp.data as any));\n }\n return;\n }\n\n if (cmd0 === 'stop') {\n const stopped = stopDaemon();\n console.log(stopped ? 'Daemon stopped' : 'Daemon is not running');\n return;\n }\n\n if (cmd0 === 'status') {\n const info = readDaemonInfo();\n if (!info) {\n console.log('Daemon is not running');\n process.exit(1);\n }\n try {\n const resp = await sendCommand({ type: 'status' });\n if (resp.ok) {\n console.log(formatStatus(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n } catch {\n console.log('Daemon is not running (stale info)');\n process.exit(1);\n }\n return;\n }\n\n // ── All other commands require the daemon ──\n await ensureDaemon();\n\n // ── Component inspection ──\n if (cmd0 === 'get' && cmd1 === 'tree') {\n const depth = parseNumericFlag(flags, 'depth');\n const ipcCmd: IpcCommand = { type: 'get-tree', depth };\n const resp = await sendCommand(ipcCmd);\n if (resp.ok) {\n console.log(formatTree(resp.data as any, resp.hint));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'get' && cmd1 === 'component') {\n const raw = command[2];\n if (!raw) {\n console.error('Usage: devtools get component <@c1 | id>');\n process.exit(1);\n }\n const id: number | string = raw.startsWith('@') ? raw : parseInt(raw, 10);\n if (typeof id === 'number' && isNaN(id)) {\n console.error('Usage: devtools get component <@c1 | id>');\n process.exit(1);\n }\n const resp = await sendCommand({ type: 'get-component', id });\n if (resp.ok) {\n console.log(formatComponent(resp.data as any, resp.label));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'find') {\n const name = command[1];\n if (!name) {\n console.error('Usage: devtools find <name> [--exact]');\n process.exit(1);\n }\n const exact = flags['exact'] === true;\n const resp = await sendCommand({ type: 'find', name, exact });\n if (resp.ok) {\n console.log(formatSearchResults(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'count') {\n const resp = await sendCommand({ type: 'count' });\n if (resp.ok) {\n console.log(formatCount(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'errors') {\n const resp = await sendCommand({ type: 'errors' });\n if (resp.ok) {\n console.log(formatErrors(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n // ── Wait ──\n if (cmd0 === 'wait') {\n const timeoutSec = parseNumericFlag(flags, 'timeout', 30)!;\n const timeoutMs = timeoutSec * 1000;\n const socketTimeout = timeoutMs + 5000;\n\n let ipcCmd: IpcCommand;\n if (flags['connected'] !== undefined) {\n ipcCmd = { type: 'wait', condition: 'connected', timeout: timeoutMs };\n } else if (flags['component'] !== undefined) {\n if (typeof flags['component'] !== 'string') {\n console.error('Usage: devtools wait --component <name> [--timeout S]');\n process.exit(1);\n }\n ipcCmd = { type: 'wait', condition: 'component', name: flags['component'], timeout: timeoutMs };\n } else {\n console.error('Usage: devtools wait --connected|--component <name> [--timeout S]');\n process.exit(1);\n }\n\n const resp = await sendCommand(ipcCmd, socketTimeout);\n if (resp.ok) {\n const result = resp.data as { met: boolean; condition: string; timeout?: boolean };\n if (result.met) {\n console.log(`Condition met: ${result.condition}`);\n } else {\n console.error(`Timed out waiting for: ${result.condition}`);\n process.exit(1);\n }\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n // ── Profiling ──\n if (cmd0 === 'profile' && cmd1 === 'start') {\n const name = command[2];\n const resp = await sendCommand({ type: 'profile-start', name });\n if (resp.ok) {\n console.log(resp.data);\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'profile' && cmd1 === 'stop') {\n const resp = await sendCommand({ type: 'profile-stop' });\n if (resp.ok) {\n console.log(formatProfileSummary(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'profile' && cmd1 === 'report') {\n const raw = command[2];\n if (!raw) {\n console.error('Usage: devtools profile report <@c1 | id>');\n process.exit(1);\n }\n const componentId: number | string = raw.startsWith('@') ? raw : parseInt(raw, 10);\n if (typeof componentId === 'number' && isNaN(componentId)) {\n console.error('Usage: devtools profile report <@c1 | id>');\n process.exit(1);\n }\n const resp = await sendCommand({ type: 'profile-report', componentId });\n if (resp.ok) {\n console.log(formatProfileReport(resp.data as any, resp.label));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'profile' && cmd1 === 'slow') {\n const limit = parseNumericFlag(flags, 'limit');\n const resp = await sendCommand({ type: 'profile-slow', limit });\n if (resp.ok) {\n console.log(formatSlowest(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'profile' && cmd1 === 'rerenders') {\n const limit = parseNumericFlag(flags, 'limit');\n const resp = await sendCommand({ type: 'profile-rerenders', limit });\n if (resp.ok) {\n console.log(formatRerenders(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'profile' && cmd1 === 'commit') {\n const raw = command[2];\n if (!raw) {\n console.error('Usage: devtools profile commit <N | #N>');\n process.exit(1);\n }\n const index = parseInt(raw.replace(/^#/, ''), 10);\n if (isNaN(index)) {\n console.error('Usage: devtools profile commit <N | #N>');\n process.exit(1);\n }\n const limit = parseNumericFlag(flags, 'limit');\n const resp = await sendCommand({ type: 'profile-commit', index, limit });\n if (resp.ok) {\n console.log(formatCommitDetail(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'profile' && cmd1 === 'timeline') {\n const limit = parseNumericFlag(flags, 'limit');\n const offset = parseNumericFlag(flags, 'offset');\n const sortFlag = flags['sort'];\n const sort = sortFlag === 'duration' ? 'duration' as const\n : sortFlag === 'timeline' ? 'timeline' as const\n : undefined;\n const resp = await sendCommand({ type: 'profile-timeline', limit, offset, sort });\n if (resp.ok) {\n console.log(formatTimeline(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'profile' && cmd1 === 'export') {\n const file = command[2];\n if (!file) {\n console.error('Usage: devtools profile export <file>');\n process.exit(1);\n }\n const resp = await sendCommand({ type: 'profile-export' });\n if (resp.ok) {\n const outPath = resolve(file);\n writeFileSync(outPath, JSON.stringify(resp.data), 'utf-8');\n console.log(`Exported to ${outPath}`);\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n console.error(`Unknown command: ${command.join(' ')}`);\n console.log(usage());\n process.exit(1);\n } catch (err) {\n console.error(\n err instanceof Error ? err.message : String(err),\n );\n process.exit(1);\n }\n}\n\nmain();\n"],"mappings":";;;AAAA,OAAO,SAAS;AAChB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,aAAa;AAGtB,IAAM,oBAAoB,KAAK;AAAA,EAC7B,QAAQ,IAAI,QAAQ,QAAQ,IAAI,eAAe;AAAA,EAC/C;AACF;AAEA,IAAI,WAAW;AAER,SAAS,YAAY,KAAmB;AAC7C,aAAW;AACb;AAEA,SAAS,oBAA4B;AACnC,SAAO,KAAK,KAAK,UAAU,aAAa;AAC1C;AAEA,SAAS,gBAAwB;AAC/B,SAAO,KAAK,KAAK,UAAU,aAAa;AAC1C;AAEO,SAAS,iBAAoC;AAClD,MAAI;AACF,UAAM,MAAM,GAAG,aAAa,kBAAkB,GAAG,OAAO;AACxD,WAAO,KAAK,MAAM,GAAG;AAAA,EACvB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,cAAc,MAA2B;AAChD,MAAI;AAEF,YAAQ,KAAK,KAAK,KAAK,CAAC;AACxB,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAsB,aAAa,MAA8B;AAC/D,QAAM,OAAO,eAAe;AAC5B,MAAI,QAAQ,cAAc,IAAI,GAAG;AAC/B,UAAMA,gBAAe,KAAK;AAAA,MACxB,KAAK,QAAQ,IAAI,IAAI,YAAY,GAAG,EAAE,QAAQ;AAAA,MAC9C;AAAA,IACF;AACA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EAAE,MAAM,oBAAoB,OAAO,QAAQ,KAAK,CAAC;AAChF,UAAI,KAAK,IAAI;AACX,gBAAQ,IAAI,eAAe,KAAK,IAAW,CAAC;AAAA,MAC9C,OAAO;AACL,gBAAQ,MAAM,KAAK,KAAK;AACxB,gBAAQ,KAAK,CAAC;AAAA,MAChB;AACA;AAAA,IACF;AAEA,QAAI,SAAS,aAAa,SAAS,UAAU;AAC3C,YAAM,OAAO,QAAQ,CAAC;AACtB,UAAI,CAAC,MAAM;AACT,gBAAQ,MAAM,uCAAuC;AACrD,gBAAQ,KAAK,CAAC;AAAA,MAChB;AACA,YAAM,OAAO,MAAM,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACzD,UAAI,KAAK,IAAI;AACX,cAAM,UAAU,QAAQ,IAAI;AAC5B,sBAAc,SAAS,KAAK,UAAU,KAAK,IAAI,GAAG,OAAO;AACzD,gBAAQ,IAAI,eAAe,OAAO,EAAE;AAAA,MACtC,OAAO;AACL,gBAAQ,MAAM,KAAK,KAAK;AACxB,gBAAQ,KAAK,CAAC;AAAA,MAChB;AACA;AAAA,IACF;AAEA,YAAQ,MAAM,oBAAoB,QAAQ,KAAK,GAAG,CAAC,EAAE;AACrD,YAAQ,IAAI,MAAM,CAAC;AACnB,YAAQ,KAAK,CAAC;AAAA,EAChB,SAAS,KAAK;AACZ,YAAQ;AAAA,MACN,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAAA,IACjD;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAEA,KAAK;","names":["daemonScript","resolve"]}
1
+ {"version":3,"sources":["../src/daemon-client.ts","../src/formatters.ts","../src/cli.ts"],"sourcesContent":["import net from 'node:net';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { spawn } from 'node:child_process';\nimport type { IpcCommand, IpcResponse, DaemonInfo } from './types.js';\n\nconst DEFAULT_STATE_DIR = path.join(\n process.env.HOME || process.env.USERPROFILE || '/tmp',\n '.agent-react-devtools',\n);\n\nlet stateDir = DEFAULT_STATE_DIR;\n\nexport function setStateDir(dir: string): void {\n stateDir = dir;\n}\n\nfunction getDaemonInfoPath(): string {\n return path.join(stateDir, 'daemon.json');\n}\n\nfunction getSocketPath(): string {\n return path.join(stateDir, 'daemon.sock');\n}\n\nexport function readDaemonInfo(): DaemonInfo | null {\n try {\n const raw = fs.readFileSync(getDaemonInfoPath(), 'utf-8');\n return JSON.parse(raw) as DaemonInfo;\n } catch {\n return null;\n }\n}\n\nfunction isDaemonAlive(info: DaemonInfo): boolean {\n try {\n // Signal 0 doesn't kill, just checks if process exists\n process.kill(info.pid, 0);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function ensureDaemon(port?: number): Promise<void> {\n const info = readDaemonInfo();\n if (info && isDaemonAlive(info)) {\n const daemonScript = path.join(\n path.dirname(new URL(import.meta.url).pathname),\n 'daemon.js',\n );\n try {\n const stat = fs.statSync(daemonScript);\n const stale = info.buildMtime !== undefined\n ? stat.mtimeMs !== info.buildMtime\n : stat.mtimeMs > info.startedAt;\n if (stale) {\n port = port ?? info.port;\n stopDaemon();\n } else {\n return;\n }\n } catch {\n return;\n }\n }\n\n // Clean up stale files\n try {\n fs.unlinkSync(getDaemonInfoPath());\n } catch {\n // ignore\n }\n try {\n fs.unlinkSync(getSocketPath());\n } catch {\n // ignore\n }\n\n // Start daemon as detached child process\n const daemonScript = path.join(\n path.dirname(new URL(import.meta.url).pathname),\n 'daemon.js',\n );\n\n const args = [];\n if (port) args.push(`--port=${port}`);\n if (stateDir !== DEFAULT_STATE_DIR) args.push(`--state-dir=${stateDir}`);\n\n const child = spawn(process.execPath, [daemonScript, ...args], {\n detached: true,\n stdio: 'ignore',\n });\n child.unref();\n\n // Wait for daemon to be ready (up to 5 seconds)\n const deadline = Date.now() + 5000;\n while (Date.now() < deadline) {\n await new Promise((r) => setTimeout(r, 100));\n try {\n await sendCommand({ type: 'ping' });\n return;\n } catch {\n // not ready yet\n }\n }\n throw new Error('Daemon failed to start within 5 seconds');\n}\n\nexport function stopDaemon(): boolean {\n const info = readDaemonInfo();\n if (!info) return false;\n\n try {\n process.kill(info.pid, 'SIGTERM');\n // Clean up files\n try {\n fs.unlinkSync(getDaemonInfoPath());\n } catch {\n // ignore\n }\n return true;\n } catch {\n return false;\n }\n}\n\nexport function sendCommand(cmd: IpcCommand, socketTimeout = 30_000): Promise<IpcResponse> {\n return new Promise((resolve, reject) => {\n const socketPath = getSocketPath();\n\n const conn = net.createConnection(socketPath, () => {\n conn.write(JSON.stringify(cmd) + '\\n');\n });\n\n let buffer = '';\n conn.on('data', (chunk) => {\n buffer += chunk.toString();\n const newlineIdx = buffer.indexOf('\\n');\n if (newlineIdx !== -1) {\n const line = buffer.slice(0, newlineIdx);\n conn.end();\n try {\n resolve(JSON.parse(line) as IpcResponse);\n } catch {\n reject(new Error('Invalid response from daemon'));\n }\n }\n });\n\n conn.on('error', (err) => {\n reject(new Error(`Cannot connect to daemon: ${err.message}`));\n });\n\n conn.setTimeout(socketTimeout, () => {\n conn.destroy();\n reject(new Error('Command timed out'));\n });\n });\n}\n","import type {\n StatusInfo,\n InspectedElement,\n ComponentRenderReport,\n ChangedKeys,\n} from './types.js';\nimport type { TreeNode } from './component-tree.js';\nimport type { ProfileSummary, TimelineResult, CommitDetail } from './profiler.js';\nimport type { ProfileDiffResult, DiffEntry } from './profile-diff.js';\n\n// ── Abbreviations for component types ──\nconst TYPE_ABBREV: Record<string, string> = {\n function: 'fn',\n class: 'cls',\n host: 'host',\n memo: 'memo',\n forwardRef: 'fRef',\n profiler: 'prof',\n suspense: 'susp',\n context: 'ctx',\n other: '?',\n};\n\nfunction typeTag(type: string): string {\n return TYPE_ABBREV[type] || type;\n}\n\n/**\n * Format a consistent component reference: `@c1 [fn] Name` or `@c1 [fn] Name key=x`\n * When errors/warnings are non-zero, appends annotations like `⚠2 ✗1`.\n */\nfunction formatRef(opts: { label?: string; type?: string; name: string; key?: string | null; errors?: number; warnings?: number }): string {\n const ref = opts.label || '?';\n const tag = typeTag(opts.type || 'other');\n let s = `${ref} [${tag}] ${opts.name}`;\n if (opts.key) s += ` key=${opts.key}`;\n const annotations = formatErrorAnnotations(opts.errors, opts.warnings);\n if (annotations) s += ` ${annotations}`;\n return s;\n}\n\n/**\n * Format error/warning count annotations (e.g., `⚠2 ✗1`).\n * Returns empty string if both counts are zero or undefined.\n */\nfunction formatErrorAnnotations(errors?: number, warnings?: number): string {\n const parts: string[] = [];\n if (warnings && warnings > 0) parts.push(`⚠${warnings}`);\n if (errors && errors > 0) parts.push(`✗${errors}`);\n return parts.join(' ');\n}\n\n// ── Tree connector characters ──\nconst PIPE = '│ ';\nconst TEE = '├─ ';\nconst ELBOW = '└─ ';\nconst SPACE = ' ';\n\n/** Default number of siblings to show before collapsing a run */\nconst COLLAPSE_THRESHOLD = 3;\n\nexport interface FormatTreeOptions {\n /** Total component count (before filtering), for the summary footer */\n totalCount?: number;\n /** Maximum output lines (hard cap) */\n maxLines?: number;\n /** Hint text for empty tree */\n hint?: string;\n}\n\nexport function formatTree(nodes: TreeNode[], hintOrOpts?: string | FormatTreeOptions): string {\n const opts: FormatTreeOptions =\n typeof hintOrOpts === 'string' ? { hint: hintOrOpts } : hintOrOpts || {};\n const { hint, totalCount, maxLines } = opts;\n\n if (nodes.length === 0) {\n return hint ? `No components (${hint})` : 'No components (is a React app connected?)';\n }\n\n // Build tree structure and id lookup from the flat list\n const childrenMap = new Map<number | null, TreeNode[]>();\n const nodeMap = new Map<number, TreeNode>();\n for (const node of nodes) {\n nodeMap.set(node.id, node);\n const parentId = node.parentId;\n let siblings = childrenMap.get(parentId);\n if (!siblings) {\n siblings = [];\n childrenMap.set(parentId, siblings);\n }\n siblings.push(node);\n }\n\n const lines: string[] = [];\n let truncated = false;\n // Reserve lines for summary footer only; truncation replaces the last tree line\n const lineLimit = maxLines !== undefined\n ? maxLines - (totalCount !== undefined ? 1 : 0)\n : Infinity;\n\n function addLine(line: string): boolean {\n if (lines.length >= lineLimit) {\n truncated = true;\n return false;\n }\n lines.push(line);\n return true;\n }\n\n function walk(nodeId: number, prefix: string, isLast: boolean, isRoot: boolean): boolean {\n const node = nodeMap.get(nodeId);\n if (!node) return true;\n\n const connector = isRoot ? '' : isLast ? ELBOW : TEE;\n const line = formatRef({ label: node.label, type: node.type, name: node.displayName, key: node.key, errors: node.errors, warnings: node.warnings });\n\n if (!addLine(`${prefix}${connector}${line}`)) return false;\n\n const children = childrenMap.get(node.id) || [];\n const childPrefix = isRoot ? '' : prefix + (isLast ? SPACE : PIPE);\n\n // Collapse repeated siblings with the same display name\n let i = 0;\n while (i < children.length) {\n // Find a run of siblings with the same displayName\n let runEnd = i + 1;\n while (runEnd < children.length && children[runEnd].displayName === children[i].displayName) {\n runEnd++;\n }\n const runLen = runEnd - i;\n\n if (runLen > COLLAPSE_THRESHOLD) {\n // Show first COLLAPSE_THRESHOLD items, then a summary line\n for (let j = 0; j < COLLAPSE_THRESHOLD; j++) {\n if (!walk(children[i + j].id, childPrefix, false, false)) return false;\n }\n // Summary line for the rest\n const remaining = runLen - COLLAPSE_THRESHOLD;\n const isLastGroup = runEnd === children.length;\n const summaryConnector = isLastGroup ? ELBOW : TEE;\n if (!addLine(`${childPrefix}${summaryConnector}... +${remaining} more ${children[i].displayName}`)) return false;\n i = runEnd;\n } else {\n // Render normally\n for (let j = i; j < runEnd; j++) {\n const isLastChild = j === children.length - 1;\n if (!walk(children[j].id, childPrefix, isLastChild, false)) return false;\n }\n i = runEnd;\n }\n }\n return true;\n }\n\n // Find root nodes\n const roots = childrenMap.get(null) || [];\n for (let i = 0; i < roots.length; i++) {\n if (!walk(roots[i].id, '', i === roots.length - 1, true)) break;\n }\n\n if (truncated) {\n if (totalCount !== undefined) {\n // Use the reserved footer slot for the truncation notice so no content line is lost.\n // Combine with total count so the summary info isn't dropped.\n lines.push(`... output truncated at ${maxLines} lines (${totalCount.toLocaleString()} total components)`);\n } else {\n // No footer reserved — replace last content line with truncation notice.\n if (lines.length > 0) {\n lines[lines.length - 1] = `... output truncated at ${maxLines} lines`;\n } else {\n lines.push(`... output truncated at ${maxLines} lines`);\n }\n }\n } else if (totalCount !== undefined) {\n // Summary footer (only when output was not truncated)\n const shown = nodes.length;\n const totalFormatted = totalCount.toLocaleString();\n if (shown < totalCount) {\n lines.push(`${shown} components shown (${totalFormatted} total)`);\n } else {\n lines.push(`${totalFormatted} components`);\n }\n }\n\n return lines.join('\\n');\n}\n\nexport function formatErrors(nodes: TreeNode[]): string {\n if (nodes.length === 0) return 'No components with errors or warnings';\n\n const lines: string[] = [];\n for (const n of nodes) {\n const ref = formatRef({ label: n.label, type: n.type, name: n.displayName, key: n.key, errors: n.errors, warnings: n.warnings });\n lines.push(ref);\n }\n return lines.join('\\n');\n}\n\nexport function formatComponent(element: InspectedElement & { errors?: number; warnings?: number }, label?: string): string {\n const lines: string[] = [];\n\n lines.push(formatRef({ label: label || `#${element.id}`, type: element.type, name: element.displayName, key: element.key, errors: element.errors, warnings: element.warnings }));\n\n // Props\n if (element.props && Object.keys(element.props).length > 0) {\n lines.push('props:');\n for (const [key, value] of Object.entries(element.props)) {\n lines.push(` ${key}: ${formatCompactValue(value) ?? 'undefined'}`);\n }\n }\n\n // State\n if (element.state && Object.keys(element.state).length > 0) {\n lines.push('state:');\n for (const [key, value] of Object.entries(element.state)) {\n lines.push(` ${key}: ${formatCompactValue(value) ?? 'undefined'}`);\n }\n }\n\n // Hooks\n if (element.hooks && element.hooks.length > 0) {\n lines.push('hooks:');\n for (const h of element.hooks) {\n const val = formatCompactValue(h.value);\n lines.push(val !== undefined ? ` ${h.name}: ${val}` : ` ${h.name}`);\n if (h.subHooks && h.subHooks.length > 0) {\n for (const sh of h.subHooks) {\n const sval = formatCompactValue(sh.value);\n lines.push(sval !== undefined ? ` ${sh.name}: ${sval}` : ` ${sh.name}`);\n }\n }\n }\n }\n\n return lines.join('\\n');\n}\n\nexport function formatSearchResults(results: TreeNode[]): string {\n if (results.length === 0) return 'No components found';\n\n return results\n .map((n) => {\n // Use numeric id as label when @c label isn't resolved (e.g., tree not traversed)\n const effectiveLabel = n.label === '@c?' ? `@c?(id:${n.id})` : n.label;\n return formatRef({ label: effectiveLabel, type: n.type, name: n.displayName, key: n.key, errors: n.errors, warnings: n.warnings });\n })\n .join('\\n');\n}\n\nexport function formatCount(counts: Record<string, number>): string {\n const total = Object.values(counts).reduce((a, b) => a + b, 0);\n const parts = Object.entries(counts)\n .sort((a, b) => b[1] - a[1])\n .map(([type, count]) => `${typeTag(type)}:${count}`)\n .join(' ');\n return `${total} components (${parts})`;\n}\n\nexport function formatStatus(status: StatusInfo): string {\n const lines: string[] = [];\n lines.push(`Daemon: running (port ${status.port})`);\n lines.push(\n `Apps: ${status.connectedApps} connected, ${status.componentCount} components`,\n );\n if (status.profilingActive) {\n lines.push('Profiling: active');\n }\n const upSec = Math.round(status.uptime / 1000);\n lines.push(`Uptime: ${upSec}s`);\n if (status.connection?.recentEvents?.length > 0) {\n const last = status.connection.recentEvents[status.connection.recentEvents.length - 1];\n const ago = formatAgo(Date.now() - last.timestamp);\n lines.push(`Last event: app ${last.type} ${ago}`);\n }\n return lines.join('\\n');\n}\n\nexport function formatAgo(ms: number): string {\n const sec = Math.round(ms / 1000);\n if (sec < 60) return `${sec}s ago`;\n const min = Math.round(sec / 60);\n if (min < 60) return `${min}m ago`;\n const hr = Math.round(min / 60);\n return `${hr}h ago`;\n}\n\nexport function formatProfileSummary(summary: ProfileSummary): string {\n const lines: string[] = [];\n const durSec = (summary.duration / 1000).toFixed(1);\n lines.push(\n `Profile \"${summary.name}\" (${durSec}s, ${summary.commitCount} commits)`,\n );\n\n if (summary.componentRenderCounts.length > 0) {\n lines.push('');\n lines.push('Top renders:');\n for (const c of summary.componentRenderCounts.slice(0, 10)) {\n const ref = formatRef({ label: c.label, type: c.type, name: c.displayName || `#${c.id}` });\n lines.push(` ${ref} ${c.count} renders`);\n }\n }\n\n return lines.join('\\n');\n}\n\nexport function formatProfileReport(report: ComponentRenderReport, label?: string): string {\n const lines: string[] = [];\n lines.push(formatRef({ label: label || report.label || `#${report.id}`, type: report.type, name: report.displayName }));\n lines.push(\n `renders:${report.renderCount} avg:${report.avgDuration.toFixed(1)}ms max:${report.maxDuration.toFixed(1)}ms total:${report.totalDuration.toFixed(1)}ms`,\n );\n if (report.causes.length > 0) {\n lines.push(`causes: ${report.causes.join(', ')}`);\n }\n const keys = formatChangedKeys(report.changedKeys);\n if (keys) {\n lines.push(`changed: ${keys}`);\n }\n return lines.join('\\n');\n}\n\nexport function formatSlowest(reports: ComponentRenderReport[]): string {\n if (reports.length === 0) return 'No profiling data';\n\n const lines: string[] = ['Slowest (by avg render time):'];\n for (const r of reports) {\n const ref = formatRef({ label: r.label, type: r.type, name: r.displayName });\n const causes = r.causes.length > 0 ? r.causes.join(', ') : '?';\n let line = ` ${ref} avg:${r.avgDuration.toFixed(1)}ms max:${r.maxDuration.toFixed(1)}ms renders:${r.renderCount} causes:${causes}`;\n const keys = formatChangedKeys(r.changedKeys);\n if (keys) line += ` changed: ${keys}`;\n lines.push(line);\n }\n return lines.join('\\n');\n}\n\nexport function formatRerenders(reports: ComponentRenderReport[]): string {\n if (reports.length === 0) return 'No profiling data';\n\n const lines: string[] = ['Most re-renders:'];\n for (const r of reports) {\n const ref = formatRef({ label: r.label, type: r.type, name: r.displayName });\n const causes = r.causes.length > 0 ? r.causes.join(', ') : '?';\n let line = ` ${ref} ${r.renderCount} renders causes:${causes}`;\n const keys = formatChangedKeys(r.changedKeys);\n if (keys) line += ` changed: ${keys}`;\n lines.push(line);\n }\n return lines.join('\\n');\n}\n\nexport function formatTimeline(result: TimelineResult): string {\n if (result.total === 0) return 'No profiling data';\n\n const { entries, total, offset } = result;\n\n if (entries.length === 0) {\n return `Commit timeline (showing 0 of ${total}): offset past end`;\n }\n\n let header: string;\n if (entries.length === total) {\n header = `Commit timeline (${total} commits):`;\n } else {\n const from = offset + 1;\n const to = offset + entries.length;\n header = `Commit timeline (showing ${from}–${to} of ${total}):`;\n }\n\n const lines: string[] = [header];\n for (const e of entries) {\n lines.push(\n ` #${e.index} ${e.duration.toFixed(1)}ms ${e.componentCount} components`,\n );\n }\n return lines.join('\\n');\n}\n\nexport function formatCommitDetail(detail: CommitDetail): string {\n const lines: string[] = [];\n lines.push(`Commit #${detail.index} ${detail.duration.toFixed(1)}ms ${detail.totalComponents} components`);\n lines.push('');\n for (const c of detail.components) {\n const ref = formatRef({ label: c.label, type: c.type, name: c.displayName });\n const causes = c.causes.length > 0 ? c.causes.join(', ') : '?';\n let line = ` ${ref} self:${c.selfDuration.toFixed(1)}ms total:${c.actualDuration.toFixed(1)}ms causes:${causes}`;\n const keys = formatChangedKeys(c.changedKeys);\n if (keys) line += ` changed: ${keys}`;\n lines.push(line);\n }\n const hidden = detail.totalComponents - detail.components.length;\n if (hidden > 0) {\n lines.push(` ... ${hidden} more (use --limit to show more)`);\n }\n return lines.join('\\n');\n}\n\n// ── Changed-keys helper ──\n\nexport function formatChangedKeys(keys: ChangedKeys | undefined): string {\n if (!keys) return '';\n const parts: string[] = [];\n if (keys.props.length > 0) parts.push(`props: ${keys.props.join(', ')}`);\n if (keys.state.length > 0) parts.push(`state: ${keys.state.join(', ')}`);\n if (keys.hooks.length > 0) parts.push(`hooks: ${keys.hooks.map((h) => `#${h}`).join(', ')}`);\n return parts.join(' ');\n}\n\n// ── Helpers ──\n\nfunction formatCompactValue(val: unknown): string | undefined {\n if (val === undefined) return undefined;\n if (val === null) return 'null';\n if (typeof val === 'function') return 'ƒ';\n if (typeof val === 'string') return `\"${val}\"`;\n if (typeof val === 'number' || typeof val === 'boolean') return String(val);\n try {\n const s = JSON.stringify(val, replacer, 0);\n if (s && s.length > 60) return s.slice(0, 57) + '...';\n return s || String(val);\n } catch {\n return String(val);\n }\n}\n\nfunction replacer(_key: string, value: unknown): unknown {\n if (typeof value === 'function') return 'ƒ';\n return value;\n}\n\n// ── Profile Diff ──\n\nfunction fmtMs(ms: number): string {\n return ms.toFixed(1) + 'ms';\n}\n\nfunction fmtPct(pct: number | null): string {\n if (pct === null) return '';\n const sign = pct > 0 ? '+' : '';\n return `${sign}${pct.toFixed(0)}%`;\n}\n\nfunction fmtDiffLine(e: DiffEntry): string {\n const before = e.before ? fmtMs(e.before.avgDuration) : '-';\n const after = e.after ? fmtMs(e.after.avgDuration) : '-';\n const pct = fmtPct(e.avgDurationDeltaPct);\n const rendersBefore = e.before ? String(e.before.renderCount) : '-';\n const rendersAfter = e.after ? String(e.after.renderCount) : '-';\n return ` ${e.displayName.padEnd(30)} avg: ${before.padStart(8)} -> ${after.padStart(8)} ${pct.padStart(6)} renders: ${rendersBefore} -> ${rendersAfter}`;\n}\n\nexport function formatProfileDiff(diff: ProfileDiffResult, limit?: number): string {\n const lines: string[] = [];\n const s = diff.summary;\n\n lines.push(`Before: ${s.totalCommitsBefore} commits, ${fmtMs(s.totalDurationBefore)} total`);\n lines.push(`After: ${s.totalCommitsAfter} commits, ${fmtMs(s.totalDurationAfter)} total`);\n\n const durDelta = s.totalDurationAfter - s.totalDurationBefore;\n const durPct = s.totalDurationBefore > 0 ? (durDelta / s.totalDurationBefore) * 100 : 0;\n lines.push(`Delta: ${fmtMs(durDelta)} (${fmtPct(durPct)})`);\n\n if (diff.regressed.length > 0) {\n lines.push('');\n lines.push(`Regressed (${diff.regressed.length}):`);\n for (const e of diff.regressed.slice(0, limit)) {\n lines.push(fmtDiffLine(e));\n }\n const hidden = diff.regressed.length - (limit ?? diff.regressed.length);\n if (hidden > 0) lines.push(` ... ${hidden} more`);\n }\n\n if (diff.improved.length > 0) {\n lines.push('');\n lines.push(`Improved (${diff.improved.length}):`);\n for (const e of diff.improved.slice(0, limit)) {\n lines.push(fmtDiffLine(e));\n }\n const hidden = diff.improved.length - (limit ?? diff.improved.length);\n if (hidden > 0) lines.push(` ... ${hidden} more`);\n }\n\n if (diff.added.length > 0) {\n lines.push('');\n lines.push(`New (${diff.added.length}):`);\n for (const e of diff.added.slice(0, limit)) {\n lines.push(fmtDiffLine(e));\n }\n const hidden = diff.added.length - (limit ?? diff.added.length);\n if (hidden > 0) lines.push(` ... ${hidden} more`);\n }\n\n if (diff.removed.length > 0) {\n lines.push('');\n lines.push(`Removed (${diff.removed.length}):`);\n for (const e of diff.removed.slice(0, limit)) {\n lines.push(fmtDiffLine(e));\n }\n const hidden = diff.removed.length - (limit ?? diff.removed.length);\n if (hidden > 0) lines.push(` ... ${hidden} more`);\n }\n\n if (diff.regressed.length === 0 && diff.improved.length === 0 && diff.added.length === 0 && diff.removed.length === 0) {\n lines.push('');\n lines.push(`No significant changes (all within ${s.thresholdPct}% threshold)`);\n }\n\n return lines.join('\\n');\n}\n","import {\n ensureDaemon,\n sendCommand,\n stopDaemon,\n readDaemonInfo,\n setStateDir,\n} from './daemon-client.js';\nimport {\n formatTree,\n formatComponent,\n formatSearchResults,\n formatCount,\n formatErrors,\n formatStatus,\n formatProfileSummary,\n formatProfileReport,\n formatSlowest,\n formatRerenders,\n formatTimeline,\n formatCommitDetail,\n formatProfileDiff,\n} from './formatters.js';\nimport { writeFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport type { IpcCommand } from './types.js';\n\nfunction usage(): string {\n return `Usage: devtools <command> [options]\n\nSetup:\n init [--dry-run] Auto-configure your React app\n uninit [--dry-run] Remove configuration added by init\n\nDaemon:\n start [--port 8097] Start daemon\n stop Stop daemon\n status Show daemon status\n\nComponents:\n get tree [@c1 | id] [--depth N] [--all] [--max-lines N] Component hierarchy\n get component <@c1 | id> Props, state, hooks\n find <name> [--exact] Search by display name\n count Component count by type\n errors Components with errors/warnings\n\nWait:\n wait --connected [--timeout S] Block until an app connects\n wait --component <name> [--timeout S] Block until a component appears\n\nProfiling:\n profile start [name] Start profiling session\n profile stop Stop profiling, collect data\n profile report <@c1 | id> Render report for component\n profile slow [--limit N] Slowest components (by avg)\n profile rerenders [--limit N] Most re-rendered components\n profile timeline [--limit N] Commit timeline\n profile commit <N | #N> [--limit N] Detail for specific commit\n profile export <file> Export as React DevTools JSON\n profile diff <before.json> <after.json> [--limit N] [--threshold N] Compare two exports`;\n}\n\nfunction parseArgs(argv: string[]): {\n command: string[];\n flags: Record<string, string | boolean>;\n} {\n const command: string[] = [];\n const flags: Record<string, string | boolean> = {};\n\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i];\n if (arg.startsWith('--')) {\n const key = arg.slice(2);\n const eqIdx = key.indexOf('=');\n if (eqIdx !== -1) {\n flags[key.slice(0, eqIdx)] = key.slice(eqIdx + 1);\n } else {\n // Check if next arg is a value\n const next = argv[i + 1];\n if (next && !next.startsWith('--')) {\n flags[key] = next;\n i++;\n } else {\n flags[key] = true;\n }\n }\n } else {\n command.push(arg);\n }\n }\n return { command, flags };\n}\n\nfunction parseNumericFlag(\n flags: Record<string, string | boolean>,\n name: string,\n defaultValue?: number,\n): number | undefined {\n const raw = flags[name];\n if (raw === undefined || raw === true) return defaultValue;\n const n = parseInt(raw as string, 10);\n if (isNaN(n)) {\n console.error(`Invalid value for --${name}: expected a number`);\n process.exit(1);\n }\n return n;\n}\n\nasync function main(): Promise<void> {\n const { command, flags } = parseArgs(process.argv.slice(2));\n\n if (command.length === 0 || flags['help']) {\n console.log(usage());\n process.exit(0);\n }\n\n // Configure custom state directory (for test isolation)\n if (typeof flags['state-dir'] === 'string') {\n setStateDir(flags['state-dir']);\n }\n\n const cmd0 = command[0];\n const cmd1 = command[1];\n\n try {\n // ── Init / Uninit ──\n if (cmd0 === 'init') {\n const { runInit } = await import('./init.js');\n await runInit(process.cwd(), flags['dry-run'] === true);\n return;\n }\n\n if (cmd0 === 'uninit') {\n const { runUninit } = await import('./init.js');\n await runUninit(process.cwd(), flags['dry-run'] === true);\n return;\n }\n\n // ── Profile diff (no daemon needed) ──\n if (cmd0 === 'profile' && cmd1 === 'diff') {\n const fileA = command[2];\n const fileB = command[3];\n if (!fileA || !fileB) {\n console.error('Usage: devtools profile diff <before.json> <after.json> [--limit N] [--threshold N]');\n process.exit(1);\n }\n const { loadExportFile, diffProfiles } = await import('./profile-diff.js');\n let before: ReturnType<typeof loadExportFile>;\n let after: ReturnType<typeof loadExportFile>;\n try {\n before = loadExportFile(resolve(fileA));\n } catch (e) {\n console.error(`Error reading ${fileA}: ${(e as Error).message}`);\n process.exit(1);\n }\n try {\n after = loadExportFile(resolve(fileB));\n } catch (e) {\n console.error(`Error reading ${fileB}: ${(e as Error).message}`);\n process.exit(1);\n }\n const limit = parseNumericFlag(flags, 'limit');\n const threshold = parseNumericFlag(flags, 'threshold');\n const diff = diffProfiles(before, after, threshold);\n console.log(formatProfileDiff(diff, limit));\n return;\n }\n\n // ── Daemon management ──\n if (cmd0 === 'start') {\n const port = parseNumericFlag(flags, 'port');\n await ensureDaemon(port);\n const resp = await sendCommand({ type: 'status' });\n if (resp.ok) {\n console.log(formatStatus(resp.data as any));\n }\n return;\n }\n\n if (cmd0 === 'stop') {\n const stopped = stopDaemon();\n console.log(stopped ? 'Daemon stopped' : 'Daemon is not running');\n return;\n }\n\n if (cmd0 === 'status') {\n const info = readDaemonInfo();\n if (!info) {\n console.log('Daemon is not running');\n process.exit(1);\n }\n try {\n const resp = await sendCommand({ type: 'status' });\n if (resp.ok) {\n console.log(formatStatus(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n } catch {\n console.log('Daemon is not running (stale info)');\n process.exit(1);\n }\n return;\n }\n\n // ── All other commands require the daemon ──\n await ensureDaemon();\n\n // ── Component inspection ──\n if (cmd0 === 'get' && cmd1 === 'tree') {\n const depth = parseNumericFlag(flags, 'depth');\n const maxLines = parseNumericFlag(flags, 'max-lines');\n // Host components are filtered by default; --all includes them\n const noHost = flags['all'] !== true;\n // Parse optional root: `get tree @c5` or `get tree 5`\n const rawRoot = command[2];\n let root: number | string | undefined;\n if (rawRoot) {\n root = rawRoot.startsWith('@') ? rawRoot : parseInt(rawRoot, 10);\n if (typeof root === 'number' && isNaN(root)) {\n console.error('Usage: devtools get tree [@c1 | id] [--depth N] [--all] [--max-lines N]');\n process.exit(1);\n }\n }\n const ipcCmd: IpcCommand = { type: 'get-tree', depth, noHost, maxLines, root };\n const resp = await sendCommand(ipcCmd);\n if (resp.ok) {\n const { nodes, totalCount } = resp.data as any;\n console.log(formatTree(nodes, { hint: resp.hint, totalCount, maxLines }));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'get' && cmd1 === 'component') {\n const raw = command[2];\n if (!raw) {\n console.error('Usage: devtools get component <@c1 | id>');\n process.exit(1);\n }\n const id: number | string = raw.startsWith('@') ? raw : parseInt(raw, 10);\n if (typeof id === 'number' && isNaN(id)) {\n console.error('Usage: devtools get component <@c1 | id>');\n process.exit(1);\n }\n const resp = await sendCommand({ type: 'get-component', id });\n if (resp.ok) {\n console.log(formatComponent(resp.data as any, resp.label));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'find') {\n const name = command[1];\n if (!name) {\n console.error('Usage: devtools find <name> [--exact]');\n process.exit(1);\n }\n const exact = flags['exact'] === true;\n const resp = await sendCommand({ type: 'find', name, exact });\n if (resp.ok) {\n console.log(formatSearchResults(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'count') {\n const resp = await sendCommand({ type: 'count' });\n if (resp.ok) {\n console.log(formatCount(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'errors') {\n const resp = await sendCommand({ type: 'errors' });\n if (resp.ok) {\n console.log(formatErrors(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n // ── Wait ──\n if (cmd0 === 'wait') {\n const timeoutSec = parseNumericFlag(flags, 'timeout', 30)!;\n const timeoutMs = timeoutSec * 1000;\n const socketTimeout = timeoutMs + 5000;\n\n let ipcCmd: IpcCommand;\n if (flags['connected'] !== undefined) {\n ipcCmd = { type: 'wait', condition: 'connected', timeout: timeoutMs };\n } else if (flags['component'] !== undefined) {\n if (typeof flags['component'] !== 'string') {\n console.error('Usage: devtools wait --component <name> [--timeout S]');\n process.exit(1);\n }\n ipcCmd = { type: 'wait', condition: 'component', name: flags['component'], timeout: timeoutMs };\n } else {\n console.error('Usage: devtools wait --connected|--component <name> [--timeout S]');\n process.exit(1);\n }\n\n const resp = await sendCommand(ipcCmd, socketTimeout);\n if (resp.ok) {\n const result = resp.data as { met: boolean; condition: string; timeout?: boolean };\n if (result.met) {\n console.log(`Condition met: ${result.condition}`);\n } else {\n console.error(`Timed out waiting for: ${result.condition}`);\n process.exit(1);\n }\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n // ── Profiling ──\n if (cmd0 === 'profile' && cmd1 === 'start') {\n const name = command[2];\n const resp = await sendCommand({ type: 'profile-start', name });\n if (resp.ok) {\n console.log(resp.data);\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'profile' && cmd1 === 'stop') {\n const resp = await sendCommand({ type: 'profile-stop' });\n if (resp.ok) {\n console.log(formatProfileSummary(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'profile' && cmd1 === 'report') {\n const raw = command[2];\n if (!raw) {\n console.error('Usage: devtools profile report <@c1 | id>');\n process.exit(1);\n }\n const componentId: number | string = raw.startsWith('@') ? raw : parseInt(raw, 10);\n if (typeof componentId === 'number' && isNaN(componentId)) {\n console.error('Usage: devtools profile report <@c1 | id>');\n process.exit(1);\n }\n const resp = await sendCommand({ type: 'profile-report', componentId });\n if (resp.ok) {\n console.log(formatProfileReport(resp.data as any, resp.label));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'profile' && cmd1 === 'slow') {\n const limit = parseNumericFlag(flags, 'limit');\n const resp = await sendCommand({ type: 'profile-slow', limit });\n if (resp.ok) {\n console.log(formatSlowest(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'profile' && cmd1 === 'rerenders') {\n const limit = parseNumericFlag(flags, 'limit');\n const resp = await sendCommand({ type: 'profile-rerenders', limit });\n if (resp.ok) {\n console.log(formatRerenders(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'profile' && cmd1 === 'commit') {\n const raw = command[2];\n if (!raw) {\n console.error('Usage: devtools profile commit <N | #N>');\n process.exit(1);\n }\n const index = parseInt(raw.replace(/^#/, ''), 10);\n if (isNaN(index)) {\n console.error('Usage: devtools profile commit <N | #N>');\n process.exit(1);\n }\n const limit = parseNumericFlag(flags, 'limit');\n const resp = await sendCommand({ type: 'profile-commit', index, limit });\n if (resp.ok) {\n console.log(formatCommitDetail(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'profile' && cmd1 === 'timeline') {\n const limit = parseNumericFlag(flags, 'limit');\n const offset = parseNumericFlag(flags, 'offset');\n const sortFlag = flags['sort'];\n const sort = sortFlag === 'duration' ? 'duration' as const\n : sortFlag === 'timeline' ? 'timeline' as const\n : undefined;\n const resp = await sendCommand({ type: 'profile-timeline', limit, offset, sort });\n if (resp.ok) {\n console.log(formatTimeline(resp.data as any));\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n if (cmd0 === 'profile' && cmd1 === 'export') {\n const file = command[2];\n if (!file) {\n console.error('Usage: devtools profile export <file>');\n process.exit(1);\n }\n const resp = await sendCommand({ type: 'profile-export' });\n if (resp.ok) {\n const outPath = resolve(file);\n writeFileSync(outPath, JSON.stringify(resp.data), 'utf-8');\n console.log(`Exported to ${outPath}`);\n } else {\n console.error(resp.error);\n process.exit(1);\n }\n return;\n }\n\n console.error(`Unknown command: ${command.join(' ')}`);\n console.log(usage());\n process.exit(1);\n } catch (err) {\n console.error(\n err instanceof Error ? err.message : String(err),\n );\n process.exit(1);\n }\n}\n\nmain();\n"],"mappings":";;;AAAA,OAAO,SAAS;AAChB,OAAO,QAAQ;AACf,OAAO,UAAU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