This commit is contained in:
John Lancaster
2026-06-20 14:13:22 -05:00
parent 19f3c1740a
commit f54cacd6cb
4 changed files with 21 additions and 14 deletions
+3 -1
View File
@@ -87,7 +87,9 @@ def build_skills_index_payload(
except ValueError as exc:
raise ValueError("cursor must be an integer string") from exc
ordered = [registry.skills_by_id[skill_id] for skill_id in registry.skills_in_load_order]
ordered = [
registry.skills_by_id[skill_id] for skill_id in registry.skills_in_load_order
]
matches = [
skill
for skill in ordered
+7 -4
View File
@@ -138,7 +138,9 @@ class SkillFrontmatter(BaseModel):
@classmethod
def validate_name(cls, value: str) -> str:
if not SKILL_ID_RE.fullmatch(value):
raise ValueError("name must be lowercase kebab-case and start with a letter")
raise ValueError(
"name must be lowercase kebab-case and start with a letter"
)
if "anthropic" in value or "claude" in value:
raise ValueError("name must not contain reserved words anthropic or claude")
return value
@@ -188,8 +190,7 @@ class DocsRegistry:
docs_markdown_by_path: dict[str, str]
docs_markdown_path_index: tuple[str, ...]
tag_to_skill_ids: dict[str, tuple[str, ...]]
capability_to_skill_ids: dict[str, tuple[str, ...]
]
capability_to_skill_ids: dict[str, tuple[str, ...]]
def _parse_frontmatter(markdown: str, *, path: str) -> tuple[dict[str, Any], str]:
@@ -234,7 +235,9 @@ def _walk_markdown(
return results
def _validate_skill_frontmatter(raw: dict[str, Any], *, skill_dir_name: str) -> SkillFrontmatter:
def _validate_skill_frontmatter(
raw: dict[str, Any], *, skill_dir_name: str
) -> SkillFrontmatter:
model = SkillFrontmatter.model_validate(raw)
if model.name != skill_dir_name:
raise ValueError("frontmatter name must exactly match skill directory name")
+3 -1
View File
@@ -11,7 +11,9 @@ def mount_docs_static(app: FastAPI, *, docs_route: str, site_dir: Path) -> None:
docs_root = f"{normalized_route}/"
async def redirect_to_docs_root() -> RedirectResponse:
return RedirectResponse(url=docs_root, status_code=status.HTTP_307_TEMPORARY_REDIRECT)
return RedirectResponse(
url=docs_root, status_code=status.HTTP_307_TEMPORARY_REDIRECT
)
app.add_api_route(
normalized_route,