"""Prompt command help text utilities."""

from __future__ import annotations


def render_help_lines(*, show_webclear_help: bool) -> list[str]:
    lines = [
        "[bold]Available Commands:[/bold]",
        "  /help          - Show this help",
        "  /system        - Show the current system prompt",
        "  /prompt <name> - Load a Prompt File or use MCP Prompt",
        "  /usage         - Show current usage statistics",
        "  /skills        - List local skills for the manager directory",
        "  /skills available - Browse marketplace skills before installing",
        "  /skills search <query> - Search marketplace skills by name/description",
        "  /skills add    - Install a skill from the marketplace",
        "  /skills remove - Remove a skill from the manager directory",
        "  /skills update - Check/apply updates for managed installed skills",
        "  /skills help   - Show skills command usage",
        "  /cards         - List installed card packs",
        "  /cards add     - Install a card pack from the marketplace",
        "  /cards remove  - Remove an installed card pack",
        "  /cards update  - Check/apply updates for managed installed card packs",
        "  /cards publish - Commit/push local card pack changes back to source (supports --no-push/--temp-dir/--keep-temp)",
        "  /model reasoning <value> - Set reasoning effort (off/low/medium/high/max/xhigh or budgets like 0/1024/16000/32000)",
        "  /model verbosity <value> - Set text verbosity (low/medium/high)",
        "  /model web_search <value> - Set web search (on/off/default, if supported)",
        "  /model web_fetch <value> - Set web fetch (on/off/default, if supported)",
        "  /models [doctor] - Inspect model onboarding readiness",
        "  /models aliases - List resolved model aliases",
        "  /models aliases set <token> <model-spec> [--target env|project] [--dry-run]",
        "  /models aliases unset <token> [--target env|project] [--dry-run]",
        "  /models catalog <provider> [--all] - Show curated/all models for a provider",
        "  /history [agent_name] - Show chat history overview",
        "  /history clear all [agent_name] - Clear conversation history (keeps templates)",
        "  /history clear last [agent_name] - Remove the most recent message from history",
        "  /markdown      - Show last assistant message without markdown formatting",
        "  /mcpstatus     - Show MCP server status summary for the active agent",
        "  /mcp list      - List attached runtime MCP servers",
        "  /mcp connect <target> - Connect MCP server at runtime",
        "      [dim]flags: --name --auth <token-value> --timeout --oauth/--no-oauth --reconnect[/dim]",
        "  /mcp disconnect <name> - Disconnect attached MCP server",
        "  /mcp reconnect <name> - Reconnect attached MCP server",
        "  /mcp session [server] - List sessions (all connected servers by default; active marker ▶)",
        "  /mcp session list [server] - List sessions for one server/mcp name, or all connected when omitted",
        "  /mcp session jar [server] - Show grouped local session store entries",
        "  /mcp session new [server] [--title <title>] - Create a new MCP session",
        "  /mcp session use <server> <session_id> - Set active session metadata",
        "  /mcp session clear [server|--all] - Clear one session entry or the full store",
        "  /connect <target> - Alias for /mcp connect",
        "  /history save [filename] - Save current chat history to a file",
        "      [dim]Tip: Use a .json extension for MCP-compatible JSON; any other extension saves Markdown.[/dim]",
        "      [dim]Default: Timestamped filename (e.g., 25_01_15_14_30-conversation.json)[/dim]",
        "  /history load <filename> - Load chat history from a file",
        "  /history rewind <turn> - Rewind to a prior user turn",
        "  /history review <turn> - Review a prior user turn in full",
        "  /history fix [agent_name] - Remove the last pending tool call",
    ]
    if show_webclear_help:
        lines.append(
            "  /history webclear [agent_name] - Strip web tool/citation metadata from history"
        )
    lines.extend(
        [
            "  /resume [id|number] - Resume the last or specified session",
            "  /session list - List recent sessions",
            "  /session new [title] - Create a new session",
            "  /session resume [id|number] - Resume the last or specified session",
            "  /session title <text> - Set the current session title",
            "  /session fork [title] - Fork the current session",
            "  /session delete <id|number|all> - Delete a session or all sessions",
            "  /session pin [on|off|id|number] - Pin or unpin a session",
            "  /card <filename> [--tool [remove]] - Load an AgentCard (attach/remove as tool)",
            "  /agent <name> --tool [remove] - Attach/remove an agent as a tool",
            "  /agent [name] --dump - Print an AgentCard to screen",
            "  /reload        - Reload AgentCards",
            "  @agent_name    - Switch to agent",
            "  #agent_name <msg> - Send message to agent, return result to input buffer",
            "  STOP           - Return control back to the workflow",
            "  EXIT           - Exit fast-agent, terminating any running workflows",
            "",
            "[bold]Keyboard Shortcuts:[/bold]",
            "  Enter          - Accept completion menu selection (if open), otherwise submit/new line",
            "  Ctrl+Enter     - Always submit (in any mode)",
            "  Ctrl+Space     - Open completion menu",
            "  Tab / Shift+Tab - Next/previous completion item (when menu is open)",
            "  Ctrl+T         - Toggle multiline mode",
            "  Ctrl+E         - Edit in external editor",
            "  Ctrl+Y         - Copy last assistant response to clipboard",
            "  Ctrl+L         - Redraw the screen",
            "  Ctrl+U         - Clear input",
            "  Ctrl+C         - Cancel current operation (press twice quickly to exit)",
            "  Ctrl+D         - End prompt session (same as STOP)",
            "  Up/Down        - Navigate history",
        ]
    )
    return lines
