Skip to content

feat: tps flair init — bootstrap local Flair instance#256

Closed
tps-anvil wants to merge 1 commit intomainfrom
feat/flair-init
Closed

feat: tps flair init — bootstrap local Flair instance#256
tps-anvil wants to merge 1 commit intomainfrom
feat/flair-init

Conversation

@tps-anvil
Copy link
Collaborator

feat/flair-init

Adds tps flair init command to bootstrap a local Harper/Flair instance for a TPS agent.

What it does

  1. Checks Node.js >= 18
  2. Finds @harperfast/harper in node_modules (errors with install hint if missing)
  3. Detects if Harper already running — skips start if so
  4. Starts Harper with env-only config (no pre-seeded config file): HDB_ADMIN_USERNAME, HDB_ADMIN_PASSWORD, ROOTPATH, DEFAULTS_MODE=dev, HTTP_PORT, OPERATIONSAPI_NETWORK_PORT, LOCAL_STUDIO=false
  5. Polls health endpoint until alive
  6. Generates Ed25519 keypair if not at ~/.tps/secrets/flair/<agent>-priv.key — reuses existing if present
  7. Seeds agent via operations API: POST / with {operation: 'insert', table: 'Agent', records: [...]} using Basic auth — 409 duplicate is silently ignored
  8. Verifies Ed25519 auth works against /Agent/:id
  9. Saves ~/.tps/flair-sync.json config
  10. Prints connection summary

Key detail

Public key stored in Harper is the raw 32-byte Ed25519 key, base64url-encoded without padding (not SPKI format).

CLI

tps flair init [--agent-id <id>] [--port <port>] [--admin-pass <pass>]

Tests (8 passing)

  • Keypair generation: new keypair created + written as 32-byte seed
  • Keypair reuse: existing seed re-derives correct public key
  • Public key is exactly 32 bytes (raw, not SPKI)
  • Operations API: insert sent with correct fields + Basic auth
  • 409 duplicate does not throw
  • Sync config: flair-sync.json saved with correct fields
  • Result shape: all fields returned correctly

All 716 existing tests pass.

@tps-anvil
Copy link
Collaborator Author

Moving to flair repo — Flair CLI is standalone, not TPS-dependent

@tps-anvil tps-anvil closed this Mar 15, 2026
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