You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v0.2.35: Hook auto-reads token from ~/.rampart/token (#59)
* fix: inline RAMPART_TOKEN in Claude Code hook command
Claude Code hooks don't inherit the user's shell environment, so
RAMPART_TOKEN was never set at hook runtime. The hook silently fell
back to local-only evaluation and events never reached the dashboard.
- serve install persists token to ~/.rampart/token (0600)
- setup claude-code reads token from RAMPART_TOKEN env or token file
and writes e.g. 'RAMPART_TOKEN=xxx /usr/local/bin/rampart hook'
- hasRampartInMatcher recognises RAMPART_TOKEN= prefixed commands
- 2 new tests: InlinesToken (env) + InlinesTokenFromFile
* fix: hook auto-reads token from ~/.rampart/token
Rather than inlining RAMPART_TOKEN in settings.json (security risk),
make the hook itself read ~/.rampart/token as a fallback when the env
var is not set. This mirrors the existing URL auto-discovery pattern.
- serve install persists token to ~/.rampart/token (0600)
- hook reads ~/.rampart/token when RAMPART_TOKEN env is unset
- setup claude-code writes bare '/path/to/rampart hook' — no creds
settings.json now contains no credentials whatsoever.
* ux: setup claude-code shows dashboard auth status
* fix: dashboard reads hook audit files (audit-hook-YYYY-MM-DD.jsonl)
The hook writes audit events to audit-hook-YYYY-MM-DD.jsonl while serve
writes to YYYY-MM-DD.jsonl. auditFilesForDate only matched the serve
prefix, so the dashboard showed 0 events even though the hook was
correctly recording them.
Now matches both prefixes. handleAuditDates similarly updated to surface
dates that only have hook files.
* fix: serve install --force unloads old service before reload
Two bugs:
1. --force wrote new plist + launchctl load but never unloaded the old
service, so the old binary/token kept running. launchctl unload is
now called first (best-effort) on both macOS and Linux.
2. persistToken failure was silently ignored, leaving plist token and
~/.rampart/token out of sync. Now warns with recovery command.
* ux: always show full token in serve install output
Generated and reused tokens both show the full value now. User needs
the full token to auth to the dashboard — truncating it was just friction.
Simplified output: dashboard URL, full token, token file pointer.
* fix: TestResolveToken_Generated isolates from real ~/.rampart/token
The test was leaking into the real home dir, so machines that had run
serve install would have a token file and the test would see generated=false.
* fix+test: token file permissions, hook guard, audit hook file coverage
- persistToken: add os.Chmod after WriteFile so pre-existing files with
wrong permissions (e.g. 0644) are always corrected to 0600
- hook.go: add tok != "" guard after readPersistedToken for consistency
with resolveServiceToken
- New tests:
- TestPersistAndReadToken: roundtrip + 0600 permission check
- TestPersistToken_FixesPermissions: chmod on pre-existing 0644 file
- TestResolveToken_FromFile: resolveServiceToken reads from ~/.rampart/token
- TestAuditDates_WithHookFiles: handleAuditDates returns hook file dates
- TestAuditEvents_HookFilesIncluded: auditFilesForDate reads hook files
Copy file name to clipboardExpand all lines: CHANGELOG.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
## [0.2.35] — 2026-02-18
11
+
12
+
### Fixed
13
+
-`rampart hook` now auto-reads the token from `~/.rampart/token` when `RAMPART_TOKEN` is not set in the environment. Claude Code hooks don't inherit the user's shell environment, so the token was never available at hook runtime — events silently fell back to local-only evaluation and never reached the dashboard. The hook now discovers both the serve URL (`localhost:18275`) and the token from standard locations, with no credentials needed in `settings.json`.
14
+
-`rampart serve install` now persists the generated token to `~/.rampart/token` (mode 0600). This is the canonical token location the hook reads from automatically.
15
+
- Dashboard now shows hook events. The hook and serve both write to `~/.rampart/audit/` but used different filename prefixes (`audit-hook-YYYY-MM-DD.jsonl` vs `YYYY-MM-DD.jsonl`). The audit API now reads both, so all events appear in the History tab regardless of which component wrote them.
0 commit comments