Skip to content

Commit fb57058

Browse files
committed
Address code review
1 parent 3f238c3 commit fb57058

File tree

10 files changed

+32
-15990
lines changed

10 files changed

+32
-15990
lines changed

examples/typescript-sdk/context/file-search-server/README.md

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# File Search Server Example
22

3-
REST API for semantic file search with AI-powered summarization and code explanation.
3+
REST API for semantic file search with AI-powered summarization.
44

55
## Prerequisites
66

7-
Install the `auggie` CLI:
7+
Install the `auggie` CLI and authenticate:
88
```bash
9-
auggie --version
9+
npm install -g @augmentcode/auggie
10+
auggie login
1011
```
1112

1213
## Usage
1314

1415
```bash
15-
export AUGMENT_API_TOKEN="your-token"
1616
npx tsx examples/context/file-search-server/index.ts .
1717
```
1818

@@ -21,21 +21,7 @@ npx tsx examples/context/file-search-server/index.ts .
2121
### Search Files
2222
```bash
2323
curl "http://localhost:3000/search?q=typescript"
24-
curl "http://localhost:3000/search?q=package.json&format=text"
25-
```
26-
27-
### Summarize (AI)
28-
```bash
29-
curl -X POST http://localhost:3000/summarize \
30-
-H "Content-Type: application/json" \
31-
-d '{"query":"authentication logic"}'
32-
```
33-
34-
### Explain Code (AI)
35-
```bash
36-
curl -X POST http://localhost:3000/explain \
37-
-H "Content-Type: application/json" \
38-
-d '{"path":"src/auth.ts"}'
24+
curl "http://localhost:3000/search?q=authentication+logic"
3925
```
4026

4127
### Health Check

examples/typescript-sdk/context/filesystem-context/index.ts

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,6 @@
1111
*/
1212

1313
import { FileSystemContext } from "@augmentcode/auggie-sdk";
14-
import { readFile } from "node:fs/promises";
15-
import { homedir } from "node:os";
16-
import { join } from "node:path";
17-
18-
/**
19-
* Read API credentials from ~/.augment/session.json
20-
* This is a workaround until FileSystemContext supports session file natively
21-
*/
22-
async function readSessionCredentials(): Promise<{
23-
apiKey?: string;
24-
apiUrl?: string;
25-
} | null> {
26-
try {
27-
const sessionPath = join(homedir(), ".augment", "session.json");
28-
const content = await readFile(sessionPath, "utf-8");
29-
const data = JSON.parse(content);
30-
if (data.accessToken && data.tenantURL) {
31-
return {
32-
apiKey: data.accessToken,
33-
apiUrl: data.tenantURL,
34-
};
35-
}
36-
} catch {
37-
// Session file doesn't exist or can't be read
38-
}
39-
return null;
40-
}
4114

4215
async function main() {
4316
console.log("=== FileSystem Context Sample ===\n");
@@ -46,24 +19,10 @@ async function main() {
4619
const workspaceDir = process.cwd();
4720
console.log(`Workspace directory: ${workspaceDir}`);
4821

49-
// Read credentials from session file if not in environment
50-
// This allows the example to work after running `auggie login`
51-
if (!process.env.AUGMENT_API_TOKEN) {
52-
const credentials = await readSessionCredentials();
53-
if (credentials) {
54-
process.env.AUGMENT_API_TOKEN = credentials.apiKey;
55-
process.env.AUGMENT_API_URL = credentials.apiUrl;
56-
console.log("✓ Using credentials from ~/.augment/session.json");
57-
} else {
58-
console.warn(
59-
"⚠️ No credentials found. Run 'auggie login' or set AUGMENT_API_TOKEN environment variable."
60-
);
61-
}
62-
} else {
63-
console.log("✓ Using credentials from environment variables");
64-
}
65-
6622
// Create a FileSystem Context instance
23+
// Authentication is handled automatically by the auggie CLI via:
24+
// 1. AUGMENT_API_TOKEN / AUGMENT_API_URL env vars, or
25+
// 2. ~/.augment/session.json (created by `auggie login`)
6726
console.log("\nCreating FileSystem Context (spawning auggie --mcp)...");
6827
const context = await FileSystemContext.create({
6928
directory: workspaceDir,

examples/typescript-sdk/context/github-action-indexer/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ npm run search "authentication functions"
3737
npm run search "error handling"
3838
```
3939

40-
The index state is saved to `.augment-index-state/state.json` by default, so subsequent runs will perform incremental updates.
40+
The index state is saved to `.augment-index-state/{branch}/state.json` by default (where `{branch}` is the current branch name), so subsequent runs will perform incremental updates.
4141

4242
## Deploy to Production (GitHub Actions)
4343

@@ -67,12 +67,14 @@ The installation script will:
6767

6868
Add these secrets to your repository (Settings → Secrets and variables → Actions):
6969

70-
| Secret Name | Description | Example |
71-
|-------------|-------------|---------|
72-
| `AUGMENT_API_TOKEN` | Your Augment API token | `your-token-here` |
73-
| `AUGMENT_API_URL` | Your tenant-specific API URL | `https://your-tenant.api.augmentcode.com/` |
70+
| Secret Name | Description | Required |
71+
|-------------|-------------|----------|
72+
| `AUGMENT_API_TOKEN` | Your Augment API token (can be a JSON object with `accessToken` and `tenantURL` fields, or a plain token string) | Yes |
7473

75-
**Note:** `GITHUB_TOKEN`, `GITHUB_REPOSITORY`, and `GITHUB_SHA` are automatically provided by GitHub Actions.
74+
**Note:**
75+
- If using a plain token string, you must also set `AUGMENT_API_URL` as a secret or environment variable
76+
- If your token is a JSON object from `~/.augment/session.json` (with `accessToken` and `tenantURL`), the URL will be extracted automatically
77+
- `GITHUB_TOKEN`, `GITHUB_REPOSITORY`, and `GITHUB_SHA` are automatically provided by GitHub Actions
7678

7779
### 3. Push and Run
7880

0 commit comments

Comments
 (0)