Documentation
¶
Overview ¶
Package setup implements `bumper init`: wiring bumper into a coding agent (Claude Code or Augment). It installs the guardrail hooks (terraform apply-guard + dependency install-block/post-install scan), registers the hosted Advisor MCP, ignores the verdict store, and drops the workflow notes into CLAUDE.md.
Every mutation is merge-not-clobber and idempotent: existing config is preserved, and re-running init changes nothing once wired. User-scope files are written atomically (temp + rename) with a one-time backup.
Index ¶
- Constants
- func BinPath() string
- func SkillsDir(a Agent, scope Scope, env Env) string
- func SupportsSkills(a Agent) bool
- type Action
- func EnsureClaudeMd(path string) (Action, error)
- func EnsureDepsClaudeMd(path string) (Action, error)
- func EnsureGitignore(path string) (Action, error)
- func MergeAdvisorMCP(path, url string, agent Agent) (Action, error)
- func MergeDepsHooks(path, binPath string, agent Agent) (Action, error)
- func MergeHook(path, binPath string, agent Agent) (Action, error)
- type Agent
- type Env
- type Options
- type Scope
- type Step
Constants ¶
const DefaultAdvisorURL = "https://advisor.bumper.sh"
DefaultAdvisorURL is the hosted, public Advisor used when no override is given.
Variables ¶
This section is empty.
Functions ¶
func BinPath ¶
func BinPath() string
BinPath returns the command to invoke bumper in generated config: the bare "bumper" when it is on PATH (clean, relocatable), else the absolute path to the running binary.
func SkillsDir ¶ added in v1.2.1
SkillsDir is where agent skills are written for the agent + scope: <agentcfg>/skills under the project (project scope) or home (user scope).
func SupportsSkills ¶ added in v1.2.1
SupportsSkills reports whether the agent reads SKILL.md agent skills. Claude Code and Gemini CLI do; Augment (AGENTS.md-based) does not.
Types ¶
type Action ¶
type Action int
Action describes what a single file mutation did.
func EnsureClaudeMd ¶
EnsureClaudeMd appends the bumper workflow stanza if its marker is absent.
func EnsureDepsClaudeMd ¶ added in v1.2.0
EnsureDepsClaudeMd appends the dependency-guardrail stanza if its marker is absent.
func EnsureGitignore ¶
EnsureGitignore adds the verdict-store directory to .gitignore if absent.
func MergeAdvisorMCP ¶ added in v1.2.0
MergeAdvisorMCP registers the hosted Advisor as a streamable-http MCP server. Only package coordinates ever reach it — never source. Idempotent. The entry shape is per-agent: Claude Code / Augment use {"type":"http","url":…}; Gemini CLI uses {"httpUrl":…} for a streamable-HTTP server.
func MergeDepsHooks ¶ added in v1.2.0
MergeDepsHooks installs the dependency guardrail hooks: `deps guard` (PreToolUse, blocks malicious installs) and `deps watch` (PostToolUse, scans after install). Idempotent and additive — it coexists with the terraform guard hook.
func MergeHook ¶
MergeHook installs the terraform guard as a pre-tool shell-tool hook in a settings.json file. The matcher, the event key, and the baked --client flag come from the agent (Claude → "Bash"/PreToolUse + no flag; Augment → "launch-process"/ PreToolUse + --client=augment; Gemini → "run_shell_command"/BeforeTool + --client=gemini).
type Agent ¶ added in v1.2.0
type Agent string
Agent is a coding agent bumper can wire into. All three read the same stdin payload (tool_name / tool_input.command) and use the same nested hook entry shape; they differ in the shell-tool name the hook matches, the settings.json event keys (Claude/Augment: PreToolUse/PostToolUse; Gemini: BeforeTool/AfterTool), the MCP entry shape (Claude/Augment: {type,url}; Gemini: {httpUrl}), and where config + notes live on disk.
func ParseAgent ¶ added in v1.2.0
ParseAgent validates an agent string from a flag.
func (Agent) PostToolEvent ¶ added in v1.2.1
func (Agent) PreToolEvent ¶ added in v1.2.1
PreToolEvent and PostToolEvent are the settings.json event keys the hooks are written under (and the hookEventName a hook echoes back in its JSON output). Claude Code and Augment use PreToolUse/PostToolUse; Gemini CLI uses BeforeTool/AfterTool.
type Env ¶
type Env struct {
Bin string // command to invoke bumper in generated config
ClaudeFound bool // the `claude` CLI is on PATH
AugmentFound bool // the `auggie`/`augment` CLI is on PATH
GeminiFound bool // the `gemini` CLI is on PATH
Cwd string // project directory
Home string // user home
GitRepo bool // cwd is a git repo
}
Env is the detected environment `bumper init` wires into.
type Options ¶
type Options struct {
Agent Agent // which coding agent to wire (claude|augment)
HookScope Scope // project|user|none — where the hook(s) are written
Terraform bool // install the terraform apply-guard hook
Deps bool // install the dependency hooks (deps guard + deps watch)
Advisor bool // register the hosted advisor MCP
AdvisorScope Scope // project|user — where the advisor MCP entry is written
AdvisorURL string // override for self-hosting; "" → the public default
Skills bool // install the agent skills (SKILL.md playbooks)
Env Env
}
Options is a chosen init configuration. Hooks self-filter at runtime, so wiring a guardrail that isn't used yet is harmless (it simply never fires) — that's why the defaults wire everything and a monorepo that adds Terraform later is already covered. The hosted advisor is the single MCP (the local stdio server is gone).
type Scope ¶
type Scope string
Scope is where a piece of config is written.
func ParseScope ¶
ParseScope validates a scope string from a flag.
type Step ¶
Step is one file mutation, deferred so a plan can be previewed before applying.