forked from ultraworkers/claw-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththinkback-play.ts
More file actions
43 lines (37 loc) · 1.4 KB
/
Copy paththinkback-play.ts
File metadata and controls
43 lines (37 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { join } from 'path'
import type { LocalCommandResult } from '../../commands.js'
import { loadInstalledPluginsV2 } from '../../utils/plugins/installedPluginsManager.js'
import { OFFICIAL_MARKETPLACE_NAME } from '../../utils/plugins/officialMarketplace.js'
import { playAnimation } from '../thinkback/thinkback.js'
const INTERNAL_MARKETPLACE_NAME = 'claude-code-marketplace'
const SKILL_NAME = 'thinkback'
function getPluginId(): string {
const marketplaceName =
process.env.USER_TYPE === 'ant'
? INTERNAL_MARKETPLACE_NAME
: OFFICIAL_MARKETPLACE_NAME
return `thinkback@${marketplaceName}`
}
export async function call(): Promise<LocalCommandResult> {
// Get skill directory from installed plugins config
const v2Data = loadInstalledPluginsV2()
const pluginId = getPluginId()
const installations = v2Data.plugins[pluginId]
if (!installations || installations.length === 0) {
return {
type: 'text' as const,
value:
'Thinkback plugin not installed. Run /think-back first to install it.',
}
}
const firstInstall = installations[0]
if (!firstInstall?.installPath) {
return {
type: 'text' as const,
value: 'Thinkback plugin installation path not found.',
}
}
const skillDir = join(firstInstall.installPath, 'skills', SKILL_NAME)
const result = await playAnimation(skillDir)
return { type: 'text' as const, value: result.message }
}