@posthog/wizard 2.68.0 → 2.70.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/dist/{add-mcp-server-to-clients-y0swAr9I.js → add-mcp-server-to-clients-D2z2adQL.js} +4 -4
- package/dist/{add-mcp-server-to-clients-y0swAr9I.js.map → add-mcp-server-to-clients-D2z2adQL.js.map} +1 -1
- package/dist/{agent-interface-CaEptZuu.js → agent-interface-NZHof8u3.js} +32 -24
- package/dist/agent-interface-NZHof8u3.js.map +1 -0
- package/dist/{agent-prompt-loader-DZHc9tIG.js → agent-prompt-loader-CQijHoX1.js} +5 -5
- package/dist/{agent-prompt-loader-DZHc9tIG.js.map → agent-prompt-loader-CQijHoX1.js.map} +1 -1
- package/dist/{agent-runner-Do5kyhPo.js → agent-runner-CK9z7-0z.js} +20 -15
- package/dist/{agent-runner-Do5kyhPo.js.map → agent-runner-CK9z7-0z.js.map} +1 -1
- package/dist/analytics-CbkGZjMp.js +2 -0
- package/dist/{analytics-tF06lcmE.js → analytics-DXPSL5IY.js} +13 -3
- package/dist/analytics-DXPSL5IY.js.map +1 -0
- package/dist/{api-D7-8R4xx.js → api-CeapT_rn.js} +3 -3
- package/dist/{api-D7-8R4xx.js.map → api-CeapT_rn.js.map} +1 -1
- package/dist/bin.js +51 -51
- package/dist/bin.js.map +1 -1
- package/dist/{bounded-fs-BwuqKpBH.js → bounded-fs-DdHuSE1X.js} +3 -3
- package/dist/{bounded-fs-BwuqKpBH.js.map → bounded-fs-DdHuSE1X.js.map} +1 -1
- package/dist/{ci-install-CrqqhXAw.js → ci-install-c-n8dJng.js} +5 -5
- package/dist/{ci-install-CrqqhXAw.js.map → ci-install-c-n8dJng.js.map} +1 -1
- package/dist/{debug-CWn7PsPd.js → debug-D2KQFr3-.js} +1 -1
- package/dist/{debug-aA5dm2MR.js → debug-D5YT7Lil.js} +3 -3
- package/dist/{debug-aA5dm2MR.js.map → debug-D5YT7Lil.js.map} +1 -1
- package/dist/{env-api-key-CwkRyrgi.js → env-api-key-ClK4nxHy.js} +2 -2
- package/dist/{env-api-key-CwkRyrgi.js.map → env-api-key-ClK4nxHy.js.map} +1 -1
- package/dist/{environment-BGUJxuvj.js → environment-DbDconLv.js} +4 -4
- package/dist/{environment-BGUJxuvj.js.map → environment-DbDconLv.js.map} +1 -1
- package/dist/{errors-BHervYGs.js → errors-BSdz2lsl.js} +3 -2
- package/dist/errors-BSdz2lsl.js.map +1 -0
- package/dist/{file-watcher-Cn7tD95m.js → file-watcher-CQj0wp1a.js} +2 -2
- package/dist/{file-watcher-Cn7tD95m.js.map → file-watcher-CQj0wp1a.js.map} +1 -1
- package/dist/{headless-ui-DtIYZNVv.js → headless-ui-BKU7MJQf.js} +2 -2
- package/dist/{headless-ui-DtIYZNVv.js.map → headless-ui-BKU7MJQf.js.map} +1 -1
- package/dist/{interactive-BRB6w6KG.js → interactive-Bfvo61oS.js} +2 -2
- package/dist/{interactive-BRB6w6KG.js.map → interactive-Bfvo61oS.js.map} +1 -1
- package/dist/{mcp-BXdSTZe6.js → mcp-C_pqYZQY.js} +2 -2
- package/dist/{mcp-BXdSTZe6.js.map → mcp-C_pqYZQY.js.map} +1 -1
- package/dist/{mcp-prompt-streaming-DhOT15Jj.js → mcp-prompt-streaming-DOHJxT8K.js} +4 -4
- package/dist/{mcp-prompt-streaming-DhOT15Jj.js.map → mcp-prompt-streaming-DOHJxT8K.js.map} +1 -1
- package/dist/{non-interactive-ezilF3PY.js → non-interactive-CkBbj2As.js} +3 -3
- package/dist/{non-interactive-ezilF3PY.js.map → non-interactive-CkBbj2As.js.map} +1 -1
- package/dist/{orchestrator-tools-D82843t_.js → orchestrator-tools-DaVjzCRn.js} +3 -3
- package/dist/{orchestrator-tools-D82843t_.js.map → orchestrator-tools-DaVjzCRn.js.map} +1 -1
- package/dist/{package-json-GEU2VZlS.js → package-json-xt3eeyBI.js} +1 -1
- package/dist/{package-json-GEU2VZlS.js.map → package-json-xt3eeyBI.js.map} +1 -1
- package/dist/{package-manager-BPoVLj7W.js → package-manager-BD3WR7Ta.js} +2 -2
- package/dist/{package-manager-BPoVLj7W.js.map → package-manager-BD3WR7Ta.js.map} +1 -1
- package/dist/{pi-CKyt4bcu.js → pi-uDtK02b4.js} +12 -12
- package/dist/{pi-CKyt4bcu.js.map → pi-uDtK02b4.js.map} +1 -1
- package/dist/{playground-Dnyb4jLu.js → playground-ELiBuGN0.js} +7 -7
- package/dist/{playground-Dnyb4jLu.js.map → playground-ELiBuGN0.js.map} +1 -1
- package/dist/{posthog-BHyJiU05.js → posthog-DISFn-54.js} +2 -2
- package/dist/{posthog-BHyJiU05.js.map → posthog-DISFn-54.js.map} +1 -1
- package/dist/{posthog-integration-DJX4qTDQ.js → posthog-integration-BGk6dYzS.js} +93 -29
- package/dist/posthog-integration-BGk6dYzS.js.map +1 -0
- package/dist/{provisioning-DEEt9xl4.js → provisioning-DoKcXygK.js} +3 -3
- package/dist/{provisioning-DEEt9xl4.js.map → provisioning-DoKcXygK.js.map} +1 -1
- package/dist/{queue-tools-i_TmeI02.js → queue-tools-B75RxrcC.js} +3 -3
- package/dist/{queue-tools-i_TmeI02.js.map → queue-tools-B75RxrcC.js.map} +1 -1
- package/dist/{registry-CbXqxcX0.js → registry-DbwlUbvA.js} +6 -6
- package/dist/{registry-CbXqxcX0.js.map → registry-DbwlUbvA.js.map} +1 -1
- package/dist/{security-DZ1rkONB.js → security-lqzh7NaZ.js} +5 -5
- package/dist/{security-DZ1rkONB.js.map → security-lqzh7NaZ.js.map} +1 -1
- package/dist/{setup-utils-BLKhAx6g.js → setup-utils-DeIoqwPw.js} +9 -9
- package/dist/{setup-utils-BLKhAx6g.js.map → setup-utils-DeIoqwPw.js.map} +1 -1
- package/dist/{start-tui-D1MqJVT1.js → start-tui-ebV_ynrs.js} +259 -134
- package/dist/start-tui-ebV_ynrs.js.map +1 -0
- package/dist/{steps-Dsw-zBET.js → steps-BB2izees.js} +7 -7
- package/dist/{steps-Dsw-zBET.js.map → steps-BB2izees.js.map} +1 -1
- package/dist/{store-OGBMWp3H.js → store-BbDrhStP.js} +40 -6
- package/dist/store-BbDrhStP.js.map +1 -0
- package/dist/{subagent-DrnKYgvu.js → subagent-oTBoYK3h.js} +2 -2
- package/dist/{subagent-DrnKYgvu.js.map → subagent-oTBoYK3h.js.map} +1 -1
- package/dist/{task-DyvLyDsO.js → task-BPsA2HrW.js} +13 -13
- package/dist/{task-DyvLyDsO.js.map → task-BPsA2HrW.js.map} +1 -1
- package/dist/{task-stream-CLXzeuPO.js → task-stream-DffFXskR.js} +6 -6
- package/dist/{task-stream-CLXzeuPO.js.map → task-stream-DffFXskR.js.map} +1 -1
- package/dist/{tasks-D77GNdOU.js → tasks-CmyTWgU7.js} +2 -2
- package/dist/{tasks-D77GNdOU.js.map → tasks-CmyTWgU7.js.map} +1 -1
- package/dist/{telemetry-wp-z9LXH.js → telemetry-DfZNqwpb.js} +3 -3
- package/dist/{telemetry-wp-z9LXH.js.map → telemetry-DfZNqwpb.js.map} +1 -1
- package/dist/{terminal-D9j4wbpD.js → terminal-DTJLXrQX.js} +12 -12
- package/dist/{terminal-D9j4wbpD.js.map → terminal-DTJLXrQX.js.map} +1 -1
- package/dist/{tools-D0r4e-Vu.js → tools-B4s78y8L.js} +6 -6
- package/dist/{tools-D0r4e-Vu.js.map → tools-B4s78y8L.js.map} +1 -1
- package/dist/{wizard-abort-oazJA1Jb.js → wizard-abort-CE6vlOGM.js} +1 -1
- package/dist/{wizard-abort-Bv87YVSp.js → wizard-abort-XQFt0vkZ.js} +5 -5
- package/dist/{wizard-abort-Bv87YVSp.js.map → wizard-abort-XQFt0vkZ.js.map} +1 -1
- package/dist/{wizard-session-C_7r3-rO.js → wizard-session-Bki7dQhv.js} +12 -2
- package/dist/wizard-session-Bki7dQhv.js.map +1 -0
- package/dist/{wizard-session-D1KQqUml.js → wizard-session-gbYCXdBf.js} +1 -1
- package/dist/yara-hooks-COTd_ALD.js +2 -0
- package/dist/{yara-hooks-DeonKbE_.js → yara-hooks-gZxdqlkx.js} +4 -4
- package/dist/{yara-hooks-DeonKbE_.js.map → yara-hooks-gZxdqlkx.js.map} +1 -1
- package/package.json +1 -1
- package/dist/agent-interface-CaEptZuu.js.map +0 -1
- package/dist/analytics-BNCWoTKa.js +0 -2
- package/dist/analytics-tF06lcmE.js.map +0 -1
- package/dist/errors-BHervYGs.js.map +0 -1
- package/dist/posthog-integration-DJX4qTDQ.js.map +0 -1
- package/dist/start-tui-D1MqJVT1.js.map +0 -1
- package/dist/store-OGBMWp3H.js.map +0 -1
- package/dist/wizard-session-C_7r3-rO.js.map +0 -1
- package/dist/yara-hooks-Bl-FeANN.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as logToFile } from "./debug-
|
|
2
|
-
import { n as analytics } from "./analytics-
|
|
1
|
+
import { s as logToFile } from "./debug-D5YT7Lil.js";
|
|
2
|
+
import { n as analytics } from "./analytics-DXPSL5IY.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-
|
|
242
|
+
//# sourceMappingURL=bounded-fs-DdHuSE1X.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bounded-fs-BwuqKpBH.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;C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,IAAI,CAAE;AAChC,SAAI,QAAQ,SAAU,OAAM,KAAK;MAAE,KAAK;MAAU,OAAO,QAAQ;MAAG,CAAC;eAC5D,QAAQ;AACjB,kBAAa;AACb,YAAO,MAAM,MAAM,SAAS;;;YAGxB;AACR,OAAI;AACF,WAAO,WAAW;WACZ;;;;;;;;AAWd,SAAgB,gBACd,UACA,WAAW,wBACI;AACf,KAAI;AACF,MAAI,GAAG,SAAS,SAAS,CAAC,OAAO,SAAU,QAAO;AAClD,SAAO,GAAG,aAAa,UAAU,QAAQ;SACnC;AACN,SAAO;;;;;;;AAQX,SAAgB,aAAa,UAAiC;AAC5D,KAAI;AACF,MAAI,GAAG,SAAS,SAAS,CAAC,OAAA,SAA+B;AACvD,aAAU,wCAAwC,WAAW;AAC7D,UAAO;;AAET,SAAO,GAAG,aAAa,UAAU,QAAQ;UAClC,OAAO;AACd,gBAAc,gBAAgB,UAAU,MAAM;AAC9C,SAAO;;;;;;AAOX,SAAgB,aAAa,UAAkB,OAA8B;AAC3E,KAAI;EACF,MAAM,KAAK,GAAG,SAAS,UAAU,IAAI;AACrC,MAAI;GACF,MAAM,SAAS,OAAO,MAAM,MAAM;GAClC,MAAM,OAAO,GAAG,SAAS,IAAI,QAAQ,GAAG,OAAO,EAAE;AACjD,UAAO,OAAO,SAAS,SAAS,GAAG,KAAK;YAChC;AACR,MAAG,UAAU,GAAG;;SAEZ;AACN,SAAO"}
|
|
1
|
+
{"version":3,"file":"bounded-fs-DdHuSE1X.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;C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U,OAAO,QAAQ;MAAG,CAAC;eAC5D,QAAQ;AACjB,kBAAa;AACb,YAAO,MAAM,MAAM,SAAS;;;YAGxB;AACR,OAAI;AACF,WAAO,WAAW;WACZ;;;;;;;;AAWd,SAAgB,gBACd,UACA,WAAW,wBACI;AACf,KAAI;AACF,MAAI,GAAG,SAAS,SAAS,CAAC,OAAO,SAAU,QAAO;AAClD,SAAO,GAAG,aAAa,UAAU,QAAQ;SACnC;AACN,SAAO;;;;;;;AAQX,SAAgB,aAAa,UAAiC;AAC5D,KAAI;AACF,MAAI,GAAG,SAAS,SAAS,CAAC,OAAA,SAA+B;AACvD,aAAU,wCAAwC,WAAW;AAC7D,UAAO;;AAET,SAAO,GAAG,aAAa,UAAU,QAAQ;UAClC,OAAO;AACd,gBAAc,gBAAgB,UAAU,MAAM;AAC9C,SAAO;;;;;;AAOX,SAAgB,aAAa,UAAkB,OAA8B;AAC3E,KAAI;EACF,MAAM,KAAK,GAAG,SAAS,UAAU,IAAI;AACrC,MAAI;GACF,MAAM,SAAS,OAAO,MAAM,MAAM;GAClC,MAAM,OAAO,GAAG,SAAS,IAAI,QAAQ,GAAG,OAAO,EAAE;AACjD,UAAO,OAAO,SAAS,SAAS,GAAG,KAAK;YAChC;AACR,MAAG,UAAU,GAAG;;SAEZ;AACN,SAAO"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as emitWizardError, l as ErrorCodes } from "./errors-
|
|
2
|
-
import { f as getUI, m as LoggingUI, p as setUI } from "./debug-
|
|
3
|
-
import { n as provisionNewAccount } from "./provisioning-
|
|
4
|
-
import { r as posthogIntegrationConfig } from "./posthog-integration-
|
|
1
|
+
import { c as emitWizardError, l as ErrorCodes } from "./errors-BSdz2lsl.js";
|
|
2
|
+
import { f as getUI, m as LoggingUI, p as setUI } from "./debug-D5YT7Lil.js";
|
|
3
|
+
import { n as provisionNewAccount } from "./provisioning-DoKcXygK.js";
|
|
4
|
+
import { r as posthogIntegrationConfig } from "./posthog-integration-BGk6dYzS.js";
|
|
5
5
|
import { c as runWizardHeadless, l as runWizardCI } from "./bin.js";
|
|
6
6
|
//#region src/commands/basic-integration/ci-install.ts
|
|
7
7
|
/**
|
|
@@ -119,4 +119,4 @@ async function provisionForSignup(options) {
|
|
|
119
119
|
//#endregion
|
|
120
120
|
export { runCIInstall, runHeadlessInstall };
|
|
121
121
|
|
|
122
|
-
//# sourceMappingURL=ci-install-
|
|
122
|
+
//# sourceMappingURL=ci-install-c-n8dJng.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-install-
|
|
1
|
+
{"version":3,"file":"ci-install-c-n8dJng.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 { 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, which api-key prefixes are accepted, and which runner is\n * invoked — the install itself is 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 const keyHint = headless\n ? 'personal API key phx_xxx or pha_ OAuth access token'\n : 'personal API key phx_xxx';\n return failCI(\n `${label} mode requires --api-key (${keyHint}). ` +\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, headless);\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 for the mode.\n *\n * This is the one behavioral fork between `--ci` and headless mode: the LLM\n * Gateway accepts a personal API key (`phx_`) in either mode, but in headless\n * a `pha_` OAuth access token is *also* first-class — PostHog mints one under\n * the wizard's own OAuth application for cloud runs and passes it as the\n * api-key. Outside headless that token is unexpected and still warns.\n *\n * Extracted as a pure predicate so the fork can be unit-tested without a UI.\n */\nexport function keyPrefixWarning(\n apiKey: string | undefined,\n headless: boolean,\n): string | null {\n if (!apiKey || apiKey.startsWith('phx_')) return null;\n if (headless && apiKey.startsWith('pha_')) return null;\n const prefix = apiKey.slice(0, 4);\n const hint =\n prefix === 'pha_'\n ? ' (pha_ is an OAuth access token — CI mode expects a personal API key)'\n : prefix === 'phc_'\n ? ' (phc_ is a project/client key — expected a personal API key)'\n : '';\n return `--api-key does not start with \"phx_\"${hint}. Continuing anyway, but the LLM Gateway may reject it with a 401.`;\n}\n\nfunction warnOnUnexpectedKeyPrefix(\n apiKey: string | undefined,\n headless: boolean,\n): void {\n const message = keyPrefixWarning(apiKey, headless);\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,OAI9B,QAAO,OACL,GAAG,MAAM,4BAJK,WACZ,wDACA,2BAE2C,4EAE7C,WAAW,kBACZ;AAEH,KAAI,CAAC,QAAQ,UAAU,QAAQ,UAAU,CAAC,QAAQ,MAChD,QAAO,OACL,GAAG,MAAM,sDACT,WAAW,iBACZ;AAEH,2BAA0B,QAAQ,QAAQ,SAAS;AAEnD,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,CAAC;AACtB,QAAO,CAAC,MAAM,iBA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AO,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-
|
|
1
|
+
import { n as configureLogFileFromEnvironment, s as logToFile } from "./debug-D5YT7Lil.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.
|
|
72
|
+
const VERSION = "2.70.0";
|
|
73
73
|
//#endregion
|
|
74
74
|
//#region src/lib/constants.ts
|
|
75
75
|
/**
|
|
@@ -998,7 +998,7 @@ let reportedLogFailure = false;
|
|
|
998
998
|
function reportLogFailureOnce(err) {
|
|
999
999
|
if (reportedLogFailure) return;
|
|
1000
1000
|
reportedLogFailure = true;
|
|
1001
|
-
import("./analytics-
|
|
1001
|
+
import("./analytics-CbkGZjMp.js").then(({ analytics }) => analytics.captureException(err instanceof Error ? err : new Error(String(err)), {
|
|
1002
1002
|
source: "log-file-write",
|
|
1003
1003
|
log_path: logFilePath,
|
|
1004
1004
|
platform: process.platform
|
|
@@ -1044,4 +1044,4 @@ function enableDebugLogs() {
|
|
|
1044
1044
|
//#endregion
|
|
1045
1045
|
export { REMOTE_SKILLS_BASE_URL as $, GPT5_6_LUNA_MODEL as A, OPUS_MODEL as B, ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY as C, isHeadless as Ct, DEFAULT_AGENT_MODEL as D, CONTEXT_MILL_URL as E, Harness as F, POSTHOG_FLAG_HEADER_PREFIX as G, POSTHOG_DEV_CLIENT_ID as H, ISSUES_URL as I, POSTHOG_PROPERTY_HEADER_PREFIX as J, POSTHOG_ORG_AI_SETTINGS_URL as K, Integration as L, GPT5_6_TERRA_MODEL as M, HAIKU_MODEL as N, DETECTION_TIMEOUT_MS as O, HAIKU_TRIAGE_MODEL as P, POSTHOG_US_CLIENT_ID as Q, OAUTH_PORTS as R, ANALYTICS_HOST_URL as S, headlessOption as St, CONTEXT_MILL_RELEASES_URL as T, POSTHOG_DOCS_URL as U, POSTHOG_APP_URL as V, POSTHOG_EU_CLIENT_ID as W, POSTHOG_STATUS_PAGE_URL as X, POSTHOG_PROXY_CLIENT_ID as Y, POSTHOG_TERMS_URL as Z, evaluateWizardReadiness as _, NODE_ENV as _t, getLogFilePath as a, WIZARD_INTERACTION_EVENT_NAME as at, isTaskStatus as b, TASK_RUN_ID as bt, WIZARD_BENCHMARK_FILE as c, WIZARD_ORCHESTRATOR_OVERRIDE_FLAG_KEY as ct, relativeToInstallDir as d, WIZARD_REMARK_EVENT_NAME as dt, SONNET_5_MODEL as et, getUI as f, WIZARD_SELF_DRIVING_USE_PI_HARNESS_FLAG_KEY as ft, SIGNUP_WIZARD_READINESS_CONFIG as g, VERSION as gt, SERVICE_LABELS as h, wizardUserAgentForProgram as ht, enableDebugLogs as i, WIZARD_FLAG_KEYS as it, GPT5_6_SOL_MODEL as j, DUMMY_PROJECT_API_KEY as k, WIZARD_LOG_FILE as l, WIZARD_ORCHESTRATOR_SEEDED_TASKS_FLAG_KEY as lt, LoggingUI as m, getSkillsBaseUrl as mt, configureLogFileFromEnvironment as n, WIZARD_BASIC_INTEGRATION_AGENTIC_DETECTION_FLAG_KEY as nt, initLogFile as o, WIZARD_OAUTH_SCOPES as ot, setUI as p, WIZARD_USER_AGENT as pt, POSTHOG_PRIVACY_URL as q, debug as r, WIZARD_CONTACT_EMAIL as rt, logToFile as s, WIZARD_ORCHESTRATOR_FLAG_KEY as st, configureLogFile as t, Sequence as tt, WIZARD_YARA_REPORT_FILE as u, WIZARD_PROVISIONING_SCOPES as ut, getBlockingServiceKeys as v, RUN_SURFACE as vt, ANALYTICS_TEAM_TAG as w, regionOption as wt, AGENTIC_DETECTION_TIMEOUT_MS as x, runtimeEnv as xt, TaskStatus as y, TASK_ID as yt, OAUTH_TIMEOUT_MS as z };
|
|
1046
1046
|
|
|
1047
|
-
//# sourceMappingURL=debug-
|
|
1047
|
+
//# sourceMappingURL=debug-D5YT7Lil.js.map
|