A CLI coding assistant
Project description
sarathi
A CLI coding assistant. It is targeted towards mundane tasks such as writing commit messages, generating docstrings etc.
Installation
You can install the package using below command. Make sure you have Python and pip installed on your system.
- pip install sarathi
Quickstart
Configuration
Sarathi uses a dual configuration system: YAML files for settings and Environment Variables for secrets (like API Keys).
1. Initialize Configuration
To create your global configuration file:
sarathi config init
This creates settings in ~/.sarathi/config.yaml. This is the single source of truth for your preferences across all projects.
If you want to initialize a config at a specific path:
sarathi config init --path ./my-config.yaml
2. Using a Custom Configuration
By default, Sarathi always looks at ~/.sarathi/config.yaml. If you want to use a specific configuration file for a particular project or session, use the global --config (or -c) flag:
sarathi --config ./project-config.yaml git autocommit
3. Configuration Hierarchy
Sarathi resolves configuration in the following order (lower items override higher ones):
- Defaults: Built-in settings.
- Global Config:
~/.sarathi/config.yaml(or the file specified via--config). - Environment Variables: For secrets and quick overrides (e.g.,
OPENAI_API_KEY).
4. Update Configuration from CLI
You can update configuration values directly from the terminal. This will persist settings to your active configuration file (local sarathi.yaml or global ~/.sarathi/config.yaml).
sarathi config set core.verify_ssl False
sarathi config set core.timeout 60
To update a value without saving it to the config file (current session only):
sarathi config set core.timeout 10 --no-save
5. Air-Gapped / Private Environments
If you are running Sarathi in an environment with private LLM endpoints (like a local Ollama or corporate proxy) that uses self-signed certificates, you can disable SSL verification:
sarathi config set core.verify_ssl False
6. Set API Keys (Environment Variable Only)
For security, API keys cannot be stored in the config file. You must export them in your shell:
For OpenAI:
export OPENAI_API_KEY="sk-..."
For Ollama (Local):
# No API key needed usually, just set the endpoint in config or env
export OPENAI_ENDPOINT_URL="http://localhost:11434/v1/chat/completions"
# Or configure the provider in sarathi.yaml/global config
Legacy Environment Variables: The following variables are also supported for backward compatibility:
OPENAI_ENDPOINT_URLOPENAI_MODEL_NAME
Usage
Generating Git Commit Messages
Sarathi provides a convenient commands to generate commit messages for git commits locally. Below are the steps you want to follow
-
Stage the files you want to commit
-
Run
sarathi git autocommit.- this command will automatically analyze your staged changes
- generate a commit message via OPEN AI, show the generated message to you,
- if you confirm, will commit your changes to the repository with the generated message.
-
Run
sarathi git gencommit.- this command will automatically analyze your staged changes,
- generate a commit message via OPEN AI, and commit the changes automatically.
- It will then run
git commit --amendfor you to edit the generated commit message.
Generating docstring messages
You can generate docstrings for your python code using commands such as below
- Run
sarathi docstrgen -f src/sarathi/code/codetasks.py. This command analyzes the methods in the file provided in the argument, and generates docstrings for functions. - Run
sarathi docstrgen -d src/sarathi/. This command analyzes the methods in all files present in the directory provided in the argument, and generates docstrings for function.
Ask Questions
You can ask general coding questions to the assistant:
- Run
sarathi chat -q "How do I reverse a list in Python?"
Interactive Chat Mode
Start a persistent, interactive session where the assistant can help you edit code, run tests, and answer complex queries.
- Run
sarathi chat
Inside the chat, you can use Slash Commands:
/exit: Quit the session/clear: Reset conversation context/model <name>: Switch the LLM model for the current session/reindex: Refresh the project file index for@filenamecompletions
Model Switching
Quickly change or view the LLM model used by Sarathi:
- View current models:
sarathi model - Change globally for all agents:
sarathi model gpt-4o - Change for a specific agent:
sarathi model claude-3-5-sonnet --agent code_editor - Temporary change (no save):
sarathi model llama3 --no-save
SBOM (Software Bill of Materials) Tools
Audit your project's dependencies, licenses, and full dependency trees with a beautiful Rich terminal UI:
- Library Mapping:
sarathi sbom imports(See which file imports which external library) - Dependency Graph:
sarathi sbom depgraph(Full visual tree of installed dependencies) - Integrity Check:
sarathi sbom check(Detect unused bloat or undeclared dependencies) - Specific Package:
sarathi sbom depgraph -p requests - JSON Export:
sarathi sbom imports --json
Tip: Inside
sarathi chat, you can ask "Who depends on aiohttp?" or "Check for unused dependencies" and the assistant will use these tools to audit your project.
Recent Changes
- Interactive Chat Mode: Added a powerful
sarathi chatmode with tool support, project indexing, and slash commands. - SBOM Tools: New
sarathi sbomsuite for auditing imports, licenses, and full dependency graphs. - Dynamic Configuration: New
sarathi config setcommand to update settings from CLI. - Model Switching: Added
sarathi modelcommand and/modelchat command to switch LLMs on the fly. - Unified Interface: Merged
askintochatfor a simpler command structure. - Air-Gapped Support: Added
core.verify_ssltoggle to support environments with private/self-signed certificates. - Persistence: Configuration updates are now preserved with proper YAML formatting.
Helpful references
- https://dev.to/taikedz/ive-parked-my-side-projects-3o62
- https://github.com/lightningorb/autocommit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sarathi-0.0.5.tar.gz.
File metadata
- Download URL: sarathi-0.0.5.tar.gz
- Upload date:
- Size: 55.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5e6b04b950dcf1358d54d4217cf52a4c34537ebb93c60dc507dcbeb733cbc3a
|
|
| MD5 |
9769e2fe19833340f531e2292dd14845
|
|
| BLAKE2b-256 |
916b172ff88fc01abb0dc2471124af60b1ce7e49f1a7f19dbb12a80f3782962a
|
File details
Details for the file sarathi-0.0.5-py3-none-any.whl.
File metadata
- Download URL: sarathi-0.0.5-py3-none-any.whl
- Upload date:
- Size: 49.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a720319e9311060433ac9f25512722253686160acf1e17887b805b88b41c2d7
|
|
| MD5 |
d39d09f3069be3bf8c69ad301581cc91
|
|
| BLAKE2b-256 |
b278bcf5d30c131a2206e3a9c595c3f83dc8818c7d54bcc4acbb935035d24a76
|