Skip to content

Normalize shared shell helpers in finance scripts - #34

Merged
id774 merged 1 commit into
masterfrom
claude/finance-shell-helpers-normalize-ad0r54
Sep 13, 2026
Merged

id774 merged 1 commit into
masterfrom
claude/finance-shell-helpers-normalize-ad0r54

Conversation

@id774

@id774 id774 commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Unify usage() and check_commands() in run.sh and deploy.sh to the same shared contract used elsewhere: check_commands() inspects the command names given in "$@", exiting 127 when a command cannot be resolved and 126 when the resolved path is not executable; usage() calls check_commands awk before extracting the header block and exits 0.
  • Split the finance-specific $CHARTS/$SUMMARY/$NOTIFY executable checks out of run.sh's check_commands() into a separate check_pipeline_commands(), preserving the existing status 1, error message, and pip install guidance. main() now calls load_environment, check_pipeline_commands, check_commands date, check_credential, check_environment, in that order.
  • deploy.sh's main() now calls check_commands "$PYTHON" sudo install instead of a fixed internal list.
  • Added doc/POLICY.md rules under 2.6 Shell Scripts stating that a shared helper name is an interface (same arguments/exit statuses/side effects/implementation), that repository-specific behavior belongs at the call site or in a differently named helper, and documenting the check_commands() / usage() contracts.
  • Updated doc/VERSIONS' unreleased v1.0.2 (Release Date: TBD) entry with a bullet describing the normalized 127/126 command-check statuses.
  • Updated Exit Codes and Version History (v1.1) headers in both run.sh and deploy.sh.

Validation

  • POSIX shell syntax (sh -n run.sh, sh -n deploy.sh): PASS
  • Shared helper identity (usage()/check_commands() match the specified common implementation in both scripts): PASS
  • Help smoke tests (run.sh -h, run.sh --help, deploy.sh -h, deploy.sh --help): PASS (header shown, status 0, no pipeline/deployment body executed)
  • Missing awk smoke test (controlled PATH without awk): PASS (status 127, common missing-command message, no header shown, no further processing)
  • run.sh pipeline-command failure preservation (one of $CHARTS/$SUMMARY/$NOTIFY non-executable): PASS (status 1, existing Command not found message and pip install guidance preserved)
  • run.sh missing date (pipeline commands present, date unresolvable): PASS (status 127, common missing-command message, pipeline checks passed first)
  • deploy.sh non-executable $PYTHON: PASS (status 126, common non-executable message, no deployment side effects)
  • pytest: PASS (513 passed, 2 deselected)
  • ruff check .: PASS (all checks passed)
  • Whitespace/diff scope check (git diff --check): PASS (no errors); changed files limited to run.sh, deploy.sh, doc/POLICY.md, doc/VERSIONS

🤖 Generated with Claude Code

https://claude.ai/code/session_01VM2WVZz7NxE541SaTwt2wg


Generated by Claude Code

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VM2WVZz7NxE541SaTwt2wg
@id774
id774 merged commit 6be9776 into master Sep 13, 2026
3 checks passed
@id774
id774 deleted the claude/finance-shell-helpers-normalize-ad0r54 branch September 13, 2026 10:19
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