Skip to content

refactor: extract inline shell tasks to mise-tasks file-tasks; add shellcheck + shfmt - #299

Merged
richardthe3rd merged 10 commits into
mainfrom
claude/refactor-mise-tasks-0JZZ1
May 20, 2026
Merged

refactor: extract inline shell tasks to mise-tasks file-tasks; add shellcheck + shfmt#299
richardthe3rd merged 10 commits into
mainfrom
claude/refactor-mise-tasks-0JZZ1

Conversation

@richardthe3rd

Copy link
Copy Markdown
Owner

All multi-line inline shell scripts in mise.toml and mise.dev.toml are
moved to standalone executable files under mise-tasks/. Filenames ending
in .sh are used where a directory of the same base name already exists
(test.sh, dev.sh, build/web.sh, test/e2e.sh) so that both the parent
task and its colon-namespaced children can coexist on the filesystem.

New file-tasks added:
mise-tasks/analyze (was inline in mise.toml)
mise-tasks/coverage (was inline in mise.toml)
mise-tasks/test.sh (was inline in mise.toml)
mise-tasks/dev.sh (was inline in mise.dev.toml)
mise-tasks/build/web.sh (was inline in mise.dev.toml)
mise-tasks/serve/release (was inline in mise.dev.toml)
mise-tasks/test/e2e.sh (was inline in mise.dev.toml)
mise-tasks/test/e2e/ui (was inline in mise.dev.toml)
mise-tasks/test/e2e/headed (was inline in mise.dev.toml)
mise-tasks/test/check-page (was inline in mise.dev.toml)
mise-tasks/screenshots/batch (was inline in mise.dev.toml)

shellcheck and shfmt added as mise tools (mise.toml). Two new tasks:
mise-tasks/shell/check — shellcheck on all .sh files + mise-tasks/
mise-tasks/shell/format — shfmt -w on all .sh files + mise-tasks/

shell:check is wired into check; shell:format into format.
All 22 shell files pass shellcheck; shfmt normalises indentation to tabs.

claude added 6 commits May 19, 2026 21:35
…ellcheck + shfmt

All multi-line inline shell scripts in mise.toml and mise.dev.toml are
moved to standalone executable files under mise-tasks/. Filenames ending
in .sh are used where a directory of the same base name already exists
(test.sh, dev.sh, build/web.sh, test/e2e.sh) so that both the parent
task and its colon-namespaced children can coexist on the filesystem.

New file-tasks added:
  mise-tasks/analyze            (was inline in mise.toml)
  mise-tasks/coverage           (was inline in mise.toml)
  mise-tasks/test.sh            (was inline in mise.toml)
  mise-tasks/dev.sh             (was inline in mise.dev.toml)
  mise-tasks/build/web.sh       (was inline in mise.dev.toml)
  mise-tasks/serve/release      (was inline in mise.dev.toml)
  mise-tasks/test/e2e.sh        (was inline in mise.dev.toml)
  mise-tasks/test/e2e/ui        (was inline in mise.dev.toml)
  mise-tasks/test/e2e/headed    (was inline in mise.dev.toml)
  mise-tasks/test/check-page    (was inline in mise.dev.toml)
  mise-tasks/screenshots/batch  (was inline in mise.dev.toml)

shellcheck and shfmt added as mise tools (mise.toml). Two new tasks:
  mise-tasks/shell/check   — shellcheck on all .sh files + mise-tasks/
  mise-tasks/shell/format  — shfmt -w on all .sh files + mise-tasks/

shell:check is wired into `check`; shell:format into `format`.
All 22 shell files pass shellcheck; shfmt normalises indentation to tabs.
Consistent convention: every file-task in mise-tasks/ has a .sh
extension regardless of whether the name conflicts with a subdirectory.
Previously only conflict cases (test.sh, dev.sh, build/web.sh,
test/e2e.sh) had the extension.

Renamed:
  analyze          -> analyze.sh
  coverage         -> coverage.sh
  build/web/prod   -> build/web/prod.sh
  dev/tunnel       -> dev/tunnel.sh
  serve/release    -> serve/release.sh
  setup/playwright -> setup/playwright.sh
  setup/tunnel     -> setup/tunnel.sh
  shell/check      -> shell/check.sh
  shell/format     -> shell/format.sh
  test/check-page  -> test/check-page.sh
  test/e2e/headed  -> test/e2e/headed.sh
  test/e2e/ui      -> test/e2e/ui.sh

Also adds mise-tasks/screenshots/ gitignore exception (the screenshots/
rule was blocking mise-tasks/screenshots/batch.sh from being tracked),
and simplifies shell:check / shell:format to a single find *.sh pass
now that the grep-for-shebang fallback is no longer needed.
Replace broken #MISE usage= multi-line strings with the correct #USAGE
per-line syntax (the format mise actually parses for argument docs).
Reverts positional-arg fallback back to $usage_* env vars now that
the header syntax is correct.

