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
Binary file added .playwright-mcp/dark-mode-dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 80 additions & 38 deletions crates/openflow-contracts/src/endpoints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,7 @@ impl Endpoint {

/// Find endpoints by tag
pub fn by_tag(tag: &str) -> Vec<&'static Endpoint> {
ENDPOINTS
.iter()
.filter(|e| e.tags.contains(&tag))
.collect()
ENDPOINTS.iter().filter(|e| e.tags.contains(&tag)).collect()
}

/// Get all endpoints
Expand Down Expand Up @@ -266,7 +263,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "Task[]",
path_params: &[],
query_params: &["project_id", "include_archived"],
query_params: &["projectId", "includeArchived"],
description: "List tasks, optionally filtered by project",
tags: &["tasks", "list"],
},
Expand Down Expand Up @@ -348,6 +345,31 @@ pub static ENDPOINTS: &[Endpoint] = &[
tags: &["tasks", "duplicate"],
},
// ==========================================================================
// ARTIFACTS (Task artifacts)
// ==========================================================================
Endpoint {
command: "artifacts_list",
method: HttpMethod::Get,
path: "/api/tasks/:taskId/artifacts",
request_type: None,
response_type: "ArtifactFile[]",
path_params: &["taskId"],
query_params: &[],
description: "List all artifacts for a task",
tags: &["artifacts", "list"],
},
Endpoint {
command: "artifact_read",
method: HttpMethod::Get,
path: "/api/tasks/:taskId/artifacts/:fileName",
request_type: None,
response_type: "string",
path_params: &["taskId", "fileName"],
query_params: &[],
description: "Read the content of an artifact file",
tags: &["artifacts", "read"],
},
// ==========================================================================
// CHATS
// ==========================================================================
Endpoint {
Expand All @@ -357,7 +379,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "Chat[]",
path_params: &[],
query_params: &["task_id"],
query_params: &["taskId"],
description: "List chats for a task",
tags: &["chats", "list"],
},
Expand All @@ -368,18 +390,18 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "Chat[]",
path_params: &[],
query_params: &["project_id"],
query_params: &["projectId"],
description: "List standalone chats (not attached to tasks)",
tags: &["chats", "list"],
},
Endpoint {
command: "list_chats_by_project",
method: HttpMethod::Get,
path: "/api/projects/:project_id/chats",
path: "/api/chats/by-project",
request_type: None,
response_type: "Chat[]",
path_params: &["project_id"],
query_params: &[],
path_params: &[],
query_params: &["projectId"],
description: "List all chats in a project",
tags: &["chats", "list"],
},
Expand Down Expand Up @@ -492,7 +514,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "Message[]",
path_params: &[],
query_params: &["chat_id"],
query_params: &["chatId"],
description: "List messages for a chat",
tags: &["messages", "list"],
},
Expand Down Expand Up @@ -558,7 +580,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "Message",
path_params: &["id"],
query_params: &["input_tokens", "output_tokens"],
query_params: &["inputTokens", "outputTokens"],
description: "Set token counts for a message",
tags: &["messages", "update"],
},
Expand All @@ -572,7 +594,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "ExecutionProcess[]",
path_params: &[],
query_params: &["chat_id"],
query_params: &["chatId"],
description: "List processes, optionally filtered by chat",
tags: &["processes", "list"],
},
Expand Down Expand Up @@ -659,7 +681,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
Endpoint {
command: "list_executor_profiles",
method: HttpMethod::Get,
path: "/api/executor-profiles",
path: "/api/executor/profiles",
request_type: None,
response_type: "ExecutorProfile[]",
path_params: &[],
Expand All @@ -670,7 +692,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
Endpoint {
command: "get_executor_profile",
method: HttpMethod::Get,
path: "/api/executor-profiles/:id",
path: "/api/executor/profiles/:id",
request_type: None,
response_type: "ExecutorProfile",
path_params: &["id"],
Expand All @@ -681,7 +703,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
Endpoint {
command: "get_default_executor_profile",
method: HttpMethod::Get,
path: "/api/executor-profiles/default",
path: "/api/executor/profiles/default",
request_type: None,
response_type: "ExecutorProfile",
path_params: &[],
Expand All @@ -692,7 +714,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
Endpoint {
command: "create_executor_profile",
method: HttpMethod::Post,
path: "/api/executor-profiles",
path: "/api/executor/profiles",
request_type: Some("CreateExecutorProfileRequest"),
response_type: "ExecutorProfile",
path_params: &[],
Expand All @@ -703,7 +725,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
Endpoint {
command: "update_executor_profile",
method: HttpMethod::Patch,
path: "/api/executor-profiles/:id",
path: "/api/executor/profiles/:id",
request_type: Some("UpdateExecutorProfileRequest"),
response_type: "ExecutorProfile",
path_params: &["id"],
Expand All @@ -714,7 +736,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
Endpoint {
command: "delete_executor_profile",
method: HttpMethod::Delete,
path: "/api/executor-profiles/:id",
path: "/api/executor/profiles/:id",
request_type: None,
response_type: "void",
path_params: &["id"],
Expand All @@ -740,10 +762,10 @@ pub static ENDPOINTS: &[Endpoint] = &[
command: "spawn_terminal",
method: HttpMethod::Post,
path: "/api/terminal/spawn",
request_type: None,
request_type: Some("SpawnTerminalRequest"),
response_type: "ExecutionProcess",
path_params: &[],
query_params: &["chat_id", "working_dir"],
query_params: &[],
description: "Spawn a new terminal session",
tags: &["terminal", "spawn"],
},
Expand Down Expand Up @@ -779,7 +801,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "string",
path_params: &["key"],
query_params: &["default_value"],
query_params: &["defaultValue"],
description: "Get a setting value or return default",
tags: &["settings", "read"],
},
Expand Down Expand Up @@ -826,7 +848,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "Worktree[]",
path_params: &[],
query_params: &["repo_path"],
query_params: &["repoPath"],
description: "List git worktrees for a repository",
tags: &["git", "worktrees", "list"],
},
Expand Down Expand Up @@ -859,7 +881,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "FileDiff[]",
path_params: &[],
query_params: &["worktree_path", "base_ref"],
query_params: &["worktreePath", "baseRef"],
description: "Get git diff for a worktree",
tags: &["git", "diff"],
},
Expand All @@ -881,7 +903,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "Commit[]",
path_params: &[],
query_params: &["worktree_path", "limit", "base_ref"],
query_params: &["worktreePath", "limit", "baseRef"],
description: "Get commits for a worktree",
tags: &["git", "commits"],
},
Expand Down Expand Up @@ -914,7 +936,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "string",
path_params: &[],
query_params: &["repo_path"],
query_params: &["repoPath"],
description: "Get current branch name",
tags: &["git", "branch"],
},
Expand All @@ -925,7 +947,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "string",
path_params: &[],
query_params: &["repo_path"],
query_params: &["repoPath"],
description: "Get HEAD commit hash",
tags: &["git", "branch"],
},
Expand All @@ -936,17 +958,39 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "boolean",
path_params: &[],
query_params: &["repo_path"],
query_params: &["repoPath"],
description: "Check if repository has uncommitted changes",
tags: &["git", "status"],
},
// ==========================================================================
// GITHUB
// ==========================================================================
Endpoint {
command: "check_gh_cli_installed",
method: HttpMethod::Get,
path: "/api/github/cli/installed",
request_type: None,
response_type: "CliInstalledResponse",
path_params: &[],
query_params: &[],
description: "Check if GitHub CLI is installed",
tags: &["github", "cli", "check"],
},
Endpoint {
command: "check_gh_auth_status",
method: HttpMethod::Get,
path: "/api/github/cli/auth",
request_type: None,
response_type: "AuthStatusResponse",
path_params: &[],
query_params: &[],
description: "Check GitHub CLI authentication status",
tags: &["github", "cli", "auth"],
},
Endpoint {
command: "create_pull_request",
method: HttpMethod::Post,
path: "/api/github/pull-requests",
path: "/api/github/pr",
request_type: Some("CreatePullRequestRequest"),
response_type: "PullRequestResult",
path_params: &[],
Expand All @@ -964,7 +1008,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "SearchResult",
path_params: &[],
query_params: &["query", "project_id"],
query_params: &["query", "projectId"],
description: "Search across projects, tasks, chats, and messages",
tags: &["search"],
},
Expand All @@ -978,7 +1022,7 @@ pub static ENDPOINTS: &[Endpoint] = &[
request_type: None,
response_type: "WorkflowTemplate[]",
path_params: &[],
query_params: &["project_id"],
query_params: &["projectId"],
description: "List workflow templates for a project",
tags: &["workflows", "templates", "list"],
},
Expand Down Expand Up @@ -1256,11 +1300,7 @@ mod tests {
#[test]
fn test_all_endpoints_have_tags() {
for ep in ENDPOINTS {
assert!(
!ep.tags.is_empty(),
"Endpoint {} has no tags",
ep.command
);
assert!(!ep.tags.is_empty(), "Endpoint {} has no tags", ep.command);
}
}

Expand Down Expand Up @@ -1311,8 +1351,10 @@ mod tests {
];

for ep in ENDPOINTS {
if matches!(ep.method, HttpMethod::Post | HttpMethod::Patch | HttpMethod::Put)
&& !exceptions.contains(&ep.command)
if matches!(
ep.method,
HttpMethod::Post | HttpMethod::Patch | HttpMethod::Put
) && !exceptions.contains(&ep.command)
&& (ep.tags.contains(&"create") || ep.tags.contains(&"update"))
&& ep.request_type.is_none()
&& !ep.has_query_params()
Expand Down
Loading