Skip to content

feat: environment hook system (pre/post-activate) #40

@nmhjklnm

Description

@nmhjklnm

Summary

Allow users to run custom scripts on environment lifecycle events.

Hook points

~/.cac/envs/<name>/hooks/
├── pre-activate.sh       # before activation
├── post-activate.sh      # after activation
├── pre-deactivate.sh     # before switching away
└── pre-claude.sh         # before claude starts (inside wrapper)

Use cases

  • Start/stop VPN on environment switch
  • Switch DNS settings
  • Log environment usage
  • Run custom proxy health checks
  • Set additional environment variables

Implementation

  • Wrapper (templates.sh) checks for hooks/pre-claude.sh and sources it
  • _env_cmd_activate checks for pre-activate.sh / post-activate.sh
  • Hooks are optional — no hooks directory = no action

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priorityenhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions