Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .github/workflows/publish-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Publish Nightly Extension

permissions:
contents: read

on:
push:
branches:
- main
workflow_dispatch:

concurrency:
group: publish-nightly
cancel-in-progress: true

jobs:
publish-nightly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run vscode:prepublish

- name: Compute nightly version
id: nightly_version
run: |
NIGHTLY_VERSION=$(node -e "const [maj,min] = require('./package.json').version.split('.').map(Number); const nightlyMinor = min % 2 === 0 ? min + 1 : min; process.stdout.write(`${maj}.${nightlyMinor}.${process.env.GITHUB_RUN_NUMBER}`)")
echo "VERSION=$NIGHTLY_VERSION" >> $GITHUB_OUTPUT
echo "Using nightly version: $NIGHTLY_VERSION"

- name: Prepare nightly manifests
env:
NIGHTLY_VERSION: ${{ steps.nightly_version.outputs.VERSION }}
OPENVSX_NIGHTLY_NAME: postgres-explorer-nightly
run: node ./scripts/prepare-nightly-manifests.js

- name: Package VS Code Marketplace nightly
id: package_marketplace
run: |
cp package.json package.json.bak
cp .nightly/package.marketplace.json package.json
VSIX_FILE=$(node -e "const pkg=require('./package.json'); process.stdout.write(`${pkg.name}-${pkg.version}.vsix`)")
npx @vscode/vsce package --pre-release
mv package.json.bak package.json
echo "VSIX_FILE=$VSIX_FILE" >> $GITHUB_OUTPUT

- name: Publish VS Code Marketplace nightly (pre-release)
run: |
npx @vscode/vsce publish \
--pre-release \
--packagePath ${{ steps.package_marketplace.outputs.VSIX_FILE }} \
-p ${{ secrets.VSCE_PAT }}

- name: Package Open VSX nightly companion
id: package_openvsx
run: |
cp package.json package.json.bak
cp .nightly/package.openvsx.json package.json
VSIX_FILE=$(node -e "const pkg=require('./package.json'); process.stdout.write(`${pkg.name}-${pkg.version}.vsix`)")
npx @vscode/vsce package
mv package.json.bak package.json
echo "VSIX_FILE=$VSIX_FILE" >> $GITHUB_OUTPUT

- name: Publish Open VSX nightly companion
run: |
npx ovsx publish \
${{ steps.package_openvsx.outputs.VSIX_FILE }} \
-p ${{ secrets.OVSX_PAT }}

- name: Upload nightly artifacts
uses: actions/upload-artifact@v4
with:
name: nightly-vsix
path: "*.vsix"
retention-days: 30
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ jobs:
echo "Package.json version: $PKG_VERSION"

if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "::warning::Tag version ($TAG_VERSION) doesn't match package.json version ($PKG_VERSION)"
echo "::error::Tag version ($TAG_VERSION) doesn't match package.json version ($PKG_VERSION)"
exit 1
fi

# Set VSIX filename
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ test_*
mock_ai_server.js
*.pgpass
src/test/unit/PgPassSupport.test.ts
.kiro/
.nightly/
CLAUDE.md
.claude/
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,64 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

---

## [0.9.5] - 2026-04-09

### Added
- **Image support in SQL Assistant**: Paste images directly from clipboard or upload via the new image button (🖼) in the chat input. Images render as fixed 56×56px thumbnails in a dedicated preview strip above the textarea.
- **Image lightbox**: Click any image thumbnail (in the input strip or in message history) to open a full-size overlay preview.
- **Vision AI support**: Images are now properly sent to AI providers that support vision — OpenAI/custom as `image_url` parts, Anthropic as `base64` image blocks, Gemini as `inline_data` parts, and VS Code LM via `LanguageModelImagePart`.
- **File preview from chat**: Clicking an attached file chip (in the input area or in message history) opens the file as a preview tab in the VS Code editor. Works for files attached via the file picker, "Send to Chat", and "Analyze Data" buttons.
- **GitHub Models account sign-in**: Added first-class GitHub Models provider support using VS Code GitHub authentication sessions, including model listing and connection checks from AI Settings.

