Skip to content

Commit 58e48f1

Browse files
committed
Renamed generic src directory to augment_indexer in example
1 parent 70ecf51 commit 58e48f1

15 files changed

Lines changed: 80 additions & 37 deletions

File tree

examples/python-sdk/context/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ Examples demonstrating the Auggie SDK's context modes and AI-powered code analys
77
1. **Python 3.10+** - Required to run the examples
88
2. **Auggie CLI** - Required for FileSystem Context examples
99
```bash
10-
pip install auggie
11-
# or
12-
npm install -g @augmentcode/auggie
10+
npm install -g @augmentcode/auggie@prerelease
1311
```
1412
3. **Authentication** - Required for all examples
1513
```bash

examples/python-sdk/context/file_search_server/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ REST API for semantic file search with AI-powered summarization.
66

77
Install the `auggie` CLI and authenticate:
88
```bash
9-
pip install auggie
10-
# or
11-
npm install -g @augmentcode/auggie
9+
npm install -g @augmentcode/auggie@prerelease
1210
auggie login
1311
```
1412

examples/python-sdk/context/github_action_indexer/.github/workflows/index.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
5050
- name: Index repository
5151
id: index
52-
run: python src/main.py
52+
run: python -m augment_indexer.main
5353
env:
5454
AUGMENT_API_TOKEN: ${{ secrets.AUGMENT_API_TOKEN }}
5555
AUGMENT_API_URL: ${{ secrets.AUGMENT_API_URL }}

examples/python-sdk/context/github_action_indexer/README.md

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,44 @@ This example demonstrates:
1010
- Automatic fallback to full re-index when needed
1111
- GitHub Actions integration
1212

13-
## Quick Start
13+
## Prerequisites
1414

15-
### Local Usage
15+
### Getting Your API Credentials
1616

17-
The simplest way to get started is to index and search a repository locally:
17+
1. **Authenticate to get your credentials if you have not already:**
18+
```bash
19+
auggie login
20+
```
21+
This opens a browser for authentication and stores your credentials at `~/.augment/session.json`.
22+
23+
2. **Extract the values for environment variables:**
24+
```bash
25+
# View your session file to get the values
26+
cat ~/.augment/session.json
27+
```
28+
- `AUGMENT_API_TOKEN`: Use the `accessToken` value from the session file
29+
- `AUGMENT_API_URL`: Use the `baseUrl` value from the session file
30+
31+
### GitHub Token
32+
33+
For the `GITHUB_TOKEN`, you need a GitHub Personal Access Token with `repo` scope (for private repos) or `public_repo` scope (for public repos only). [Create one here](https://github.com/settings/tokens).
34+
35+
## Two Ways to Use This Example
36+
37+
There are two ways to use this indexer:
38+
39+
| Mode | Description | Best For |
40+
|------|-------------|----------|
41+
| **Local Testing** | Run from this examples directory to index any GitHub repo | Trying out the indexer, testing on existing repos |
42+
| **GitHub Actions** | Copy the code into your own repo for automatic indexing | Production use, CI/CD integration |
43+
44+
---
45+
46+
## Option 1: Local Testing (Quick Start)
47+
48+
Test the indexer on any GitHub repository without copying any files. This downloads the repo via the GitHub API and indexes it.
49+
50+
### Example: Index the facebook/react Repository
1851

1952
```bash
2053
# Navigate to the context examples directory
@@ -23,32 +56,47 @@ cd examples/python-sdk/context
2356
# Install dependencies
2457
pip install -r github_action_indexer/requirements.txt
2558

26-
# Set required environment variables
27-
export AUGMENT_API_TOKEN="your-token"
28-
export AUGMENT_API_URL="https://your-tenant.api.augmentcode.com/" # Required: your tenant-specific URL
29-
export GITHUB_TOKEN="your-github-token"
30-
export GITHUB_REPOSITORY="owner/repo"
31-
export GITHUB_SHA="$(git rev-parse HEAD)"
59+
# Set your credentials (see Prerequisites section above)
60+
export AUGMENT_API_TOKEN="your-token" # From ~/.augment/session.json
61+
export AUGMENT_API_URL="your-url" # From ~/.augment/session.json
62+
export GITHUB_TOKEN="your-github-token" # Your GitHub PAT
63+
64+
# Index a public repository (e.g., facebook/react)
65+
export GITHUB_REPOSITORY="facebook/react"
66+
export GITHUB_SHA="main"
3267

