#compdef pieces
# Zsh completion for pieces
# Generated automatically - using Pieces CLI
# Version: 1.16.1

_pieces() {
    local line state

    _arguments -C \
        "1: :->cmds" \
        "*::arg:->args" \
        '--help -h[Show help message]' \
        '--version -v[Show version]' \
        '--ignore-onboarding[Ignore onboarding for this command]'

    case "$state" in
        cmds)
            _values "commands" \
                "ask[Ask a question to the Copilot]" \
                "chat[Select a chat]" \
                "chats[Print all chats]" \
                "commit[Auto-generate a GitHub commit message and commit changes]" \
                "completion[Display shell completion scripts]" \
                "config[Configure settings]" \
                "contribute[How to contribute]" \
                "create[Create a new material]" \
                "delete[Delete the current material]" \
                "edit[Edit an existing material'\''s metadata]" \
                "execute[Execute shell or bash materials]" \
                "feedback[Submit feedback]" \
                "install[Install PiecesOS]" \
                "list[List materials or apps or models]" \
                "login[Sign into PiecesOS]" \
                "logout[Sign out from PiecesOS]" \
                "mcp[setup the MCP server for an integration]" \
                "modify[Updates the current material content]" \
                "onboarding[Start the onboarding process]" \
                "open[Opens PiecesOS or Applet]" \
                "run[Runs CLI in a loop]" \
                "search[Perform a search for materials using the specified query string]" \
                "share[Share the current material]" \
                "version[Gets version of PiecesOS]" \
                "conversation[Alias for chat: Select a chat]" \
                "conversations[Alias for chats: Print all chats]" \
                "drive[Alias for list: List materials or apps or models]" \
                "save[Alias for modify: Updates the current material content]"
            ;;
        args)
            case $line[1] in
                config)
                    _pieces_config
                    ;;
                list)
                    _pieces_list
                    ;;
                login)
                    _pieces_login
                    ;;
                logout)
                    _pieces_logout
                    ;;
                search)
                    _pieces_search
                    ;;
                modify)
                    _pieces_modify
                    ;;
                delete)
                    _pieces_delete
                    ;;
                create)
                    _pieces_create
                    ;;
                share)
                    _pieces_share
                    ;;
                edit)
                    _pieces_edit
                    ;;
                run)
                    _pieces_run
                    ;;
                execute)
                    _pieces_execute
                    ;;
                feedback)
                    _pieces_feedback
                    ;;
                contribute)
                    _pieces_contribute
                    ;;
                install)
                    _pieces_install
                    ;;
                onboarding)
                    _pieces_onboarding
                    ;;
                version)
                    _pieces_version
                    ;;
                ask)
                    _pieces_ask
                    ;;
                chats)
                    _pieces_chats
                    ;;
                chat)
                    _pieces_chat
                    ;;
                commit)
                    _pieces_commit
                    ;;
                open)
                    _pieces_open
                    ;;
                mcp)
                    _pieces_mcp
                    ;;
                completion)
                    _pieces_completion
                    ;;
            esac
            ;;
    esac
}

_pieces_config() {
    # Completion for 'config' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]' \
        '(-e --editor)'{-e,--editor}'[Set the default code editor]'
}

_pieces_list() {
    # Completion for 'list' command
    _arguments \
        '1::type:(materials apps models)' \
        '(-h --help)'{-h,--help}'[show this help message and exit]' \
        '(-e --editor)'{-e,--editor}'[Open the chosen material in the editor]'
}

_pieces_login() {
    # Completion for 'login' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_logout() {
    # Completion for 'logout' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_search() {
    # Completion for 'search' command
    _arguments \
        '1:query:' \
        '(-h --help)'{-h,--help}'[show this help message and exit]' \
        '(--mode --mode)'{--mode,--mode}'[Type of search]:choice:(fuzzy ncs fts)'
}

_pieces_modify() {
    # Completion for 'modify' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_delete() {
    # Completion for 'delete' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_create() {
    # Completion for 'create' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]' \
        '(-c --content)'{-c,--content}'[Enter snippet content manually in the terminal or via stdin]'
}

_pieces_share() {
    # Completion for 'share' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_edit() {
    # Completion for 'edit' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]' \
        '(-n --name)'{-n,--name}'[Set a new name for the material]' \
        '(-c --classification)'{-c,--classification}'[Reclassify a material (eg. py, js)]'
}

_pieces_run() {
    # Completion for 'run' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_execute() {
    # Completion for 'execute' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_feedback() {
    # Completion for 'feedback' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_contribute() {
    # Completion for 'contribute' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_install() {
    # Completion for 'install' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_onboarding() {
    # Completion for 'onboarding' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_version() {
    # Completion for 'version' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_ask() {
    # Completion for 'ask' command
    _arguments \
        '1:query:' \
        '(-h --help)'{-h,--help}'[show this help message and exit]' \
        '(-f --files)*'{-f,--files}'[Provide one or more files or folders as context (absolute or relative path)]:file:_files' \
        '(-m --materials)'{-m,--materials}'[Use one or more saved materials as context (provide material'\''s index).]:number:' \
        '(--ltm --ltm)'{--ltm,--ltm}'[Enable Long-Term Memory (LTM) to include prior context]'
}

