Skip to content

CLI subcommand tree via decline #46

Description

@Sootopolis

Depends on

  • Packaging (Main entry exists) — #41

Blocks

  • ccas serve lifecycle — #48
  • Shell completions (consume the decline command tree) — #49

What

Add decline (com.monovore::decline-effect) and build the subcommand tree.

Public subcommands

Subcommand Maps to
ccas serve boots CcasServer (foreground)
ccas membership <slug> [...] POST /api/jobs/membership
ccas history <slugs...> [...] POST /api/jobs/history
ccas recruit <slug> [...] POST /api/jobs/recruitment
ccas stats <slug> [...] POST /api/jobs/stats
ccas blacklist {add|list|remove} <slug> BlacklistRoutes
ccas schedule {list|add|remove} ScheduleRoutes
ccas logs <job_id> GET /api/jobs/{id}/logs live tail
ccas jobs [...] GET /api/jobs listings
ccas __complete <args> hidden; returns completion matches

Hidden admin subcommands (decline Visibility.Partial)

Subcommand Maps to
ccas admin ref [--force] POST /api/admin/jobs/matchref
ccas admin clubdata [--force] [<slug>...] POST /api/admin/jobs/clubdata

Per #50 (closed 2026-05-27): MatchRef and ClubData are server-internal — no public subcommand, no --help listing. Hidden admin escape hatch for ops debugging only. Default JobSchedule rows (see #45) cover the normal cadence.

History stays public because users do want explicit "ingest this club's matches now" semantics (esp. first-seed). Default JobSchedule for History keeps steady state warm.

Each subcommand serializes the same case classes (MembershipRequest, HistoryRequest, ...) that JobRoutes already accepts. HTTP client uses HttpClientLayer.live for consistency.

After a successful submit, poll GET /api/jobs/{id} until terminal, streaming logs from GET /api/jobs/{id}/logs once the file-tail endpoint lands; until then just poll status.

Acceptance

  • All listed public subcommands parse via decline and produce a usable --help per subcommand.
  • Hidden ccas admin ref / ccas admin clubdata work but do not appear in ccas --help output.
  • ccas membership team-alpha against a running local server returns exit 0 on success, non-zero on job failure, with the server-side error message printed.
  • ccas <invalid> exits non-zero with the standard decline "unknown command" suggestion.

Files

  • build.sbt — add decline-effect.
  • new src/main/scala/ccas/cli/ — command tree, HTTP client, poll loop.
  • src/main/scala/ccas/cli/Main.scala — dispatch into the command tree.

Reference

Tracked under epic #40 (CLI v0). Outcome of #50 decision (closed 2026-05-27).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliCLI binary (subcommands, completions, config, packaging)enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions