Skip to content

setdb: connect by db-name (cross-server search) + live --status health - #26

Merged
sibinc merged 3 commits into
mainfrom
setdb-status-lookup
Jul 3, 2026
Merged

setdb: connect by db-name (cross-server search) + live --status health#26
sibinc merged 3 commits into
mainfrom
setdb-status-lookup

Conversation

@sibinc

@sibinc sibinc commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Builds on and supersedes #25 (its docs/skill commits are included here).

New capabilities

Connect by db name — setdb <dbname>. If the first arg isn't a known server id, it's treated as a database name: setdb searches every server in the group, finds which one hosts it, ensures the connection, and sets the active db. Unique → auto; multiple → prompt (JSON: error listing them); none → error. Example: setdb test_sfchyd2906.

Live --status health check. setdb --status now pings the current connection and reports ● connected (301ms) / ○ DOWN — <error> (JSON: connection: {ok, ms}). Enabled by stamping the source connection id into active-db.php as a PHP comment (// setdb server=<id>), which parseActiveDb reads back. --no-check skips the ping.

Interactive db listing. With a server chosen but no db given, setdb lists the server's databases (with a filter prompt) to pick from, instead of blind-typing.

Connection ensured before set. A ping runs before writing active-db.php (skipped with --no-verify), so a set never points the app at an unreachable server.

Standalone lookups unchanged and documented: lwdb servers, lwdb dbs <server> [pattern], lwdb find-table.

Also included (from #25)

  • docs/setdb.md step-3 fix (web-root .lwdb, not home dir).
  • lwdb skill: new setdb section + activation trigger.

Tests

13/13 pass (added server-stamp round-trip). Manually verified: db-name search → set, --status health, stamped active-db.php lints + app connects.

@sibinc
sibinc merged commit 290e486 into main Jul 3, 2026
6 checks passed
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.

2 participants