homelab: v0.6.0 — usage telemetry (usage top), evidence-driven verb prioritization
Answers the question that drove the whole CLI — which verbs to add next — with
data instead of one maintainer's habits, and resolves the cross-user-usage ask
in-bounds (no reading anyone's home).
- emit on dispatch: every verb fire-and-forgets one Loki line {job,user,verb} +
"exit=N ver=X". ONLY the verb path + exit code — never args, paths, flags, or
secrets (the emit never sees arguments). Best-effort: 800ms timeout, errors
swallowed, never affects the command; opt-out HOMELAB_TELEMETRY=0. Discovery
verbs (manifest/version/help) and usage itself don't self-record.
- usage top [--since 30d] [--user U] [--json]: ranks verbs via
sum by (verb)(count_over_time({job="homelab-usage"}[…])) against the shared
Loki. Cross-user analytics WITHOUT touching ~/.claude — the privacy-preserving
answer to "what does the team use".
- Loki sink (zero new infra, dogfoods v0.5 logs path); push verified HTTP 204 no
auth. ADR docs/adr/0011.
Live-verified: ran 4 verbs, usage top ranked them correctly (metrics query=2).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
666fefd22b
commit
3e3fdb34f0
9 changed files with 215 additions and 4 deletions
|
|
@ -50,7 +50,10 @@ func dispatch(reg []Command, args []string) error {
|
|||
if best < 0 {
|
||||
return fmt.Errorf("unknown command: %q", strings.Join(args, " "))
|
||||
}
|
||||
return reg[best].Run(args[bestLen:])
|
||||
matched := reg[best]
|
||||
runErr := matched.Run(args[bestLen:])
|
||||
emitUsage(matched.name(), runErr) // best-effort usage telemetry; never affects the command
|
||||
return runErr
|
||||
}
|
||||
|
||||
// name is the space-joined verb path, e.g. "tf plan".
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue