chief-clancy 0.7.3 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -617,6 +617,142 @@ Continue — do not stop. The local file is the source of truth.
617
617
 
618
618
  ---
619
619
 
620
+ ## Step 10a — Apply pipeline label (board-sourced only)
621
+
622
+ Only for board-sourced briefs (ticket key was provided). Inline text and file briefs skip this step.
623
+
624
+ **This step is mandatory for board-sourced briefs — always apply the label.** Use `CLANCY_LABEL_BRIEF` from `.clancy/.env` if set. If not set, use `clancy:brief` as the default. Ensure the label exists on the board (create it if missing), then add it to the ticket. Also read `CLANCY_LABEL_PLAN` (default: `clancy:plan`) and `CLANCY_LABEL_BUILD` (default: `clancy:build`) for cleanup during re-briefs.
625
+
626
+ ### Re-brief cleanup (`--fresh` flag)
627
+
628
+ If this is a re-brief (`--fresh`), the ticket may already have `clancy:plan` or `clancy:build` from a prior approval. Remove them first (best-effort — ignore failures):
629
+
630
+ #### GitHub
631
+
632
+ ```bash
633
+ # Remove plan label (ignore 404)
634
+ curl -s \
635
+ -H "Authorization: Bearer $GITHUB_TOKEN" \
636
+ -H "Accept: application/vnd.github+json" \
637
+ -H "X-GitHub-Api-Version: 2022-11-28" \
638
+ -X DELETE \
639
+ "https://api.github.com/repos/$GITHUB_REPO/issues/$ISSUE_NUMBER/labels/$(echo $CLANCY_LABEL_PLAN | jq -Rr @uri)"
640
+
641
+ # Remove build label (ignore 404)
642
+ curl -s \
643
+ -H "Authorization: Bearer $GITHUB_TOKEN" \
644
+ -H "Accept: application/vnd.github+json" \
645
+ -H "X-GitHub-Api-Version: 2022-11-28" \
646
+ -X DELETE \
647
+ "https://api.github.com/repos/$GITHUB_REPO/issues/$ISSUE_NUMBER/labels/$(echo $CLANCY_LABEL_BUILD | jq -Rr @uri)"
648
+ ```
649
+
650
+ #### Jira
651
+
652
+ ```bash
653
+ # Fetch current labels, remove plan + build labels, PUT updated list
654
+ CURRENT_LABELS=$(curl -s \
655
+ -u "$JIRA_USER:$JIRA_API_TOKEN" \
656
+ -H "Accept: application/json" \
657
+ "$JIRA_BASE_URL/rest/api/3/issue/$TICKET_KEY?fields=labels" | jq -r '.fields.labels')
658
+
659
+ UPDATED_LABELS=$(echo "$CURRENT_LABELS" | jq --arg plan "$CLANCY_LABEL_PLAN" --arg build "$CLANCY_LABEL_BUILD" '[.[] | select(. != $plan and . != $build)]')
660
+
661
+ curl -s \
662
+ -u "$JIRA_USER:$JIRA_API_TOKEN" \
663
+ -X PUT \
664
+ -H "Content-Type: application/json" \
665
+ "$JIRA_BASE_URL/rest/api/3/issue/$TICKET_KEY" \
666
+ -d "{\"fields\": {\"labels\": $UPDATED_LABELS}}"
667
+ ```
668
+
669
+ #### Linear
670
+
671
+ ```bash
672
+ # Fetch current label IDs, remove plan + build label IDs, update issue
673
+ # Query current labels on the issue
674
+ ISSUE_DATA=$(curl -s \
675
+ -X POST \
676
+ -H "Content-Type: application/json" \
677
+ -H "Authorization: $LINEAR_API_KEY" \
678
+ "https://api.linear.app/graphql" \
679
+ -d '{"query": "query { issues(filter: { identifier: { eq: \"$IDENTIFIER\" } }) { nodes { id labels { nodes { id name } } } } }"}')
680
+
681
+ # Filter out plan + build label IDs, then issueUpdate with remaining labelIds
682
+ ```
683
+
684
+ ### Add brief label
685
+
686
+ Ensure the label exists and add it to the ticket. Best-effort — warn on failure, never stop.
687
+
688
+ #### GitHub
689
+
690
+ ```bash
691
+ # Ensure label exists (ignore 422 = already exists)
692
+ curl -s \
693
+ -H "Authorization: Bearer $GITHUB_TOKEN" \
694
+ -H "Accept: application/vnd.github+json" \
695
+ -H "X-GitHub-Api-Version: 2022-11-28" \
696
+ -H "Content-Type: application/json" \
697
+ -X POST \
698
+ "https://api.github.com/repos/$GITHUB_REPO/labels" \
699
+ -d '{"name": "$CLANCY_LABEL_BRIEF", "color": "0075ca"}'
700
+
701
+ # Add label to issue
702
+ curl -s \
703
+ -H "Authorization: Bearer $GITHUB_TOKEN" \
704
+ -H "Accept: application/vnd.github+json" \
705
+ -H "X-GitHub-Api-Version: 2022-11-28" \
706
+ -H "Content-Type: application/json" \
707
+ -X POST \
708
+ "https://api.github.com/repos/$GITHUB_REPO/issues/$ISSUE_NUMBER/labels" \
709
+ -d '{"labels": ["$CLANCY_LABEL_BRIEF"]}'
710
+ ```
711
+
712
+ #### Jira
713
+
714
+ ```bash
715
+ # Jira auto-creates labels — just add to the issue's label array
716
+ CURRENT_LABELS=$(curl -s \
717
+ -u "$JIRA_USER:$JIRA_API_TOKEN" \
718
+ -H "Accept: application/json" \
719
+ "$JIRA_BASE_URL/rest/api/3/issue/$TICKET_KEY?fields=labels" | jq -r '.fields.labels')
720
+
721
+ UPDATED_LABELS=$(echo "$CURRENT_LABELS" | jq --arg brief "$CLANCY_LABEL_BRIEF" '. + [$brief] | unique')
722
+
723
+ curl -s \
724
+ -u "$JIRA_USER:$JIRA_API_TOKEN" \
725
+ -X PUT \
726
+ -H "Content-Type: application/json" \
727
+ "$JIRA_BASE_URL/rest/api/3/issue/$TICKET_KEY" \
728
+ -d "{\"fields\": {\"labels\": $UPDATED_LABELS}}"
729
+ ```
730
+
731
+ #### Linear
732
+
733
+ ```bash
734
+ # Ensure label exists (check team labels, workspace labels, create if missing)
735
+ # Then add to issue via issueUpdate with updated labelIds array
736
+ curl -s \
737
+ -X POST \
738
+ -H "Content-Type: application/json" \
739
+ -H "Authorization: $LINEAR_API_KEY" \
740
+ "https://api.linear.app/graphql" \
741
+ -d '{"query": "mutation { issueLabelCreate(input: { teamId: \"$LINEAR_TEAM_ID\", name: \"$CLANCY_LABEL_BRIEF\", color: \"#0075ca\" }) { success issueLabel { id } } }"}'
742
+
743
+ # Add label to issue (fetch current labelIds, append new, issueUpdate)
744
+ ```
745
+
746
+ #### On failure (any platform)
747
+
748
+ ```
749
+ ⚠️ Could not add pipeline label to {KEY}. The brief was saved and posted successfully — label it manually if needed.
750
+ ```
751
+
752
+ Continue — do not stop.
753
+
754
+ ---
755
+
620
756
  ## Step 11 — Brief inventory (`--list`)
