Skip to content

Commit a7654f9

Browse files
committed
Merge branch 'moe/temporal-agent-cli' into moe/temporal-agent-cli-examples
2 parents 2ab62b7 + a914bba commit a7654f9

File tree

6 files changed

+30
-57
lines changed

6 files changed

+30
-57
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ The CLI includes workflow commands optimized for AI agents, LLM tooling, and aut
5555
- **`temporal workflow list --failed`** - List recent workflow failures with auto-traversed root cause
5656
- **`temporal workflow describe --trace-root-cause`** - Trace a workflow through its child chain to the deepest failure
5757
- **`temporal workflow show --compact`** - Show a compact event timeline
58-
- **`temporal workflow show --format mermaid`** - Generate a sequence diagram
58+
- **`temporal workflow show --output mermaid`** - Generate a sequence diagram
5959
- **`temporal workflow describe --pending`** - Show pending activities, children, and Nexus operations
60-
- **`temporal workflow describe --format mermaid`** - Generate a state diagram
60+
- **`temporal workflow describe --output mermaid`** - Generate a state diagram
6161
- **`temporal tool-spec`** - Output tool specifications for AI agent frameworks
6262

6363
### Examples
@@ -131,23 +131,23 @@ temporal workflow list --failed --namespace commerce-ns --since 1h \
131131

132132
### Mermaid Visualization
133133

134-
Commands support `--format mermaid` to generate visual diagrams:
134+
Commands support `--output mermaid` to generate visual diagrams:
135135

136136
```bash
137137
# Visualize workflow chain as a flowchart
138-
temporal workflow describe --trace-root-cause --workflow-id order-123 --namespace prod --format mermaid
138+
temporal workflow describe --trace-root-cause --workflow-id order-123 --namespace prod --output mermaid
139139

140140
# Visualize timeline as a sequence diagram
141-
temporal workflow show --workflow-id order-123 --namespace prod --format mermaid
141+
temporal workflow show --workflow-id order-123 --namespace prod --output mermaid
142142

143143
# Visualize current state with pending activities
144-
temporal workflow describe --workflow-id order-123 --namespace prod --pending --format mermaid
144+
temporal workflow describe --workflow-id order-123 --namespace prod --pending --output mermaid
145145

146146
# Visualize failures as a pie chart (when grouped)
147-
temporal workflow list --failed --namespace prod --since 1h --group-by error --format mermaid
147+
temporal workflow list --failed --namespace prod --since 1h --group-by error --output mermaid
148148

149149
# Visualize failures as a flowchart (when not grouped)
150-
temporal workflow list --failed --namespace prod --since 1h --follow-children --format mermaid
150+
temporal workflow list --failed --namespace prod --since 1h --follow-children --output mermaid
151151
```
152152

153153
The mermaid output renders directly in:
@@ -156,7 +156,7 @@ The mermaid output renders directly in:
156156
- Notion pages
157157
- Any markdown preview with Mermaid support
158158

