feat(ai): add assistant context and command history#12
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds AI assistant functionality to DubStack, enabling context-aware help through Google Gemini integration. It includes command history tracking with sensitive data redaction, repository-local configuration management, and utilities for setting up AI API keys.
Changes:
- Implements command history capture system that records all dub commands with output redaction for sensitive data (API keys, tokens, etc.)
- Adds AI assistant with context collection (branch state, git status, doctor output, recent command history) and streaming chat interface
- Introduces repo-local configuration for enabling/disabling the AI assistant per repository
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/history.ts | Command history tracking with JSONL storage and sensitive data redaction patterns |
| src/lib/history.test.ts | Tests for history append/read, command arg sanitization, and text redaction |
| src/lib/config.ts | Repo-local config management (stored in .git/dubstack/config.json) |
| src/lib/config.test.ts | Tests for config read/write and error handling |
| src/lib/ai-context.ts | Collects repository context (branch, stack, doctor, history) for AI assistant |
| src/lib/ai-context.test.ts | Tests for context collection and prompt building |
| src/commands/history.ts | Command to display recent dub history with formatting |
| src/commands/history.test.ts | Tests for history command output formatting |
| src/commands/config.ts | Command to enable/disable AI assistant |
| src/commands/config.test.ts | Tests for config command state management |
| src/commands/ai.ts | AI assistant with Google Gemini and AI Gateway provider support |
| src/commands/ai.test.ts | Tests for AI provider selection and streaming output |
| src/commands/ai-env.ts | Utility to write API keys to shell profile files |
| src/commands/ai-env.test.ts | Tests for env command with profile updates |
| src/index.ts | CLI command registration and history capture hooks (preAction/postAction) |
| package.json | Adds @ai-sdk/google and ai dependencies |
| pnpm-lock.yaml | Lockfile updates for AI SDK dependencies |
| pnpm-workspace.yaml | Explicitly adds packages field for workspace config |
| README.md | Documentation for new AI commands (config, ask, env, history) |
| QUICKSTART.md | Quick start guide for enabling and using AI assistant |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🥞 DubStack