-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor workspace_init.sh into a shock init subcommand #33
Description
Problem
Shellshock's onboarding for new consumer repos is clunky. workspace_init.sh exists but it's a standalone script that doesn't integrate with the shock CLI, and it doesn't handle .envrc setup.
Proposal
Replace workspace_init.sh with a shock init subcommand that:
- Does everything
workspace_init.shcurrently handles (submodule setup, directory structure, etc.) - Creates or patches the consumer repo's
.envrcto source Shellshock's.envrcand exportPROJ - Provides a single, discoverable entry point for setting up Shellshock in a new or existing repo
Motivation
With the new .envrc-based environment bootstrapping (where consumer repos source $PROJ/shell/.shock/.envrc), init needs to wire that up automatically. Having it as a subcommand means it follows the same patterns as other Shellshock operations.
Note: BASH_SOURCE dirname pattern
The BASH_SOURCE dirname idiom (DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)") is repeated across test helpers and .envrc files. A shared utility for this was considered but has a chicken-and-egg problem: you need to know where Shellshock is to source the utility that resolves paths. shock init is a better place to address this -- it can generate the correct boilerplate with the right paths baked in, rather than trying to abstract the idiom into a library function.
Acceptance Criteria
-
shock initperforms all currentworkspace_init.shfunctionality -
shock initcreates/edits.envrcwith correctPROJexport and Shellshock.envrcsource -
workspace_init.shis removed or deprecated - Running
shock initon an already-initialized repo is safe (idempotent)