### Changed
- **GitHub auth UX**: GitHub provider connection now uses the standard VS Code GitHub sign-in flow in AI Settings, with provider state reflected in the UI.
- **Nightly release channel**: Nightly builds are now available as pre-release updates, including a dedicated Open VSX nightly companion package for early access testing.

### Fixed
- **Image CSP**: Added `img-src data: blob:` to the webview Content Security Policy so image thumbnails actually render (previously blocked by `default-src 'none'`).
- **File path missing on attach**: Files picked via the attachment button now include their filesystem path, enabling click-to-preview.
- **Open VSX GitHub auth fallback**: Removed invalid OAuth scope requests for GitHub session auth to prevent users from being redirected to PAT-only fallback prompts.

---

## [0.9.2] - 2026-04-07

### Added
- **Local AI model support**: New **Ollama** and **LM Studio** providers connect to locally-running models at their default endpoints (`http://localhost:11434` and `http://localhost:1234`). No API key required.
- **Nightly build pipeline**: Automated GitHub Actions workflow publishes pre-release builds to VS Code Marketplace and Open VSX on every push to `main`. Nightly versions use odd minor numbers (e.g., `0.9.1.{run}`).
- **AI response timing**: Chat responses now display elapsed time alongside token usage for quick performance feedback.
- **Code snippet execution**: Suggestion bubbles in chat can now run code snippets directly via a new `runSnippet()` action.

### Changed
- **Connection edit flow**: Editing a connection now opens `ConnectionFormPanel` directly instead of dispatching a command, making the flow more reliable.
- **Connection card styling**: Environment-specific accent colors (green for DEV, orange for STAGING, red for PROD) applied consistently across connection cards.
- **Chat input focus**: `sendSuggestion()` now properly focuses the input and positions the cursor after inserting a suggestion.
- **Publish workflow**: Version mismatch between the git tag and `package.json` now fails the build instead of emitting a warning.

### Fixed
- **Inline code rendering**: Fixed markdown rendering of inline code in chat responses (resolves display issues with meta-notation like `(u, o)`).
- **SVG icon sizing**: Code block action buttons now have explicit `width`/`height` attributes, preventing layout inconsistencies across themes.

### Removed
- **Tree filter commands**: `postgres-explorer.filterTree` and `postgres-explorer.clearFilter` removed from activation — these experimental commands were unused.

---

## [0.9.0] - 2026-04-06

### Added
- **Anthropic model discovery**: AI Settings now lists Anthropic models from the official `/v1/models` API instead of a fixed local list.
- **Guided chat responses**: Assistant replies can now include numbered follow-up questions, optional next-step suggestion bubbles, and contextual quote-style factoids or jokes when they genuinely fit.

### Changed
- **AI key lookup**: Direct AI provider keys now resolve from `SecretStorage` first, fixing false “API key required” errors when the key is already saved.
- **Chat identity and styling**: Assistant messages are labeled **PG Studio Bot**, with improved assistant bubble contrast and quote styling for richer responses.
- **Composer UX**: The chat input and suggestion bubbles were tightened for readability, capped to a compact height, and styled to avoid carrying stale next-step actions between chats.

### Fixed
- **Follow-up selection**: Typing a number now resolves to the corresponding numbered follow-up question from the previous assistant message, instead of being treated as a fresh prompt.
- **Next-step carry-over**: Next-step bubbles are hidden when a new follow-up is sent or when switching chats, so actions remain specific to the active conversation.

## [0.8.8] - 2026-03-21

