Skip to content

Commit 07eeb89

Browse files
committed
Update docs and spec
1 parent 84868c5 commit 07eeb89

9 files changed

Lines changed: 1111 additions & 56 deletions

File tree

docs/architecture.md

Lines changed: 112 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Overview
44

5-
Entity Manager is built with a modular architecture that separates concerns and allows for easy extension.
5+
Entity Manager is built with a modular, plugin-based architecture that separates the CLI interface from storage backends. This design allows easy extension with new storage systems while maintaining a consistent API.
66

77
## Project Structure
88

@@ -11,34 +11,130 @@ entity-manager/
1111
├── src/
1212
│ └── entity_manager/
1313
│ ├── __init__.py
14-
│ ├── cli.py # CLI interface
15-
│ ├── entities/ # Entity management
16-
│ ├── github/ # GitHub integration
17-
│ └── notion/ # Notion integration
18-
├── tests/ # Test suite
19-
├── docs/ # Documentation
20-
└── pyproject.toml # Project configuration
14+
│ ├── cli.py # Main CLI entry point
15+
│ ├── backend.py # Abstract backend interface
16+
│ ├── models.py # Data models (Entity, Link)
17+
│ ├── config.py # Configuration management
18+
│ ├── config_commands.py # Configuration CLI commands
19+
│ ├── link_commands.py # Link CLI commands
20+
│ └── backends/ # Backend implementations
21+
│ ├── github.py # GitHub Issues backend
22+
│ ├── notion.py # Notion Database backend
23+
│ ├── beads.py # Beads backend
24+
│ ├── backlog.py # Backlog.md backend
25+
│ ├── sqlite.py # SQLite backend
26+
│ ├── markdown.py # Markdown files backend
27+
│ └── redis.py # Redis backend
28+
├── tests/ # Test suite
29+
│ ├── backends/ # Backend-specific tests
30+
│ └── integration/ # Integration tests
31+
├── docs/ # Documentation
32+
├── spec/ # Feature specifications
33+
└── pyproject.toml # Project configuration
2134
```
2235

2336
## Core Components
2437

2538
### CLI Interface
2639

27-
The CLI is built using [Cyclopts](https://cyclopts.readthedocs.io/), providing a clean and intuitive command-line interface.
40+
The CLI is built using [Cyclopts](https://cyclopts.readthedocs.io/), providing a clean and intuitive command-line interface with:
2841

29-
### Entity Management
42+
- **Entity commands**: CRUD operations (create, read, update, delete, list)
43+
- **Link commands**: Relationship management (add, remove, list, tree, cycle)
44+
- **Config commands**: Configuration management (set, get, unset, list, init)
45+
- **Global options**: Log level control
3046

31-
Entities are the core abstraction in Entity Manager. Each entity represents a logical unit that can be tracked, managed, and synchronized across different platforms.
47+
### Data Models
3248

33-
### Integrations
49+
#### Entity
3450

35-
#### GitHub
51+
The `Entity` model represents a task, issue, or requirement with:
3652

37-
Entity Manager integrates with GitHub using the [PyGithub](https://github.com/PyGithub/PyGithub) library. This allows tracking entities such as issues, pull requests, and repositories.
53+
- `id`: Unique identifier (format varies by backend)
54+
- `title`: Entity title
55+
- `description`: Detailed description
56+
- `status`: Current state (open, in_progress, closed)
57+
- `labels`: Key-value pairs for categorization
58+
- `assignee`: Assigned user or agent
59+
- `metadata`: Backend-specific additional data
3860

39-
#### Notion
61+
#### Link
4062

41-
The Notion integration uses the [notion-client](https://github.com/ramnes/notion-sdk-py) library to sync entities with Notion databases.
63+
The `Link` model represents directed relationships between entities:
64+
65+
- `source_id`: Source entity ID
66+
- `target_id`: Target entity ID
67+
- `link_type`: Relationship type (blocking, parent, depends-on, etc.)
68+
69+
### Backend Interface
70+
71+
The abstract `Backend` class defines the contract all backends must implement:
72+
73+
- **CRUD operations**: create, read, update, delete, list_entities
74+
- **Link operations**: add_link, remove_link, list_links
75+
- **Graph operations**: get_link_tree, find_cycles
76+
77+
This abstraction allows Entity Manager to work with any storage system by implementing the `Backend` interface.
78+
79+
### Configuration Management
80+
81+
Hierarchical configuration system with:
82+
83+
- **Local config**: `.entity-manager/config.yaml` in project directory
84+
- **Global config**: `~/.entity-manager/config.yaml` in home directory
85+
- **Precedence**: Local settings override global defaults
86+
- **Format**: YAML key-value pairs with dot notation
87+
88+
### Backends
89+
90+
#### Backlog Backend
91+
92+
Reads/writes backlog.md markdown task files:
93+
- Task IDs in format task-N
94+
- Markdown files in backlog/tasks/ directory
95+
- Status mapping (To Do, In Progress, Done)
96+
97+
#### Beads Backend
98+
99+
Integrates with the beads task management system:
100+
- Beads hash format (bd-xxxx) for entity IDs
101+
- Direct file-system integration
102+
103+
#### GitHub Backend
104+
105+
Uses [PyGithub](https://github.com/PyGithub/PyGithub) to map GitHub Issues to entities:
106+
- Issue numbers as entity IDs
107+
- Labels mapped to entity labels
108+
- Issue descriptions and status tracked
109+
- Custom fields for dependencies (blocked by, blocking, parent)
110+
111+
#### Markdown Backend
112+
113+
Stores entities as individual markdown files:
114+
- File-based entity IDs
115+
- Links stored in separate YAML file (.em/links.yaml)
116+
- Supports arbitrary link types with automatic inverse mapping
117+
118+
#### Notion Backend
119+
120+
Uses [notion-client](https://github.com/ramnes/notion-sdk-py) to map Notion pages to entities:
121+
- Page UUIDs as entity IDs
122+
- Database properties mapped to entity fields
123+
- Relation properties for links
124+
125+
#### Redis Backend
126+
127+
In-memory backend for fast operations:
128+
- Key-value storage for entities
129+
- Set-based link tracking
130+
- Ideal for temporary or high-performance scenarios
131+
132+
#### SQLite Backend
133+
134+
Uses SQLite for local relational storage:
135+
- Integer entity IDs
136+
- Efficient SQL queries for filtering and sorting
137+
- Full-text search capabilities
42138

43139
## Design Principles
44140

0 commit comments

Comments
 (0)