MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / formatAutonomyFlowDetail

Function formatAutonomyFlowDetail

src/utils/autonomyFlows.ts:1066–1116  ·  view source on GitHub ↗
(
  flow: AutonomyFlowRecord | null | undefined,
)

Source from the content-addressed store, hash-verified

1064}
1065
1066export function formatAutonomyFlowDetail(
1067 flow: AutonomyFlowRecord | null | undefined,
1068): string {
1069 if (!flow) {
1070 return 'Autonomy flow not found.'
1071 }
1072 const stepLines = flow.stateJson?.steps.map((step, index) => {
1073 const runId = step.runId ?? 'none'
1074 const wait = step.waitFor ? ` | wait=${step.waitFor}` : ''
1075 const error = step.error ? ` | error=${step.error}` : ''
1076 return `${index + 1}. ${step.name} | ${step.status} | run=${runId}${wait}${error}`
1077 }) ?? ['none']
1078
1079 return [
1080 `Flow: ${flow.flowId}`,
1081 `Key: ${flow.flowKey}`,
1082 `Mode: ${flow.syncMode}`,
1083 `Revision: ${flow.revision}`,
1084 `Trigger: ${flow.trigger}`,
1085 `Status: ${flow.status}`,
1086 `Goal: ${flow.goal}`,
1087 `Source: ${flow.sourceLabel ?? flow.sourceId ?? 'automatic'}`,
1088 `Owner: ${flow.ownerKey}`,
1089 `Current step: ${flow.currentStep ?? 'none'}`,
1090 `Run count: ${flow.runCount}`,
1091 `Latest run: ${flow.latestRunId ?? 'none'}`,
1092 `Created: ${new Date(flow.createdAt).toLocaleString()}`,
1093 `Updated: ${new Date(flow.updatedAt).toLocaleString()}`,
1094 ...(flow.startedAt
1095 ? [`Started: ${new Date(flow.startedAt).toLocaleString()}`]
1096 : []),
1097 ...(flow.endedAt
1098 ? [`Ended: ${new Date(flow.endedAt).toLocaleString()}`]
1099 : []),
1100 ...(flow.waitJson
1101 ? [
1102 `Waiting: ${flow.waitJson.reason} (${flow.waitJson.stepName} @ ${flow.waitJson.stepIndex + 1})`,
1103 ]
1104 : []),
1105 ...(flow.cancelRequestedAt
1106 ? [
1107 `Cancel requested: ${new Date(flow.cancelRequestedAt).toLocaleString()}`,
1108 ]
1109 : []),
1110 ...(flow.blockedRunId ? [`Blocked run: ${flow.blockedRunId}`] : []),
1111 ...(flow.blockedSummary ? [`Blocked summary: ${flow.blockedSummary}`] : []),
1112 ...(flow.lastError ? [`Error: ${flow.lastError}`] : []),
1113 'Steps:',
1114 ...stepLines,
1115 ].join('\n')
1116}

Callers 2

getAutonomyFlowTextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected