refactor: split manage_labels.py into reusable modes (#6) #62
Reference in New Issue
Block a user
Delete Branch "feat/issue-6-manage-labels-modes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #6.
What
Split
manage_labels.py's one-shot backfill into reusable, mode-selected operations — default behavior preserved.--create-labels— idempotent label creation only (create_labels()).--apply-mapping— one-offMAPPINGlabeling only (apply_mapping(); PUT replaces each issue's label set).--add-label <issue> <label>— ad-hoc single-issue labeling (add_label(); POST appends the label, does not replace; refuses an undefined label; validates numeric issue).MAPPING, identical to before.--dry(and--dry-run) still print without writing.Extracted
create_labels/apply_mapping/add_label/_labels_by_name.LABELS,MAPPING, and theapi()wrapper unchanged. No auth/network behavior change.Tests / checks
tests/test_manage_labels.py— addedTestModes: create-only (no PUT), apply-only (no label creation), add-label appends (POST not PUT, correct id), unknown-label no-op, dry no-op, non-numeric issue exits. Existing default/dry/mapping/constant tests unchanged and pass.py_compileclean; full suite (isolated worktree): 319 passed, 0 failures, 0 errors (JUnit XML);git diff --checkclean; secret scan clean.Files changed
manage_labels.py,tests/test_manage_labels.py.Process
Isolated worktree:
./scripts/worktree-start feat/issue-6-manage-labels-modes→branches/feat-issue-6-manage-labels-modes.⚠️ Authored by me — do not self-merge. Needs review by another author.