Skip to content

Commit

Permalink
Closes #3 and Closes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
PrashamTrivedi committed Sep 13, 2024
1 parent 9ade56d commit 7106b11
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@ npm install -g sourcesailor

#### Setup

Set up the OpenAI API key and default model for SourceSailor:
Set up the API keys and default models for SourceSailor:

```bash
SourceSailor setup --apiKey <your_api_key> [--model <model_name>] [--analysisDir <directory>]
SourceSailor setup --apiKey <your_api_key> [--model <model_name>] [--analysisDir <directory>] [--anthropicApiKey <your_anthropic_api_key>] [--geminiApiKey <your_gemini_api_key>]
```

Options:
- `--apiKey`, `-k`: OpenAI API Key (required)
- `--model`, `-m`: OpenAI Model (default: 'gpt-3.5-turbo')
- `--analysisDir`, `-a`: Root directory to write the analysis. Default is the home directory. Use 'p' to use the codebase directory. (default: home directory)
- `--model`, `-m`: Default AI Model (default: 'gpt-3.5-turbo')
- `--analysisDir`, `-a`: Root directory to write the analysis. Default is the home directory. Use 'p' to use the codebase directory.
- `--anthropicApiKey`, `-n`: Anthropic API Key
- `--geminiApiKey`, `-g`: Gemini API Key

#### Get Directory Structure (Added in 1.3.0)
#### Get Directory Structure

Get the directory structure of the given path:

Expand All @@ -54,27 +56,26 @@ Options:
- `--withContent`, `-c`: Include file content in the output (default: true)
- `--ignore`, `-i`: Additional files or patterns to ignore for analysis. You can pass multiple patterns separated by commas (default: none)


#### Analyze

Analyze the given directory structure to understand the project structure and dependencies:

```bash
SourceSailor analyse <path> [--verbose] [--openai] [--streaming] [--ignore]
SourceSailor analyse <path> [--verbose] [--streaming] [--ignore] [--model]
```

Positional arguments:
- `<path>`, `-p`: Path to the directory to analyze (required)

Options:
- `--verbose`, `-v`: Run with verbose logging (default: false)
- `--openai`, `-o`: Use OpenAI to infer project structure (default: true)
- `--streaming`, `-s`: Use OpenAI streaming to infer project structure (default: false)
- `--ignore`, `-i`: Additional files or patterns to ignore for analysis. You can pass multiple patterns separated by commas (default: none) (Added in 1.3.0)
- `--streaming`, `-s`: Use AI streaming to infer project structure (default: false)
- `--ignore`, `-i`: Additional files or patterns to ignore for analysis. You can pass multiple patterns separated by commas (default: none)
- `--model`, `-m`: Specify the AI model to use for analysis

#### List Models

List all available OpenAI models:
List all available AI models:

```bash
SourceSailor listModels [--verbose]
Expand All @@ -96,16 +97,18 @@ Options:

#### Update Config

Update the OpenAI API key and default model:
Update the API keys and default model:

```bash
SourceSailor updateConfig [--apiKey <api_key>] [--model <model_name>] [--analysisDir <directory>]
SourceSailor updateConfig [--apiKey <api_key>] [--model <model_name>] [--analysisDir <directory>] [--geminiApiKey <gemini_api_key>] [--anthropicApiKey <anthropic_api_key>]
```

Options:
- `--apiKey`, `-k`: OpenAI API Key
- `--model`, `-m`: OpenAI Model
- `--model`, `-m`: Default AI Model
- `--analysisDir`, `-a`: Root directory to write the analysis. Default is the home directory. Use 'p' to use the codebase directory.
- `--geminiApiKey`, `-g`: Gemini API Key
- `--anthropicApiKey`, `-n`: Anthropic API Key

#### Set User Expertise

Expand All @@ -122,7 +125,7 @@ This interactive command will guide you through setting your expertise levels fo
Prepare a report based on the analysis:

```bash
SourceSailor prepareReport <path> [--verbose] [--streaming]
SourceSailor prepareReport <path> [--verbose] [--streaming] [--model]
```

Positional arguments:
Expand All @@ -131,28 +134,30 @@ Positional arguments:
Options:
- `--verbose`, `-v`: Enable verbose output
- `--streaming`, `-s`: Stream the output to a file
- `--model`, `-m`: Specify the AI model to use for report generation

Use the `SourceSailor --help` command to see the full list of available commands and options.


## About the Code

The SourceSailor-CLI tool is structured around several key components, each serving a specific purpose in the code analysis process:

- **Commands Directory**: Contains various CLI commands like `analyse.mjs`, `listConfig.mjs`, and more, which implement the tool's functionality.
- **OpenAI Integration**: The `openai.mjs` module interfaces with the OpenAI API, enabling the tool to perform advanced code analysis.
-:brain: **Tree-Sitter Parsing**: Utilizes Tree-Sitter grammars in `treeParser.mjs` and `treeSitterFromFieNames.mjs` for accurate code parsing across different languages. (Removed from the core functionality,See [#9](https://github.com/PrashamTrivedi/SourceSailor-CLI/issues/9))
- **AI Integration**: Includes modules for OpenAI (`openai.mjs`), Google's Gemini (`gemini.mts`), and Anthropic (`anthropic.mts`) to perform advanced code analysis.
- **Dynamic Command Handling**: Employs Yargs for building a flexible CLI interface, making it user-friendly and adaptable to various user needs.
- **Configurable Analysis Directory**: Allows users to specify directories for storing analysis results, adding a layer of customization.
- **User Expertise Levels**: The `expertise.mjs` module manages user expertise levels for different programming languages and frameworks, enhancing the tool's analysis capabilities.
- **Model Utils**: The `modelUtils.mts` file provides a unified interface for managing different AI models and providers.


## :construction: Next Steps

- Iterate through prompts (Will be ongoing evaluation)
- Use Openrouter to switch models (Not planning to use, will switch to Gemini and Claude for future versions, may be by using plugins)
- Use more prompts and CoT to work around the project (Will be ongoing evaluation)
- Add Anthropic and Gemini models (See [#3](https://github.com/PrashamTrivedi/SourceSailor-CLI/issues/3) and [#2](https://github.com/PrashamTrivedi/SourceSailor-CLI/issues/2) respectively)
- ❌ Use tree sitter to get better ideas of the project and codebase :brain: (Can be core functionality of the CLI) (Already in the code) (Removed from the core functionality,See [#9](https://github.com/PrashamTrivedi/SourceSailor-CLI/issues/9) )
- Add Plug and Play architecture for various model providers (Openrouter, AWS Bedrock, Google Vertex and Mistral are in my mind)
- 🤔 Customizable prompts
- ✅ Add Anthropic and Gemini models (See [#3](https://github.com/PrashamTrivedi/SourceSailor-CLI/issues/3) and [#2](https://github.com/PrashamTrivedi/SourceSailor-CLI/issues/2) respectively)
- ✅ Write some reports per prompt and then pass it to CoT to generate a confident report (Already in the code)
- Use the report as RAG. :bulb: (Highly speculative)
- ✅ Use CLI decorators like colors and other decorators
Expand Down

0 comments on commit 7106b11

Please sign in to comment.