Skip to content

refactor: make shared message functions reusable - #85

Closed
k-alphonse wants to merge 2 commits into
stagingfrom
ka/refactor/84/shared-messages
Closed

k-alphonse wants to merge 2 commits into
stagingfrom
ka/refactor/84/shared-messages

Conversation

@k-alphonse

@k-alphonse k-alphonse commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Scope review — 2 October 2026

Closed without merging after the supervisor clarified the requirement. The existing msg function already supports info, ok, warn, fail, and notice messages. Hierarchies' current CI messages use these existing categories, so no missing message type has been identified. Extracting the functions into a new file is not required for this task. Reuse the existing functions in the consumer; add a category only when a concrete missing requirement is established.

🥇 Generic Pull Request 🥇

Elizabeth Consulting International Inc

Purpose & Objective

This PR makes the existing colored-message functions reusable in shell scripts and CI pipelines.

These functions currently live in src/bash/functions, which also performs terminal setup. Separating them allows scripts such as Hierarchies’ CI runner to load only the messaging functions and share the company’s existing output format.

Changes

  • Move msg, emsg, kmsg, imsg, and wmsg into src/bash/messages.
  • Update src/bash/functions to load the shared file in both Bash and Zsh.
  • Preserve the existing function names, message labels, colours, spacing, and timestamp timezone.
  • Document how scripts and containers can load the functions, with usage examples and verification commands.

Testing

The following checks passed against the prepared changes:

  • Bash and Zsh syntax checks for both shell files.
  • Loading messages directly produces no output or terminal setup.
  • Message labels and colours match the existing implementation.
  • Loading the full functions file works from another working directory, including when the checkout path contains spaces.
  • Patch application and Git whitespace checks pass.

Repository linting and Docker integration have not been run. Updating Hierarchies to consume the shared functions is a separate follow-up.

Closes #84.


  • This PR satisfies the PR checklist.

@k-alphonse k-alphonse self-assigned this Oct 2, 2026
Copilot AI balanced review requested due to automatic review settings October 2, 2026 19:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused refactor preserves existing behavior and satisfies the stated reuse and documentation requirements.

Review effort: Balanced
Findings: None

What changed in this PR

Extracts reusable shell messaging functions while preserving existing terminal behavior and documenting standalone usage.

Changes:

  • Adds a standalone message-function module.
  • Loads it safely from Bash and Zsh.
  • Documents script and container usage.
File Description
src/​bash/​messages Defines shared message functions.
src/​bash/​functions Sources messages using shell-specific paths.
README.md Documents usage and verification.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@k-alphonse
k-alphonse enabled auto-merge October 2, 2026 19:58
Explain and narrowly suppress the Bash-only diagnostic for the guarded Zsh expansion.
Mark the shared message file executable to match the repository lint convention.
Allow only the lint job to read contents and publish commit statuses.
Copilot AI balanced review requested due to automatic review settings October 2, 2026 20:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The extraction preserves existing behavior and satisfies the stated reuse and documentation requirements.

Review effort: Balanced
Findings: None

@k-alphonse k-alphonse closed this Oct 2, 2026
auto-merge was automatically disabled October 2, 2026 20:19

Pull request was closed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants