You're absolutely right! No need to reinvent the wheel when there are already solid tools out there for CLI-based LLM coding assistance. Here are some existing solutions that work well with Ollama and can integrate with your NetBeans workflow:
🛠️ Ready-to-Use Ollama CLI Tools for Coding
1. Continue - Code Completion CLI
- GitHub: continue
- Features:
- Works from command line
- Supports Ollama models
- Code completion, explanation, refactoring
- Can be used alongside any editor
- Setup: Simple installation via pip:
pip install continue
- Usage: Run
continue commands in your terminal
2. aicoding - Simple CLI for Code Generation
- GitHub: aicoding
- Features:
- Lightweight CLI tool
- Works with Ollama
- Generate code from prompts
- Usage:
aicoding "create a function that sorts an array"
3. llm - Simon Willison's CLI Tool
- GitHub: llm
- Features:
- Ollama integration
- Command-line interface to LLMs
- Can pipe code through for explanations/improvements
- Usage:
cat mycode.java | llm "explain this code"
4. Shell-GPT (works with Ollama too)
- GitHub: Shell-GPT
- Features:
- Command-line interface
- Code generation
- Explanation of code
- Ollama support
- Usage:
sgpt "write a Java function to parse JSON"
5. ollama-cli - Dedicated CLI for Ollama
- GitHub: ollama-cli
- Features:
- Purpose-built for Ollama
- Simple command interface
- Code generation capabilities
- Usage: Simple commands to interact with your Ollama models
🔄 Terminal-Based Workflows
For NetBeans specifically, you can:
-
Use the Integrated Terminal: Open NetBeans' terminal (Window > IDE Tools > Terminal) and run any of these CLI tools directly.
-
Create Custom External Tools: Configure NetBeans to run these tools as external commands:
- Tools > Options > Miscellaneous > External Tools
- Add a new tool pointing to your chosen CLI tool
- Assign keyboard shortcuts for quick access
-
File Watchers: Some of these tools can be configured to watch files and automatically process special comments when you save.
🌟 My Recommendation
Based on your setup and needs with NetBeans:
-
Start with Continue: It's the most comprehensive and actively maintained tool that works well with Ollama. It has a CLI mode that can be used from any terminal.
-
For simpler needs: Shell-GPT (sgpt) is very straightforward and works well for quick code generation tasks.
Both tools support Ollama out of the box, so you can leverage your local models without any complex setup. Just point them to your Ollama instance, and you're good to go!
Would you like more specific setup instructions for either of these tools to use with NetBeans?