aboutsummaryrefslogtreecommitdiffstats
path: root/hooks
Commit message (Collapse)AuthorAgeFilesLines
* feat(hooks): colour the SessionStart memory messageThomas Vanbesien5 days1-3/+25
| | | | | | | | | | | ANSI-colour the systemMessage so it stands out at a glance: memory rows cyan, a "(missing)" row red with an ❌, the $HOME warning yellow with a ⚠️ per line. Colours wrap each line around its already-computed padding, so the util's column alignment is unaffected -- ANSI bytes never count toward printf's width. jq encodes the ESC byte as an escape in the JSON and the harness restores a real ESC when it prints.
* feat(hooks): unify payload dumps into one generic hookThomas Vanbesien5 days5-76/+43
| | | | | | | | | | | Replace the three near-identical dump scripts with a single dump.hook.sh that derives both target dir and filename from the payload: dir from hook_event_name (trailing `failure` stripped so the two post events share posttooluse), id from tool_use_id else session_id-source/reason. This adds SessionEnd for free, so register the hook (and the notifier) on SessionEnd too, and extend the notifier's id fallback to reason.
* feat(hooks): notify $NVIM of state dumpsThomas Vanbesien5 days1-0/+38
| | | | | | | | | | | | | | | | Add nvim-notify.hook.sh, a generic hook that tells the Neovim instance owning the terminal ($NVIM) that a state dump is available, by firing a `User Claude<Event>` autocmd whose `data` is the dump's basename. The signal is derived from the payload, so the one script serves every event it is registered against: `hook_event_name` becomes the pattern, and `tool_use_id` (else `session_id-source`) becomes the `data`, matching how the dump hooks name their files. It is a no-op outside a Neovim terminal or without an identifier, and the remote call is backgrounded with a timeout so a slow or absent editor never blocks a tool call. Register it after each dump hook on SessionStart, PreToolUse (Bash), PostToolUse (Bash), and PostToolUseFailure (Bash).
* feat(hooks): dump the SessionStart payload to a state fileThomas Vanbesien5 days1-0/+24
| | | | | | | | | | Add sessionstart-dump.hook.sh, mirroring the Bash payload dumps: it writes the full SessionStart JSON to $XDG_STATE_HOME/claude/sessionstart/<session_id>-<source>.json. Register it as a second SessionStart hook, alongside the memory-status report. session_id is stable across a session's fires, so source (startup/resume/clear/compact) is appended to keep them distinct.
* feat(hooks): warn when SessionStart runs from $HOMEThomas Vanbesien5 days1-0/+11
| | | | | | $HOME is not treated as a project, so home skills (~/.claude/skills) only load with --add-dir $HOME. No payload exposes whether that flag was passed, so append the warning whenever cwd is $HOME.
* feat(hooks): dump Bash payloads as JSON, replacing the loggerThomas Vanbesien5 days3-71/+39
| | | | | | | | | | | | Capture each Bash call's full pre/post JSON payload to $XDG_STATE_HOME/claude/{pretooluse,posttooluse}/<tool_use_id>.json. The pre dump is the command (input), the post dump is command plus result (output); the post hook registers on PostToolUse and PostToolUseFailure so failed commands are captured. Naming files by the shared tool_use_id lets a consumer pair a call's input and output dumps by matching basename across the two folders. Retire the per-session bash-log hook, which the dumps supersede.
* feat: add pretooluse hookThomas Vanbesien5 days1-0/+23
|
* refactor(hooks): split wrappers from implementationsThomas Vanbesien7 days13-40/+129
| | | | | | | | | | | | | Move the hook wrappers out of bin/ into hooks/, and name every registered hook with a .hook.sh suffix. bin/ keeps only the standalone installer and the by-hand utilities (memory-status.sh, managed-files.sh) that those wrappers now resolve as their implementations. Coalesce the eight per-language formatter hooks into a single format.hook.sh that dispatches on file type with a case, so no file is ever run through more than one formatter. Update settings.json, .claude/settings.json, and .gitignore to match.
* refactor: split SessionStart hook into memory-status util + wrapperThomas Vanbesien10 days1-101/+0
| | | | | | | | | | Mirror the managed-files.{sh,hook.sh} convention: move the stats logic out of hooks/session-start.sh into a standalone bin/memory-status.sh (runnable by hand, takes cwd as $1), and add a thin bin/session-start.hook.sh wrapper that does the stdin/JSON plumbing. Behavior change: omit the 'Automemory entries' row when MEMORY.md is missing, rather than showing a 0 count.
* feat: show automemory entry count in session-start hookThomas Vanbesien10 days1-0/+22
| | | | | Add an "Automemory entries" row to the SessionStart stats — the count of *.md under the automemory dir minus the always-loaded MEMORY.md index.
* refactor: track .claude with each repo, drop the external storeThomas Vanbesien10 days3-230/+19
| | | | | | | | | | | | | | | | | | | | | The per-project store kept each project's `.claude/` under `projects/<encoded-cwd>/.claude/` with `$PWD/.claude` a symlink into it, wired by a `Setup` hook. The indirection bought nothing — a project's `.claude/` belongs in that project's own repo. Discard it. - remove `hooks/setup-init.sh` (the symlink-wiring `Setup` hook) and its registration - remove `hooks/worktree-create.sh`: with `.claude/` tracked, a worktree checks out its own, so `claude --worktree` reverts to the built-in - rework `session-start.sh`: drop the `Setup`→`SessionStart` `.last-setup-result.json` channel, report each memory file as a whole-KB size, and warn only when the always-loaded MEMORY.md index exceeds 25 KB - `.gitignore` now tracks the top-level `.claude/` and, under `projects/`, only `memory/` (the harness auto-memory) tested: `session-start.sh` renders the KB stats table with no `Setup` section and valid JSON; no tracked `projects/*/.claude/*` remain.
* feat: add Setup→SessionStart result channel, rewrite session-startThomas Vanbesien10 days3-118/+190
| | | | | | | | | | | | | | | | | | The Setup hook has no live feedback channel, so it now records its outcome to a machine-local .last-setup-result.json and SessionStart reads it back. - rename hooks/setup.sh → setup-init.sh (Setup matcher `init`); create the store on first use, leave a real .claude as project-local, record a simple status (created/repointed/linked/local/ok|error) via an ERR trap, keeping stdout+exit0 / stderr+exit2 conventions. - rewrite session-start.sh: surface the last Setup outcome (or a hint to run `claude --init-only`), show per-file memory stats (user/project CLAUDE.md sizes, automemory entries) with full paths — and warn on any always-loaded file over 200 lines. - settings.json: point the Setup hook at setup-init.sh - README: document store creation and the new session-start behavior. - memory: record the "Setup hook has no feedback channel" finding.
* feat: fold the memory store in and wire projects via hooksThomas Vanbesien11 days3-2/+139
| | | | | | | | | | | Collapse the double-submodule setup (claude-config + claude-memory) into this single repo and replace the `claude-wrapper` launcher with hooks, so `claude` runs directly — no alias, no installer. Verified: `claude --init-only` wires/repairs the link and the no-store path points at `dotfiles claude-adopt-project`; `git check-ignore` confirms `*.jsonl`, session dirs, `settings.local.json`, and `worktrees/` stay out while the stores and auto-memory are tracked.
* Initial commit: track authored Claude Code configThomas Vanbesien12 days11-0/+236
Track only the hand-authored configuration of the ~/.config/claude config dir. Runtime state, caches, and secrets stay untracked via a whitelist .gitignore. - .gitignore: whitelist ignore — everything excluded except the paths below - README.md: map of tracked vs. untracked (runtime/secret) entries - install.sh: bootstrap/installer for the config dir - bin/claude-wrapper: the `claude` launcher (wires memory.d/, --add-dir) - hooks/: harness hooks registered in settings.json - format-on-edit: bash-format.sh, lua-format.sh, clang-format.sh, cmake-format.sh, qml-format.sh, black-format.sh, markdown-format.sh, php-cs-fixer.sh - bash-log.sh: Bash-tool logger - status-line.sh: custom status line - worktree-create.sh: WorktreeCreate hook - skills/common-commit/: shared commit-message skill (SKILL.md + examples/emphasis.txt, examples/lists.txt) - agents/.gitkeep: keep the empty agents/ dir