//! Static template strings for project scaffolding.
//!
//! Includes templates for `.huskies/specs/`, default settings, agent config,
//! and bot examples.  Bot examples are loaded via `include_str!` from the
//! `.huskies/` directory at the repo root.

pub(super) const STORY_KIT_README: &str = include_str!("../../../../../.huskies/README.md");

pub(super) const BOT_TOML_MATRIX_EXAMPLE: &str =
    include_str!("../../../../../.huskies/bot.toml.matrix.example");
pub(super) const BOT_TOML_WHATSAPP_META_EXAMPLE: &str =
    include_str!("../../../../../.huskies/bot.toml.whatsapp-meta.example");
pub(super) const BOT_TOML_WHATSAPP_TWILIO_EXAMPLE: &str =
    include_str!("../../../../../.huskies/bot.toml.whatsapp-twilio.example");
pub(super) const BOT_TOML_SLACK_EXAMPLE: &str =
    include_str!("../../../../../.huskies/bot.toml.slack.example");

pub(super) const STORY_KIT_CONTEXT: &str = "<!-- huskies:scaffold-template -->\n\
# Project Context\n\
\n\
## High-Level Goal\n\
\n\
TODO: Describe the high-level goal of this project.\n\
\n\
## Core Features\n\
\n\
TODO: List the core features of this project.\n\
\n\
## Domain Definition\n\
\n\
TODO: Define the key domain concepts and entities.\n\
\n\
## Glossary\n\
\n\
TODO: Define abbreviations and technical terms.\n";

pub(super) const STORY_KIT_STACK: &str = "<!-- huskies:scaffold-template -->\n\
# Tech Stack & Constraints\n\
\n\
## Core Stack\n\
\n\
TODO: Describe the language, frameworks, and runtimes.\n\
\n\
## Coding Standards\n\
\n\
TODO: Describe code style, linting rules, and error handling conventions.\n\
\n\
## Quality Gates\n\
\n\
TODO: List the commands that must pass before merging (e.g., cargo test, npm run build).\n\
\n\
## Libraries\n\
\n\
TODO: List approved libraries and their purpose.\n";

pub(super) const STORY_KIT_SCRIPT_TEST: &str = "#!/usr/bin/env bash\nset -euo pipefail\n\n# Add your project's test commands here.\n# Story Kit agents invoke this script as the canonical test runner.\n# Exit 0 on success, non-zero on failure.\necho \"No tests configured\"\n";

pub(super) const STORY_KIT_CLAUDE_MD: &str = "<!-- huskies:scaffold-template -->\n\
Never chain shell commands with `&&`, `||`, or `;` in a single Bash call. \
The permission system validates the entire command string, and chained commands \
won't match allow rules like `Bash(git *)`. Use separate Bash calls instead — \
parallel calls work fine.\n\
\n\
Read .huskies/README.md to see our dev process.\n\
\n\
IMPORTANT: On your first conversation, call `wizard_status` to check if \
project setup is complete. If not, read .huskies/README.md for the full \
setup wizard instructions and guide the user through it conversationally.\n";

pub(super) const STORY_KIT_CLAUDE_SETTINGS: &str = r#"{
  "permissions": {
    "allow": [
      "Bash",
      "Read",
      "Edit",
      "Write",
      "Glob",
      "Grep",
      "mcp__huskies__*"
    ]
  },
  "enabledMcpjsonServers": [
    "huskies"
  ]
}
"#;

pub(super) const DEFAULT_PROJECT_SETTINGS_TOML: &str = r#"# Project-wide default QA mode: "server", "agent", or "human".
# Per-story `qa` front matter overrides this setting.
default_qa = "server"

# Maximum number of retries per story per pipeline stage before marking as blocked.
# Set to 0 to disable retry limits.
max_retries = 2

# Default model for coder-stage agents (e.g. "sonnet", "opus").
# When set, only coder agents whose model matches this value are considered for
# auto-assignment, so opus agents are only used when explicitly requested via
# story front matter `agent:` field.
# default_coder_model = "sonnet"

# Maximum number of concurrent coder-stage agents.
# Stories wait in 2_current/ until a slot frees up.
# max_coders = 3

# Override the base branch for worktree creation and merge operations.
# When not set, the system auto-detects the base branch from the current HEAD.
# base_branch = "main"

# Suppress soft rate-limit warning notifications in chat.
# Hard blocks and story-blocked notifications are always sent.
# rate_limit_notifications = true

# IANA timezone for timer scheduling (e.g. "Europe/London", "America/New_York").
# Timer HH:MM inputs are interpreted in this timezone.
# timezone = "America/New_York"
"#;

pub(super) const DEFAULT_AGENTS_TOML: &str = r#"[[agent]]
name = "coder-1"
stage = "coder"
role = "Full-stack engineer. Implements features across all components."
model = "sonnet"
max_turns = 50
max_budget_usd = 5.00
prompt = "You are working in a git worktree on story {{story_id}}. Read CLAUDE.md first, then .huskies/README.md to understand the dev process. Follow the workflow through implementation and verification. The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop.\n\nIMPORTANT: Commit all your work before your process exits. The server will automatically run acceptance gates when your process exits.\n\nIf `script/test` still contains the generic 'No tests configured' stub, update it to run the project's actual test suite before starting implementation."
system_prompt = "You are a full-stack engineer working autonomously in a git worktree. Follow the Story-Driven Test Workflow strictly. Commit all your work before finishing. Do not accept stories, move them to archived, or merge to master."

[[agent]]
name = "qa"
stage = "qa"
role = "Reviews coder work: runs quality gates, generates testing plans, and reports findings."
model = "sonnet"
max_turns = 40
max_budget_usd = 4.00
prompt = "You are the QA agent for story {{story_id}}. Review the coder's work and produce a structured QA report. Run quality gates (linting, tests), attempt a build, and generate a manual testing plan. Do NOT modify any code."
system_prompt = "You are a QA agent. Your job is read-only: review code quality, run tests, and produce a structured QA report. Do not modify code."

[[agent]]
name = "mergemaster"
stage = "mergemaster"
role = "Merges completed work into master, runs quality gates, and archives stories."
model = "sonnet"
max_turns = 30
max_budget_usd = 5.00
prompt = "You are the mergemaster agent for story {{story_id}}. Call merge_agent_work(story_id='{{story_id}}') to start the merge pipeline. Then poll get_merge_status(story_id='{{story_id}}') every 15 seconds until the status is 'completed' or 'failed'. Report the final result. If the merge fails, call report_merge_failure."
system_prompt = "You are the mergemaster agent. Call merge_agent_work to start the merge, then poll get_merge_status every 15 seconds until done. Never manually move story files. Call report_merge_failure when merges fail."
"#;