### Added
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2025 Richie Varghese <ric-v@astrx.dev>
Copyright (c) 2026 Richie Varghese <ric-v@astrx.dev>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 7 additions & 6 deletions MARKETPLACE.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
| 🔍 **EXPLAIN CodeLens** | One-click EXPLAIN/ANALYZE with results in notebooks |
| 🛡️ **Auto-LIMIT** | Automatic query protection with configurable row limits (default 1000) |
| 🌍 **Foreign Data Wrappers** | Manage foreign servers, user mappings, and tables |
| 🤖 **AI-Powered** | GitHub Copilot, OpenAI, Anthropic, and Google Gemini integration |
| 🤖 **AI-Powered** | GitHub Copilot, GitHub Models, OpenAI, Anthropic, and Google Gemini integration |
| ⌨️ **Developer Tools** | IntelliSense, keyboard shortcuts, PSQL terminal access |
| 📤 **Export Data** | Export query results to CSV, JSON, or Excel formats |

Expand Down Expand Up @@ -160,6 +160,7 @@ PgStudio provides a **Safe Execution Model** for AI interactions.

**Supported AI Providers:**
- GitHub Copilot (VS Code LM)
- GitHub Models (GitHub account sign-in)
- OpenAI
- Anthropic Claude
- Google Gemini
Expand Down Expand Up @@ -229,16 +230,16 @@ code --install-extension ric-v.postgres-explorer

## 📚 Resources

