Skip to content

Move the tracker verb CLI helpers into one seam lib file #15603

Description

@kyle-sexton

Agent Brief

Type: Task
Summary: Move the tracker verb CLI helpers wit_help_if_requested and wit_usage_error into one seam lib file, plugins/work-items/tools/work-item-tracker/lib/verb-cli.sh, and fold the jira JQL value-list copy into jira/common.sh (part of restructuring pass #14823).

Current behavior:
The five adapter common.sh files under plugins/work-items/tools/work-item-tracker/ repeat two helpers:

  • wit_help_if_requested: identical in adapters/github/common.sh:108-115, adapters/local-markdown/common.sh:60-67, seeds/jira/common.sh:120-127 and seeds/linear/common.sh:169-176. seeds/gitea/common.sh:159-163 tests ${2:-} where the others shift and test ${1:-}; every caller passes the usage text and then "$@" (for example seeds/jira/list-items.sh:10), so both forms print and exit alike.
  • wit_usage_error: identical in local-markdown/common.sh:54-57, gitea/common.sh:138-141, jira/common.sh:114-117 and linear/common.sh:148-151, naming BASH_SOURCE[1]. github's (github/common.sh:87-94) names the bottom of the source stack, which differs when a lib/id.sh function calls it (lib/id.sh:32-57).

The jira JQL value-list builder exists twice: jql_value_list at seeds/jira/list-items.sh:62-68, called at :75, :76 and :80, and the same jq filter inline at seeds/jira/common.sh:382.

Each common.sh loads seam libs as a <prefix>_require_seam_lib check, a # shellcheck source= line and source; the json.sh lines are github :30-32, local-markdown :36-38, gitea :49-51, jira :37-39 and linear :51-53. A seed run as a consumer copy finds the lib directory through WIT_SEAM_LIB_DIR (jira/common.sh:20-26).

Desired behavior:

  • New lib/verb-cli.sh, mode 100644, sourced only, with the source guard of the other seam libs (lib/id.sh:5-6, lib/json.sh:4-5). It holds wit_help_if_requested and the BASH_SOURCE[1] form of wit_usage_error, which reads the caller's EX_USAGE; that read takes a reasoned SC2154 disable, as at gitea/common.sh:186.
  • Each common.sh loads it beside its json.sh lines, in the same three-line form. local-markdown, gitea, jira and linear then delete both helpers; github deletes only wit_help_if_requested, and its own wit_usage_error, defined after the source line, still wins.
  • The EX_* constants stay in each file: they are readonly and the sets differ (github :75-81, local-markdown :45-48, gitea :59-65, jira :48-53, linear :61-67).
  • jql_value_list moves into jira/common.sh as wit_jira_value_list; :382 and the three list-items.sh call sites call it.
  • No verb-cli.test.sh is added. No repository check pairs a seam lib with a test (lib/labels.sh and lib/recurrence.sh have none), and the test selector maps the new file through each common.sh that sources it (scripts/affected-tests.sh:93-97,192-196) and through the test-scope: plugins/work-items/tools/work-item-tracker/lib/* lines of adapters/github/list-items.test.sh:3, adapters/local-markdown/list-items.test.sh:3 and seeds/jira/list-items.test.sh:6 (scripts/affected-tests.sh:133-145).

Files:

  • plugins/work-items/tools/work-item-tracker/lib/verb-cli.sh (new)
  • plugins/work-items/tools/work-item-tracker/adapters/github/common.sh
  • plugins/work-items/tools/work-item-tracker/adapters/local-markdown/common.sh
  • plugins/work-items/tools/work-item-tracker/seeds/gitea/common.sh
  • plugins/work-items/tools/work-item-tracker/seeds/jira/common.sh
  • plugins/work-items/tools/work-item-tracker/seeds/linear/common.sh
  • plugins/work-items/tools/work-item-tracker/seeds/jira/list-items.sh
  • a new patch fragment in .changes/work-items/: ### Changed, "Internal restructuring, no behavior change."

Key interfaces:

  • Each verb's --help text, usage-error text and exit codes: unchanged.
  • Each common.test.sh checks with declare -F that wit_help_if_requested is defined after sourcing common.sh (github :20, local-markdown :17, gitea :47, jira :13, linear :47); it still is.
  • Outside the tracker tree only plugins/work-items/skills/onboard-adapter/scripts/generate-adapter.sh and its templates/ name these helpers, and generated adapters keep their own copies.

Acceptance criteria:

  • wit_help_if_requested is defined once, in lib/verb-cli.sh; wit_usage_error is defined in lib/verb-cli.sh and adapters/github/common.sh only; the JQL value-list filter exists once, in wit_jira_value_list.
  • Behavior is unchanged: the same outputs, exit codes and printed results for the same inputs.
  • The diff edits only the listed files and the lines of a test that assert on them when the change breaks that assertion.
  • The pull request stays within 400 changed lines and 15 hand-edited files.
  • The *.test.sh suites under plugins/work-items/tools/work-item-tracker/ pass, including adapters/*/, seeds/*/, lib/, conformance/, work-item-tracker.test.sh and seed-copy.test.sh.
  • ci-status is green.

Out of scope:

  • The EX_* constants, gitea's and linear's wit_<provider>_unimplemented, the onboard-adapter generator and templates, a new test file, other duplication, eval cases, fixtures, and skill and agent text.

Activity

  1. added
    status: ready
    on Nov 12, 2026
  2. added theissue type on Nov 12, 2026
  3. melodic-automation-lanes commented on Nov 12, 2026

    @melodic-automation-lanes
    Contributor

    {"v":1,"actor_id":337595936,"title_sha256":"a8c9e2e396eb581fada190746bcffd618c667650392f584a2d67d60c1a467168","body_sha256":"cfcc3bbd38f44c2a7e2c0341dfa4fc7a3d12fdd5acf2a93e7e30055dd1ac8a19"}

  4. removed
    status: ready
    on Nov 12, 2026
  5. github-actions commented on Nov 12, 2026

    @github-actions
    Contributor
    No description provided.
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

    No labels
    No labels

    Type

    Fields

    Work status

    needs-triage

    Priority

    low

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions