Repository navigation
tackroom dash --json prints the dash's answer once, without a terminal - #344
Conversation
Reviewer's GuideAPIDefine the JSON document and implement
Add the
ImplementationAdapt dashboard status, answer, count, harness, and machine helpers so the JSON output can reuse the dash’s calculations and represent unknown counts.
UIUpdate command summaries to advertise the new one-shot JSON mode.
DocumentationDocument the dash JSON option and its fields, update command references, and add the 3.3 upgrade note.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 41 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="internal/app/dash.go" line_range="1378-1379" />
<code_context>
+// not be read.
+func (m dashModel) countNumbers() (numbers [5]*int) {
+ if s := m.status; s != nil {
+ for i, n := range []int{s.skills, s.roles, s.mcp, s.hooks} {
+ numbers[i] = &n
+ }
+ }
</code_context>
<issue_to_address>
**Unreadable counts appear as zero**
When `expectedSkills` or `agentrole.Load` fails while the rest of status collection succeeds, `collectDashStatus` leaves the skill or role count at zero, and `countNumbers` wraps it in a non-nil pointer, so JSON reports `0` instead of `null` and callers treat unreadable data as a real zero.
Preserve whether the skills and roles reads succeeded, and return nil pointers for counts whose reads failed.
Also at `docs/terminals.md:78`.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: internal/app/dash.go:1379
What and why
tackroom dash --jsonprints once, as JSON, the answer the terminal dash shows, and exits. It needs no terminal, so a script or a menu bar item can run it. Until now the combined headline ("1 failing, 5 need attention") existed only inside the dash and the Herdr panel;status --jsoncovers sync alone.The document has the level (
ok,warn,fail), the headline, the two numbers behind it, the notes under it, the counts, the harnesses in sync, needing a sync or broken, the jobs that fail or need attention, the machines, and the time of the check. It is built from the dash's own collects andanswer(), so the dash and the JSON cannot disagree.Plain
tackroom dashis unchanged; its "needs a terminal" error now namesdash --json.How I checked it
In a throwaway home with stub
launchctl,crontabandssh:tackroom dash --json < /dev/nullexits 0, prints valid JSON with no ANSI codes and nothing on stderr. On a healthy demo home:levelok,title"All clear", 6 harnesses in sync, counts 15 skills, 6 roles, 2 MCP servers, 1 hook, which is what the web view's Overview shows for the same home.With one stub job reporting exit 1 and one pointing at a missing path:
levelfail, "1 failing, 1 needs attention", both jobs listed, the healthy one left out.A moved role file puts the harness under
needs_sync; a second host fillsmachines; a corrupt lock gives null config counts and a note.tackroom dashwithout a terminal still exits non-zero with the new message.go test ./...andgo vet ./...passI can explain this change without an AI tool
Summary by Sourcery
Expose the dash's current health summary as a machine-readable JSON snapshot for scripts and menu bar integrations.
New Features:
tackroom dash --jsonto emit a one-time, terminal-independent JSON snapshot of sync status, scheduled jobs, harnesses, machines, counts, and check metadata.Enhancements:
Documentation: