Skip to content

Commit 0ea6abb

Browse files
committed
docs: Add governance model and plugin system
- GOVERNANCE.md: Project structure and module definitions - plugins/protocol.py: Plugin system protocol
1 parent d361e09 commit 0ea6abb

2 files changed

Lines changed: 256 additions & 0 deletions

File tree

GOVERNANCE.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# heliosHarness Governance Model
2+
3+
## Purpose
4+
5+
**heliosHarness** is a private research & planning monorepo for developing, analyzing, and organizing the heliosCLI system architecture. It does **not** contain production code - instead, it researches, prototypes, and defines how to extend other projects.
6+
7+
## Project Shelf Model
8+
9+
Like `kush/` - heliosHarness serves as a **project shelf** for organizing dependencies and research.
10+
11+
## Module Categories
12+
13+
### 1. Clones (forked external projects)
14+
```
15+
clones/
16+
├── codex/ # Forked Codex CLI research
17+
├── goose/ # Forked Goose research
18+
├── cline/ # Forked Cline research
19+
├── aider/ # Forked Aider research
20+
├── opencode/ # Forked OpenCode research
21+
└── [other forks/]
22+
```
23+
24+
### 2. Extensions (plugin systems)
25+
```
26+
extensions/
27+
├── codex-plugins/ # Codex CLI extensibility
28+
├── harbor-plugins/ # Harbor framework plugins
29+
├── portage-plugins/ # Portage module system
30+
└── [project]-plugins/
31+
```
32+
33+
### 3. Plugins (modular extension system)
34+
```
35+
plugins/
36+
├── protocol/ # Plugin protocol definitions
37+
├── loader/ # Plugin loader/runtimes
38+
├── registry/ # Plugin registry
39+
└── templates/ # Plugin templates
40+
```
41+
42+
### 4. Submodules (component definitions)
43+
```
44+
modules/
45+
├── harness_core/ # Core harness interfaces
46+
├── adapters/ # Adapter definitions
47+
├── handlers/ # Handler specs
48+
└── validators/ # Validation contracts
49+
```
50+
51+
### 5. Research & Analysis
52+
```
53+
research/
54+
├── [domain]-analysis/ # Research documents
55+
├── [project]-specs/ # Specification documents
56+
└── prototypes/ # Prototype code/tests
57+
```
58+
59+
## Extension Pattern
60+
61+
### Plugin Contract
62+
```python
63+
# plugins/protocol/base.py
64+
class Plugin(Protocol):
65+
name: str
66+
version: str
67+
68+
def initialize(self, config: dict) -> None: ...
69+
def execute(self, ctx: Context) -> Result: ...
70+
def shutdown(self) -> None: ...
71+
```
72+
73+
### Extension Points
74+
- **codex extensions** → Extend heliosCLI
75+
- **harbor plugins** → Harbor framework integration
76+
- **portage modules** → Portage package system
77+
- **custom adapters** → External system connectors
78+
79+
## Governance Rules
80+
81+
1. **No production code** - Research/prototypes only
82+
2. **Clear provenance** - Document source projects
83+
3. **Plugin-first** - Use extension patterns over hardcoded deps
84+
4. **Modular** - Independent, composable components
85+
5. **Documented** - ADRs for architectural decisions
86+
87+
## Directory Structure
88+
89+
```
90+
heliosHarness/
91+
├── clones/ # Forked external projects
92+
├── plugins/ # Plugin system
93+
├── extensions/ # Extension definitions
94+
├── modules/ # Component interfaces
95+
├── research/ # Analysis documents
96+
├── prototypes/ # Experimental code
97+
├── specs/ # Specification documents
98+
└── artifacts/ # Generated artifacts
99+
```
100+
101+
## Plugin Registry Example
102+
103+
```yaml
104+
# plugins/registry.yaml
105+
plugins:
106+
- name: codex-extension
107+
type: helioscli-extension
108+
source: clones/codex
109+
path: extensions/codex-plugins/
110+
111+
- name: harbor-adapter
112+
type: harbor-plugin
113+
source: portage/harbor
114+
path: extensions/harbor-plugins/
115+
```

