{"version":3,"file":"skillsCommand.cjs","names":["SKILLS_COMMAND","requireDoomConfigContext","skillInvocation"],"sources":["../../../../../../../src/extensions/workspaces/sessions/(backend)/_lib/skillsCommand.ts"],"sourcesContent":["import { requireDoomConfigContext } from '@agimon-ai/doompi-config/piContext';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\n\nimport type { SkillCatalog, SkillCatalogOptions } from '../../../../../services/skillCatalog';\nimport { skillInvocation } from '../../../../../services/skillText';\nimport type { SkillsOverlayResult } from '../../../../../tui/skillsOverlay';\nimport { SKILLS_COMMAND } from '../../../../../types/skills';\n\nconst INFO = 'info';\nconst ERROR = 'error';\n\nexport interface SkillsCommandDependencies {\n  readonly cordisContext: () => Context;\n  /** Skill directories every loaded extension has contributed this session. */\n  readonly extensionSources: () => readonly { source: string; directories: readonly string[] }[];\n  /** Merged view of normal, deferred and package Help skills. */\n  readonly inventory: (ctx: ExtensionContext) => Promise<{\n    readonly helpSkills: SkillCatalogOptions['helpSkills'];\n    readonly diagnostics: readonly string[];\n  }>;\n  readonly repositoryRoot: (ctx: ExtensionContext) => Promise<string>;\n  readonly buildCatalog: (request: SkillCatalogOptions) => Promise<SkillCatalog>;\n  readonly openOverlay: (\n    ctx: ExtensionContext,\n    options: { catalog: SkillCatalog; repoRoot: string },\n  ) => Promise<SkillsOverlayResult | undefined>;\n}\n\nexport function createSkillsCommand(\n  dependencies: SkillsCommandDependencies,\n): Parameters<ExtensionAPI['registerCommand']> {\n  return [\n    SKILLS_COMMAND,\n    {\n      description: 'Browse the skills this session loaded, and what other domains would add',\n      handler: async (_args, ctx) => {\n        if (!ctx.hasUI || ctx.mode !== 'tui') {\n          ctx.ui.notify('/skills requires interactive mode', ERROR);\n          return;\n        }\n\n        const state = requireDoomConfigContext(dependencies.cordisContext()).harness;\n        const [repoRoot, inventory] = await Promise.all([\n          dependencies.repositoryRoot(ctx),\n          dependencies.inventory(ctx),\n        ]);\n        const catalog = await dependencies.buildCatalog({\n          repoRoot,\n          activeSkillDirectories: state.skillDirectories,\n          extensionSources: dependencies.extensionSources(),\n          helpSkills: inventory.helpSkills,\n          helpDiagnostics: [...inventory.diagnostics],\n        });\n\n        const result = await dependencies.openOverlay(ctx, { catalog, repoRoot });\n        if (!result) return;\n        ctx.ui.setEditorText(skillInvocation(result.skill.name));\n        ctx.ui.notify(`Loaded ${result.skill.name} into the prompt. Press enter to run it.`, INFO);\n      },\n    },\n  ];\n}\n"],"mappings":";;;;AASA,MAAM,OAAO;AACb,MAAM,QAAQ;AAmBd,SAAgB,oBACd,cAC6C;CAC7C,OAAO,CACLA,eAAAA,gBACA;EACE,aAAa;EACb,SAAS,OAAO,OAAO,QAAQ;GAC7B,IAAI,CAAC,IAAI,SAAS,IAAI,SAAS,OAAO;IACpC,IAAI,GAAG,OAAO,qCAAqC,KAAK;IACxD;GACF;GAEA,MAAM,SAAA,GAAQC,mCAAAA,yBAAAA,CAAyB,aAAa,cAAc,CAAC,CAAC,CAAC;GACrE,MAAM,CAAC,UAAU,aAAa,MAAM,QAAQ,IAAI,CAC9C,aAAa,eAAe,GAAG,GAC/B,aAAa,UAAU,GAAG,CAC5B,CAAC;GACD,MAAM,UAAU,MAAM,aAAa,aAAa;IAC9C;IACA,wBAAwB,MAAM;IAC9B,kBAAkB,aAAa,iBAAiB;IAChD,YAAY,UAAU;IACtB,iBAAiB,CAAC,GAAG,UAAU,WAAW;GAC5C,CAAC;GAED,MAAM,SAAS,MAAM,aAAa,YAAY,KAAK;IAAE;IAAS;GAAS,CAAC;GACxE,IAAI,CAAC,QAAQ;GACb,IAAI,GAAG,cAAcC,cAAAA,gBAAgB,OAAO,MAAM,IAAI,CAAC;GACvD,IAAI,GAAG,OAAO,UAAU,OAAO,MAAM,KAAK,2CAA2C,IAAI;EAC3F;CACF,CACF;AACF"}