This document provides guidance for AI agents (such as Kiro, Claude, ChatGPT, etc.) when developing the Git Worktree Manager extension.
Git Worktree Manager is a VSCode extension designed to simplify Git worktree management. It allows developers to work on different branches of the same repository in parallel without frequently switching branches or dealing with stash operations.
- Worktree Management: Create, delete, and switch Git worktrees
- Workspace Integration: Add worktrees to VSCode workspace
- Favorites System: Save frequently used worktrees for quick access
- Multi-language Support: Supports English, Simplified Chinese, Traditional Chinese, and Japanese
- Terminal Integration: Open terminals in specified directories
- Branch Management: Create worktrees from branches, switch branches, etc.
- Language: TypeScript
- Framework: VSCode Extension API
- Build Tool: Rspack
- Package Manager: pnpm
- Internationalization: VSCode l10n
├── src/
│ ├── core/ # Core functionality modules
│ ├── constants.ts # Constants definition
│ ├── extension.ts # Extension entry point
│ └── types.ts # Type definitions
├── l10n/ # Internationalization files
├── images/ # Icons and demo videos
├── package.json # Extension configuration and command definitions
└── dist/ # Build output
- Use TypeScript strict mode
- Follow ESLint and Prettier configurations
- Use meaningful variable and function names
- Add appropriate comments, especially for complex Git operations
- Use
vscode.commands.registerCommandto register commands - Define UI elements through the
contributessection inpackage.json - Use TreeDataProvider to implement tree views
- Handle async operations and errors properly
- Use
child_processto execute Git commands - Always check Git command exit codes
- Provide meaningful error messages
- Support path handling for different operating systems
- All user-visible strings should be internationalized
- Use
vscode.l10n.t()for translations - Maintain translation files in the
l10n/directory
- Read configuration through
vscode.workspace.getConfiguration() - Define configuration items in
package.json - Provide reasonable default values
- Define the command in
package.jsonundercontributes.commands - Implement command logic in the appropriate module
- Register the command in
extension.tsor related modules - Add necessary internationalization strings
- Update the
contributesconfiguration inpackage.json - Modify the corresponding TreeDataProvider or WebView
- Update related icons and styles
- Define in
package.jsonundercontributes.configuration - Read using
vscode.workspace.getConfiguration()in code - Add internationalization strings for configuration descriptions
- Test on different operating systems (Windows, macOS, Linux)
- Test various Git repository states (clean, with uncommitted changes, etc.)
- Verify correct display of internationalized strings
- Test error handling and edge cases
- Use VSCode's Extension Development Host for debugging
- Check extension logs in the "Output" panel
- Use
console.logorlogger.logfor debug output - Examine Git command output and error messages
- Update version number (
package.json) - Update
CHANGELOG.md - Run tests to ensure functionality
- Build extension package:
vsce package - Publish to VSCode Marketplace
- Follow existing code style and architecture
- Add appropriate tests for new features
- Update relevant documentation
- Ensure backward compatibility
- Provide clear PR descriptions
- VSCode Extension API
- Git Worktree Documentation
- VSCode Internationalization Guide
- Project GitHub Repository
- Always consider cross-platform compatibility
- Handle cases where Git repository doesn't exist or is corrupted
- Provide user-friendly error messages
- Maintain extension performance and responsiveness
- Follow VSCode UX guidelines