Skip to main content

Overview

Chapi Assistant provides comprehensive workspace management to handle multiple .NET WPF projects simultaneously. Easily switch between projects, track their status, and maintain an organized development environment.
Workspace management is built on the IProjectRepository interface, which persists project information and preferences.

Loading Projects

Get All Projects

Retrieve all projects registered in your workspace:
var result = await loadProjectsUseCase.ExecuteAsync();

if (result.IsSuccess)
{
    var projects = result.Value;
    foreach (var project in projects)
    {
        Console.WriteLine($"{project.Name} - {project.Path}");
    }
}
Load and display all projects:
var result = await loadProjectsUseCase.ExecuteAsync();

if (result.IsSuccess)
{
    var projects = result.Value;
    
    if (!projects.Any())
    {
        Console.WriteLine("No projects in workspace");
    }
    else
    {
        Console.WriteLine($"Found {projects.Count()} projects");
    }
}
else
{
    Console.WriteLine($"Error: {result.Error}");
}

Switching Projects

Switch Active Project

Change the currently active project in your workspace:
var result = await switchProjectUseCase.ExecuteAsync(
    projectPath: @"C:\Projects\CustomerApp"
);

if (result.IsSuccess)
{
    var project = result.Value;
    Console.WriteLine($"Switched to: {project.Name}");
}
projectPath
string
required
Full path to the project directory to switch to.
1

Validate Path

Ensures the project path is valid and the directory exists.
2

Retrieve Project

Fetches project information from the repository.
3

Update Active State

Marks the project as the currently active workspace.
4

Return Project

Returns the Project entity with all metadata.

Project Validation

// Validates:
// - Path is not null or whitespace
// - Directory exists on filesystem
// - Project is registered in workspace

if (string.IsNullOrWhiteSpace(projectPath))
    return Result<Project>.Fail("La ruta del proyecto no puede estar vacía");

if (!Directory.Exists(projectPath))
    return Result<Project>.Fail("El directorio no existe");
var project = await _projectRepository.GetProjectAsync(projectPath);

if (project == null)
    return Result<Project>.Fail("Proyecto no encontrado");
The project must be previously registered in the workspace.

Adding Projects

Register New Project

Add an existing project to your workspace:
var result = await addProjectUseCase.ExecuteAsync(
    projectPath: @"C:\Projects\ExistingApp"
);

if (result.IsSuccess)
{
    Console.WriteLine("Project added to workspace");
}
var result = await addProjectUseCase.ExecuteAsync(
    @"C:\Projects\MyApp"
);

if (result.IsSuccess)
{
    // Project is now tracked in workspace
    await RefreshProjectList();
}

When to Add Projects

After Cloning

Add projects after cloning from Git repositories.

Existing Projects

Register existing projects not created with Chapi.

After Creation

Automatically added by CreateProjectUseCase.

Imported Projects

Add projects moved from other machines.

Removing Projects

Unregister Project

Remove a project from the workspace (doesn’t delete files):
var result = await removeProjectUseCase.ExecuteAsync(
    projectPath: @"C:\Projects\OldApp"
);
Removing a project from the workspace does not delete the project files. It only unregisters it from Chapi.

Project Indicators & Status

Update Project Status

Update project indicators like Git status, build status, etc.:
var result = await updateProjectIndicatorsUseCase.ExecuteAsync(
    projectPath: @"C:\Projects\MyApp"
);
This typically updates:
  • Git branch and status
  • Uncommitted changes count
  • Build status
  • Last modified time
  • Active status
Project indicators are refreshed automatically when switching projects or after Git operations.

Cloning Projects

Clone from Remote Repository

Clone a project and add it to the workspace:
var result = await cloneProjectUseCase.ExecuteAsync(
    remoteUrl: "https://github.com/myorg/myapp.git",
    localPath: @"C:\Projects\MyApp"
);
1

Clone Repository

Git clone from the remote URL to local path.
2

Register in Workspace

Automatically add the cloned project to workspace.
3

Update Indicators

Fetch initial project status and metadata.
4

Set as Active

Optionally switch to the newly cloned project.

Project Entity Structure

public class Project
{
    public string Path { get; set; }          // Full directory path
    public string Name { get; set; }          // Project name
    public bool IsActive { get; set; }        // Currently active?
    public DateTime LastAccessedDate { get; set; }
    public string CurrentBranch { get; set; } // Git branch
    public int UncommittedChanges { get; set; }
    public string BuildStatus { get; set; }
    // ... additional properties
}

Workspace Workflows

// 1. Load all projects
var projects = await loadProjectsUseCase.ExecuteAsync();

// 2. Switch to project you want to work on
await switchProjectUseCase.ExecuteAsync(
    @"C:\Projects\CustomerApp"
);

// 3. Work on the project...
// Generate code, commit changes, etc.

// 4. Update project status
await updateProjectIndicatorsUseCase.ExecuteAsync(
    currentProjectPath
);

// 5. Switch to another project when needed
await switchProjectUseCase.ExecuteAsync(
    @"C:\Projects\OrderApp"
);

Error Handling

var result = await loadProjectsUseCase.ExecuteAsync();

if (!result.IsSuccess)
{
    // "Error cargando proyectos: {message}"
    LogError(result.Error);
    
    // Fallback to empty workspace
    var emptyProjects = Enumerable.Empty<Project>();
}

Best Practices

  • Keep all projects in a consistent root directory (e.g., C:\Projects)
  • Use meaningful project names
  • Remove inactive projects from workspace
  • Regularly update project indicators
  • Commit or stash changes before switching
  • Update project status after significant changes
  • Use project switch as a context boundary
  • Close unnecessary file handles before switching
  • Periodically review and clean up old projects
  • Keep workspace list manageable (< 20 active projects)
  • Archive completed projects
  • Back up workspace configuration
  • Load projects asynchronously on startup
  • Cache project list in memory
  • Update indicators on-demand, not constantly
  • Use lazy loading for project details

Project Lifecycle

1

Creation or Addition

Project is created via CreateProjectUseCase or added via AddProjectUseCase.
2

Registration

Project is registered in the workspace repository with metadata.
3

Active Development

Switch to project, make changes, commit, generate code, etc.
4

Status Updates

Indicators are updated after operations (commits, builds, etc.).
5

Archival or Removal

Remove from workspace when no longer needed (files remain).

Integration with Other Features

Project Creation

Created projects are automatically added to workspace

Git Management

Git operations update project indicators and status

Code Generation

Code generation operates on the active project

Deployment & Releases

Deploy Project Release

Deploy a project release to production:
var result = await deployProjectReleaseUseCase.ExecuteAsync(
    projectPath: @"C:\Projects\MyApp",
    version: "1.0.0",
    environment: "Production"
);
Project deployment is integrated with workspace management to track release history and status.

Project Creation

Create new projects that get added to workspace

Git Management

Manage version control for workspace projects

Build docs developers (and LLMs) love