mirror of
https://github.com/penpot/penpot.git
synced 2026-10-01 16:26:22 +00:00
Remove the legacy @opencode-ai/plugin import and V1 server export so the local plugin loads under OpenCode V2 without project dependencies. Add a focused smoke test for the V2 export and tool registration, and update the related script memories. AI-assisted-by: space-bunny-free
41 lines
1.1 KiB
Markdown
41 lines
1.1 KiB
Markdown
# Psql
|
|
|
|
`scripts/psql` is a wrapper around `psql` that connects to the Penpot PostgreSQL
|
|
database using environment variables (`PENPOT_DB_HOST`, `PENPOT_DB_USER`,
|
|
`PENPOT_DB_PASSWORD`, `PENPOT_DB_NAME`) with sensible defaults for local
|
|
development.
|
|
|
|
## When to use
|
|
|
|
- Running ad-hoc SQL queries against the Penpot database.
|
|
- Inspecting schema, migrations, or data during development or debugging.
|
|
|
|
## How to use (CLI)
|
|
|
|
```bash
|
|
# Default connection (penpot db, localhost)
|
|
scripts/psql -c "SELECT version();"
|
|
|
|
# Test database
|
|
scripts/psql --test -c "SELECT * FROM migrations;"
|
|
|
|
# Custom host/user/database
|
|
scripts/psql --host myhost --user myuser --db mydb
|
|
```
|
|
|
|
`scripts/psql` must be invoked from the repo root so the path resolves.
|
|
|
|
## Native Tool Available (OpenCode V2)
|
|
|
|
A native OpenCode V2 tool `penpot-psql` is available. It is defined in
|
|
`.opencode/plugins/penpot.js` and registered through `setup()`. The LLM can
|
|
call it directly with:
|
|
- `sql`: SQL command string to execute
|
|
- `test`: Boolean flag to use the `penpot_test` database
|
|
|
|
Example usage by the LLM:
|
|
```
|
|
penpot-psql(sql="SELECT version();")
|
|
penpot-psql(sql="SELECT * FROM migrations;", test=true)
|
|
```
|