Skip to content
Development
Command

/connect

Connect a developer to one or more project postgres databases on the Tailscale network. Configures `~/.config/jat/projects.json`, `~/.config/jat/identity.json`, and seeds the developer as an assignee so they appear in assignee dropdowns immediately.

From plugin
jat
24836 skills36 commands
Install
$ npx -y skills add joewinke/jat --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/connect

Context preview

What this command does when you run it.

Connect a developer to one or more project postgres databases on the Tailscale network. Configures `~/.config/jat/projects.json`, `~/.config/jat/identity.json`, and seeds the developer as an assignee so they appear in assignee dropdowns immediately.

Command definition

connect.md
argument-hint: "[project-name] [postgres-url]"

/jat:connect — Connect to Project Databases

Connect a developer to one or more project postgres databases on the Tailscale network. Configures `~/.config/jat/projects.json`, `~/.config/jat/identity.json`, and seeds the developer as an assignee so they appear in assignee dropdowns immediately.

Usage

/jat:connect                                          # List available projects, pick which to connect
/jat:connect acme                                   # Connect to a specific project (auto-discover URL)
/jat:connect acme postgres://user:pass@host:5432/db # Connect with explicit URL
/jat:connect all                                      # Connect to all available projects

**The simplest onboarding:** jw runs `jat-secret --list`, identifies the project URLs, new dev runs `/jat:connect` and picks from the menu. Done.

**Direct onboarding for one project:** jw sends the postgres URL, new dev runs `/jat:connect acme postgres://...`.

---

What This Does

1. **Discovers available projects** — scans `jat-secret --list` for `*-supabase-url` and `*-postgres-url` patterns 2. **Shows connection status** — which projects are already connected in `projects.json` vs available 3. **Gets your identity** — name + email from git config (or prompts) 4. **Connects selected project(s)** — saves URL as a local secret, writes `projects.json` entry with `backend: "postgres"` 5. **Seeds you as an assignee** — creates and closes a stub task in each connected DB 6. **Tests each connection** — verifies `jt list` can reach each DB

---

Implementation

> ⚡ **BEGIN WITH TOOL CALLS — NO TEXT PREAMBLE.**

ROUND 1: Gather state (all parallel)

**1A: Discover available projects from jat-secret vault**

# List all secrets that look like project database URLs
jat-secret --list 2>/dev/null | python3 -c "
import sys, re
secrets = []
for line in sys.stdin:
    line = line.strip()
    # Match patterns: {project}-supabase-url, {project}-postgres-url, jat-postgres-url
    m = re.match(r'^(\w+)-(supabase-url|postgres-url)$', line)
    if m:
        secrets.append({'project': m.group(1), 'secret_name': line, 'type': m.group(2)})
    elif line == 'jat-postgres-url':
        secrets.append({'project': 'jat', 'secret_name': 'jat-postgres-url', 'type': 'postgres-url'})
import json
print(json.dumps(secrets))
" 2>/dev/null || echo "[]"

**1B: Check current projects.json state**

python3 -c "
import json, os
p = os.path.expanduser('~/.config/jat/projects.json')
if not os.path.exists(p):
    print('NO_PROJECTS_JSON')
    print('CONNECTED={}')
else:
    d = json.load(open(p))
    projects = d.get('projects', {})
    connected = {}
    for name, cfg in projects.items():
        if cfg.get('backend') == 'postgres' and cfg.get('backend_url'):
            connected[name] = True
    print(f'CONNECTED={json.dumps(connected)}')
    print(f'PROJECT_COUNT={len(projects)}')
" 2>/dev/null || echo "PARSE_ERROR"

**1C: Get identity from git config and identity.json**

GIT_NAME=$(git config --global user.name 2>/dev/null)
GIT_EMAIL=$(git config --global user.email 2>/dev/null)
echo "GIT_NAME=$GIT_NAME"
echo "GIT_EMAIL=$GIT_EMAIL"
python3 -c "
import json, os
p = os.path.expanduser('~/.config/jat/identity.json')
if os.path.exists(p):
    d = json.load(open(p))
    print('IDENTITY_JSON:', json.dumps(d))
else:
    print('NO_IDENTITY_JSON')
" 2>/dev/null || true

**1D: Try bootstrap endpoint (Tailnet probe)**

BOOTSTRAP_URL="${BOOTSTRAP_URL:-http://YOUR_TAILNET_IP:9876/jat/connect}"
result=$(curl -sS --connect-timeout 4 --max-time 5 "$BOOTSTRAP_URL" 2>/dev/null)
if [ $? -eq 0 ] && echo "$result" | python3 -c "
import json,sys
d=json.load(sys.stdin)
projects=d.get('projects',{})
if projects:
    print('BOOTSTRAP_OK')
    # Bootstrap v2 format: each project is {postgres_url, port}
    # Normalize to flat map for backwards compat if needed
    print(f'BOOTSTRAP_PROJECTS={json.dumps(projects)}')
" 2>/dev/null; then
    true
else
    echo "BOOTSTRAP_UNAVAILABLE"
fi

---

Analyze results and determine mode

After Round 1, determine which mode we're in based on `<input>`:

**Mode 1 — No argument (`/jat:connect`):** Show a table of all discovered projects with connection status and port, then ask which to connect via `AskUserQuestion`:

Available projects:

  Project       Status        Port    Source
  ─────────     ──────        ────    ──────
  jat           ✓ connected   :3333   bootstrap
  jst           ✓ connected   :4444   bootstrap
  steelbridge   ○ available   :3300   bootstrap
  flush         ○ available   :3400   bootstrap
  meadow        ○ available   :3200   bootstrap
  headcount     ○ available   :2900   bootstrap

Which project(s) to connect?

Use `AskUserQuestion` with `multiSelect: true` listing the unconnected projects, plus an "All unconnected" option.

**Mode 2 — Project name (`/jat:connect acme`):** Skip the menu. Connect directly to the named project. Resolve URL from: 1. Second argument if provided (`/jat:connect acme postgres://...`) 2. `jat-secret {project}-supabase-url` or `jat-secret {project}-postgres-url` 3. Bootstrap endpoint projects list 4. Prompt user to paste URL

**Mode 3 — "all" (`/jat:connect all`):** Connect to every available project that isn't already connected.

**Mode 4 — Raw postgres URL (`/jat:connect postgres://...`):** Legacy mode. Ask which project name this URL is for via `AskUserQuestion`, then proceed as Mode 2.

**User identity** (in priority order, same for all modes): 1. `identity.json` name/email → use it (already set up) 2. `GIT_NAME` + `GIT_EMAIL` from git config → use it 3. Neither → prompt via `AskUserQuestion` for name and email

---

ROUND 2: Resolve URLs and ports for selected projects

For each project selected in the previous step, resolve its postgres URL and port.

**If bootstrap data is available (preferred):** extract `postgres_url` and `port` directly from the

Read more
Ships withjat

Agents ship, suggest, repeat. You supervise — or they run on their own. JAT is the complete, self-contained environment for agentic development. Task management, agent orchestration, code editor, git integration, terminal access—all unified in a single IDE.

Get the whole plugin