(args, context)
| 324 | return displayName || commandName |
| 325 | }, |
| 326 | async getPromptForCommand(args, context) { |
| 327 | // For skills from skills/ directory, include base directory |
| 328 | let finalContent = config.isSkillMode |
| 329 | ? `Base directory for this skill: ${dirname(file.filePath)}\n\n${content}` |
| 330 | : content |
| 331 | |
| 332 | finalContent = substituteArguments( |
| 333 | finalContent, |
| 334 | args, |
| 335 | true, |
| 336 | argumentNames, |
| 337 | ) |
| 338 | |
| 339 | // Replace ${CLAUDE_PLUGIN_ROOT} and ${CLAUDE_PLUGIN_DATA} with their paths |
| 340 | finalContent = substitutePluginVariables(finalContent, { |
| 341 | path: pluginPath, |
| 342 | source: sourceName, |
| 343 | }) |
| 344 | |
| 345 | // Replace ${user_config.X} with saved option values. Sensitive keys |
| 346 | // resolve to a descriptive placeholder instead — skill content goes to |
| 347 | // the model prompt and we don't put secrets there. |
| 348 | if (pluginManifest.userConfig) { |
| 349 | finalContent = substituteUserConfigInContent( |
| 350 | finalContent, |
| 351 | loadPluginOptions(sourceName), |
| 352 | pluginManifest.userConfig, |
| 353 | ) |
| 354 | } |
| 355 | |
| 356 | // Replace ${CLAUDE_SKILL_DIR} with this specific skill's directory. |
| 357 | // Distinct from ${CLAUDE_PLUGIN_ROOT}: a plugin can contain multiple |
| 358 | // skills, so CLAUDE_PLUGIN_ROOT points to the plugin root while |
| 359 | // CLAUDE_SKILL_DIR points to the individual skill's subdirectory. |
| 360 | if (config.isSkillMode) { |
| 361 | const rawSkillDir = dirname(file.filePath) |
| 362 | const skillDir = |
| 363 | process.platform === 'win32' |
| 364 | ? rawSkillDir.replace(/\\/g, '/') |
| 365 | : rawSkillDir |
| 366 | finalContent = finalContent.replace( |
| 367 | /\$\{CLAUDE_SKILL_DIR\}/g, |
| 368 | skillDir, |
| 369 | ) |
| 370 | } |
| 371 | |
| 372 | // Replace ${CLAUDE_SESSION_ID} with the current session ID |
| 373 | finalContent = finalContent.replace( |
| 374 | /\$\{CLAUDE_SESSION_ID\}/g, |
| 375 | getSessionId(), |
| 376 | ) |
| 377 | |
| 378 | finalContent = await executeShellCommandsInPrompt( |
| 379 | finalContent, |
| 380 | { |
| 381 | ...context, |
| 382 | getAppState() { |
| 383 | const appState = context.getAppState() |
nothing calls this directly
no test coverage detected