plugins/protocol.py

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
"""Plugin system for heliosHarness extensions.
2+
3+
Defines the plugin protocol and extension points for modular code.
4+
"""
5+
6+
from typing import Protocol, runtime_checkable
7+
from dataclasses import dataclass
8+
from enum import Enum
9+
from abc import ABC, abstractmethod
10+
from pathlib import Path
11+
12+
13+
class PluginType(Enum):
14+
"""Types of plugins."""
15+
HELIOS_CLI_EXTENSION = "helioscli_extension"
16+
HARBOR_PLUGIN = "harbor_plugin"
17+
PORTAGE_MODULE = "portage_module"
18+
ADAPTER = "adapter"
19+
TEMPLATE = "template"
20+
21+
22+
@dataclass
23+
class PluginMetadata:
24+
"""Plugin metadata."""
25+
name: str
26+
version: str
27+
plugin_type: PluginType
28+
source_project: str
29+
description: str = ""
30+
author: str = ""
31+
tags: list[str] = None
32+
33+
def __post_init__(self):
34+
if self.tags is None:
35+
self.tags = []
36+
37+
38+
@dataclass
39+
class PluginConfig:
40+
"""Plugin configuration."""
41+
enabled: bool = True
42+
priority: int = 100
43+
settings: dict = None
44+
45+
def __post_init__(self):
46+
if self.settings is None:
47+
self.settings = {}
48+
49+
50+
@runtime_checkable
51+
class Plugin(Protocol):
52+
"""Base plugin protocol."""
53+
54+
@property
55+
def metadata(self) -> PluginMetadata:
56+
"""Plugin metadata."""
57+
...
58+
59+
def initialize(self, config: dict) -> None:
60+
"""Initialize the plugin with configuration."""
61+
...
62+
63+
def execute(self, *args, **kwargs):
64+
"""Execute the plugin."""
65+
...
66+
67+
def shutdown(self) -> None:
68+
"""Cleanup resources."""
69+
...
70+
71+
72+
def validate(self) -> bool:
73+
"""Validate plugin setup."""
74+
return True
75+
76+
77+
class PluginLoader:
78+
"""Loads and manages plugins."""
79+
80+
def __init__(self, plugin_dir: Path = None):
81+
self.plugin_dir = plugin_dir or Path("plugins")
82+
self._plugins: dict[str, Plugin] = {}
83+
self._metadata: dict[str, PluginMetadata] = {}
84+
85+
def discover(self) -> list[PluginMetadata]:
86+
"""Discover available plugins."""
87+
discovered = []
88+
89+
if not self.plugin_dir.exists():
90+
return discovered
91+
92+
for plugin_path in self.plugin_dir.rglob("plugin.yaml"):
93+
with open(plugin_path) as f:
94+
# Parse YAML and create metadata
95+
pass
96+
97+
return discovered
98+
99+
def load(self, name: str) -> Plugin:
100+
"""Load a plugin by name."""
101+
if name in self._plugins:
102+
return self._plugins[name]
103+
104+
# Dynamic import
105+
module = __import__(f"plugins.{name}", fromlist=["Plugin"])
106+
plugin = module.Plugin()
107+
108+
self._plugins[name] = plugin
109+
return plugin
110+
111+
def unload(self, name: str) -> None:
112+
"""Unload a plugin."""
113+
if name in self._plugins:
114+
self._plugins[name].shutdown()
115+
del self._plugins[name]
116+
117+
118+
class ExtensionRegistry:
119+
"""Registry for extension points."""
120+
121+
def __init__(self):
122+
self._extensions: dict[str, list[type] = {}
123+
124+
def register(self, extension_point: str, extension: type):
125+
"""Register an extension for a point."""
126+
if extension_point not in self._extensions:
127+
self._extensions[extension_point] = []
128+
self._extensions[extension_point].append(extension)
129+
130+
def get_extensions(self, extension_point: str) -> list[type]:
131+
"""Get all extensions for a point."""
132+
return self._extensions.get(extension_point, [])
133+
134+
135+
# Extension points
136+
EXTENSION_POINTS = {
137+
"codex_command": "Codex CLI command extension",
138+
"harbor_adapter": "Harbor system adapter",
139+
"portage_module": "Portage module extension",
140+
"template_renderer": "Template renderer extension",
141+
}

0 commit comments

Comments
 (0)