shellhook

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package shellhook generates the self-contained scripts that `agentmod hook <shell>` prints and the user's rc file evals (IMPLEMENTATION_PLAN §7).

The scripts do the per-prompt work in pure shell — an upward search for .agentmod/agentmod.toml — and exec the agentmod binary only on activation/deactivation transitions (D007), eval'ing `agentmod env` output (D016). They never touch HOME, never create shims, and no-op with a one-time warning when the binary is missing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bash

func Bash() string

Bash returns the bash hook script. Bash has no chpwd hook, so registration uses PROMPT_COMMAND alone: it runs before every prompt, which covers both cd transitions and a new shell that starts inside a project (FABLE_PLAN §14). The script is bash-3.2-clean (macOS /bin/bash): no associative arrays, no ${var,,}, scalar PROMPT_COMMAND. Failed-root caching and missing-binary warn-once follow the same contract as zsh (D017).

func Zsh

func Zsh() string

Zsh returns the zsh hook script. It registers on precmd (a new shell that starts inside a project activates at its first prompt) and chpwd (cd transitions), per FABLE_PLAN §14. A project root whose activation failed (e.g. broken agentmod.toml) is remembered in _AGENTMOD_FAILED_ROOT so the error prints once instead of on every prompt; leaving and re-entering the project retries (D017).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL