An AI-powered VS Code extension that provides context-aware code suggestions based on your own GitHub repositories.
GhostDev is not another "vibe coding" tool. It's a sophisticated code assistant that learns from your coding patterns and repositories to provide personalized suggestions and refinements. By analyzing your selected GitHub repositories, GhostDev understands your coding style and project architecture to deliver contextually relevant improvements.
%%{init: {"theme": "base", "themeVariables": { "primaryColor": "#ffffff", "edgeLabelBackground":"#ffffff", "tertiaryColor": "#ffffff", "secondaryColor": "#ffffff", "primaryBorderColor":"#000000", "lineColor":"#000000", "textColor":"#000000"}}}%%
mindmap
root((GhostDev))
Project Setup
Project Naming
Description Input
Tech Stack Selection
GitHub Integration
AI-Powered Generation
Boilerplate Structure
Directory Generation
File Scaffolding
Commit Message Suggestion
Smart Code Refinement
Git Diff Tracking
Automated Suggestions
Accept / Reject / Modify
Customization
Custom Prompts
Prompt Configuration
Fine-tuned Control
flowchart TD
Start([User Opens Extension]) --> A[Enter Project Details]
A --> B[Project Name]
A --> C[Project Description]
A --> D[Select Tech Stack]
D --> E{GitHub Connected?}
E -->|No| F[Connect GitHub Account]
F --> G
E -->|Yes| G[Fetch User Repositories]
G --> H[Display Repository List]
H --> I[User Selects Reference Repos]
I --> J[Click OK/Generate]
J --> K[API Call to Gemini]
K --> L[Generate Boilerplate Structure]
L --> M[Create Directory Structure]
M --> N[Files Generated]
N --> O[User Writes Code]
O --> P[User Commits Code]
P --> Q[User Stages New Changes]
Q --> R[Git Add Detected]
R --> S[GhostDev Triggered]
S --> T[Calculate Git Diff]
T --> U[Staged vs Last Commit]
U --> V{Custom Prompts Exist?}
V -->|Yes| W[Load .ghostdev/prompts.json]
V -->|No| X[Use Default Prompts]
W --> Y[API Call with Context]
X --> Y
Y --> Z[Gemini Analyzes Changes]
Z --> AA[Generate Suggestions]
AA --> AB[Display in UI]
AB --> AC{User Action?}
AC -->|Accept| AD[Apply Changes]
AC -->|Reject| AE[Discard Suggestions]
AC -->|Modify| AF[Edit & Apply]
AD --> O
AE --> O
AF --> O
sequenceDiagram
participant User
participant VSCode
participant GhostDev
participant GitHub
participant Gemini
participant FileSystem
User->>VSCode: Open Extension
VSCode->>GhostDev: Activate Extension
User->>GhostDev: Enter Project Details
GhostDev->>GitHub: Request Repository List
GitHub-->>GhostDev: Return Repositories
User->>GhostDev: Select Repos & Confirm
GhostDev->>Gemini: Generate Structure Request
Note over Gemini: Analyzes repos + tech stack
Gemini-->>GhostDev: Directory Structure JSON
GhostDev->>FileSystem: Create Directories & Files
FileSystem-->>User: Boilerplate Ready
User->>FileSystem: Write Code & Commit
User->>VSCode: Git Add (Stage Changes)
VSCode->>GhostDev: File Watcher Triggered
GhostDev->>VSCode: Get Git Diff
VSCode-->>GhostDev: Diff Data
GhostDev->>FileSystem: Check Custom Prompts
FileSystem-->>GhostDev: prompts.json (if exists)
GhostDev->>Gemini: Analyze Changes + Context
Gemini-->>GhostDev: Code Suggestions
GhostDev->>User: Display Suggestions
User->>GhostDev: Accept/Reject/Modify
GhostDev->>FileSystem: Apply Changes (if accepted)
- Node.js (v14 or higher)
- VS Code (latest version)
- GitHub account
- Gemini API key
Create .vscode/launch.json
in your project root:
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: compile"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "npm: compile"
}
]
}
npm install
- Open
extension.ts
- Press
F5
to start debugging - A new VS Code window will open with your extension loaded
You can override GhostDev's default behavior by creating a custom prompts file at
.ghostdev/prompts.json
in your project's root directory.
The extension will look for specific keys in this file.
If a key is not found, a built-in default prompt will be used.
Here are the prompts you can customize and the placeholders that will be replaced with dynamic data.
Used to generate a conventional commit message for your staged changes.
Placeholders:
{{diffDataAsJson}}
: Will be replaced with a JSON string representing the staged files, each with a name and diff.
Used to refactor the code in your staged files.
Placeholders:
{{persona}}
: A JSON string describing the project's coding style and conventions.{{diffDataAsJson}}
: The same JSON string of staged file diffs as above.
Used to generate the initial project structure when initializing a new project.
Placeholders:
{{projectName}}
: The name of the project.{{projectDescription}}
: The description of the project.{{techStack}}
: A comma-separated string of the selected technologies (e.g.,"React, Node.js, Tailwind CSS"
).{{persona}}
: The same coding style persona as above.
{
"suggestComment": "You are a git expert. Write a concise, imperative commit message for the following changes. Your response must be only the message string.\n\nChanges:\n```json\n{{diffDataAsJson}}\n```",
"codeRefinement": "As a principal engineer, refactor the code described in the diff below. Adhere to the user's coding style. Only return a JSON array of the refined files.\n\nUser Persona:\n{{persona}}\n\nStaged Files:\n```json\n{{diffDataAsJson}}\n```",
"generateFileStructure": "Create a complete file and directory structure as a single JSON object for a new project.\n\nProject: {{projectName}}\nDescription: {{projectDescription}}\nTech: {{techStack}}\n\nFollow this coding style:\n{{persona}}"
}
ghostdev/
βββ π src/
β βββ π extension.ts # Entry point
β βββ π git.d.ts
β βββ π assets/
β β βββ techStackData.ts
β βββ π utils/
β β βββ githubUtils.ts
β β βββ geminiUtils.ts
β β βββ promptUtils.ts
β β βββ terminalUtils.ts
β β βββ gitUtils.ts
βββ π .vscode/
β βββ π launch.json
βββ π package.json
βββ π .env
βββ π tsconfig.json
βββ π README.md
journey
title GhostDev First-Time User Journey
section Setup
Install Extension: 3: User
Configure GitHub: 4: User
Add API Key: 3: User
section First Project
Create New Project: 5: User
Select Repositories: 5: User
Generate Structure: 5: System
section Development
Write Code: 5: User
Stage Changes: 4: User
Review Suggestions: 5: User, System
Apply Refinements: 5: User
section Advanced
Add Custom Prompts: 4: User
Fine-tune Settings: 4: User
MIT License - see LICENSE file for details
Built with:
- π€ Google Gemini AI
- π GitHub API
- π» VS Code Extension API
- β‘ TypeScript
Made with love by MDGSpace
β Star us on GitHub | π Get Started | π Documentation