Skip to content

Conversation

@Tearran
Copy link
Owner

@Tearran Tearran commented Jun 16, 2025

Summary by CodeRabbit

  • New Features
    • Introduced interactive info and message boxes for terminal interfaces, allowing users to view rolling logs or informational messages during background tasks.
    • Added support for displaying messages using dialog tools or plain text, with options for live updates or static content.
  • Documentation
    • Included built-in help and usage instructions for new interface features.
  • Tests
    • Added initial placeholder test scripts for the new info and message box modules.
  • Bug Fixes
    • Corrected a configuration key typo in the debug settings for improved metadata accuracy.
  • Chores
    • Removed unused template-related configuration files and scripts to streamline the codebase.

Tearran added 2 commits June 16, 2025 14:51
new file:   interface/info_box.sh
new file:   interface/ok_box.conf
new file:   interface/ok_box.sh
new file:   interface/test_info_box.sh
new file:   interface/test_ok_box.sh
renamed:    interface/info_box.sh -> staging/interface/info_box.sh
renamed:    interface/ok_box.conf -> staging/interface/ok_box.conf
renamed:    interface/ok_box.sh -> staging/interface/ok_box.sh
renamed:    interface/test_info_box.sh -> staging/interface/test_info_box.sh
renamed:    interface/test_ok_box.sh -> staging/interface/test_ok_box.sh
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 16, 2025

Walkthrough

New interface modules for displaying informational and OK message boxes in terminal user interfaces have been introduced, including their configuration files, implementation scripts, and placeholder test scripts. The modules support both dynamic and static message display using dialog or whiptail, with help and usage documentation provided in corresponding sections. A minor typo fix was made in the debug configuration. Additionally, the previously existing templates module files and configuration were removed.

Changes

File(s) Change Summary
staging/interface/info_box.conf,
staging/interface/ok_box.conf
Added configuration files defining new interface features for info and OK message boxes, including about/help sections.
staging/interface/info_box.sh,
staging/interface/ok_box.sh
Added shell scripts implementing info_box and ok_box functions for TUI message display with dialog/whiptail support.
staging/interface/test_info_box.sh,
staging/interface/test_ok_box.sh
Added placeholder test scripts for the new info_box and ok_box modules, indicating pending implementation.
src/initialize/debug.conf Fixed typo in [debug] section: corrected key from extend_disc to extend_desc.
templates/doc_templates.md,
templates/templates.conf,
templates/templates.sh
Removed the entire templates module including its configuration, documentation header, and implementation script.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Terminal
    participant info_box.sh
    participant DialogTool

    User->>Terminal: Run info_box (with pipe or argument)
    Terminal->>info_box.sh: Execute script
    info_box.sh->>DialogTool: Show info box (dynamic or static message)
    DialogTool-->>User: Display info box
Loading
sequenceDiagram
    participant User
    participant Terminal
    participant ok_box.sh
    participant DialogTool

    User->>Terminal: Run ok_box (with argument or stdin)
    Terminal->>ok_box.sh: Execute script
    ok_box.sh->>DialogTool: Show OK message box
    DialogTool-->>User: Display message box
Loading

Possibly related PRs

  • stage templates #14: Adds scaffold files and configuration for the templates module, directly related as this PR removes those same templates-related files.

Poem

🐇✨
In the terminal’s gentle, glowing light,
New message boxes spring to life at night.
Info rolls by, logs in a stream,
Or static words in a dialog gleam.
Rabbits approve with a happy hop—
TUI helpers, you’re the cream of the crop!
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a35e751 and 374e746.

📒 Files selected for processing (1)
  • staging/interface/info_box.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • staging/interface/info_box.sh
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

♻️ Duplicate comments (1)
staging/interface/test_ok_box.sh (1)

6-10: Same CI-breaking exit code as in test_info_box.sh

Adjust as above to avoid false-negative pipeline runs while the test body is still a stub.

🧹 Nitpick comments (6)
staging/interface/info_box.sh (2)

1-2: Add strict-mode guards (set -euo pipefail) at the top of the script

Enabling set -euo pipefail makes the helper fail fast on errors, unset variables, or broken pipelines – behaviour already used in your test stubs and most Armbian-config helpers.
It prevents silent UI freezes if, for example, $dialog is missing or printf fails.

 #!/usr/bin/env bash
+set -euo pipefail

42-44: Hard-coded 0.5 s refresh may be too slow/fast for some use-cases

Consider making the sleep interval configurable via an environment variable (e.g. INFOBOX_REFRESH_MS) or cli flag so callers can tune UI responsiveness vs. CPU usage.

staging/interface/ok_box.sh (4)

18-21: Extend help flags to include --help.

Currently only help and -h invoke _about_interface_message. For consistency, accept --help (and optionally -?):

-if [[ "$message" == "help" || "$message" == "-h" ]]; then
+if [[ "$message" =~ ^(-h|--help|\?)$ ]]; then
   _about_interface_message
   return 0
 fi

29-30: Verify that the chosen dialog tool is installed.

Before the case statement, ensure $dialog exists on PATH to avoid cryptic failures:

