@baton-dx/cli 0.4.4 → 0.5.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/{ai-tool-detection-BFep6YS9.mjs → ai-tool-detection-Bw4qveB8.mjs} +1 -1
- package/dist/{ai-tool-detection-CMsBNa9e.mjs → ai-tool-detection-DMnwwNBI.mjs} +1 -1
- package/dist/{ai-tool-detection-CMsBNa9e.mjs.map → ai-tool-detection-DMnwwNBI.mjs.map} +1 -1
- package/dist/{context-detection-Ddu0mj_K.mjs → context-detection-C7T1evnW.mjs} +40 -11
- package/dist/context-detection-C7T1evnW.mjs.map +1 -0
- package/dist/{create-DEZA3dPb.mjs → create-Cx1nCS3X.mjs} +4 -6
- package/dist/{create-DEZA3dPb.mjs.map → create-Cx1nCS3X.mjs.map} +1 -1
- package/dist/index.mjs +1051 -486
- package/dist/index.mjs.map +1 -1
- package/dist/{list-BT2zFAVc.mjs → list-BsAASsXi.mjs} +4 -5
- package/dist/{list-BT2zFAVc.mjs.map → list-BsAASsXi.mjs.map} +1 -1
- package/dist/{prompt-DtgNNhRW.mjs → prompt-C7kAOs-S.mjs} +5 -5
- package/dist/prompt-C7kAOs-S.mjs.map +1 -0
- package/dist/{remove-BBFBYUPy.mjs → remove-36qv7yQ3.mjs} +2 -2
- package/dist/{remove-BBFBYUPy.mjs.map → remove-36qv7yQ3.mjs.map} +1 -1
- package/dist/{src-dY02psbw.mjs → src-n95I0s2u.mjs} +4572 -61
- package/dist/src-n95I0s2u.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-BbwQpWto.mjs +0 -33
- package/dist/context-detection-Ddu0mj_K.mjs.map +0 -1
- package/dist/esm-BagM-kVd.mjs +0 -4526
- package/dist/esm-BagM-kVd.mjs.map +0 -1
- package/dist/esm-CuRZ1S4C.mjs +0 -4
- package/dist/prompt-DtgNNhRW.mjs.map +0 -1
- package/dist/src-dY02psbw.mjs.map +0 -1
|
@@ -735,4 +735,4 @@ function clearAIToolCache() {
|
|
|
735
735
|
|
|
736
736
|
//#endregion
|
|
737
737
|
export { AI_TOOL_PATHS as i, detectInstalledAITools as n, evaluateDetection as r, clearAIToolCache as t };
|
|
738
|
-
//# sourceMappingURL=ai-tool-detection-
|
|
738
|
+
//# sourceMappingURL=ai-tool-detection-DMnwwNBI.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-tool-detection-CMsBNa9e.mjs","names":[],"sources":["../../ai-tool-paths/src/registry.ts","../../core/src/detection/mechanisms.ts","../../core/src/detection/ai-tool-detection.ts"],"sourcesContent":["import type { AIToolPathConfig } from \"./types.js\";\n\n/**\n * Registry of all supported AI agents and their path configurations.\n * Each agent defines where it expects skills, rules, agents, memory, and commands.\n */\nexport const AI_TOOL_PATHS: readonly AIToolPathConfig[] = [\n {\n key: \"claude-code\",\n name: \"Claude Code\",\n skills: {\n project: \".claude/skills/{name}\",\n global: \"~/.claude/skills/{name}\",\n },\n rules: {\n project: \".claude/rules/{name}.md\",\n global: \"~/.claude/rules/{name}.md\",\n },\n agents: {\n project: \".claude/agents/{name}.md\",\n global: \"~/.claude/agents/{name}.md\",\n },\n memory: {\n project: \"CLAUDE.md\",\n global: \"~/.claude/CLAUDE.md\",\n },\n commands: {\n project: \".claude/commands/{name}.md\",\n global: \"~/.claude/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"binary\", name: \"claude\", versionPattern: /claude/i }],\n [{ type: \"directory\", path: \"~/.claude/\", markerFile: \"settings.json\" }],\n ],\n },\n legacy: {},\n },\n {\n key: \"cursor\",\n name: \"Cursor\",\n skills: {\n project: \".cursor/skills/{name}\",\n global: \"~/.cursor/skills/{name}\",\n },\n rules: {\n project: \".cursor/rules/{name}.mdc\",\n global: \"~/.cursor/rules/{name}.mdc\",\n },\n agents: {\n project: \".cursor/agents/{name}.md\",\n global: \"~/.cursor/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.cursor/AGENTS.md\",\n },\n commands: {\n project: \".cursor/commands/{name}.md\",\n global: \"~/.cursor/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"app\", name: \"Cursor.app\" }],\n [{ type: \"binary\", name: \"cursor\" }],\n [{ type: \"directory\", path: \"~/.cursor/\", markerFile: \"extensions\" }],\n ],\n },\n legacy: {\n rules: [\".cursorrules\"],\n },\n },\n {\n key: \"windsurf\",\n name: \"Windsurf\",\n skills: {\n project: \".windsurf/skills/{name}\",\n global: \"~/.codeium/windsurf/skills/{name}\",\n },\n rules: {\n project: \".windsurf/rules/{name}.md\",\n global: \"~/.codeium/windsurf/rules/{name}.md\",\n },\n agents: {\n project: \".windsurf/agents/{name}.md\",\n global: \"~/.codeium/windsurf/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.codeium/windsurf/AGENTS.md\",\n },\n commands: {\n project: \".windsurf/workflows/{name}.md\",\n global: \"~/.codeium/windsurf/workflows/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"app\", name: \"Windsurf.app\" }],\n [{ type: \"binary\", name: \"windsurf\" }],\n [\n {\n type: \"directory\",\n path: \"~/.codeium/windsurf/\",\n markerFile: \"settings.json\",\n },\n ],\n ],\n },\n legacy: {\n rules: [\".windsurfrules\"],\n },\n },\n {\n key: \"antigravity\",\n name: \"Antigravity\",\n skills: {\n project: \".agent/skills/{name}\",\n global: \"~/.gemini/antigravity/skills/{name}\",\n },\n rules: {\n project: \".agent/rules/{name}.md\",\n global: \"~/.gemini/antigravity/rules/{name}.md\",\n },\n agents: {\n project: \".agent/agents/{name}.md\",\n global: \"~/.gemini/antigravity/agents/{name}.md\",\n },\n memory: {\n project: \"GEMINI.md\",\n global: \"~/.gemini/antigravity/GEMINI.md\",\n },\n commands: {\n project: \".agent/workflows/{name}.md\",\n global: \"~/.gemini/antigravity/workflows/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"app\", name: \"Antigravity.app\" }],\n [{ type: \"binary\", name: \"agy\" }],\n [{ type: \"binary\", name: \"antigravity\", platforms: [\"linux\"] }],\n [\n {\n type: \"directory\",\n path: \"~/.gemini/antigravity/\",\n markerFile: \"settings.json\",\n },\n ],\n ],\n },\n legacy: {},\n },\n {\n key: \"codex\",\n name: \"Codex CLI\",\n skills: {\n project: \".codex/skills/{name}\",\n global: \"~/.codex/skills/{name}\",\n },\n rules: {\n project: \".codex/rules/{name}.md\",\n global: \"~/.codex/rules/{name}.md\",\n },\n agents: {\n project: \".codex/agents/{name}.md\",\n global: \"~/.codex/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.codex/AGENTS.md\",\n },\n commands: {\n project: \".codex/commands/{name}.md\",\n global: \"~/.codex/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"binary\", name: \"codex\", versionPattern: /codex/i }],\n [{ type: \"directory\", path: \"~/.codex/\", markerFile: \"config.toml\" }],\n ],\n },\n legacy: {},\n },\n {\n key: \"github-copilot\",\n name: \"GitHub Copilot\",\n skills: {\n project: \".github/skills/{name}\",\n global: \"~/.github/skills/{name}\",\n },\n rules: {\n project: \".github/copilot-instructions.md\",\n global: \"~/.github/copilot-instructions.md\",\n },\n agents: {\n project: \".github/agents/{name}.md\",\n global: \"~/.github/agents/{name}.md\",\n },\n memory: {\n project: \".github/copilot-instructions.md\",\n global: \"~/.github/copilot-instructions.md\",\n },\n commands: {\n project: \".github/copilot/commands/{name}.md\",\n global: \"~/.github/copilot/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [\n {\n type: \"binary\",\n name: \"copilot\",\n versionPattern: /copilot|github/i,\n },\n ],\n [\n {\n type: \"vscode-extension\",\n extensionId: \"GitHub.copilot\",\n editors: [\"vscode\", \"cursor\"],\n },\n ],\n [{ type: \"directory\", path: \"~/.github/copilot/\" }],\n ],\n },\n legacy: {},\n },\n {\n key: \"opencode\",\n name: \"OpenCode\",\n skills: {\n project: \".opencode/skills/{name}\",\n global: \"~/.config/opencode/skills/{name}\",\n },\n rules: {\n project: \".opencode/rules/{name}.md\",\n global: \"~/.config/opencode/rules/{name}.md\",\n },\n agents: {\n project: \".opencode/agents/{name}.md\",\n global: \"~/.config/opencode/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.config/opencode/AGENTS.md\",\n },\n commands: {\n project: \".opencode/commands/{name}.md\",\n global: \"~/.config/opencode/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"binary\", name: \"opencode\", versionPattern: /opencode|sst/i }],\n [\n {\n type: \"directory\",\n path: \"~/.config/opencode/\",\n markerFile: \"config.yaml\",\n },\n ],\n ],\n },\n legacy: {},\n },\n {\n key: \"amp\",\n name: \"Amp\",\n skills: {\n project: \".agents/skills/{name}\",\n global: \"~/.config/agents/skills/{name}\",\n },\n rules: {\n project: \".agents/rules/{name}.md\",\n global: \"~/.config/agents/rules/{name}.md\",\n },\n agents: {\n project: \".agents/agents/{name}.md\",\n global: \"~/.config/agents/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.config/agents/AGENTS.md\",\n },\n commands: {\n project: \".agents/commands/{name}.md\",\n global: \"~/.config/agents/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"binary\", name: \"amp\", versionPattern: /amp|sourcegraph/i }],\n [{ type: \"directory\", path: \"~/.ampcache/\" }],\n ],\n },\n legacy: {},\n },\n {\n key: \"kiro\",\n name: \"Kiro\",\n skills: {\n project: \".kiro/skills/{name}\",\n global: \"~/.kiro/skills/{name}\",\n },\n rules: {\n project: \".kiro/rules/{name}.md\",\n global: \"~/.kiro/rules/{name}.md\",\n },\n agents: {\n project: \".kiro/agents/{name}.md\",\n global: \"~/.kiro/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.kiro/AGENTS.md\",\n },\n commands: {\n project: \".kiro/commands/{name}.md\",\n global: \"~/.kiro/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"app\", name: \"Kiro.app\" }],\n [{ type: \"binary\", name: \"kiro\" }],\n [{ type: \"directory\", path: \"~/.kiro/\", markerFile: \"settings.json\" }],\n ],\n },\n legacy: {},\n },\n {\n key: \"zed\",\n name: \"Zed\",\n skills: {\n project: \".zed/skills/{name}\",\n global: \"~/.zed/skills/{name}\",\n },\n rules: {\n project: \".zed/rules/{name}.md\",\n global: \"~/.zed/rules/{name}.md\",\n },\n agents: {\n project: \".zed/agents/{name}.md\",\n global: \"~/.zed/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.zed/AGENTS.md\",\n },\n commands: {\n project: \".zed/commands/{name}.md\",\n global: \"~/.zed/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"app\", name: \"Zed.app\" }],\n [{ type: \"binary\", name: \"zed\" }],\n [\n {\n type: \"directory\",\n path: \"~/.config/zed/\",\n markerFile: \"settings.json\",\n },\n ],\n ],\n },\n legacy: {},\n },\n {\n key: \"cline\",\n name: \"Cline\",\n skills: {\n project: \".cline/skills/{name}\",\n global: \"~/.cline/skills/{name}\",\n },\n rules: {\n project: \".cline/rules/{name}.md\",\n global: \"~/.cline/rules/{name}.md\",\n },\n agents: {\n project: \".cline/agents/{name}.md\",\n global: \"~/.cline/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.cline/AGENTS.md\",\n },\n commands: {\n project: \".cline/commands/{name}.md\",\n global: \"~/.cline/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [\n {\n type: \"vscode-extension\",\n extensionId: \"saoudrizwan.claude-dev\",\n editors: [\"vscode\", \"cursor\", \"windsurf\"],\n },\n ],\n [\n {\n type: \"directory\",\n path: \"~/.cline/\",\n markerFile: \"settings.json\",\n },\n ],\n ],\n },\n legacy: {},\n },\n {\n key: \"roo\",\n name: \"Roo\",\n skills: {\n project: \".roo/skills/{name}\",\n global: \"~/.roo/skills/{name}\",\n },\n rules: {\n project: \".roo/rules/{name}.md\",\n global: \"~/.roo/rules/{name}.md\",\n },\n agents: {\n project: \".roo/agents/{name}.md\",\n global: \"~/.roo/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.roo/AGENTS.md\",\n },\n commands: {\n project: \".roo/commands/{name}.md\",\n global: \"~/.roo/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [\n {\n type: \"vscode-extension\",\n extensionId: \"RooVeterinaryInc.roo-cline\",\n editors: [\"vscode\", \"cursor\", \"windsurf\"],\n },\n ],\n [{ type: \"directory\", path: \"~/.roo/\", markerFile: \"settings.json\" }],\n ],\n },\n legacy: {},\n },\n {\n key: \"junie\",\n name: \"Junie\",\n skills: {\n project: \".junie/skills/{name}\",\n global: \"~/.junie/skills/{name}\",\n },\n rules: {\n project: \".junie/rules/{name}.md\",\n global: \"~/.junie/rules/{name}.md\",\n },\n agents: {\n project: \".junie/agents/{name}.md\",\n global: \"~/.junie/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.junie/AGENTS.md\",\n },\n commands: {\n project: \".junie/commands/{name}.md\",\n global: \"~/.junie/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"jetbrains-plugin\", pluginId: \"junie\" }],\n [\n {\n type: \"directory\",\n path: \"~/.junie/\",\n markerFile: \"settings.json\",\n },\n ],\n ],\n },\n legacy: {},\n },\n {\n key: \"trae\",\n name: \"Trae\",\n skills: {\n project: \".trae/skills/{name}\",\n global: \"~/.trae/skills/{name}\",\n },\n rules: {\n project: \".trae/rules/{name}.md\",\n global: \"~/.trae/rules/{name}.md\",\n },\n agents: {\n project: \".trae/agents/{name}.md\",\n global: \"~/.trae/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.trae/AGENTS.md\",\n },\n commands: {\n project: \".trae/commands/{name}.md\",\n global: \"~/.trae/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"app\", name: \"Trae.app\" }],\n [{ type: \"directory\", path: \"~/.trae/\", markerFile: \"settings.json\" }],\n ],\n },\n legacy: {},\n },\n];\n","import { execFile } from \"node:child_process\";\nimport { constants, access, readdir } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type {\n AppBundleCheck,\n BinaryCheck,\n DetectionCheck,\n DetectionConfig,\n DirectoryCheck,\n JetbrainsPluginCheck,\n Platform,\n VscodeExtensionCheck,\n} from \"@baton-dx/ai-tool-paths\";\n\n/**\n * Execute a command and return stdout/stderr as a promise.\n * Rejects on non-zero exit code or timeout.\n */\nfunction execAsync(\n command: string,\n args: string[],\n options: { timeout?: number } = {},\n): Promise<{ stdout: string; stderr: string }> {\n return new Promise((resolve, reject) => {\n execFile(command, args, options, (error, stdout, stderr) => {\n if (error) {\n reject(error);\n } else {\n resolve({ stdout: String(stdout), stderr: String(stderr) });\n }\n });\n });\n}\n\n/**\n * Check if a binary exists in PATH and optionally verify its identity via version output.\n * Prevents false positives from binary name collisions (e.g., `opencode` by Litestar vs SST).\n */\nexport async function checkBinary(check: BinaryCheck): Promise<boolean> {\n if (check.platforms && !check.platforms.includes(process.platform as Platform)) {\n return false;\n }\n\n const lookupCommand = process.platform === \"win32\" ? \"where\" : \"which\";\n\n try {\n await execAsync(lookupCommand, [check.name]);\n } catch {\n return false;\n }\n\n if (!check.versionPattern) {\n return true;\n }\n\n const versionFlag = check.versionFlag ?? \"--version\";\n try {\n const { stdout, stderr } = await execAsync(check.name, [versionFlag], {\n timeout: 5000,\n });\n const output = `${stdout}\\n${stderr}`;\n return check.versionPattern.test(output);\n } catch {\n return false;\n }\n}\n\n/**\n * Check if a directory exists and optionally contains a marker file.\n * Prevents false positives from leftover empty directories (e.g., ~/.cline/ without settings.json).\n */\nexport async function checkDirectory(check: DirectoryCheck): Promise<boolean> {\n if (check.platforms && !check.platforms.includes(process.platform as Platform)) {\n return false;\n }\n\n const expandedPath = check.path.startsWith(\"~/\")\n ? join(homedir(), check.path.slice(2))\n : check.path;\n\n try {\n await access(expandedPath, constants.R_OK);\n } catch {\n return false;\n }\n\n if (!check.markerFile) {\n return true;\n }\n\n try {\n await access(join(expandedPath, check.markerFile));\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Check if a macOS .app bundle exists in /Applications or ~/Applications.\n * Returns false immediately on non-darwin platforms.\n */\nexport async function checkAppBundle(check: AppBundleCheck): Promise<boolean> {\n if (process.platform !== \"darwin\") {\n return false;\n }\n\n const searchPaths = check.searchPaths ?? [\"/Applications\", join(homedir(), \"Applications\")];\n\n for (const dir of searchPaths) {\n try {\n await access(join(dir, check.name));\n return true;\n } catch {\n // not found in this path, try next\n }\n }\n\n return false;\n}\n\n/** Map of editor names to their extension directory paths. */\nconst EDITOR_EXTENSION_DIRS: Record<string, string> = {\n vscode: join(homedir(), \".vscode\", \"extensions\"),\n cursor: join(homedir(), \".cursor\", \"extensions\"),\n windsurf: join(homedir(), \".windsurf\", \"extensions\"),\n};\n\n/**\n * Check if a VS Code extension is installed in VS Code, Cursor, or Windsurf.\n * Matches extension directories by prefix (case-insensitive) since directories\n * are named `<extensionId>-<version>`.\n */\nexport async function checkVscodeExtension(check: VscodeExtensionCheck): Promise<boolean> {\n const editors = check.editors ?? [\"vscode\"];\n const prefix = check.extensionId.toLowerCase();\n\n for (const editor of editors) {\n const extDir = EDITOR_EXTENSION_DIRS[editor];\n if (!extDir) {\n // skip unknown editor\n } else {\n try {\n const entries = await readdir(extDir);\n if (entries.some((entry) => entry.toLowerCase().startsWith(prefix))) {\n return true;\n }\n } catch {\n // extension directory missing (ENOENT) — skip, not throw\n }\n }\n }\n\n return false;\n}\n\n/**\n * Get the JetBrains config base directory for the current platform.\n * macOS: ~/Library/Application Support/JetBrains/\n * Linux: ~/.config/JetBrains/\n * Windows: %APPDATA%/JetBrains/\n */\nfunction getJetbrainsConfigBase(): string | undefined {\n switch (process.platform) {\n case \"darwin\":\n return join(homedir(), \"Library\", \"Application Support\", \"JetBrains\");\n case \"linux\":\n return join(homedir(), \".config\", \"JetBrains\");\n case \"win32\":\n return process.env.APPDATA ? join(process.env.APPDATA, \"JetBrains\") : undefined;\n default:\n return undefined;\n }\n}\n\n/**\n * Check if a JetBrains plugin is installed by scanning IDE config directories.\n * Looks for pluginId as a subdirectory under <version>/plugins/ across all IDE versions.\n */\nexport async function checkJetbrainsPlugin(check: JetbrainsPluginCheck): Promise<boolean> {\n const base = getJetbrainsConfigBase();\n if (!base) {\n return false;\n }\n\n let versionDirs: string[];\n try {\n versionDirs = await readdir(base);\n } catch {\n return false;\n }\n\n for (const versionDir of versionDirs) {\n try {\n const pluginEntries = await readdir(join(base, versionDir, \"plugins\"));\n if (pluginEntries.some((entry) => entry.toLowerCase() === check.pluginId.toLowerCase())) {\n return true;\n }\n } catch {\n // plugins directory missing for this version — skip\n }\n }\n\n return false;\n}\n\n/**\n * Handler map for dispatching detection checks by type.\n * Uses an object so that individual handlers can be spied on in tests\n * (ESM module exports are not interceptable for intra-module calls).\n */\nexport const checkHandlers = {\n binary: checkBinary,\n directory: checkDirectory,\n app: checkAppBundle,\n \"vscode-extension\": checkVscodeExtension,\n \"jetbrains-plugin\": checkJetbrainsPlugin,\n};\n\n/**\n * Dispatch a single detection check to the appropriate mechanism function.\n */\nfunction runCheck(check: DetectionCheck): Promise<boolean> {\n switch (check.type) {\n case \"binary\":\n return checkHandlers.binary(check);\n case \"directory\":\n return checkHandlers.directory(check);\n case \"app\":\n return checkHandlers.app(check);\n case \"vscode-extension\":\n return checkHandlers[\"vscode-extension\"](check);\n case \"jetbrains-plugin\":\n return checkHandlers[\"jetbrains-plugin\"](check);\n }\n}\n\n/**\n * Evaluate a DetectionConfig using OR-of-ANDs logic.\n * Each group is evaluated in parallel. Within a group, ALL checks must pass (AND).\n * ANY group passing means the tool is detected (OR across groups).\n */\nexport async function evaluateDetection(config: DetectionConfig): Promise<boolean> {\n const groupResults = await Promise.all(\n config.groups.map(async (group) => {\n const results = await Promise.all(group.map(runCheck));\n return results.every(Boolean);\n }),\n );\n return groupResults.some(Boolean);\n}\n","import { AI_TOOL_PATHS } from \"@baton-dx/ai-tool-paths\";\nimport { evaluateDetection } from \"./mechanisms.js\";\n\n/**\n * Cache for detected AI tools (valid for process lifetime)\n */\nlet cachedAITools: string[] | null = null;\n\n/**\n * Detect if a specific AI tool is installed using structured detectionConfig.\n */\nasync function isAIToolInstalled(toolKey: string): Promise<boolean> {\n const toolConfig = AI_TOOL_PATHS.find((agent) => agent.key === toolKey);\n if (!toolConfig?.detectionConfig) return false;\n\n return evaluateDetection(toolConfig.detectionConfig);\n}\n\n/**\n * Detect all installed AI tools\n * Results are cached for the duration of the process\n */\nexport async function detectInstalledAITools(): Promise<string[]> {\n // Return cached result if available\n if (cachedAITools !== null) {\n return cachedAITools;\n }\n\n const installedAITools: string[] = [];\n\n // Check each tool in parallel\n const detectionPromises = AI_TOOL_PATHS.map(async (agent) => {\n const isInstalled = await isAIToolInstalled(agent.key);\n return isInstalled ? agent.key : null;\n });\n\n const results = await Promise.all(detectionPromises);\n\n // Filter out null results\n for (const result of results) {\n if (result !== null) {\n installedAITools.push(result);\n }\n }\n\n // Cache the result\n cachedAITools = installedAITools;\n\n return installedAITools;\n}\n\n/**\n * Clear the AI tool detection cache\n * Useful for testing or when tool installation state may have changed\n */\nexport function clearAIToolCache(): void {\n cachedAITools = null;\n}\n\n/**\n * Override AI tool detection with a specific list of tools\n * Used when --agents flag is provided\n */\nexport function setDetectedAITools(tools: string[]): void {\n cachedAITools = [...tools];\n}\n"],"mappings":";;;;;;;;;;;AAMA,MAAa,gBAA6C;CACxD;EACE,KAAK;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,OAAO;GACL,SAAS;GACT,QAAQ;GACT;EACD,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,UAAU;GACR,SAAS;GACT,QAAQ;GACT;EACD,iB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B,QAA2C;AAOjF,SANqB,MAAM,QAAQ,IACjC,OAAO,OAAO,IAAI,OAAO,UAAU;AAEjC,UADgB,MAAM,QAAQ,IAAI,MAAM,IAAI,SAAS,CAAC,EACvC,MAAM,QAAQ;GAC7B,CACH,EACmB,KAAK,QAAQ;;;;;;;;ACpPnC,IAAI,gBAAiC;;;;AAKrC,eAAe,kBAAkB,SAAmC;CAClE,MAAM,aAAa,cAAc,MAAM,UAAU,MAAM,QAAQ,QAAQ;AACvE,KAAI,CAAC,YAAY,gBAAiB,QAAO;AAEzC,QAAO,kBAAkB,WAAW,gBAAgB;;;;;;AAOtD,eAAsB,yBAA4C;AAEhE,KAAI,kBAAkB,KACpB,QAAO;CAGT,MAAM,mBAA6B,EAAE;CAGrC,MAAM,oBAAoB,cAAc,IAAI,OAAO,UAAU;AAE3D,SADoB,MAAM,kBAAkB,MAAM,IAAI,GACjC,MAAM,MAAM;GACjC;CAEF,MAAM,UAAU,MAAM,QAAQ,IAAI,kBAAkB;AAGpD,MAAK,MAAM,UAAU,QACnB,KAAI,WAAW,KACb,kBAAiB,KAAK,OAAO;AAKjC,iBAAgB;AAEhB,QAAO;;;;;;AAOT,SAAgB,mBAAyB;AACvC,iBAAgB"}
|
|
1
|
+
{"version":3,"file":"ai-tool-detection-DMnwwNBI.mjs","names":[],"sources":["../../ai-tool-paths/src/registry.ts","../../core/src/detection/mechanisms.ts","../../core/src/detection/ai-tool-detection.ts"],"sourcesContent":["import type { AIToolPathConfig } from \"./types.js\";\n\n/**\n * Registry of all supported AI agents and their path configurations.\n * Each agent defines where it expects skills, rules, agents, memory, and commands.\n */\nexport const AI_TOOL_PATHS: readonly AIToolPathConfig[] = [\n {\n key: \"claude-code\",\n name: \"Claude Code\",\n skills: {\n project: \".claude/skills/{name}\",\n global: \"~/.claude/skills/{name}\",\n },\n rules: {\n project: \".claude/rules/{name}.md\",\n global: \"~/.claude/rules/{name}.md\",\n },\n agents: {\n project: \".claude/agents/{name}.md\",\n global: \"~/.claude/agents/{name}.md\",\n },\n memory: {\n project: \"CLAUDE.md\",\n global: \"~/.claude/CLAUDE.md\",\n },\n commands: {\n project: \".claude/commands/{name}.md\",\n global: \"~/.claude/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"binary\", name: \"claude\", versionPattern: /claude/i }],\n [{ type: \"directory\", path: \"~/.claude/\", markerFile: \"settings.json\" }],\n ],\n },\n legacy: {},\n },\n {\n key: \"cursor\",\n name: \"Cursor\",\n skills: {\n project: \".cursor/skills/{name}\",\n global: \"~/.cursor/skills/{name}\",\n },\n rules: {\n project: \".cursor/rules/{name}.mdc\",\n global: \"~/.cursor/rules/{name}.mdc\",\n },\n agents: {\n project: \".cursor/agents/{name}.md\",\n global: \"~/.cursor/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.cursor/AGENTS.md\",\n },\n commands: {\n project: \".cursor/commands/{name}.md\",\n global: \"~/.cursor/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"app\", name: \"Cursor.app\" }],\n [{ type: \"binary\", name: \"cursor\" }],\n [{ type: \"directory\", path: \"~/.cursor/\", markerFile: \"extensions\" }],\n ],\n },\n legacy: {\n rules: [\".cursorrules\"],\n },\n },\n {\n key: \"windsurf\",\n name: \"Windsurf\",\n skills: {\n project: \".windsurf/skills/{name}\",\n global: \"~/.codeium/windsurf/skills/{name}\",\n },\n rules: {\n project: \".windsurf/rules/{name}.md\",\n global: \"~/.codeium/windsurf/rules/{name}.md\",\n },\n agents: {\n project: \".windsurf/agents/{name}.md\",\n global: \"~/.codeium/windsurf/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.codeium/windsurf/AGENTS.md\",\n },\n commands: {\n project: \".windsurf/workflows/{name}.md\",\n global: \"~/.codeium/windsurf/workflows/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"app\", name: \"Windsurf.app\" }],\n [{ type: \"binary\", name: \"windsurf\" }],\n [\n {\n type: \"directory\",\n path: \"~/.codeium/windsurf/\",\n markerFile: \"settings.json\",\n },\n ],\n ],\n },\n legacy: {\n rules: [\".windsurfrules\"],\n },\n },\n {\n key: \"antigravity\",\n name: \"Antigravity\",\n skills: {\n project: \".agent/skills/{name}\",\n global: \"~/.gemini/antigravity/skills/{name}\",\n },\n rules: {\n project: \".agent/rules/{name}.md\",\n global: \"~/.gemini/antigravity/rules/{name}.md\",\n },\n agents: {\n project: \".agent/agents/{name}.md\",\n global: \"~/.gemini/antigravity/agents/{name}.md\",\n },\n memory: {\n project: \"GEMINI.md\",\n global: \"~/.gemini/antigravity/GEMINI.md\",\n },\n commands: {\n project: \".agent/workflows/{name}.md\",\n global: \"~/.gemini/antigravity/workflows/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"app\", name: \"Antigravity.app\" }],\n [{ type: \"binary\", name: \"agy\" }],\n [{ type: \"binary\", name: \"antigravity\", platforms: [\"linux\"] }],\n [\n {\n type: \"directory\",\n path: \"~/.gemini/antigravity/\",\n markerFile: \"settings.json\",\n },\n ],\n ],\n },\n legacy: {},\n },\n {\n key: \"codex\",\n name: \"Codex CLI\",\n skills: {\n project: \".codex/skills/{name}\",\n global: \"~/.codex/skills/{name}\",\n },\n rules: {\n project: \".codex/rules/{name}.md\",\n global: \"~/.codex/rules/{name}.md\",\n },\n agents: {\n project: \".codex/agents/{name}.md\",\n global: \"~/.codex/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.codex/AGENTS.md\",\n },\n commands: {\n project: \".codex/commands/{name}.md\",\n global: \"~/.codex/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"binary\", name: \"codex\", versionPattern: /codex/i }],\n [{ type: \"directory\", path: \"~/.codex/\", markerFile: \"config.toml\" }],\n ],\n },\n legacy: {},\n },\n {\n key: \"github-copilot\",\n name: \"GitHub Copilot\",\n skills: {\n project: \".github/skills/{name}\",\n global: \"~/.github/skills/{name}\",\n },\n rules: {\n project: \".github/copilot-instructions.md\",\n global: \"~/.github/copilot-instructions.md\",\n },\n agents: {\n project: \".github/agents/{name}.md\",\n global: \"~/.github/agents/{name}.md\",\n },\n memory: {\n project: \".github/copilot-instructions.md\",\n global: \"~/.github/copilot-instructions.md\",\n },\n commands: {\n project: \".github/copilot/commands/{name}.md\",\n global: \"~/.github/copilot/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [\n {\n type: \"binary\",\n name: \"copilot\",\n versionPattern: /copilot|github/i,\n },\n ],\n [\n {\n type: \"vscode-extension\",\n extensionId: \"GitHub.copilot\",\n editors: [\"vscode\", \"cursor\"],\n },\n ],\n [{ type: \"directory\", path: \"~/.github/copilot/\" }],\n ],\n },\n legacy: {},\n },\n {\n key: \"opencode\",\n name: \"OpenCode\",\n skills: {\n project: \".opencode/skills/{name}\",\n global: \"~/.config/opencode/skills/{name}\",\n },\n rules: {\n project: \".opencode/rules/{name}.md\",\n global: \"~/.config/opencode/rules/{name}.md\",\n },\n agents: {\n project: \".opencode/agents/{name}.md\",\n global: \"~/.config/opencode/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.config/opencode/AGENTS.md\",\n },\n commands: {\n project: \".opencode/commands/{name}.md\",\n global: \"~/.config/opencode/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"binary\", name: \"opencode\", versionPattern: /opencode|sst/i }],\n [\n {\n type: \"directory\",\n path: \"~/.config/opencode/\",\n markerFile: \"config.yaml\",\n },\n ],\n ],\n },\n legacy: {},\n },\n {\n key: \"amp\",\n name: \"Amp\",\n skills: {\n project: \".agents/skills/{name}\",\n global: \"~/.config/agents/skills/{name}\",\n },\n rules: {\n project: \".agents/rules/{name}.md\",\n global: \"~/.config/agents/rules/{name}.md\",\n },\n agents: {\n project: \".agents/agents/{name}.md\",\n global: \"~/.config/agents/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.config/agents/AGENTS.md\",\n },\n commands: {\n project: \".agents/commands/{name}.md\",\n global: \"~/.config/agents/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"binary\", name: \"amp\", versionPattern: /amp|sourcegraph/i }],\n [{ type: \"directory\", path: \"~/.ampcache/\" }],\n ],\n },\n legacy: {},\n },\n {\n key: \"kiro\",\n name: \"Kiro\",\n skills: {\n project: \".kiro/skills/{name}\",\n global: \"~/.kiro/skills/{name}\",\n },\n rules: {\n project: \".kiro/rules/{name}.md\",\n global: \"~/.kiro/rules/{name}.md\",\n },\n agents: {\n project: \".kiro/agents/{name}.md\",\n global: \"~/.kiro/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.kiro/AGENTS.md\",\n },\n commands: {\n project: \".kiro/commands/{name}.md\",\n global: \"~/.kiro/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"app\", name: \"Kiro.app\" }],\n [{ type: \"binary\", name: \"kiro\" }],\n [{ type: \"directory\", path: \"~/.kiro/\", markerFile: \"settings.json\" }],\n ],\n },\n legacy: {},\n },\n {\n key: \"zed\",\n name: \"Zed\",\n skills: {\n project: \".zed/skills/{name}\",\n global: \"~/.zed/skills/{name}\",\n },\n rules: {\n project: \".zed/rules/{name}.md\",\n global: \"~/.zed/rules/{name}.md\",\n },\n agents: {\n project: \".zed/agents/{name}.md\",\n global: \"~/.zed/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.zed/AGENTS.md\",\n },\n commands: {\n project: \".zed/commands/{name}.md\",\n global: \"~/.zed/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"app\", name: \"Zed.app\" }],\n [{ type: \"binary\", name: \"zed\" }],\n [\n {\n type: \"directory\",\n path: \"~/.config/zed/\",\n markerFile: \"settings.json\",\n },\n ],\n ],\n },\n legacy: {},\n },\n {\n key: \"cline\",\n name: \"Cline\",\n skills: {\n project: \".cline/skills/{name}\",\n global: \"~/.cline/skills/{name}\",\n },\n rules: {\n project: \".cline/rules/{name}.md\",\n global: \"~/.cline/rules/{name}.md\",\n },\n agents: {\n project: \".cline/agents/{name}.md\",\n global: \"~/.cline/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.cline/AGENTS.md\",\n },\n commands: {\n project: \".cline/commands/{name}.md\",\n global: \"~/.cline/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [\n {\n type: \"vscode-extension\",\n extensionId: \"saoudrizwan.claude-dev\",\n editors: [\"vscode\", \"cursor\", \"windsurf\"],\n },\n ],\n [\n {\n type: \"directory\",\n path: \"~/.cline/\",\n markerFile: \"settings.json\",\n },\n ],\n ],\n },\n legacy: {},\n },\n {\n key: \"roo\",\n name: \"Roo\",\n skills: {\n project: \".roo/skills/{name}\",\n global: \"~/.roo/skills/{name}\",\n },\n rules: {\n project: \".roo/rules/{name}.md\",\n global: \"~/.roo/rules/{name}.md\",\n },\n agents: {\n project: \".roo/agents/{name}.md\",\n global: \"~/.roo/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.roo/AGENTS.md\",\n },\n commands: {\n project: \".roo/commands/{name}.md\",\n global: \"~/.roo/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [\n {\n type: \"vscode-extension\",\n extensionId: \"RooVeterinaryInc.roo-cline\",\n editors: [\"vscode\", \"cursor\", \"windsurf\"],\n },\n ],\n [{ type: \"directory\", path: \"~/.roo/\", markerFile: \"settings.json\" }],\n ],\n },\n legacy: {},\n },\n {\n key: \"junie\",\n name: \"Junie\",\n skills: {\n project: \".junie/skills/{name}\",\n global: \"~/.junie/skills/{name}\",\n },\n rules: {\n project: \".junie/rules/{name}.md\",\n global: \"~/.junie/rules/{name}.md\",\n },\n agents: {\n project: \".junie/agents/{name}.md\",\n global: \"~/.junie/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.junie/AGENTS.md\",\n },\n commands: {\n project: \".junie/commands/{name}.md\",\n global: \"~/.junie/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"jetbrains-plugin\", pluginId: \"junie\" }],\n [\n {\n type: \"directory\",\n path: \"~/.junie/\",\n markerFile: \"settings.json\",\n },\n ],\n ],\n },\n legacy: {},\n },\n {\n key: \"trae\",\n name: \"Trae\",\n skills: {\n project: \".trae/skills/{name}\",\n global: \"~/.trae/skills/{name}\",\n },\n rules: {\n project: \".trae/rules/{name}.md\",\n global: \"~/.trae/rules/{name}.md\",\n },\n agents: {\n project: \".trae/agents/{name}.md\",\n global: \"~/.trae/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.trae/AGENTS.md\",\n },\n commands: {\n project: \".trae/commands/{name}.md\",\n global: \"~/.trae/commands/{name}.md\",\n },\n detectionConfig: {\n groups: [\n [{ type: \"app\", name: \"Trae.app\" }],\n [{ type: \"directory\", path: \"~/.trae/\", markerFile: \"settings.json\" }],\n ],\n },\n legacy: {},\n },\n];\n","import { execFile } from \"node:child_process\";\nimport { constants, access, readdir } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type {\n AppBundleCheck,\n BinaryCheck,\n DetectionCheck,\n DetectionConfig,\n DirectoryCheck,\n JetbrainsPluginCheck,\n Platform,\n VscodeExtensionCheck,\n} from \"@baton-dx/ai-tool-paths\";\n\n/**\n * Execute a command and return stdout/stderr as a promise.\n * Rejects on non-zero exit code or timeout.\n */\nfunction execAsync(\n command: string,\n args: string[],\n options: { timeout?: number } = {},\n): Promise<{ stdout: string; stderr: string }> {\n return new Promise((resolve, reject) => {\n execFile(command, args, options, (error, stdout, stderr) => {\n if (error) {\n reject(error);\n } else {\n resolve({ stdout: String(stdout), stderr: String(stderr) });\n }\n });\n });\n}\n\n/**\n * Check if a binary exists in PATH and optionally verify its identity via version output.\n * Prevents false positives from binary name collisions (e.g., `opencode` by Litestar vs SST).\n */\nexport async function checkBinary(check: BinaryCheck): Promise<boolean> {\n if (check.platforms && !check.platforms.includes(process.platform as Platform)) {\n return false;\n }\n\n const lookupCommand = process.platform === \"win32\" ? \"where\" : \"which\";\n\n try {\n await execAsync(lookupCommand, [check.name]);\n } catch {\n return false;\n }\n\n if (!check.versionPattern) {\n return true;\n }\n\n const versionFlag = check.versionFlag ?? \"--version\";\n try {\n const { stdout, stderr } = await execAsync(check.name, [versionFlag], {\n timeout: 5000,\n });\n const output = `${stdout}\\n${stderr}`;\n return check.versionPattern.test(output);\n } catch {\n return false;\n }\n}\n\n/**\n * Check if a directory exists and optionally contains a marker file.\n * Prevents false positives from leftover empty directories (e.g., ~/.cline/ without settings.json).\n */\nexport async function checkDirectory(check: DirectoryCheck): Promise<boolean> {\n if (check.platforms && !check.platforms.includes(process.platform as Platform)) {\n return false;\n }\n\n const expandedPath = check.path.startsWith(\"~/\")\n ? join(homedir(), check.path.slice(2))\n : check.path;\n\n try {\n await access(expandedPath, constants.R_OK);\n } catch {\n return false;\n }\n\n if (!check.markerFile) {\n return true;\n }\n\n try {\n await access(join(expandedPath, check.markerFile));\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Check if a macOS .app bundle exists in /Applications or ~/Applications.\n * Returns false immediately on non-darwin platforms.\n */\nexport async function checkAppBundle(check: AppBundleCheck): Promise<boolean> {\n if (process.platform !== \"darwin\") {\n return false;\n }\n\n const searchPaths = check.searchPaths ?? [\"/Applications\", join(homedir(), \"Applications\")];\n\n for (const dir of searchPaths) {\n try {\n await access(join(dir, check.name));\n return true;\n } catch {\n // not found in this path, try next\n }\n }\n\n return false;\n}\n\n/** Map of editor names to their extension directory paths. */\nconst EDITOR_EXTENSION_DIRS: Record<string, string> = {\n vscode: join(homedir(), \".vscode\", \"extensions\"),\n cursor: join(homedir(), \".cursor\", \"extensions\"),\n windsurf: join(homedir(), \".windsurf\", \"extensions\"),\n};\n\n/**\n * Check if a VS Code extension is installed in VS Code, Cursor, or Windsurf.\n * Matches extension directories by prefix (case-insensitive) since directories\n * are named `<extensionId>-<version>`.\n */\nexport async function checkVscodeExtension(check: VscodeExtensionCheck): Promise<boolean> {\n const editors = check.editors ?? [\"vscode\"];\n const prefix = check.extensionId.toLowerCase();\n\n for (const editor of editors) {\n const extDir = EDITOR_EXTENSION_DIRS[editor];\n if (!extDir) {\n // skip unknown editor\n } else {\n try {\n const entries = await readdir(extDir);\n if (entries.some((entry) => entry.toLowerCase().startsWith(prefix))) {\n return true;\n }\n } catch {\n // extension directory missing (ENOENT) — skip, not throw\n }\n }\n }\n\n return false;\n}\n\n/**\n * Get the JetBrains config base directory for the current platform.\n * macOS: ~/Library/Application Support/JetBrains/\n * Linux: ~/.config/JetBrains/\n * Windows: %APPDATA%/JetBrains/\n */\nfunction getJetbrainsConfigBase(): string | undefined {\n switch (process.platform) {\n case \"darwin\":\n return join(homedir(), \"Library\", \"Application Support\", \"JetBrains\");\n case \"linux\":\n return join(homedir(), \".config\", \"JetBrains\");\n case \"win32\":\n return process.env.APPDATA ? join(process.env.APPDATA, \"JetBrains\") : undefined;\n default:\n return undefined;\n }\n}\n\n/**\n * Check if a JetBrains plugin is installed by scanning IDE config directories.\n * Looks for pluginId as a subdirectory under <version>/plugins/ across all IDE versions.\n */\nexport async function checkJetbrainsPlugin(check: JetbrainsPluginCheck): Promise<boolean> {\n const base = getJetbrainsConfigBase();\n if (!base) {\n return false;\n }\n\n let versionDirs: string[];\n try {\n versionDirs = await readdir(base);\n } catch {\n return false;\n }\n\n for (const versionDir of versionDirs) {\n try {\n const pluginEntries = await readdir(join(base, versionDir, \"plugins\"));\n if (pluginEntries.some((entry) => entry.toLowerCase() === check.pluginId.toLowerCase())) {\n return true;\n }\n } catch {\n // plugins directory missing for this version — skip\n }\n }\n\n return false;\n}\n\n/**\n * Handler map for dispatching detection checks by type.\n * Uses an object so that individual handlers can be spied on in tests\n * (ESM module exports are not interceptable for intra-module calls).\n */\nexport const checkHandlers = {\n binary: checkBinary,\n directory: checkDirectory,\n app: checkAppBundle,\n \"vscode-extension\": checkVscodeExtension,\n \"jetbrains-plugin\": checkJetbrainsPlugin,\n};\n\n/**\n * Dispatch a single detection check to the appropriate mechanism function.\n */\nfunction runCheck(check: DetectionCheck): Promise<boolean> {\n switch (check.type) {\n case \"binary\":\n return checkHandlers.binary(check);\n case \"directory\":\n return checkHandlers.directory(check);\n case \"app\":\n return checkHandlers.app(check);\n case \"vscode-extension\":\n return checkHandlers[\"vscode-extension\"](check);\n case \"jetbrains-plugin\":\n return checkHandlers[\"jetbrains-plugin\"](check);\n }\n}\n\n/**\n * Evaluate a DetectionConfig using OR-of-ANDs logic.\n * Each group is evaluated in parallel. Within a group, ALL checks must pass (AND).\n * ANY group passing means the tool is detected (OR across groups).\n */\nexport async function evaluateDetection(config: DetectionConfig): Promise<boolean> {\n const groupResults = await Promise.all(\n config.groups.map(async (group) => {\n const results = await Promise.all(group.map(runCheck));\n return results.every(Boolean);\n }),\n );\n return groupResults.some(Boolean);\n}\n","import { AI_TOOL_PATHS } from \"@baton-dx/ai-tool-paths\";\nimport { evaluateDetection } from \"./mechanisms.js\";\n\n/**\n * Cache for detected AI tools (valid for process lifetime)\n */\nlet cachedAITools: string[] | null = null;\n\n/**\n * Detect if a specific AI tool is installed using structured detectionConfig.\n */\nasync function isAIToolInstalled(toolKey: string): Promise<boolean> {\n const toolConfig = AI_TOOL_PATHS.find((agent) => agent.key === toolKey);\n if (!toolConfig?.detectionConfig) return false;\n\n return evaluateDetection(toolConfig.detectionConfig);\n}\n\n/**\n * Detect all installed AI tools\n * Results are cached for the duration of the process\n */\nexport async function detectInstalledAITools(): Promise<string[]> {\n // Return cached result if available\n if (cachedAITools !== null) {\n return cachedAITools;\n }\n\n const installedAITools: string[] = [];\n\n // Check each tool in parallel\n const detectionPromises = AI_TOOL_PATHS.map(async (agent) => {\n const isInstalled = await isAIToolInstalled(agent.key);\n return isInstalled ? agent.key : null;\n });\n\n const results = await Promise.all(detectionPromises);\n\n // Filter out null results\n for (const result of results) {\n if (result !== null) {\n installedAITools.push(result);\n }\n }\n\n // Cache the result\n cachedAITools = installedAITools;\n\n return installedAITools;\n}\n\n/**\n * Clear the AI tool detection cache\n * Useful for testing or when tool installation state may have changed\n */\nexport function clearAIToolCache(): void {\n cachedAITools = null;\n}\n\n/**\n * Override AI tool detection with a specific list of tools\n * Used when --agents flag is provided\n */\nexport function setDetectedAITools(tools: string[]): void {\n cachedAITools = [...tools];\n}\n"],"mappings":";;;;;;;;;;;AAMA,MAAa,gBAA6C;CACxD;EACE,KAAK;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,OAAO;GACL,SAAS;GACT,QAAQ;GACT;EACD,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,UAAU;GACR,SAAS;GACT,QAAQ;GACT;EACD,iBAAiB,EACf,QAAQ,CACN,CAAC;GAAE,MAAM;GAAU,MAAM;GAAU,gBAAgB;GAAW,CAAC,EAC/D,CAAC;GAAE,MAAM;GAAa,MAAM;GAAc,YAAY;GAAiB,CAAC,CACzE,EACF;EACD,QAAQ,EAAE;EACX;CACD;EACE,KAAK;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,OAAO;GACL,SAAS;GACT,QAAQ;GACT;EACD,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,UAAU;GACR,SAAS;GACT,QAAQ;GACT;EACD,iBAAiB,EACf,QAAQ;GACN,CAAC;IAAE,MAAM;IAAO,MAAM;IAAc,CAAC;GACrC,CAAC;IAAE,MAAM;IAAU,MAAM;IAAU,CAAC;GACpC,CAAC;IAAE,MAAM;IAAa,MAAM;IAAc,YAAY;IAAc,CAAC;GACtE,EACF;EACD,QAAQ,EACN,OAAO,CAAC,eAAe,EACxB;EACF;CACD;EACE,KAAK;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,OAAO;G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O;;;;;;AAOT,SAAgB,mBAAyB;AACvC,iBAAgB"}
|
|
@@ -1,15 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
3
|
import { access } from "node:fs/promises";
|
|
4
4
|
import { dirname, join, sep } from "node:path";
|
|
5
5
|
import { formatWithOptions, stripVTControlCharacters } from "node:util";
|
|
6
|
-
import
|
|
6
|
+
import N, { stdin, stdout } from "node:process";
|
|
7
7
|
import * as tty from "node:tty";
|
|
8
8
|
import { ReadStream } from "node:tty";
|
|
9
9
|
import * as k from "node:readline";
|
|
10
10
|
import ot from "node:readline";
|
|
11
11
|
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
12
12
|
|
|
13
|
+
//#region \0rolldown/runtime.js
|
|
14
|
+
var __create = Object.create;
|
|
15
|
+
var __defProp = Object.defineProperty;
|
|
16
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
17
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
18
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
19
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
20
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
24
|
+
key = keys[i];
|
|
25
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
26
|
+
__defProp(to, key, {
|
|
27
|
+
get: ((k) => from[k]).bind(null, key),
|
|
28
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
36
|
+
value: mod,
|
|
37
|
+
enumerable: true
|
|
38
|
+
}) : target, mod));
|
|
39
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
13
42
|
//#region ../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/core.mjs
|
|
14
43
|
const LogLevels = {
|
|
15
44
|
silent: Number.NEGATIVE_INFINITY,
|
|
@@ -790,10 +819,10 @@ new Proxy(y$1, { get(e, s) {
|
|
|
790
819
|
if (s in e) return e[s];
|
|
791
820
|
if (s in _$1) return _$1[s];
|
|
792
821
|
} });
|
|
793
|
-
const c = globalThis.process?.release?.name === "node", O$1 = !!globalThis.Bun || !!globalThis.process?.versions?.bun, D$1 = !!globalThis.Deno, L$1 = !!globalThis.fastly, S$1 = !!globalThis.Netlify, u = !!globalThis.EdgeRuntime, N$
|
|
822
|
+
const c = globalThis.process?.release?.name === "node", O$1 = !!globalThis.Bun || !!globalThis.process?.versions?.bun, D$1 = !!globalThis.Deno, L$1 = !!globalThis.fastly, S$1 = !!globalThis.Netlify, u = !!globalThis.EdgeRuntime, N$2 = globalThis.navigator?.userAgent === "Cloudflare-Workers", F = [
|
|
794
823
|
[S$1, "netlify"],
|
|
795
824
|
[u, "edge-light"],
|
|
796
|
-
[N$
|
|
825
|
+
[N$2, "workerd"],
|
|
797
826
|
[L$1, "fastly"],
|
|
798
827
|
[D$1, "deno"],
|
|
799
828
|
[O$1, "bun"],
|
|
@@ -859,9 +888,9 @@ function stringWidth$1(string, options = {}) {
|
|
|
859
888
|
return width;
|
|
860
889
|
}
|
|
861
890
|
function isUnicodeSupported() {
|
|
862
|
-
const { env } =
|
|
891
|
+
const { env } = N;
|
|
863
892
|
const { TERM, TERM_PROGRAM } = env;
|
|
864
|
-
if (
|
|
893
|
+
if (N.platform !== "win32") return TERM !== "linux";
|
|
865
894
|
return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
866
895
|
}
|
|
867
896
|
const TYPE_COLOR_MAP = {
|
|
@@ -948,7 +977,7 @@ function createConsola(options = {}) {
|
|
|
948
977
|
defaults: { level },
|
|
949
978
|
stdout: process.stdout,
|
|
950
979
|
stderr: process.stderr,
|
|
951
|
-
prompt: (...args) => import("./prompt-
|
|
980
|
+
prompt: (...args) => import("./prompt-C7kAOs-S.mjs").then((m) => m.prompt(...args)),
|
|
952
981
|
reporters: options.reporters || [options.fancy ?? !(T$1 || R$1) ? new FancyReporter() : new BasicReporter()],
|
|
953
982
|
...options
|
|
954
983
|
});
|
|
@@ -8731,7 +8760,7 @@ var $t$1 = class extends x$1 {
|
|
|
8731
8760
|
//#endregion
|
|
8732
8761
|
//#region ../../node_modules/.bun/@clack+prompts@1.0.1/node_modules/@clack/prompts/dist/index.mjs
|
|
8733
8762
|
function me() {
|
|
8734
|
-
return
|
|
8763
|
+
return N.platform !== "win32" ? N.env.TERM !== "linux" : !!N.env.CI || !!N.env.WT_SESSION || !!N.env.TERMINUS_SUBLIME || N.env.ConEmuTask === "{cmd::Cmder}" || N.env.TERM_PROGRAM === "Terminus-Sublime" || N.env.TERM_PROGRAM === "vscode" || N.env.TERM === "xterm-256color" || N.env.TERM === "alacritty" || N.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
8735
8764
|
}
|
|
8736
8765
|
const et = me(), ct = () => process.env.CI === "true", Mt = (t) => t.isTTY === !0, C = (t, r) => et ? t : r, Rt = C("◆", "*"), dt = C("■", "x"), $t = C("▲", "x"), V = C("◇", "o"), ht = C("┌", "T"), d = C("│", "|"), x = C("└", "—"), Ot = C("┐", "T"), Pt = C("┘", "—"), Q = C("●", ">"), H = C("○", " "), st = C("◻", "[•]"), U = C("◼", "[+]"), q = C("◻", "[ ]"), Nt = C("▪", "•"), rt = C("─", "-"), mt = C("╮", "+"), Wt = C("├", "+"), pt = C("╯", "+"), gt = C("╰", "+"), Lt = C("╭", "+"), ft = C("●", "•"), Ft = C("◆", "*"), yt = C("▲", "!"), Et = C("■", "x"), W = (t) => {
|
|
8737
8766
|
switch (t) {
|
|
@@ -9371,7 +9400,7 @@ ${import_picocolors.default.cyan(x)}
|
|
|
9371
9400
|
`), o = a.reduce((n, c) => Math.max(M(c), n), 0);
|
|
9372
9401
|
return J(t, r - (a.map(s).reduce((n, c) => Math.max(M(c), n), 0) - o), i);
|
|
9373
9402
|
}, Ve = (t = "", r = "", s) => {
|
|
9374
|
-
const i = s?.output ??
|
|
9403
|
+
const i = s?.output ?? N.stdout, a = s?.withGuide ?? _.withGuide, o = s?.format ?? Ge, u = [
|
|
9375
9404
|
"",
|
|
9376
9405
|
...ke(t, rt$1(i) - 6, o).split(`
|
|
9377
9406
|
`).map(o),
|
|
@@ -9837,5 +9866,5 @@ async function findSourceRoot(cwd = process.cwd(), options) {
|
|
|
9837
9866
|
}
|
|
9838
9867
|
|
|
9839
9868
|
//#endregion
|
|
9840
|
-
export { Ne as a, Ve as c, bt as d, je as f, runMain as g, defineCommand as h, Le as i, We as l, require_dist as m, isInSourceRepo as n, R as o, Ct$1 as p, Je as r, Re as s, findSourceRoot as t, Ze as u };
|
|
9841
|
-
//# sourceMappingURL=context-detection-
|
|
9869
|
+
export { __commonJSMin as _, Ne as a, Ve as c, bt as d, je as f, runMain as g, defineCommand as h, Le as i, We as l, require_dist as m, isInSourceRepo as n, R as o, Ct$1 as p, Je as r, Re as s, findSourceRoot as t, Ze as u, __require as v, __toESM as y };
|
|
9870
|
+
//# sourceMappingURL=context-detection-C7T1evnW.mjs.map
|