source dump of claude code
at main 43 lines 1.4 kB view raw
1import { join } from 'path' 2import type { LocalCommandResult } from '../../commands.js' 3import { loadInstalledPluginsV2 } from '../../utils/plugins/installedPluginsManager.js' 4import { OFFICIAL_MARKETPLACE_NAME } from '../../utils/plugins/officialMarketplace.js' 5import { playAnimation } from '../thinkback/thinkback.js' 6 7const INTERNAL_MARKETPLACE_NAME = 'claude-code-marketplace' 8const SKILL_NAME = 'thinkback' 9 10function getPluginId(): string { 11 const marketplaceName = 12 process.env.USER_TYPE === 'ant' 13 ? INTERNAL_MARKETPLACE_NAME 14 : OFFICIAL_MARKETPLACE_NAME 15 return `thinkback@${marketplaceName}` 16} 17 18export async function call(): Promise<LocalCommandResult> { 19 // Get skill directory from installed plugins config 20 const v2Data = loadInstalledPluginsV2() 21 const pluginId = getPluginId() 22 const installations = v2Data.plugins[pluginId] 23 24 if (!installations || installations.length === 0) { 25 return { 26 type: 'text' as const, 27 value: 28 'Thinkback plugin not installed. Run /think-back first to install it.', 29 } 30 } 31 32 const firstInstall = installations[0] 33 if (!firstInstall?.installPath) { 34 return { 35 type: 'text' as const, 36 value: 'Thinkback plugin installation path not found.', 37 } 38 } 39 40 const skillDir = join(firstInstall.installPath, 'skills', SKILL_NAME) 41 const result = await playAnimation(skillDir) 42 return { type: 'text' as const, value: result.message } 43}