Setting Up Nia CLI
A step-by-step guide to installing, configuring, and using Nia CLI
This guide provides detailed instructions for getting started with Nia CLI, from installation to advanced usage.
Prerequisites
Before installing Nia CLI, ensure you have:
To verify your Python installation:
Installation
Install Nia CLI
Using pip (recommended):
Alternatively, use pipx for an isolated installation:
If you’re using a virtual environment, make sure it’s activated before installation.
Verify installation
Confirm that Nia CLI was installed correctly:
You should see the version number of the installed CLI.
Get your API key
If you don’t already have a Nia API key:
- Go to app.trynia.ai
- Sign up or log in to your account
- Navigate to API settings
- Generate a new API key
Keep your API key secure. Do not share it or expose it in public repositories.
Login to Nia
Authenticate your CLI with your API key:
When prompted, enter your API key. Alternatively, provide it directly:
Your API key will be securely stored in ~/.nia/config.json
.
Basic Configuration
After installation and authentication, let’s set up your working environment:
View available repositories
If you’ve already indexed repositories through the Nia web interface, you can list them:
This will show all repositories you have access to, including their IDs, names, branches, and indexing status.
Index a new repository
To add a GitHub repository for Nia to analyze:
For example:
By default, Nia will index the “main” branch. To specify a different branch:
Initial indexing may take several minutes depending on the size of the repository.
Check indexing status
Monitor the progress of repository indexing:
Replace REPOSITORY_ID
with the ID returned when you created the repository.
Set a default repository
To avoid specifying a repository ID in every command:
Alternatively, run nia select
without arguments to see a list of repositories to choose from.
Starting Your First Chat
Now that you’ve set up Nia CLI and indexed a repository, let’s start interacting with your code:
Begin a chat session
Start chatting with your default repository:
Or specify a repository:
The chat interface will open in your terminal.
Ask questions about your code
Now you can ask Nia about your codebase. Try starting with these questions:
Be specific in your questions to get the most precise answers.
Explore multi-repository functionality
For projects that span multiple repositories, you can include additional repositories in your chat:
This is particularly useful for microservice architectures or projects with shared dependencies.
End your session
When you’re finished, exit the chat:
Advanced Workflow
Effective Chat Strategies
Start Broad, Then Narrow
Begin with general questions about architecture before diving into specific components
Reference Specific Files
When asking about implementation details, mention file paths for more precise answers
Chain Your Questions
Build on previous questions to maintain context through your exploration
Use Multiple Sessions
Create different chat sessions for different aspects of your codebase
Example Chat Sequence
Configuration File Reference
The Nia CLI configuration file is located at ~/.nia/config.json
. Here’s a sample configuration with explanations:
You can manually edit this file if needed, but it’s recommended to use the CLI commands for configuration.
Resolving Common Issues
Best Practices
Regular Updates
Keep Nia CLI up-to-date:
Repository Freshness
Re-index after major code changes to ensure accurate answers
Specific Questions
Ask focused questions rather than overly broad ones
Terminal Session
Use a terminal with good Unicode support for optimal display
Secure Storage
Never share your API key or include it in scripts
Multiple Repositories
Set up different projects for different codebases
Going Further
Explore integrations
Beyond the CLI, Nia AI offers integrations with:
- Slack for team-wide code assistance
- GitHub for automated code reviews
- VS Code and other editors through extensions
Check the Integrations Overview for details.
Automate workflows
Incorporate Nia CLI into your development workflows:
- Add repository indexing to CI/CD pipelines
- Create scripts to automate common queries
- Integrate with project documentation tools
Alternative Access Methods
If you prefer not to use the CLI, Nia provides multiple ways to access its functionality:
- Web Application: User-friendly interface for code chat
- REST API: Programmatic access for custom integrations
- Slack Integration: Chat with your code directly in Slack
- IDE Extensions: Use Nia directly in your code editor
Join the community
Connect with other Nia users:
- Join our Discord community
- Share your use cases and feedback
- Learn from how others are using Nia
For any issues not covered in this guide, contact Nia support at arlan@nozomio.com or visit our Discord community.