- 📖 [Full Documentation](https://dev-asterix.github.io/yape/)
- 🐛 [Report Issues](https://github.com/dev-asterix/yape/issues)
- 💡 [Request Features](https://github.com/dev-asterix/yape/issues/new?template=feature_request.md)
- ⭐ [Star on GitHub](https://github.com/dev-asterix/yape)
- 📖 [Full Documentation](https://pgstudio.astrx.dev/)
- 🐛 [Report Issues](https://github.com/dev-asterix/PgStudio/issues)
- 💡 [Request Features](https://github.com/dev-asterix/PgStudio/issues/new?template=feature_request.md)
- ⭐ [Star on GitHub](https://github.com/dev-asterix/PgStudio)

---

## 📝 License

This extension is licensed under the [MIT License](https://github.com/dev-asterix/yape/blob/main/LICENSE).
This extension is licensed under the [MIT License](https://github.com/dev-asterix/PgStudio/blob/main/LICENSE).

---

Expand Down
40 changes: 39 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
.PHONY: all clean install build package publish publish-ovsx publish-vsx git-tag test test-unit test-integration test-renderer test-all coverage docker-up docker-down
.PHONY: all clean install build package package-nightly publish publish-nightly publish-ovsx publish-vsx git-tag test test-unit test-integration test-renderer test-all coverage docker-up docker-down

# Variables
NODE_BIN := node
NPM_BIN := npm
VSCE_CMD := npx -y @vscode/vsce@2.24.0
OVSX_CMD := npx -y ovsx
OPENVSX_NIGHTLY_NAME ?= postgres-explorer-nightly
# Evaluate once per make invocation to keep package/publish nightly version consistent.
NIGHTLY_RUN_NUMBER := $(shell date +%s)

# Get version and name from package.json using node
EXTENSION_NAME := $(shell $(NODE_BIN) -p "require('./package.json').name")
Expand Down Expand Up @@ -38,6 +41,25 @@ package: build
echo "Restored original README.md"; \
exit $$EXIT_CODE

# Package nightly VSIX artifacts for Marketplace (pre-release) and Open VSX companion
package-nightly: build
@echo "Computing nightly version..."
@NIGHTLY_VERSION=$$($(NODE_BIN) -e "const [maj,min]=require('./package.json').version.split('.').map(Number); const nightlyMinor=min%2===0?min+1:min; const run='$(NIGHTLY_RUN_NUMBER)'; process.stdout.write(maj + '.' + nightlyMinor + '.' + run)"); \
echo "Using nightly version: $$NIGHTLY_VERSION"; \
NIGHTLY_VERSION=$$NIGHTLY_VERSION OPENVSX_NIGHTLY_NAME=$(OPENVSX_NIGHTLY_NAME) $(NODE_BIN) ./scripts/prepare-nightly-manifests.js
@echo "Packaging VS Code Marketplace nightly (pre-release)..."
@cp package.json package.json.bak
@cp .nightly/package.marketplace.json package.json
@$(VSCE_CMD) package --pre-release
@mv package.json.bak package.json
@echo "Packaging Open VSX nightly companion..."
@cp package.json package.json.bak
@cp .nightly/package.openvsx.json package.json
@$(VSCE_CMD) package
@mv package.json.bak package.json
@echo "Nightly packages created:"
@ls -1 *.vsix

# Publish the extension to VS Code Marketplace and Open VSX Registry
publish: package
@echo "Publishing $(VSIX_FILE) to VS Code Marketplace..."
Expand All @@ -50,6 +72,20 @@ publish: package
$(OVSX_CMD) publish $(VSIX_FILE) -p $(shell cat ./pat-open-vsx)
@echo "Successfully published to Open VSX Registry."

# Publish nightly artifacts to both VS Code Marketplace and Open VSX
publish-nightly: package-nightly
@echo "Publishing nightly pre-release to VS Code Marketplace..."
test -f ./pat || (echo "Error: pat file not found. Please create a file named 'pat' containing your Personal Access Token." && exit 1)
@NIGHTLY_VERSION=$$($(NODE_BIN) -e "const [maj,min]=require('./package.json').version.split('.').map(Number); const nightlyMinor=min%2===0?min+1:min; const run='$(NIGHTLY_RUN_NUMBER)'; process.stdout.write(maj + '.' + nightlyMinor + '.' + run)"); \
MARKET_VSIX="$(EXTENSION_NAME)-$$NIGHTLY_VERSION.vsix"; \
$(VSCE_CMD) publish --pre-release --packagePath $$MARKET_VSIX -p $$(cat ./pat)
@echo "Publishing nightly companion to Open VSX..."
test -f ./pat-open-vsx || (echo "Error: pat-open-vsx file not found. Please create a file named 'pat-open-vsx' containing your Open VSX Access Token." && exit 1)
@NIGHTLY_VERSION=$$($(NODE_BIN) -e "const [maj,min]=require('./package.json').version.split('.').map(Number); const nightlyMinor=min%2===0?min+1:min; const run='$(NIGHTLY_RUN_NUMBER)'; process.stdout.write(maj + '.' + nightlyMinor + '.' + run)"); \
OPENVSX_VSIX="$(OPENVSX_NIGHTLY_NAME)-$$NIGHTLY_VERSION.vsix"; \
$(OVSX_CMD) publish $$OPENVSX_VSIX -p $$(cat ./pat-open-vsx)
@echo "Successfully published nightly builds to both registries."

# Publish the extension to VS Code Marketplace only
publish-vsx: package
@echo "Publishing $(VSIX_FILE) to VS Code Marketplace..."
Expand Down Expand Up @@ -138,7 +174,9 @@ help:
@echo " install : Install dependencies"
@echo " build : Build the extension"
@echo " package : Create VSIX package"
@echo " package-nightly : Create nightly VSIX packages (Marketplace pre-release + Open VSX companion)"
@echo " publish : Publish to BOTH VS Code Marketplace and Open VSX"
@echo " publish-nightly : Publish nightly builds to BOTH VS Code Marketplace and Open VSX"
@echo " publish-vsx : Publish to VS Code Marketplace only"
@echo " publish-ovsx : Publish to Open VSX Registry only"
@echo " git-tag : Interactive version bump, commit, tag, and push"
Expand Down
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
- 🔍 **EXPLAIN CodeLens** — One-click query analysis directly in notebooks
- 🛡️ **Auto-LIMIT** — Intelligent query protection (configurable, default 1000 rows)
- 🌍 **Foreign Data Wrappers** — Manage foreign servers, user mappings & tables
- 🤖 **AI-Powered** — Generate, Optimize, Explain & Analyze (OpenAI, Anthropic, Gemini)
- 🤖 **AI-Powered** — Generate, Optimize, Explain & Analyze with guided follow-ups and next-step suggestions (GitHub Models, OpenAI, Anthropic, Gemini, VS Code LM)
- 🖼️ **Vision AI** — Paste or upload images directly in the SQL Assistant; sent to vision-capable AI providers
- 📎 **File Preview** — Click attached file chips to open them as preview tabs in the editor
- 📤 **Export Data** — Export results to CSV, JSON, or Excel

---
Expand Down Expand Up @@ -130,7 +132,7 @@ Then: **PostgreSQL icon** → **Add Connection** → Enter details → **Connect
- `SECURITY.md` - Security policy and vulnerability reporting guidance
- `CHANGELOG.md` - Release notes and what changed across versions

**v0.8.8 (latest) —** Sidebar puts **Connections** and **SQL Assistant** first; **Saved Queries** and **Query History** start collapsed for fresh view state; **What’s New** is command-palette only. Notebook inline edits use **parameterized SQL inside transactions**. **Table Designer** adds **create-mode column reorder** and improved **SQL preview** styling. Details: `CHANGELOG.md`.
**v0.9.5 (latest) —** SQL Assistant now supports image paste/upload with thumbnail previews, vision AI (OpenAI, Anthropic, Gemini, VS Code LM), click-to-preview for attached files, and GitHub Models sign-in via standard VS Code GitHub auth. Details: `CHANGELOG.md`.

---

Expand Down Expand Up @@ -202,6 +204,12 @@ Organize, manage, and reuse your most important queries with intelligent tagging

PgStudio integrates advanced AI capabilities directly into your workflow, but keeps **YOU** in control.

### 🔐 GitHub Models via GitHub Sign-In
Use GitHub Models without manually managing a PAT in normal VS Code authentication flows.
- **Native Sign-In**: Connect with your GitHub account from AI Settings.
- **Model Catalog Access**: List and select available GitHub-hosted models.
- **Session-Based Auth**: Uses VS Code GitHub authentication sessions instead of storing provider tokens.

### 🪄 Generate Query (Natural Language → SQL)
Describe what you need in plain English (e.g., "Show me top 10 users by order count"), and PgStudio will generate the SQL for you using your schema context.
- **Command Palette**: `AI: Generate Query`
Expand Down Expand Up @@ -401,6 +409,31 @@ npx vsce publish
npx ovsx publish
```

### Stable And Nightly Channels

- Stable releases are published from version tags (`v*`) via `.github/workflows/publish.yml`.
- Nightly releases are published on every merge to `main` via `.github/workflows/publish-nightly.yml`.

VS Code Marketplace channel behavior:

- Stable extension ID: `ric-v.postgres-explorer`
- Nightly is published as a **pre-release** of the same extension ID.
- Users can opt in/out directly from the extension page with:
- `Switch to Pre-Release Version`
- `Switch to Release Version`

Open VSX channel behavior:

- Stable extension ID: `ric-v.postgres-explorer`
- Nightly companion extension ID: `ric-v.postgres-explorer-nightly`
- To opt out of nightly on Open VSX-based editors, uninstall the nightly companion extension and install stable.

Nightly versioning policy:

- Nightly builds use an odd minor stream and CI run number as patch.
- Example format: `0.9.<run_number>`
- This keeps nightly versions monotonically increasing for reliable updates.

---

## 📝 License
Expand Down
2 changes: 1 addition & 1 deletion docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ graph TB

subgraph "External Systems"
PG[(PostgreSQL Database)]
AI[AI Services<br/>OpenAI/Anthropic/Gemini]
AI[AI Services<br/>GitHub Models/OpenAI/Anthropic/Gemini]
end

EXT --> CMD
Expand Down
Loading
Loading