@posthog/wizard 2.74.0 → 2.75.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 (117) hide show
  1. package/README.md +41 -27
  2. package/dist/README.md +10 -0
  3. package/dist/{add-mcp-server-to-clients-BtWwRG7O.js → add-mcp-server-to-clients-CjfnPMbO.js} +5 -5
  4. package/dist/{add-mcp-server-to-clients-BtWwRG7O.js.map → add-mcp-server-to-clients-CjfnPMbO.js.map} +1 -1
  5. package/dist/{agent-interface-CK6pmvkF.js → agent-interface-BKLTDSyN.js} +144 -338
  6. package/dist/agent-interface-BKLTDSyN.js.map +1 -0
  7. package/dist/{agent-prompt-loader-CPCNMvGh.js → agent-prompt-loader-DAagxT3p.js} +5 -5
  8. package/dist/{agent-prompt-loader-CPCNMvGh.js.map → agent-prompt-loader-DAagxT3p.js.map} +1 -1
  9. package/dist/{agent-runner-jz4yiJfh.js → agent-runner-BkQontri.js} +136 -46
  10. package/dist/agent-runner-BkQontri.js.map +1 -0
  11. package/dist/{analytics-DZNb3aRN.js → analytics-DSK0GXg1.js} +6 -4
  12. package/dist/analytics-DSK0GXg1.js.map +1 -0
  13. package/dist/analytics-yurAACt5.js +2 -0
  14. package/dist/{api-DXGaiK94.js → api-CwNulLDK.js} +3 -3
  15. package/dist/{api-DXGaiK94.js.map → api-CwNulLDK.js.map} +1 -1
  16. package/dist/bin.js +125 -4072
  17. package/dist/bin.js.map +1 -1
  18. package/dist/{bounded-fs-CErPpkN2.js → bounded-fs-D85Tk3nS.js} +3 -3
  19. package/dist/{bounded-fs-CErPpkN2.js.map → bounded-fs-D85Tk3nS.js.map} +1 -1
  20. package/dist/{ci-install-CzWzi_qu.js → ci-install-CQLi_a-r.js} +4 -4
  21. package/dist/{ci-install-CzWzi_qu.js.map → ci-install-CQLi_a-r.js.map} +1 -1
  22. package/dist/{debug-D4y9vVWt.js → debug-CBmI5YUF.js} +1 -1
  23. package/dist/{debug-ECdmmlDM.js → debug-DUmMVUHn.js} +14 -335
  24. package/dist/debug-DUmMVUHn.js.map +1 -0
  25. package/dist/{defaults-DI642M3n.js → defaults-DDDwYTN5.js} +1 -1
  26. package/dist/{defaults-DI642M3n.js.map → defaults-DDDwYTN5.js.map} +1 -1
  27. package/dist/{env-api-key-g5w775Ve.js → env-api-key-CGC1Bqwq.js} +2 -2
  28. package/dist/{env-api-key-g5w775Ve.js.map → env-api-key-CGC1Bqwq.js.map} +1 -1
  29. package/dist/{environment-DDkdsWUr.js → environment-DC4RDnzR.js} +4 -4
  30. package/dist/{environment-DDkdsWUr.js.map → environment-DC4RDnzR.js.map} +1 -1
  31. package/dist/{file-watcher-BNdFPlI8.js → file-watcher-hafFFQib.js} +2 -2
  32. package/dist/{file-watcher-BNdFPlI8.js.map → file-watcher-hafFFQib.js.map} +1 -1
  33. package/dist/gateway-session-Ctc2xaz7.js +271 -0
  34. package/dist/gateway-session-Ctc2xaz7.js.map +1 -0
  35. package/dist/gateway-session-zwwZAyTt.js +2 -0
  36. package/dist/{headless-ui-DBZCl4CG.js → headless-ui-CQ46FOTh.js} +2 -2
  37. package/dist/{headless-ui-DBZCl4CG.js.map → headless-ui-CQ46FOTh.js.map} +1 -1
  38. package/dist/{interactive-BKxXUB0T.js → interactive-5O4XQf59.js} +2 -2
  39. package/dist/{interactive-BKxXUB0T.js.map → interactive-5O4XQf59.js.map} +1 -1
  40. package/dist/{mcp-CwM45_Kp.js → mcp-D0Dni4tL.js} +2 -2
  41. package/dist/{mcp-CwM45_Kp.js.map → mcp-D0Dni4tL.js.map} +1 -1
  42. package/dist/{mcp-prompt-streaming-R8H7uhuO.js → mcp-prompt-streaming-DNCDeU51.js} +6 -5
  43. package/dist/{mcp-prompt-streaming-R8H7uhuO.js.map → mcp-prompt-streaming-DNCDeU51.js.map} +1 -1
  44. package/dist/mint-failure-CQqypC_v.js +5718 -0
  45. package/dist/mint-failure-CQqypC_v.js.map +1 -0
  46. package/dist/{non-interactive-DxzBwNxJ.js → non-interactive-D5-lCBy6.js} +2 -2
  47. package/dist/{non-interactive-DxzBwNxJ.js.map → non-interactive-D5-lCBy6.js.map} +1 -1
  48. package/dist/{orchestrator-tools-CTpKnk5-.js → orchestrator-tools-D8ZQS2DM.js} +5 -5
  49. package/dist/orchestrator-tools-D8ZQS2DM.js.map +1 -0
  50. package/dist/{package-manager-Bi6gaPa4.js → package-manager-hyP-CPSZ.js} +2 -2
  51. package/dist/{package-manager-Bi6gaPa4.js.map → package-manager-hyP-CPSZ.js.map} +1 -1
  52. package/dist/{pi-DpWFwz5u.js → pi-DARAk2I_.js} +35 -24
  53. package/dist/pi-DARAk2I_.js.map +1 -0
  54. package/dist/{playground-BtTCVaSD.js → playground-Djabnagq.js} +13 -65
  55. package/dist/playground-Djabnagq.js.map +1 -0
  56. package/dist/{posthog-B99H8Zyk.js → posthog-C3Sncfan.js} +2 -2
  57. package/dist/{posthog-B99H8Zyk.js.map → posthog-C3Sncfan.js.map} +1 -1
  58. package/dist/{provisioning-BewSEuFX.js → provisioning-B74q1uSQ.js} +3 -3
  59. package/dist/{provisioning-BewSEuFX.js.map → provisioning-B74q1uSQ.js.map} +1 -1
  60. package/dist/{queue-tools-CbRM-OET.js → queue-tools-FLMG8hcB.js} +34 -9
  61. package/dist/queue-tools-FLMG8hcB.js.map +1 -0
  62. package/dist/{registry-Bt2Mc4vC.js → registry-DZoReEU3.js} +5 -5
  63. package/dist/{registry-Bt2Mc4vC.js.map → registry-DZoReEU3.js.map} +1 -1
  64. package/dist/{security-Cmxb64bz.js → security-DiBFYwh7.js} +5 -5
  65. package/dist/{security-Cmxb64bz.js.map → security-DiBFYwh7.js.map} +1 -1
  66. package/dist/{setup-utils-CCphwDIz.js → setup-utils-C3tsa6D6.js} +48 -9
  67. package/dist/setup-utils-C3tsa6D6.js.map +1 -0
  68. package/dist/smoke-test-ci.sh +9 -14
  69. package/dist/{start-tui-BRwZzlWb.js → start-tui-BXjJGNx2.js} +849 -115
  70. package/dist/start-tui-BXjJGNx2.js.map +1 -0
  71. package/dist/{steps-CJrx1t72.js → steps-CeFanezY.js} +7 -7
  72. package/dist/{steps-CJrx1t72.js.map → steps-CeFanezY.js.map} +1 -1
  73. package/dist/{store-BhcCTIn4.js → store-DN_6FaoQ.js} +66 -28
  74. package/dist/store-DN_6FaoQ.js.map +1 -0
  75. package/dist/{subagent-BeMPBF5r.js → subagent-BzhCH9c3.js} +2 -2
  76. package/dist/{subagent-BeMPBF5r.js.map → subagent-BzhCH9c3.js.map} +1 -1
  77. package/dist/{task-DX3eZgBL.js → task-DZKmaWYF.js} +19 -22
  78. package/dist/task-DZKmaWYF.js.map +1 -0
  79. package/dist/{task-stream-BW7BG70C.js → task-stream-h-b1nWdM.js} +5 -5
  80. package/dist/{task-stream-BW7BG70C.js.map → task-stream-h-b1nWdM.js.map} +1 -1
  81. package/dist/{tasks-Did1AR7v.js → tasks-0Rb5AXpz.js} +2 -2
  82. package/dist/{tasks-Did1AR7v.js.map → tasks-0Rb5AXpz.js.map} +1 -1
  83. package/dist/{telemetry-CPWHrsXK.js → telemetry-QpeVhVtU.js} +3 -3
  84. package/dist/{telemetry-CPWHrsXK.js.map → telemetry-QpeVhVtU.js.map} +1 -1
  85. package/dist/{terminal-CpVFsbGu.js → terminal-dLoYiXsd.js} +24 -65
  86. package/dist/terminal-dLoYiXsd.js.map +1 -0
  87. package/dist/{tools-DjiwCd53.js → tools-DmwO0eBZ.js} +22 -16
  88. package/dist/tools-DmwO0eBZ.js.map +1 -0
  89. package/dist/{wizard-abort-RUnY1Dax.js → wizard-abort-B0c5VDie.js} +4 -4
  90. package/dist/{wizard-abort-RUnY1Dax.js.map → wizard-abort-B0c5VDie.js.map} +1 -1
  91. package/dist/{wizard-abort-DjJ-6y6S.js → wizard-abort-C9Jbm-m7.js} +1 -1
  92. package/dist/{wizard-session-BWAQoi9q.js → wizard-session-CYvyYnti.js} +1 -1
  93. package/dist/{wizard-session-GdDN_aMS.js → wizard-session-FSJCkTcP.js} +9 -2
  94. package/dist/wizard-session-FSJCkTcP.js.map +1 -0
  95. package/dist/yara-hooks-B7prW1Ng.js +2 -0
  96. package/dist/{yara-hooks-jBqAkgxw.js → yara-hooks-uCiAIcqU.js} +4 -4
  97. package/dist/{yara-hooks-jBqAkgxw.js.map → yara-hooks-uCiAIcqU.js.map} +1 -1
  98. package/package.json +1 -1
  99. package/dist/agent-interface-CK6pmvkF.js.map +0 -1
  100. package/dist/agent-runner-jz4yiJfh.js.map +0 -1
  101. package/dist/analytics-CfadnLFG.js +0 -2
  102. package/dist/analytics-DZNb3aRN.js.map +0 -1
  103. package/dist/debug-ECdmmlDM.js.map +0 -1
  104. package/dist/orchestrator-tools-CTpKnk5-.js.map +0 -1
  105. package/dist/pi-DpWFwz5u.js.map +0 -1
  106. package/dist/playground-BtTCVaSD.js.map +0 -1
  107. package/dist/posthog-integration-CxvkKY1j.js +0 -1475
  108. package/dist/posthog-integration-CxvkKY1j.js.map +0 -1
  109. package/dist/queue-tools-CbRM-OET.js.map +0 -1
  110. package/dist/setup-utils-CCphwDIz.js.map +0 -1
  111. package/dist/start-tui-BRwZzlWb.js.map +0 -1
  112. package/dist/store-BhcCTIn4.js.map +0 -1
  113. package/dist/task-DX3eZgBL.js.map +0 -1
  114. package/dist/terminal-CpVFsbGu.js.map +0 -1
  115. package/dist/tools-DjiwCd53.js.map +0 -1
  116. package/dist/wizard-session-GdDN_aMS.js.map +0 -1
  117. package/dist/yara-hooks-CBMSmD9F.js +0 -2