159-
Example diagnose output with `--format mermaid`:
159+
Example diagnose output with `--output mermaid`:
160160
```
161161
graph TD
162162
W0[🔄 OrderWorkflow<br/>Failed]

cliext/flags.gen.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ func (v *CommonOptions) BuildFlags(f *pflag.FlagSet) {
4242
f.Var(&v.LogLevel, "log-level", "Log level. Default is \"info\" for most commands and \"warn\" for `server start-dev`. Accepted values: debug, info, warn, error, never.")
4343
v.LogFormat = NewFlagStringEnum([]string{"text", "json", "pretty"}, "text")
4444
f.Var(&v.LogFormat, "log-format", "Log format. Accepted values: text, json.")
45-
v.Output = NewFlagStringEnum([]string{"text", "json", "jsonl", "none"}, "text")
46-
f.VarP(&v.Output, "output", "o", "Non-logging data output format. Accepted values: text, json, jsonl, none.")
45+
v.Output = NewFlagStringEnum([]string{"text", "json", "jsonl", "mermaid", "none"}, "text")
46+
f.VarP(&v.Output, "output", "o", "Non-logging data output format. Accepted values: text, json, jsonl, mermaid, none.")
4747
v.TimeFormat = NewFlagStringEnum([]string{"relative", "iso", "raw"}, "relative")
4848
f.Var(&v.TimeFormat, "time-format", "Time format. Accepted values: relative, iso, raw.")
4949
v.Color = NewFlagStringEnum([]string{"always", "never", "auto"}, "auto")

cliext/option-sets.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ option-sets:
7070
- text
7171
- json
7272
- jsonl
73+
- mermaid
7374
- none
7475
default: text
7576
- name: time-format

internal/temporalcli/commands.gen.go

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3407,7 +3407,6 @@ type TemporalWorkflowDescribeCommand struct {
34073407
TraceRootCause bool
34083408
FollowNamespaces []string
34093409
Depth int
3410-
Format cliext.FlagStringEnum
34113410
}
34123411

34133412
func NewTemporalWorkflowDescribeCommand(cctx *CommandContext, parent *TemporalWorkflowCommand) *TemporalWorkflowDescribeCommand {
@@ -3417,9 +3416,9 @@ func NewTemporalWorkflowDescribeCommand(cctx *CommandContext, parent *TemporalWo
34173416
s.Command.Use = "describe [flags]"
34183417
s.Command.Short = "Show Workflow Execution info"
34193418
if hasHighlighting {
3420-
s.Command.Long = "Display information about a specific Workflow Execution:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId\x1b[0m\n\nShow the Workflow Execution's auto-reset points:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --reset-points true\x1b[0m\n\nShow pending activities, children, and Nexus operations:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --pending\x1b[0m\n\nGenerate a visual state diagram:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --pending \\\n --format mermaid\x1b[0m\n\nTrace through child workflows to find root cause of failure:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --trace-root-cause\x1b[0m\n\nFollow children across namespaces:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --trace-root-cause \\\n --follow-namespaces OtherNamespace1,OtherNamespace2 \\\n --format mermaid\x1b[0m"
3419+
s.Command.Long = "Display information about a specific Workflow Execution:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId\x1b[0m\n\nShow the Workflow Execution's auto-reset points:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --reset-points true\x1b[0m\n\nShow pending activities, children, and Nexus operations:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --pending\x1b[0m\n\nGenerate a visual state diagram:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --pending \\\n --output mermaid\x1b[0m\n\nTrace through child workflows to find root cause of failure:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --trace-root-cause\x1b[0m\n\nFollow children across namespaces:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --trace-root-cause \\\n --follow-namespaces OtherNamespace1,OtherNamespace2 \\\n --output mermaid\x1b[0m"
34213420
} else {
3422-
s.Command.Long = "Display information about a specific Workflow Execution:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId\n```\n\nShow the Workflow Execution's auto-reset points:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --reset-points true\n```\n\nShow pending activities, children, and Nexus operations:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --pending\n```\n\nGenerate a visual state diagram:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --pending \\\n --format mermaid\n```\n\nTrace through child workflows to find root cause of failure:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --trace-root-cause\n```\n\nFollow children across namespaces:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --trace-root-cause \\\n --follow-namespaces OtherNamespace1,OtherNamespace2 \\\n --format mermaid\n```"
3421+
s.Command.Long = "Display information about a specific Workflow Execution:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId\n```\n\nShow the Workflow Execution's auto-reset points:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --reset-points true\n```\n\nShow pending activities, children, and Nexus operations:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --pending\n```\n\nGenerate a visual state diagram:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --pending \\\n --output mermaid\n```\n\nTrace through child workflows to find root cause of failure:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --trace-root-cause\n```\n\nFollow children across namespaces:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --trace-root-cause \\\n --follow-namespaces OtherNamespace1,OtherNamespace2 \\\n --output mermaid\n```"
34233422
}
34243423
s.Command.Args = cobra.NoArgs
34253424
s.Command.Flags().BoolVar(&s.ResetPoints, "reset-points", false, "Show auto-reset points only.")
@@ -3428,8 +3427,6 @@ func NewTemporalWorkflowDescribeCommand(cctx *CommandContext, parent *TemporalWo
34283427
s.Command.Flags().BoolVar(&s.TraceRootCause, "trace-root-cause", false, "Trace through child workflow chain to find the deepest failure point. Automates following failed child workflows to find the actual root cause.")
34293428
s.Command.Flags().StringArrayVar(&s.FollowNamespaces, "follow-namespaces", nil, "Additional namespaces to follow when tracing child workflows. Used with --trace-root-cause. Can be passed multiple times.")
34303429
s.Command.Flags().IntVar(&s.Depth, "depth", 0, "Maximum depth to traverse when tracing child workflows. Zero means unlimited. Used with --trace-root-cause.")
3431-
s.Format = cliext.NewFlagStringEnum([]string{"default", "json", "mermaid"}, "")
3432-
s.Command.Flags().Var(&s.Format, "format", "Visual output format. Use \"mermaid\" to generate a state diagram showing pending work. Implies --pending. Accepted values: default, json, mermaid.")
34333430
s.WorkflowReferenceOptions.BuildFlags(s.Command.Flags())
34343431
s.Command.Run = func(c *cobra.Command, args []string) {
34353432
if err := s.run(cctx, args); err != nil {
@@ -3574,7 +3571,6 @@ type TemporalWorkflowListCommand struct {
35743571
LeafOnly bool
35753572
CompactErrors bool
35763573
GroupBy cliext.FlagStringEnum
3577-
Format cliext.FlagStringEnum
35783574
}
35793575

35803576
func NewTemporalWorkflowListCommand(cctx *CommandContext, parent *TemporalWorkflowCommand) *TemporalWorkflowListCommand {
@@ -3584,9 +3580,9 @@ func NewTemporalWorkflowListCommand(cctx *CommandContext, parent *TemporalWorkfl
35843580
s.Command.Use = "list [flags]"
35853581
s.Command.Short = "Show Workflow Executions"
35863582
if hasHighlighting {
3587-
s.Command.Long = "List Workflow Executions. The optional \x1b[1m--query\x1b[0m limits the output to\nWorkflows matching a Query:\n\n\x1b[1mtemporal workflow list \\\n --query YourQuery\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference.\n\nView a list of archived Workflow Executions:\n\n\x1b[1mtemporal workflow list \\\n --archived\x1b[0m\n\nList failed workflows from the last hour with root cause analysis:\n\n\x1b[1mtemporal workflow list \\\n --failed \\\n --since 1h\x1b[0m\n\nFollow child workflows to find root causes:\n\n\x1b[1mtemporal workflow list \\\n --failed \\\n --since 24h \\\n --follow-children \\\n --follow-namespaces OtherNamespace1,OtherNamespace2\x1b[0m\n\nGroup failures by error message to find patterns:\n\n\x1b[1mtemporal workflow list \\\n --failed \\\n --since 1h \\\n --group-by error \\\n --format mermaid\x1b[0m"
3583+
s.Command.Long = "List Workflow Executions. The optional \x1b[1m--query\x1b[0m limits the output to\nWorkflows matching a Query:\n\n\x1b[1mtemporal workflow list \\\n --query YourQuery\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference.\n\nView a list of archived Workflow Executions:\n\n\x1b[1mtemporal workflow list \\\n --archived\x1b[0m\n\nList failed workflows from the last hour with root cause analysis:\n\n\x1b[1mtemporal workflow list \\\n --failed \\\n --since 1h\x1b[0m\n\nFollow child workflows to find root causes:\n\n\x1b[1mtemporal workflow list \\\n --failed \\\n --since 24h \\\n --follow-children \\\n --follow-namespaces OtherNamespace1,OtherNamespace2\x1b[0m\n\nGroup failures by error message to find patterns:\n\n\x1b[1mtemporal workflow list \\\n --failed \\\n --since 1h \\\n --group-by error \\\n --output mermaid\x1b[0m"
35883584
} else {
3589-
s.Command.Long = "List Workflow Executions. The optional `--query` limits the output to\nWorkflows matching a Query:\n\n```\ntemporal workflow list \\\n --query YourQuery\n```\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference.\n\nView a list of archived Workflow Executions:\n\n```\ntemporal workflow list \\\n --archived\n```\n\nList failed workflows from the last hour with root cause analysis:\n\n```\ntemporal workflow list \\\n --failed \\\n --since 1h\n```\n\nFollow child workflows to find root causes:\n\n```\ntemporal workflow list \\\n --failed \\\n --since 24h \\\n --follow-children \\\n --follow-namespaces OtherNamespace1,OtherNamespace2\n```\n\nGroup failures by error message to find patterns:\n\n```\ntemporal workflow list \\\n --failed \\\n --since 1h \\\n --group-by error \\\n --format mermaid\n```"
3585+
s.Command.Long = "List Workflow Executions. The optional `--query` limits the output to\nWorkflows matching a Query:\n\n```\ntemporal workflow list \\\n --query YourQuery\n```\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference.\n\nView a list of archived Workflow Executions:\n\n```\ntemporal workflow list \\\n --archived\n```\n\nList failed workflows from the last hour with root cause analysis:\n\n```\ntemporal workflow list \\\n --failed \\\n --since 1h\n```\n\nFollow child workflows to find root causes:\n\n```\ntemporal workflow list \\\n --failed \\\n --since 24h \\\n --follow-children \\\n --follow-namespaces OtherNamespace1,OtherNamespace2\n```\n\nGroup failures by error message to find patterns:\n\n```\ntemporal workflow list \\\n --failed \\\n --since 1h \\\n --group-by error \\\n --output mermaid\n```"
35903586
}
35913587
s.Command.Args = cobra.NoArgs
35923588
s.Command.Flags().StringVarP(&s.Query, "query", "q", "", "Content for an SQL-like `QUERY` List Filter.")
@@ -3605,8 +3601,6 @@ func NewTemporalWorkflowListCommand(cctx *CommandContext, parent *TemporalWorkfl
36053601
s.Command.Flags().BoolVar(&s.CompactErrors, "compact-errors", false, "Extract the core error message, stripping wrapper context (used with --failed).")
36063602
s.GroupBy = cliext.NewFlagStringEnum([]string{"none", "type", "namespace", "status", "error"}, "none")
36073603
s.Command.Flags().Var(&s.GroupBy, "group-by", "Group failures by a field instead of listing individually. Returns aggregated counts per group (used with --failed). Accepted values: none, type, namespace, status, error.")
3608-
s.Format = cliext.NewFlagStringEnum([]string{"default", "json", "mermaid"}, "default")
3609-
s.Command.Flags().Var(&s.Format, "format", "Output format. Use \"mermaid\" for a visual diagram (used with --failed). Shows a pie chart when grouped, or a flowchart of failure chains. Accepted values: default, json, mermaid.")
36103604
s.Command.Run = func(c *cobra.Command, args []string) {
36113605
if err := s.run(cctx, args); err != nil {
36123606
cctx.Options.Fail(err)
@@ -3790,7 +3784,6 @@ type TemporalWorkflowShowCommand struct {
37903784
Compact bool
37913785
EventTypes []string
37923786
ExcludeEventTypes []string
3793-
Format cliext.FlagStringEnum
37943787
}
37953788

37963789
func NewTemporalWorkflowShowCommand(cctx *CommandContext, parent *TemporalWorkflowCommand) *TemporalWorkflowShowCommand {
@@ -3800,18 +3793,16 @@ func NewTemporalWorkflowShowCommand(cctx *CommandContext, parent *TemporalWorkfl
38003793
s.Command.Use = "show [flags]"
38013794
s.Command.Short = "Display Event History"
38023795
if hasHighlighting {
3803-
s.Command.Long = "Show a Workflow Execution's Event History.\nWhen using JSON output (\x1b[1m--output json\x1b[0m), you may pass the results to an SDK\nto perform a replay:\n\n\x1b[1mtemporal workflow show \\\n --workflow-id YourWorkflowId\n --output json\x1b[0m\n\nGenerate a visual sequence diagram of the workflow timeline:\n\n\x1b[1mtemporal workflow show \\\n --workflow-id YourWorkflowId\n --format mermaid\x1b[0m\n\nShow a compact timeline (collapsed retries, focused events):\n\n\x1b[1mtemporal workflow show \\\n --workflow-id YourWorkflowId\n --compact\x1b[0m"
3796+
s.Command.Long = "Show a Workflow Execution's Event History.\nWhen using JSON output (\x1b[1m--output json\x1b[0m), you may pass the results to an SDK\nto perform a replay:\n\n\x1b[1mtemporal workflow show \\\n --workflow-id YourWorkflowId\n --output json\x1b[0m\n\nGenerate a visual sequence diagram of the workflow timeline:\n\n\x1b[1mtemporal workflow show \\\n --workflow-id YourWorkflowId\n --output mermaid\x1b[0m\n\nShow a compact timeline (collapsed retries, focused events):\n\n\x1b[1mtemporal workflow show \\\n --workflow-id YourWorkflowId\n --compact\x1b[0m"
38043797
} else {
3805-
s.Command.Long = "Show a Workflow Execution's Event History.\nWhen using JSON output (`--output json`), you may pass the results to an SDK\nto perform a replay:\n\n```\ntemporal workflow show \\\n --workflow-id YourWorkflowId\n --output json\n```\n\nGenerate a visual sequence diagram of the workflow timeline:\n\n```\ntemporal workflow show \\\n --workflow-id YourWorkflowId\n --format mermaid\n```\n\nShow a compact timeline (collapsed retries, focused events):\n\n```\ntemporal workflow show \\\n --workflow-id YourWorkflowId\n --compact\n```"
3798+
s.Command.Long = "Show a Workflow Execution's Event History.\nWhen using JSON output (`--output json`), you may pass the results to an SDK\nto perform a replay:\n\n```\ntemporal workflow show \\\n --workflow-id YourWorkflowId\n --output json\n```\n\nGenerate a visual sequence diagram of the workflow timeline:\n\n```\ntemporal workflow show \\\n --workflow-id YourWorkflowId\n --output mermaid\n```\n\nShow a compact timeline (collapsed retries, focused events):\n\n```\ntemporal workflow show \\\n --workflow-id YourWorkflowId\n --compact\n```"
38063799
}
38073800
s.Command.Args = cobra.NoArgs
38083801
s.Command.Flags().BoolVarP(&s.Follow, "follow", "f", false, "Follow the Workflow Execution progress in real time. Does not apply to JSON output.")
38093802
s.Command.Flags().BoolVar(&s.Detailed, "detailed", false, "Display events as detailed sections instead of table. Does not apply to JSON output.")
38103803
s.Command.Flags().BoolVar(&s.Compact, "compact", false, "Show a compact event timeline focused on activities and workflows. Collapses retries and filters noise for easier debugging.")
38113804
s.Command.Flags().StringArrayVar(&s.EventTypes, "event-types", nil, "Filter to specific event types in compact mode. Can be passed multiple times.")
38123805
s.Command.Flags().StringArrayVar(&s.ExcludeEventTypes, "exclude-event-types", nil, "Exclude specific event types in compact mode. Can be passed multiple times.")
3813-
s.Format = cliext.NewFlagStringEnum([]string{"default", "mermaid"}, "")
3814-
s.Command.Flags().Var(&s.Format, "format", "Visual output format. Use \"mermaid\" to generate a sequence diagram of the workflow timeline. Implies --compact. Accepted values: default, mermaid.")
38153806
s.WorkflowReferenceOptions.BuildFlags(s.Command.Flags())
38163807
s.Command.Run = func(c *cobra.Command, args []string) {
38173808
if err := s.run(cctx, args); err != nil {

0 commit comments

Comments
 (0)