+if ! command -v "$dialog" &>/dev/null; then
+  echo "Error: '$dialog' is not installed" >&2
+  return 1
+fi
 local dialog="${DIALOG:-whiptail}"

31-37: Handle multiline and special‐character messages safely.

Passing unescaped quotes or newlines directly to --msgbox can break the dialog. Consider writing the message to a temporary file or using printf:

+printf '%s\n' "$message" >"$tmpfile"
+dialog --title "${TITLE:-Info}" --msgbox "$tmpfile" 10 80 >/dev/tty 2>&1

41-44: Clarify unsupported $DIALOG behavior.

Falling back to echo "$message" with exit code 1 is ambiguous. Better to emit an explicit error, show usage, and then exit:

 *) 
-  echo "$message"
-  return 1
+  echo "Error: Unsupported dialog type '$dialog'" >&2
+  _about_interface_message
+  return 1
 ;;
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 25213a6 and d1eb2fe.

📒 Files selected for processing (6)
  • staging/interface/info_box.conf (1 hunks)
  • staging/interface/info_box.sh (1 hunks)
  • staging/interface/ok_box.conf (1 hunks)
  • staging/interface/ok_box.sh (1 hunks)
  • staging/interface/test_info_box.sh (1 hunks)
  • staging/interface/test_ok_box.sh (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: 01 Coding style check
staging/interface/info_box.conf

[error] 1-1: editorconfig-checker: Wrong line endings or no final newline. 1 error found.

🔇 Additional comments (1)
staging/interface/info_box.conf (1)

3-5: Mixed attribute names: extend_desc vs documents vs extend_docs

For consistency with other config files and to satisfy sanity-checkers, prefer:

extend_desc=...
extend_docs=false

documents=false is non-standard and will likely be ignored.

Tearran added 2 commits June 16, 2025 15:19
modified:   staging/interface/info_box.sh
modified:   staging/interface/ok_box.conf
modified:   staging/interface/ok_box.sh
modified:   staging/interface/ok_box.sh
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (2)
staging/interface/ok_box.conf (1)

4-4: extend_disc typo still present – please propagate the earlier fix

The key is still spelled extend_disc; all other .conf files (and the parser) expect extend_desc.
This was flagged in the previous review and remains unresolved.

-extend_disc=
+extend_desc=

Also applies to: 19-19

staging/interface/ok_box.sh (1)

4-7: Usage line still mismatched – replace interface_message with ok_box

The Usage header should match the actual entry point.

-Usage: interface_message ["message"]
+Usage: ok_box ["message"]
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d1eb2fe and 14b4a77.

📒 Files selected for processing (4)
  • staging/interface/info_box.conf (1 hunks)
  • staging/interface/info_box.sh (1 hunks)
  • staging/interface/ok_box.conf (1 hunks)
  • staging/interface/ok_box.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • staging/interface/info_box.conf
  • staging/interface/info_box.sh

@Tearran Tearran requested a review from Copilot June 16, 2025 15:44

This comment was marked as outdated.

@Tearran Tearran requested a review from Copilot June 16, 2025 15:59

This comment was marked as outdated.

@Tearran Tearran requested a review from Copilot June 16, 2025 16:36

This comment was marked as outdated.

@Tearran Tearran requested a review from Copilot June 16, 2025 17:36

This comment was marked as outdated.

deleted:    templates/templates.conf
deleted:    templates/templates.sh
deleted:    templates/test_templates.sh
@Tearran Tearran requested a review from Copilot June 17, 2025 01:38
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

This PR migrates the codebase by removing unused template files and introducing new interactive terminal modules for displaying OK and info boxes. The changes include the deletion of templates-related scripts and configuration, the addition of new scripts for ok_box and info_box (along with their tests and configs), and a minor correction in the debug configuration.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
templates/templates.sh Removed unused bash module for templates
templates/templates.conf Removed unused configuration file for templates
templates/doc_templates.md Removed extra documentation file for templates
staging/interface/test_ok_box.sh Added placeholder test script for ok_box module
staging/interface/test_info_box.sh Updated test label from "templates" to "info_box" in the test script
staging/interface/ok_box.sh Introduced interactive ok_box module with support for multiple dialogs
staging/interface/ok_box.conf Added configuration for the ok_box module
staging/interface/info_box.sh Introduced interactive info_box module with live updates
staging/interface/info_box.conf Added configuration for the info_box module
src/initialize/debug.conf Corrected a configuration key typo (extend_disc ➜ extend_desc)

echo "$message"
;;
*)
echo "$message"
Copy link

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

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

In the default case of the switch (lines 48-50), consider outputting a clear error message indicating that an unsupported dialog tool was provided, rather than just echoing the message.

Suggested change
echo "$message"
echo "Error: Unsupported dialog tool '$dialog'. Supported tools are: dialog, whiptail, read." >&2

Copilot uses AI. Check for mistakes.
Tearran and others added 2 commits June 16, 2025 18:39
deleted:    staging/interface/info_box.sh
deleted:    staging/interface/ok_box.conf
deleted:    staging/interface/ok_box.sh
deleted:    staging/interface/test_info_box.sh
deleted:    staging/interface/test_ok_box.sh
@Tearran Tearran merged commit 8ca12e7 into main Jun 17, 2025
4 checks passed
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