33-
# Index the repository (stores state in .augment-index-state/state.json)
68+
# Run the indexer
3469
python -m github_action_indexer index
3570

3671
# Search the indexed repository
37-
python -m github_action_indexer search "authentication functions"
38-
python -m github_action_indexer search "error handling" --max-chars 5000
72+
python -m github_action_indexer search "hooks implementation"
73+
python -m github_action_indexer search "reconciler algorithm"
3974
```
4075

41-
The index state is saved to `.augment-index-state/state.json` by default, so subsequent runs will perform incremental updates.
76+
### Index Your Own Repository
77+
78+
```bash
79+
# Set to any repo you have access to
80+
export GITHUB_REPOSITORY="your-username/your-repo"
81+
export GITHUB_SHA="main" # or a specific commit SHA
82+
83+
python -m github_action_indexer index
84+
python -m github_action_indexer search "your search query"
85+
```
86+
87+
The index state is saved to `.augment-index-state/{branch}/state.json`, so subsequent runs perform incremental updates.
88+
89+
---
4290

43-
## GitHub Actions Setup
91+
## Option 2: GitHub Actions Setup (Production Use)
4492

45-
To automatically index your repository on every push:
93+
For automatic indexing of your repository on every push, copy this code into your own repository.
4694

4795
1. **Copy the indexer code** to your repository root. The workflow expects the following structure:
4896
```
4997
your-repo/
5098
├── .github/workflows/index.yml
51-
├── src/
99+
├── augment_indexer/
52100
│ └── main.py (and other indexer source files)
53101
└── requirements.txt
54102
```
@@ -128,7 +176,7 @@ Key environment variables:
128176

129177
The index state is stored as a JSON file on the file system by default (`.augment-index-state/{branch}/state.json`). In GitHub Actions, the state is persisted between runs using GitHub Actions cache for efficient incremental updates.
130178

131-
The indexer can be adapted to use other storage backends like Redis, S3, or databases. The state save/load operations in `src/index_manager.py` can be modified to work with any storage system that can persist JSON data.
179+
The indexer can be adapted to use other storage backends like Redis, S3, or databases. The state save/load operations in `augment_indexer/index_manager.py` can be modified to work with any storage system that can persist JSON data.
132180

133181
## Searching the Index
134182

examples/python-sdk/context/github_action_indexer/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ def main() -> None:
3434
sys.argv = [sys.argv[0]] + sys.argv[2:]
3535

3636
if command == "index":
37-
from .src.main import main as index_main
37+
from .augment_indexer.main import main as index_main
3838

3939
index_main()
4040
elif command == "search":
41-
from .src.search import main as search_main
41+
from .augment_indexer.search import main as search_main
4242

4343
search_main()
4444
else:

examples/python-sdk/context/github_action_indexer/src/__init__.py renamed to examples/python-sdk/context/github_action_indexer/augment_indexer/__init__.py

File renamed without changes.

examples/python-sdk/context/github_action_indexer/src/file_filter.py renamed to examples/python-sdk/context/github_action_indexer/augment_indexer/file_filter.py

File renamed without changes.

examples/python-sdk/context/github_action_indexer/src/github_client.py renamed to examples/python-sdk/context/github_action_indexer/augment_indexer/github_client.py

File renamed without changes.

examples/python-sdk/context/github_action_indexer/src/index_manager.py renamed to examples/python-sdk/context/github_action_indexer/augment_indexer/index_manager.py

File renamed without changes.

examples/python-sdk/context/github_action_indexer/src/main.py renamed to examples/python-sdk/context/github_action_indexer/augment_indexer/main.py

File renamed without changes.

0 commit comments

Comments
 (0)