Also pins shellcheck = "0.9.0" and shfmt = "3.8.0" instead of "latest"
so mise tools resolve without hitting GitHub releases API.
Both tasks now forward $@ so agents can run a subset without resorting
to mise exec:

  mise run test test/widgets/drink_card_test.dart
  mise run analyze lib/screens/

Descriptions rewritten to answer "when to run" rather than "what it does",
and to clarify that the log file is auto-created (not a required input).
AGENTS.md updated to show the task form instead of the mise exec workaround.
…ols]

Declaring them in [tools] caused mise to attempt installation on every
task run, blocking all tasks when GitHub's API is rate-limited.
Moving them to #MISE tools={} in the tasks that actually need them means
they're only resolved for shell:check and shell:format.
…failure

The "Woah! You appear to be running flutter as root" warning on stderr
was filtered out with grep -v in the test/analyze/coverage pipelines.

Also fixes a latent bug: set -euo pipefail caused the script to exit
immediately on flutter failure, so the "Grep with:" hint was never
printed on failure — exactly when it's most needed. Replaced with
set -uo pipefail and EXIT_CODE=${PIPESTATUS[0]} to capture flutter's
exit code while letting the hint always print.
Copilot AI review requested due to automatic review settings May 19, 2026 22:31
@github-actions

github-actions Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

LCOV of commit 35304ed during CI #250

