Skip to content

Refactor workspace_init.sh into a shock init subcommand #33

@jerrod-storm

Description

@jerrod-storm

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:

  1. Does everything workspace_init.sh currently handles (submodule setup, directory structure, etc.)
  2. Creates or patches the consumer repo's .envrc to source Shellshock's .envrc and export PROJ
  3. 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 init performs all current workspace_init.sh functionality
  • shock init creates/edits .envrc with correct PROJ export and Shellshock .envrc source
  • workspace_init.sh is removed or deprecated
  • Running shock init on an already-initialized repo is safe (idempotent)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions