reeboot 1.0.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: files
3
+ description: Local filesystem operations — read files, list directories, search with find/grep, write files. Use when reading, writing, searching, or managing local files and directories.
4
+ ---
5
+
6
+ # Files
7
+
8
+ Local filesystem operations using standard shell tools. No external dependencies beyond bash.
9
+
10
+ ## Setup
11
+
12
+ No installation required — all tools (`cat`, `ls`, `find`, `grep`, `head`, `tail`) are built into macOS and Linux.
13
+
14
+ **Protected paths**: reeboot's protected-paths extension blocks access to sensitive directories (e.g., `~/.ssh`, `~/.reeboot/credentials`). The agent will refuse to read or modify files in these paths.
15
+
16
+ Check which paths are protected:
17
+ ```bash
18
+ # The protected-paths extension documents blocked directories
19
+ # Default blocked: ~/.ssh, ~/.gnupg, /etc/passwd, /etc/shadow, ~/.reeboot/credentials
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ### Reading files
25
+
26
+ ```bash
27
+ # Read an entire file
28
+ cat /path/to/file.txt
29
+
30
+ # Read first N lines
31
+ head -n 50 /path/to/file.txt
32
+
33
+ # Read last N lines
34
+ tail -n 100 /path/to/file.log
35
+
36
+ # Read a specific range of lines
37
+ sed -n '10,30p' /path/to/file.txt
38
+ ```
39
+
40
+ ### Listing directories
41
+
42
+ ```bash
43
+ # List with details
44
+ ls -la /path/to/directory
45
+
46
+ # List recursively (shallow)
47
+ ls -la /path/to/directory/
48
+
49
+ # Tree view (if available)
50
+ find /path/to/directory -maxdepth 2 -print | sed 's|[^/]*/| |g'
51
+ ```
52
+
53
+ ### Searching
54
+
55
+ ```bash
56
+ # Search file contents
57
+ grep -r "pattern" /path/to/directory
58
+ grep -r "TODO" . --include="*.ts"
59
+ grep -n "function auth" src/auth.ts
60
+
61
+ # Find files by name
62
+ find /path -name "*.json" -type f
63
+ find . -name "*.log" -mtime -7 # modified in last 7 days
64
+
65
+ # Find and grep
66
+ find . -name "*.ts" | xargs grep "import.*config"
67
+ ```
68
+
69
+ ### Writing files
70
+
71
+ ```bash
72
+ # Write (overwrite) a file
73
+ echo "content" > /path/to/file.txt
74
+ cat > /path/to/file.txt << 'HEREDOC'
75
+ multi-line
76
+ content here
77
+ HEREDOC
78
+
79
+ # Append to a file
80
+ echo "new line" >> /path/to/file.log
81
+
82
+ # Copy a file
83
+ cp /source/file.txt /dest/file.txt
84
+
85
+ # Move/rename a file
86
+ mv /old/path.txt /new/path.txt
87
+ ```
88
+
89
+ ### Safe practices
90
+
91
+ - Always `head` or `wc -l` a file before `cat` if you don't know its size
92
+ - Use `find` with `-maxdepth` to avoid traversing huge directory trees
93
+ - Prefer `cat` over editors for reading; use redirect operators for writing
94
+ - Check file size first: `ls -lh /path/to/file`
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: gcal
3
+ description: Google Calendar operations via gccli — list events, create meetings, update or delete events, check free/busy. Use when managing calendar events, scheduling meetings, or checking availability.
4
+ ---
5
+
6
+ # Google Calendar
7
+
8
+ Wraps `gccli` (`@mariozechner/gccli`) for Google Calendar operations — list, create, update, delete events, and free/busy queries.
9
+
10
+ ## Setup
11
+
12
+ 1. Install gccli:
13
+ ```
14
+ npm install -g @mariozechner/gccli
15
+ ```
16
+
17
+ 2. Use the same GCP project as the Gmail skill (or create a new one):
18
+ - Enable the **Google Calendar API** under APIs & Services → Library
19
+ - Use the same OAuth 2.0 Desktop credentials JSON (or create new ones)
20
+
21
+ 3. Configure gccli with your credentials:
22
+ ```
23
+ gccli accounts credentials ~/path/to/credentials.json
24
+ ```
25
+
26
+ 4. Add your Google account:
27
+ ```
28
+ gccli accounts add user@gmail.com
29
+ ```
30
+ Follow the browser OAuth consent flow.
31
+
32
+ 5. Verify:
33
+ ```
34
+ gccli accounts list
35
+ gccli user@gmail.com list --days 1
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ ```bash
41
+ # List upcoming events (next 7 days)
42
+ gccli user@gmail.com list --days 7
43
+
44
+ # List events in a date range
45
+ gccli user@gmail.com list --from 2026-03-21 --to 2026-03-28
46
+
47
+ # Create an event
48
+ gccli user@gmail.com create \
49
+ --title "Team Standup" \
50
+ --start "2026-03-21T09:00" \
51
+ --end "2026-03-21T09:30" \
52
+ --description "Daily sync"
53
+
54
+ # Create an all-day event
55
+ gccli user@gmail.com create \
56
+ --title "Conference" \
57
+ --date "2026-03-21"
58
+
59
+ # Update an event
60
+ gccli user@gmail.com update <eventId> --title "New Title"
61
+
62
+ # Delete an event
63
+ gccli user@gmail.com delete <eventId>
64
+
65
+ # Check free/busy
66
+ gccli user@gmail.com freebusy \
67
+ --from "2026-03-21T08:00" \
68
+ --to "2026-03-21T18:00"
69
+ ```
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: gdrive
3
+ description: Google Drive operations via gdcli — list files, read documents, search, upload, and share. Use when accessing, reading, or managing files in Google Drive.
4
+ ---
5
+
6
+ # Google Drive
7
+
8
+ Wraps `gdcli` (`@mariozechner/gdcli`) for Google Drive operations — list, read, search, upload, and share files.
9
+
10
+ ## Setup
11
+
12
+ 1. Install gdcli:
13
+ ```
14
+ npm install -g @mariozechner/gdcli
15
+ ```
16
+
17
+ 2. Use the same GCP project as the Gmail/Calendar skills (or create a new one):
18
+ - Enable the **Google Drive API** under APIs & Services → Library
19
+ - Use the same OAuth 2.0 Desktop credentials JSON
20
+
21
+ 3. Configure gdcli with your credentials:
22
+ ```
23
+ gdcli accounts credentials ~/path/to/credentials.json
24
+ ```
25
+
26
+ 4. Add your Google account:
27
+ ```
28
+ gdcli accounts add user@gmail.com
29
+ ```
30
+ Follow the browser OAuth consent flow.
31
+
32
+ 5. Verify:
33
+ ```
34
+ gdcli accounts list
35
+ gdcli user@gmail.com list --limit 5
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ ```bash
41
+ # List files in root
42
+ gdcli user@gmail.com list --limit 20
43
+
44
+ # List files in a folder
45
+ gdcli user@gmail.com list --folder <folderId>
46
+
47
+ # Search files
48
+ gdcli user@gmail.com search "quarterly report"
49
+ gdcli user@gmail.com search "type:spreadsheet name:budget"
50
+
51
+ # Read a file (returns text content)
52
+ gdcli user@gmail.com read <fileId>
53
+
54
+ # Upload a file
55
+ gdcli user@gmail.com upload /path/to/file.pdf --name "Report Q1"
56
+
57
+ # Upload to a specific folder
58
+ gdcli user@gmail.com upload /path/to/file.pdf --folder <folderId>
59
+
60
+ # Share a file
61
+ gdcli user@gmail.com share <fileId> --email colleague@example.com --role reader
62
+
63
+ # Get file metadata
64
+ gdcli user@gmail.com info <fileId>
65
+ ```
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: github
3
+ description: GitHub operations via gh CLI — issues, PRs, releases, code search, GitHub Actions workflows. Use when working with GitHub repositories, managing issues, reviewing pull requests, or automating GitHub tasks.
4
+ ---
5
+
6
+ # GitHub
7
+
8
+ Wraps the `gh` CLI for GitHub operations — issues, pull requests, releases, code search, and GitHub Actions.
9
+
10
+ ## Setup
11
+
12
+ 1. Install the GitHub CLI:
13
+ ```
14
+ brew install gh # macOS
15
+ # or: https://cli.github.com/
16
+ ```
17
+
18
+ 2. Authenticate:
19
+ ```
20
+ gh auth login
21
+ ```
22
+ Follow the prompts to authenticate via browser or token.
23
+
24
+ 3. Verify:
25
+ ```
26
+ gh auth status
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ### Issues
32
+
33
+ ```bash
34
+ gh issue list --repo owner/repo --state open --limit 20
35
+ gh issue view 123 --repo owner/repo
36
+ gh issue create --title "Bug: ..." --body "..." --label bug
37
+ gh issue close 123
38
+ ```
39
+
40
+ ### Pull Requests
41
+
42
+ ```bash
43
+ gh pr list --repo owner/repo --state open
44
+ gh pr view 456 --repo owner/repo
45
+ gh pr create --title "Feature: ..." --body "..." --base main
46
+ gh pr merge 456 --squash
47
+ gh pr review 456 --approve
48
+ ```
49
+
50
+ ### Releases
51
+
52
+ ```bash
53
+ gh release list --repo owner/repo
54
+ gh release create v1.2.3 --title "v1.2.3" --notes "Changelog..."
55
+ gh release view v1.2.3
56
+ ```
57
+
58
+ ### Code Search
59
+
60
+ ```bash
61
+ gh search code "function authenticate" --repo owner/repo
62
+ gh search issues "memory leak" --repo owner/repo
63
+ ```
64
+
65
+ ### GitHub Actions
66
+
67
+ ```bash
68
+ gh run list --repo owner/repo --limit 10
69
+ gh run view 789 --repo owner/repo
70
+ gh run watch 789
71
+ gh workflow run deploy.yml --ref main
72
+ ```
73
+
74
+ ### Repos
75
+
76
+ ```bash
77
+ gh repo list --limit 20
78
+ gh repo clone owner/repo
79
+ gh repo view owner/repo
80
+ ```
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: gmail
3
+ description: Gmail operations via gmcli — search emails, read threads, send messages, manage labels, handle attachments. Use when working with Gmail: reading, searching, sending, or organising emails.
4
+ ---
5
+
6
+ # Gmail
7
+
8
+ Wraps `gmcli` (`@mariozechner/gmcli`) for Gmail operations — search, read, send, draft, labels, attachments.
9
+
10
+ ## Setup
11
+
12
+ 1. Install gmcli:
13
+ ```
14
+ npm install -g @mariozechner/gmcli
15
+ ```
16
+
17
+ 2. Create a GCP project and enable the Gmail API:
18
+ - Go to https://console.cloud.google.com/
19
+ - Create a new project (or use an existing one)
20
+ - Enable the **Gmail API** under APIs & Services → Library
21
+ - Create **OAuth 2.0 Desktop credentials**: APIs & Services → Credentials → Create Credentials → OAuth client ID → Desktop app
22
+ - Download the credentials JSON file
23
+
24
+ 3. Configure gmcli with your credentials:
25
+ ```
26
+ gmcli accounts credentials ~/path/to/credentials.json
27
+ ```
28
+
29
+ 4. Add your Gmail account:
30
+ ```
31
+ gmcli accounts add user@gmail.com
32
+ ```
33
+ This opens a browser for OAuth consent. Grant the requested permissions.
34
+
35
+ 5. Verify:
36
+ ```
37
+ gmcli accounts list
38
+ ```
39
+
40
+ ## Usage
41
+
42
+ ```bash
43
+ # Search emails
44
+ gmcli user@gmail.com search "from:boss@company.com is:unread"
45
+ gmcli user@gmail.com search "subject:invoice after:2025/01/01"
46
+
47
+ # Read a thread
48
+ gmcli user@gmail.com thread <threadId>
49
+
50
+ # Send an email
51
+ gmcli user@gmail.com send \
52
+ --to recipient@example.com \
53
+ --subject "Hello" \
54
+ --body "Message content here"
55
+
56
+ # Send with attachment
57
+ gmcli user@gmail.com send \
58
+ --to recipient@example.com \
59
+ --subject "Report" \
60
+ --body "See attached" \
61
+ --attach /path/to/report.pdf
62
+
63
+ # List labels
64
+ gmcli user@gmail.com labels list
65
+
66
+ # List unread in inbox
67
+ gmcli user@gmail.com search "in:inbox is:unread" --limit 10
68
+ ```
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: hubspot
3
+ description: HubSpot CRM operations via HUBSPOT_ACCESS_TOKEN and curl — manage contacts, deals, companies, pipelines, and notes via the HubSpot v3 API. Use when working with CRM data in HubSpot.
4
+ ---
5
+
6
+ # HubSpot
7
+
8
+ Uses `HUBSPOT_ACCESS_TOKEN` env var + curl against the HubSpot CRM v3 API to manage contacts, deals, companies, pipelines, and notes.
9
+
10
+ ## Setup
11
+
12
+ 1. Create a Private App in HubSpot:
13
+ - Go to HubSpot Settings → **Integrations** → **Private Apps**
14
+ - Click **Create a private app**
15
+ - Name it (e.g., "reeboot-agent")
16
+ - Under **Scopes**, add:
17
+ - `crm.objects.contacts.read` / `crm.objects.contacts.write`
18
+ - `crm.objects.deals.read` / `crm.objects.deals.write`
19
+ - `crm.objects.companies.read` / `crm.objects.companies.write`
20
+ - `crm.objects.notes.read` / `crm.objects.notes.write`
21
+ - Click **Create app** → copy the **Access token** (starts with `pat-`)
22
+
23
+ 2. Set the environment variable:
24
+ ```
25
+ export HUBSPOT_ACCESS_TOKEN=pat-na1-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
26
+ ```
27
+ Add to your shell profile for persistence.
28
+
29
+ 3. Verify:
30
+ ```
31
+ curl -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" \
32
+ https://api.hubapi.com/crm/v3/objects/contacts?limit=1
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ```bash
38
+ # List contacts
39
+ curl -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" \
40
+ "https://api.hubapi.com/crm/v3/objects/contacts?limit=20&properties=firstname,lastname,email"
41
+
42
+ # Search contacts
43
+ curl -X POST \
44
+ -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" \
45
+ -H "Content-Type: application/json" \
46
+ "https://api.hubapi.com/crm/v3/objects/contacts/search" \
47
+ -d '{"filterGroups": [{"filters": [{"propertyName": "email", "operator": "EQ", "value": "john@example.com"}]}]}'
48
+
49
+ # Create a contact
50
+ curl -X POST \
51
+ -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" \
52
+ -H "Content-Type: application/json" \
53
+ "https://api.hubapi.com/crm/v3/objects/contacts" \
54
+ -d '{"properties": {"email": "new@example.com", "firstname": "New", "lastname": "Contact"}}'
55
+
56
+ # List deals
57
+ curl -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" \
58
+ "https://api.hubapi.com/crm/v3/objects/deals?limit=20&properties=dealname,amount,closedate,dealstage"
59
+
60
+ # Create a deal
61
+ curl -X POST \
62
+ -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" \
63
+ -H "Content-Type: application/json" \
64
+ "https://api.hubapi.com/crm/v3/objects/deals" \
65
+ -d '{"properties": {"dealname": "New Deal", "amount": "10000", "closedate": "2026-06-30", "pipeline": "default", "dealstage": "appointmentscheduled"}}'
66
+
67
+ # List companies
68
+ curl -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" \
69
+ "https://api.hubapi.com/crm/v3/objects/companies?limit=20&properties=name,domain,industry"
70
+
71
+ # Create a note
72
+ curl -X POST \
73
+ -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" \
74
+ -H "Content-Type: application/json" \
75
+ "https://api.hubapi.com/crm/v3/objects/notes" \
76
+ -d '{"properties": {"hs_note_body": "Called customer, interested in enterprise plan.", "hs_timestamp": "2026-03-20T10:00:00Z"}}'
77
+ ```
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: linear
3
+ description: Linear project management via LINEAR_API_KEY and GraphQL — create, list, update, and search issues and projects. Use when managing engineering tasks, sprint planning, or querying Linear issues.
4
+ ---
5
+
6
+ # Linear
7
+
8
+ Uses `LINEAR_API_KEY` env var + curl against the Linear GraphQL API to manage issues, projects, and teams.
9
+
10
+ ## Setup
11
+
12
+ 1. Generate a Personal API key:
13
+ - Go to Linear Settings → **API** → **Personal API keys**
14
+ - Click **Create key** → give it a label → copy the key
15
+
16
+ 2. Set the environment variable:
17
+ ```
18
+ export LINEAR_API_KEY=lin_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
19
+ ```
20
+ Add to your shell profile for persistence.
21
+
22
+ 3. Verify:
23
+ ```
24
+ curl -X POST \
25
+ -H "Authorization: $LINEAR_API_KEY" \
26
+ -H "Content-Type: application/json" \
27
+ https://api.linear.app/graphql \
28
+ -d '{"query": "{ viewer { id name email } }"}'
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ All requests go to `https://api.linear.app/graphql` with `Authorization: $LINEAR_API_KEY`.
34
+
35
+ ```bash
36
+ # List your assigned issues
37
+ curl -X POST \
38
+ -H "Authorization: $LINEAR_API_KEY" \
39
+ -H "Content-Type: application/json" \
40
+ https://api.linear.app/graphql \
41
+ -d '{
42
+ "query": "{ viewer { assignedIssues(first: 20) { nodes { id title state { name } priority } } } }"
43
+ }'
44
+
45
+ # Search issues
46
+ curl -X POST \
47
+ -H "Authorization: $LINEAR_API_KEY" \
48
+ -H "Content-Type: application/json" \
49
+ https://api.linear.app/graphql \
50
+ -d '{
51
+ "query": "{ issueSearch(query: \"bug login\", first: 10) { nodes { id title state { name } assignee { name } } } }"
52
+ }'
53
+
54
+ # Create an issue
55
+ curl -X POST \
56
+ -H "Authorization: $LINEAR_API_KEY" \
57
+ -H "Content-Type: application/json" \
58
+ https://api.linear.app/graphql \
59
+ -d '{
60
+ "query": "mutation { issueCreate(input: { teamId: \"<teamId>\", title: \"Fix login bug\", description: \"Steps to reproduce...\" }) { issue { id title } } }"
61
+ }'
62
+
63
+ # List teams
64
+ curl -X POST \
65
+ -H "Authorization: $LINEAR_API_KEY" \
66
+ -H "Content-Type: application/json" \
67
+ https://api.linear.app/graphql \
68
+ -d '{"query": "{ teams { nodes { id name key } } }"}'
69
+
70
+ # Update issue state
71
+ curl -X POST \
72
+ -H "Authorization: $LINEAR_API_KEY" \
73
+ -H "Content-Type: application/json" \
74
+ https://api.linear.app/graphql \
75
+ -d '{
76
+ "query": "mutation { issueUpdate(id: \"<issueId>\", input: { stateId: \"<stateId>\" }) { issue { id state { name } } } }"
77
+ }'
78
+ ```
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: notion
3
+ description: Notion workspace operations via NOTION_API_KEY and curl — search pages, read databases, create/update blocks and pages. Use when accessing or modifying content in a Notion workspace.
4
+ ---
5
+
6
+ # Notion
7
+
8
+ Uses `NOTION_API_KEY` env var + curl against the Notion REST API to manage pages, databases, and blocks.
9
+
10
+ ## Setup
11
+
12
+ 1. Create a Notion internal integration:
13
+ - Go to https://www.notion.so/my-integrations
14
+ - Click **New integration**
15
+ - Give it a name (e.g., "reeboot-agent")
16
+ - Select the workspace
17
+ - Copy the **Internal Integration Token** (starts with `secret_`)
18
+
19
+ 2. Set the environment variable:
20
+ ```
21
+ export NOTION_API_KEY=secret_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
22
+ ```
23
+ Add to your shell profile (`~/.zshrc` or `~/.bashrc`) for persistence.
24
+
25
+ 3. Share pages/databases with the integration:
26
+ - Open any Notion page you want the agent to access
27
+ - Click **Share** (top right) → **Invite** → search for your integration name → **Invite**
28
+
29
+ 4. Verify:
30
+ ```
31
+ curl -H "Authorization: Bearer $NOTION_API_KEY" \
32
+ -H "Notion-Version: 2022-06-28" \
33
+ https://api.notion.com/v1/users/me
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ```bash
39
+ # Search across workspace
40
+ curl -X POST \
41
+ -H "Authorization: Bearer $NOTION_API_KEY" \
42
+ -H "Notion-Version: 2022-06-28" \
43
+ -H "Content-Type: application/json" \
44
+ https://api.notion.com/v1/search \
45
+ -d '{"query": "project roadmap", "filter": {"value": "page", "property": "object"}}'
46
+
47
+ # List databases
48
+ curl -X POST \
49
+ -H "Authorization: Bearer $NOTION_API_KEY" \
50
+ -H "Notion-Version: 2022-06-28" \
51
+ -H "Content-Type: application/json" \
52
+ https://api.notion.com/v1/search \
53
+ -d '{"filter": {"value": "database", "property": "object"}}'
54
+
55
+ # Query a database
56
+ curl -X POST \
57
+ -H "Authorization: Bearer $NOTION_API_KEY" \
58
+ -H "Notion-Version: 2022-06-28" \
59
+ -H "Content-Type: application/json" \
60
+ "https://api.notion.com/v1/databases/<database_id>/query" \
61
+ -d '{"filter": {"property": "Status", "select": {"equals": "In Progress"}}}'
62
+
63
+ # Get a page
64
+ curl -H "Authorization: Bearer $NOTION_API_KEY" \
65
+ -H "Notion-Version: 2022-06-28" \
66
+ "https://api.notion.com/v1/pages/<page_id>"
67
+
68
+ # Get page blocks (content)
69
+ curl -H "Authorization: Bearer $NOTION_API_KEY" \
70
+ -H "Notion-Version: 2022-06-28" \
71
+ "https://api.notion.com/v1/blocks/<page_id>/children"
72
+
73
+ # Create a page
74
+ curl -X POST \
75
+ -H "Authorization: Bearer $NOTION_API_KEY" \
76
+ -H "Notion-Version: 2022-06-28" \
77
+ -H "Content-Type: application/json" \
78
+ https://api.notion.com/v1/pages \
79
+ -d '{
80
+ "parent": {"database_id": "<database_id>"},
81
+ "properties": {
82
+ "Name": {"title": [{"text": {"content": "New page"}}]}
83
+ }
84
+ }'
85
+ ```
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: postgres
3
+ description: PostgreSQL database operations via psql CLI and DATABASE_URL — run queries, inspect schemas, insert data, manage tables. Use when working with a PostgreSQL database.
4
+ ---
5
+
6
+ # PostgreSQL
7
+
8
+ Wraps the `psql` CLI for PostgreSQL database operations. Connects via the `DATABASE_URL` environment variable.
9
+
10
+ ## Setup
11
+
12
+ 1. Install psql:
13
+ ```
14
+ brew install postgresql # macOS (installs psql client only)
15
+ # or on Ubuntu/Debian: apt-get install postgresql-client
16
+ ```
17
+
18
+ 2. Set the `DATABASE_URL` environment variable:
19
+ ```
20
+ export DATABASE_URL=postgresql://user:password@host:5432/dbname
21
+ ```
22
+ Examples:
23
+ ```
24
+ export DATABASE_URL=postgresql://postgres:secret@localhost:5432/myapp
25
+ export DATABASE_URL=postgresql://myuser:mypass@db.example.com:5432/production
26
+ ```
27
+ Add to your shell profile for persistence.
28
+
29
+ 3. Verify connection:
30
+ ```
31
+ psql "$DATABASE_URL" -c "SELECT version();"
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ```bash
37
+ # Run a query
38
+ psql "$DATABASE_URL" -c "SELECT * FROM users LIMIT 10;"
39
+
40
+ # Inspect tables
41
+ psql "$DATABASE_URL" -c "\dt"
42
+
43
+ # Describe a table schema
44
+ psql "$DATABASE_URL" -c "\d users"
45
+
46
+ # Count rows
47
+ psql "$DATABASE_URL" -c "SELECT COUNT(*) FROM orders WHERE status = 'pending';"
48
+
49
+ # Insert data
50
+ psql "$DATABASE_URL" -c "INSERT INTO logs (message, created_at) VALUES ('test', NOW());"
51
+
52
+ # Update data
53
+ psql "$DATABASE_URL" -c "UPDATE users SET active = true WHERE email = 'user@example.com';"
54
+
55
+ # Run a SQL file
56
+ psql "$DATABASE_URL" -f /path/to/migration.sql
57
+
58
+ # Interactive mode (use with caution)
59
+ psql "$DATABASE_URL"
60
+
61
+ # Export query result to CSV
62
+ psql "$DATABASE_URL" -c "COPY (SELECT * FROM users) TO STDOUT WITH CSV HEADER" > users.csv
63
+
64
+ # List databases
65
+ psql "$DATABASE_URL" -c "\l"
66
+
67
+ # Check active connections
68
+ psql "$DATABASE_URL" -c "SELECT pid, usename, application_name, state FROM pg_stat_activity;"
69
+ ```
70
+
71
+ ### Tips
72
+
73
+ - Always `LIMIT` queries on large tables to avoid returning millions of rows
74
+ - Use `-t` flag for tuple-only output (no headers) when parsing output programmatically
75
+ - Use `--no-password` with `DATABASE_URL` to avoid password prompts