UNPKG

flashy-cli

Version:

Fast AI-powered code completion using OpenAI API - No API key setup required!

141 lines (102 loc) 3.46 kB
# Flash ⚡ Fast AI-powered code completion and chat using Cerebras API - No API key setup required! ## Installation ```bash npm install flash-tool-oss ``` ## Quick Start ### Command Line Usage ```bash # Interactive mode npx flash-tool-oss interactive # Complete code npx flash-tool-oss complete "def fibonacci" # Chat with AI npx flash-tool-oss chat "How do I create a React component?" # Complete code in specific language npx flash-tool-oss complete "function sortArray" --language javascript ``` ### Programmatic Usage ```javascript const Flash = require('flash-tool-oss'); const flash = new Flash(); // Complete code const completion = await flash.complete('def fibonacci', 'python'); console.log(completion); // Chat with AI const response = await flash.chat('How do I create a React component?'); console.log(response); // Process "using oss" commands (for Cursor integration) const result = await flash.processUsingOss('using oss explain async/await'); console.log(result); ``` ## Features - ⚡ **Fast AI completions** using Cerebras gpt-oss-120b model - 💬 **Interactive chat** with AI programming assistant - 🔧 **Multi-language support** (Python, JavaScript, TypeScript, etc.) - 🚀 **Zero configuration** - works immediately after installation - 📦 **Easy installation** via npm - 🎯 **Cursor integration** with "using oss" commands via MCP - 🤖 **Automatic code application** - Cursor applies suggestions directly ## Configuration The tool uses these default settings: - Model: `gpt-oss-120b` - Max tokens: 1024 (completion), 2048 (chat) - Temperature: 0.3 (completion), 0.7 (chat) - Top-p: 0.9 - Reasoning effort: medium ## Cursor Integration ### MCP Server Setup To integrate with Cursor chat using MCP (Model Context Protocol): 1. **Install the package:** ```bash npm install flash-tool-oss ``` 2. **Create MCP configuration** (see `CURSOR_SETUP.md` for detailed instructions): ```json { "mcpServers": { "flash-tool-oss": { "command": "node", "args": ["node_modules/flash-tool-oss/src/mcp-server.js"], "env": {} } } } ``` 3. **Use in Cursor chat:** ``` using oss create a React component that displays a todo list ``` ### Programmatic Usage You can also use the `processUsingOss` method programmatically: ```javascript const Flash = require('flash-tool-oss'); const flash = new Flash(); // This will detect "using oss" commands and respond appropriately const response = await flash.processUsingOss('using oss how do I debug this React error?'); ``` ## Troubleshooting - Ensure Python is installed and accessible via `python` command - Install Python dependencies: `pip install cerebras-cloud-sdk` - Check your internet connection - The tool uses a pre-configured API key - no setup required ## Examples ### Code Completion Examples ```bash # Python npx flash-tool-oss complete "def quick_sort" # JavaScript npx flash-tool-oss complete "function debounce" --language javascript # React npx flash-tool-oss complete "const MyComponent = () => {" --language javascript ``` ### Chat Examples ```bash # Programming questions npx flash-tool-oss chat "What's the difference between let, const, and var in JavaScript?" # Code review npx flash-tool-oss chat "Review this code: function add(a, b) { return a + b; }" # Debugging help npx flash-tool-oss chat "I'm getting a TypeError in my React app, how do I debug it?" ```