feat(workflow): add replay, approve, templates, and task-definitions subcommands - #107
Conversation
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several new workflow-related CLI commands: approve for completing human approval gates, replay for retriggering executions, task-definitions for listing task definitions, and templates for browsing pre-built templates. The feedback suggests validating the type flag in the template commands to prevent invalid API requests, and pre-allocating the rows slice in the task definitions command to optimize performance.
There was a problem hiding this comment.
Code Review
This pull request introduces several new subcommands to manage workflows, including approve, replay, task-definitions, and templates (with list and get subcommands). The feedback recommends utilizing the package-level client.Run helper instead of instantiating a new client with client.NewClient() in each command to reduce boilerplate and ensure consistent initialization. Additionally, for the templates get subcommand, the reviewer suggests making the --type flag optional (defaulting to an empty string) so that templates can be resolved by ID alone without requiring an explicit type parameter.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several new subcommands under the workflow command: approve for completing human approval gates, replay for retriggering workflow executions, task-definitions for listing supported tasks, and templates (with list and get subcommands) for browsing pre-built workflow templates. The review feedback focuses on refining the template commands, specifically recommending to omit the type filter in the GraphQL request when listing "all" templates, restricting the template "get" command to only "system" or "custom" types, and updating the help text for the list command to accurately reflect that "all" is a supported type.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several new subcommands under the workflow command: approve for completing human approval gates, replay for retriggering workflow executions, task-definitions for listing supported task definitions, and templates (with list and get subcommands) for browsing pre-built workflow templates. The review feedback suggests improving the robustness of the GraphQL response handling in workflow_templates.go by using a pointer for the nullable workflow_get_template field to correctly distinguish missing templates. Additionally, it recommends updating the CLI flag descriptions for template types to explicitly mention 'all' as a valid option alongside 'system' and 'custom' to match the validation logic.
… flag descriptions
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several new workflow-related commands to the CLI, including approve to complete human approval gates, replay to retrigger workflow executions, task-definitions to list supported tasks, and templates (with list and get subcommands) to browse pre-built templates. The review feedback suggests changing the WorkflowGetTemplate response field in the templates get command from a pointer to a non-pointer struct. This avoids formatting issues where raw pointers are printed instead of structured data, and consequently allows simplifying the error handling by removing the redundant nil check.
|
/gemini review |
1 similar comment
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several new CLI commands for managing workflows, including commands to approve or reject pending executions, replay previous executions, list task definitions, and browse or inspect workflow templates. The review feedback suggests improving the user experience by making the template type flag validation case-insensitive. Additionally, it recommends using a pointer to a struct instead of checking for an empty string when handling nullable GraphQL response fields to align with idiomatic Go practices.
|
/gemini review |
1 similar comment
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several new workflow-related CLI commands, including approve, replay, task-definitions, and templates (with list and get subcommands). The feedback recommends validating that the required task flag is not empty in the approve command. Additionally, it is highly recommended to replace manual client instantiations (client.NewClient()) with the package-level client.Run() helper across all new commands to properly leverage the singleton client, automatic configuration initialization, and authenticated transport reuse.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several new subcommands to the workflow command group, including 'approve' for completing human approval gates, 'replay' for re-triggering executions, 'task-definitions' for listing task schemas, and 'templates' (with 'list' and 'get' subcommands) for browsing pre-built templates. The feedback suggests improving the payload construction in the 'approve' command by omitting empty optional fields, and refactoring the 'templates' command to extract duplicate struct definitions into a shared package-level struct.
I am having trouble creating individual review comments. Click here to see my feedback.
cmd/workflow_approve.go (24-39)
To maintain consistency with other subcommands (like workflow_templates and workflow_task_definitions), optional fields like comments should only be included in the request payload if they are non-empty. This prevents sending empty strings to the backend, which might otherwise be interpreted as actual empty comments.
graphqlClient := client.NewClient()
req := client.NewRequest("mutation CompleteWorkflowApproval($request: WorkflowCompleteApprovalRequest!) {\n\t\t\tworkflow_complete_approval(request: $request) {\n\t\t\t\tstatus\n\t\t\t\tmessage\n\t\t\t}\n\t\t}")
input := map[string]any{
"execution_id": executionID,
"task_id": taskID,
"status": status,
}
if comments != "" {
input["comments"] = comments
}
req.Var("request", input)cmd/workflow_templates.go (57-69)
The template struct definition is duplicated between workflowTemplatesListCmd and workflowTemplatesGetCmd. Extracting this into a shared package-level struct workflowTemplate improves maintainability and ensures consistency if the template schema changes in the future.
var respData struct {
WorkflowListTemplate struct {
TotalCount int "json:\"total_count\""
Templates []workflowTemplate "json:\"templates\""
} "json:\"workflow_list_template\""
}cmd/workflow_templates.go (128-137)
Reuse the shared workflowTemplate struct here to eliminate duplication.
var respData struct {
WorkflowGetTemplate workflowTemplate "json:\"workflow_get_template\""
}cmd/workflow_templates.go (152-162)
Define the shared workflowTemplate struct at the package level.
func init() {
workflowCmd.AddCommand(workflowTemplatesCmd)
workflowTemplatesCmd.AddCommand(workflowTemplatesListCmd)
workflowTemplatesCmd.AddCommand(workflowTemplatesGetCmd)
workflowTemplatesListCmd.Flags().String("type", "system", "Template type (system, custom, or all)")
workflowTemplatesListCmd.Flags().String("category", "", "Filter templates by category")
workflowTemplatesListCmd.Flags().Int("limit", 50, "Maximum number of templates to return")
workflowTemplatesGetCmd.Flags().String("type", "", "Optional template type filter (system, custom, or all)")
}
type workflowTemplate struct {
ID string "json:\"id\""
Name string "json:\"name\""
Description string "json:\"description\""
Category string "json:\"category\""
IsSystem bool "json:\"is_system\""
Status string "json:\"status\""
}
…mments in approve input
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several new subcommands under the workflow command to manage workflow executions and templates. Specifically, it adds approve to complete human approval gates, replay to re-trigger executions, task-definitions to list supported tasks, and templates (with list and get subcommands) to browse pre-built templates. The review feedback suggests adding input validation to ensure that required positional arguments, such as execution-id and template-id, are not empty or whitespace-only before executing API requests.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several new workflow-related CLI commands, including approve, replay, task-definitions, and templates (with list and get subcommands). The feedback recommends using a pointer struct for WorkflowGetTemplate in the get template command to properly handle and distinguish null API responses from empty structs.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several new subcommands to the workflow CLI tool: approve for completing human approval gates, replay for retriggering previous or failed workflow executions, task-definitions for listing supported task definitions, and templates (with list and get subcommands) for browsing pre-built workflow templates. Feedback on these changes includes using a pointer type for GraphQL query responses to properly handle null values, enforcing zero positional arguments on subcommands that do not accept them, and trimming whitespace from input flags.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several new subcommands to the workflow CLI tool, including commands to approve pending executions, replay previous or failed executions, list task definitions, and browse/get workflow templates. The feedback recommends dereferencing the template pointer in the get subcommand before passing it to the formatter to ensure the output is rendered as a structured table rather than falling back to default text formatting.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several new workflow-related CLI commands: 'approve' to complete human approval gates, 'replay' to re-trigger workflow executions, 'task-definitions' to list task schemas, and 'templates' (with 'list' and 'get' subcommands) to browse pre-built workflow templates. The feedback highlights an issue in 'cmd/workflow_templates.go' where passing a pointer to the formatter causes it to print a raw pointer representation instead of formatted key-value pairs; dereferencing the template pointer before printing resolves this.
There was a problem hiding this comment.
Code Review
This pull request introduces several new workflow-related CLI commands, including approve for completing human approval gates, replay for re-triggering workflow executions, task-definitions for listing task definitions, and templates (with list and get subcommands) for managing pre-built workflow templates. The review feedback recommends adding input validation to ensure the limit parameter is a positive integer in both the task-definitions and templates list commands, which also requires importing the fmt package in workflow_task_definitions.go.
There was a problem hiding this comment.
Code Review
This pull request adds several new workflow-related CLI commands: 'approve' for completing human approval gates, 'replay' for re-triggering workflow executions, 'task-definitions' for listing supported task definitions, and 'templates' (with 'list' and 'get' subcommands) for browsing pre-built workflow templates. There are no review comments, and I have no feedback to provide.
Description
Extends
nbctl workflowwith subcommands for execution replay, human approvals, pre-built template browsing, and task definition listing:New Subcommands
nbctl workflow replay <execution-id>:workflow_replay_execution.nbctl workflow approve <execution-id> --task <task-id> [--reject]:workflow_complete_approval.nbctl workflow templates(Command Group):nbctl workflow templates list [--type system|custom] [--category <name>](Query:workflow_list_template).nbctl workflow templates get <template-id>(Query:workflow_get_template).nbctl workflow task-definitions:workflow_list_taskdefinitions.Testing & Verification
make lint— 0 issues.go test ./...— 100% PASS.devenvironment with structured output.