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

Function missingWorkFromFlags

internal/cli/task.go:2765–2797  ·  view source on GitHub ↗
(items []string, raw string)

Source from the content-addressed store, hash-verified

2763}
2764
2765func missingWorkFromFlags(items []string, raw string) (json.RawMessage, error) {
2766 hasRaw := strings.TrimSpace(raw) != ""
2767 if hasRaw && len(items) > 0 {
2768 return nil, errors.New("cli: --missing-work-json cannot be combined with --missing-work")
2769 }
2770 if hasRaw {
2771 payload, err := parseJSONFlag("missing-work-json", raw)
2772 if err != nil {
2773 return nil, err
2774 }
2775 var items []json.RawMessage
2776 if err := json.Unmarshal(payload, &items); err != nil {
2777 return nil, errors.New("cli: --missing-work-json must be a JSON array")
2778 }
2779 return payload, nil
2780 }
2781
2782 normalized := make([]string, 0, len(items))
2783 for _, item := range items {
2784 trimmed := strings.TrimSpace(item)
2785 if trimmed != "" {
2786 normalized = append(normalized, trimmed)
2787 }
2788 }
2789 if len(normalized) == 0 {
2790 return nil, nil
2791 }
2792 payload, err := json.Marshal(normalized)
2793 if err != nil {
2794 return nil, fmt.Errorf("cli: encode --missing-work: %w", err)
2795 }
2796 return payload, nil
2797}
2798
2799func resolveTaskScopeWorkspace(
2800 rawScope string,

Callers 1

Calls 2

parseJSONFlagFunction · 0.85
appendFunction · 0.85

Tested by

no test coverage detected