summaryrefslogtreecommitdiff
path: root/makima/src/daemon/api/directive.rs
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-06 20:06:30 +0000
committersoryu <soryu@soryu.co>2026-02-06 20:15:27 +0000
commit1b692b8cde4a888c8a35af69231f181b57bf5619 (patch)
tree74ce25ce6ee5fb4536b53404e1a0ae923e85c30d /makima/src/daemon/api/directive.rs
parent139be135c2086d725e4f040e744bb25acd436549 (diff)
downloadsoryu-1b692b8cde4a888c8a35af69231f181b57bf5619.tar.gz
soryu-1b692b8cde4a888c8a35af69231f181b57bf5619.zip
Fix: Cleanup old chain code
Diffstat (limited to 'makima/src/daemon/api/directive.rs')
-rw-r--r--makima/src/daemon/api/directive.rs285
1 files changed, 285 insertions, 0 deletions
diff --git a/makima/src/daemon/api/directive.rs b/makima/src/daemon/api/directive.rs
index 5281d21..48762d6 100644
--- a/makima/src/daemon/api/directive.rs
+++ b/makima/src/daemon/api/directive.rs
@@ -159,4 +159,289 @@ impl ApiClient {
)
.await
}
+
+ // =========================================================================
+ // Chain operations
+ // =========================================================================
+
+ /// Force chain regeneration (replan).
+ pub async fn replan_directive_chain(
+ &self,
+ directive_id: Uuid,
+ ) -> Result<JsonValue, ApiError> {
+ self.post_empty(&format!(
+ "/api/v1/directives/{}/chain/replan",
+ directive_id
+ ))
+ .await
+ }
+
+ // =========================================================================
+ // Step management
+ // =========================================================================
+
+ /// Add a step to a directive's chain.
+ pub async fn add_directive_step(
+ &self,
+ directive_id: Uuid,
+ name: &str,
+ description: Option<&str>,
+ step_type: Option<&str>,
+ depends_on: Option<Vec<Uuid>>,
+ ) -> Result<JsonValue, ApiError> {
+ #[derive(serde::Serialize)]
+ #[serde(rename_all = "camelCase")]
+ struct AddStepReq<'a> {
+ name: &'a str,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ description: Option<&'a str>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ step_type: Option<&'a str>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ depends_on: Option<Vec<Uuid>>,
+ }
+ let req = AddStepReq {
+ name,
+ description,
+ step_type,
+ depends_on,
+ };
+ self.post(
+ &format!("/api/v1/directives/{}/chain/steps", directive_id),
+ &req,
+ )
+ .await
+ }
+
+ /// Get a step by ID.
+ pub async fn get_directive_step(
+ &self,
+ directive_id: Uuid,
+ step_id: Uuid,
+ ) -> Result<JsonValue, ApiError> {
+ self.get(&format!(
+ "/api/v1/directives/{}/chain/steps/{}",
+ directive_id, step_id
+ ))
+ .await
+ }
+
+ /// Update a step.
+ pub async fn update_directive_step(
+ &self,
+ directive_id: Uuid,
+ step_id: Uuid,
+ update: serde_json::Value,
+ ) -> Result<JsonValue, ApiError> {
+ self.put(
+ &format!(
+ "/api/v1/directives/{}/chain/steps/{}",
+ directive_id, step_id
+ ),
+ &update,
+ )
+ .await
+ }
+
+ /// Delete a step.
+ pub async fn delete_directive_step(
+ &self,
+ directive_id: Uuid,
+ step_id: Uuid,
+ ) -> Result<(), ApiError> {
+ self.delete(&format!(
+ "/api/v1/directives/{}/chain/steps/{}",
+ directive_id, step_id
+ ))
+ .await
+ }
+
+ /// Skip a step.
+ pub async fn skip_directive_step(
+ &self,
+ directive_id: Uuid,
+ step_id: Uuid,
+ ) -> Result<JsonValue, ApiError> {
+ self.post_empty(&format!(
+ "/api/v1/directives/{}/chain/steps/{}/skip",
+ directive_id, step_id
+ ))
+ .await
+ }
+
+ /// Force re-evaluation of a step.
+ pub async fn evaluate_directive_step(
+ &self,
+ directive_id: Uuid,
+ step_id: Uuid,
+ ) -> Result<JsonValue, ApiError> {
+ self.post_empty(&format!(
+ "/api/v1/directives/{}/chain/steps/{}/evaluate",
+ directive_id, step_id
+ ))
+ .await
+ }
+
+ /// Trigger manual rework for a step.
+ pub async fn rework_directive_step(
+ &self,
+ directive_id: Uuid,
+ step_id: Uuid,
+ instructions: Option<&str>,
+ ) -> Result<JsonValue, ApiError> {
+ #[derive(serde::Serialize)]
+ #[serde(rename_all = "camelCase")]
+ struct ReworkReq<'a> {
+ instructions: Option<&'a str>,
+ }
+ let req = ReworkReq { instructions };
+ self.post(
+ &format!(
+ "/api/v1/directives/{}/chain/steps/{}/rework",
+ directive_id, step_id
+ ),
+ &req,
+ )
+ .await
+ }
+
+ // =========================================================================
+ // Evaluations
+ // =========================================================================
+
+ /// List evaluations for a directive.
+ pub async fn list_directive_evaluations(
+ &self,
+ directive_id: Uuid,
+ ) -> Result<JsonValue, ApiError> {
+ self.get(&format!(
+ "/api/v1/directives/{}/evaluations",
+ directive_id
+ ))
+ .await
+ }
+
+ // =========================================================================
+ // Verifiers
+ // =========================================================================
+
+ /// List verifiers for a directive.
+ pub async fn list_directive_verifiers(
+ &self,
+ directive_id: Uuid,
+ ) -> Result<JsonValue, ApiError> {
+ self.get(&format!("/api/v1/directives/{}/verifiers", directive_id))
+ .await
+ }
+
+ /// Add a verifier to a directive.
+ pub async fn add_directive_verifier(
+ &self,
+ directive_id: Uuid,
+ name: &str,
+ verifier_type: &str,
+ command: Option<&str>,
+ ) -> Result<JsonValue, ApiError> {
+ #[derive(serde::Serialize)]
+ #[serde(rename_all = "camelCase")]
+ struct CreateVerifierReq<'a> {
+ name: &'a str,
+ verifier_type: &'a str,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ command: Option<&'a str>,
+ }
+ let req = CreateVerifierReq {
+ name,
+ verifier_type,
+ command,
+ };
+ self.post(
+ &format!("/api/v1/directives/{}/verifiers", directive_id),
+ &req,
+ )
+ .await
+ }
+
+ /// Update a verifier.
+ pub async fn update_directive_verifier(
+ &self,
+ directive_id: Uuid,
+ verifier_id: Uuid,
+ update: serde_json::Value,
+ ) -> Result<JsonValue, ApiError> {
+ self.put(
+ &format!(
+ "/api/v1/directives/{}/verifiers/{}",
+ directive_id, verifier_id
+ ),
+ &update,
+ )
+ .await
+ }
+
+ /// Auto-detect verifiers based on repository content.
+ pub async fn auto_detect_directive_verifiers(
+ &self,
+ directive_id: Uuid,
+ ) -> Result<JsonValue, ApiError> {
+ self.post_empty(&format!(
+ "/api/v1/directives/{}/verifiers/auto-detect",
+ directive_id
+ ))
+ .await
+ }
+
+ // =========================================================================
+ // Requirements & Spec
+ // =========================================================================
+
+ /// Update directive requirements.
+ pub async fn update_directive_requirements(
+ &self,
+ directive_id: Uuid,
+ requirements: serde_json::Value,
+ ) -> Result<JsonValue, ApiError> {
+ #[derive(serde::Serialize)]
+ #[serde(rename_all = "camelCase")]
+ struct UpdateReq {
+ requirements: serde_json::Value,
+ }
+ let req = UpdateReq { requirements };
+ self.put(
+ &format!("/api/v1/directives/{}/requirements", directive_id),
+ &req,
+ )
+ .await
+ }
+
+ /// Update directive acceptance criteria.
+ pub async fn update_directive_criteria(
+ &self,
+ directive_id: Uuid,
+ acceptance_criteria: serde_json::Value,
+ ) -> Result<JsonValue, ApiError> {
+ #[derive(serde::Serialize)]
+ #[serde(rename_all = "camelCase")]
+ struct UpdateReq {
+ acceptance_criteria: serde_json::Value,
+ }
+ let req = UpdateReq { acceptance_criteria };
+ self.put(
+ &format!("/api/v1/directives/{}/criteria", directive_id),
+ &req,
+ )
+ .await
+ }
+
+ /// Generate a specification from the directive's goal.
+ pub async fn generate_directive_spec(
+ &self,
+ directive_id: Uuid,
+ ) -> Result<JsonValue, ApiError> {
+ self.post_empty(&format!(
+ "/api/v1/directives/{}/generate-spec",
+ directive_id
+ ))
+ .await
+ }
}