Skip to main content

AI-powered analysis and refactoring in natural language.

Project description

OneCode

Talk to your code. Let AI understand, refactor, and improve it.

Have a codebase that needs analysis? Want to refactor without getting lost in the details? OneCode is your AI assistant for code.

Point OneCode at any project folder, and ask it anything:

  • 🤔 "What does this authentication flow do?"
  • ✏️ "Add input validation to the login function"
  • 🔍 "Where is the database connection code?"
  • 🧪 "Write a test for this function and run it"
  • 📁 "Move all test files to a tests/ directory"

No complex commands. No context switching. Just natural conversation.


Why OneCode?

Problem Solution
Understanding unfamiliar codebases Semantic search + AI analysis
Time-consuming refactoring AI-powered code modification
Manual testing & debugging Automated test generation & self-correction
Context switching between tools Single natural language interface
Code maintenance at scale Intelligent file operations & git integration

Installation

From PyPI:

pip install onecode-cli

Setup

1. Configure environment

Provide API keys using one of two methods:

Method A: Create .env file Add API keys to .env in your project or home directory. OPENAI_API_KEY is always required (used for embeddings):

OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...   # only needed for Claude models

Method B: Export environment variables

export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...   # only needed for Claude models

How to run

After installation, the onecode command is available globally:

# Default model (claude-sonnet-4-6) with explicit path
onecode ~/path/to/project

# Use current directory (default if no path specified)
onecode

# Specify a different model
onecode --model gpt-4o

# From within the codebase directory (same as above)
cd ~/myproject
onecode

First installation check:

onecode --help

First run — output looks like this:

$ onecode ~/myproject
OneCode - Codebase Analyzer
----------------------------------------
Model:    claude-sonnet-4-6
Indexing: /Users/you/myproject
Ready:    42 nodes (class:12, file:18, function:12) | 42 embeddings

Type a question or task (or 'exit' to quit).
----------------------------------------

You: 

Subsequent runs — output looks like this:

$ onecode ~/myproject
OneCode - Codebase Analyzer
----------------------------------------
Model:    claude-sonnet-4-6
Indexing: /Users/you/myproject
Ready:    42 nodes (class:12, file:18, function:12) | 42 embeddings

Type a question or task (or 'exit' to quit).
----------------------------------------

You: 

Example queries

Understand the codebase

You: what does this codebase do?
You: explain the authentication flow
You: what classes exist and what are their responsibilities?
You: how does the database connection work?

Find specific code

You: search for all calls to connect_db
You: search for TODO comments
You: where is the retry logic implemented?
You: find all async functions

Write and modify code

You: add input validation to the login function
You: write a utility function that paginates a list and add it to utils.py
You: refactor the parse_config function to handle missing keys gracefully

Write, run, and self-correct

You: create a function that reverses a string, write a test for it, and run the test
You: add a health check endpoint and run the server to verify it starts
You: write a script that counts lines of code per file and run it

File management

You: rename src/helpers.py to src/utils.py
You: delete the tmp/ directory
You: move all test files into a tests/ directory

Git operations

You: show git status
You: show the diff of uncommitted changes
You: commit all staged files with message "add retry logic"
You: show the last 5 commits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onecode_cli-0.1.2.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onecode_cli-0.1.2-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file onecode_cli-0.1.2.tar.gz.

File metadata

  • Download URL: onecode_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for onecode_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d77863dfeaf59641b0c07ccd65d6a9415b7c55e8084870df6498a77f0a26b1a4
MD5 600947ccfb852c590596c30d038a6ea1
BLAKE2b-256 ddc1fd1b24e8e1b49e75bf22fed2a69951e34e627d55d6b963a2fa45d5bccb70

See more details on using hashes here.

File details

Details for the file onecode_cli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: onecode_cli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for onecode_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a7b508d18b225cb923c9a56358dbc044239dd17999a4b8b3e20b028af287c7a7
MD5 05f09fd7ec00043156cc3740f56178eb
BLAKE2b-256 cdd2f08c11d2a4c1b09bde9ea2cb1ab89f4e74e38bcb3d4b9bc663a6a2dcb05d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page