621
757
 
622
758
  If `--list` flag is present, display an inventory of all briefs and stop.
@@ -59,6 +59,16 @@ MAX_ITERATIONS=20
59
59
  # Grill mode: "interactive" (human grill) or "afk" (AI-grill). Default: interactive
60
60
  # CLANCY_MODE=interactive
61
61
 
62
+ # ─── Optional: Pipeline labels ────────────────────────────────────────────────
63
+ # Labels that control ticket flow through pipeline stages.
64
+ # CLANCY_LABEL_BRIEF marks tickets that have been briefed (awaiting approval).
65
+ # CLANCY_LABEL_PLAN marks tickets that need planning.
66
+ # CLANCY_LABEL_BUILD marks tickets ready for implementation.
67
+ # Deprecated: CLANCY_LABEL (use CLANCY_LABEL_BUILD), CLANCY_PLAN_LABEL (use CLANCY_LABEL_PLAN)
68
+ # CLANCY_LABEL_BRIEF="clancy:brief"
69
+ # CLANCY_LABEL_PLAN="clancy:plan"
70
+ # CLANCY_LABEL_BUILD="clancy:build"
71
+
62
72
  # ─── Optional: Reliable autonomous mode ─────────────────────────────────────
63
73
  # Max self-healing fix attempts before delivering with warnings (default: 2, 0 to disable)
