summaryrefslogtreecommitdiff
path: root/makima/src/db/models.rs
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-05-02 15:07:33 +0100
committerGitHub <noreply@github.com>2026-05-02 15:07:33 +0100
commit760516b2e7b97fa389fb3902e8d2314eea052ff0 (patch)
tree69eb1dd212ef924ee9e451d8d88806f899c03e84 /makima/src/db/models.rs
parente11759447b1ac00becfb1e979e488f7f9c9cf478 (diff)
downloadsoryu-760516b2e7b97fa389fb3902e8d2314eea052ff0.tar.gz
soryu-760516b2e7b97fa389fb3902e8d2314eea052ff0.zip
feat: multi-document directives with ephemeral task lifecycle (#119)
* feat: soryu-co/soryu - makima: Fix folder/file naming and breadcrumb hash bugs * WIP: heartbeat checkpoint * WIP: heartbeat checkpoint * WIP: heartbeat checkpoint * feat: soryu-co/soryu - makima: Frontend: render multiple documents per directive folder * WIP: heartbeat checkpoint * WIP: heartbeat checkpoint * WIP: heartbeat checkpoint * Fix DirectiveRevision import in openapi.rs after merge * Fix document-directives.tsx merge artifacts and add inactive status
Diffstat (limited to 'makima/src/db/models.rs')
-rw-r--r--makima/src/db/models.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs
index 44af939..18f3435 100644
--- a/makima/src/db/models.rs
+++ b/makima/src/db/models.rs
@@ -539,6 +539,13 @@ pub struct Task {
/// Directive step this task executes
#[serde(skip_serializing_if = "Option::is_none")]
pub directive_step_id: Option<Uuid>,
+ /// Directive document this task is an artifact of. Set when the
+ /// orchestrator (or any task-creation path) knows which document
+ /// triggered the work — so when that document ships, the sidebar can
+ /// move its tasks alongside it under shipped/. Nullable for legacy /
+ /// non-directive tasks.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub directive_document_id: Option<Uuid>,
}
impl Task {
@@ -2778,6 +2785,11 @@ pub struct DirectiveStep {
pub started_at: Option<DateTime<Utc>>,
pub completed_at: Option<DateTime<Utc>>,
pub created_at: DateTime<Utc>,
+ /// Directive document this step belongs to. When the document ships, its
+ /// steps move with it under shipped/. Nullable for legacy steps and for
+ /// directives that don't yet have a document.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub directive_document_id: Option<Uuid>,
}
/// Directive with its steps for detail view.
@@ -2902,6 +2914,11 @@ pub struct CreateDirectiveStepRequest {
/// Valid values: "simple", "specification", "execute"
#[serde(default)]
pub contract_type: Option<String>,
+ /// Optional: attach this step to a specific directive document. When
+ /// omitted, the repository falls back to the directive's most-recently
+ /// updated active document (if any).
+ #[serde(default)]
+ pub directive_document_id: Option<Uuid>,
}
/// Request to update a directive step.
@@ -2918,6 +2935,32 @@ pub struct UpdateDirectiveStepRequest {
}
// =============================================================================
+// Directive Document Types
+// =============================================================================
+
+/// A directive document — one of N markdown documents owned by a directive.
+/// The user calls these "directive contracts". Each document has its own
+/// lifecycle (draft → active → shipped → archived) and may be attached to a
+/// PR. Multiple documents can be active under the same directive at once.
+#[derive(Debug, Clone, FromRow, Serialize, Deserialize, ToSchema)]
+#[serde(rename_all = "camelCase")]
+pub struct DirectiveDocument {
+ pub id: Uuid,
+ pub directive_id: Uuid,
+ pub title: String,
+ pub body: String,
+ /// Status: draft, active, shipped, archived
+ pub status: String,
+ pub pr_url: Option<String>,
+ pub pr_branch: Option<String>,
+ pub shipped_at: Option<DateTime<Utc>>,
+ pub archived_at: Option<DateTime<Utc>>,
+ pub version: i32,
+ pub created_at: DateTime<Utc>,
+ pub updated_at: DateTime<Utc>,
+}
+
+// =============================================================================
// Order Types
// =============================================================================