MCPcopy Create free account
hub / github.com/compozy/agh / newTaskChildCreateCommand

Function newTaskChildCreateCommand

internal/cli/task.go:2203–2274  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

2201}
2202
2203func newTaskChildCreateCommand(deps commandDeps) *cobra.Command {
2204 var (
2205 id string
2206 identifier string
2207 scopeRaw string
2208 workspaceRef string
2209 networkRaw string
2210 title string
2211 description string
2212 priorityRaw string
2213 ownerKindRaw string
2214 ownerRef string
2215 metadataRaw string
2216 autoEnqueue bool
2217 )
2218
2219 cmd := &cobra.Command{
2220 Use: "create <parent-id>",
2221 Short: "Create a child task beneath a parent",
2222 Args: exactOneNonBlankArg(),
2223 RunE: func(cmd *cobra.Command, args []string) error {
2224 client, err := clientFromDeps(deps)
2225 if err != nil {
2226 return err
2227 }
2228
2229 baseRequest, err := buildTaskCreateRequest(cmd, taskCreateInput{
2230 ID: id,
2231 Identifier: identifier,
2232 ScopeRaw: scopeRaw,
2233 WorkspaceRef: workspaceRef,
2234 NetworkRaw: networkRaw,
2235 Title: title,
2236 Description: description,
2237 PriorityRaw: priorityRaw,
2238 OwnerKindRaw: ownerKindRaw,
2239 OwnerRef: ownerRef,
2240 MetadataRaw: metadataRaw,
2241 AutoEnqueueOnReady: autoEnqueue,
2242 })
2243 if err != nil {
2244 return err
2245 }
2246 request := CreateTaskChildRequest(baseRequest)
2247
2248 created, err := client.CreateChildTask(cmd.Context(), args[0], request)
2249 if err != nil {
2250 return err
2251 }
2252 return writeCommandOutput(cmd, taskBundle(&created))
2253 },
2254 }
2255 cmd.Flags().StringVar(&id, "id", "", "Explicit child task ID")
2256 cmd.Flags().
2257 StringVar(&identifier, taskIdentifierKey, "", "Human-friendly child task identifier")
2258 cmd.Flags().StringVar(&scopeRaw, taskScopeKey, "", "Child task scope: global or workspace")
2259 cmd.Flags().
2260 StringVar(&workspaceRef, "workspace", "", "Workspace path, name, or ID (required when --scope=workspace)")

Callers 1

newTaskChildCommandFunction · 0.85

Calls 8

exactOneNonBlankArgFunction · 0.85
clientFromDepsFunction · 0.85
buildTaskCreateRequestFunction · 0.85
writeCommandOutputFunction · 0.85
taskBundleFunction · 0.85
mustMarkFlagRequiredFunction · 0.85
CreateChildTaskMethod · 0.65

Tested by

no test coverage detected