Summary coverage rate:
  lines......: 80.8% (2624 of 3246 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate: n/a

@codecov

codecov Bot commented May 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 refactors mise task definitions by moving multi-line inline shell scripts out of mise.toml/mise.dev.toml into executable file-tasks under mise-tasks/, and introduces shell lint/format tasks intended to be wired into the project’s formatting and pre-commit gates.

Changes:

  • Extracted inline mise shell tasks into mise-tasks/ file-tasks (including test/analyze/coverage and dev/e2e/build helpers).
  • Added shell formatting/linting tasks (shell:format, shell:check) and wired them into format and check.
  • Updated docs/ignore rules to reflect the new task layout and keep task scripts tracked.

Reviewed changes

Copilot reviewed 16 out of 22 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/get_version_info.sh shfmt-driven indentation normalization for version-info script used by build tooling/CI.
mise.toml Updates format/check dependencies to include shell format/check and relies on file-tasks for extracted scripts.
mise.dev.toml Removes inline dev tasks and documents the mapping to mise-tasks/ file-tasks.
mise-tasks/analyze.sh New file-task version of analyze with log capture and optional path args.
mise-tasks/coverage.sh New file-task version of coverage with filtered output and exit-code preservation.
mise-tasks/test.sh New file-task version of test with log capture, optional args, and exit-code preservation.
mise-tasks/dev.sh New file-task to start Flutter web dev server on port 8080.
mise-tasks/build/web.sh New file-task to build the Flutter web release bundle for local testing/e2e.
mise-tasks/build/web/prod.sh Adjusts formatting; continues to inject git version info into production web builds.
mise-tasks/serve/release.sh New file-task to serve build/web via http-server with SPA proxying.
mise-tasks/test/e2e.sh New file-task to run Playwright e2e tests (headless).
mise-tasks/test/e2e/ui.sh New file-task to run Playwright e2e tests in UI mode.
mise-tasks/test/e2e/headed.sh New file-task to run Playwright e2e tests in headed mode.
mise-tasks/test/check-page.sh New file-task to run the page-check + screenshot Node script with mise args.
mise-tasks/screenshots/batch.sh New file-task to run batch screenshot capture via Node script with mise args.
mise-tasks/shell/check.sh New file-task to run shellcheck across repo .sh files.
mise-tasks/shell/format.sh New file-task to run shfmt across repo .sh files.
mise-tasks/setup/tunnel.sh Formatting-only changes (shfmt) to the Cloudflare tunnel setup task.
mise-tasks/setup/playwright.sh Formatting-only changes (shfmt) to the Playwright setup task.
mise-tasks/dev/tunnel.sh Formatting-only changes (shfmt) to tunnel dev task cleanup function.
AGENTS.md Updates examples to use mise run analyze/test with path/file args.
.gitignore Ensures mise-tasks/screenshots/ is not ignored by the global screenshots/ ignore rule.

# Output format for --dart-define flags
elif [ "$1" == "dart-define" ]; then
echo "--dart-define=GIT_TAG=$GIT_TAG --dart-define=GIT_COMMIT=$GIT_COMMIT --dart-define=GIT_BRANCH=$GIT_BRANCH --dart-define=BUILD_VERSION=$VERSION --dart-define=BUILD_TIME=$BUILD_TIME"
echo "--dart-define=GIT_TAG=$GIT_TAG --dart-define=GIT_COMMIT=$GIT_COMMIT --dart-define=GIT_BRANCH=$GIT_BRANCH --dart-define=BUILD_VERSION=$VERSION --dart-define=BUILD_TIME=$BUILD_TIME"
Comment thread mise.toml
Comment on lines 46 to 54
[tasks.format]
description = "Format all code (Dart, JS/TS, mise.toml)"
depends = ['dart:format', 'prettier:format', 'mise:format']
description = "Format all code (Dart, JS/TS, mise.toml, shell)"
depends = ['dart:format', 'prettier:format', 'mise:format', 'shell:format']
run = 'echo "All formatting complete"'

[tasks.check]
description = "Pre-commit gate: generate → format + analyze + test (run before every commit)"
depends = ['format', 'analyze', 'test']
description = "Pre-commit gate: generate → format + analyze + test + shell:check (run before every commit)"
depends = ['format', 'analyze', 'test', 'shell:check']
run = 'echo "All checks passed"'
Comment thread mise.dev.toml Outdated
Comment on lines +17 to +25
# All tasks moved to mise-tasks/ for better maintainability and shellcheck/shfmt support:
# - dev -> mise-tasks/dev.sh
# - test:e2e -> mise-tasks/test/e2e.sh
# - test:e2e:ui -> mise-tasks/test/e2e/ui
# - test:e2e:headed -> mise-tasks/test/e2e/headed
# - build:web -> mise-tasks/build/web.sh
# - serve:release -> mise-tasks/serve/release
# - test:check-page -> mise-tasks/test/check-page
# - screenshots:batch -> mise-tasks/screenshots/batch
Comment thread mise-tasks/serve/release.sh Outdated
set -euo pipefail
if [ ! -d "build/web" ]; then
echo "Error: build/web directory not found"
echo "Run: mise run build:web first"
…essage

- get_version_info.sh: add 'export' mode (eval-safe VAR=value lines)
  that prod.sh was already calling but was falling through to the
  human-readable default, causing eval to fail on the "Version: ..."
  output. Also switch == to = in [ ] comparisons (shellcheck SC2039).

- serve/release.sh: error hint now points to the correct
  MISE_ENV=dev ./bin/mise invocation instead of bare `mise`.

- mise.dev.toml: update task→file mapping comments to include .sh
  extension to match the actual committed filenames.
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Cloudflare Pages Preview

Your preview deployment is ready!

Preview URL: https://claude-refactor-mise-tasks-0.staging-cambeerfestival.pages.dev

This preview will be automatically updated when you push new commits to this PR.

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Cloudflare Pages Preview

Your preview deployment is ready!

Preview URL: https://claude-refactor-mise-tasks-0.staging-cambeerfestival.pages.dev

This preview will be automatically updated when you push new commits to this PR.

claude added 2 commits May 19, 2026 22:49
…scans

'system' version in #MISE tools={} is deprecated in mise. Removing the
declaration entirely — shellcheck and shfmt are expected on PATH (install
via apt/brew). Also adds -not -path "./.mise/*" to the find commands so
the Flutter SDK's own shell scripts in .mise/http-tarballs/ are not
included in shellcheck/shfmt runs.
'system' is not a valid mise version. The correct approach is to pin
versions in [tools] so mise installs and manages them. In environments
where they are already available (e.g. this sandbox, devcontainers),
set MISE_DISABLE_TOOLS=shellcheck,shfmt to skip installation and use
the PATH versions instead.
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Cloudflare Pages Preview

Your preview deployment is ready!

Preview URL: https://claude-refactor-mise-tasks-0.staging-cambeerfestival.pages.dev

This preview will be automatically updated when you push new commits to this PR.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread scripts/get_version_info.sh Outdated
Comment on lines +36 to +40
echo "export GIT_TAG=\"$GIT_TAG\""
echo "export GIT_COMMIT=\"$GIT_COMMIT\""
echo "export GIT_BRANCH=\"$GIT_BRANCH\""
echo "export BUILD_VERSION=\"$VERSION\""
echo "export BUILD_TIME=\"$BUILD_TIME\""
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Cloudflare Pages Preview

Your preview deployment is ready!

Preview URL: https://claude-refactor-mise-tasks-0.staging-cambeerfestival.pages.dev

This preview will be automatically updated when you push new commits to this PR.

@richardthe3rd
richardthe3rd merged commit 6f3e2fb into main May 20, 2026
11 checks passed
@github-actions github-actions Bot mentioned this pull request May 19, 2026
@github-actions github-actions Bot mentioned this pull request May 31, 2026
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.

3 participants