Skip to content

feat(gemini): A bash utility to manage and prioritize post-apocalyptic tasks, categorizing them by urgency and displaying them with a touch of wasteland wisdom. - #5825

Open
polsala wants to merge 1 commit into
mainfrom
ai/gemini-20260901-2221
Open

feat(gemini): A bash utility to manage and prioritize post-apocalyptic tasks, categorizing them by urgency and displaying them with a touch of wasteland wisdom.#5825
polsala wants to merge 1 commit into
mainfrom
ai/gemini-20260901-2221

Conversation

@polsala

@polsala polsala commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Implementation Summary

  • Utility: nightly-apocalypse-task-prioritizer
  • Provider: gemini
  • Location: bash-utils/nightly-nightly-apocalypse-task-prio
  • Files Created: 3
  • Description: A bash utility to manage and prioritize post-apocalyptic tasks, categorizing them by urgency and displaying them with a touch of wasteland wisdom.

Rationale

  • Automated proposal from the Gemini generator delivering a fresh community utility.
  • This utility was generated using the gemini AI provider.

Why safe to merge

  • Utility is isolated to bash-utils/nightly-nightly-apocalypse-task-prio.
  • README + tests ship together (see folder contents).
  • No secrets or credentials touched.
  • All changes are additive and self-contained.

Test Plan

  • Follow the instructions in the generated README at bash-utils/nightly-nightly-apocalypse-task-prio/README.md
  • Run tests located in bash-utils/nightly-nightly-apocalypse-task-prio/tests/

Links

  • Generated docs and examples committed alongside this change.

Mock Justification

  • Not applicable; generator did not introduce new mocks.

…c tasks, categorizing them by urgency and displaying them with a touch of wasteland wisdom.
@polsala

polsala commented Sep 1, 2026

Copy link
Copy Markdown
Owner Author

🤖 Review by GROQ Agent

✅ What's solid

  • Self‑contained utility – The script lives entirely under bash-utils/nightly-nightly-apocalypse-task-prio and does not touch any external services or configuration files outside the user’s home directory.
  • Clear CLI contract – The add, list, complete, and clear commands are well‑named and documented in the README, making the tool discoverable for new contributors.
  • Deterministic test harness – Tests create a temporary task file (TEMP_TASK_FILE) and clean it up with a trap, guaranteeing they never pollute a developer’s real .apocalypse_tasks.
  • User‑friendly output – Human‑readable status markers ([ ] / [X]) and a random “Wasteland Wisdom” line add charm without sacrificing clarity.
  • Graceful defaults – The APOCALYPSE_TASK_FILE env‑var override is respected, and the script auto‑creates a sensible header if the file is missing.

🧪 Tests

  • Coverage is good but could be tighter

    • The current suite validates most happy‑path flows (add, list, complete, clear) and a handful of error cases. Consider adding:
      • Boundary tests for priority values (1 and 5) and for category case‑insensitivity.
      • Concurrent execution test: run two instances of the script in parallel to ensure the ID generation is atomic (e.g., using flock or a lock file).
  • Dynamic date handling

    • Test 1 compares the header line with $(date +%Y-%m-%d). This works locally but can flake if the test runs across midnight. A more robust approach is to pattern‑match the header, e.g.:

      assert_contains "$(head -n 1 "$TEMP_TASK_FILE")" "^# Apocalypse Task Log - Created [0-9]{4}-[0-9]{2}-[0-9]{2}$"
  • Random tip assertion

    • The test only checks that the phrase “Wasteland Wisdom:” appears, which is fine. If you ever want to assert the tip itself, expose a --no‑tip flag for deterministic output in CI.
  • Exit‑code verification

    • Each test currently checks output strings but does not assert the script’s exit status. Adding assert_exit_code 0 "$SCRIPT" list (or non‑zero for error cases) would catch silent failures.
  • Test naming & organization

    • Consider splitting the monolithic test_apocalypse_tasks.sh into logical sections (e.g., test_add.sh, test_list.sh) and sourcing a common helper library. This improves readability and makes future extensions easier.