@@ -1,5 +1,5 @@
1
- import { s as logToFile } from "./debug-ECdmmlDM.js";
2
- import { n as analytics } from "./analytics-DZNb3aRN.js";
1
+ import { s as logToFile } from "./debug-DUmMVUHn.js";
2
+ import { n as analytics } from "./analytics-DSK0GXg1.js";
3
3
  import fs from "fs";
4
4
  import path from "path";
5
5
  import fg from "fast-glob";
@@ -239,4 +239,4 @@ function readFileHead(filePath, bytes) {
239
239
  //#endregion
240
240
  export { safeReadFile as a, readProjectFile as i, boundedGlob as n, walkProjectFiles as o, readFileHead as r, IGNORED_DIRS as t };
241
241
 
242
- //# sourceMappingURL=bounded-fs-CErPpkN2.js.map
242
+ //# sourceMappingURL=bounded-fs-D85Tk3nS.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bounded-fs-CErPpkN2.js","names":[],"sources":["../src/utils/bounded-fs.ts"],"sourcesContent":["/**\n * Bounded filesystem primitives for scanning USER project trees. Every\n * detection-time glob, walk, and project-file read goes through here so the\n * worst case is a constant, never a function of the user's repo.\n */\nimport path from 'path';\nimport fs from 'fs';\nimport type { Dirent } from 'fs';\nimport fg from 'fast-glob';\nimport { analytics } from './analytics';\nimport { logToFile } from './debug';\nimport type { WizardRunOptions } from './types';\n\n/**\n * Errno codes that are expected while walking an arbitrary tree and mean\n * \"skip this entry\", not \"something is broken\". Scanning from a broad dir\n * (e.g. `~`) routinely hits OS-protected paths (macOS `Library/Group\n * Containers/group.com.apple.*`) that throw EPERM/EACCES per entry — capturing\n * each as an exception buried real errors under thousands of noise events.\n */\nconst BENIGN_FS_ERROR_CODES = new Set<string>([\n 'EACCES', // permission denied\n 'EPERM', // operation not permitted (macOS-protected dirs)\n 'ENOENT', // entry vanished mid-walk\n 'ENOTDIR', // path component isn't a directory\n 'ELOOP', // symlink loop\n 'ENAMETOOLONG', // path too long\n 'EMFILE', // too many open files (environmental, not a wizard bug)\n 'ENFILE',\n]);\n\n/**\n * Report a swallowed filesystem error. Traversal stays best-effort — the caller\n * still skips the failing entry. Expected errno codes (permission denied, entry\n * vanished, symlink loops…) are logged to the debug file only; anything else is\n * genuinely unexpected and gets captured to error tracking. Preserves the\n * original Error (and its `code`, e.g. EACCES / ENOENT) when available.\n */\nfunction reportFsError(step: string, filePath: string, error: unknown): void {\n const code = (error as NodeJS.ErrnoException | null)?.code;\n if (code && BENIGN_FS_ERROR_CODES.has(code)) {\n logToFile(`[bounded-fs] skipped ${step} (${code}): ${filePath}`);\n return;\n }\n analytics.captureException(\n error instanceof Error ? error : new Error(String(error)),\n { step, path: filePath },\n );\n}\n\nexport function getDotGitignore({\n installDir,\n}: Pick<WizardRunOptions, 'installDir'>) {\n const gitignorePath = path.join(installDir, '.gitignore');\n const gitignoreExists = fs.existsSync(gitignorePath);\n\n if (gitignoreExists) {\n return gitignorePath;\n }\n\n return undefined;\n}\n\n/**\n * Directory names to skip when scanning a project tree — dependency\n * directories, build output, virtual environments, vendored trees.\n * Used verbatim by walkProjectFiles and as glob patterns by boundedGlob.\n */\nexport const IGNORED_DIRS = new Set<string>([\n 'node_modules',\n '.git',\n '.next',\n '.nuxt',\n '.svelte-kit',\n '.turbo',\n '.cache',\n '.parcel-cache',\n 'dist',\n 'build',\n 'out',\n 'coverage',\n '.coverage',\n 'venv',\n '.venv',\n '__pycache__',\n '.pytest_cache',\n 'vendor',\n 'target',\n '.gradle',\n '.idea',\n '.vscode',\n 'site-packages',\n 'DerivedData',\n 'Pods',\n]);\n\n/** IGNORED_DIRS as fast-glob ignore patterns. */\nexport const PROJECT_IGNORE_GLOBS: readonly string[] = [...IGNORED_DIRS].map(\n (dir) => `**/${dir}/**`,\n);\n\n// Files larger than this are skipped, never materialized.\nexport const MAX_PROJECT_FILE_BYTES = 2 * 1024 * 1024;\n\n// A glob returns at most this many entries.\nexport const MAX_GLOB_MATCHES = 500;\n\n// A glob's traversal is destroyed after this long, even when abandoned.\nexport const GLOB_DEADLINE_MS = 8_000;\n\n// A directory contributes at most this many entries to a walk.\nexport const MAX_DIR_ENTRIES = 10_000;\n\n// A walk fires at most this many onFile callbacks.\nexport const MAX_WALK_FILES = 100_000;\n\nexport interface BoundedGlobOptions {\n cwd: string;\n /** Appended to PROJECT_IGNORE_GLOBS. */\n extraIgnore?: readonly string[];\n /** Stop after this many matches. Defaults to MAX_GLOB_MATCHES. */\n limit?: number;\n /** Match dotfiles. Traversal of dot-DIRECTORIES stays blocked by the ignore set. */\n dot?: boolean;\n /** fast-glob `deep` — maximum directory depth. */\n deep?: number;\n}\n\n/**\n * Streams matches, stops at `limit`, destroys the crawl at GLOB_DEADLINE_MS.\n * Returns paths relative to `cwd`, possibly truncated.\n */\nexport async function boundedGlob(\n patterns: string | string[],\n options: BoundedGlobOptions,\n): Promise<string[]> {\n const limit = options.limit ?? MAX_GLOB_MATCHES;\n const stream = fg.stream(patterns, {\n cwd: options.cwd,\n dot: options.dot ?? false,\n onlyFiles: true,\n deep: options.deep,\n ignore: [...PROJECT_IGNORE_GLOBS, ...(options.extraIgnore ?? [])],\n suppressErrors: true,\n followSymbolicLinks: false,\n });\n\n const matches: string[] = [];\n return new Promise((resolve) => {\n let settled = false;\n const finish = (): void => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n resolve(matches);\n };\n const timer = setTimeout(() => {\n stream.destroy();\n finish();\n }, GLOB_DEADLINE_MS);\n stream.on('data', (entry: string | Buffer) => {\n matches.push(String(entry));\n if (matches.length >= limit) {\n stream.destroy();\n finish();\n }\n });\n stream.once('error', finish);\n stream.once('end', finish);\n stream.once('close', finish);\n });\n}\n\n/**\n * Walk a project tree, invoking `onFile(name, fullPath)` for every regular\n * file — including dotfiles like `.env` (the caller decides what it cares\n * about). Skips `IGNORED_DIRS` and hidden directories, follows symlinked\n * directories with realpath-based loop protection, descends at most\n * `maxDepth` levels below `rootDir`, and stops at the per-directory and\n * whole-walk caps. Filesystem errors are reported and skipped (best-effort).\n */\nexport function walkProjectFiles(\n rootDir: string,\n onFile: (name: string, fullPath: string) => void,\n maxDepth = 3,\n): void {\n const visited = new Set<string>();\n let filesSeen = 0;\n // Explicit stack — no call-stack recursion.\n const stack: Array<{ dir: string; depth: number }> = [\n { dir: rootDir, depth: 0 },\n ];\n\n while (stack.length > 0 && filesSeen < MAX_WALK_FILES) {\n const { dir, depth } = stack.pop()!;\n\n // realpath both resolves symlinked dirs and gives us a stable key to\n // detect loops (symlink cycles, e.g. a -> ../a).\n let realDir: string;\n try {\n realDir = fs.realpathSync(dir);\n } catch (error) {\n reportFsError('walkProjectFiles.realpath', dir, error);\n continue;\n }\n if (visited.has(realDir)) continue;\n visited.add(realDir);\n\n let handle: fs.Dir;\n try {\n handle = fs.opendirSync(dir);\n } catch (error) {\n reportFsError('walkProjectFiles.opendir', dir, error);\n continue;\n }\n try {\n let entriesRead = 0;\n let entry: Dirent | null;\n while ((entry = handle.readSync()) !== null) {\n if (++entriesRead > MAX_DIR_ENTRIES || filesSeen >= MAX_WALK_FILES) {\n logToFile(\n `[bounded-fs] walk capped in ${dir} (entries=${entriesRead}, files=${filesSeen})`,\n );\n break;\n }\n if (IGNORED_DIRS.has(entry.name)) continue;\n\n const fullPath = path.join(dir, entry.name);\n\n // Symlinks report isDirectory()/isFile() as false under withFileTypes,\n // so resolve the target before deciding how to handle the entry.\n let isDir = entry.isDirectory();\n let isFile = entry.isFile();\n if (entry.isSymbolicLink()) {\n try {\n const st = fs.statSync(fullPath);\n isDir = st.isDirectory();\n isFile = st.isFile();\n } catch (error) {\n reportFsError('walkProjectFiles.stat', fullPath, error);\n continue;\n }\n }\n\n if (isDir) {\n if (entry.name.startsWith('.')) continue; // skip hidden directories\n if (depth < maxDepth) stack.push({ dir: fullPath, depth: depth + 1 });\n } else if (isFile) {\n filesSeen += 1;\n onFile(entry.name, fullPath);\n }\n }\n } finally {\n try {\n handle.closeSync();\n } catch {\n /* already closed */\n }\n }\n }\n}\n\n/**\n * Read a project file as UTF-8, or null when missing, unreadable, or over\n * `maxBytes` (stat-gated: an oversized file is never materialized).\n */\nexport function readProjectFile(\n filePath: string,\n maxBytes = MAX_PROJECT_FILE_BYTES,\n): string | null {\n try {\n if (fs.statSync(filePath).size > maxBytes) return null;\n return fs.readFileSync(filePath, 'utf-8');\n } catch {\n return null;\n }\n}\n\n/**\n * `readProjectFile` that also reports unexpected errors to error tracking.\n * For walk callbacks where a failing read is worth a telemetry breadcrumb.\n */\nexport function safeReadFile(fullPath: string): string | null {\n try {\n if (fs.statSync(fullPath).size > MAX_PROJECT_FILE_BYTES) {\n logToFile(`[bounded-fs] skipped oversized file: ${fullPath}`);\n return null;\n }\n return fs.readFileSync(fullPath, 'utf-8');\n } catch (error) {\n reportFsError('safeReadFile', fullPath, error);\n return null;\n }\n}\n\n/**\n * The first `bytes` of a file without materializing the rest.\n */\nexport function readFileHead(filePath: string, bytes: number): string | null {\n try {\n const fd = fs.openSync(filePath, 'r');\n try {\n const buffer = Buffer.alloc(bytes);\n const read = fs.readSync(fd, buffer, 0, bytes, 0);\n return buffer.toString('utf-8', 0, read);\n } finally {\n fs.closeSync(fd);\n }\n } catch {\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,MAAM,wBAAwB,IAAI,IAAY;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;;;;AASF,SAAS,cAAc,MAAc,UAAkB,OAAsB;CAC3E,MAAM,OAAQ,OAAwC;AACtD,KAAI,QAAQ,sBAAsB,IAAI,KAAK,EAAE;AAC3C,YAAU,wBAAwB,KAAK,IAAI,KAAK,KAAK,WAAW;AAChE;;AAEF,WAAU,iBACR,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC,EACzD;EAAE;EAAM,MAAM;EAAU,CACzB;;;;;;;AAqBH,MAAa,eAAe,IAAI,IAAY;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;AAGF,MAAa,uBAA0C,CAAC,GAAG,aAAa,CAAC,KACtE,QAAQ,MAAM,IAAI,KACpB;AAGD,MAAa,yBAAyB,IAAI,OAAO;AAMjD,MAAa,mBAAmB;;;;;AAwBhC,eAAsB,YACpB,UACA,SACmB;CACnB,MAAM,QAAQ,QAAQ,SAAA;CACtB,MAAM,SAAS,GAAG,OAAO,UAAU;EACjC,KAAK,QAAQ;EACb,KAAK,QAAQ,OAAO;EACpB,WAAW;EACX,MAAM,QAAQ;EACd,QAAQ,CAAC,GAAG,sBAAsB,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AAG,KAAK;YAChC;AACR,MAAG,UAAU,GAAG;;SAEZ;AACN,SAAO"}
1
+ {"version":3,"file":"bounded-fs-D85Tk3nS.js","names":[],"sources":["../src/utils/bounded-fs.ts"],"sourcesContent":["/**\n * Bounded filesystem primitives for scanning USER project trees. Every\n * detection-time glob, walk, and project-file read goes through here so the\n * worst case is a constant, never a function of the user's repo.\n */\nimport path from 'path';\nimport fs from 'fs';\nimport type { Dirent } from 'fs';\nimport fg from 'fast-glob';\nimport { analytics } from './analytics';\nimport { logToFile } from './debug';\nimport type { WizardRunOptions } from './types';\n\n/**\n * Errno codes that are expected while walking an arbitrary tree and mean\n * \"skip this entry\", not \"something is broken\". Scanning from a broad dir\n * (e.g. `~`) routinely hits OS-protected paths (macOS `Library/Group\n * Containers/group.com.apple.*`) that throw EPERM/EACCES per entry — capturing\n * each as an exception buried real errors under thousands of noise events.\n */\nconst BENIGN_FS_ERROR_CODES = new Set<string>([\n 'EACCES', // permission denied\n 'EPERM', // operation not permitted (macOS-protected dirs)\n 'ENOENT', // entry vanished mid-walk\n 'ENOTDIR', // path component isn't a directory\n 'ELOOP', // symlink loop\n 'ENAMETOOLONG', // path too long\n 'EMFILE', // too many open files (environmental, not a wizard bug)\n 'ENFILE',\n]);\n\n/**\n * Report a swallowed filesystem error. Traversal stays best-effort — the caller\n * still skips the failing entry. Expected errno codes (permission denied, entry\n * vanished, symlink loops…) are logged to the debug file only; anything else is\n * genuinely unexpected and gets captured to error tracking. Preserves the\n * original Error (and its `code`, e.g. EACCES / ENOENT) when available.\n */\nfunction reportFsError(step: string, filePath: string, error: unknown): void {\n const code = (error as NodeJS.ErrnoException | null)?.code;\n if (code && BENIGN_FS_ERROR_CODES.has(code)) {\n logToFile(`[bounded-fs] skipped ${step} (${code}): ${filePath}`);\n return;\n }\n analytics.captureException(\n error instanceof Error ? error : new Error(String(error)),\n { step, path: filePath },\n );\n}\n\nexport function getDotGitignore({\n installDir,\n}: Pick<WizardRunOptions, 'installDir'>) {\n const gitignorePath = path.join(installDir, '.gitignore');\n const gitignoreExists = fs.existsSync(gitignorePath);\n\n if (gitignoreExists) {\n return gitignorePath;\n }\n\n return undefined;\n}\n\n/**\n * Directory names to skip when scanning a project tree — dependency\n * directories, build output, virtual environments, vendored trees.\n * Used verbatim by walkProjectFiles and as glob patterns by boundedGlob.\n */\nexport const IGNORED_DIRS = new Set<string>([\n 'node_modules',\n '.git',\n '.next',\n '.nuxt',\n '.svelte-kit',\n '.turbo',\n '.cache',\n '.parcel-cache',\n 'dist',\n 'build',\n 'out',\n 'coverage',\n '.coverage',\n 'venv',\n '.venv',\n '__pycache__',\n '.pytest_cache',\n 'vendor',\n 'target',\n '.gradle',\n '.idea',\n '.vscode',\n 'site-packages',\n 'DerivedData',\n 'Pods',\n]);\n\n/** IGNORED_DIRS as fast-glob ignore patterns. */\nexport const PROJECT_IGNORE_GLOBS: readonly string[] = [...IGNORED_DIRS].map(\n (dir) => `**/${dir}/**`,\n);\n\n// Files larger than this are skipped, never materialized.\nexport const MAX_PROJECT_FILE_BYTES = 2 * 1024 * 1024;\n\n// A glob returns at most this many entries.\nexport const MAX_GLOB_MATCHES = 500;\n\n// A glob's traversal is destroyed after this long, even when abandoned.\nexport const GLOB_DEADLINE_MS = 8_000;\n\n// A directory contributes at most this many entries to a walk.\nexport const MAX_DIR_ENTRIES = 10_000;\n\n// A walk fires at most this many onFile callbacks.\nexport const MAX_WALK_FILES = 100_000;\n\nexport interface BoundedGlobOptions {\n cwd: string;\n /** Appended to PROJECT_IGNORE_GLOBS. */\n extraIgnore?: readonly string[];\n /** Stop after this many matches. Defaults to MAX_GLOB_MATCHES. */\n limit?: number;\n /** Match dotfiles. Traversal of dot-DIRECTORIES stays blocked by the ignore set. */\n dot?: boolean;\n /** fast-glob `deep` — maximum directory depth. */\n deep?: number;\n}\n\n/**\n * Streams matches, stops at `limit`, destroys the crawl at GLOB_DEADLINE_MS.\n * Returns paths relative to `cwd`, possibly truncated.\n */\nexport async function boundedGlob(\n patterns: string | string[],\n options: BoundedGlobOptions,\n): Promise<string[]> {\n const limit = options.limit ?? MAX_GLOB_MATCHES;\n const stream = fg.stream(patterns, {\n cwd: options.cwd,\n dot: options.dot ?? false,\n onlyFiles: true,\n deep: options.deep,\n ignore: [...PROJECT_IGNORE_GLOBS, ...(options.extraIgnore ?? [])],\n suppressErrors: true,\n followSymbolicLinks: false,\n });\n\n const matches: string[] = [];\n return new Promise((resolve) => {\n let settled = false;\n const finish = (): void => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n resolve(matches);\n };\n const timer = setTimeout(() => {\n stream.destroy();\n finish();\n }, GLOB_DEADLINE_MS);\n stream.on('data', (entry: string | Buffer) => {\n matches.push(String(entry));\n if (matches.length >= limit) {\n stream.destroy();\n finish();\n }\n });\n stream.once('error', finish);\n stream.once('end', finish);\n stream.once('close', finish);\n });\n}\n\n/**\n * Walk a project tree, invoking `onFile(name, fullPath)` for every regular\n * file — including dotfiles like `.env` (the caller decides what it cares\n * about). Skips `IGNORED_DIRS` and hidden directories, follows symlinked\n * directories with realpath-based loop protection, descends at most\n * `maxDepth` levels below `rootDir`, and stops at the per-directory and\n * whole-walk caps. Filesystem errors are reported and skipped (best-effort).\n */\nexport function walkProjectFiles(\n rootDir: string,\n onFile: (name: string, fullPath: string) => void,\n maxDepth = 3,\n): void {\n const visited = new Set<string>();\n let filesSeen = 0;\n // Explicit stack — no call-stack recursion.\n const stack: Array<{ dir: string; depth: number }> = [\n { dir: rootDir, depth: 0 },\n ];\n\n while (stack.length > 0 && filesSeen < MAX_WALK_FILES) {\n const { dir, depth } = stack.pop()!;\n\n // realpath both resolves symlinked dirs and gives us a stable key to\n // detect loops (symlink cycles, e.g. a -> ../a).\n let realDir: string;\n try {\n realDir = fs.realpathSync(dir);\n } catch (error) {\n reportFsError('walkProjectFiles.realpath', dir, error);\n continue;\n }\n if (visited.has(realDir)) continue;\n visited.add(realDir);\n\n let handle: fs.Dir;\n try {\n handle = fs.opendirSync(dir);\n } catch (error) {\n reportFsError('walkProjectFiles.opendir', dir, error);\n continue;\n }\n try {\n let entriesRead = 0;\n let entry: Dirent | null;\n while ((entry = handle.readSync()) !== null) {\n if (++entriesRead > MAX_DIR_ENTRIES || filesSeen >= MAX_WALK_FILES) {\n logToFile(\n `[bounded-fs] walk capped in ${dir} (entries=${entriesRead}, files=${filesSeen})`,\n );\n break;\n }\n if (IGNORED_DIRS.has(entry.name)) continue;\n\n const fullPath = path.join(dir, entry.name);\n\n // Symlinks report isDirectory()/isFile() as false under withFileTypes,\n // so resolve the target before deciding how to handle the entry.\n let isDir = entry.isDirectory();\n let isFile = entry.isFile();\n if (entry.isSymbolicLink()) {\n try {\n const st = fs.statSync(fullPath);\n isDir = st.isDirectory();\n isFile = st.isFile();\n } catch (error) {\n reportFsError('walkProjectFiles.stat', fullPath, error);\n continue;\n }\n }\n\n if (isDir) {\n if (entry.name.startsWith('.')) continue; // skip hidden directories\n if (depth < maxDepth) stack.push({ dir: fullPath, depth: depth + 1 });\n } else if (isFile) {\n filesSeen += 1;\n onFile(entry.name, fullPath);\n }\n }\n } finally {\n try {\n handle.closeSync();\n } catch {\n /* already closed */\n }\n }\n }\n}\n\n/**\n * Read a project file as UTF-8, or null when missing, unreadable, or over\n * `maxBytes` (stat-gated: an oversized file is never materialized).\n */\nexport function readProjectFile(\n filePath: string,\n maxBytes = MAX_PROJECT_FILE_BYTES,\n): string | null {\n try {\n if (fs.statSync(filePath).size > maxBytes) return null;\n return fs.readFileSync(filePath, 'utf-8');\n } catch {\n return null;\n }\n}\n\n/**\n * `readProjectFile` that also reports unexpected errors to error tracking.\n * For walk callbacks where a failing read is worth a telemetry breadcrumb.\n */\nexport function safeReadFile(fullPath: string): string | null {\n try {\n if (fs.statSync(fullPath).size > MAX_PROJECT_FILE_BYTES) {\n logToFile(`[bounded-fs] skipped oversized file: ${fullPath}`);\n return null;\n }\n return fs.readFileSync(fullPath, 'utf-8');\n } catch (error) {\n reportFsError('safeReadFile', fullPath, error);\n return null;\n }\n}\n\n/**\n * The first `bytes` of a file without materializing the rest.\n */\nexport function readFileHead(filePath: string, bytes: number): string | null {\n try {\n const fd = fs.openSync(filePath, 'r');\n try {\n const buffer = Buffer.alloc(bytes);\n const read = fs.readSync(fd, buffer, 0, bytes, 0);\n return buffer.toString('utf-8', 0, read);\n } finally {\n fs.closeSync(fd);\n }\n } catch {\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,MAAM,wBAAwB,IAAI,IAAY;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;;;;AASF,SAAS,cAAc,MAAc,UAAkB,OAAsB;CAC3E,MAAM,OAAQ,OAAwC;AACtD,KAAI,QAAQ,sBAAsB,IAAI,KAAK,EAAE;AAC3C,YAAU,wBAAwB,KAAK,IAAI,KAAK,KAAK,WAAW;AAChE;;AAEF,WAAU,iBACR,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC,EACzD;EAAE;EAAM,MAAM;EAAU,CACzB;;;;;;;AAqBH,MAAa,eAAe,IAAI,IAAY;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;AAGF,MAAa,uBAA0C,CAAC,GAAG,aAAa,CAAC,KACtE,QAAQ,MAAM,IAAI,KACpB;AAGD,MAAa,yBAAyB,IAAI,OAAO;AAMjD,MAAa,mBAAmB;;;;;AAwBhC,eAAsB,YACpB,UACA,SACmB;CACnB,MAAM,QAAQ,QAAQ,SAAA;CACtB,MAAM,SAAS,GAAG,OAAO,UAAU;EACjC,KAAK,QAAQ;EACb,KAAK,QAAQ,OAAO;EACpB,WAAW;EACX,MAAM,QAAQ;EACd,QAAQ,CAAC,GAAG,sBAAsB,GAAI,QAAQ,eAAe,EAAE,CAAE;EACjE,gBAAgB;EAChB,qBAAqB;EACtB,CAAC;C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,7 @@
1
1
  import { d as ErrorCodes, u as emitWizardError } from "./errors--OqLxmWR.js";
2
- import { f as getUI, m as LoggingUI, p as setUI } from "./debug-ECdmmlDM.js";
3
- import { n as provisionNewAccount } from "./provisioning-BewSEuFX.js";
4
- import { r as posthogIntegrationConfig } from "./posthog-integration-CxvkKY1j.js";
2
+ import { f as getUI, m as LoggingUI, p as setUI } from "./debug-DUmMVUHn.js";
3
+ import { n as provisionNewAccount } from "./provisioning-B74q1uSQ.js";
4
+ import { X as posthogIntegrationConfig } from "./mint-failure-CQqypC_v.js";
5
5
  import { c as runWizardHeadless, l as runWizardCI, u as API_KEY_HINT } from "./bin.js";
6
6
  //#region src/commands/basic-integration/ci-install.ts
7
7
  /**
@@ -116,4 +116,4 @@ async function provisionForSignup(options) {
116
116
  //#endregion
117
117
  export { runCIInstall, runHeadlessInstall };
118
118
 
119
- //# sourceMappingURL=ci-install-CzWzi_qu.js.map
119
+ //# sourceMappingURL=ci-install-CQLi_a-r.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ci-install-CzWzi_qu.js","names":[],"sources":["../src/commands/basic-integration/ci-install.ts"],"sourcesContent":["import type { Arguments } from 'yargs';\nimport { getUI, setUI } from '@ui';\nimport { LoggingUI } from '@ui/logging-ui';\nimport { API_KEY_HINT, runWizardCI, runWizardHeadless } from '@lib/runners';\nimport type { NonInteractiveMode } from '@lib/runners';\nimport { provisionNewAccount } from '@utils/provisioning';\nimport { posthogIntegrationConfig } from '@lib/programs/posthog-integration/index';\nimport { ErrorCodes, type ErrorCode } from '@lib/errors';\nimport { emitWizardError } from '@lib/errors';\n\ntype Options = Arguments & {\n region?: string;\n baseUrl?: string;\n installDir?: string;\n apiKey?: string;\n signup?: boolean;\n email?: string;\n name?: string;\n projectId?: string;\n};\n\n/**\n * CI-mode install entry point (`--ci`, dev/test builds). Thin shell over the\n * shared non-interactive install — see `runNonInteractiveInstall`.\n */\nexport function runCIInstall(argv: Arguments): void {\n runNonInteractiveInstall(argv, 'ci');\n}\n\n/**\n * Headless install entry point (the experimental published-build run path; see\n * @lib/headless-mode). Thin shell over the shared non-interactive install.\n * Today it behaves exactly like `runCIInstall`; it is a separate function so\n * headless can diverge later (auth, prompts, …) without touching the CI path.\n */\nexport function runHeadlessInstall(argv: Arguments): void {\n runNonInteractiveInstall(argv, 'headless');\n}\n\n/**\n * Non-interactive install shared by CI and headless. Validates signup flags,\n * optionally provisions an account, then installs. `mode` only changes\n * user-facing labels and which runner is invoked; the accepted keys and the\n * install itself are identical (see runNonInteractive).\n */\nfunction runNonInteractiveInstall(\n argv: Arguments,\n mode: NonInteractiveMode,\n): void {\n const options = { ...argv } as Options;\n const headless = mode === 'headless';\n const label = headless ? 'Headless' : 'CI';\n const runWizard = headless ? runWizardHeadless : runWizardCI;\n\n // Base validation (region/install-dir/api-key) is owned by the runner.\n // This layer only adds the signup branch on top.\n if (!options.apiKey && !options.signup) {\n return failCI(\n `${label} mode requires --api-key (${API_KEY_HINT}). ` +\n 'To create a new account instead, use --signup --email you@example.com.',\n ErrorCodes.ArgsMissingApiKey,\n );\n }\n if (!options.apiKey && options.signup && !options.email) {\n return failCI(\n `${label} --signup requires --email to create a new account.`,\n ErrorCodes.ArgsMissingEmail,\n );\n }\n warnOnUnexpectedKeyPrefix(options.apiKey);\n\n void (async () => {\n if (!options.apiKey && options.signup) {\n // Fail before the irreversible provisioning step rather than after it.\n if (!options.installDir) {\n return failCI(\n `${label} mode requires --install-dir (directory to install in)`,\n ErrorCodes.ArgsMissingInstallDir,\n );\n }\n const provisioned = await provisionForSignup(options);\n options.apiKey = provisioned.personalApiKey;\n if (options.projectId == null) options.projectId = provisioned.projectId;\n }\n runWizard(posthogIntegrationConfig, options);\n })().catch((error: unknown) => {\n emitWizardError({\n code: ErrorCodes.ArgsSignupProvisionFailed,\n message: error instanceof Error ? error.message : String(error),\n });\n process.exit(1);\n });\n}\n\nfunction failCI(message: string, code?: ErrorCode): void {\n setUI(new LoggingUI());\n getUI().intro('PostHog Wizard');\n getUI().log.error(message);\n if (code) emitWizardError({ code, message });\n process.exit(1);\n}\n\n/**\n * Decide whether to warn about an unexpected `--api-key` prefix, and with what\n * message. Returns `null` when the key is acceptable.\n *\n * CI and headless accept the same two credentials: a personal API key (`phx_`)\n * and a `pha_` OAuth access token minted under the wizard's own OAuth\n * application (cloud runs, and the CI bot). Both authenticate the mint the\n * same way. Anything else is unexpected and warns.\n *\n * Extracted as a pure predicate so it can be unit-tested without a UI.\n */\nexport function keyPrefixWarning(apiKey: string | undefined): string | null {\n if (!apiKey || apiKey.startsWith('phx_') || apiKey.startsWith('pha_')) {\n return null;\n }\n const hint = apiKey.startsWith('phc_')\n ? ' (phc_ is a project/client key; expected a personal API key or a wizard-app token)'\n : '';\n return `--api-key does not start with \"phx_\" or \"pha_\"${hint}. Continuing anyway, but the LLM Gateway may reject it with a 401.`;\n}\n\nfunction warnOnUnexpectedKeyPrefix(apiKey: string | undefined): void {\n const message = keyPrefixWarning(apiKey);\n if (!message) return;\n setUI(new LoggingUI());\n getUI().intro('PostHog Wizard');\n getUI().log.warn(message);\n}\n\n/**\n * Provision a new account and return its credentials. Throws on any failure\n * (after logging a user-facing message); the caller's `.catch` turns that\n * into a non-zero exit. The return type carries no failure sentinel.\n */\nasync function provisionForSignup(\n options: Options,\n): Promise<{ personalApiKey: string; projectId: string }> {\n setUI(new LoggingUI());\n getUI().intro('PostHog Wizard');\n const signupRegion = ((options.region as string) || 'us').toUpperCase() as\n | 'US'\n | 'EU';\n getUI().log.info(\n `Provisioning new PostHog account for ${String(\n options.email,\n )} in ${signupRegion}...`,\n );\n\n let result;\n try {\n result = await provisionNewAccount(\n options.email as string,\n options.name ?? '',\n signupRegion,\n { baseUrl: options.baseUrl },\n );\n } catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n getUI().log.error(`Provisioning failed: ${msg}`);\n throw error;\n }\n\n if (!result.personalApiKey) {\n getUI().log.error(\n 'Provisioning succeeded but no personal API key was returned — cannot continue install.',\n );\n throw new Error('provisioning returned no personal API key');\n }\n\n getUI().log.success('Account ready.');\n getUI().log.info(` Project API Key: ${result.projectApiKey}`);\n getUI().log.info(` Personal API Key: ${result.personalApiKey}`);\n getUI().log.info(` Host: ${result.host}`);\n return {\n personalApiKey: result.personalApiKey,\n projectId: result.projectId,\n };\n}\n"],"mappings":";;;;;;;;;;AAyBA,SAAgB,aAAa,MAAuB;AAClD,0BAAyB,MAAM,KAAK;;;;;;;;AAStC,SAAgB,mBAAmB,MAAuB;AACxD,0BAAyB,MAAM,WAAW;;;;;;;;AAS5C,SAAS,yBACP,MACA,MACM;CACN,MAAM,UAAU,EAAE,GAAG,MAAM;CAC3B,MAAM,WAAW,SAAS;CAC1B,MAAM,QAAQ,WAAW,aAAa;CACtC,MAAM,YAAY,WAAW,oBAAoB;AAIjD,KAAI,CAAC,QAAQ,UAAU,CAAC,QAAQ,OAC9B,QAAO,OACL,GAAG,MAAM,4BAA4B,aAAa,4EAElD,WAAW,kBACZ;AAEH,KAAI,CAAC,QAAQ,UAAU,QAAQ,UAAU,CAAC,QAAQ,MAChD,QAAO,OACL,GAAG,MAAM,sDACT,WAAW,iBACZ;AAEH,2BAA0B,QAAQ,OAAO;AAEzC,EAAM,YAAY;AAChB,MAAI,CAAC,QAAQ,UAAU,QAAQ,QAAQ;AAErC,OAAI,CAAC,QAAQ,WACX,QAAO,OACL,GAAG,MAAM,yDACT,WAAW,sBACZ;GAEH,MAAM,cAAc,MAAM,mBAAmB,QAAQ;AACrD,WAAQ,SAAS,YAAY;AAC7B,OAAI,QAAQ,aAAa,KAAM,SAAQ,YAAY,YAAY;;AAEjE,YAAU,0BAA0B,QAAQ;KAC1C,CAAC,OAAO,UAAmB;AAC7B,kBAAgB;GACd,MAAM,WAAW;GACjB,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;GAChE,CAAC;AACF,UAAQ,KAAK,EAAE;GACf;;AAGJ,SAAS,OAAO,SAAiB,MAAwB;AACvD,OAAM,IAAI,WAAW,CA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;AAChE,QAAO,CAAC,IAAI,KAAK,uBAAuB,OAAO,OAAO;AACtD,QAAO;EACL,gBAAgB,OAAO;EACvB,WAAW,OAAO;EACnB"}
1
+ {"version":3,"file":"ci-install-CQLi_a-r.js","names":[],"sources":["../src/commands/basic-integration/ci-install.ts"],"sourcesContent":["import type { Arguments } from 'yargs';\nimport { getUI, setUI } from '@ui';\nimport { LoggingUI } from '@ui/logging-ui';\nimport { API_KEY_HINT, runWizardCI, runWizardHeadless } from '@lib/runners';\nimport type { NonInteractiveMode } from '@lib/runners';\nimport { provisionNewAccount } from '@utils/provisioning';\nimport { posthogIntegrationConfig } from '@lib/programs/posthog-integration/index';\nimport { ErrorCodes, type ErrorCode } from '@lib/errors';\nimport { emitWizardError } from '@lib/errors';\n\ntype Options = Arguments & {\n region?: string;\n baseUrl?: string;\n installDir?: string;\n apiKey?: string;\n signup?: boolean;\n email?: string;\n name?: string;\n projectId?: string;\n};\n\n/**\n * CI-mode install entry point (`--ci`, dev/test builds). Thin shell over the\n * shared non-interactive install — see `runNonInteractiveInstall`.\n */\nexport function runCIInstall(argv: Arguments): void {\n runNonInteractiveInstall(argv, 'ci');\n}\n\n/**\n * Headless install entry point (the experimental published-build run path; see\n * @lib/headless-mode). Thin shell over the shared non-interactive install.\n * Today it behaves exactly like `runCIInstall`; it is a separate function so\n * headless can diverge later (auth, prompts, …) without touching the CI path.\n */\nexport function runHeadlessInstall(argv: Arguments): void {\n runNonInteractiveInstall(argv, 'headless');\n}\n\n/**\n * Non-interactive install shared by CI and headless. Validates signup flags,\n * optionally provisions an account, then installs. `mode` only changes\n * user-facing labels and which runner is invoked; the accepted keys and the\n * install itself are identical (see runNonInteractive).\n */\nfunction runNonInteractiveInstall(\n argv: Arguments,\n mode: NonInteractiveMode,\n): void {\n const options = { ...argv } as Options;\n const headless = mode === 'headless';\n const label = headless ? 'Headless' : 'CI';\n const runWizard = headless ? runWizardHeadless : runWizardCI;\n\n // Base validation (region/install-dir/api-key) is owned by the runner.\n // This layer only adds the signup branch on top.\n if (!options.apiKey && !options.signup) {\n return failCI(\n `${label} mode requires --api-key (${API_KEY_HINT}). ` +\n 'To create a new account instead, use --signup --email you@example.com.',\n ErrorCodes.ArgsMissingApiKey,\n );\n }\n if (!options.apiKey && options.signup && !options.email) {\n return failCI(\n `${label} --signup requires --email to create a new account.`,\n ErrorCodes.ArgsMissingEmail,\n );\n }\n warnOnUnexpectedKeyPrefix(options.apiKey);\n\n void (async () => {\n if (!options.apiKey && options.signup) {\n // Fail before the irreversible provisioning step rather than after it.\n if (!options.installDir) {\n return failCI(\n `${label} mode requires --install-dir (directory to install in)`,\n ErrorCodes.ArgsMissingInstallDir,\n );\n }\n const provisioned = await provisionForSignup(options);\n options.apiKey = provisioned.personalApiKey;\n if (options.projectId == null) options.projectId = provisioned.projectId;\n }\n runWizard(posthogIntegrationConfig, options);\n })().catch((error: unknown) => {\n emitWizardError({\n code: ErrorCodes.ArgsSignupProvisionFailed,\n message: error instanceof Error ? error.message : String(error),\n });\n process.exit(1);\n });\n}\n\nfunction failCI(message: string, code?: ErrorCode): void {\n setUI(new LoggingUI());\n getUI().intro('PostHog Wizard');\n getUI().log.error(message);\n if (code) emitWizardError({ code, message });\n process.exit(1);\n}\n\n/**\n * Decide whether to warn about an unexpected `--api-key` prefix, and with what\n * message. Returns `null` when the key is acceptable.\n *\n * CI and headless accept the same two credentials: a personal API key (`phx_`)\n * and a `pha_` OAuth access token minted under the wizard's own OAuth\n * application (cloud runs, and the CI bot). Both authenticate the mint the\n * same way. Anything else is unexpected and warns.\n *\n * Extracted as a pure predicate so it can be unit-tested without a UI.\n */\nexport function keyPrefixWarning(apiKey: string | undefined): string | null {\n if (!apiKey || apiKey.startsWith('phx_') || apiKey.startsWith('pha_')) {\n return null;\n }\n const hint = apiKey.startsWith('phc_')\n ? ' (phc_ is a project/client key; expected a personal API key or a wizard-app token)'\n : '';\n return `--api-key does not start with \"phx_\" or \"pha_\"${hint}. Continuing anyway, but the LLM Gateway may reject it with a 401.`;\n}\n\nfunction warnOnUnexpectedKeyPrefix(apiKey: string | undefined): void {\n const message = keyPrefixWarning(apiKey);\n if (!message) return;\n setUI(new LoggingUI());\n getUI().intro('PostHog Wizard');\n getUI().log.warn(message);\n}\n\n/**\n * Provision a new account and return its credentials. Throws on any failure\n * (after logging a user-facing message); the caller's `.catch` turns that\n * into a non-zero exit. The return type carries no failure sentinel.\n */\nasync function provisionForSignup(\n options: Options,\n): Promise<{ personalApiKey: string; projectId: string }> {\n setUI(new LoggingUI());\n getUI().intro('PostHog Wizard');\n const signupRegion = ((options.region as string) || 'us').toUpperCase() as\n | 'US'\n | 'EU';\n getUI().log.info(\n `Provisioning new PostHog account for ${String(\n options.email,\n )} in ${signupRegion}...`,\n );\n\n let result;\n try {\n result = await provisionNewAccount(\n options.email as string,\n options.name ?? '',\n signupRegion,\n { baseUrl: options.baseUrl },\n );\n } catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n getUI().log.error(`Provisioning failed: ${msg}`);\n throw error;\n }\n\n if (!result.personalApiKey) {\n getUI().log.error(\n 'Provisioning succeeded but no personal API key was returned — cannot continue install.',\n );\n throw new Error('provisioning returned no personal API key');\n }\n\n getUI().log.success('Account ready.');\n getUI().log.info(` Project API Key: ${result.projectApiKey}`);\n getUI().log.info(` Personal API Key: ${result.personalApiKey}`);\n getUI().log.info(` Host: ${result.host}`);\n return {\n personalApiKey: result.personalApiKey,\n projectId: result.projectId,\n };\n}\n"],"mappings":";;;;;;;;;;AAyBA,SAAgB,aAAa,MAAuB;AAClD,0BAAyB,MAAM,KAAK;;;;;;;;AAStC,SAAgB,mBAAmB,MAAuB;AACxD,0BAAyB,MAAM,WAAW;;;;;;;;AAS5C,SAAS,yBACP,MACA,MACM;CACN,MAAM,UAAU,EAAE,GAAG,MAAM;CAC3B,MAAM,WAAW,SAAS;CAC1B,MAAM,QAAQ,WAAW,aAAa;CACtC,MAAM,YAAY,WAAW,oBAAoB;AAIjD,KAAI,CAAC,QAAQ,U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;;;;;;AAQ3B,eAAe,mBACb,SACwD;AACxD,OAAM,IAAI,WAAW,CAAC;AACtB,QAAO,CAAC,MAAM,iBAAiB;CAC/B,MAAM,gBAAiB,QAAQ,UAAqB,MAAM,aAAa;AAGvE,QAAO,CAAC,IAAI,KACV,wCAAwC,OACtC,QAAQ,MACT,CAAC,MAAM,aAAa,KACtB;CAED,IAAI;AACJ,KAAI;AACF,WAAS,MAAM,oBACb,QAAQ,OACR,QAAQ,QAAQ,IAChB,cACA,EAAE,SAAS,QAAQ,SAAS,CAC7B;UACM,OAAO;EACd,MAAM,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AAClE,SAAO,CAAC,IAAI,MAAM,wBAAwB,MAAM;AAChD,QAAM;;AAGR,KAAI,CAAC,OAAO,gBAAgB;AAC1B,SAAO,CAAC,IAAI,MACV,yFACD;AACD,QAAM,IAAI,MAAM,4CAA4C;;AAG9D,QAAO,CAAC,IAAI,QAAQ,iBAAiB;AACrC,QAAO,CAAC,IAAI,KAAK,uBAAuB,OAAO,gBAAgB;AAC/D,QAAO,CAAC,IAAI,KAAK,uBAAuB,OAAO,iBAAiB;AAChE,QAAO,CAAC,IAAI,KAAK,uBAAuB,OAAO,OAAO;AACtD,QAAO;EACL,gBAAgB,OAAO;EACvB,WAAW,OAAO;EACnB"}
@@ -1,2 +1,2 @@
1
- import { n as configureLogFileFromEnvironment, s as logToFile } from "./debug-ECdmmlDM.js";
1
+ import { n as configureLogFileFromEnvironment, s as logToFile } from "./debug-DUmMVUHn.js";
2
2
  export { configureLogFileFromEnvironment, logToFile };
@@ -69,7 +69,7 @@ const TASK_RUN_ID = runtimeEnv("POSTHOG_TASK_RUN_ID") || void 0;
69
69
  const TASK_ID = runtimeEnv("POSTHOG_TASK_ID") || void 0;
70
70
  //#endregion
71
71
  //#region src/lib/version.ts
72
- const VERSION = "2.74.0";
72
+ const VERSION = "2.75.0";
73
73
  //#endregion
74
74
  //#region src/lib/constants.ts
75
75
  /**
@@ -322,181 +322,6 @@ function isTaskStatus(value) {
322
322
  return Object.values(TaskStatus).includes(value);
323
323
  }
324
324
  //#endregion
325
- //#region src/lib/health-checks/statuspage.ts
326
- function mapIndicator(v) {
327
- switch (v) {
328
- case "none": return "healthy";
329
- case "minor": return "degraded";
330
- case "major":
331
- case "critical": return "down";
332
- default: return "degraded";
333
- }
334
- }
335
- function mapComponentRaw(v) {
336
- switch (v) {
337
- case "operational": return "healthy";
338
- case "degraded_performance":
339
- case "under_maintenance": return "degraded";
340
- case "partial_outage":
341
- case "major_outage": return "down";
342
- default: return "degraded";
343
- }
344
- }
345
- function errResult$1(error) {
346
- return {
347
- status: "degraded",
348
- error
349
- };
350
- }
351
- async function fetchStatuspageIndicator(url, timeoutMs = 5e3) {
352
- try {
353
- const controller = new AbortController();
354
- const tid = setTimeout(() => controller.abort(), timeoutMs);
355
- const res = await fetch(url, { signal: controller.signal });
356
- clearTimeout(tid);
357
- if (!res.ok) return errResult$1(`HTTP ${res.status}`);
358
- const indicator = (await res.json()).status?.indicator ?? null;
359
- return {
360
- status: mapIndicator(indicator),
361
- rawIndicator: indicator ?? void 0
362
- };
363
- } catch (e) {
364
- if (e instanceof Error && e.name === "AbortError") return errResult$1("Request timed out");
365
- return errResult$1(e instanceof Error ? e.message : "Unknown error");
366
- }
367
- }
368
- async function fetchStatuspageSummary(url, timeoutMs = 5e3) {
369
- try {
370
- const controller = new AbortController();
371
- const tid = setTimeout(() => controller.abort(), timeoutMs);
372
- const res = await fetch(url, { signal: controller.signal });
373
- clearTimeout(tid);
374
- if (!res.ok) return errResult$1(`HTTP ${res.status}`);
375
- const data = await res.json();
376
- const indicator = data.status?.indicator ?? null;
377
- const overall = mapIndicator(indicator);
378
- const affected = (data.components ?? []).map((c) => ({
379
- name: c.name,
380
- status: mapComponentRaw(c.status),
381
- rawStatus: c.status
382
- })).filter((c) => c.status !== "healthy");
383
- return {
384
- status: affected.length > 0 ? "degraded" : overall,
385
- rawIndicator: indicator ?? void 0,
386
- degradedOrDownComponents: affected.length > 0 ? affected : void 0
387
- };
388
- } catch (e) {
389
- if (e instanceof Error && e.name === "AbortError") return errResult$1("Request timed out");
390
- return errResult$1(e instanceof Error ? e.message : "Unknown error");
391
- }
392
- }
393
- const checkAnthropicHealth = () => fetchStatuspageIndicator("https://status.claude.com/api/v2/status.json");
394
- const checkGithubHealth = () => fetchStatuspageIndicator("https://www.githubstatus.com/api/v2/status.json");
395
- const checkNpmOverallHealth = () => fetchStatuspageIndicator("https://status.npmjs.org/api/v2/status.json");
396
- const checkNpmComponentHealth = () => fetchStatuspageSummary("https://status.npmjs.org/api/v2/summary.json");
397
- const checkCloudflareOverallHealth = () => fetchStatuspageIndicator("https://www.cloudflarestatus.com/api/v2/status.json");
398
- const checkCloudflareComponentHealth = () => fetchStatuspageSummary("https://www.cloudflarestatus.com/api/v2/summary.json");
399
- //#endregion
400
- //#region src/lib/health-checks/incidentio.ts
401
- function mapIncidentImpact(impact) {
402
- switch (impact) {
403
- case "full_outage": return "down";
404
- case "partial_outage":
405
- case "degraded_performance": return "degraded";
406
- default: return "degraded";
407
- }
408
- }
409
- function mapComponentStatus(status) {
410
- switch (status) {
411
- case "operational": return "healthy";
412
- case "full_outage": return "down";
413
- case "partial_outage":
414
- case "degraded_performance": return "degraded";
415
- default: return "degraded";
416
- }
417
- }
418
- /**
419
- * Build an error result for fetch failures. The kind matters for
420
- * downstream reconciliation:
421
- *
422
- * - 'http' (incident.io returned a bad status code) → `Down`. We
423
- * reached the status page but it told us something is wrong on
424
- * its side. We have a definitive response.
425
- * - 'network' (timeout, DNS failure, TCP/TLS failure) → `NoConnection`.
426
- * We never reached the status page. Treating this as `Degraded`
427
- * (the previous behavior) silently flipped the reconciliation in
428
- * `readiness.ts` from "soft" to "confirmed outage" whenever the
429
- * user's own network was flaky — exactly the false positive this
430
- * module is meant to help diagnose.
431
- */
432
- function errResult(error, kind) {
433
- return {
434
- status: kind === "http" ? "down" : "no-connection",
435
- error
436
- };
437
- }
438
- const POSTHOG_STATUS_URL = "https://www.posthogstatus.com/api/v1/summary";
439
- async function fetchPosthogStatus(timeoutMs = 5e3) {
440
- try {
441
- const controller = new AbortController();
442
- const tid = setTimeout(() => controller.abort(), timeoutMs);
443
- const res = await fetch(POSTHOG_STATUS_URL, { signal: controller.signal });
444
- clearTimeout(tid);
445
- if (!res.ok) {
446
- const err = errResult(`HTTP ${res.status}`, "http");
447
- return {
448
- overall: err,
449
- components: err
450
- };
451
- }
452
- const incidents = (await res.json()).ongoing_incidents ?? [];
453
- if (incidents.length === 0) return {
454
- overall: { status: "healthy" },
455
- components: { status: "healthy" }
456
- };
457
- let worstOverall = "degraded";
458
- const affected = [];
459
- for (const incident of incidents) {
460
- if (mapIncidentImpact(incident.current_worst_impact) === "down") worstOverall = "down";
461
- for (const comp of incident.affected_components ?? []) {
462
- const compStatus = mapComponentStatus(comp.current_status);
463
- if (compStatus !== "healthy") affected.push({
464
- name: comp.group_name ? `${comp.group_name} — ${comp.name}` : comp.name,
465
- status: compStatus,
466
- rawStatus: comp.current_status
467
- });
468
- }
469
- }
470
- return {
471
- overall: { status: worstOverall },
472
- components: {
473
- status: affected.length > 0 ? "degraded" : worstOverall,
474
- degradedOrDownComponents: affected.length > 0 ? affected : void 0
475
- }
476
- };
477
- } catch (e) {
478
- if (e instanceof Error && e.name === "AbortError") {
479
- const err = errResult("Request timed out", "network");
480
- return {
481
- overall: err,
482
- components: err
483
- };
484
- }
485
- const err = errResult(e instanceof Error ? e.message : "Unknown error", "network");
486
- return {
487
- overall: err,
488
- components: err
489
- };
490
- }
491
- }
492
- let _cache = null;
493
- function getPosthogHealth() {
494
- if (!_cache) _cache = fetchPosthogStatus();
495
- return _cache;
496
- }
497
- const checkPosthogOverallHealth = async () => (await getPosthogHealth()).overall;
498
- const checkPosthogComponentHealth = async () => (await getPosthogHealth()).components;
499
- //#endregion
500
325
  //#region src/lib/health-checks/endpoints.ts
501
326
  function noConnectionResult(error, attempts) {
502
327
  return {
@@ -563,11 +388,11 @@ async function fetchEndpointHealth(url, timeoutMs = 5e3, isExpectedStatus = (s)
563
388
  }
564
389
  lastError = outcome.timedOut ? `Request timed out after ${timeoutMs}ms` : outcome.error.message;
565
390
  }
566
- const result = lastHttpStatus !== null ? downResult(`HTTP ${lastHttpStatus} (attempts=${attempts})`, lastHttpStatus) : noConnectionResult(lastError, attempts);
391
+ const result = lastHttpStatus !== null ? downResult(`HTTP ${lastHttpStatus} (attempts=${attempts})`) : noConnectionResult(lastError, attempts);
567
392
  logToFile(`[health-checks] GET ${url} -> ${result.status} (attempts=${attempts}, ${result.error})`);
568
393
  return result;
569
394
  }
570
- const checkMcpHealth = () => fetchEndpointHealth("https://mcp.posthog.com/", 5e3, (s) => s >= 200 && s < 400, "manual");
395
+ const checkLlmGatewayHealth = (gatewayUrl) => fetchEndpointHealth(new URL("/readyz", gatewayUrl).href);
571
396
  /**
572
397
  * Skills are published to two origins under the same filenames and
573
398
  * `fetchWithRetry` fails over between them, so the run is only blocked when
@@ -601,111 +426,11 @@ function withIndicatorSuffix(result, suffix) {
601
426
  }
602
427
  //#endregion
603
428
  //#region src/lib/health-checks/readiness.ts
604
- const SERVICE_LABELS = {
605
- anthropic: "Anthropic",
606
- posthogOverall: "PostHog",
607
- posthogComponents: "PostHog (components)",
608
- github: "GitHub",
609
- npmOverall: "npm",
610
- npmComponents: "npm (components)",
611
- cloudflareOverall: "Cloudflare",
612
- cloudflareComponents: "Cloudflare (components)",
613
- mcp: "MCP",
614
- skillsOrigin: "Skills download"
615
- };
616
- /**
617
- * See README section "Health checks" for the full rationale.
618
- * Adjust these arrays to change what blocks a wizard run.
619
- *
620
- * The AI gateway is not probed: its URL is only known from the run's token
621
- * mint, and a failed mint already stops the run at bootstrap with the
622
- * server's reason.
623
- */
624
- const DEFAULT_WIZARD_READINESS_CONFIG = {
625
- downBlocksRun: [
626
- "anthropic",
627
- "npmOverall",
628
- "mcp",
629
- "skillsOrigin"
630
- ],
631
- degradedBlocksRun: ["anthropic"]
632
- };
633
- /**
634
- * Reduced readiness config for --signup provisioning flows.
635
- *
636
- * Provisioning only needs PostHog - it doesn't use Anthropic directly, npm,
637
- * the skills origins, or MCP.
638
- */
639
- const SIGNUP_WIZARD_READINESS_CONFIG = { downBlocksRun: ["posthogOverall"] };
429
+ const SERVICE_LABELS = { skillsOrigin: "Skills download" };
430
+ const DEFAULT_WIZARD_READINESS_CONFIG = { downBlocksRun: ["skillsOrigin"] };
431
+ const SIGNUP_WIZARD_READINESS_CONFIG = DEFAULT_WIZARD_READINESS_CONFIG;
640
432
  async function checkAllExternalServices() {
641
- const [anthropic, posthogOverall, posthogComponents, github, npmOverall, npmComponents, cloudflareOverall, cloudflareComponents, mcp, skillsOrigin] = await Promise.all([
642
- checkAnthropicHealth(),
643
- checkPosthogOverallHealth(),
644
- checkPosthogComponentHealth(),
645
- checkGithubHealth(),
646
- checkNpmOverallHealth(),
647
- checkNpmComponentHealth(),
648
- checkCloudflareOverallHealth(),
649
- checkCloudflareComponentHealth(),
650
- checkMcpHealth(),
651
- checkSkillsOriginHealth()
652
- ]);
653
- return reconcilePosthogReachability({
654
- anthropic,
655
- posthogOverall,
656
- posthogComponents,
657
- github,
658
- npmOverall,
659
- npmComponents,
660
- cloudflareOverall,
661
- cloudflareComponents,
662
- mcp,
663
- skillsOrigin
664
- });
665
- }
666
- /**
667
- * When a PostHog-owned endpoint probe returns `NoConnection`, decide
668
- * whether it's a real outage or a likely-local issue by checking the
669
- * official status page (`posthogstatus.com`):
670
- *
671
- * - Status page says PostHog is `Down` / `Degraded` → upgrade
672
- * mcp to `Down`. The status page corroborates.
673
- * - Status page is `Healthy` → keep `NoConnection`. The status page
674
- * contradicts; this is probably the user's network.
675
- * - Status page is also `NoConnection` → keep `NoConnection`. User
676
- * can't reach two independent PostHog properties; almost
677
- * certainly their network. (This case relies on incidentio.ts
678
- * correctly emitting `NoConnection` for fetch failures rather
679
- * than the previous `Degraded`, which used to silently flip the
680
- * reconciliation into a false positive.)
681
- *
682
- * Why `Degraded` corroborates: a `Degraded` reading here only fires
683
- * when incident.io's API parsed successfully and reported a real
684
- * `partial_outage` or `degraded_performance` for some component. That's
685
- * PostHog acknowledging an issue, even if narrower than a full outage.
686
- * If our MCP probe is also failing, those two signals together
687
- * justify pointing at PostHog rather than the user.
688
- *
689
- * A narrower variant — only corroborate when the affected component is
690
- * MCP-related (US/EU Cloud, app) — would be more precise. We
691
- * have the data in `posthogComponents` but don't use it here. If the
692
- * analytics show false positives concentrated in this case, it's a
693
- * cheap follow-up.
694
- *
695
- * Mutates a copy of `health` and returns it.
696
- */
697
- function reconcilePosthogReachability(health) {
698
- const posthogStatus = health.posthogOverall.status;
699
- if (!(posthogStatus === "down" || posthogStatus === "degraded")) return health;
700
- const upgrade = (r) => r.status === "no-connection" ? {
701
- ...r,
702
- status: "down",
703
- error: r.error ? `${r.error} (corroborated by status page)` : "corroborated by status page"
704
- } : r;
705
- return {
706
- ...health,
707
- mcp: upgrade(health.mcp)
708
- };
433
+ return { skillsOrigin: await checkSkillsOriginHealth() };
709
434
  }
710
435
  function describeResult(label, h) {
711
436
  const parts = [`${label}: ${h.status}`];
@@ -713,26 +438,12 @@ function describeResult(label, h) {
713
438
  if (h.error) parts.push(h.error);
714
439
  return parts.join(" — ");
715
440
  }
716
- const MAX_COMPONENT_NAMES = 8;
717
- function describeComponents(label, h) {
718
- const affected = h.degradedOrDownComponents;
719
- if (!affected || affected.length === 0) return `${label} components: all operational`;
720
- const shown = affected.slice(0, MAX_COMPONENT_NAMES).map((c) => `${c.name} (${c.status})`);
721
- const suffix = affected.length > MAX_COMPONENT_NAMES ? `, +${affected.length - MAX_COMPONENT_NAMES} more` : "";
722
- return `${label} components impacted: ${shown.join(", ")}${suffix}`;
723
- }
724
441
  const READINESS_TIMEOUT_MS = 2e4;
725
442
  async function evaluateWizardReadiness(config = DEFAULT_WIZARD_READINESS_CONFIG) {
726
443
  try {
727
444
  const health = await Promise.race([checkAllExternalServices(), new Promise((resolve) => setTimeout(() => resolve(allUnknown("Health check timed out")), READINESS_TIMEOUT_MS))]);
728
- const reasons = [];
729
- for (const key of Object.keys(health)) {
730
- const result = health[key];
731
- const label = SERVICE_LABELS[key];
732
- reasons.push(describeResult(label, result));
733
- if ("degradedOrDownComponents" in result) reasons.push(describeComponents(label, result));
734
- }
735
445
  const blockingKeys = getBlockingServiceKeys(health, config);
446
+ const reasons = blockingKeys.map((key) => describeResult(SERVICE_LABELS[key], health[key]));
736
447
  if (blockingKeys.length > 0) {
737
448
  logToFile(`[health-checks] blocked by: ${blockingKeys.map((key) => {
738
449
  const h = health[key];
@@ -744,11 +455,6 @@ async function evaluateWizardReadiness(config = DEFAULT_WIZARD_READINESS_CONFIG)
744
455
  reasons
745
456
  };
746
457
  }
747
- if (Object.values(health).some((h) => h.status !== "healthy")) return {
748
- decision: "yes_with_warnings",
749
- health,
750
- reasons
751
- };
752
458
  return {
753
459
  decision: "yes",
754
460
  health,
@@ -759,27 +465,12 @@ async function evaluateWizardReadiness(config = DEFAULT_WIZARD_READINESS_CONFIG)
759
465
  return {
760
466
  decision: "yes",
761
467
  health: allUnknown("Unexpected error"),
762
- reasons: ["Health check failed unexpectedly — proceeding anyway"]
468
+ reasons: []
763
469
  };
764
470
  }
765
471
  }
766
- /** Keys that are component-level detail, not top-level services. */
767
- const COMPONENT_KEYS = [
768
- "posthogComponents",
769
- "npmComponents",
770
- "cloudflareComponents"
771
- ];
772
- /**
773
- * Get the keys of services that would block a wizard run per the given config.
774
- *
775
- * `NoConnection` blocks the same services as `Down` — the wizard genuinely
776
- * can't continue if it can't reach the gateway. The screen shows softer
777
- * framing in that case (HealthCheckScreen) so we don't falsely accuse
778
- * PostHog of an outage when the user's network is the likely cause.
779
- */
780
472
  function getBlockingServiceKeys(health, config = DEFAULT_WIZARD_READINESS_CONFIG) {
781
473
  return Object.keys(health).filter((key) => {
782
- if (COMPONENT_KEYS.includes(key)) return false;
783
474
  const result = health[key];
784
475
  if (config.downBlocksRun.includes(key) && (result.status === "down" || result.status === "no-connection")) return true;
785
476
  if ((config.degradedBlocksRun ?? []).includes(key) && result.status !== "healthy") return true;
@@ -788,22 +479,10 @@ function getBlockingServiceKeys(health, config = DEFAULT_WIZARD_READINESS_CONFIG
788
479
  }
789
480
  /** Build an AllServicesHealth where every service is Degraded with the given error. */
790
481
  function allUnknown(error) {
791
- const base = {
482
+ return { skillsOrigin: {
792
483
  status: "degraded",
793
484
  error
794
- };
795
- return {
796
- anthropic: base,
797
- posthogOverall: base,
798
- posthogComponents: { ...base },
799
- github: base,
800
- npmOverall: base,
801
- npmComponents: { ...base },
802
- cloudflareOverall: base,
803
- cloudflareComponents: { ...base },
804
- mcp: base,
805
- skillsOrigin: base
806
- };
485
+ } };
807
486
  }
808
487
  //#endregion
809
488
  //#region src/ui/logging-ui.ts
@@ -1021,7 +700,7 @@ let reportedLogFailure = false;
1021
700
  function reportLogFailureOnce(err) {
1022
701
  if (reportedLogFailure) return;
1023
702
  reportedLogFailure = true;
1024
- import("./analytics-CfadnLFG.js").then(({ analytics }) => analytics.captureException(err instanceof Error ? err : new Error(String(err)), {
703
+ import("./analytics-yurAACt5.js").then(({ analytics }) => analytics.captureException(err instanceof Error ? err : new Error(String(err)), {
1025
704
  source: "log-file-write",
1026
705
  log_path: logFilePath,
1027
706
  platform: process.platform
@@ -1065,6 +744,6 @@ function enableDebugLogs() {
1065
744
  consoleLoggingEnabled = true;
1066
745
  }
1067
746
  //#endregion
1068
- export { Sequence as $, DUMMY_PROJECT_API_KEY as A, OAUTH_PORTS as B, ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY as C, CONTEXT_MILL_URL as D, CONTEXT_MILL_RELEASES_URL as E, HAIKU_MODEL as F, POSTHOG_EU_CLIENT_ID as G, POSTHOG_APP_URL as H, HAIKU_TRIAGE_MODEL as I, POSTHOG_PROXY_CLIENT_ID as J, POSTHOG_ORG_AI_SETTINGS_URL as K, Harness as L, GPT5_6_LUNA_MODEL as M, GPT5_6_SOL_MODEL as N, DEFAULT_AGENT_MODEL as O, GPT5_6_TERRA_MODEL as P, SONNET_5_MODEL as Q, ISSUES_URL as R, ANALYTICS_HOST_URL as S, regionOption as St, AWS_SKILLS_BASE_URL as T, POSTHOG_DEV_CLIENT_ID as U, OAUTH_TIMEOUT_MS as V, POSTHOG_DOCS_URL as W, POSTHOG_TERMS_URL as X, POSTHOG_STATUS_PAGE_URL as Y, POSTHOG_US_CLIENT_ID as Z, evaluateWizardReadiness as _, TASK_ID as _t, getLogFilePath as a, WIZARD_ORCHESTRATOR_FLAG_KEY as at, isTaskStatus as b, headlessOption as bt, WIZARD_BENCHMARK_FILE as c, WIZARD_PROVISIONING_SCOPES as ct, relativeToInstallDir as d, WIZARD_USER_AGENT as dt, WIZARD_BASIC_INTEGRATION_AGENTIC_DETECTION_FLAG_KEY as et, getUI as f, getSkillsBaseUrl as ft, SIGNUP_WIZARD_READINESS_CONFIG as g, RUN_SURFACE as gt, SERVICE_LABELS as h, NODE_ENV as ht, enableDebugLogs as i, WIZARD_OAUTH_SCOPES as it, GITHUB_SKILLS_BASE_URL as j, DETECTION_TIMEOUT_MS as k, WIZARD_LOG_FILE as l, WIZARD_REMARK_EVENT_NAME as lt, LoggingUI as m, VERSION as mt, configureLogFileFromEnvironment as n, WIZARD_FLAG_KEYS as nt, initLogFile as o, WIZARD_ORCHESTRATOR_OVERRIDE_FLAG_KEY as ot, setUI as p, wizardUserAgentForProgram as pt, POSTHOG_PRIVACY_URL as q, debug as r, WIZARD_INTERACTION_EVENT_NAME as rt, logToFile as s, WIZARD_ORCHESTRATOR_SEEDED_TASKS_FLAG_KEY as st, configureLogFile as t, WIZARD_CONTACT_EMAIL as tt, WIZARD_YARA_REPORT_FILE as u, WIZARD_SELF_DRIVING_USE_PI_HARNESS_FLAG_KEY as ut, getBlockingServiceKeys as v, TASK_RUN_ID as vt, ANALYTICS_TEAM_TAG as w, AGENTIC_DETECTION_TIMEOUT_MS as x, isHeadless as xt, TaskStatus as y, runtimeEnv as yt, Integration as z };
747
+ export { SONNET_5_MODEL as $, DETECTION_TIMEOUT_MS as A, Integration as B, ANALYTICS_HOST_URL as C, regionOption as Ct, CONTEXT_MILL_RELEASES_URL as D, AWS_SKILLS_BASE_URL as E, GPT5_6_TERRA_MODEL as F, POSTHOG_DOCS_URL as G, OAUTH_TIMEOUT_MS as H, HAIKU_MODEL as I, POSTHOG_PRIVACY_URL as J, POSTHOG_EU_CLIENT_ID as K, HAIKU_TRIAGE_MODEL as L, GITHUB_SKILLS_BASE_URL as M, GPT5_6_LUNA_MODEL as N, CONTEXT_MILL_URL as O, GPT5_6_SOL_MODEL as P, POSTHOG_US_CLIENT_ID as Q, Harness as R, AGENTIC_DETECTION_TIMEOUT_MS as S, isHeadless as St, ANALYTICS_TEAM_TAG as T, POSTHOG_APP_URL as U, OAUTH_PORTS as V, POSTHOG_DEV_CLIENT_ID as W, POSTHOG_STATUS_PAGE_URL as X, POSTHOG_PROXY_CLIENT_ID as Y, POSTHOG_TERMS_URL as Z, evaluateWizardReadiness as _, RUN_SURFACE as _t, getLogFilePath as a, WIZARD_OAUTH_SCOPES as at, TaskStatus as b, runtimeEnv as bt, WIZARD_BENCHMARK_FILE as c, WIZARD_ORCHESTRATOR_SEEDED_TASKS_FLAG_KEY as ct, relativeToInstallDir as d, WIZARD_SELF_DRIVING_USE_PI_HARNESS_FLAG_KEY as dt, Sequence as et, getUI as f, WIZARD_USER_AGENT as ft, SIGNUP_WIZARD_READINESS_CONFIG as g, NODE_ENV as gt, SERVICE_LABELS as h, VERSION as ht, enableDebugLogs as i, WIZARD_INTERACTION_EVENT_NAME as it, DUMMY_PROJECT_API_KEY as j, DEFAULT_AGENT_MODEL as k, WIZARD_LOG_FILE as l, WIZARD_PROVISIONING_SCOPES as lt, LoggingUI as m, wizardUserAgentForProgram as mt, configureLogFileFromEnvironment as n, WIZARD_CONTACT_EMAIL as nt, initLogFile as o, WIZARD_ORCHESTRATOR_FLAG_KEY as ot, setUI as p, getSkillsBaseUrl as pt, POSTHOG_ORG_AI_SETTINGS_URL as q, debug as r, WIZARD_FLAG_KEYS as rt, logToFile as s, WIZARD_ORCHESTRATOR_OVERRIDE_FLAG_KEY as st, configureLogFile as t, WIZARD_BASIC_INTEGRATION_AGENTIC_DETECTION_FLAG_KEY as tt, WIZARD_YARA_REPORT_FILE as u, WIZARD_REMARK_EVENT_NAME as ut, getBlockingServiceKeys as v, TASK_ID as vt, ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY as w, isTaskStatus as x, headlessOption as xt, checkLlmGatewayHealth as y, TASK_RUN_ID as yt, ISSUES_URL as z };
1069
748
 
1070
- //# sourceMappingURL=debug-ECdmmlDM.js.map
749
+ //# sourceMappingURL=debug-DUmMVUHn.js.map