_pieces_chats() {
    # Completion for 'chats' command
    _arguments \
        '1:max_chats:' \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_chat() {
    # Completion for 'chat' command
    _arguments \
        '1:CONVERSATION_INDEX:' \
        '(-h --help)'{-h,--help}'[show this help message and exit]' \
        '(-n --new)'{-n,--new}'[Create a new chat]' \
        '(-r --rename)'{-r,--rename}'[Rename the conversation that you are currently. If nothing is specified it will rename the current chat using the llm model]' \
        '(-d --delete)'{-d,--delete}'[Delete the chat that you are currently using in the ask command]'
}

_pieces_commit() {
    # Completion for 'commit' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]' \
        '(-p --push)'{-p,--push}'[Push the code to GitHub]' \
        '(-a --all)'{-a,--all}'[Stage all the files before committing]' \
        '(-i --issues)'{-i,--issues}'[Add issue number in the commit message]'
}

_pieces_open() {
    # Completion for 'open' command
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]' \
        '(-p --pieces_os)'{-p,--pieces_os}'[Opens PiecesOS]' \
        '(-c --copilot)'{-c,--copilot}'[Opens Pieces Copilot]' \
        '(-d --drive)'{-d,--drive}'[Opens Pieces Drive]' \
        '(-s --settings)'{-s,--settings}'[Opens Pieces Settings]'
}

_pieces_mcp() {
    local line state
    
    _arguments -C \
        "1: :->subcmds" \
        "*::arg:->args"
    
    case "$state" in
        subcmds)
            _values "subcommands" \
                "docs[Print the documentations for an integration]" \
                "list[List all MCP integrations]" \
                "repair[Repair an MCP config settings]" \
                "setup[Set up an integration]" \
                "start[Start the stdio MCP server]" \
                "status[Show the Status of the LTM and the MCPs]"
            ;;
        args)
            case $line[1] in
                setup)
                    _pieces_mcp_setup
                    ;;
                list)
                    _pieces_mcp_list
                    ;;
                docs)
                    _pieces_mcp_docs
                    ;;
                start)
                    _pieces_mcp_start
                    ;;
                repair)
                    _pieces_mcp_repair
                    ;;
                status)
                    _pieces_mcp_status
                    ;;
            esac
            ;;
    esac
}

_pieces_mcp_setup() {
    # Completion for 'mcp setup' subcommand
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]' \
        '(--vscode --vscode)'{--vscode,--vscode}'[Set up the MCP for VS Code]' \
        '(--goose --goose)'{--goose,--goose}'[Set up the MCP for Goose]' \
        '(--cursor --cursor)'{--cursor,--cursor}'[Set up the MCP for Cursor]' \
        '(--claude --claude)'{--claude,--claude}'[Set up the MCP for Claude Desktop]' \
        '(--windsurf --windsurf)'{--windsurf,--windsurf}'[Set up the MCP for Windsurf]' \
        '(--zed --zed)'{--zed,--zed}'[Set up the MCP for Zed]' \
        '(--shortwave --shortwave)'{--shortwave,--shortwave}'[Set up the MCP for Shortwave]' \
        '(--claude_code --claude_code)'{--claude_code,--claude_code}'[Set up the MCP for Claude Code]' \
        '(--raycast --raycast)'{--raycast,--raycast}'[Set up the MCP for Raycast]' \
        '(--wrap --wrap)'{--wrap,--wrap}'[Set up the MCP for Wrap]' \
        '(--globally --globally)'{--globally,--globally}'[For VS Code or Cursor to set the Global MCP]' \
        '(--specific-workspace --specific-workspace)'{--specific-workspace,--specific-workspace}'[For VS Code or Cursor to set the Local MCP]' \
        '(--stdio --stdio)'{--stdio,--stdio}'[Use the stdio MCP instead of sse]'
}

_pieces_mcp_list() {
    # Completion for 'mcp list' subcommand
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]' \
        '(--already-registered --already-registered)'{--already-registered,--already-registered}'[Display the list of the registered MCPs]' \
        '(--available-for-setup --available-for-setup)'{--available-for-setup,--available-for-setup}'[Display the list of the ready to be registered MCPs]'
}

_pieces_mcp_docs() {
    # Completion for 'mcp docs' subcommand
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]' \
        '(-i --integration)'{-i,--integration}'[The integration to print its documentation]:choice:(vscode goose cursor claude windsurf zed shortwave claude_code all current raycast wrap)' \
        '(-o --open)'{-o,--open}'[Open the queried docs in the browser]'
}

_pieces_mcp_start() {
    # Completion for 'mcp start' subcommand
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_mcp_repair() {
    # Completion for 'mcp repair' subcommand
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]' \
        '(-i --integration)'{-i,--integration}'[The integration to repair]:choice:(vscode goose cursor claude windsurf zed shortwave claude_code all)'
}

_pieces_mcp_status() {
    # Completion for 'mcp status' subcommand
    _arguments \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

_pieces_completion() {
    # Completion for 'completion' command
    _arguments \
        '1::shell:(bash zsh fish powershell)' \
        '(-h --help)'{-h,--help}'[show this help message and exit]'
}

# Register the completion
compdef _pieces pieces
