{"_id":"@abdessamadwinu2024/procia-cli","name":"@abdessamadwinu2024/procia-cli","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@abdessamadwinu2024/procia-cli","version":"1.0.0","description":"A minimalist AI assistant CLI powered by PROCIA","main":"dist/index.js","bin":{"procia":"dist/index.js"},"type":"module","preferGlobal":true,"scripts":{"build":"tsc","dev":"tsx src/index.ts","start":"node dist/index.js","lint":"eslint . --ext .js,.jsx,.ts,.tsx","typecheck":"tsc --noEmit","postinstall":"node scripts/postinstall.js","prepublishOnly":"npm run build"},"keywords":["cli","ai","assistant","winu","tui"],"author":{"name":"Winu Team"},"license":"MIT","dependencies":{"axios":"^1.6.0","better-sqlite3":"^9.2.2","chalk":"^4.1.2","commander":"^11.1.0","dotenv":"^16.3.0","fs-extra":"^11.1.1","ink":"^3.2.0","inquirer":"^9.2.12","keytar":"^7.9.0","pg":"^8.16.3","react":"^17.0.2"},"devDependencies":{"@types/better-sqlite3":"^7.6.8","@types/fs-extra":"^11.0.2","@types/inquirer":"^9.0.9","@types/node":"^20.8.0","@types/pg":"^8.10.9","@types/react":"^17.0.0","@typescript-eslint/eslint-plugin":"^8.37.0","@typescript-eslint/parser":"^8.37.0","eslint":"^9.31.0","tsx":"^4.0.0","typescript":"^4.9.5"},"engines":{"node":">=16.0.0"},"_id":"@abdessamadwinu2024/procia-cli@1.0.0","gitHead":"14684c6fe680276c6332ca97d08fb404a46ca504","types":"./dist/index.d.ts","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-soiWLnrAQon9iDKPPxSJlrBal5F2ErFc7fkQVxQ4cGn7jOg3mOdnzcqQRVpIrblrPjNkjUrKb04vvVHFcsfENg==","shasum":"32eabe56baf9e00e16c6c1d6eaab44103d13447f","tarball":"https://registry.npmjs.org/@abdessamadwinu2024/procia-cli/-/procia-cli-1.0.0.tgz","fileCount":120,"unpackedSize":369486,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEAMb71sXVxwZajCFWXbG28NQ94ZWCXVNXDPu9U10aPjAiEAxb++u6zCl+RvnAn+smr4D15HR8LYJ4hGN9Nd3XDSg5g="}]},"_npmUser":{"name":"abdessamadwinu2024","email":"Abdessamad@winu.fr"},"directories":{},"maintainers":[{"name":"abdessamadwinu2024","email":"Abdessamad@winu.fr"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/procia-cli_1.0.0_1757550072327_0.01696155378453712"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-11T00:21:12.222Z","1.0.0":"2025-09-11T00:21:12.540Z","modified":"2025-09-11T00:21:12.905Z"},"maintainers":[{"name":"abdessamadwinu2024","email":"Abdessamad@winu.fr"}],"description":"A minimalist AI assistant CLI powered by PROCIA","keywords":["cli","ai","assistant","winu","tui"],"author":{"name":"Winu Team"},"license":"MIT","readme":"# PROCIA CLI\r\n\r\nA minimalist AI assistant CLI powered by PROCIA, featuring interactive chat, plan execution, and comprehensive tool integration.\r\n\r\n## 🚀 Quick Start\r\n\r\n### Global Installation\r\n\r\n```bash\r\nnpm install -g @procia/cli\r\n```\r\n\r\n### First-time Setup\r\n\r\nAfter installation, run the setup commands:\r\n\r\n```bash\r\n# Basic setup (uses pre-configured cloud database)\r\nprocia setup show\r\n\r\n# Optional: Custom database setup\r\nprocia setup database\r\n\r\n# Optional: Custom authentication setup  \r\nprocia setup auth\r\n\r\n# Optional: Custom server endpoints\r\nprocia setup server\r\n```\r\n\r\n### Start Using\r\n\r\n```bash\r\n# Start the interactive CLI\r\nprocia\r\n\r\n# Or use specific commands\r\nprocia --help\r\n```\r\n\r\n## 🎯 Features\r\n\r\n- **Interactive Chat Mode**: Natural language conversations with AI\r\n- **Command Mode**: Structured command execution\r\n- **Plan Execution**: Multi-step automated workflows\r\n- **Tool Integration**: Access to external tools and APIs\r\n- **Cloud Database**: Pre-configured PostgreSQL backend\r\n- **Secure Authentication**: JWT-based authentication system\r\n- 🎯 **Minimalist**: Simple, focused interface without complex configuration\r\n\r\n## Installation\r\n\r\n### From Source\r\n\r\n```bash\r\n# Clone the repository\r\ngit clone <repository-url>\r\ncd winu-cli/packages/winu-cli\r\n\r\n# Install dependencies\r\nnpm install\r\n\r\n# Build the project\r\nnpm run build\r\n\r\n# Link for global usage (optional)\r\nnpm link\r\n```\r\n\r\n\r\n## MCP servers backend \r\n```bash\r\nnpm run start:multi-tool:dev   # connect to port 3020 has multiple tools (ssh , bash , etc)\r\n\r\nnpm run start:workflows:dev   # assistant endpoint and workflow tools \r\n```\r\n\r\n## Kubernetes server \r\n```bash\r\nnpx kubernetes-mcp-server --port 3008\r\n```\r\n\r\n## GRAFANA \r\n```bash\r\ndocker run --rm -p 8020:8000 \\\r\n  -e GRAFANA_URL=https://grafana-xcloud.winu.fr/ \\\r\n  -e GRAFANA_API_KEY=glsa_f9oXmlnbrWu16nPvjcaPItVcQixecusF_f2d68ff1 \\\r\n  -e GRAFANA_DASHBOARD_UID=rYdddlPWk \\\r\n  -e GRAFANA_DATASOURCE_UID=rYdddlPWk \\\r\n  -e PROMETHEUS_DATASOURCE_UID=f5d84164-20f6-4b02-8e09-5c0c9d116b00 \\\r\n  mcp/grafana -t streamable-http\r\n```\r\n\r\n## GITLAB \r\n```bash\r\ndotenv -e .env -- npx -y @zereight/mcp-gitlab --port 3007\r\n```\r\n\r\n\r\n\r\n## Usage\r\n\r\n### Interactive Mode\r\n\r\nStart in Command Mode (default):\r\n\r\n```bash\r\nwinu\r\n```\r\n\r\nThe CLI starts in **Command Mode** where you can:\r\n- Execute installation plans with `/plan` commands\r\n- Get help with `/help`\r\n- Switch to Chat Mode with `/chat`\r\n\r\n### Interface Modes\r\n\r\n#### Command Mode (Default)\r\n- **Purpose**: Execute specific commands and plans\r\n- **Commands**:\r\n  - `/plan <plan_name>` - Execute plan in auto mode\r\n  - `/plan <plan_name> -mode interactive` - Execute with user confirmations\r\n  - `/plan <plan_name> -mode semi_assisted` - Execute with step confirmations\r\n  - `/plan <plan_name> -step_id <step>` - Execute specific step\r\n  - `/plan <plan_name> -step_id <step> -phase <phase>` - Execute specific phase\r\n  - `/chat` - Switch to Chat Mode\r\n  - `/help` - Show available commands\r\n\r\n#### Chat Mode\r\n- **Purpose**: Conversational AI interactions\r\n- **Features**: Ask questions, get coding help, workflow assistance\r\n- **Commands**:\r\n  - `/exit-chat` - Return to Command Mode\r\n  - `/help` - Show chat-specific help\r\n  - All plan execution commands also work in Chat Mode\r\n\r\n### Headless Mode\r\n\r\nProcess a single prompt and exit:\r\n\r\n```bash\r\nwinu -p \"What is the weather like today?\"\r\n```\r\n\r\n### Command Line Options\r\n\r\n```bash\r\nwinu [options]\r\n\r\nOptions:\r\n  -p, --prompt <prompt>    process a single prompt and exit (headless mode)\r\n  -h, --help               display help for command\r\n```\r\n\r\n## Architecture Overview\r\n\r\n### System Architecture\r\n\r\n```\r\n┌─────────────────────────────────────────────────────────────────┐\r\n│                        WINU CLI                                 │\r\n├─────────────────────────────────────────────────────────────────┤\r\n│  ┌─────────────┐    ┌──────────────┐    ┌─────────────────────┐ │\r\n│  │ index.ts    │────│ winu-agent   │────│ winu-client         │ │\r\n│  │ Commander   │    │ chat handeler│    │  Axios Backend      │ │\r\n│  │ Entry Point │    │ Plan Exec    │    │ Communication      │ │\r\n│  └─────────────┘    │ History Mgmt │    └─────────────────────┘ │\r\n│                     └──────────────┘                │\r\n│                            │                        │           │\r\n│  ┌─────────────────────────▼────────────────────────▼─────────┐ │\r\n│  │                  React + Ink UI                            │ │\r\n│  │                                                            │ │\r\n│  │  ┌─────────────────┐                ┌─────────────────────┐ │ │\r\n│  │  │ Command Mode    │                │ Chat Mode           │ │ │\r\n│  │  │                 │                │                     │ │ │\r\n│  │  │ ┌─────────────┐ │                │ ┌─────────────────┐ │ │ │\r\n│  │  │ │Plan Execute │ │                │ │AI Conversation  │ │ │ │\r\n│  │  │ │Components   │ │                │ │Interface        │ │ │ │\r\n│  │  │ └─────────────┘ │                │ └─────────────────┘ │ │ │\r\n│  │  └─────────────────┘                └─────────────────────┘ │ │\r\n│  └─────────────────────────────────────────────────────────────┘ │\r\n└─────────────────────────────────────────────────────────────────┘\r\n                                   │\r\n                                   ▼\r\n              ┌─────────────────────────────────────┐\r\n              │         WINU BACKEND                │\r\n              │                                     │\r\n              │  ┌─────────────────────────────────┐│\r\n              │  │ POST /winu-cli Endpoint         ││\r\n              │  │                                 ││\r\n              │  │ ┌─────────────┐ ┌─────────────┐ ││\r\n              │  │ │ MCP Server  │ │ AI Assistant│ ││\r\n              │  │ │ Integration │ │ Processing  │ ││\r\n              │  │ └─────────────┘ └─────────────┘ ││\r\n              │  └─────────────────────────────────┘│\r\n              └─────────────────────────────────────┘\r\n```\r\n### Plan Execution Architecture\r\n\r\n```\r\nUser Input: /plan install_kube -mode interactive -step_id os.bootstrap\r\n     │\r\n     ▼\r\n┌─────────────────────────────────────────────────────────────────┐\r\n│                   Command Parser                                │\r\n│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────────┐ │\r\n│  │ Parse Args  │─▶│ Validate    │─▶│ Extract Parameters      │ │\r\n│  │ • plan_name │  │ • mode      │  │ • plan: install_kube    │ │\r\n│  │ • mode      │  │ • step_id   │  │ • mode: interactive     │ │\r\n│  │ • step_id   │  │ • phase     │  │ • step_id: os.bootstrap │ │\r\n│  └─────────────┘  └─────────────┘  └─────────────────────────┘ │\r\n└─────────────────────────────────────────────────────────────────┘\r\n     │\r\n     ▼\r\n┌─────────────────────────────────────────────────────────────────┐\r\n│                     Agent Layer                                 │\r\n│  ┌─────────────────────────────────────────────────────────────┐ │\r\n│  │ executePlan() → Backend Call                                │ │\r\n│  │                                                             │ │\r\n│  │ Response: {status, response, tool_calls, reasoning}         │ │\r\n│  └─────────────────────────────────────────────────────────────┘ │\r\n└─────────────────────────────────────────────────────────────────┘\r\n     │\r\n     ▼\r\n┌────────────────────────────────────────────────────────────────┐\r\n│                 Plan Execution UI                              │\r\n│                                                                │\r\n│  Mode: Interactive                                             │\r\n│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐ │\r\n│  │ 1. Confirmation │─▶│ 2. Live Results │─▶│ 3. Step Summary│ │\r\n│  │                 │  │                 │  │                 │ │\r\n│  │ Show step info  │  │ Phase execution │  │ Success/failure │ │\r\n│  │ [Continue]/[Abort] │  │ Real-time logs  │  │ Next step ready│ \r\n│  └─────────────────┘  └─────────────────┘  └─────────────────┘ │\r\n└────────────────────────────────────────────────────────────────┘\r\n```\r\n\r\n\r\n## Configuration\r\n\r\nThe CLI is pre-configured to connect to `http://localhost:3006` - no additional configuration needed.\r\n\r\n## Backend Integration\r\n\r\nThis CLI connects to the Winu backend's AI assistant endpoint:\r\n- **Endpoint**: `POST /winu-cli`\r\n- **Default URL**: `http://localhost:3006`\r\n- **Response Format**: The backend returns structured responses with `{status, response, tool_calls, reasoning}`\r\n- **MCP Integration**: Backend integrates with Model Context Protocol (MCP) servers for enhanced capabilities\r\n\r\nMake sure your Winu backend server is running before using the CLI.\r\n\r\n## Keyboard Shortcuts\r\n\r\n### Command Mode & Chat Mode\r\n- **Enter**: Send command/message\r\n- **Ctrl+C**: Exit application\r\n- **↑/↓**: Navigate command history\r\n- **←/→**: Move cursor within input\r\n- **Backspace**: Delete character\r\n\r\n### Plan Execution\r\n- **Enter**: Confirm plan execution steps\r\n- **←/→**: Select options (Continue/Abort) during confirmations\r\n- **Space**: Continue through phase results and step summaries\r\n\r\n## Development\r\n\r\n### Scripts\r\n\r\n- `npm run dev` - Run in development mode with tsx\r\n- `npm run build` - Build TypeScript to JavaScript\r\n- `npm run start` - Run the built application\r\n- `npm run lint` - Run ESLint\r\n- `npm run typecheck` - Run TypeScript type checking\r\n\r\n### Project Structure\r\n\r\n```\r\nsrc/\r\n├── index.ts                     # Main CLI entry point with Commander.js\r\n├── client/                      # HTTP client for backend communication\r\n│   └── winu-client.ts          # Axios-based HTTP client for Winu backend\r\n├── agent/                       # Agent wrapper layer\r\n│   └── winu-agent.ts           # Agent with plan execution and history management\r\n├── ui/                          # React + Ink TUI components\r\n│   ├── app.tsx                 # Main app entry point\r\n│   └── components/             # UI components\r\n│       ├── interface-router.tsx      # Routes between Command and Chat modes\r\n│       ├── command-interface.tsx     # Command mode interface with plan execution\r\n│       ├── chat-interface.tsx        # Chat mode interface\r\n│       ├── plan-execution/           # Plan execution UI components\r\n│       │   ├── confirmation-prompt.tsx    # Pre-execution confirmations\r\n│       │   ├── execution-results.tsx      # Phase result displays\r\n│       │   └── step-summary.tsx           # Step completion summaries\r\n│       └── loading-spinner.js        # Loading states\r\n├── hooks/                       # Custom React hooks\r\n│   ├── use-input-handler.ts    # Input handling with mode support\r\n│   ├── use-plan-execution.ts   # Plan execution state management\r\n│   └── use-input-history.ts    # Command history navigation\r\n└── utils/                       # Utility functions\r\n    └── command-parser.ts       # Parse /plan commands and help system\r\n```\r\n\r\n### Technical Implementation\r\n\r\n- **Dual Interface Architecture**: Separate Command and Chat modes with interface routing\r\n- **Plan Execution System**: Interactive, semi-assisted, and auto execution modes with real-time confirmations\r\n- **React + Ink**: Terminal UI framework with optimized memoization to prevent re-renders\r\n- **State Management**: Dedicated hooks for plan execution state and command history \r\n\r\n## Examples\r\n\r\n### Command Mode (Default)\r\n```bash\r\n$ winu\r\n🖥️  Command Mode\r\nType /help for commands, /chat to enter chat mode\r\n\r\nwinu> /plan install_min4 -step_id os.bootstrap -phase prechecks\r\n🚀 Plan Execution: install_docker\r\n📋 Step: system.setup\r\n🎯 Target: localhost\r\n\r\nPhase: prechecks\r\n✅ Docker not installed - OK to proceed\r\n✅ System requirements met\r\n✅ Network connectivity verified\r\n\r\nAction: [Continue] [Abort]\r\n```\r\n\r\n### Chat Mode\r\n```bash\r\n$ winu\r\n🖥️  Command Mode\r\n\r\nwinu> /chat\r\n💬 Chat Mode\r\n\r\nTips for getting started:\r\n1. Ask questions about anything\r\n2. Request help with coding tasks  \r\n3. Get workflow assistance\r\n4. /exit-chat to return to command mode\r\n\r\n❯ How do I troubleshoot Docker installation issues?\r\n```\r\n\r\n### Plan Execution Modes\r\n```bash\r\n# Auto mode - no confirmations\r\nwinu> /plan install_docker\r\n\r\n# Interactive mode - confirm each phase\r\nwinu> /plan install_docker -mode interactive\r\n\r\n# Semi-assisted mode - confirm each step\r\nwinu> /plan install_docker -mode semi_assisted\r\n\r\n# Execute specific step\r\nwinu> /plan install_docker -step_id system.setup\r\n\r\n# Execute specific phase\r\nwinu> /plan install_docker -step_id system.setup -phase prechecks\r\n```\r\n\r\n\r\n\r\n","readmeFilename":"README.md","_rev":"1-fad5cdbe6fd9d05388f6e2b5a8938554"}