Examples demonstrating the Auggie SDK's context modes and AI-powered code analysis.
-
Node.js 18+ - Required to run the examples
-
Auggie CLI - Required for FileSystem Context examples
npm install -g @augmentcode/auggie
-
Authentication - Required for all examples
auggie login
This creates a session file at
~/.augment/session.jsonwith your API token.Alternatively, you can set environment variables:
export AUGMENT_API_TOKEN=your_token_here export AUGMENT_API_URL=https://staging-shard-0.api.augmentcode.com/
Install dependencies:
cd examples/typescript-sdk/context
npm installAPI-based indexing with semantic search and AI Q&A.
Run it:
npm run direct-contextLocal directory search via MCP protocol.
Prerequisites:
- Auggie CLI must be installed and in your PATH
- Authentication via
auggie loginorAUGMENT_API_TOKENenvironment variable - A
.gitignoreor.augmentignorefile in the workspace directory to excludenode_modules/and other large directories
Important: The FileSystem Context indexes all files in the workspace directory. To avoid timeouts when indexing large directories (like node_modules/), make sure you have a .gitignore or .augmentignore file that excludes them. The auggie CLI respects both .gitignore and .augmentignore patterns during indexing.
Run it:
npm run filesystem-contextREST API for semantic file search with AI summarization.
Prerequisites: Auggie CLI must be installed and in your PATH.
Run it:
npm run file-search-server [workspace-directory]Then query the API:
curl "http://localhost:3000/search?q=typescript"HTTP server that enhances prompts with codebase context.
Prerequisites: Auggie CLI must be installed and in your PATH.
Run it:
npm run prompt-enhancer-server [workspace-directory]Then enhance prompts:
curl -X POST http://localhost:3001/enhance \
-H "Content-Type: application/json" \
-d '{"prompt": "fix the login bug"}'Index GitHub repositories for semantic search.
This example has its own package.json and dependencies.
Setup:
npm run github-indexer:installRun it:
npm run github-indexer:index
npm run github-indexer:searchSee github-action-indexer/README.md for more details.
You can also run examples directly without installing dependencies:
npx tsx direct-context/index.ts
npx tsx filesystem-context/index.ts
npx tsx file-search-server/index.ts .
npx tsx prompt-enhancer-server/index.ts .Note: This will download dependencies on each run. For better performance, use npm install first.
Problem: The FileSystem Context example times out during indexing.
Cause: The workspace directory contains too many files (e.g., node_modules/ with 45,000+ files).
Solution: Create a .gitignore or .augmentignore file in the workspace directory to exclude large directories:
# .gitignore or .augmentignore
node_modules/
dist/
*.log
.DS_StoreThe auggie CLI respects both .gitignore and .augmentignore patterns and will skip excluded files during indexing.
Problem: Error: API key is required for searchAndAsk()
Cause: The SDK cannot find your authentication credentials.
Solution: Run auggie login to authenticate, or set the AUGMENT_API_TOKEN and AUGMENT_API_URL environment variables.