name: detect-local-content-folder
description: Finds the local folder for a given content kind and name. Use before pulling or pushing content to determine the correct local directory.
argument-hint:
user-invocable: false
allowed-tools: Glob
Find the local folder for content of kind $0 with name $1.
Rules
The local folder is always inside the pluralized kind subdirectory of the project root:
challenge->challenges/tutorial->tutorials/course->courses/skill-path->skill-paths/
The folder either:
- Matches the name exactly:
<kind-plural>/$1/ - Or matches the pattern
<kind-plural>/$1-<short-hex-suffix>/(e.g.,challenges/docker-101-6e812f1f/)
- Matches the name exactly:
Steps
- Use Glob to search for
$0s/$1/index.md(exact match). - If not found, use Glob to search for
$0s/$1-*/index.md(suffix match). - If a match is found, return the folder path (without the
index.mdpart). - If no match is found, report that no local folder was detected.