Skip to content

refactor: consolidate shared JS constants into constants.cjs#21835

Merged
pelikhan merged 2 commits intomainfrom
copilot/refactor-constants-declaration
Mar 19, 2026
Merged

refactor: consolidate shared JS constants into constants.cjs#21835
pelikhan merged 2 commits intomainfrom
copilot/refactor-constants-declaration

Conversation

Copy link
Contributor

Copilot AI commented Mar 19, 2026

Summary

Consolidates all duplicated/shared constant declarations from non-test .cjs files into the single constants.cjs module. Updates all consumers to import from there, deploys the file to all MCP server directories, and adds comprehensive tests.

What changed

Constants moved to constants.cjs:

Constant Was duplicated in
COPILOT_REVIEWER_BOT add_copilot_reviewer.cjs, add_reviewer.cjs, create_pull_request.cjs
FAQ_CREATE_PR_PERMISSIONS_URL create_pull_request.cjs, handle_create_pr_error.cjs
MAX_LABELS add_labels.cjs, create_discussion.cjs, create_issue.cjs, update_issue.cjs
MAX_ASSIGNEES create_issue.cjs, update_issue.cjs
GATEWAY_JSONL_PATH / RPC_MESSAGES_PATH gateway_difc_filtered.cjs (path constants, now derived from TMP_GH_AW_PATH)
MANIFEST_FILE_PATH safe_output_manifest.cjs (path constant, now derived from TMP_GH_AW_PATH)

setup.sh updated: constants.cjs added to both MCP_SCRIPTS_FILES and SAFE_OUTPUTS_FILES arrays so it is deployed to all MCP server directories.

Tests: constants.test.cjs expanded to cover all 9 exported constants with 10 test assertions across grouped describe blocks.

Testing

  • All 218 tests across the 10 modified files pass
  • make fmt-cjs and make lint-cjs pass clean

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan March 19, 2026 18:13
@pelikhan pelikhan marked this pull request as ready for review March 19, 2026 18:15
Copilot AI review requested due to automatic review settings March 19, 2026 18:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the JS action code by centralizing shared constants into constants.cjs, updating consumers to import from that module, and ensuring the consolidated module is deployed to the MCP server directories.

Changes:

  • Added shared constants (bot name, URLs, limits, paths) to actions/setup/js/constants.cjs and updated multiple scripts to import them.
  • Updated actions/setup/setup.sh to deploy constants.cjs to both MCP server file sets.
  • Expanded actions/setup/js/constants.test.cjs to validate all expected exports.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
actions/setup/setup.sh Adds constants.cjs to deployed MCP script bundles.
actions/setup/js/constants.cjs Centralizes shared constants (limits, URLs, paths, bot name).
actions/setup/js/constants.test.cjs Expands tests to cover all exported constants.
actions/setup/js/add_copilot_reviewer.cjs Imports COPILOT_REVIEWER_BOT from constants.cjs.
actions/setup/js/add_reviewer.cjs Imports COPILOT_REVIEWER_BOT from constants.cjs.
actions/setup/js/create_pull_request.cjs Imports reviewer bot + FAQ URL from constants.cjs.
actions/setup/js/handle_create_pr_error.cjs Imports FAQ URL from constants.cjs.
actions/setup/js/add_labels.cjs Imports MAX_LABELS from constants.cjs.
actions/setup/js/create_discussion.cjs Imports MAX_LABELS from constants.cjs.
actions/setup/js/create_issue.cjs Imports MAX_LABELS/MAX_ASSIGNEES from constants.cjs.
actions/setup/js/update_issue.cjs Imports MAX_LABELS/MAX_ASSIGNEES from constants.cjs.
actions/setup/js/gateway_difc_filtered.cjs Imports gateway log path constants from constants.cjs.
actions/setup/js/safe_output_manifest.cjs Imports manifest file path constant from constants.cjs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@pelikhan pelikhan merged commit d1dc19e into main Mar 19, 2026
48 checks passed
@pelikhan pelikhan deleted the copilot/refactor-constants-declaration branch March 19, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants