init: OpenSpec project scaffolding with proposal, design, specs, tasks

- 7 capabilities: agent-registry, task-router, receipt-protocol,
  forgejo-integration, matrix-chatops, agent-adapter, orchestrator-core
- Tech stack: Rust + axum + zigbuild (single binary)
- Forgejo as task source of truth
- Matrix as real-time ChatOps layer
- Adapter pattern for multi-agent type support
This commit is contained in:
Zer4tul 2026-05-11 14:37:43 +08:00
commit aabd52ed52
19 changed files with 1938 additions and 0 deletions

View file

@ -0,0 +1,44 @@
## ADDED Requirements
### Requirement: Webhook endpoint for Forgejo
Orchestrator SHALL 暴露 HTTP webhook endpoint 接收 Forgejo 事件:`POST /api/v1/webhooks/forgejo`
#### Scenario: Forgejo sends issue event
- **WHEN** Forgejo 配置了指向 Orchestrator 的 webhookIssue 事件触发
- **THEN** Orchestrator SHALL 接收、验证签名、解析事件体,并路由到 Task Router
#### Scenario: Invalid webhook signature
- **WHEN** 收到的 webhook 签名验证失败
- **THEN** Orchestrator SHALL 返回 401 并记录安全日志
### Requirement: Issue to task conversion
Orchestrator SHALL 将 Forgejo Issue 转换为内部任务保持双向映射Issue URL ↔ task_id。
#### Scenario: Issue created with agent label
- **WHEN** Issue #42 在 repo `my-project` 中创建,带 `agent:code` 标签
- **THEN** 创建任务,`source = "forgejo:my-project#42"`,任务状态为 `created`
### Requirement: Task status sync back to Issue
任务状态变更 SHALL 同步回 Forgejo Issuelabel 更新(`status:todo``status:doing``status:done`、milestone 更新、assignee 更新。
#### Scenario: Task assigned to agent
- **WHEN** 任务被分配给 Agent `worker-03`
- **THEN** 对应 Issue 的 assignee SHALL 更新为 `worker-03` 对应的 Forgejo 用户label SHALL 添加 `status:doing`
#### Scenario: Task completed
- **WHEN** 任务状态变为 `completed`
- **THEN** Issue label SHALL 从 `status:doing` 变为 `status:done`Issue comment SHALL 写入 receipt summary
### Requirement: PR creation and update
Agent 通过 Orchestrator 创建的 PR SHALL 关联到原始 Issue通过 description 或 `Closes #N` 引用)。
#### Scenario: Agent creates PR via Orchestrator
- **WHEN** Agent 在 receipt 中声明需要创建 PR
- **THEN** Orchestrator SHALL 协助创建 PR或验证 Agent 直接创建的 PR确保 PR body 包含 `Closes #<issue-number>`
### Requirement: Forgejo API authentication
Orchestrator SHALL 使用 Forgejo API token 进行所有 API 调用(读取 Issue、创建 comment、更新 label、创建 PR 等)。
#### Scenario: Token rotation
- **WHEN** Forgejo API token 过期
- **THEN** Orchestrator SHALL 返回明确错误并通过 Matrix 通知管理员