Code Indexing

Code indexing is the process of uploading your codebase's structure and content to DPage. This enables AI-powered search, analysis, and RAG for generating dynamic components.

Indexing Features

šŸ“‚

Recursive Scanning

Automatically scans nested directories for supported code files.

✨

Change Detection

Uses SHA-1 hashing to only re-index files that have actually changed.

šŸ›”ļø

Smart Filtering

Automatically excludes node_modules, build artifacts, and hidden files.

šŸš€

Batch Processing

Handles large codebases by uploading files in optimized batches.

Index Your Code

Once your project is linked, indexing is a single command:

Terminal
dpage code index

The CLI will scan your directory, calculate hashes, and upload chunks to the server for embedding.

Advanced Indexing

Specific Directory

By default, the CLI indexes the current directory. Use --dir to index a specific path:

Terminal
dpage code index --dir ./src

Exclude Patterns

Add custom exclusion patterns using --exclude:

Terminal
dpage code index --exclude test legacy scripts

Without Linking

If you don't want to link the directory, you must provide IDs manually:

Terminal
dpage code index -o org_123 -p proj_456

Check Indexing Status

To see statistics about what has been indexed for your project, use:

Terminal
dpage code status

Example output:

Text
šŸ“Š Code Indexing Status
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Organization: Acme Corp
Project: My Website

Files indexed: 150
Code chunks: 543
Total size: 2.34 MB
Last indexed: 11/13/2025, 10:30:00 AM
Languages: ts, tsx, js
How it works: The server breaks your files into semantic chunks (like functions and classes) and generates vector embeddings. These embeddings are then used by the DPage AI to find relevant code snippets when generating dynamic components.

Best Practices

  • Index regularly: Re-index after significant code changes to keep the AI updated.
  • Include relevant files: Ensure your src directory is indexed so the AI understands your components and hooks.
  • Exclude binaries: Don't index large non-code files (images, PDFs, etc.) as it wastes bandwidth and indexing quota.