thinkback-play.ts
commands/thinkback-play/thinkback-play.ts
44
Lines
1430
Bytes
1
Exports
5
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file lives in the command layer. It likely turns a user action into concrete program behavior.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with commands, ui-flow. It contains 44 lines, 5 detected imports, and 1 detected exports.
Important relationships
Detected exports
call
Keywords
thinkbackpluginsinstallationstextfirstinstalljoinpathlocalcommandresultloadinstalledpluginsv2utils
Detected imports
path../../commands.js../../utils/plugins/installedPluginsManager.js../../utils/plugins/officialMarketplace.js../thinkback/thinkback.js
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
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 }
}