Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/core/prompts/sections/skills.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import * as os from "os"
import * as path from "path"

import { SkillsManager, SkillMetadata } from "../../../services/skills/SkillsManager"

/**
* Get a display-friendly relative path for a skill.
* Converts absolute paths to relative paths to avoid leaking sensitive filesystem info.
*
* @param skill - The skill metadata
* @returns A relative path like ".kilocode/skills/name/SKILL.md" or "~/.kilocode/skills/name/SKILL.md"
* @returns A relative path like ".kilocode/skills/name/SKILL.md" or absolute path like "/Users/username/.kilocode/skills/name/SKILL.md"
*/
function getDisplayPath(skill: SkillMetadata): string {
const basePath = skill.source === "project" ? ".kilocode" : "~/.kilocode"
const basePath = skill.source === "project" ? ".kilocode" : path.join(os.homedir(), ".kilocode")
const skillsDir = skill.mode ? `skills-${skill.mode}` : "skills"
return `${basePath}/${skillsDir}/${skill.name}/SKILL.md`
return path.join(basePath, skillsDir, skill.name, "SKILL.md")
}

/**
Expand Down