Skip to content

feat: add ataegina list --json (fleet view)#31

Merged
noahhyden merged 2 commits into
mainfrom
feat/list-json
Jul 20, 2026
Merged

feat: add ataegina list --json (fleet view)#31
noahhyden merged 2 commits into
mainfrom
feat/list-json

Conversation

@noahhyden

Copy link
Copy Markdown
Owner

What & why

Fifth and final planned agent-native addition (docs/design/agent-native.md). A supervising agent that spawns workers across worktrees needs to see the whole fleet in one structured call. list --json emits the registry as a JSON array — the shared slot shape per worktree (primary first) plus stale and live:

[{"index":0,"repo_root":"","frontend":{},"backend":{},"log_dir":"","db":null,"stale":false,"live":false},
 {"index":1,"repo_root":"…-wtA","frontend":{"port":5174,},…,"stale":false,"live":true}]
  • stale — the worktree directory is gone (run prune).
  • live — coarse best-effort: any of its derived ports is listening (always false under a none port backend).
  • Human list output is unchanged.

_ate_list_entry_json computes a slot for an arbitrary (index, path) from the repo's config (port bases, DB naming) rather than the current tree, reusing emit_db_json for each entry's db object.

Discipline

  • Spec: docs/design/agent-native.md.
  • Tests-first: tests/list_json.bats — 10 hermetic tests: array shape, per-worktree ports, stale (a removed worktree dir), live (fake ss on a derived port), per-worktree db naming (unsuffixed primary + wtN), single-primary case, human-output regression, arg validation, completion. Completion assertions across ports/status/list made robust to future group changes.
  • Live verification: drove the binary across a primary + two worktrees and parsed the array with python -m json.tool.
  • Mutation red-teaming: stale-always-false, live-never-true, and db-suffix-dropped — each caught by a distinct test.
  • Docs: README, man page, CHANGELOG, bash+zsh completion, in-script --help. Checksum regenerated. No new dependencies.

Series

Completes #27 (ports --json), #28 (up --wait), #29 (status --json), #30 (up --json).

🤖 Generated with Claude Code

noahhyden and others added 2 commits July 20, 2026 01:29
Emit the registry as a JSON array — the shared slot shape per worktree
(primary at index 0 first, then each registry entry) plus two list-only
fields: `stale` (its directory is gone) and `live` (a coarse best-effort
"a derived port is listening"; always false under a `none` port backend).
This is the fleet view a supervising agent uses to see all its parallel
workers at once. Human `list` output is unchanged.

`list` becomes cmd_list; _ate_list_entry_json computes a slot for an
arbitrary (index, path) from the repo's config (port bases, DB naming)
rather than the current tree, reusing emit_db_json for the per-entry db
object. This completes the five-part agent-native surface.

Spec: docs/design/agent-native.md. Completion (bash+zsh), man page, README,
CHANGELOG, and in-script --help updated. New hermetic suite
tests/list_json.bats (10 tests): the array shape, per-worktree ports, stale
(a removed worktree dir), live (fake `ss` on a derived port), per-worktree
db naming, the single-primary case, human-output regression, arg validation,
completion. Completion assertions across ports/status/list made robust to
future group changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Compare repo_root (and the human list path) against git's resolved toplevel
via a resolved() helper, not the raw mktemp path. On macOS CI $TMPDIR is
/var -> /private/var (a symlink) which git rev-parse resolves, so the raw
comparison failed on both macOS jobs (tests 1/2/3/7) while passing on
Linux/Windows. Same class as the PR #27 fix; now applied to this file too.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@noahhyden
noahhyden merged commit 9bd6f72 into main Jul 20, 2026
8 checks passed
@noahhyden
noahhyden deleted the feat/list-json branch July 20, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant