Skip to content

Commit f300193

Browse files
committed
docs: update documentation for simplified usage
- Update Core commands.md with new Makefile targets - Add Quick Start section to README.md - Improve installation instructions - Add example commands and usage (cherry picked from commit 49a099d128dd221f2fc34a9a93fef96085654af3)
1 parent 39a6d16 commit f300193

File tree

2 files changed

+101
-25
lines changed

2 files changed

+101
-25
lines changed

README.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
## Features
2424

2525
- **Designed for AI Assistants**: This API was specifically designed to integrate with AI assistants such as custom GPTs, providing them with efficient access to project file structures and contents.
26-
- **Retrieve Project Structure**: Get a detailed view of the projects directories and files.
26+
- **Retrieve Project Structure**: Get a detailed view of the project's directories and files.
2727
- **Retrieve File Contents**: Access the contents of specific files in the project, with error handling for non-existent paths.
2828
- **Custom Ignore Patterns**: Utilize `.agentignore` and/or `.gitignore` for specifying which files or directories to exclude from the structure retrieval.
2929

@@ -60,7 +60,7 @@
6060

6161
- **Error Scenarios**:
6262

63-
- **500 Internal Server Error**: If theres a failure in reading the directory structure, such as permission issues or corrupted files, an internal error response will be returned.
63+
- **500 Internal Server Error**: If there's a failure in reading the directory structure, such as permission issues or corrupted files, an internal error response will be returned.
6464

6565
**Example Error Response**:
6666

@@ -131,7 +131,7 @@
131131
}
132132
```
133133

134-
- **500 Internal Server Error**: If theres a failure in reading a file due to permissions, encoding issues, or other OS-level errors.
134+
- **500 Internal Server Error**: If there's a failure in reading a file due to permissions, encoding issues, or other OS-level errors.
135135

136136
**Example Error Response**:
137137

@@ -185,7 +185,7 @@ The **CodeQuery API** relies on environment variables, defined in an `.env` file
185185
mv template.env .env
186186
```
187187

188-
3. **Customize the Variables**: Adjust the variables in the `.env` file according to your projects requirements:
188+
3. **Customize the Variables**: Adjust the variables in the `.env` file according to your project's requirements:
189189

190190
```plaintext
191191
# Project Settings
@@ -207,9 +207,9 @@ The **CodeQuery API** relies on environment variables, defined in an `.env` file
207207
### Prerequisites
208208

209209
- Docker
210-
- Docker Compose (optional)
210+
- Make
211211

212-
### Installation Steps
212+
### Quick Start
213213

214214
1. **Clone the repository**:
215215

@@ -218,29 +218,34 @@ The **CodeQuery API** relies on environment variables, defined in an `.env` file
218218
cd CodeQuery-API
219219
```
220220

221-
2. **Build the Docker image**:
221+
2. **Initialize the environment**:
222222

223223
```bash
224-
docker build -t codequery_core .
224+
make init
225225
```
226226

227-
3. **Set up the environment variables**:
227+
This will create a `.env` file from the template. Edit it with your settings.
228228

