Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Learn more in the Augment Docs:
1. Install Auggie (Node 22+ required):

```sh
npm install -g @augmentcode/auggie
npm install -g @augmentcode/auggie@latest
```

2. Login:
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript-sdk/context/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Examples demonstrating the Auggie SDK's context modes and AI-powered code analys
1. **Node.js 18+** - Required to run the examples
2. **Auggie CLI** - Required for FileSystem Context examples
```bash
npm install -g @augmentcode/auggie
npm install -g @augmentcode/auggie@latest
```
3. **Authentication** - Required for all examples
```bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ REST API for semantic file search with AI-powered summarization.

Install the `auggie` CLI and authenticate:
```bash
npm install -g @augmentcode/auggie
npm install -g @augmentcode/auggie@latest
auggie login
```

Expand Down
29 changes: 25 additions & 4 deletions examples/typescript-sdk/context/github-action-indexer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,36 @@ The installation script will:

### 2. Configure Repository Secrets

Add these secrets to your repository (Settings → Secrets and variables → Actions):
In the GitHub UI, navigate to your repository **Settings → Secrets and variables → Actions** and add these secrets:

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that the indexer requires AUGMENT_API_URL, the bundled example workflow at examples/typescript-sdk/context/github-action-indexer/.github/workflows/index.yml will likely need to pass AUGMENT_API_URL too (it currently only sets AUGMENT_API_TOKEN). Otherwise users copying that workflow could hit a missing-env error.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.


**How to get your credentials:**

1. **Using the Auggie CLI** (recommended):
```bash
# Login to Augment
auggie login

# Print your credentials
auggie token print

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs/changelog refer to auggie tokens print; auggie token print may not exist and could break these setup steps. Consider updating this command to match the actual CLI subcommand (tokens print).

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

```

This outputs:
```
TOKEN={"accessToken":"your-token-here","tenantURL":"https://your-tenant.api.augmentcode.com/","scopes":["read","write"]}
```

Extract the values from the JSON:
- `accessToken` → use for `AUGMENT_API_TOKEN`
- `tenantURL` → use for `AUGMENT_API_URL`

2. **From your Augment account**: Contact your Augment administrator or check your account settings for API credentials.

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

### 3. Push and Run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ jobs:
run: npm run index
env:
AUGMENT_API_TOKEN: \${{ secrets.AUGMENT_API_TOKEN }}
AUGMENT_API_URL: \${{ secrets.AUGMENT_API_URL }}
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
MAX_COMMITS: ${settings.maxCommits}
MAX_FILES: ${settings.maxFiles}
Expand Down Expand Up @@ -264,6 +265,7 @@ jobs:
run: npm run index
env:
AUGMENT_API_TOKEN: \${{ secrets.AUGMENT_API_TOKEN }}
AUGMENT_API_URL: \${{ secrets.AUGMENT_API_URL }}
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
MAX_COMMITS: ${settings.maxCommits}
MAX_FILES: ${settings.maxFiles}
Expand Down
36 changes: 7 additions & 29 deletions examples/typescript-sdk/context/github-action-indexer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,18 @@ import { IndexManager } from "./index-manager.js";
import type { IndexConfig } from "./types.js";

/**
* Parse API token from environment variable
* Handles both plain string tokens and JSON-formatted tokens
* Get API credentials from environment variables
*/
function parseApiToken(): { apiToken: string; apiUrl: string } {
const apiTokenEnv = process.env.AUGMENT_API_TOKEN;
if (!apiTokenEnv) {
function getApiCredentials(): { apiToken: string; apiUrl: string } {
const apiToken = process.env.AUGMENT_API_TOKEN;
if (!apiToken) {
throw new Error("AUGMENT_API_TOKEN environment variable is required");
}

let apiToken: string;
let apiUrl: string | undefined = process.env.AUGMENT_API_URL;

try {
const tokenObj = JSON.parse(apiTokenEnv) as {
accessToken?: string;
tenantURL?: string;
};
if (tokenObj.accessToken) {
apiToken = tokenObj.accessToken;
// Use tenantURL from token if not overridden by env var
if (!apiUrl && tokenObj.tenantURL) {
apiUrl = tokenObj.tenantURL;
}
} else {
apiToken = apiTokenEnv;
}
} catch {
// Not JSON, use as-is
apiToken = apiTokenEnv;
}

const apiUrl = process.env.AUGMENT_API_URL;
if (!apiUrl) {
throw new Error(
"AUGMENT_API_URL environment variable is required. Please set it to your tenant-specific URL (e.g., 'https://your-tenant.api.augmentcode.com') or include tenantURL in your API token JSON."
"AUGMENT_API_URL environment variable is required. Please set it to your tenant-specific URL (e.g., 'https://your-tenant.api.augmentcode.com/')"
);
}

Expand Down Expand Up @@ -96,7 +74,7 @@ function loadConfig(): IndexConfig {
throw new Error("GITHUB_TOKEN environment variable is required");
}

const { apiToken, apiUrl } = parseApiToken();
const { apiToken, apiUrl } = getApiCredentials();
const { owner, repo, branch, currentCommit } = parseRepositoryInfo();

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,39 +73,17 @@ async function main(): Promise<void> {
process.exit(1);
}

// Get API token
const apiTokenEnv = process.env.AUGMENT_API_TOKEN;
if (!apiTokenEnv) {
// Get API credentials
const apiToken = process.env.AUGMENT_API_TOKEN;
if (!apiToken) {
console.error("Error: AUGMENT_API_TOKEN environment variable is required");
process.exit(1);
}

// Parse API token - it can be either a JSON object or a plain string
let apiToken: string;
let apiUrl: string | undefined = process.env.AUGMENT_API_URL;

try {
const tokenObj = JSON.parse(apiTokenEnv) as {
accessToken?: string;
tenantURL?: string;
};
if (tokenObj.accessToken) {
apiToken = tokenObj.accessToken;
// Use tenantURL from token if not overridden by env var
if (!apiUrl && tokenObj.tenantURL) {
apiUrl = tokenObj.tenantURL;
}
} else {
apiToken = apiTokenEnv;
}
} catch {
// Not JSON, use as-is
apiToken = apiTokenEnv;
}

const apiUrl = process.env.AUGMENT_API_URL;
if (!apiUrl) {
console.error(
"Error: AUGMENT_API_URL environment variable is required. Please set it to your tenant-specific URL (e.g., 'https://your-tenant.api.augmentcode.com') or include tenantURL in your API token JSON."
"Error: AUGMENT_API_URL environment variable is required. Please set it to your tenant-specific URL (e.g., 'https://your-tenant.api.augmentcode.com/')"
);
process.exit(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ export type IndexConfig = {

/**
* Augment API URL
* Can be provided via AUGMENT_API_URL env var, or extracted from
* a JSON-formatted AUGMENT_API_TOKEN that includes tenantURL field
* Provided via AUGMENT_API_URL env var
*/
apiUrl: string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HTTP server that enhances vague prompts using AI with codebase context.

Install the `auggie` CLI and authenticate:
```bash
npm install -g @augmentcode/auggie
npm install -g @augmentcode/auggie@latest
auggie login
```

Expand Down
Loading