This document describes the organization and structure of the CodIn VS Code extension project.
CodIn/
├── .github/ # GitHub configuration
│ ├── ISSUE_TEMPLATE/ # Issue templates
│ │ ├── bug_report.yml # Bug report template
│ │ └── feature_request.yml # Feature request template
│ └── workflows/ # GitHub Actions
│ ├── ci.yml # Continuous integration
│ └── release.yml # Release automation
├── .vscode/ # VS Code workspace settings
├── landing-page/ # Marketing/landing page
├── node_modules/ # Dependencies (generated)
├── out/ # Compiled output (generated)
├── src/ # Source code
│ └── extension.ts # Main extension entry point
├── .env.example # Environment variables template
├── .eslintrc.json # ESLint configuration
├── .gitignore # Git ignore rules
├── .vscodeignore # VS Code packaging ignore
├── CHANGELOG.md # Version history
├── CONTRIBUTING.md # Contribution guidelines
├── LICENSE # MIT license
├── README.md # Main documentation
├── SECURITY.md # Security policy
├── package.json # Node.js project configuration
└── tsconfig.json # TypeScript configuration
Main extension entry point containing:
- Extension activation and deactivation logic
- Command registration and implementations
- CodeLens and CodeAction providers
- API key management functions
- AI explanation logic with OpenAI integration
- Webview content generation
- Multi-language support
Extension manifest defining:
- Extension metadata (name, version, publisher)
- VS Code engine compatibility
- Command contributions and menus
- Activation events and categories
- Dependencies and scripts
- Marketplace information
TypeScript compiler configuration:
- Target ES2020 for modern JavaScript features
- CommonJS modules for Node.js compatibility
- Source maps for debugging
- Strict type checking enabled
ESLint configuration for code quality:
- TypeScript-specific rules
- Best practices enforcement
- Code style consistency
- Import/export validations
Packaging exclusions:
- Source TypeScript files (only compiled JS included)
- Development and test files
- Documentation (except essential files)
- Node.js development dependencies
Version control exclusions:
- Node.js dependencies
- Compiled output
- Temporary and cache files
- Environment variables and secrets
Primary documentation including:
- Feature overview and screenshots
- Installation instructions
- Usage examples and tutorials
- Configuration options
- Troubleshooting guide
Version history with:
- Feature additions and improvements
- Bug fixes and security patches
- Breaking changes and migrations
- Release dates and version numbers
Developer guidelines covering:
- Development environment setup
- Code style and conventions
- Pull request process
- Testing requirements
- Issue reporting templates
Security policy detailing:
- Vulnerability reporting process
- Supported versions for security updates
- Security best practices for users
- Data privacy and protection measures
MIT license for open source usage
Template for environment variables:
- OpenAI API key configuration
- Development settings
- Local testing parameters
ci.yml: Continuous integration pipeline- Multi-version Node.js testing
- TypeScript compilation
- Linting and code quality checks
- Extension packaging
release.yml: Automated release process- Version tagging
- VSIX generation
- GitHub release creation
- Marketplace publishing
bug_report.yml: Structured bug reportingfeature_request.yml: Feature suggestion format
- Source: Write TypeScript in
src/ - Compile:
npm run compile→ generatesout/extension.js - Package:
npm run package→ creates.vsixfile - Test: Install VSIX in VS Code for testing
- Version: Update version in
package.json - Changelog: Document changes in
CHANGELOG.md - Tag: Create git tag (
v1.2.3) - Automate: GitHub Actions handles building and publishing
- TypeScript: Primary programming language
- Node.js: Runtime environment
- VS Code Extension API: Platform integration
- OpenAI API: GPT-3.5-turbo for code explanations
- Fetch API: HTTP client for API requests
- VS Code Secret Storage: Secure API key management
- ESLint: Code linting and quality
- TypeScript Compiler: Code compilation
- VSCE: VS Code extension packaging
- GitHub Actions: CI/CD automation
- VS Code loads extension on startup (universal activation)
- Commands registered in extension.ts
- Providers registered for CodeLens and Quick Actions
- Event listeners established for UI updates
- User selects code in editor
- CodeLens button appears above selection
- User clicks button or uses context menu
- Extension validates API key
- Code sent to OpenAI API
- Explanation displayed in webview panel
- API keys stored in VS Code Secret Storage (encrypted)
- No plain text storage of sensitive data
- Minimal data transmission (selected code only)
- HTTPS-only communication with OpenAI
code --install-extension codin-1.2.3.vsixvsce publish -p $PERSONAL_ACCESS_TOKEN- Push to
mainbranch triggers CI/CD - Successful builds auto-publish to marketplace
- Releases created automatically from git tags
This structure ensures maintainability, security, and ease of development while providing a professional user experience.