codenaut
v0.2.2
Published
AI-powered terminal coding assistant — chat with AI to write, edit, and understand code directly from your terminal
Maintainers
Readme
CodeNaut
AI-powered terminal coding assistant.
Chat with AI in your terminal. Read/write/edit files, run commands, search code — all through natural language.
Install
npm install -g codenautOr use without installing:
npx codenaut chatQuick Start
# Start a chat session
codenaut chat
# Start with TUI interface
codenaut chat --tui
# Use a specific model
codenaut chat -p custom --base-url https://api.deepseek.com/v1 --api-key YOUR_KEY -m deepseek-chat
# Use with a custom provider name
codenaut chat -p custom --provider-name "DeepSeek" --base-url https://api.deepseek.com/v1 --api-key YOUR_KEY -m deepseek-chat
# Resume a previous session
codenaut chat -s sess-abc123Configuration
Config file
Create ~/.codenaut/config.json:
{
"provider": {
"type": "custom",
"apiKey": "your-api-key",
"model": "glm-5.1",
"baseURL": "https://open.bigmodel.cn/api/coding/paas/v4",
"providerName": "My Provider",
"temperature": 0.7,
"maxTokens": 4096
}
}Environment variables
| Variable | Description | Example |
|----------|-------------|---------|
| CODENAUT_API_KEY | API key | sk-xxx |
| CODENAUT_PROVIDER_TYPE | Provider type (openai, anthropic, custom) | custom |
| CODENAUT_MODEL | Model name | gpt-4o |
| CODENAUT_BASE_URL | Custom API base URL | https://api.openai.com/v1 |
| CODENAUT_PROVIDER_NAME | Display name for custom provider | My Provider |
| CODENAUT_TEMPERATURE | Response randomness (0-2) | 0.7 |
| CODENAUT_MAX_TOKENS | Max response tokens | 4096 |
| CODENAUT_THEME | TUI theme (dark, light) | dark |
Config priority (latter overrides former)
- Built-in defaults
- Global config:
~/.codenaut/config.json - Project config:
.codenaut/config.json - Environment variables:
CODENAUT_* - CLI arguments:
--model,--provider, etc.
Commands
| Command | Description |
|---------|-------------|
| codenaut chat | Start interactive chat |
| codenaut chat --tui | Start with TUI interface |
| codenaut chat -m <model> | Use specific model |
| codenaut chat -p <provider> | Use specific provider |
| codenaut chat --base-url <url> | Use custom API endpoint |
| codenaut chat --provider-name <name> | Set custom provider display name |
| codenaut chat -s <session-id> | Resume a saved session |
| codenaut chat --temperature <n> | Set temperature |
| codenaut chat --max-tokens <n> | Set max tokens |
| codenaut chat -v | Enable verbose logging |
| codenaut config list | Show current config |
In-chat commands
| Command | Description |
|---------|-------------|
| /help | Show available commands |
| /clear | Clear chat history |
| /model | Show current model info |
| /sessions | List saved sessions |
| /resume <id> | Resume a saved session |
| /exit | Save and quit |
Sessions
Conversations are automatically saved to ~/.codenaut/sessions/. Each session gets a unique ID (e.g. sess-m5x7k2-abc123).
# Resume via CLI flag
codenaut chat -s sess-m5x7k2-abc123
# Or list and resume from within a chat
codenaut chat
> /sessions
> /resume sess-m5x7k2-abc123Provider Types
| Type | Description | Notes |
|------|-------------|-------|
| openai | OpenAI GPT models | Native SDK support |
| anthropic | Anthropic Claude models | Native SDK with tool support |
| custom | Any OpenAI-compatible API | DeepSeek, Qwen, Ollama, etc. |
For custom providers, use --base-url to point to the API endpoint and --provider-name to set a display name shown in the UI.
Built-in Tools
| Tool | Description | Needs approval |
|------|-------------|----------------|
| file_read | Read file contents | No |
| file_write | Create/overwrite files | Yes |
| file_edit | Edit files (string replace) | Yes |
| shell | Execute shell commands | Configurable (safe commands auto-approved) |
| glob | Search files by pattern | No |
| grep | Search file contents | No |
Tech Stack
- Node.js + TypeScript + ESM
- ink (React for CLI) — TUI mode
- Commander — CLI parsing
- OpenAI SDK / Anthropic SDK
- Zod — Config validation
- tsup — Bundling
Development
git clone https://github.com/your-repo/codenaut.git
cd codenaut
npm install
npm run build
npm link # makes `codenaut` available globally
npm test # run testsLicense
MIT
