@agents-inc/cli 0.85.0 → 0.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/{chunk-6VGBO6SZ.js → chunk-5M6Q5UQO.js} +2 -2
- package/dist/chunk-5UJJQFET.js +564 -0
- package/dist/chunk-5UJJQFET.js.map +1 -0
- package/dist/{chunk-TXW257CU.js → chunk-7FFNNDJQ.js} +181 -202
- package/dist/chunk-7FFNNDJQ.js.map +1 -0
- package/dist/{chunk-YJ2URWF7.js → chunk-B6MYECV6.js} +2 -2
- package/dist/{chunk-G2MINRWX.js → chunk-C5IYJ42F.js} +2 -2
- package/dist/{chunk-7UZUDHP7.js → chunk-CXWBVBDM.js} +2 -2
- package/dist/{chunk-CYPCJ536.js → chunk-FBZR46GC.js} +92 -92
- package/dist/chunk-FBZR46GC.js.map +1 -0
- package/dist/{chunk-LTFGEVTM.js → chunk-HH3AWXF4.js} +3 -3
- package/dist/{chunk-2XVLQDNI.js → chunk-HSLVCKVQ.js} +3 -3
- package/dist/{chunk-TAQGYJIS.js → chunk-HZ2IBXVQ.js} +3 -3
- package/dist/{chunk-LN76TJJP.js → chunk-HZQOFFKA.js} +10 -10
- package/dist/{chunk-W7LHI54P.js → chunk-I44YG6VI.js} +2 -2
- package/dist/{chunk-FT46LN7K.js → chunk-I5AZKNNL.js} +7 -8
- package/dist/chunk-I5AZKNNL.js.map +1 -0
- package/dist/chunk-J6PI73YV.js +68 -0
- package/dist/chunk-J6PI73YV.js.map +1 -0
- package/dist/{chunk-L7COG2EX.js → chunk-LZ7XQ3IU.js} +2 -2
- package/dist/{chunk-LMR7VAP3.js → chunk-MMTMXLI4.js} +2 -2
- package/dist/chunk-N6A7A4RA.js +16 -0
- package/dist/chunk-N6A7A4RA.js.map +1 -0
- package/dist/{chunk-WJKD6EGK.js → chunk-NUU3U43A.js} +5 -6
- package/dist/chunk-NUU3U43A.js.map +1 -0
- package/dist/{chunk-YYIWB42G.js → chunk-Q4DMIPZB.js} +2 -2
- package/dist/{chunk-YSLDMYWP.js → chunk-SGZOFIFF.js} +2 -2
- package/dist/{chunk-FKXD3EXJ.js → chunk-TMTUTUEV.js} +42 -228
- package/dist/chunk-TMTUTUEV.js.map +1 -0
- package/dist/{chunk-WCCWQ56J.js → chunk-UNEJKTLP.js} +3 -3
- package/dist/{chunk-ZGD7PLLC.js → chunk-ZOWRO7UQ.js} +3 -3
- package/dist/commands/build/marketplace.js +3 -3
- package/dist/commands/build/plugins.js +5 -5
- package/dist/commands/build/stack.js +5 -5
- package/dist/commands/compile.js +77 -171
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/config/index.js +5 -5
- package/dist/commands/config/path.js +4 -4
- package/dist/commands/config/show.js +5 -5
- package/dist/commands/diff.js +161 -167
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/doctor.js +68 -83
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +275 -209
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +206 -124
- package/dist/commands/eject.js.map +1 -1
- package/dist/commands/import/skill.js +175 -144
- package/dist/commands/import/skill.js.map +1 -1
- package/dist/commands/info.js +58 -102
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/init.js +19 -16
- package/dist/commands/list.js +4 -4
- package/dist/commands/new/agent.js +124 -102
- package/dist/commands/new/agent.js.map +1 -1
- package/dist/commands/new/marketplace.js +6 -6
- package/dist/commands/new/marketplace.js.map +1 -1
- package/dist/commands/new/skill.js +328 -15
- package/dist/commands/new/skill.js.map +1 -1
- package/dist/commands/outdated.js +16 -24
- package/dist/commands/outdated.js.map +1 -1
- package/dist/commands/search.js +166 -132
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/uninstall.js +269 -189
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +238 -219
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate.js +4 -4
- package/dist/components/skill-search/skill-search.js +2 -1
- package/dist/components/wizard/category-grid.test.js +4 -4
- package/dist/components/wizard/domain-selection.js +5 -5
- package/dist/components/wizard/help-modal.js +5 -5
- package/dist/components/wizard/source-grid.test.js +4 -4
- package/dist/components/wizard/stack-selection.js +5 -5
- package/dist/components/wizard/step-agents.js +5 -5
- package/dist/components/wizard/step-agents.test.js +5 -5
- package/dist/components/wizard/step-build.js +5 -5
- package/dist/components/wizard/step-build.test.js +5 -5
- package/dist/components/wizard/step-confirm.test.js +4 -4
- package/dist/components/wizard/step-settings.js +4 -4
- package/dist/components/wizard/step-settings.test.js +7 -7
- package/dist/components/wizard/step-sources.js +5 -5
- package/dist/components/wizard/step-sources.test.js +5 -5
- package/dist/components/wizard/step-stack.js +6 -6
- package/dist/components/wizard/step-stack.test.js +6 -6
- package/dist/components/wizard/wizard-layout.js +6 -6
- package/dist/components/wizard/wizard.js +14 -14
- package/dist/hooks/init.js +19 -16
- package/dist/hooks/init.js.map +1 -1
- package/dist/{loader-GT2A7R7U.js → loader-GSEGPK64.js} +3 -3
- package/dist/{source-loader-TNQW4P47.js → source-loader-OGFTIRIX.js} +4 -4
- package/dist/{source-manager-INRXRFJE.js → source-manager-FMMDDVZA.js} +4 -4
- package/dist/stores/wizard-store.js +4 -4
- package/dist/stores/wizard-store.test.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-AABH2HSE.js +0 -340
- package/dist/chunk-AABH2HSE.js.map +0 -1
- package/dist/chunk-CYPCJ536.js.map +0 -1
- package/dist/chunk-FKXD3EXJ.js.map +0 -1
- package/dist/chunk-FT46LN7K.js.map +0 -1
- package/dist/chunk-TXW257CU.js.map +0 -1
- package/dist/chunk-WJKD6EGK.js.map +0 -1
- /package/dist/{chunk-6VGBO6SZ.js.map → chunk-5M6Q5UQO.js.map} +0 -0
- /package/dist/{chunk-YJ2URWF7.js.map → chunk-B6MYECV6.js.map} +0 -0
- /package/dist/{chunk-G2MINRWX.js.map → chunk-C5IYJ42F.js.map} +0 -0
- /package/dist/{chunk-7UZUDHP7.js.map → chunk-CXWBVBDM.js.map} +0 -0
- /package/dist/{chunk-LTFGEVTM.js.map → chunk-HH3AWXF4.js.map} +0 -0
- /package/dist/{chunk-2XVLQDNI.js.map → chunk-HSLVCKVQ.js.map} +0 -0
- /package/dist/{chunk-TAQGYJIS.js.map → chunk-HZ2IBXVQ.js.map} +0 -0
- /package/dist/{chunk-LN76TJJP.js.map → chunk-HZQOFFKA.js.map} +0 -0
- /package/dist/{chunk-W7LHI54P.js.map → chunk-I44YG6VI.js.map} +0 -0
- /package/dist/{chunk-L7COG2EX.js.map → chunk-LZ7XQ3IU.js.map} +0 -0
- /package/dist/{chunk-LMR7VAP3.js.map → chunk-MMTMXLI4.js.map} +0 -0
- /package/dist/{chunk-YYIWB42G.js.map → chunk-Q4DMIPZB.js.map} +0 -0
- /package/dist/{chunk-YSLDMYWP.js.map → chunk-SGZOFIFF.js.map} +0 -0
- /package/dist/{chunk-WCCWQ56J.js.map → chunk-UNEJKTLP.js.map} +0 -0
- /package/dist/{chunk-ZGD7PLLC.js.map → chunk-ZOWRO7UQ.js.map} +0 -0
- /package/dist/{loader-GT2A7R7U.js.map → loader-GSEGPK64.js.map} +0 -0
- /package/dist/{source-loader-TNQW4P47.js.map → source-loader-OGFTIRIX.js.map} +0 -0
- /package/dist/{source-manager-INRXRFJE.js.map → source-manager-FMMDDVZA.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/init.tsx","../src/cli/lib/permission-checker.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { Flags } from \"@oclif/core\";\nimport { render, Box, Text, useApp } from \"ink\";\nimport fs from \"fs\";\n\nimport { BaseCommand } from \"../base-command.js\";\nimport { Wizard, type WizardResultV2 } from \"../components/wizard/wizard.js\";\nimport { type SourceLoadResult } from \"../lib/loading/index.js\";\nimport {\n loadSource,\n loadAgentDefs,\n copyLocalSkills,\n ensureMarketplace,\n installPluginSkills,\n writeProjectConfig,\n compileAgents,\n discoverInstalledSkills,\n} from \"../lib/operations/index.js\";\nimport { getInstallationInfo } from \"../lib/plugins/plugin-info.js\";\nimport { loadProjectConfig } from \"../lib/configuration/project-config.js\";\nimport {\n type InstallMode,\n detectProjectInstallation,\n deriveInstallMode,\n resolveInstallPaths,\n buildAgentScopeMap,\n} from \"../lib/installation/index.js\";\nimport { checkPermissions } from \"../lib/permission-checker.js\";\nimport {\n ASCII_LOGO,\n CLAUDE_SRC_DIR,\n CLI_BIN_NAME,\n DEFAULT_BRANDING,\n GLOBAL_INSTALL_ROOT,\n} from \"../consts.js\";\nimport { SelectList, type SelectListItem } from \"../components/common/select-list.js\";\nimport {\n KEY_LABEL_ARROWS_VERT,\n KEY_LABEL_ENTER,\n KEY_LABEL_ESC,\n} from \"../components/wizard/hotkeys.js\";\nimport { getErrorMessage } from \"../utils/errors.js\";\nimport { EXIT_CODES } from \"../lib/exit-codes.js\";\nimport { getSkillById } from \"../lib/matrix/matrix-provider\";\nimport { type StartupMessage } from \"../utils/logger.js\";\nimport { SUCCESS_MESSAGES, STATUS_MESSAGES } from \"../utils/messages.js\";\nimport { ensureBlankGlobalConfig } from \"../lib/configuration/config-writer.js\";\n\n/** Clears the visible terminal area so the next render starts clean. */\nfunction clearTerminalOutput(): void {\n process.stdout.write(\"\\x1b[2J\\x1b[H\");\n}\n\nconst DASHBOARD_OPTIONS: SelectListItem<string>[] = [\n { label: \"Edit\", value: \"edit\" },\n { label: \"Compile\", value: \"compile\" },\n { label: \"Doctor\", value: \"doctor\" },\n { label: \"List\", value: \"list\" },\n];\n\ntype DashboardProps = {\n onSelect: (command: string) => void;\n onCancel: () => void;\n};\n\nconst Dashboard: React.FC<DashboardProps> = ({ onSelect, onCancel }) => {\n const { exit } = useApp();\n\n return (\n <Box flexDirection=\"column\">\n <Text bold>{DEFAULT_BRANDING.NAME}</Text>\n <Text> </Text>\n <SelectList\n items={DASHBOARD_OPTIONS}\n onSelect={(command) => {\n onSelect(command);\n exit();\n }}\n onCancel={() => {\n onCancel();\n exit();\n }}\n />\n <Text> </Text>\n <Text dimColor>\n {\" \"}\n {KEY_LABEL_ARROWS_VERT} Navigate {\" \"}\n {KEY_LABEL_ENTER} Confirm {\" \"}\n {KEY_LABEL_ESC} Exit\n </Text>\n </Box>\n );\n};\n\n/** Formats the dashboard summary as plain text lines (for non-interactive/test output). */\nexport function formatDashboardText(data: DashboardData): string {\n const modeLabel = data.mode === \"plugin\" ? \"Plugin\" : data.mode === \"mixed\" ? \"Mixed\" : \"Local\";\n const lines = [\n DEFAULT_BRANDING.NAME,\n \"\",\n ` Skills: ${data.skillCount} installed`,\n ` Agents: ${data.agentCount} compiled`,\n ` Mode: ${modeLabel}`,\n ];\n if (data.source) {\n lines.push(` Source: ${data.source}`);\n }\n lines.push(\"\");\n lines.push(` [Edit] [Compile] [Doctor] [List]`);\n return lines.join(\"\\n\");\n}\n\n/**\n * Shows the project dashboard and returns the selected command (or null if cancelled).\n * In non-interactive environments (no TTY), prints the summary text and returns null.\n */\nexport async function showDashboard(\n projectDir: string,\n log?: (message: string) => void,\n): Promise<string | null> {\n const data = await getDashboardData(projectDir);\n\n // Non-interactive: print text summary and exit (CI, piped, tests)\n if (!process.stdin.isTTY) {\n const output = log ?? console.log;\n output(formatDashboardText(data));\n return null;\n }\n\n let selectedCommand: string | null = null;\n\n const { waitUntilExit } = render(\n <Dashboard\n onSelect={(command) => {\n selectedCommand = command;\n }}\n onCancel={() => {\n selectedCommand = null;\n }}\n />,\n );\n\n await waitUntilExit();\n clearTerminalOutput();\n\n return selectedCommand;\n}\n\nexport default class Init extends BaseCommand {\n static summary = `Initialize ${DEFAULT_BRANDING.NAME} in this project`;\n static description =\n \"Interactive wizard to set up skills and agents. Supports Plugin Mode (native install) and Local Mode (copy to .claude/).\";\n\n static examples = [\n {\n description: \"Start the setup wizard\",\n command: \"<%= config.bin %> <%= command.id %>\",\n },\n {\n description: \"Initialize from a custom marketplace\",\n command: \"<%= config.bin %> <%= command.id %> --source github:org/marketplace\",\n },\n {\n description: \"Force refresh skills from remote\",\n command: \"<%= config.bin %> <%= command.id %> --refresh\",\n },\n ];\n\n static flags = {\n ...BaseCommand.baseFlags,\n refresh: Flags.boolean({\n description: \"Force refresh from remote source\",\n default: false,\n }),\n };\n\n async run(): Promise<void> {\n const { flags } = await this.parse(Init);\n const projectDir = process.cwd();\n\n if (await this.showDashboardIfInitialized(projectDir)) return;\n await this.ensureGlobalConfig(projectDir);\n\n const { sourceResult, startupMessages } = await this.loadSourceOrFail(flags);\n const result = await this.runWizard(sourceResult, startupMessages, projectDir);\n if (!result) this.exit(EXIT_CODES.CANCELLED);\n\n if (result.skills.length === 0) {\n this.error(\"No skills selected\", { exit: EXIT_CODES.ERROR });\n }\n\n await this.handleInstallation(result, sourceResult, flags);\n }\n\n private async showDashboardIfInitialized(projectDir: string): Promise<boolean> {\n const existingInstallation = await detectProjectInstallation(projectDir);\n if (!existingInstallation) return false;\n\n const selectedCommand = await showDashboard(projectDir, (msg) => this.log(msg));\n if (selectedCommand) {\n await this.config.runCommand(selectedCommand);\n }\n return true;\n }\n\n private async ensureGlobalConfig(projectDir: string): Promise<void> {\n // Auto-create blank global config on first init from a project directory.\n // This ensures the project config can always import from global.\n // Resolve both paths through realpathSync — on macOS /var is a symlink to\n // /private/var, so os.homedir() and process.cwd() can return different\n // prefixes for the same directory.\n const isGlobalRoot = fs.realpathSync(projectDir) === fs.realpathSync(GLOBAL_INSTALL_ROOT);\n if (!isGlobalRoot) {\n const created = await ensureBlankGlobalConfig();\n if (created) {\n this.log(\"Created blank global config at ~/\" + CLAUDE_SRC_DIR);\n }\n }\n }\n\n private async loadSourceOrFail(flags: {\n source?: string;\n refresh: boolean;\n }): Promise<{ sourceResult: SourceLoadResult; startupMessages: StartupMessage[] }> {\n try {\n const loaded = await loadSource({\n sourceFlag: flags.source,\n projectDir: process.cwd(),\n forceRefresh: flags.refresh,\n captureStartupMessages: true,\n });\n return { sourceResult: loaded.sourceResult, startupMessages: loaded.startupMessages };\n } catch (error) {\n this.error(getErrorMessage(error), {\n exit: EXIT_CODES.ERROR,\n });\n }\n }\n\n private async runWizard(\n sourceResult: SourceLoadResult,\n startupMessages: StartupMessage[],\n projectDir: string,\n ): Promise<WizardResultV2 | null> {\n let wizardResult: WizardResultV2 | null = null;\n\n const { waitUntilExit } = render(\n <Wizard\n version={this.config.version}\n logo={ASCII_LOGO}\n projectDir={projectDir}\n startupMessages={startupMessages}\n onComplete={(result) => {\n wizardResult = result;\n }}\n onCancel={() => {\n this.log(\"Setup cancelled\");\n }}\n />,\n );\n\n await waitUntilExit();\n\n // TypeScript can't track that onComplete callback mutates wizardResult before waitUntilExit resolves\n const result = wizardResult as WizardResultV2 | null;\n if (result?.cancelled) return null;\n return result;\n }\n\n private async handleInstallation(\n result: WizardResultV2,\n sourceResult: SourceLoadResult,\n flags: { source?: string; refresh: boolean },\n ): Promise<void> {\n const projectDir = process.cwd();\n let installMode = deriveInstallMode(result.skills);\n const localSkills = result.skills.filter((s) => s.source === \"local\");\n const pluginSkills = result.skills.filter((s) => s.source !== \"local\");\n\n this.logInstallPlan(result, installMode, localSkills, pluginSkills);\n\n let copiedSkills = [...localSkills];\n let pluginModeSucceeded = false;\n\n if (installMode === \"local\" || installMode === \"mixed\") {\n await this.copyLocalSkillsStep(localSkills, projectDir, sourceResult, installMode);\n }\n\n if (installMode === \"plugin\" || installMode === \"mixed\") {\n const pluginStepResult = await this.installPluginsStep(\n pluginSkills,\n sourceResult,\n projectDir,\n installMode,\n copiedSkills,\n result.skills,\n );\n copiedSkills = pluginStepResult.copiedSkills;\n installMode = pluginStepResult.installMode;\n pluginModeSucceeded = pluginStepResult.succeeded;\n }\n\n try {\n const { configResult, compileResult, projectPaths } = await this.writeConfigAndCompile(\n result,\n sourceResult,\n flags,\n installMode,\n );\n this.reportSuccess(\n configResult,\n compileResult,\n projectPaths,\n installMode,\n pluginModeSucceeded,\n copiedSkills,\n );\n\n const permissionWarning = await checkPermissions(projectDir);\n if (permissionWarning) {\n const { waitUntilExit } = render(permissionWarning);\n await waitUntilExit();\n }\n } catch (error) {\n this.handleError(error);\n }\n }\n\n private logInstallPlan(\n result: WizardResultV2,\n installMode: InstallMode,\n localSkills: WizardResultV2[\"skills\"],\n pluginSkills: WizardResultV2[\"skills\"],\n ): void {\n this.log(\"\\n\");\n this.log(`Selected ${result.skills.length} skills`);\n this.log(\n `Install mode: ${\n installMode === \"plugin\"\n ? \"Plugin (native install)\"\n : installMode === \"mixed\"\n ? `Mixed (${localSkills.length} local, ${pluginSkills.length} plugin)`\n : \"Local (copy to .claude/skills/)\"\n }`,\n );\n }\n\n private async copyLocalSkillsStep(\n localSkills: WizardResultV2[\"skills\"],\n projectDir: string,\n sourceResult: SourceLoadResult,\n installMode: InstallMode,\n ): Promise<void> {\n this.log(\"Copying skills to local directory...\");\n const copyResult = await copyLocalSkills(localSkills, projectDir, sourceResult);\n\n if (installMode === \"mixed\") {\n if (copyResult.projectCopied.length > 0 && copyResult.globalCopied.length > 0) {\n this.log(\n `Copied ${copyResult.totalCopied} local skills (${copyResult.projectCopied.length} project, ${copyResult.globalCopied.length} global)`,\n );\n } else if (copyResult.globalCopied.length > 0) {\n this.log(`Copied ${copyResult.globalCopied.length} local skills to ~/.claude/skills/`);\n } else {\n this.log(`Copied ${copyResult.projectCopied.length} local skills to .claude/skills/`);\n }\n } else {\n this.log(`Copied ${copyResult.totalCopied} skills to .claude/skills/\\n`);\n }\n }\n\n private async installPluginsStep(\n pluginSkills: WizardResultV2[\"skills\"],\n sourceResult: SourceLoadResult,\n projectDir: string,\n installMode: InstallMode,\n copiedSkills: WizardResultV2[\"skills\"],\n allSkills: WizardResultV2[\"skills\"],\n ): Promise<{\n copiedSkills: WizardResultV2[\"skills\"];\n installMode: InstallMode;\n succeeded: boolean;\n }> {\n const mpResult = await ensureMarketplace(sourceResult);\n\n if (!mpResult.marketplace) {\n this.warn(\"Could not resolve marketplace. Falling back to Local Mode...\");\n // Marketplace unavailable — copy all plugin-intended skills locally as fallback.\n // In \"mixed\" mode, localSkills were already copied; only copy plugin-intended skills.\n // In \"plugin\" mode, no skills were copied yet; copy all skills.\n const fallbackSkills = installMode === \"mixed\" ? pluginSkills : allSkills;\n const fallbackCopyResult = await copyLocalSkills(fallbackSkills, projectDir, sourceResult);\n this.log(`Copied ${fallbackCopyResult.totalCopied} skills to .claude/skills/\\n`);\n return {\n copiedSkills: [...copiedSkills, ...fallbackSkills],\n installMode: \"local\",\n succeeded: false,\n };\n }\n\n if (mpResult.registered) {\n this.log(`Registering marketplace \"${mpResult.marketplace}\"...`);\n }\n\n this.log(\"Installing skill plugins...\");\n const pluginResult = await installPluginSkills(pluginSkills, mpResult.marketplace, projectDir);\n\n for (const item of pluginResult.installed) {\n this.log(` Installed ${item.ref}`);\n }\n for (const item of pluginResult.failed) {\n this.warn(`Failed to install plugin ${item.id}: ${item.error}`);\n }\n\n this.log(`Installed ${pluginResult.installed.length} skill plugins\\n`);\n return { copiedSkills, installMode, succeeded: true };\n }\n\n private async writeConfigAndCompile(\n result: WizardResultV2,\n sourceResult: SourceLoadResult,\n flags: { source?: string; refresh: boolean },\n installMode: InstallMode,\n ): Promise<{\n configResult: Awaited<ReturnType<typeof writeProjectConfig>>;\n compileResult: Awaited<ReturnType<typeof compileAgents>>;\n projectPaths: ReturnType<typeof resolveInstallPaths>;\n }> {\n this.log(\"Generating configuration...\");\n const configResult = await writeProjectConfig({\n wizardResult: result,\n sourceResult,\n projectDir: process.cwd(),\n sourceFlag: flags.source,\n });\n\n if (configResult.wasMerged) {\n this.log(`Merged with existing config at ${configResult.existingConfigPath}`);\n }\n\n this.log(`Configuration saved (${configResult.config.agents.length} agents)\\n`);\n\n this.log(STATUS_MESSAGES.COMPILING_AGENTS);\n const projectPaths = resolveInstallPaths(process.cwd(), \"project\");\n const agentDefs = await loadAgentDefs();\n const { allSkills } = await discoverInstalledSkills(process.cwd());\n const compileResult = await compileAgents({\n projectDir: process.cwd(),\n sourcePath: agentDefs.sourcePath,\n skills: allSkills,\n installMode,\n agentScopeMap: buildAgentScopeMap(configResult.config),\n outputDir: projectPaths.agentsDir,\n });\n this.log(`Compiled ${compileResult.compiled.length} agents to .claude/agents/\\n`);\n\n return { configResult, compileResult, projectPaths };\n }\n\n private reportSuccess(\n configResult: Awaited<ReturnType<typeof writeProjectConfig>>,\n compileResult: Awaited<ReturnType<typeof compileAgents>>,\n projectPaths: ReturnType<typeof resolveInstallPaths>,\n installMode: InstallMode,\n pluginModeSucceeded: boolean,\n copiedSkills: WizardResultV2[\"skills\"],\n ): void {\n this.log(`${SUCCESS_MESSAGES.INIT_SUCCESS}\\n`);\n\n const isLocalOutput =\n installMode === \"local\" || (installMode === \"mixed\" && !pluginModeSucceeded);\n if (isLocalOutput && copiedSkills.length > 0) {\n this.log(\"Skills copied to:\");\n this.log(` ${projectPaths.skillsDir}`);\n for (const skill of copiedSkills) {\n const displayName = getSkillById(skill.id).displayName;\n this.log(` ${displayName}/`);\n }\n this.log(\"\");\n }\n this.log(\"Agents compiled to:\");\n this.log(` ${projectPaths.agentsDir}`);\n for (const agentName of compileResult.compiled) {\n this.log(` ${agentName}.md`);\n }\n this.log(\"\");\n this.log(\"Configuration:\");\n this.log(` ${configResult.configPath}`);\n this.log(\"\");\n this.log(\"To customize agent-skill assignments:\");\n this.log(` 1. Edit .claude-src/config.ts`);\n this.log(` 2. Run '${CLI_BIN_NAME} compile' to regenerate agents`);\n this.log(\"\");\n }\n}\n\nexport type DashboardData = {\n skillCount: number;\n agentCount: number;\n mode: string;\n source?: string;\n};\n\n/** Gathers dashboard data from the installation and project config. */\nexport async function getDashboardData(projectDir: string): Promise<DashboardData> {\n const [info, loaded] = await Promise.all([getInstallationInfo(), loadProjectConfig(projectDir)]);\n\n const skillCount = loaded?.config?.skills?.length ?? 0;\n const agentCount = info?.agentCount ?? 0;\n const mode =\n info?.mode ?? (loaded?.config?.skills ? deriveInstallMode(loaded.config.skills) : \"local\");\n const source = loaded?.config?.source;\n\n return { skillCount, agentCount, mode, source };\n}\n","import React from \"react\";\n\nimport { Text, Box } from \"ink\";\nimport path from \"path\";\n\nimport { CLAUDE_DIR, CLI_COLORS, MAX_CONFIG_FILE_SIZE } from \"../consts\";\nimport { fileExists, readFileSafe } from \"../utils/fs\";\nimport { warn } from \"../utils/logger\";\nimport { settingsFileSchema, warnUnknownFields } from \"./schemas\";\n\ntype PermissionConfig = {\n allow?: string[];\n deny?: string[];\n};\n\ntype SettingsFile = {\n permissions?: PermissionConfig;\n};\n\nexport async function checkPermissions(projectRoot: string): Promise<React.ReactElement | null> {\n const settingsPath = path.join(projectRoot, CLAUDE_DIR, \"settings.json\");\n const localSettingsPath = path.join(projectRoot, CLAUDE_DIR, \"settings.local.json\");\n\n let permissions: PermissionConfig | undefined;\n\n for (const filePath of [localSettingsPath, settingsPath]) {\n if (await fileExists(filePath)) {\n try {\n const content = await readFileSafe(filePath, MAX_CONFIG_FILE_SIZE);\n const raw = JSON.parse(content);\n if (typeof raw === \"object\" && raw !== null && !Array.isArray(raw)) {\n // Known Claude CLI settings.json fields (permissions is ours; the rest are managed by Claude CLI)\n const EXPECTED_SETTINGS_KEYS = [\n \"permissions\",\n \"enabledPlugins\",\n \"env\",\n \"allowedTools\",\n \"customInstructions\",\n \"defaultModel\",\n ] as const;\n warnUnknownFields(\n raw as Record<string, unknown>,\n EXPECTED_SETTINGS_KEYS,\n `settings file '${filePath}'`,\n );\n }\n const result = settingsFileSchema.safeParse(raw);\n const parsed: SettingsFile = result.success ? (result.data as SettingsFile) : {};\n if (parsed.permissions) {\n permissions = parsed.permissions;\n break;\n }\n } catch {\n warn(`Malformed settings file at '${filePath}' — skipping`);\n }\n }\n }\n\n if (!permissions) {\n return (\n <Box flexDirection=\"column\" borderStyle=\"round\" borderColor={CLI_COLORS.WARNING} padding={1}>\n <Text bold color={CLI_COLORS.WARNING}>\n Permission Notice\n </Text>\n <Text>No permissions configured in .claude/settings.json</Text>\n <Text>Agents will prompt for approval on each tool use.</Text>\n <Text> </Text>\n <Text>For autonomous operation, add to .claude/settings.json:</Text>\n <Text> </Text>\n <Text color=\"dim\">{\"{\"}</Text>\n <Text color=\"dim\">{' \"permissions\": {'}</Text>\n <Text color=\"dim\">{' \"allow\": ['}</Text>\n <Text color=\"dim\">{' \"Read(*)\",'}</Text>\n <Text color=\"dim\">{' \"Bash(git *)\",'}</Text>\n <Text color=\"dim\">{' \"Bash(bun *)\"'}</Text>\n <Text color=\"dim\">{\" ]\"}</Text>\n <Text color=\"dim\">{\" }\"}</Text>\n <Text color=\"dim\">{\"}\"}</Text>\n </Box>\n );\n }\n\n const hasRestrictiveBash = permissions.deny?.some(\n (rule) => rule === \"Bash(*)\" || rule === \"Bash\",\n );\n const hasNoAllows = !permissions.allow || permissions.allow.length === 0;\n\n if (hasRestrictiveBash || hasNoAllows) {\n return (\n <Box flexDirection=\"column\" borderStyle=\"round\" borderColor={CLI_COLORS.WARNING} padding={1}>\n <Text bold color={CLI_COLORS.WARNING}>\n Permission Warnings\n </Text>\n {hasRestrictiveBash && (\n <Text>\n ⚠ Bash is denied in permissions. Some agents require Bash for git, testing, and build\n commands.\n </Text>\n )}\n {hasNoAllows && (\n <Text>⚠ No allow rules configured. Agents will prompt for each tool use.</Text>\n )}\n </Box>\n );\n }\n\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAEA,SAAS,aAAa;AACtB,SAAS,QAAQ,OAAAA,MAAK,QAAAC,OAAM,cAAc;AAC1C,OAAO,QAAQ;;;ACJf;AAEA,SAAS,MAAM,WAAW;AAC1B,OAAO,UAAU;AAyDX,SACE,KADF;AAzCN,eAAsB,iBAAiB,aAAyD;AAC9F,QAAM,eAAe,KAAK,KAAK,aAAa,YAAY,eAAe;AACvE,QAAM,oBAAoB,KAAK,KAAK,aAAa,YAAY,qBAAqB;AAElF,MAAI;AAEJ,aAAW,YAAY,CAAC,mBAAmB,YAAY,GAAG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c;AAChC,cAAM,cAAc,aAAa,MAAM,EAAE,EAAE;AAC3C,aAAK,IAAI,OAAO,WAAW,GAAG;AAAA,MAChC;AACA,WAAK,IAAI,EAAE;AAAA,IACb;AACA,SAAK,IAAI,qBAAqB;AAC9B,SAAK,IAAI,KAAK,aAAa,SAAS,EAAE;AACtC,eAAW,aAAa,cAAc,UAAU;AAC9C,WAAK,IAAI,OAAO,SAAS,KAAK;AAAA,IAChC;AACA,SAAK,IAAI,EAAE;AACX,SAAK,IAAI,gBAAgB;AACzB,SAAK,IAAI,KAAK,aAAa,UAAU,EAAE;AACvC,SAAK,IAAI,EAAE;AACX,SAAK,IAAI,uCAAuC;AAChD,SAAK,IAAI,iCAAiC;AAC1C,SAAK,IAAI,aAAa,YAAY,gCAAgC;AAClE,SAAK,IAAI,EAAE;AAAA,EACb;AACF;AAUA,eAAsB,iBAAiB,YAA4C;AACjF,QAAM,CAAC,MAAM,MAAM,IAAI,MAAM,QAAQ,IAAI,CAAC,oBAAoB,GAAG,kBAAkB,UAAU,CAAC,CAAC;AAE/F,QAAM,aAAa,QAAQ,QAAQ,QAAQ,UAAU;AACrD,QAAM,aAAa,MAAM,cAAc;AACvC,QAAM,OACJ,MAAM,SAAS,QAAQ,QAAQ,SAAS,kBAAkB,OAAO,OAAO,MAAM,IAAI;AACpF,QAAM,SAAS,QAAQ,QAAQ;AAE/B,SAAO,EAAE,YAAY,YAAY,MAAM,OAAO;AAChD;","names":["Box","Text","jsx","jsxs","Box","Text","result"]}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
skillFrontmatterLoaderSchema,
|
|
10
10
|
verbose,
|
|
11
11
|
warn
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-NUU3U43A.js";
|
|
13
13
|
import {
|
|
14
14
|
CLAUDE_SRC_DIR,
|
|
15
15
|
DIRS,
|
|
@@ -198,4 +198,4 @@ export {
|
|
|
198
198
|
loadSkillsByIds,
|
|
199
199
|
loadPluginSkills
|
|
200
200
|
};
|
|
201
|
-
//# sourceMappingURL=chunk-
|
|
201
|
+
//# sourceMappingURL=chunk-B6MYECV6.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-HSKKGAOW.js";
|
|
9
9
|
import {
|
|
10
10
|
useWizardStore
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-HSLVCKVQ.js";
|
|
12
12
|
import {
|
|
13
13
|
matrix,
|
|
14
14
|
typedEntries
|
|
@@ -67,4 +67,4 @@ var DomainSelection = () => {
|
|
|
67
67
|
export {
|
|
68
68
|
DomainSelection
|
|
69
69
|
};
|
|
70
|
-
//# sourceMappingURL=chunk-
|
|
70
|
+
//# sourceMappingURL=chunk-C5IYJ42F.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
useWizardStore
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HSLVCKVQ.js";
|
|
5
5
|
import {
|
|
6
6
|
HOTKEY_HELP,
|
|
7
7
|
HOTKEY_SCOPE,
|
|
@@ -108,4 +108,4 @@ var HelpModal = ({ currentStep }) => {
|
|
|
108
108
|
export {
|
|
109
109
|
HelpModal
|
|
110
110
|
};
|
|
111
|
-
//# sourceMappingURL=chunk-
|
|
111
|
+
//# sourceMappingURL=chunk-CXWBVBDM.js.map
|
|
@@ -17,11 +17,11 @@ import {
|
|
|
17
17
|
resolveAgents,
|
|
18
18
|
writeContentHash,
|
|
19
19
|
writePluginManifest
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-TMTUTUEV.js";
|
|
21
21
|
import {
|
|
22
22
|
loadAllAgents,
|
|
23
23
|
loadProjectAgents
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-B6MYECV6.js";
|
|
25
25
|
import {
|
|
26
26
|
typedEntries,
|
|
27
27
|
typedKeys
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
verbose,
|
|
40
40
|
warn,
|
|
41
41
|
writeFile
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-NUU3U43A.js";
|
|
43
43
|
import {
|
|
44
44
|
CLAUDE_DIR,
|
|
45
45
|
DIRS,
|
|
@@ -114,14 +114,97 @@ async function fetchAgentDefinitionsFromRemote(source, options = {}) {
|
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
// src/cli/lib/agents/agent-plugin-compiler.ts
|
|
118
|
+
init_esm_shims();
|
|
119
|
+
import path2 from "path";
|
|
120
|
+
function parseAgentFrontmatter(content, filePath) {
|
|
121
|
+
const raw = extractFrontmatter(content);
|
|
122
|
+
if (!raw) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
const result = agentFrontmatterValidationSchema.safeParse(raw);
|
|
126
|
+
if (!result.success) {
|
|
127
|
+
warn(`Invalid agent frontmatter in ${filePath}: ${formatZodErrors(result.error.issues)}`);
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
return { name: result.data.name, description: result.data.description };
|
|
131
|
+
}
|
|
132
|
+
async function compileAgentPlugin(options) {
|
|
133
|
+
const { agentPath, outputDir } = options;
|
|
134
|
+
const fileName = path2.basename(agentPath);
|
|
135
|
+
const content = await readFile(agentPath);
|
|
136
|
+
const frontmatter = parseAgentFrontmatter(content, agentPath);
|
|
137
|
+
if (!frontmatter) {
|
|
138
|
+
throw new Error(
|
|
139
|
+
`Agent '${fileName}' has invalid or missing YAML frontmatter. Required fields: 'name' and 'description'. File: ${agentPath}`
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
const agentName = frontmatter.name;
|
|
143
|
+
verbose(`Compiling agent plugin: ${agentName} from ${agentPath}`);
|
|
144
|
+
const pluginDir = path2.join(outputDir, `agent-${agentName}`);
|
|
145
|
+
const agentsDir = path2.join(pluginDir, "agents");
|
|
146
|
+
await ensureDir(pluginDir);
|
|
147
|
+
await ensureDir(agentsDir);
|
|
148
|
+
const newHash = computeStringHash(content);
|
|
149
|
+
const { version, contentHash } = await determinePluginVersion(
|
|
150
|
+
newHash,
|
|
151
|
+
pluginDir,
|
|
152
|
+
getPluginManifestPath
|
|
153
|
+
);
|
|
154
|
+
const manifest = generateAgentPluginManifest({
|
|
155
|
+
agentName,
|
|
156
|
+
description: frontmatter.description,
|
|
157
|
+
version
|
|
158
|
+
});
|
|
159
|
+
await writePluginManifest(pluginDir, manifest);
|
|
160
|
+
await writeContentHash(pluginDir, contentHash, getPluginManifestPath);
|
|
161
|
+
verbose(` Wrote plugin.json for ${agentName} (v${version})`);
|
|
162
|
+
await copy(agentPath, path2.join(agentsDir, `${agentName}.md`));
|
|
163
|
+
verbose(` Copied agent ${fileName} -> agents/${agentName}.md`);
|
|
164
|
+
return {
|
|
165
|
+
pluginPath: pluginDir,
|
|
166
|
+
manifest,
|
|
167
|
+
agentName
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
async function compileAllAgentPlugins(agentsDir, outputDir) {
|
|
171
|
+
const results = [];
|
|
172
|
+
const agentMdFiles = await glob("*.md", agentsDir);
|
|
173
|
+
for (const agentFile of agentMdFiles) {
|
|
174
|
+
const agentPath = path2.join(agentsDir, agentFile);
|
|
175
|
+
try {
|
|
176
|
+
const result = await compileAgentPlugin({
|
|
177
|
+
agentPath,
|
|
178
|
+
outputDir
|
|
179
|
+
});
|
|
180
|
+
results.push(result);
|
|
181
|
+
log(` [OK] agent-${result.agentName}`);
|
|
182
|
+
} catch (error) {
|
|
183
|
+
const errorMessage = getErrorMessage(error);
|
|
184
|
+
warn(`Failed to compile agent from '${agentFile}': ${errorMessage}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return results;
|
|
188
|
+
}
|
|
189
|
+
function printAgentCompilationSummary(results) {
|
|
190
|
+
log(`
|
|
191
|
+
Compiled ${results.length} agent plugins:`);
|
|
192
|
+
for (const result of results) {
|
|
193
|
+
log(` - agent-${result.agentName} (v${result.manifest.version})`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// src/cli/lib/agents/index.ts
|
|
198
|
+
init_esm_shims();
|
|
199
|
+
|
|
117
200
|
// src/cli/lib/agents/agent-recompiler.ts
|
|
118
201
|
init_esm_shims();
|
|
119
202
|
import os from "os";
|
|
120
|
-
import
|
|
203
|
+
import path3 from "path";
|
|
121
204
|
async function getExistingAgentNames(pluginDir) {
|
|
122
205
|
const agentsDir = getPluginAgentsDir(pluginDir);
|
|
123
206
|
const files = await glob("*.md", agentsDir);
|
|
124
|
-
return files.map((f) =>
|
|
207
|
+
return files.map((f) => path3.basename(f, ".md"));
|
|
125
208
|
}
|
|
126
209
|
async function resolveAgentNames(params) {
|
|
127
210
|
const { specifiedAgents, projectConfig, allAgents, outputDir, pluginDir } = params;
|
|
@@ -153,7 +236,7 @@ function buildCompileConfig(params) {
|
|
|
153
236
|
}
|
|
154
237
|
}
|
|
155
238
|
const compileConfig = {
|
|
156
|
-
name: projectConfig?.name ||
|
|
239
|
+
name: projectConfig?.name || path3.basename(pluginDir),
|
|
157
240
|
description: projectConfig?.description || "Recompiled plugin",
|
|
158
241
|
agents: compileAgents
|
|
159
242
|
};
|
|
@@ -161,14 +244,14 @@ function buildCompileConfig(params) {
|
|
|
161
244
|
}
|
|
162
245
|
async function compileAndWriteAgents(params, result) {
|
|
163
246
|
const { resolvedAgents, agentsDir, sourcePath, engine, installMode, agentScopeMap } = params;
|
|
164
|
-
const globalAgentsDir =
|
|
247
|
+
const globalAgentsDir = path3.join(os.homedir(), CLAUDE_DIR, "agents");
|
|
165
248
|
await ensureDir(globalAgentsDir);
|
|
166
249
|
for (const [agentName, agent] of typedEntries(resolvedAgents)) {
|
|
167
250
|
try {
|
|
168
251
|
const output = await compileAgentForPlugin(agentName, agent, sourcePath, engine, installMode);
|
|
169
252
|
const scope = agentScopeMap?.get(agentName) ?? "project";
|
|
170
253
|
const targetDir = scope === "global" ? globalAgentsDir : agentsDir;
|
|
171
|
-
await writeFile(
|
|
254
|
+
await writeFile(path3.join(targetDir, `${agentName}.md`), output);
|
|
172
255
|
result.compiled.push(agentName);
|
|
173
256
|
verbose(` Recompiled: ${agentName} (${scope} -> ${targetDir})`);
|
|
174
257
|
} catch (error) {
|
|
@@ -236,93 +319,10 @@ async function recompileAgents(options) {
|
|
|
236
319
|
return result;
|
|
237
320
|
}
|
|
238
321
|
|
|
239
|
-
// src/cli/lib/agents/agent-plugin-compiler.ts
|
|
240
|
-
init_esm_shims();
|
|
241
|
-
import path3 from "path";
|
|
242
|
-
function parseAgentFrontmatter(content, filePath) {
|
|
243
|
-
const raw = extractFrontmatter(content);
|
|
244
|
-
if (!raw) {
|
|
245
|
-
return null;
|
|
246
|
-
}
|
|
247
|
-
const result = agentFrontmatterValidationSchema.safeParse(raw);
|
|
248
|
-
if (!result.success) {
|
|
249
|
-
warn(`Invalid agent frontmatter in ${filePath}: ${formatZodErrors(result.error.issues)}`);
|
|
250
|
-
return null;
|
|
251
|
-
}
|
|
252
|
-
return { name: result.data.name, description: result.data.description };
|
|
253
|
-
}
|
|
254
|
-
async function compileAgentPlugin(options) {
|
|
255
|
-
const { agentPath, outputDir } = options;
|
|
256
|
-
const fileName = path3.basename(agentPath);
|
|
257
|
-
const content = await readFile(agentPath);
|
|
258
|
-
const frontmatter = parseAgentFrontmatter(content, agentPath);
|
|
259
|
-
if (!frontmatter) {
|
|
260
|
-
throw new Error(
|
|
261
|
-
`Agent '${fileName}' has invalid or missing YAML frontmatter. Required fields: 'name' and 'description'. File: ${agentPath}`
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
const agentName = frontmatter.name;
|
|
265
|
-
verbose(`Compiling agent plugin: ${agentName} from ${agentPath}`);
|
|
266
|
-
const pluginDir = path3.join(outputDir, `agent-${agentName}`);
|
|
267
|
-
const agentsDir = path3.join(pluginDir, "agents");
|
|
268
|
-
await ensureDir(pluginDir);
|
|
269
|
-
await ensureDir(agentsDir);
|
|
270
|
-
const newHash = computeStringHash(content);
|
|
271
|
-
const { version, contentHash } = await determinePluginVersion(
|
|
272
|
-
newHash,
|
|
273
|
-
pluginDir,
|
|
274
|
-
getPluginManifestPath
|
|
275
|
-
);
|
|
276
|
-
const manifest = generateAgentPluginManifest({
|
|
277
|
-
agentName,
|
|
278
|
-
description: frontmatter.description,
|
|
279
|
-
version
|
|
280
|
-
});
|
|
281
|
-
await writePluginManifest(pluginDir, manifest);
|
|
282
|
-
await writeContentHash(pluginDir, contentHash, getPluginManifestPath);
|
|
283
|
-
verbose(` Wrote plugin.json for ${agentName} (v${version})`);
|
|
284
|
-
await copy(agentPath, path3.join(agentsDir, `${agentName}.md`));
|
|
285
|
-
verbose(` Copied agent ${fileName} -> agents/${agentName}.md`);
|
|
286
|
-
return {
|
|
287
|
-
pluginPath: pluginDir,
|
|
288
|
-
manifest,
|
|
289
|
-
agentName
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
async function compileAllAgentPlugins(agentsDir, outputDir) {
|
|
293
|
-
const results = [];
|
|
294
|
-
const agentMdFiles = await glob("*.md", agentsDir);
|
|
295
|
-
for (const agentFile of agentMdFiles) {
|
|
296
|
-
const agentPath = path3.join(agentsDir, agentFile);
|
|
297
|
-
try {
|
|
298
|
-
const result = await compileAgentPlugin({
|
|
299
|
-
agentPath,
|
|
300
|
-
outputDir
|
|
301
|
-
});
|
|
302
|
-
results.push(result);
|
|
303
|
-
log(` [OK] agent-${result.agentName}`);
|
|
304
|
-
} catch (error) {
|
|
305
|
-
const errorMessage = getErrorMessage(error);
|
|
306
|
-
warn(`Failed to compile agent from '${agentFile}': ${errorMessage}`);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
return results;
|
|
310
|
-
}
|
|
311
|
-
function printAgentCompilationSummary(results) {
|
|
312
|
-
log(`
|
|
313
|
-
Compiled ${results.length} agent plugins:`);
|
|
314
|
-
for (const result of results) {
|
|
315
|
-
log(` - agent-${result.agentName} (v${result.manifest.version})`);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// src/cli/lib/agents/index.ts
|
|
320
|
-
init_esm_shims();
|
|
321
|
-
|
|
322
322
|
export {
|
|
323
323
|
getAgentDefinitions,
|
|
324
324
|
recompileAgents,
|
|
325
325
|
compileAllAgentPlugins,
|
|
326
326
|
printAgentCompilationSummary
|
|
327
327
|
};
|
|
328
|
-
//# sourceMappingURL=chunk-
|
|
328
|
+
//# sourceMappingURL=chunk-FBZR46GC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/lib/agents/agent-fetcher.ts","../src/cli/lib/agents/agent-plugin-compiler.ts","../src/cli/lib/agents/index.ts","../src/cli/lib/agents/agent-recompiler.ts"],"sourcesContent":["import path from \"path\";\nimport { directoryExists } from \"../../utils/fs\";\nimport { verbose } from \"../../utils/logger\";\nimport { PROJECT_ROOT, DIRS, CLAUDE_DIR } from \"../../consts\";\nimport { fetchFromSource, type FetchOptions } from \"../loading\";\nimport { loadProjectSourceConfig } from \"../configuration\";\nimport type { AgentSourcePaths } from \"../../types\";\n\nexport type AgentDefinitionOptions = FetchOptions & {\n projectDir?: string;\n};\n\nexport async function getAgentDefinitions(\n remoteSource?: string,\n options: AgentDefinitionOptions = {},\n): Promise<AgentSourcePaths> {\n if (remoteSource) {\n return fetchAgentDefinitionsFromRemote(remoteSource, options);\n }\n return getLocalAgentDefinitions(options);\n}\n\nexport async function getLocalAgentDefinitions(\n options: AgentDefinitionOptions = {},\n): Promise<AgentSourcePaths> {\n const agentsDir = path.join(PROJECT_ROOT, DIRS.agents);\n let templatesDir = path.join(PROJECT_ROOT, DIRS.templates);\n\n if (!(await directoryExists(agentsDir))) {\n throw new Error(\n `Agent partials not found at '${agentsDir}'. Ensure the CLI is properly installed.`,\n );\n }\n\n if (options.projectDir) {\n const localTemplatesDir = path.join(options.projectDir, CLAUDE_DIR, \"templates\");\n if (await directoryExists(localTemplatesDir)) {\n verbose(`Using local templates from: ${localTemplatesDir}`);\n templatesDir = localTemplatesDir;\n }\n }\n\n if (!(await directoryExists(templatesDir))) {\n verbose(`Templates directory not found: ${templatesDir}`);\n }\n\n verbose(`Agent partials loaded from CLI: ${agentsDir}`);\n verbose(`Templates directory: ${templatesDir}`);\n\n return {\n agentsDir,\n templatesDir,\n sourcePath: PROJECT_ROOT,\n };\n}\n\nexport async function fetchAgentDefinitionsFromRemote(\n source: string,\n options: FetchOptions & { agentsDir?: string } = {},\n): Promise<AgentSourcePaths> {\n verbose(`Fetching agent partials from remote: ${source}`);\n\n const result = await fetchFromSource(source, {\n forceRefresh: options.forceRefresh,\n subdir: \"\",\n });\n\n let agentsDirRelPath = options.agentsDir;\n if (!agentsDirRelPath) {\n const sourceProjectConfig = await loadProjectSourceConfig(result.path);\n agentsDirRelPath = sourceProjectConfig?.agentsDir ?? DIRS.agents;\n if (sourceProjectConfig?.agentsDir) {\n verbose(`Using agentsDir from source config: ${sourceProjectConfig.agentsDir}`);\n }\n }\n\n const agentsDir = path.join(result.path, agentsDirRelPath);\n const templatesDir = path.join(agentsDir, \"_templates\");\n\n if (!(await directoryExists(agentsDir))) {\n throw new Error(`Agent partials not found at '${agentsDir}'`);\n }\n\n if (!(await directoryExists(templatesDir))) {\n verbose(`Templates directory not found: ${templatesDir}`);\n }\n\n verbose(`Agent partials fetched from: ${result.path}`);\n\n return {\n agentsDir,\n templatesDir,\n sourcePath: result.path,\n };\n}\n","import path from \"path\";\nimport { getErrorMessage } from \"../../utils/errors\";\nimport { readFile, ensureDir, glob, copy } from \"../../utils/fs\";\nimport { log, verbose, warn } from \"../../utils/logger\";\nimport {\n generateAgentPluginManifest,\n writePluginManifest,\n getPluginManifestPath,\n} from \"../plugins\";\nimport { computeStringHash, determinePluginVersion, writeContentHash } from \"../versioning\";\nimport { extractFrontmatter } from \"../../utils/frontmatter\";\nimport type { AgentFrontmatter, PluginManifest } from \"../../types\";\nimport { agentFrontmatterValidationSchema, formatZodErrors } from \"../schemas\";\n\nexport type AgentPluginOptions = {\n agentPath: string;\n outputDir: string;\n};\n\nexport type CompiledAgentPlugin = {\n pluginPath: string;\n manifest: PluginManifest;\n agentName: string;\n};\n\nfunction parseAgentFrontmatter(\n content: string,\n filePath: string,\n): Pick<AgentFrontmatter, \"name\" | \"description\"> | null {\n const raw = extractFrontmatter(content);\n if (!raw) {\n return null;\n }\n\n const result = agentFrontmatterValidationSchema.safeParse(raw);\n if (!result.success) {\n warn(`Invalid agent frontmatter in ${filePath}: ${formatZodErrors(result.error.issues)}`);\n return null;\n }\n\n return { name: result.data.name, description: result.data.description };\n}\n\nexport async function compileAgentPlugin(\n options: AgentPluginOptions,\n): Promise<CompiledAgentPlugin> {\n const { agentPath, outputDir } = options;\n const fileName = path.basename(agentPath);\n\n const content = await readFile(agentPath);\n const frontmatter = parseAgentFrontmatter(content, agentPath);\n\n if (!frontmatter) {\n throw new Error(\n `Agent '${fileName}' has invalid or missing YAML frontmatter. ` +\n `Required fields: 'name' and 'description'. File: ${agentPath}`,\n );\n }\n\n const agentName = frontmatter.name;\n\n verbose(`Compiling agent plugin: ${agentName} from ${agentPath}`);\n\n const pluginDir = path.join(outputDir, `agent-${agentName}`);\n const agentsDir = path.join(pluginDir, \"agents\");\n\n await ensureDir(pluginDir);\n await ensureDir(agentsDir);\n\n const newHash = computeStringHash(content);\n const { version, contentHash } = await determinePluginVersion(\n newHash,\n pluginDir,\n getPluginManifestPath,\n );\n\n const manifest = generateAgentPluginManifest({\n agentName,\n description: frontmatter.description,\n version,\n });\n\n await writePluginManifest(pluginDir, manifest);\n\n await writeContentHash(pluginDir, contentHash, getPluginManifestPath);\n\n verbose(` Wrote plugin.json for ${agentName} (v${version})`);\n\n await copy(agentPath, path.join(agentsDir, `${agentName}.md`));\n verbose(` Copied agent ${fileName} -> agents/${agentName}.md`);\n\n return {\n pluginPath: pluginDir,\n manifest,\n agentName,\n };\n}\n\nexport async function compileAllAgentPlugins(\n agentsDir: string,\n outputDir: string,\n): Promise<CompiledAgentPlugin[]> {\n const results: CompiledAgentPlugin[] = [];\n\n const agentMdFiles = await glob(\"*.md\", agentsDir);\n\n for (const agentFile of agentMdFiles) {\n const agentPath = path.join(agentsDir, agentFile);\n\n try {\n const result = await compileAgentPlugin({\n agentPath,\n outputDir,\n });\n results.push(result);\n log(` [OK] agent-${result.agentName}`);\n } catch (error) {\n const errorMessage = getErrorMessage(error);\n warn(`Failed to compile agent from '${agentFile}': ${errorMessage}`);\n }\n }\n\n return results;\n}\n\nexport function printAgentCompilationSummary(results: CompiledAgentPlugin[]): void {\n log(`\\nCompiled ${results.length} agent plugins:`);\n for (const result of results) {\n log(` - agent-${result.agentName} (v${result.manifest.version})`);\n }\n}\n","export {\n type AgentDefinitionOptions,\n getAgentDefinitions,\n getLocalAgentDefinitions,\n fetchAgentDefinitionsFromRemote,\n} from \"./agent-fetcher\";\n\nexport {\n type RecompileAgentsOptions,\n type RecompileAgentsResult,\n recompileAgents,\n} from \"./agent-recompiler\";\n\nexport {\n type AgentPluginOptions,\n type CompiledAgentPlugin,\n compileAgentPlugin,\n compileAllAgentPlugins,\n printAgentCompilationSummary,\n} from \"./agent-plugin-compiler\";\n","import type { Liquid } from \"liquidjs\";\nimport os from \"os\";\nimport path from \"path\";\n\nimport { getErrorMessage } from \"../../utils/errors\";\nimport type {\n AgentConfig,\n AgentDefinition,\n AgentName,\n CompileAgentConfig,\n CompileConfig,\n ProjectConfig,\n SkillDefinitionMap,\n} from \"../../types\";\nimport { type InstallMode, deriveInstallMode } from \"../installation/installation\";\nimport { CLAUDE_DIR } from \"../../consts\";\nimport { glob, writeFile, ensureDir } from \"../../utils/fs\";\nimport { verbose } from \"../../utils/logger\";\nimport { typedEntries, typedKeys } from \"../../utils/typed-object\";\nimport { createLiquidEngine } from \"../compiler\";\nimport { loadProjectConfig } from \"../configuration\";\nimport { loadAllAgents, loadProjectAgents } from \"../loading\";\nimport { getPluginAgentsDir } from \"../plugins\";\nimport { discoverAllPluginSkills } from \"../plugins/plugin-discovery\";\nimport { resolveAgents, buildSkillRefsFromConfig } from \"../resolver\";\nimport { compileAgentForPlugin } from \"../stacks\";\n\nexport type RecompileAgentsOptions = {\n pluginDir: string;\n sourcePath: string;\n agents?: AgentName[];\n skills?: SkillDefinitionMap;\n projectDir?: string;\n outputDir?: string;\n installMode?: InstallMode;\n /** When provided, routes agents by scope: global agents to ~/.claude/agents/, project agents to outputDir */\n agentScopeMap?: Map<AgentName, \"project\" | \"global\">;\n};\n\nexport type RecompileAgentsResult = {\n compiled: AgentName[];\n failed: AgentName[];\n warnings: string[];\n};\n\nasync function getExistingAgentNames(pluginDir: string): Promise<AgentName[]> {\n const agentsDir = getPluginAgentsDir(pluginDir);\n const files = await glob(\"*.md\", agentsDir);\n // Boundary cast: directory names from filesystem are agent names by convention\n return files.map((f) => path.basename(f, \".md\") as AgentName);\n}\n\ntype ResolveAgentNamesParams = {\n specifiedAgents?: AgentName[];\n projectConfig: ProjectConfig | null;\n allAgents: Record<AgentName, AgentDefinition>;\n outputDir?: string;\n pluginDir: string;\n};\n\nasync function resolveAgentNames(params: ResolveAgentNamesParams): Promise<AgentName[]> {\n const { specifiedAgents, projectConfig, allAgents, outputDir, pluginDir } = params;\n\n if (specifiedAgents) {\n return specifiedAgents;\n }\n\n if (projectConfig?.agents?.length) {\n const agentNames = projectConfig.agents.map((a) => a.name);\n verbose(`Using agents from config: ${agentNames.join(\", \")}`);\n return agentNames;\n }\n\n if (outputDir) {\n const names = typedKeys<AgentName>(allAgents);\n verbose(`Using all available agents from source: ${names.join(\", \")}`);\n return names;\n }\n\n return getExistingAgentNames(pluginDir);\n}\n\ntype BuildCompileConfigParams = {\n agentNames: AgentName[];\n allAgents: Record<AgentName, AgentDefinition>;\n projectConfig: ProjectConfig | null;\n pluginDir: string;\n};\n\ntype BuildCompileConfigResult = {\n compileConfig: CompileConfig;\n warnings: string[];\n};\n\nfunction buildCompileConfig(params: BuildCompileConfigParams): BuildCompileConfigResult {\n const { agentNames, allAgents, projectConfig, pluginDir } = params;\n const warnings: string[] = [];\n\n // Store initialization: accumulator populated below for each agent in agentNames\n const compileAgents: Record<string, CompileAgentConfig> = {};\n for (const agentName of agentNames) {\n if (allAgents[agentName]) {\n const agentStack = projectConfig?.stack?.[agentName];\n compileAgents[agentName] = agentStack ? { skills: buildSkillRefsFromConfig(agentStack) } : {};\n } else {\n warnings.push(`Agent \"${agentName}\" not found in source definitions`);\n }\n }\n\n const compileConfig: CompileConfig = {\n name: projectConfig?.name || path.basename(pluginDir),\n description: projectConfig?.description || \"Recompiled plugin\",\n agents: compileAgents,\n };\n\n return { compileConfig, warnings };\n}\n\ntype CompileAndWriteParams = {\n resolvedAgents: Record<AgentName, AgentConfig>;\n agentsDir: string;\n sourcePath: string;\n engine: Liquid;\n installMode?: InstallMode;\n agentScopeMap?: Map<AgentName, \"project\" | \"global\">;\n};\n\nasync function compileAndWriteAgents(\n params: CompileAndWriteParams,\n result: RecompileAgentsResult,\n): Promise<void> {\n const { resolvedAgents, agentsDir, sourcePath, engine, installMode, agentScopeMap } = params;\n\n const globalAgentsDir = path.join(os.homedir(), CLAUDE_DIR, \"agents\");\n\n // Ensure both directories exist before writing agents.\n // ensureDir is idempotent (mkdir -p), so calling it when dirs already exist is safe.\n await ensureDir(globalAgentsDir);\n\n for (const [agentName, agent] of typedEntries<AgentName, AgentConfig>(resolvedAgents)) {\n try {\n const output = await compileAgentForPlugin(agentName, agent, sourcePath, engine, installMode);\n\n // Route agent output by scope: global agents go to ~/.claude/agents/, project agents to agentsDir\n const scope = agentScopeMap?.get(agentName) ?? \"project\";\n const targetDir = scope === \"global\" ? globalAgentsDir : agentsDir;\n await writeFile(path.join(targetDir, `${agentName}.md`), output);\n result.compiled.push(agentName);\n verbose(` Recompiled: ${agentName} (${scope} -> ${targetDir})`);\n } catch (error) {\n result.failed.push(agentName);\n result.warnings.push(`Failed to compile ${agentName}: ${getErrorMessage(error)}`);\n }\n }\n}\n\nexport async function recompileAgents(\n options: RecompileAgentsOptions,\n): Promise<RecompileAgentsResult> {\n const { pluginDir, sourcePath, skills: providedSkills, projectDir, outputDir } = options;\n\n const result: RecompileAgentsResult = {\n compiled: [],\n failed: [],\n warnings: [],\n };\n\n const configDir = projectDir ?? pluginDir;\n const loadedConfig = await loadProjectConfig(configDir);\n const projectConfig = loadedConfig?.config ?? null;\n\n const builtinAgents = await loadAllAgents(sourcePath);\n const projectAgents = projectDir ? await loadProjectAgents(projectDir) : {};\n\n // Priority: project agents > built-in agents\n const allAgents: Record<AgentName, AgentDefinition> = {\n ...builtinAgents,\n ...projectAgents,\n };\n\n const agentNames = await resolveAgentNames({\n specifiedAgents: options.agents,\n projectConfig,\n allAgents,\n outputDir,\n pluginDir,\n });\n\n if (agentNames.length === 0) {\n result.warnings.push(\"No agents found to recompile\");\n return result;\n }\n\n verbose(`Recompiling ${agentNames.length} agents in ${outputDir ?? pluginDir}`);\n\n // When skills are not provided, discover from all plugin directories.\n let pluginSkills: SkillDefinitionMap;\n if (providedSkills) {\n pluginSkills = providedSkills;\n } else {\n pluginSkills = await discoverAllPluginSkills(projectDir ?? pluginDir);\n }\n\n const { compileConfig, warnings } = buildCompileConfig({\n agentNames,\n allAgents,\n projectConfig,\n pluginDir,\n });\n result.warnings.push(...warnings);\n\n const engine = await createLiquidEngine(projectDir);\n const resolvedAgents = await resolveAgents(allAgents, pluginSkills, compileConfig, sourcePath);\n\n const agentsDir = outputDir ?? getPluginAgentsDir(pluginDir);\n await ensureDir(agentsDir);\n\n await compileAndWriteAgents(\n {\n resolvedAgents,\n agentsDir,\n sourcePath,\n engine,\n installMode: options.installMode ?? deriveInstallMode(projectConfig?.skills ?? []),\n agentScopeMap: options.agentScopeMap,\n },\n result,\n );\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,OAAO,UAAU;AAYjB,eAAsB,oBACpB,cACA,UAAkC,CAAC,GACR;AAC3B,MAAI,cAAc;AAChB,WAAO,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AA8B;AACnD,WAAO;AAAA,EACT;AAEA,UAAQ,eAAe,WAAW,MAAM,cAAc,aAAa,SAAS,EAAE;AAG9E,MAAI;AACJ,MAAI,gBAAgB;AAClB,mBAAe;AAAA,EACjB,OAAO;AACL,mBAAe,MAAM,wBAAwB,cAAc,SAAS;AAAA,EACtE;AAEA,QAAM,EAAE,eAAe,SAAS,IAAI,mBAAmB;AAAA,IACrD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,SAAO,SAAS,KAAK,GAAG,QAAQ;AAEhC,QAAM,SAAS,MAAM,mBAAmB,UAAU;AAClD,QAAM,iBAAiB,MAAM,cAAc,WAAW,cAAc,eAAe,UAAU;AAE7F,QAAM,YAAY,aAAa,mBAAmB,SAAS;AAC3D,QAAM,UAAU,SAAS;AAEzB,QAAM;AAAA,IACJ;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa,QAAQ,eAAe,kBAAkB,eAAe,UAAU,CAAC,CAAC;AAAA,MACjF,eAAe,QAAQ;AAAA,IACzB;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AACT;","names":["path","path","path","path"]}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-CKZ65VFJ.js";
|
|
14
14
|
import {
|
|
15
15
|
useWizardStore
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-HSLVCKVQ.js";
|
|
17
17
|
import {
|
|
18
18
|
HOTKEY_SET_ALL_LOCAL,
|
|
19
19
|
HOTKEY_SET_ALL_PLUGIN,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
import {
|
|
23
23
|
resolveAllSources,
|
|
24
24
|
searchExtraSources
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-TMTUTUEV.js";
|
|
26
26
|
import {
|
|
27
27
|
CLI_COLORS,
|
|
28
28
|
DEFAULT_BRANDING
|
|
@@ -168,4 +168,4 @@ var StepSources = ({ projectDir, onContinue, onBack }) => {
|
|
|
168
168
|
export {
|
|
169
169
|
StepSources
|
|
170
170
|
};
|
|
171
|
-
//# sourceMappingURL=chunk-
|
|
171
|
+
//# sourceMappingURL=chunk-HH3AWXF4.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getAvailableSkills,
|
|
5
5
|
getUnmetRequiredBy,
|
|
6
6
|
resolveAlias
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TMTUTUEV.js";
|
|
8
8
|
import {
|
|
9
9
|
getCategoryDomain,
|
|
10
10
|
getSkillById,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-ANXHMG32.js";
|
|
15
15
|
import {
|
|
16
16
|
warn
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-NUU3U43A.js";
|
|
18
18
|
import {
|
|
19
19
|
BUILT_IN_DOMAIN_ORDER,
|
|
20
20
|
DEFAULT_PUBLIC_SOURCE_NAME
|
|
@@ -643,4 +643,4 @@ export {
|
|
|
643
643
|
buildCategoriesForDomain,
|
|
644
644
|
useWizardStore
|
|
645
645
|
};
|
|
646
|
-
//# sourceMappingURL=chunk-
|
|
646
|
+
//# sourceMappingURL=chunk-HSLVCKVQ.js.map
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
loadProjectSourceConfig,
|
|
8
8
|
resolveAgentsSource,
|
|
9
9
|
resolveSource
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TMTUTUEV.js";
|
|
11
11
|
import {
|
|
12
12
|
BaseCommand
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-MMTMXLI4.js";
|
|
14
14
|
import {
|
|
15
15
|
DEFAULT_BRANDING
|
|
16
16
|
} from "./chunk-6PGL2XMY.js";
|
|
@@ -90,4 +90,4 @@ ${DEFAULT_BRANDING.NAME} Configuration
|
|
|
90
90
|
export {
|
|
91
91
|
ConfigShow
|
|
92
92
|
};
|
|
93
|
-
//# sourceMappingURL=chunk-
|
|
93
|
+
//# sourceMappingURL=chunk-HZ2IBXVQ.js.map
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
WizardLayout
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UNEJKTLP.js";
|
|
5
5
|
import {
|
|
6
6
|
StepSettings
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZOWRO7UQ.js";
|
|
8
8
|
import {
|
|
9
9
|
StepSources
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HH3AWXF4.js";
|
|
11
11
|
import {
|
|
12
12
|
StepStack
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-Q4DMIPZB.js";
|
|
14
14
|
import {
|
|
15
15
|
StepAgents
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-LZ7XQ3IU.js";
|
|
17
17
|
import {
|
|
18
18
|
StepBuild
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-SGZOFIFF.js";
|
|
20
20
|
import {
|
|
21
21
|
StepConfirm
|
|
22
22
|
} from "./chunk-ANZV33N5.js";
|
|
23
23
|
import {
|
|
24
24
|
DomainSelection
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-C5IYJ42F.js";
|
|
26
26
|
import {
|
|
27
27
|
getStackName
|
|
28
28
|
} from "./chunk-NL5EB57E.js";
|
|
29
29
|
import {
|
|
30
30
|
useWizardStore
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-HSLVCKVQ.js";
|
|
32
32
|
import {
|
|
33
33
|
cliTheme
|
|
34
34
|
} from "./chunk-HEQVUIHQ.js";
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
import {
|
|
43
43
|
resolveAlias,
|
|
44
44
|
validateSelection
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-TMTUTUEV.js";
|
|
46
46
|
import {
|
|
47
47
|
findStack,
|
|
48
48
|
matrix
|
|
@@ -342,4 +342,4 @@ var Wizard = ({
|
|
|
342
342
|
export {
|
|
343
343
|
Wizard
|
|
344
344
|
};
|
|
345
|
-
//# sourceMappingURL=chunk-
|
|
345
|
+
//# sourceMappingURL=chunk-HZQOFFKA.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
verbose,
|
|
9
9
|
warn,
|
|
10
10
|
writeFile
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-NUU3U43A.js";
|
|
12
12
|
import {
|
|
13
13
|
DOMAINS
|
|
14
14
|
} from "./chunk-6XWHJHNZ.js";
|
|
@@ -121,4 +121,4 @@ export {
|
|
|
121
121
|
writeMarketplace,
|
|
122
122
|
getMarketplaceStats
|
|
123
123
|
};
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# sourceMappingURL=chunk-I44YG6VI.js.map
|
|
@@ -13,6 +13,9 @@ import {
|
|
|
13
13
|
KEY_LABEL_VIM_VERT,
|
|
14
14
|
isHotkey
|
|
15
15
|
} from "./chunk-HK53FRMU.js";
|
|
16
|
+
import {
|
|
17
|
+
truncateText
|
|
18
|
+
} from "./chunk-N6A7A4RA.js";
|
|
16
19
|
import {
|
|
17
20
|
CLI_COLORS,
|
|
18
21
|
UI_LAYOUT,
|
|
@@ -107,10 +110,6 @@ function matchesQuery(skill, query) {
|
|
|
107
110
|
if (skill.category.toLowerCase().includes(lowerQuery)) return true;
|
|
108
111
|
return skill.sourceName.toLowerCase().includes(lowerQuery);
|
|
109
112
|
}
|
|
110
|
-
function truncate(text, maxLength) {
|
|
111
|
-
if (text.length <= maxLength) return text;
|
|
112
|
-
return `${text.slice(0, maxLength - 3)}...`;
|
|
113
|
-
}
|
|
114
113
|
var Header = ({ sourceCount }) => {
|
|
115
114
|
return /* @__PURE__ */ jsxs(
|
|
116
115
|
Box,
|
|
@@ -160,9 +159,9 @@ var ResultItem = ({ skill, isSelected, isFocused }) => {
|
|
|
160
159
|
]
|
|
161
160
|
}
|
|
162
161
|
),
|
|
163
|
-
/* @__PURE__ */ jsx(Box, { width: 14, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children:
|
|
164
|
-
/* @__PURE__ */ jsx(Box, { width: 24, children: /* @__PURE__ */ jsx(Text, { color: isFocused ? CLI_COLORS.FOCUS : void 0, bold: isFocused || isSelected, children:
|
|
165
|
-
/* @__PURE__ */ jsx(Text, { dimColor: true, children:
|
|
162
|
+
/* @__PURE__ */ jsx(Box, { width: 14, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: truncateText(skill.sourceName, 12) }) }),
|
|
163
|
+
/* @__PURE__ */ jsx(Box, { width: 24, children: /* @__PURE__ */ jsx(Text, { color: isFocused ? CLI_COLORS.FOCUS : void 0, bold: isFocused || isSelected, children: truncateText(displayName, 22) }) }),
|
|
164
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: truncateText(skill.description, DESCRIPTION_WIDTH) })
|
|
166
165
|
] });
|
|
167
166
|
};
|
|
168
167
|
var ResultsList = ({
|
|
@@ -351,4 +350,4 @@ var SkillSearch = ({
|
|
|
351
350
|
export {
|
|
352
351
|
SkillSearch
|
|
353
352
|
};
|
|
354
|
-
//# sourceMappingURL=chunk-
|
|
353
|
+
//# sourceMappingURL=chunk-I5AZKNNL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/components/skill-search/skill-search.tsx","../src/cli/components/hooks/use-filtered-results.ts"],"sourcesContent":["import React, { useState, useCallback } from \"react\";\nimport { Box, Text, useApp, useInput } from \"ink\";\nimport { ThemeProvider } from \"@inkjs/ui\";\nimport { cliTheme } from \"../themes/default.js\";\nimport type { SkillId, ResolvedSkill } from \"../../types/index.js\";\nimport { CLI_COLORS, UI_SYMBOLS, UI_LAYOUT } from \"../../consts.js\";\nimport {\n HOTKEY_COPY_LINK,\n KEY_LABEL_ENTER,\n KEY_LABEL_ESC,\n KEY_LABEL_SPACE,\n KEY_LABEL_VIM_VERT,\n isHotkey,\n} from \"../wizard/hotkeys.js\";\nimport { useTextInput } from \"../hooks/use-text-input.js\";\nimport { useFilteredResults } from \"../hooks/use-filtered-results.js\";\nimport { truncateText } from \"../../utils/string.js\";\n\n/** A skill with source provenance info, used for search results and imports. */\nexport type SourcedSkill = ResolvedSkill & {\n sourceName: string;\n sourceUrl?: string;\n};\n\nexport type SkillSearchResult = {\n selectedSkills: SourcedSkill[];\n cancelled: boolean;\n};\n\nexport type SkillSearchProps = {\n skills: SourcedSkill[];\n sourceCount: number;\n initialQuery?: string;\n onComplete: (result: SkillSearchResult) => void;\n onCancel: () => void;\n};\n\nconst {\n MAX_VISIBLE_RESULTS,\n DESCRIPTION_WIDTH,\n COPIED_MESSAGE_TIMEOUT_MS,\n FALLBACK_MESSAGE_TIMEOUT_MS,\n} = UI_LAYOUT;\nconst { CHECKBOX_CHECKED, CHECKBOX_UNCHECKED } = UI_SYMBOLS;\n\nfunction matchesQuery(skill: SourcedSkill, query: string): boolean {\n if (!query.trim()) return true;\n\n const lowerQuery = query.toLowerCase();\n\n if (skill.id.toLowerCase().includes(lowerQuery)) return true;\n if (skill.displayName.toLowerCase().includes(lowerQuery)) return true;\n if (skill.slug.toLowerCase().includes(lowerQuery)) return true;\n if (skill.description.toLowerCase().includes(lowerQuery)) return true;\n if (skill.category.toLowerCase().includes(lowerQuery)) return true;\n return skill.sourceName.toLowerCase().includes(lowerQuery);\n}\n\ntype HeaderProps = {\n sourceCount: number;\n};\n\nconst Header: React.FC<HeaderProps> = ({ sourceCount }) => {\n return (\n <Box\n flexDirection=\"row\"\n justifyContent=\"space-between\"\n borderStyle=\"single\"\n borderBottom={false}\n borderLeft={false}\n borderRight={false}\n paddingX={1}\n >\n <Text bold color={CLI_COLORS.PRIMARY}>\n Search Skills\n </Text>\n <Text dimColor>\n {sourceCount} source{sourceCount !== 1 ? \"s\" : \"\"}\n </Text>\n </Box>\n );\n};\n\ntype SearchInputProps = {\n value: string;\n};\n\nconst SearchInput: React.FC<SearchInputProps> = ({ value }) => {\n return (\n <Box paddingX={1} paddingY={1}>\n <Text color={CLI_COLORS.FOCUS}>{\">\"} </Text>\n <Text>{value}</Text>\n <Text color={CLI_COLORS.FOCUS}>_</Text>\n </Box>\n );\n};\n\ntype ResultItemProps = {\n skill: SourcedSkill;\n isSelected: boolean;\n isFocused: boolean;\n};\n\nconst ResultItem: React.FC<ResultItemProps> = ({ skill, isSelected, isFocused }) => {\n const checkbox = isSelected ? CHECKBOX_CHECKED : CHECKBOX_UNCHECKED;\n const displayName = skill.displayName;\n return (\n <Box flexDirection=\"row\" gap={1}>\n <Text\n color={isFocused ? CLI_COLORS.FOCUS : isSelected ? CLI_COLORS.SUCCESS : undefined}\n bold={isFocused}\n backgroundColor={isFocused ? \"#333333\" : undefined}\n >\n {\" \"}\n {checkbox}{\" \"}\n </Text>\n <Box width={14}>\n <Text dimColor>{truncateText(skill.sourceName, 12)}</Text>\n </Box>\n <Box width={24}>\n <Text color={isFocused ? CLI_COLORS.FOCUS : undefined} bold={isFocused || isSelected}>\n {truncateText(displayName, 22)}\n </Text>\n </Box>\n <Text dimColor>{truncateText(skill.description, DESCRIPTION_WIDTH)}</Text>\n </Box>\n );\n};\n\ntype ResultsListProps = {\n results: SourcedSkill[];\n selectedIds: Set<SkillId>;\n focusedIndex: number;\n scrollOffset: number;\n};\n\nconst ResultsList: React.FC<ResultsListProps> = ({\n results,\n selectedIds,\n focusedIndex,\n scrollOffset,\n}) => {\n const visibleResults = results.slice(scrollOffset, scrollOffset + MAX_VISIBLE_RESULTS);\n\n if (results.length === 0) {\n return (\n <Box paddingX={1} paddingY={1}>\n <Text dimColor>No skills found matching your search.</Text>\n </Box>\n );\n }\n\n return (\n <Box\n flexDirection=\"column\"\n borderStyle=\"single\"\n borderTop={false}\n borderBottom={false}\n paddingX={1}\n >\n {visibleResults.map((skill, index) => {\n const actualIndex = scrollOffset + index;\n return (\n <ResultItem\n key={skill.id}\n skill={skill}\n isSelected={selectedIds.has(skill.id)}\n isFocused={actualIndex === focusedIndex}\n />\n );\n })}\n </Box>\n );\n};\n\ntype StatusBarProps = {\n resultCount: number;\n selectedCount: number;\n};\n\nconst StatusBar: React.FC<StatusBarProps> = ({ resultCount, selectedCount }) => {\n return (\n <Box paddingX={1}>\n <Text dimColor>\n {resultCount} result{resultCount !== 1 ? \"s\" : \"\"}\n {selectedCount > 0 && <Text color={CLI_COLORS.SUCCESS}> | {selectedCount} selected</Text>}\n </Text>\n </Box>\n );\n};\n\ntype FooterProps = {\n hasSelection: boolean;\n};\n\nconst Footer: React.FC<FooterProps> = ({ hasSelection }) => {\n return (\n <Box\n flexDirection=\"row\"\n justifyContent=\"center\"\n gap={2}\n borderStyle=\"single\"\n borderTop={false}\n borderLeft={false}\n borderRight={false}\n paddingX={1}\n marginTop={1}\n >\n <Text dimColor>\n <Text color={CLI_COLORS.UNFOCUSED}>{KEY_LABEL_VIM_VERT}</Text> navigate\n </Text>\n <Text dimColor>\n <Text color={CLI_COLORS.UNFOCUSED}>{KEY_LABEL_SPACE}</Text> select\n </Text>\n {hasSelection && (\n <Text dimColor>\n <Text color={CLI_COLORS.SUCCESS}>{KEY_LABEL_ENTER}</Text> import\n </Text>\n )}\n <Text dimColor>\n <Text color={CLI_COLORS.UNFOCUSED}>{HOTKEY_COPY_LINK.label}</Text> copy link\n </Text>\n <Text dimColor>\n <Text color={CLI_COLORS.WARNING}>{KEY_LABEL_ESC}</Text> cancel\n </Text>\n </Box>\n );\n};\n\nexport const SkillSearch: React.FC<SkillSearchProps> = ({\n skills,\n sourceCount,\n initialQuery = \"\",\n onComplete,\n onCancel,\n}) => {\n const { exit } = useApp();\n\n const { value: query, handleInput: handleTextInput } = useTextInput(initialQuery);\n const [selectedIds, setSelectedIds] = useState<Set<SkillId>>(new Set());\n const [copiedMessage, setCopiedMessage] = useState<string | null>(null);\n\n const {\n filteredResults,\n safeFocusedIndex,\n focusedItem: focusedSkill,\n scrollOffset,\n moveUp,\n moveDown,\n } = useFilteredResults({\n items: skills,\n query,\n filterFn: matchesQuery,\n maxVisible: MAX_VISIBLE_RESULTS,\n });\n\n const toggleSelection = useCallback((skillId: SkillId) => {\n setSelectedIds((prev) => {\n const next = new Set(prev);\n if (next.has(skillId)) {\n next.delete(skillId);\n } else {\n next.add(skillId);\n }\n return next;\n });\n }, []);\n\n const copySkillLink = useCallback(async (skill: SourcedSkill) => {\n const link = skill.sourceUrl ? `${skill.sourceUrl}/${skill.id}` : skill.id;\n\n try {\n // OSC 52 terminal clipboard escape sequence\n const encoded = Buffer.from(link).toString(\"base64\");\n process.stdout.write(`\\x1b]52;c;${encoded}\\x07`);\n setCopiedMessage(`Copied: ${link}`);\n setTimeout(() => setCopiedMessage(null), COPIED_MESSAGE_TIMEOUT_MS);\n } catch {\n setCopiedMessage(`Link: ${link}`);\n setTimeout(() => setCopiedMessage(null), FALLBACK_MESSAGE_TIMEOUT_MS);\n }\n }, []);\n\n useInput((input, key) => {\n if (key.escape) {\n onCancel();\n exit();\n return;\n }\n\n if (key.return) {\n if (selectedIds.size > 0) {\n const selectedSkills = filteredResults.filter((s) => selectedIds.has(s.id));\n onComplete({\n selectedSkills,\n cancelled: false,\n });\n exit();\n }\n return;\n }\n\n if (input === \" \" && focusedSkill) {\n toggleSelection(focusedSkill.id);\n return;\n }\n\n if (isHotkey(input, HOTKEY_COPY_LINK) && focusedSkill) {\n void copySkillLink(focusedSkill);\n return;\n }\n\n const isUp = key.upArrow || input === \"k\";\n const isDown = key.downArrow || input === \"j\";\n\n if (isUp) {\n moveUp();\n }\n\n if (isDown) {\n moveDown();\n }\n\n handleTextInput(input, key);\n });\n\n return (\n <ThemeProvider theme={cliTheme}>\n <Box flexDirection=\"column\">\n <Header sourceCount={sourceCount} />\n <SearchInput value={query} />\n <ResultsList\n results={filteredResults}\n selectedIds={selectedIds}\n focusedIndex={safeFocusedIndex}\n scrollOffset={scrollOffset}\n />\n <StatusBar resultCount={filteredResults.length} selectedCount={selectedIds.size} />\n {copiedMessage && (\n <Box paddingX={1}>\n <Text color={CLI_COLORS.SUCCESS}>{copiedMessage}</Text>\n </Box>\n )}\n <Footer hasSelection={selectedIds.size > 0} />\n </Box>\n </ThemeProvider>\n );\n};\n","import { useState, useMemo, useEffect, useCallback, useRef } from \"react\";\n\ntype UseFilteredResultsOptions<T> = {\n /** Items to filter */\n items: T[];\n /** Current search query */\n query: string;\n /** Filter predicate — returns true if item matches the query */\n filterFn: (item: T, query: string) => boolean;\n /** Number of visible rows in the scrollable viewport */\n maxVisible: number;\n};\n\ntype UseFilteredResultsResult<T> = {\n /** Items that pass the filter */\n filteredResults: T[];\n /** Index clamped to valid range */\n safeFocusedIndex: number;\n /** The item at safeFocusedIndex, or undefined when empty */\n focusedItem: T | undefined;\n /** First visible row offset for windowed rendering */\n scrollOffset: number;\n /** Move focus up one row (clamped, adjusts scroll) */\n moveUp: () => void;\n /** Move focus down one row (clamped, adjusts scroll) */\n moveDown: () => void;\n};\n\n/**\n * Manages filtered list state: query-based filtering, focus tracking,\n * and scroll-offset synchronisation for windowed rendering.\n * Focus and scroll reset automatically when the query changes.\n */\nexport function useFilteredResults<T>({\n items,\n query,\n filterFn,\n maxVisible,\n}: UseFilteredResultsOptions<T>): UseFilteredResultsResult<T> {\n const [focusedIndex, setFocusedIndex] = useState(0);\n const [scrollOffset, setScrollOffset] = useState(0);\n\n useEffect(() => {\n setFocusedIndex(0);\n setScrollOffset(0);\n }, [query]);\n\n const filteredResults = useMemo(() => {\n return items.filter((item) => filterFn(item, query));\n }, [items, query, filterFn]);\n\n const safeFocusedIndex = Math.min(focusedIndex, Math.max(0, filteredResults.length - 1));\n const focusedItem = filteredResults[safeFocusedIndex] as T | undefined;\n\n // Refs for stable callback access (matches use-keyboard-navigation pattern)\n const safeFocusedIndexRef = useRef(safeFocusedIndex);\n const scrollOffsetRef = useRef(scrollOffset);\n const resultCountRef = useRef(filteredResults.length);\n\n useEffect(() => {\n safeFocusedIndexRef.current = safeFocusedIndex;\n }, [safeFocusedIndex]);\n\n useEffect(() => {\n scrollOffsetRef.current = scrollOffset;\n }, [scrollOffset]);\n\n useEffect(() => {\n resultCountRef.current = filteredResults.length;\n }, [filteredResults.length]);\n\n const moveUp = useCallback(() => {\n const current = safeFocusedIndexRef.current;\n if (current <= 0) return;\n const newIndex = current - 1;\n setFocusedIndex(newIndex);\n if (newIndex < scrollOffsetRef.current) {\n setScrollOffset(newIndex);\n }\n }, []);\n\n const moveDown = useCallback(() => {\n const current = safeFocusedIndexRef.current;\n if (current >= resultCountRef.current - 1) return;\n const newIndex = current + 1;\n setFocusedIndex(newIndex);\n if (newIndex >= scrollOffsetRef.current + maxVisible) {\n setScrollOffset(newIndex - maxVisible + 1);\n }\n }, [maxVisible]);\n\n return {\n filteredResults,\n safeFocusedIndex,\n focusedItem,\n scrollOffset,\n moveUp,\n moveDown,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,SAAgB,YAAAA,WAAU,eAAAC,oBAAmB;AAC7C,SAAS,KAAK,MAAM,QAAQ,gBAAgB;AAC5C,SAAS,qBAAqB;;;ACF9B;AAAA,SAAS,UAAU,SAAS,WAAW,aAAa,cAAc;AAiC3D,SAAS,mBAAsB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA8D;AAC5D,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,CAAC;AAClD,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,CAAC;AAElD,YAAU,MAAM;AACd,oBAAgB,CAAC;AACjB,oBAAgB,CAAC;AAAA,EACnB,GAAG,CAAC,KAAK,CAAC;AAEV,QAAM,kBAAkB,QAAQ,MAAM;AACpC,WAAO,MAAM,OAAO,CAAC,SAAS,SAAS,MAAM,KAAK,CAAC;AAAA,EACrD,GAAG,CAAC,OAAO,OAAO,QAAQ,CAAC;AAE3B,QAAM,mBAAmB,KAAK,IAAI,c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