Skip to main content

Module project

Module project 

Source
Expand description

Project root lifecycle management (per PROJECT_ROOT_SPEC.md) Project root lifecycle management

This module implements the behaviors defined in docs/architecture/PROJECT_ROOT_SPEC.md:

  • ProjectManager: Routes file paths to Projects based on ProjectRootMode
  • Project: Owns a CodeGraph, file table, and caches for one index root
  • RepoId: Tracks which git repository each file belongs to

§Architecture Overview

┌─────────────────────────────────────────────────────────────┐
│                      ProjectManager                         │
│  - mode: ProjectRootMode                                    │
│  - projects: HashMap<ProjectId, Arc<Project>>               │
│  - workspace_folders: Vec<PathBuf>                          │
└─────────────────────────────────────────────────────────────┘
                             │
                             │ project_for_path()
                             ▼
┌─────────────────────────────────────────────────────────────┐
│                         Project                             │
│  - id: ProjectId                                            │
│  - index_root: PathBuf                                      │
│  - graph: CodeGraph                                         │
│  - repo_index: HashMap<PathBuf, RepoId>                     │
│  - file_table: HashMap<StringId, FileEntry>                 │
└─────────────────────────────────────────────────────────────┘

§Modes

  • GitRoot (default): Each git repository gets its own Project
  • WorkspaceFolder: Each VS Code workspace folder gets a Project
  • WorkspaceRoot: Single Project covering all workspace folders

§Lifecycle

  1. Create: On first file routed to an index_root
  2. Initialize: Empty graph, caches, watchers
  3. Build: Full index scan
  4. Update: Incremental updates on file changes
  5. Destroy: On workspace removal or shutdown

Re-exports§

pub use manager::Project;
pub use manager::ProjectManager;
pub use path_utils::DEFAULT_IGNORED_DIRS;
pub use path_utils::absolutize_without_resolution;
pub use path_utils::canonicalize_path;
pub use path_utils::is_ignored_dir_with_config;
pub use path_utils::normalize_path_components;
pub use repo_detection::detect_repos_under;
pub use repo_detection::lookup_git_root;
pub use repo_detection::lookup_repo_id;
pub use resolver::canonicalize_and_resolve;
pub use resolver::find_git_root;
pub use resolver::resolve_index_root;
pub use types::FileEntry;
pub use types::ProjectError;
pub use types::ProjectId;
pub use types::ProjectRootMode;
pub use types::RepoId;
pub use types::StringId;

Modules§

manager
Project lifecycle management with thread-safe access
path_utils
Path canonicalization and resolution utilities for Project root handling
persistence
Project state persistence
repo_detection
Repository detection within a project index root
resolver
Root resolution logic for determining Project boundaries
types
Foundation types for Project root lifecycle management