64
74
  # CLANCY_FIX_RETRIES=2
@@ -77,6 +77,16 @@ MAX_ITERATIONS=5
77
77
  # Grill mode: "interactive" (human grill) or "afk" (AI-grill). Default: interactive
78
78
  # CLANCY_MODE=interactive
79
79
 
80
+ # ─── Optional: Pipeline labels ────────────────────────────────────────────────
81
+ # Labels that control ticket flow through pipeline stages.
82
+ # CLANCY_LABEL_BRIEF marks tickets that have been briefed (awaiting approval).
83
+ # CLANCY_LABEL_PLAN marks tickets that need planning.
84
+ # CLANCY_LABEL_BUILD marks tickets ready for implementation.
85
+ # Deprecated: CLANCY_LABEL (use CLANCY_LABEL_BUILD), CLANCY_PLAN_LABEL (use CLANCY_LABEL_PLAN)
86
+ # CLANCY_LABEL_BRIEF="clancy:brief"
87
+ # CLANCY_LABEL_PLAN="clancy:plan"
88
+ # CLANCY_LABEL_BUILD="clancy:build"
89
+
80
90
  # ─── Optional: Reliable autonomous mode ─────────────────────────────────────
81
91
  # Max self-healing fix attempts before delivering with warnings (default: 2, 0 to disable)
82
92
  # CLANCY_FIX_RETRIES=2
@@ -65,6 +65,16 @@ MAX_ITERATIONS=20
65
65
  # Grill mode: "interactive" (human grill) or "afk" (AI-grill). Default: interactive
66
66
  # CLANCY_MODE=interactive
67
67
 
68
+ # ─── Optional: Pipeline labels ────────────────────────────────────────────────
69
+ # Labels that control ticket flow through pipeline stages.
70
+ # CLANCY_LABEL_BRIEF marks tickets that have been briefed (awaiting approval).
71
+ # CLANCY_LABEL_PLAN marks tickets that need planning.
72
+ # CLANCY_LABEL_BUILD marks tickets ready for implementation.
73
+ # Deprecated: CLANCY_LABEL (use CLANCY_LABEL_BUILD), CLANCY_PLAN_LABEL (use CLANCY_LABEL_PLAN)
74
+ # CLANCY_LABEL_BRIEF="clancy:brief"
75
+ # CLANCY_LABEL_PLAN="clancy:plan"
76
+ # CLANCY_LABEL_BUILD="clancy:build"
77
+
68
78
  # ─── Optional: Reliable autonomous mode ─────────────────────────────────────
69
79
  # Max self-healing fix attempts before delivering with warnings (default: 2, 0 to disable)
70
80
  # CLANCY_FIX_RETRIES=2