🧠 AI Context Builder & AI Prompt Generator (
|
| Language / File Type | Extensions | Engine / Worker | Capability Level |
|---|---|---|---|
| C# | .cs |
.NET Roslyn (Microsoft.CodeAnalysis.CSharp) |
Semantic |
| Visual Basic .NET | .vb |
.NET Roslyn (Microsoft.CodeAnalysis.VisualBasic) |
Semantic |
| ASP.NET Core | .cs |
Controller, Minimal API & DI Enhancer | Semantic |
| Blazor & Razor | .razor, .cshtml |
Scoped CSS & Companion Code-Behind Enhancer | SyntaxAware + CompanionFile |
| TypeScript | .ts, .mts, .cts |
TypeScript Compiler API 5.9.3 | Semantic |
| JavaScript | .js, .mjs, .cjs |
TypeScript Compiler API 5.9.3 | Semantic |
| React | .jsx, .tsx |
React Component, Hook & Context Enhancer | Semantic + SyntaxAware |
| Angular | .ts, .html, .scss |
Angular @Component, templateUrl, styleUrls |
Semantic + CompanionFile |
| Vue SFC | .vue |
Single-File Component Parser (single file in output) | SyntaxAware |
| HTML | .html, .htm |
HTML Syntax Analyzer (scripts, module scripts, styles) | SyntaxAware |
| CSS, SCSS, Sass | .css, .scss, .sass |
SCSS & Sass Syntax Parser (@import, @use, partials) |
SyntaxAware |
| Python | .py |
Python 3 ast & tokenize Worker |
Semantic |
| Java | .java |
Java Syntax & Maven/Gradle Project Analyzer | SyntaxAware |
| Go | .go |
Go Packages & go.mod Syntax Analyzer |
SyntaxAware |
| JSON / YAML Config | .json, .yaml, .yml |
Explicitly Referenced Configuration Analyzer | ImportGraph |
💻 CLI Quickstart
Build the Solution
dotnet build
The compiled CLI wrapper is located at ./bin/aicontext.
Usage Examples
# 1. Analyze C# Service with unlimited token budget
./bin/aicontext generate --file src/Application/Customers/CustomerService.cs
# 2. Analyze Angular Component with HTML template and SCSS partials
./bin/aicontext generate --file src/app/customers/customer.component.ts --framework angular
# 3. Analyze React Component with a 64k token budget and auto comment stripping
./bin/aicontext generate --file src/components/CustomerPage.tsx --max-tokens 64000 --comments auto
# 4. Analyze Python module and output machine-readable JSON metadata
./bin/aicontext generate --file app/services/customer_service.py --format json
# 5. Check active language workers
./bin/aicontext check-workers
Options Reference
Usage:
aicontext generate --file <path> [options]
aicontext check-workers
Required:
--file <path> Target source file to analyze
Options:
--workspace <path> Workspace root directory boundary
--project <path> Explicit project file (.csproj, tsconfig.json, etc.)
--symbol <qualified-name> Specific class, function, or symbol to select as root
--output <path> Destination Markdown file path
--max-tokens <int> Token budget (omitted means unlimited)
--max-depth <int> Maximum dependency traversal depth (omitted means unlimited)
--comments preserve|remove|auto Comment preservation policy (default: preserve)
--language <lang> Force specific language analyzer
--framework <fw> Force specific framework adapter
--analysis-level <level> Best, Semantic, SyntaxAware, ImportGraph
--task <text> Custom prompt task heading
--include-tests <bool> Include test files (default: false)
--include-generated <bool> Include generated files (default: false)
--include-attributes <bool> Include attributes/decorators (default: false)
--include-companions <bool> Include companion templates/styles (default: true)
--include-config <bool> Include configuration files (default: true)
--save <bool> Write result to file (default: true)
--copy <bool> Copy result to clipboard (default: false)
--format text|json Output format (default: text)
--omit-timestamp Omit generation timestamp for deterministic golden testing
--verbose Enable verbose diagnostic logging
--help Display help message
--version Display version information
🔌 VS Code Extension Guide
Generate clean, dependency-aware AI prompts directly inside your editor with single-click ease.
How to Use
1. Right-Click in the File Explorer (Fastest)
- Right-click any source file in the Explorer tree (
.cs,.ts,.tsx,.razor,.py,.java,.go, etc.). - Click AI Prompt: Generate from Current File.
- The extension automatically traverses direct and transitive dependencies, links companion templates/styles, strips internal noise, and opens the clean prompt in a new editor tab ready to copy into your AI chat.
2. Right-Click Inside Code (Targeted Symbol)
- Place your cursor on any class name, interface, method, or function.
- Right-click and choose AI Prompt: Generate from Symbol at Cursor.
- Generates a focused prompt centered on that specific symbol and its required dependency tree.
3. Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
- Press
Ctrl+Shift+Pand typeAI Promptto see all available actions. - Choose AI Prompt: Generate with Options... to open an interactive QuickPick wizard to set:
- Token budget limits (e.g. 16k, 32k, 64k, 128k)
- Maximum traversal depth
- Comment stripping policy (
Preserve,Remove, orAuto) - Task description to pre-populate for the consuming AI
Commands Reference
| Command | Title | Action |
|---|---|---|
aiPromptContextBuilder.generateFromFile |
AI Prompt: Generate from Current File | Analyzes the active file and all transitive dependencies |
aiPromptContextBuilder.generateFromSymbol |
AI Prompt: Generate from Symbol at Cursor | Centers analysis on the selected class/function symbol |
aiPromptContextBuilder.generateWithOptions |
AI Prompt: Generate with Options... | Opens interactive wizard for budget, depth, and comment policy |
aiPromptContextBuilder.generateAndCopy |
AI Prompt: Generate and Copy to Clipboard | Generates prompt and copies directly to clipboard |
aiPromptContextBuilder.generateAndSave |
AI Prompt: Generate and Save to File | Generates and saves directly to disk |
aiPromptContextBuilder.openLastGenerated |
AI Prompt: Open Last Generated Prompt | Re-opens the most recent context prompt in the editor |
aiPromptContextBuilder.showDependencyPreview |
AI Context: Show Dependency Preview | Displays an ASCII tree notification of discovered dependencies |
aiPromptContextBuilder.checkWorkers |
AI Context: Check Language Workers | Verifies compiler health across .NET Roslyn, Node.js, and Python |
🎥 Adding Animated GIF Demos to the Marketplace & GitHub
The VS Code Marketplace and GitHub READMEs support animated .gif files natively! To show an animated walkthrough:
- Record a short 5–10 second clip of yourself:
- Right-clicking a file in the VS Code explorer.
- Selecting AI Prompt: Generate from Current File.
- Showing the clean markdown prompt opening in the editor and pasting it into your AI chat.
- Recommended Free Screen-to-GIF Tools:
- Linux: Peek (
sudo apt install peek) or Kooha - Windows: ScreenToGif (super clean editor)
- macOS: Kap or Gifski
- Linux: Peek (
- Drop the GIF into
docs/images/demo.gifand embed it in yourREADME.md:
Extension Settings (aiPromptContextBuilder.*)
Customize default behavior in Settings (Ctrl+, -> search aiContextBuilder):
{
"aiPromptContextBuilder.executablePath": "aicontext",
"aiPromptContextBuilder.defaultTokenBudget": null,
"aiPromptContextBuilder.commentMode": "Preserve",
"aiPromptContextBuilder.includeCompanionFiles": true,
"aiPromptContextBuilder.includeTests": false,
"aiPromptContextBuilder.includeGeneratedFiles": false,
"aiPromptContextBuilder.openAfterGeneration": true
}
🔒 Security & Privacy Guarantee
- Zero Cloud Leakage: No remote AI API calls, telemetry, or external network requests.
- Preflight Secret Scanner: Inspects candidate files before inclusion for private keys, AWS/Slack/GitHub keys, and database connection strings with passwords. Secret values are never printed to logs or Markdown files.
- Path Traversal Protection: Canonicalizes all file paths and enforces strict workspace boundaries. Symlinks escaping the workspace and
.gitinternals are automatically rejected.
🧪 Testing & Debugging
The repository features comprehensive automated acceptance tests and step-by-step developer debugging tools:
- Run Acceptance Tests:
dotnet run --project tests/AiPromptContextBuilder.Tests.csproj - VS Code F5 Debugging: Pre-configured
.vscode/launch.jsonfor stepping through CLI execution and tests. - Detailed Guide: See
docs/testing-and-debugging.mdfor worker pipe debugging, AST inspection, and golden-file regression workflows.
📚 Documentation Index
- Architecture Design & Data Flow
- Language Adapter Contract
- Dependency Semantics & Importance Scoring
- Security & Workspace Boundaries
- Supported Languages Reference
- Testing and Debugging Guide
- Visual Studio Extension Plan (VSIX)
- Known Limitations & Transparent Disclosures
👤 Author & Maintainer
Welcome Bonginhlahla Sithole
📍 South Africa, KwaZulu Natal
🔗 GitHub: @SitholeWB
📦 VS Code Marketplace: sitholewb
📄 License
Distributed under the MIT License.