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/cliFirst-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 serverStart 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 linkMCP 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 3008GRAFANA
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-httpGITLAB
dotenv -e .env -- npx -y @zereight/mcp-gitlab --port 3007Usage
Interactive Mode
Start in Command Mode (default):
winuThe CLI starts in Command Mode where you can:
- Execute installation plans with
/plancommands - 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 commandArchitecture 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 tsxnpm run build- Build TypeScript to JavaScriptnpm run start- Run the built applicationnpm run lint- Run ESLintnpm 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 systemTechnical 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