Skip to content

Cross-environment stash availability #14

@kicka5h

Description

@kicka5h

Problem

A stash registered in one terminal environment is not reliably available in others. For example, a stash created in a zsh session may not be found when switching to bash, a different user profile, or a Python venv — particularly when the user has configured their stash via the SNACK_STASH environment variable rather than snack stash create.

The SNACK_STASH env var is shell-specific: set in .zshrc, it won't exist in a bash session or a subprocess that doesn't inherit it. The ~/.snackstashrc config file is already shell-agnostic (any process on the machine can read it), but users who set up via the env var miss this.

Proposed solution

Introduce a snack init command that writes the stash configuration to ~/.snackstashrc once, regardless of how the user's shell is configured, so the stash is discoverable in every environment without requiring env var setup.

snack init ~/snack-stash
# Writes ~/.snackstashrc, no shell profile changes needed

Additionally, when SNACK_STASH is set but no ~/.snackstashrc exists, proactively suggest the user run snack stash create or snack init to make their config environment-independent:

Note: your stash is configured via SNACK_STASH but not registered in ~/.snackstashrc.
Run `snack stash create default $SNACK_STASH` to make it available in all environments.

Scope for BonBon

  • snack init <path> command — registers a default stash in ~/.snackstashrc and confirms the path works
  • Hint shown when SNACK_STASH is set but no ~/.snackstashrc exists
  • Documentation updated to recommend snack stash create / snack init over the env var for persistent setups
  • Test coverage for snack init and the hint behaviour

Notes

The ~/.snackstashrc config file is already cross-environment — this feature is about guiding users toward it as the primary setup method and providing a frictionless path to get there.

SNACK_STASH remains supported as a high-priority override for scripts and CI where explicit env vars are appropriate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions