Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 1.72 KB

File metadata and controls

62 lines (42 loc) · 1.72 KB

Shadow Docs

Auto-generate documentation from git changes using AI.

What It Does

Shadow Docs watches your git repository and automatically generates documentation summaries whenever you make commits. It uses Google's Gemini AI to analyze code changes and create concise summaries.

The Workflow

  1. Initial Sync: Creates a baseline snapshot of your project state
  2. On Changes: Detects new commits and extracts the diff
  3. AI Analysis: Sends project structure + existing docs + new changes to Gemini
  4. Documentation: Generates and updates documentation based on changes
  5. State Tracking: Saves the current state for next sync

How To Use

Setup

# Install dependencies
npm install

# Create .env file with your Gemini API key
echo "GOOGLE_GEMINI_API_KEY=your_key_here" > .env#

Run

npm run build    # Compile TypeScript

#To create strucutre run this command
npx tsx src/index.ts sync

How NOT To Use

Don't run sync with uncommitted changes - the tool will exit with an error
Don't forget to set GOOGLE_GEMINI_API_KEY in .env
Don't modify .shadow-lock file manually
Don't run on non-git repositories
Don't use without committing changes first

Project Structure

  • src/lib/ai.ts - Gemini API integration and prompt handling
  • src/lib/git.ts - Git command wrapper for diffs and project structure
  • src/commands/sync.ts - Main sync logic
  • src/utils/store.ts - Persistent state management
  • docs/ - Generated documentation

Key Features

  • ✅ Automatic documentation generation
  • ✅ Maintains documentation history
  • ✅ Lightweight state tracking
  • ✅ Excludes node_modules and lock files
  • ✅ Colored console output