src.core.project_registry module#

Project Registry for Marcus Multi-Project Support.

Manages multiple project configurations across different providers (Planka, Linear, GitHub). Provides CRUD operations and persistence for project definitions.

class src.core.project_registry.ProjectConfig[source]#

Bases: object

Configuration for a single project.

id: str#
name: str#
provider: str#
provider_config: Dict[str, Any]#
created_at: datetime#
last_used: datetime#
tags: List[str]#
to_dict()[source]#

Convert to dictionary for persistence.

Return type:

Dict[str, Any]

classmethod from_dict(data)[source]#

Create from dictionary.

Return type:

ProjectConfig

Parameters:

data (Dict[str, Any])

__init__(id, name, provider, provider_config, created_at=<factory>, last_used=<factory>, tags=<factory>)#
Parameters:
Return type:

None

class src.core.project_registry.ProjectRegistry[source]#

Bases: object

Registry for managing multiple projects.

Provides CRUD operations and persistence for project configurations. Uses the existing Persistence layer for storage.

COLLECTION = 'projects'#
ACTIVE_PROJECT_KEY = 'active_project'#
__init__(persistence=None)[source]#

Initialize the project registry.

Parameters:

persistence (Optional[Persistence]) –

Optional persistence instance. If not provided,.

creates a new one with file backend.

async initialize()[source]#

Initialize the registry and load active project.

Return type:

None

async add_project(config)[source]#

Add a new project to the registry.

Parameters:

config (ProjectConfig) – Project configuration.

Return type:

str

Returns:

Project ID

async get_project(project_id)[source]#

Get a project by ID.

Parameters:

project_id (str) – Project ID.

Return type:

Optional[ProjectConfig]

Returns:

Project configuration or None if not found

async list_projects(filter_tags=None, provider=None)[source]#

List all projects with optional filtering.

Parameters:
  • filter_tags (Optional[List[str]]) – Only return projects with these tags.

  • provider (Optional[str]) – Only return projects using this provider.

Return type:

List[ProjectConfig]

Returns:

List of project configurations

async update_project(project_id, updates)[source]#

Update a project configuration.

Parameters:
  • project_id (str) – Project ID.

  • updates (Dict[str, Any]) – Fields to update.

Return type:

bool

Returns:

True if successful

async delete_project(project_id)[source]#

Delete a project from the registry.

Parameters:

project_id (str) – Project ID.

Return type:

bool

Returns:

True if successful

async set_active_project(project_id)[source]#

Set the active project.

Parameters:

project_id (str) – Project ID to make active.

Return type:

bool

Returns:

True if successful

async get_active_project()[source]#

Get the currently active project.

Return type:

Optional[ProjectConfig]

Returns:

Active project configuration or None

async create_from_legacy_config(legacy_config)[source]#

Create a project from legacy single-project configuration.

Parameters:

legacy_config (Dict[str, Any]) – Legacy configuration dictionary.

Return type:

str

Returns:

Created project ID