129 lines
3.5 KiB
Python
129 lines
3.5 KiB
Python
"""Skill routing: task_type + stage -> skill configuration.
|
|
|
|
Each entry maps a (task_type, stage) pair to either:
|
|
- A Claude Code skill (skill_file, tools, max_turns)
|
|
- An AutoCora handler (handler="autocora")
|
|
|
|
To add a new task type: add an entry here + write the skill .md file.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Any
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class SkillRoute:
|
|
"""One step in a task's pipeline."""
|
|
|
|
next_stage: str
|
|
next_status: str
|
|
handler: str = "claude" # "claude" or "autocora"
|
|
skill_file: str = "" # path relative to skills_dir
|
|
tools: str = "" # comma-separated Claude Code --allowedTools
|
|
max_turns: int = 10
|
|
|
|
|
|
# Tools commonly needed for content work
|
|
_CONTENT_TOOLS = "Read,Edit,Write,Bash,Glob,Grep,WebFetch,WebSearch"
|
|
_LINK_TOOLS = "Read,Edit,Write,Bash,Glob,Grep"
|
|
|
|
|
|
SKILL_MAP: dict[str, dict[str, SkillRoute]] = {
|
|
"Content Creation": {
|
|
"run_cora": SkillRoute(
|
|
handler="autocora",
|
|
next_stage="outline",
|
|
next_status="review",
|
|
),
|
|
"outline": SkillRoute(
|
|
skill_file="content_outline.md",
|
|
next_stage="draft",
|
|
next_status="review",
|
|
tools=_CONTENT_TOOLS,
|
|
max_turns=20,
|
|
),
|
|
"draft": SkillRoute(
|
|
skill_file="content_draft.md",
|
|
next_stage="final",
|
|
next_status="review",
|
|
tools=_CONTENT_TOOLS,
|
|
max_turns=30,
|
|
),
|
|
},
|
|
"On Page Optimization": {
|
|
"run_cora": SkillRoute(
|
|
handler="autocora",
|
|
next_stage="outline",
|
|
next_status="review",
|
|
),
|
|
"outline": SkillRoute(
|
|
skill_file="content_outline.md",
|
|
next_stage="draft",
|
|
next_status="review",
|
|
tools=_CONTENT_TOOLS,
|
|
max_turns=20,
|
|
),
|
|
"draft": SkillRoute(
|
|
skill_file="content_draft.md",
|
|
next_stage="hidden div",
|
|
next_status="review",
|
|
tools=_CONTENT_TOOLS,
|
|
max_turns=30,
|
|
),
|
|
"hidden div": SkillRoute(
|
|
skill_file="content_hidden_div.md",
|
|
next_stage="final",
|
|
next_status="review",
|
|
tools=_CONTENT_TOOLS,
|
|
max_turns=15,
|
|
),
|
|
},
|
|
"Press Release": {
|
|
"draft": SkillRoute(
|
|
skill_file="press_release_prompt.md",
|
|
next_stage="final",
|
|
next_status="review",
|
|
tools=_CONTENT_TOOLS,
|
|
max_turns=25,
|
|
),
|
|
},
|
|
"Link Building": {
|
|
"run_cora": SkillRoute(
|
|
handler="autocora",
|
|
next_stage="build",
|
|
next_status="review",
|
|
),
|
|
"build": SkillRoute(
|
|
handler="blm",
|
|
next_stage="final",
|
|
next_status="complete",
|
|
),
|
|
},
|
|
}
|
|
|
|
|
|
def get_route(task_type: str, stage: str) -> SkillRoute | None:
|
|
"""Look up the skill route for a task type + stage.
|
|
|
|
Returns None if no mapping exists.
|
|
"""
|
|
type_routes = SKILL_MAP.get(task_type)
|
|
if not type_routes:
|
|
return None
|
|
return type_routes.get(stage.lower().strip())
|
|
|
|
|
|
def get_valid_stages(task_type: str) -> list[str]:
|
|
"""Return the list of valid stage names for a task type."""
|
|
type_routes = SKILL_MAP.get(task_type)
|
|
if not type_routes:
|
|
return []
|
|
return list(type_routes.keys())
|
|
|
|
|
|
def get_supported_task_types() -> list[str]:
|
|
"""Return all supported task type names."""
|
|
return list(SKILL_MAP.keys())
|