Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions .egg/phase-permissions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"schemaVersion": "1.0",
"phases": {
"refine": {
"allowed_operations": [
{
"type": "gh",
"pattern": "issue comment *",
"description": "Comment on issues"
},
{
"type": "gh",
"pattern": "issue edit *",
"description": "Edit issues"
},
{
"type": "egg-contract",
"pattern": "add-decision *",
"description": "Create HITL decision points"
},
{
"type": "egg-contract",
"pattern": "show *",
"description": "View contract state"
}
],
"blocked_operations": [
{
"type": "git",
"pattern": "push *",
"description": "Cannot push code during refine phase"
},
{
"type": "gh",
"pattern": "pr create*",
"description": "Cannot create PRs during refine phase"
}
],
"exit_requires": "human"
},
"plan": {
"allowed_operations": [
{
"type": "gh",
"pattern": "issue comment *",
"description": "Comment on issues"
},
{
"type": "gh",
"pattern": "issue edit *",
"description": "Edit issues"
},
{
"type": "egg-contract",
"pattern": "add-decision *",
"description": "Create HITL decision points"
},
{
"type": "egg-contract",
"pattern": "show *",
"description": "View contract state"
}
],
"blocked_operations": [
{
"type": "git",
"pattern": "push *",
"description": "Cannot push code during plan phase"
},
{
"type": "gh",
"pattern": "pr create*",
"description": "Cannot create PRs during plan phase"
}
],
"exit_requires": "human"
},
"implement": {
"allowed_operations": [
{
"type": "git",
"pattern": "push *",
"description": "Push code to remote"
},
{
"type": "egg-contract",
"pattern": "add-commit *",
"description": "Link commits to tasks"
},
{
"type": "egg-contract",
"pattern": "update-notes *",
"description": "Add implementation notes"
},
{
"type": "egg-contract",
"pattern": "mark-task *",
"description": "Mark task status (reviewer only)"
},
{
"type": "egg-contract",
"pattern": "mark-phase *",
"description": "Mark phase status (reviewer only)"
},
{
"type": "egg-contract",
"pattern": "show *",
"description": "View contract state"
}
],
"blocked_operations": [
{
"type": "gh",
"pattern": "pr create*",
"description": "Cannot create PRs until implementation is complete"
}
],
"exit_requires": "reviewer"
},
"pr": {
"allowed_operations": [
{
"type": "gh",
"pattern": "pr create*",
"description": "Create pull requests"
},
{
"type": "gh",
"pattern": "pr edit *",
"description": "Edit pull requests"
},
{
"type": "git",
"pattern": "push *",
"description": "Push code to remote"
},
{
"type": "egg-contract",
"pattern": "show *",
"description": "View contract state"
}
],
"blocked_operations": [],
"exit_requires": "human"
}
}
}
88 changes: 88 additions & 0 deletions .egg/schemas/phase-permissions.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/jwbron/egg/schemas/phase-permissions.schema.json",
"title": "SDLC Phase Permissions",
"description": "Defines operation permissions for each pipeline phase",
"type": "object",
"required": ["schemaVersion", "phases"],
"properties": {
"schemaVersion": {
"type": "string",
"description": "Schema version",
"pattern": "^[0-9]+\\.[0-9]+$",
"default": "1.0"
},
"phases": {
"type": "object",
"description": "Permission definitions for each phase",
"additionalProperties": {
"$ref": "#/$defs/phasePermissions"
},
"properties": {
"refine": {
"$ref": "#/$defs/phasePermissions"
},
"plan": {
"$ref": "#/$defs/phasePermissions"
},
"implement": {
"$ref": "#/$defs/phasePermissions"
},
"pr": {
"$ref": "#/$defs/phasePermissions"
}
}
}
},
"$defs": {
"phasePermissions": {
"type": "object",
"description": "Permission set for a single phase",
"required": ["allowed_operations", "blocked_operations", "exit_requires"],
"properties": {
"allowed_operations": {
"type": "array",
"description": "Operations allowed in this phase",
"items": {
"$ref": "#/$defs/operation"
}
},
"blocked_operations": {
"type": "array",
"description": "Operations explicitly blocked in this phase",
"items": {
"$ref": "#/$defs/operation"
}
},
"exit_requires": {
"type": "string",
"description": "Role required to exit this phase",
"enum": ["human", "reviewer", "implementer"]
}
},
"additionalProperties": false
},
"operation": {
"type": "object",
"description": "An operation that can be allowed or blocked",
"required": ["type", "pattern"],
"properties": {
"type": {
"type": "string",
"description": "Operation type",
"enum": ["git", "gh", "egg-contract"]
},
"pattern": {
"type": "string",
"description": "Command pattern to match (supports wildcards)",
"minLength": 1
},
"description": {
"type": "string",
"description": "Human-readable description of the operation"
}
},
"additionalProperties": false
}
}
}
10 changes: 10 additions & 0 deletions gateway/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@

app.register_blueprint(contract_bp)

# Register phase API blueprint
try:
from .phase_api import phase_bp

app.register_blueprint(phase_bp)
except ImportError:
from phase_api import phase_bp # type: ignore[import-not-found, no-redef]

app.register_blueprint(phase_bp)


@app.errorhandler(Exception)
def handle_unhandled_exception(e: Exception) -> tuple[Response, int]:
Expand Down
Loading
Loading