Skip to content

Automate cleanup of completed issue specs in docs/issues with a non-interactive script #1774

Open

Description

@josecelano

Summary

Create an automation script for the skill at .github/skills/dev/planning/cleanup-completed-issues/SKILL.md to reduce manual work and mistakes when cleaning completed issues.

The script should support the two-stage lifecycle already documented:

  1. Stage 1: move closed issue specs from docs/issues/open/ to docs/issues/closed/
  2. Stage 2: delete old specs from docs/issues/closed/ only when no longer referenced

Motivation

The current process is repetitive and easy to get wrong in batch operations.
Automating it would make maintenance faster and safer while keeping behavior aligned with the skill.

Proposed scope (phase 1)

Implement a script for Stage 1 archive with a strict, agent-friendly interface:

  • Non-interactive CLI only (no prompts)
  • Verify issue state on GitHub before moving
  • Support dry run by default
  • Support apply mode for real changes
  • Produce structured JSON on stdout
  • Send diagnostics to stderr
  • Return meaningful non-zero exit codes on failure

Suggested flags:

  • --issues 1042,1178,...
  • --all-closed-in-open (optional)
  • --dry-run (default)
  • --apply
  • --json

Proposed scope (phase 2)

Add Stage 2 delete with stronger safeguards:

  • Check references before delete (filename and issue references in docs)
  • Refuse deletion if references are found unless explicit override is provided
  • Keep --dry-run default and require explicit confirmation flag for destructive actions

Acceptance criteria

  • Script is added under the cleanup skill folder (for example scripts/)
  • SKILL.md documents the script(s), usage, examples, and prerequisites
  • Stage 1 move flow is fully automated and idempotent
  • Script never blocks on interactive input
  • Output is parseable JSON for results; diagnostics are separate
  • Dry-run behavior is default
  • Errors are explicit and actionable (invalid issue, open issue, missing file, ambiguous file)
  • Basic tests or fixture-based validation for key paths are included

Notes

Reference guidance used for script design:

Key recommendations to follow:

  • avoid interactive prompts
  • provide clear --help
  • use structured output
  • separate stdout data from stderr diagnostics
  • use safe defaults (--dry-run)
  • support idempotent retries

Activity

  1. added 2 commits that reference this issue on May 13, 2026
  2. added
    - Developer -
    and removed on May 13, 2026
  3. added a commit that references this issue on Jul 20, 2026
  4. da2ce7 commented on Sep 24, 2026

    @da2ce7
    Contributor

    Archival measurements for this issue's Stage 1 (--all-closed-in-open). Tree at develop fa698c43; issue and pull-request capture of 2026-09-24T11:03Z.

    Specifications under docs/issues/open/ whose issue GitHub reports as closed: 8 of 29.

    Issue Closed (UTC) Directory
    #2157 2026-09-14 2157-2003-require-documented-clippy-allows
    #2234 2026-09-17 2234-1488-si-2-remove-global-shutdown-signal
    #2226 2026-09-18 2226-fix-stale-inactivity-cutoff-in-activity-metrics-updater
    #2159 2026-09-18 2159-2003-adopt-folder-style-issue-specs
    #2179 2026-09-21 2179-fix-docker-e2e-package-flag
    #2230 2026-09-21 2230-add-fix-bug-skill-and-bug-spec-guardrails
    #2274 2026-09-22 2274-1488-si-10-add-token-aware-axum-drain-helper
    #2280 2026-09-24 2280-2264-generate-v1-schema-and-verify-drift (archive PR #2331 open)

    No specification under docs/issues/closed/ belongs to an open issue. No specification under open/ belongs to an issue closed before 2026-09-14.

    Rule. .github/skills/dev/planning/cleanup-completed-issues/SKILL.md:31 archives a specification "when its PR is merged and the issue is closed on GitHub". Line 32 also allows "Batch archive: Periodically move multiple closed issue files during maintenance."

    Archive pull requests. These are pull requests with "archive" in the title, created from 2026-08-01 to the capture:

    The specification PR for #2190 (#2193) counted sixteen closed-issue specifications under open/ at f6b73e29 on 2026-09-09.

    Question: are the eight above waiting for a batch archive, or were they missed by the per-pull-request archive step? The answer tells whether Stage 1 replaces a batch routine or a per-merge step.

  5. added 2 commits that reference this issue on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    - Developer -Automation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions