Skip to content

Headless mode + local reload endpoint (#18) - #35

Merged
MagicalTux merged 1 commit into
masterfrom
feat/headless-and-reload
Jun 18, 2026
Merged

MagicalTux merged 1 commit into
masterfrom
feat/headless-and-reload

Conversation

@MagicalTux

Copy link
Copy Markdown
Member

Completes the passive-compatible parts of the #18 upstreaming stack (from #14), without the active background prober.

Added

  • teamclaude server --headless (alias --no-tui) — run the proxy without the interactive TUI, for backgrounding / running as a service.
  • POST /teamclaude/reload — re-sync accounts from config without a restart; the headless equivalent of pressing R in the TUI. Local-only control endpoint (no upstream calls — same trust model as the existing /teamclaude/status). Returns {ok, added}; 501 if no handler is wired, 500 on error.
  • Auto-notify: login / import / enable / disable / priority best-effort POST to /teamclaude/reload, so CLI changes apply to a running server live. A closed local port refuses instantly, so it's a near-instant no-op when nothing is running.
  • reloadAccounts is shared by the TUI R key, the endpoint, and the CLI notify.

Deliberately excluded (passive-only)

The background quota prober, usage-endpoint quota, and probe-on-add from #14/#16 all actively call the Anthropic API on a timer — that violates TeamClaude's passive-only design, so they're not included.

Notes

  • Reload covers new accounts + credential/priority/enable-disable changes (which syncAccountsFromDisk already applies). Account removals still require a restart — documented in help and README.
  • Auth: localhost is already trusted by the proxy, so the reload endpoint is reachable locally without the API key, exactly like /teamclaude/status.

Tests

test/server-reload.test.js — endpoint success/501/500. Verified end-to-end: a --headless server serves /teamclaude/status and /teamclaude/reload. Full suite 49 passing, lint clean.

Part of #18.

🤖 Generated with Claude Code

Completes the passive-compatible parts of the #18 upstreaming stack (#14),
without the active background prober (which would violate the passive-only
design).

- `teamclaude server --headless` (alias `--no-tui`) runs the proxy without the
  interactive TUI, for backgrounding / running as a service.
- `POST /teamclaude/reload` re-syncs accounts from config without a restart —
  the headless equivalent of pressing 'R' in the TUI. Local-only control
  endpoint (no upstream calls); returns the number of newly added accounts, 501
  if unwired, 500 on handler error.
- CLI commands that change accounts (login/import/enable/disable/priority) now
  best-effort notify a running server to reload, so changes apply live. A closed
  port refuses instantly, so it's a no-op when nothing is running. (Reload picks
  up adds + credential/priority/enable-disable changes; removals still need a
  restart.)
- reloadAccounts is shared by the TUI 'R' key, the endpoint, and CLI notify.

Explicitly NOT included (active polling, against passive-only): the background
quota prober, usage-endpoint quota, and probe-on-add from #14/#16.

Tests for the reload endpoint (success/501/500); README + help updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@MagicalTux
MagicalTux merged commit dd309a6 into master Jun 18, 2026
5 checks passed
@MagicalTux
MagicalTux deleted the feat/headless-and-reload branch June 18, 2026 09:23
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