LearnNewsExamplesServices
Frontmatter
id8514
titleRefactor createLabelIndex.mjs to use Commander and enhance JSDoc
stateClosed
labels
documentationairefactoring
assigneestobiu
createdAtJan 10, 2026, 7:27 PM
updatedAtJan 10, 2026, 7:41 PM
githubUrlhttps://github.com/neomjs/neo/issues/8514
authortobiu
commentsCount2
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 10, 2026, 7:41 PM

Refactor createLabelIndex.mjs to use Commander and enhance JSDoc

Closed v11.20.0 documentationairefactoring
tobiu
tobiu commented on Jan 10, 2026, 7:27 PM

To improve consistency and maintainability of our build scripts, buildScripts/createLabelIndex.mjs needs to be refactored to match the pattern used in buildScripts/createReleaseIndex.mjs.

Requirements:

  1. Commander Integration: Use the commander library for CLI argument parsing.
    • Support -o, --output <path> to specify a custom output file.
  2. Architecture:
    • Export the main logic as a reusable async function createLabelIndex(options).
    • Include a runCli() function for standalone execution.
    • Use process.cwd() based path resolution for consistency.
  3. Documentation (Knowledge Base Enhancement Strategy):
    • Add comprehensive JSDoc to the module and main function.
    • Include @summary, @module, and semantic @keywords (e.g., github, labels, build-script, portal).
    • Explain the script's purpose: fetching labels from GitHub and generating a JSON index for the Portal.

Context: This script is essential for the "Tickets" view in the Portal (Issue #8398), ensuring that ticket labels are rendered with correct colors and high-contrast text.

tobiu added the documentation label on Jan 10, 2026, 7:27 PM
tobiu added the ai label on Jan 10, 2026, 7:27 PM
tobiu added the refactoring label on Jan 10, 2026, 7:27 PM
tobiu
tobiu Jan 10, 2026, 7:40 PM

Input from Gemini 3 Pro:

✦ Completed refactoring of buildScripts/createLabelIndex.mjs.

Changes:

  1. Architecture: Converted to a dual-mode module (importable function + standalone CLI) matching createReleaseIndex.mjs.
  2. CLI: Integrated commander for robust argument parsing (-o, --output).
  3. Documentation: Applied Knowledge Base Enhancement Strategy with comprehensive JSDoc (@summary, @module, @keywords).
  4. Fix: Added graceful shutdown of the Neural Link connection to prevent the script from hanging due to the persistent WebSocket.

Verified:

  • Script runs standalone: node buildScripts/createLabelIndex.mjs
  • Script exits cleanly (no hang).
  • Output labels.json is generated correctly.
tobiu referenced in commit 2eaa11a - "refactor: Enhance createLabelIndex.mjs with Commander, JSDoc and SDK cleanup (#8514)" on Jan 10, 2026, 7:41 PM
tobiu assigned to @tobiu on Jan 10, 2026, 7:41 PM
tobiu
tobiu Jan 10, 2026, 7:41 PM

Input from Gemini 3 Pro:

✦ Closing ticket as the refactoring is complete and verified.

tobiu closed this issue on Jan 10, 2026, 7:41 PM
tobiu referenced in commit 677f52e - "fix: Add explicit process.exit(0) to createLabelIndex CLI runner (#8514)" on Jan 10, 2026, 7:53 PM