ruffage
This commit is contained in:
@@ -87,7 +87,9 @@ def build_skills_index_payload(
|
|||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
raise ValueError("cursor must be an integer string") from 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 = [
|
matches = [
|
||||||
skill
|
skill
|
||||||
for skill in ordered
|
for skill in ordered
|
||||||
|
|||||||
@@ -138,7 +138,9 @@ class SkillFrontmatter(BaseModel):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def validate_name(cls, value: str) -> str:
|
def validate_name(cls, value: str) -> str:
|
||||||
if not SKILL_ID_RE.fullmatch(value):
|
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:
|
if "anthropic" in value or "claude" in value:
|
||||||
raise ValueError("name must not contain reserved words anthropic or claude")
|
raise ValueError("name must not contain reserved words anthropic or claude")
|
||||||
return value
|
return value
|
||||||
@@ -188,8 +190,7 @@ class DocsRegistry:
|
|||||||
docs_markdown_by_path: dict[str, str]
|
docs_markdown_by_path: dict[str, str]
|
||||||
docs_markdown_path_index: tuple[str, ...]
|
docs_markdown_path_index: tuple[str, ...]
|
||||||
tag_to_skill_ids: dict[str, 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]:
|
def _parse_frontmatter(markdown: str, *, path: str) -> tuple[dict[str, Any], str]:
|
||||||
@@ -234,7 +235,9 @@ def _walk_markdown(
|
|||||||
return results
|
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)
|
model = SkillFrontmatter.model_validate(raw)
|
||||||
if model.name != skill_dir_name:
|
if model.name != skill_dir_name:
|
||||||
raise ValueError("frontmatter name must exactly match skill directory name")
|
raise ValueError("frontmatter name must exactly match skill directory name")
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ def mount_docs_static(app: FastAPI, *, docs_route: str, site_dir: Path) -> None:
|
|||||||
docs_root = f"{normalized_route}/"
|
docs_root = f"{normalized_route}/"
|
||||||
|
|
||||||
async def redirect_to_docs_root() -> RedirectResponse:
|
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(
|
app.add_api_route(
|
||||||
normalized_route,
|
normalized_route,
|
||||||
|
|||||||
Reference in New Issue
Block a user