🔒 Security

  • File permissions

    • The task file is created with default umask, which may leave it readable by other users on a shared system. Harden it by explicitly setting restrictive permissions:

      _init_task_file() {
          if [[ ! -f "$TASK_FILE" ]]; then
              umask 077   # rw------- for the owner only
              cat >"$TASK_FILE" <<EOF
      # Apocalypse Task Log - Created $(date +%Y-%m-%d)
      # Format: ID | Status | Category | Priority | Task Description
      # ...
      EOF
          fi
      }
  • Input sanitisation

    • The script directly interpolates $description into the task line without escaping pipe (|) characters, which could corrupt the file format. Escape or forbid the delimiter:

      safe_desc="${description//|/\\|}"
      echo "$next_id | [ ] | $category | $priority | $safe_desc" >> "$TASK_FILE"
  • Path traversal

    • APOCALYPSE_TASK_FILE can be set to any path, including system files. Guard against accidental overwrites by refusing absolute paths outside the user’s home, or at least warning the user:

      if [[ "$TASK_FILE" = /* && "$TASK_FILE" != "$HOME"* ]]; then
          echo "Error: TASK_FILE must reside within your home directory."
          exit 1
      fi
  • Shell injection

    • All arguments are passed as plain strings to internal functions, but the script uses eval‑like constructs only indirectly (e.g., "$SCRIPT" add ...). Ensure no eval or source of user‑provided data is introduced in future extensions.

🧩 Docs/DX

  • README completeness

    • The README covers installation, usage, and testing, which is excellent. Minor improvements:
      • Add a Version badge or a short “Supported Bash versions” note (e.g., “Requires Bash 4.0+”).
      • Document the environment variable override (APOCALYPSE_TASK_FILE) in a dedicated “Configuration” subsection.
      • Provide an example of the task file format with a few lines, so users can manually edit if needed.
  • Help output

    • The script currently prints usage messages only when arguments are missing or invalid. Adding a --help flag that prints the same command summary as the README would improve discoverability:

      if [[ "$1" == "--help" || "$1" == "-h" ]]; then
          cat <<'EOF'
      apocalypse-tasks <command> [arguments]
      
      Commands:
        add <CATEGORY> <PRIORITY> <DESCRIPTION>   Add a new task
        list [CATEGORY]                           List tasks (optional filter)
        complete <TASK_ID>                        Mark a task as completed
        clear                                     Remove completed tasks
      EOF
          exit 0
      fi
  • Error messages

    • They are clear, but consider prefixing with Error: consistently and exiting with a non‑zero status. This aids scripting callers that rely on $?.
  • Shellcheck compliance

    • Run shellcheck locally; it will likely flag a few style issues (e.g., quoting variables, using [[ -z $var ]] vs [[ -z "$var" ]]). Fixing these will reduce false‑positive warnings in CI.

🧱 Mocks/Fakes

  • No external dependencies – The utility does not import any third‑party binaries or services, so mocks are unnecessary at the moment.
  • Test isolation – The test suite already uses a temporary task file and cleans it up with trap. If future features introduce network calls (e.g., fetching a tip from an API), consider adding a lightweight mock server or stubbing curl with a wrapper function.

Overall impression: The utility is a fun, well‑documented addition that follows good Bash practices. Addressing the minor security hardening points, tightening a few tests, and polishing the documentation will make it production‑ready for the nightly suite. Happy post‑apocalyptic scripting!

@polsala

polsala commented Sep 1, 2026

Copy link
Copy Markdown
Owner Author

🤖 Review by GROQ Agent

🔒 Security

  • (pending)

🧩 Docs/DX

  • (pending)

🧱 Mocks/Fakes

  • (pending)

What’s solid

  • Clear, self‑contained utility – The script lives in its own directory, uses an environment variable (APOCALYPSE_TASK_FILE) for the data file, and ships a README that explains installation, usage, and testing.
  • Comprehensive test suitetest_apocalypse_tasks.sh covers all public commands (add, list, complete, clear), validates error handling, and checks that the random tip is displayed.
  • Good UX – The CLI follows a familiar pattern (add <cat> <prio> <desc>, list [cat], complete <id>, clear) and prints friendly messages for success, errors, and empty states.
  • Random “wasteland wisdom” – Adds a fun, non‑intrusive element that is easy to test for presence.
  • Header generation – The script creates a human‑readable header with date and format notes, which is useful for manual inspection.

🧪 **

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.

1 participant