Workspace Template Manager

Overview

The Workspace Template Manager is a core module of the Dev Center designed to simplify the management of VS Code extension suggestions, template files, and workspace settings across multiple repositories.

It provides a centralized suite for creating, maintaining, and syncing project configurations, ensuring consistency across projects while reducing manual maintenance overhead.

Core Features

Template Creation

  • Generate standardized template files for various tech stacks (Next.js, D, Python, etc.).

  • Create base .code-workspace files with pre-configured settings and extension recommendations.

Settings Synchronization

  • Sync settings from a central template repository to specific project repositories.

  • Support for partial or full synchronization of:

    • *.code-workspace files (Preferred for global standards to ensure precedence)

    • .vscode/settings.json (Local overrides)

    • .vscode/extensions.json

    • Project-specific configuration files (e.g., .prettierrc, .hintrc)

Repository Integration

  • Apply templates to newly created repositories.

  • Retroactively update existing repositories with new template standards.

  • Detect and resolve configuration drift between repositories and their source templates.

Usage Scenarios

  1. New Project Onboarding: A developer starts a new Next.js project. They use the Dev Center to apply the "Next.js Template," which automatically populates the repository with the correct .vscode settings and recommended extensions.

  2. Global Standard Update: A new "must-have" extension is added to the organization-wide standards. The Workspace Template Manager pushes this update to all relevant repositories' .code-workspace files.

  3. Tech Stack Migration: Moving a project from one set of standards to another (e.g., updating formatting rules) is handled via a guided sync process.

    • Define template schema for multi-stack support.

    • Implement file copying and merging logic for JSON-based configurations.

    • Create a CLI or GUI interface within Dev Center for managing sync tasks.

    • Integrate with GitHub API to automate template application during repo creation.

Implementation Details

The manager is implemented as a set of D-language modules within the dev_center source tree:

  • modules.template_installer.installer: Handles the local cache of the templates repository, performing Git-based updates with a 24-hour freshness check.

  • modules.template_installer.project_manager: Bridges the template installer with the ProjectRecognizer. It enables stack-to-template mapping and the "Save as Template" functionality.

  • DevCenterApp (DlangUI): Orchestrates the user interface for browsing the template library and managing project-specific workspace configurations.