229-
Refer to the [Environment Variables](#environment-variables) section for a complete guide on setting and customizing variables. Key variables to review include:
229+
3. **Build and run**:
230230

231-
- `PROJECT_PATH`
232-
- `API_KEY`
233-
- `NGROK_AUTHTOKEN`
231+
```bash
232+
make build # Build the Docker image
233+
make run # Run the Core container
234+
```
234235

235-
4. **Run the container**:
236+
4. **View logs**:
236237

237-
- Use Docker to start the container:
238+
```bash
239+
make logs # View container logs
240+
```
238241

239-
```bash
240-
docker run -d -p 5001:5001 -p 4040:4040 --name codequery_core --env-file .env codequery_core
241-
```
242+
5. **Other useful commands**:
242243

243-
- This command will run the CodeQuery Core component and expose it on port 5001. Ngrok’s local API will be accessible on port 4040 for tunnel management.
244+
```bash
245+
make help # Show all available commands
246+
make stop # Stop the container
247+
make test # Run tests
248+
```
244249

245250
### Testing the API
246251

@@ -278,7 +283,7 @@ For extensive testing, refer to the [Testing Guide](docs/testing.md).
278283

279284
#### 2. **Setting Up a Self-Hosted Server**
280285

281-
- **Description**: For users with a static IP or home server, you can host the Core directly using your ISPs services, avoiding ngrok or Gateway usage.
286+
- **Description**: For users with a static IP or home server, you can host the Core directly using your ISP's services, avoiding ngrok or Gateway usage.
282287

283288
- **Command**:
284289

@@ -500,7 +505,7 @@ Conversation Starters:
500505

501506
### 1. CoreQuery API (and CodeQueryGPT)
502507

503-
The **CoreQuery API** itself is the first use case of the CodeQuery API, and its the project youre currently exploring. It serves as a powerful development tool, integrating with AI assistants (such as the [**CodeQueryGPT**](#codequerygpt--creating-your-own-custom-gpt-for-using-this-api)) to support developers by providing a structured way to query project files, understand code dependencies, and interact with large codebases. This project was developed using a **Test-Driven Development (TDD)** approach to ensure the correctness of the AI-generated code.
508+
The **CoreQuery API** itself is the first use case of the CodeQuery API, and it's the project you're currently exploring. It serves as a powerful development tool, integrating with AI assistants (such as the [**CodeQueryGPT**](#codequerygpt--creating-your-own-custom-gpt-for-using-this-api)) to support developers by providing a structured way to query project files, understand code dependencies, and interact with large codebases. This project was developed using a **Test-Driven Development (TDD)** approach to ensure the correctness of the AI-generated code.
504509

505510
### 2. SkillChrono
506511

core/commands.md

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,84 @@
11
# Commands
22

3-
## Running
3+
## Quick Start
44

5-
docker rm -f codequery_core 2>/dev/null || true &&\
6-
docker run -d -p 5001:5001 --name codequery_core -v "$(pwd):/app" codequery_core
5+
```bash
6+
# Initialize environment
7+
make init
78

8-
lsof -i :$LOCAL_PORT && ps aux | grep ngrok
9+
# Build and run
10+
make build
11+
make run
912

13+
# View logs
14+
make logs
15+
16+
# Stop the container
17+
make stop
18+
19+
# Run tests
20+
make test
21+
22+
# Show all available commands
23+
make help
24+
```
25+
26+
## Manual Commands (Alternative)
27+
28+
### Running Manually
29+
30+
```bash
31+
# Build the image
32+
docker build -t codequery_core --build-arg NGROK_AUTHTOKEN=$NGROK_AUTHTOKEN .
33+
34+
# Run the container
35+
docker run --rm -d -p 5001:5001 -p 4040:4040 --name codequery_core -v "$(pwd):/app" --env-file .env codequery_core
36+
37+
# View logs
38+
docker logs -f codequery_core
39+
40+
# Stop the container
41+
docker stop codequery_core
42+
```
43+
44+
### Testing
45+
46+
```bash
47+
# Run tests
48+
docker run --rm codequery_core pytest core/tests
49+
```
50+
51+
### API Testing
52+
53+
#### Health check (Localhost)
54+
55+
```bash
56+
curl -X GET http://127.0.0.1:$LOCAL_PORT/
57+
```
58+
59+
#### GET /files/structure (Localhost)
60+
61+
```bash
62+
curl -H "X-API-KEY: $API_KEY" http://127.0.0.1:$LOCAL_PORT/files/structure
63+
```
64+
65+
#### POST /files/content (Localhost)
66+
67+
```bash
68+
curl -X POST -H "Content-Type: application/json" -H "X-API-KEY: $API_KEY" -d '{
69+
"file_paths": [
70+
"core/src/app.py",
71+
"core/src/ngrok_manager.py"
72+
]
73+
}' http://127.0.0.1:$LOCAL_PORT/files/content
74+
```
75+
76+
### Ngrok URLs
77+
78+
```bash
79+
# Get current ngrok URL
1080
curl --silent http://127.0.0.1:4040/api/tunnels | grep -Eo 'https://[a-zA-Z0-9-]+\.ngrok-free\.app'
81+
```
1182

1283
## Testing
1384

0 commit comments

Comments
 (0)