Skip to content

refactor(issue): split 839-line issue.js by feature group#35

Merged
pchuri merged 1 commit into
mainfrom
refactor/split-issue-commands
May 10, 2026
Merged

refactor(issue): split 839-line issue.js by feature group#35
pchuri merged 1 commit into
mainfrom
refactor/split-issue-commands

Conversation

@pchuri
Copy link
Copy Markdown
Owner

@pchuri pchuri commented May 10, 2026

Summary

  • Split bin/commands/issue.js (839 lines) into a thin router (18 lines) plus three feature modules under bin/commands/issue/.
  • New layout:
    bin/commands/
    ├── issue.js          (router only — wires command tree)
    └── issue/
        ├── crud.js       list / view / create / edit / delete
        ├── comment.js    comment add / list / edit / delete
        ├── link.js       remote-link list / add / update / delete
        └── shared.js     readDescriptionFile (shared by crud + comment)
    
  • Each feature module exports a register(command, factory) function that owns its own subcommand registration plus the action handlers.

Why

The single 839-line file had grown 18 async handlers across 3 unrelated feature areas, making it hard to navigate and review. Splitting by feature group improves cohesion without inflating the public surface — same CLI, same flags, same help text, same tests.

Non-changes (intentional)

  • No behavior change.
  • No flag/help-text/error-message edits — every string preserved verbatim.
  • No test changes — existing tests in tests/commands/issue.test.js exercise the public command tree and pass unmodified.

Test plan

  • npm test — 251 tests pass (unchanged from main)
  • npm run lint — clean
  • node bin/index.js issue --help renders identically (verified locally)
  • node bin/index.js issue comment --help renders identically
  • node bin/index.js issue remote-link --help renders identically

issue.js shrinks to a router that wires the issue command to three
feature modules:

  bin/commands/issue/
  ├── crud.js     list / view / create / edit / delete
  ├── comment.js  comment add / list / edit / delete
  ├── link.js     remote-link list / add / update / delete
  └── shared.js   readDescriptionFile (used by crud and comment)

No behavior change — same CLI surface, same flags, same help text. All
251 tests pass and `jira issue --help` / `comment --help` /
`remote-link --help` render identically.
@pchuri pchuri self-assigned this May 10, 2026
@pchuri pchuri merged commit a51ddae into main May 10, 2026
5 checks passed
@pchuri pchuri deleted the refactor/split-issue-commands branch May 10, 2026 06:50
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 2.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant