JSPM

@abdessamadwinu2024/procia-cli

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 2
    • Score
      100M100P100Q34588F
    • License MIT

    A minimalist AI assistant CLI powered by PROCIA

    Package Exports

      This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@abdessamadwinu2024/procia-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

      Readme

      PROCIA CLI

      A minimalist AI assistant CLI powered by PROCIA, featuring interactive chat, plan execution, and comprehensive tool integration.

      πŸš€ Quick Start

      Global Installation

      npm install -g @procia/cli

      First-time Setup

      After installation, run the setup commands:

      # Basic setup (uses pre-configured cloud database)
      procia setup show
      
      # Optional: Custom database setup
      procia setup database
      
      # Optional: Custom authentication setup  
      procia setup auth
      
      # Optional: Custom server endpoints
      procia setup server

      Start Using

      # Start the interactive CLI
      procia
      
      # Or use specific commands
      procia --help

      🎯 Features

      • Interactive Chat Mode: Natural language conversations with AI
      • Command Mode: Structured command execution
      • Plan Execution: Multi-step automated workflows
      • Tool Integration: Access to external tools and APIs
      • Cloud Database: Pre-configured PostgreSQL backend
      • Secure Authentication: JWT-based authentication system
      • 🎯 Minimalist: Simple, focused interface without complex configuration

      Installation

      From Source

      # Clone the repository
      git clone <repository-url>
      cd winu-cli/packages/winu-cli
      
      # Install dependencies
      npm install
      
      # Build the project
      npm run build
      
      # Link for global usage (optional)
      npm link

      MCP servers backend

      npm run start:multi-tool:dev   # connect to port 3020 has multiple tools (ssh , bash , etc)
      
      npm run start:workflows:dev   # assistant endpoint and workflow tools 

      Kubernetes server

      npx kubernetes-mcp-server --port 3008

      GRAFANA

      docker run --rm -p 8020:8000 \
        -e GRAFANA_URL=https://grafana-xcloud.winu.fr/ \
        -e GRAFANA_API_KEY=glsa_f9oXmlnbrWu16nPvjcaPItVcQixecusF_f2d68ff1 \
        -e GRAFANA_DASHBOARD_UID=rYdddlPWk \
        -e GRAFANA_DATASOURCE_UID=rYdddlPWk \
        -e PROMETHEUS_DATASOURCE_UID=f5d84164-20f6-4b02-8e09-5c0c9d116b00 \
        mcp/grafana -t streamable-http

      GITLAB

      dotenv -e .env -- npx -y @zereight/mcp-gitlab --port 3007

      Usage

      Interactive Mode

      Start in Command Mode (default):

      winu

      The CLI starts in Command Mode where you can:

      • Execute installation plans with /plan commands
      • Get help with /help
      • Switch to Chat Mode with /chat

      Interface Modes

      Command Mode (Default)

      • Purpose: Execute specific commands and plans
      • Commands:
        • /plan <plan_name> - Execute plan in auto mode
        • /plan <plan_name> -mode interactive - Execute with user confirmations
        • /plan <plan_name> -mode semi_assisted - Execute with step confirmations
        • /plan <plan_name> -step_id <step> - Execute specific step
        • /plan <plan_name> -step_id <step> -phase <phase> - Execute specific phase
        • /chat - Switch to Chat Mode
        • /help - Show available commands

      Chat Mode

      • Purpose: Conversational AI interactions
      • Features: Ask questions, get coding help, workflow assistance
      • Commands:
        • /exit-chat - Return to Command Mode
        • /help - Show chat-specific help
        • All plan execution commands also work in Chat Mode

      Headless Mode

      Process a single prompt and exit:

      winu -p "What is the weather like today?"

      Command Line Options

      winu [options]
      
      Options:
        -p, --prompt <prompt>    process a single prompt and exit (headless mode)
        -h, --help               display help for command

      Architecture Overview

      System Architecture

      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚                        WINU CLI                                 β”‚
      β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
      β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
      β”‚  β”‚ index.ts    │────│ winu-agent   │────│ winu-client         β”‚ β”‚
      β”‚  β”‚ Commander   β”‚    β”‚ chat handelerβ”‚    β”‚  Axios Backend      β”‚ β”‚
      β”‚  β”‚ Entry Point β”‚    β”‚ Plan Exec    β”‚    β”‚ Communication      β”‚ β”‚
      β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚ History Mgmt β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
      β”‚                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚
      β”‚                            β”‚                        β”‚           β”‚
      β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
      β”‚  β”‚                  React + Ink UI                            β”‚ β”‚
      β”‚  β”‚                                                            β”‚ β”‚
      β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
      β”‚  β”‚  β”‚ Command Mode    β”‚                β”‚ Chat Mode           β”‚ β”‚ β”‚
      β”‚  β”‚  β”‚                 β”‚                β”‚                     β”‚ β”‚ β”‚
      β”‚  β”‚  β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚                β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚
      β”‚  β”‚  β”‚ β”‚Plan Execute β”‚ β”‚                β”‚ β”‚AI Conversation  β”‚ β”‚ β”‚ β”‚
      β”‚  β”‚  β”‚ β”‚Components   β”‚ β”‚                β”‚ β”‚Interface        β”‚ β”‚ β”‚ β”‚
      β”‚  β”‚  β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚                β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚
      β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
      β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                         β”‚
                                         β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚         WINU BACKEND                β”‚
                    β”‚                                     β”‚
                    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚
                    β”‚  β”‚ POST /winu-cli Endpoint         β”‚β”‚
                    β”‚  β”‚                                 β”‚β”‚
                    β”‚  β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚β”‚
                    β”‚  β”‚ β”‚ MCP Server  β”‚ β”‚ AI Assistantβ”‚ β”‚β”‚
                    β”‚  β”‚ β”‚ Integration β”‚ β”‚ Processing  β”‚ β”‚β”‚
                    β”‚  β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚β”‚
                    β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

      Plan Execution Architecture

      User Input: /plan install_kube -mode interactive -step_id os.bootstrap
           β”‚
           β–Ό
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚                   Command Parser                                β”‚
      β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
      β”‚  β”‚ Parse Args  │─▢│ Validate    │─▢│ Extract Parameters      β”‚ β”‚
      β”‚  β”‚ β€’ plan_name β”‚  β”‚ β€’ mode      β”‚  β”‚ β€’ plan: install_kube    β”‚ β”‚
      β”‚  β”‚ β€’ mode      β”‚  β”‚ β€’ step_id   β”‚  β”‚ β€’ mode: interactive     β”‚ β”‚
      β”‚  β”‚ β€’ step_id   β”‚  β”‚ β€’ phase     β”‚  β”‚ β€’ step_id: os.bootstrap β”‚ β”‚
      β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β–Ό
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚                     Agent Layer                                 β”‚
      β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
      β”‚  β”‚ executePlan() β†’ Backend Call                                β”‚ β”‚
      β”‚  β”‚                                                             β”‚ β”‚
      β”‚  β”‚ Response: {status, response, tool_calls, reasoning}         β”‚ β”‚
      β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β–Ό
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚                 Plan Execution UI                              β”‚
      β”‚                                                                β”‚
      β”‚  Mode: Interactive                                             β”‚
      β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
      β”‚  β”‚ 1. Confirmation │─▢│ 2. Live Results │─▢│ 3. Step Summaryβ”‚ β”‚
      β”‚  β”‚                 β”‚  β”‚                 β”‚  β”‚                 β”‚ β”‚
      β”‚  β”‚ Show step info  β”‚  β”‚ Phase execution β”‚  β”‚ Success/failure β”‚ β”‚
      β”‚  β”‚ [Continue]/[Abort] β”‚  β”‚ Real-time logs  β”‚  β”‚ Next step readyβ”‚ 
      β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

      Configuration

      The CLI is pre-configured to connect to http://localhost:3006 - no additional configuration needed.

      Backend Integration

      This CLI connects to the Winu backend's AI assistant endpoint:

      • Endpoint: POST /winu-cli
      • Default URL: http://localhost:3006
      • Response Format: The backend returns structured responses with {status, response, tool_calls, reasoning}
      • MCP Integration: Backend integrates with Model Context Protocol (MCP) servers for enhanced capabilities

      Make sure your Winu backend server is running before using the CLI.

      Keyboard Shortcuts

      Command Mode & Chat Mode

      • Enter: Send command/message
      • Ctrl+C: Exit application
      • ↑/↓: Navigate command history
      • ←/β†’: Move cursor within input
      • Backspace: Delete character

      Plan Execution

      • Enter: Confirm plan execution steps
      • ←/β†’: Select options (Continue/Abort) during confirmations
      • Space: Continue through phase results and step summaries

      Development

      Scripts

      • npm run dev - Run in development mode with tsx
      • npm run build - Build TypeScript to JavaScript
      • npm run start - Run the built application
      • npm run lint - Run ESLint
      • npm run typecheck - Run TypeScript type checking

      Project Structure

      src/
      β”œβ”€β”€ index.ts                     # Main CLI entry point with Commander.js
      β”œβ”€β”€ client/                      # HTTP client for backend communication
      β”‚   └── winu-client.ts          # Axios-based HTTP client for Winu backend
      β”œβ”€β”€ agent/                       # Agent wrapper layer
      β”‚   └── winu-agent.ts           # Agent with plan execution and history management
      β”œβ”€β”€ ui/                          # React + Ink TUI components
      β”‚   β”œβ”€β”€ app.tsx                 # Main app entry point
      β”‚   └── components/             # UI components
      β”‚       β”œβ”€β”€ interface-router.tsx      # Routes between Command and Chat modes
      β”‚       β”œβ”€β”€ command-interface.tsx     # Command mode interface with plan execution
      β”‚       β”œβ”€β”€ chat-interface.tsx        # Chat mode interface
      β”‚       β”œβ”€β”€ plan-execution/           # Plan execution UI components
      β”‚       β”‚   β”œβ”€β”€ confirmation-prompt.tsx    # Pre-execution confirmations
      β”‚       β”‚   β”œβ”€β”€ execution-results.tsx      # Phase result displays
      β”‚       β”‚   └── step-summary.tsx           # Step completion summaries
      β”‚       └── loading-spinner.js        # Loading states
      β”œβ”€β”€ hooks/                       # Custom React hooks
      β”‚   β”œβ”€β”€ use-input-handler.ts    # Input handling with mode support
      β”‚   β”œβ”€β”€ use-plan-execution.ts   # Plan execution state management
      β”‚   └── use-input-history.ts    # Command history navigation
      └── utils/                       # Utility functions
          └── command-parser.ts       # Parse /plan commands and help system

      Technical Implementation

      • Dual Interface Architecture: Separate Command and Chat modes with interface routing
      • Plan Execution System: Interactive, semi-assisted, and auto execution modes with real-time confirmations
      • React + Ink: Terminal UI framework with optimized memoization to prevent re-renders
      • State Management: Dedicated hooks for plan execution state and command history

      Examples

      Command Mode (Default)

      $ winu
      πŸ–₯️  Command Mode
      Type /help for commands, /chat to enter chat mode
      
      winu> /plan install_min4 -step_id os.bootstrap -phase prechecks
      πŸš€ Plan Execution: install_docker
      πŸ“‹ Step: system.setup
      🎯 Target: localhost
      
      Phase: prechecks
      βœ… Docker not installed - OK to proceed
      βœ… System requirements met
      βœ… Network connectivity verified
      
      Action: [Continue] [Abort]

      Chat Mode

      $ winu
      πŸ–₯️  Command Mode
      
      winu> /chat
      πŸ’¬ Chat Mode
      
      Tips for getting started:
      1. Ask questions about anything
      2. Request help with coding tasks  
      3. Get workflow assistance
      4. /exit-chat to return to command mode
      
      ❯ How do I troubleshoot Docker installation issues?

      Plan Execution Modes

      # Auto mode - no confirmations
      winu> /plan install_docker
      
      # Interactive mode - confirm each phase
      winu> /plan install_docker -mode interactive
      
      # Semi-assisted mode - confirm each step
      winu> /plan install_docker -mode semi_assisted
      
      # Execute specific step
      winu> /plan install_docker -step_id system.setup
      
      # Execute specific phase
      winu> /plan install_docker -step_id system.setup -phase prechecks