Modular shell tooling for daily development (Git, JIRA, repositories, PR review, utilities). Split into focused modules for faster load, easier maintenance and selective sourcing.
All functions are LLM-friendly — interactive prompts (fzf, board/status selection) are bypassed when arguments are provided directly, making them callable from any LLM agent.
- Structure
- Quick Start
- Usage (Full vs Selective Load)
- Module Reference
- Migration (Monolithic → Modular)
- Development Guidelines
- Notes
- Troubleshooting
scripts/
├── my-script-modular.sh # Loader (sources modules in order)
├── constants.sh # Shared constants + ANSI colors
├── aliases.sh # Command aliases
├── installation.sh # Workstation setup helpers
├── utilities.sh # Cross-cutting utility functions
├── git.sh # Git workflow helpers
├── jira.sh # JIRA integration
├── repository.sh # Repository list + cloning helpers
├── pr-review.sh # Pull request review helpers
├── slate.sh # Slate environment management
├── specialized.sh # Focused one-off utilities
└── prompts/
└── analyze_pull-request.md # PR review prompt template (reference)
Clone (or update) the scripts directory somewhere under $HOME (recommended: $HOME/scripts). Then source the modular loader from your shell profile.
# Clone (example)
git clone <repo-url> "$HOME/scripts"
# Add to ~/.zshrc (one line)
source "$HOME/scripts/my-script-modular.sh"
# Reload shell
exec zshVerify:
type branch # from git.sh
type jbr # from jira.sh
type review # from pr-review.shInstall (or verify) required tools. Most are bundled by install-deps.
| Tool | Why |
|---|---|
| gh | PR creation, diff, comments |
| jira-cli | Ticket listing, moves, creation |
| scli | Slate management |
| kubectl | Kubernetes context + namespace for slate |
| telepresence | Service interception for tpa |
| fzf | Interactive selection (branches/repos/tickets) |
| ffmpeg, gifsicle | Media conversion for giffy |
| glow | Markdown rendering for review |
| md5sum (md5sha1sum) | Hashing inside pw |
Optional: ensure AWS SSO (awscli) installed for auth aliases.
Bulk install after sourcing loader:
install-depssource "$HOME/scripts/my-script-modular.sh"Ensure constants.sh first, then any dependencies.
# Git only
source "$HOME/scripts/constants.sh"
source "$HOME/scripts/utilities.sh"
source "$HOME/scripts/git.sh"
# JIRA only
source "$HOME/scripts/constants.sh"
source "$HOME/scripts/utilities.sh"
source "$HOME/scripts/jira.sh"Purpose: Core constants + color codes
Contains: SAFETYCULTURE_DIR, SCRIPTS_DIR, PROMPTS_DIR, ANSI colors
Purpose: Frequently used shortcuts (reload, docker helpers, git helpers) Note: Available after sourcing loader; add new aliases here not inline in other modules.
Purpose: Workstation setup (Homebrew, Oh My Zsh, Kubernetes config, NVM) Use: Run functions manually; not auto-run to avoid unintended installs.
Purpose: Shared helpers (input, selection, navigation, media conversion)
Examples: yesno, select_status, cleanpipe, giffy, cdi [dir], sci [dir]
Depends on: constants.sh
Purpose: Git workflow acceleration Examples:
branch <name>— switch to main, pull, create branch, pushpr [title] [merge_dest]— create draft PR (-vto view existing)gacp <message|flag>— add, commit, push (flags:-rri,-gmt,-gga,-gmm,-vb,-ut,-fmt)gbi [branch]— checkout branch (fzf if no arg)gbdi [branch]— delete branch with JIRA/slate cleanup Depends on:constants.sh,utilities.sh
Purpose: JIRA ticket integration Examples:
sync_board [board]— sync JIRA issues to local filejbr [ticket_id]— create branch from ticket (fzf if no arg)mvj [ticket_id] [status]— move ticket status (fzf/prompt if no args)jdiff <title> <description>— create ticket, branch, commit, and PR Depends on:constants.sh,utilities.sh
Purpose: Manage + clone internal repositories
Examples: repo (sync list), grc (clone interactively)
Depends on: constants.sh
Purpose: Review, diff and approve PRs Examples:
stamp— approve PR from clipboard URLprd [url]— show PR diff (clipboard if no arg)rr— review then approve workflowreview [-c] <text>— post or preview review text (-cposts as PR comment) Depends on:constants.sh,utilities.sh
Purpose: Niche utilities (ID conversion, password generation, SQL file scaffolding)
Examples: s12id <id>, ids12 <uuid> [prefix], pw [-s] [input], auto-sql
Depends on: constants.sh
Purpose: Ephemeral environment ("slate") lifecycle + Kubernetes context helpers
Examples: slate up, slate ls, slate extend <id> <days>, slate delete <id>, slate tp <ticket> [svc], slate tpa
Depends on: External tools (scli, kubectl, telepresence)
- Replace sourcing in
~/.zshrc:
# Old
source "$HOME/scripts/my-script.sh"
# New
source "$HOME/scripts/my-script-modular.sh"- Reload shell:
exec zsh - (Optional) Remove monolithic sourcing from any other dotfiles.
- For partial usage, only source required modules (see section 3).
- Pick module matching responsibility (Git, JIRA, etc.)
- Require only necessary dependencies (source order matters)
- Keep naming consistent and short (
verbNounwhere helpful) - Accept arguments directly to keep functions LLM-callable — fall back to interactive prompts (fzf,
select_*) only when no args are given - Append description to this README if user-facing
- Test standalone: source required modules then call function
- Create
<name>.shwith brief header comment - Avoid side effects on load (no automatic installs/executions)
- Update
my-script-modular.shto source it in dependency order - Document in sections 1 & 4
- Keep cross-cutting logic in
utilities.shnot in the new module
Dependency Order: Loader enforces required order.
Backward Compatibility: Interfaces mirror legacy script where feasible.
Performance: Selective loading reduces shell startup time.
Isolation: Source individual files to debug without full stack.
Prompts: prompts/analyze_pull-request.md contains a PR review template for reference.
Slate Environments: Require valid kubectl context & scli installed; failing context switches are warned, not fatal.
Security: No secrets are stored in repo; ensure environment variables / credentials (AWS SSO) are managed externally.
Idempotency: Loader can be safely re-sourced; installation functions intentionally not auto-invoked.
Extensibility: Prefer adding new shared helpers to utilities.sh to avoid duplication.
source "$HOME/scripts/utilities.sh" && echo OK || echo FAILgrep -r "function_name" "$HOME/scripts" | cut -d: -f1 | sort -usource "$HOME/scripts/constants.sh"
source "$HOME/scripts/utilities.sh" # then your target modulereload # if alias exists; otherwise
source "$HOME/scripts/my-script-modular.sh"Ensure the sourcing line is at end of ~/.zshrc and no earlier return statements are short-circuiting.
- Confirm
sclilogin (sc-auth/sc-slate). - Verify kubectl context via
kubectl config current-context.
- Run
telepresence quit -sbeforetpa. - Verify Kubernetes context via
kubectl config current-context. - Check port conflicts with
cleanpipe <port>.
Internal tooling; adjust before external distribution. Remove organization-specific paths or secrets before sharing.
Suggestions / additions welcome. Update the README with substantive user-facing changes.