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
11 changes: 11 additions & 0 deletions .github/WORKFLOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ This document describes all the GitHub Actions workflows configured for the Obje
- Reminds contributors to add changesets
- Comments on PRs with changelog preview

### 📦 [publish-vscode-extension.yml](workflows/publish-vscode-extension.yml) ✨ NEW
**Purpose:** Publish VSCode extension to marketplace
**Triggers:** Manual dispatch, Git tags (`vscode-v*.*.*`)
**What it does:**
- Builds the ObjectQL VSCode extension
- Packages the extension as `.vsix` file
- Publishes to VSCode Marketplace (requires VSCE_PAT secret)
- Creates GitHub Release with VSIX artifact
- Supports dry-run mode for testing
- See [PUBLISHING.md](../packages/tools/vscode-objectql/PUBLISHING.md) for detailed instructions

## Code Quality & Security

### 🔒 [codeql.yml](workflows/codeql.yml)
Expand Down
133 changes: 133 additions & 0 deletions .github/workflows/publish-vscode-extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Publish VSCode Extension

on:
workflow_dispatch:
inputs:
version:
description: 'Version to publish (leave empty to use version from package.json)'
required: false
type: string
dry_run:
description: 'Dry run (package only, do not publish)'
required: false
type: boolean
default: false
push:
tags:
- 'vscode-v*.*.*'

permissions:
contents: write
issues: write
pull-requests: write

Comment on lines +21 to +23
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow permissions include 'issues: write' and 'pull-requests: write', but the workflow does not interact with issues or pull requests. These permissions should be removed to follow the principle of least privilege. Only 'contents: write' is needed for creating releases.

Suggested change
issues: write
pull-requests: write

Copilot uses AI. Check for mistakes.
jobs:
publish:
name: Package and Publish VSCode Extension
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout Repository
uses: actions/checkout@v4

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

- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 10
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install Dependencies
run: pnpm install
timeout-minutes: 3

- name: Build Monorepo
run: pnpm run build
timeout-minutes: 5

- name: Build VSCode Extension
working-directory: packages/tools/vscode-objectql
run: pnpm run compile

- name: Update Version (if specified)
if: inputs.version != ''
working-directory: packages/tools/vscode-objectql
run: |
echo "Updating version to ${{ inputs.version }}"
npm version ${{ inputs.version }} --no-git-tag-version

Comment on lines +74 to +76
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version input is not validated before being passed to 'npm version'. If a user provides an invalid version string, the command will fail. Consider adding validation to ensure the version follows semantic versioning format (e.g., X.Y.Z) or is one of the npm version keywords (patch, minor, major, prepatch, preminor, premajor, prerelease).

Suggested change
echo "Updating version to ${{ inputs.version }}"
npm version ${{ inputs.version }} --no-git-tag-version
VERSION="${{ inputs.version }}"
# Allow npm version keywords and semantic version strings (X.Y.Z with optional pre-release/build)
if [[ "$VERSION" == "patch" || "$VERSION" == "minor" || "$VERSION" == "major" || \
"$VERSION" == "prepatch" || "$VERSION" == "preminor" || "$VERSION" == "premajor" || \
"$VERSION" == "prerelease" ]]; then
echo "Updating version using npm keyword: $VERSION"
elif [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then
echo "Updating version to semantic version: $VERSION"
else
echo "::error::Invalid version input '$VERSION'. Expected a semantic version (e.g., 1.2.3) or one of: patch, minor, major, prepatch, preminor, premajor, prerelease."
exit 1
fi
npm version "$VERSION" --no-git-tag-version

Copilot uses AI. Check for mistakes.
- name: Package Extension
working-directory: packages/tools/vscode-objectql
run: |
npx @vscode/vsce package --no-yarn
echo "VSIX_FILE=$(ls *.vsix)" >> $GITHUB_ENV
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'ls *.vsix' to capture the filename can fail if multiple .vsix files exist in the directory. Consider using a more robust approach such as specifying the exact filename based on the package.json name and version, or using 'ls -1 *.vsix | head -n 1' to ensure only one file is captured.

Suggested change
echo "VSIX_FILE=$(ls *.vsix)" >> $GITHUB_ENV
echo "VSIX_FILE=$(ls -1 *.vsix | head -n 1)" >> $GITHUB_ENV

Copilot uses AI. Check for mistakes.

- name: Upload VSIX as Artifact
uses: actions/upload-artifact@v4
with:
name: vscode-objectql-extension
path: packages/tools/vscode-objectql/*.vsix
retention-days: 30

- name: Publish to VSCode Marketplace
if: inputs.dry_run != true
working-directory: packages/tools/vscode-objectql
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: |
if [ -z "$VSCE_PAT" ]; then
echo "::error::VSCE_PAT secret is not set. Cannot publish to marketplace."
exit 1
fi
npx @vscode/vsce publish --no-yarn --pat "$VSCE_PAT"
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The VSCE_PAT secret is properly quoted when passed to the vsce command, which is good for security. However, consider using the environment variable approach instead of passing it via command line argument. The vsce tool automatically reads from the VSCE_PAT environment variable, so you could simplify line 100 to just 'npx @vscode/vsce publish --no-yarn' and rely on the env block on line 94.

Suggested change
npx @vscode/vsce publish --no-yarn --pat "$VSCE_PAT"
npx @vscode/vsce publish --no-yarn

Copilot uses AI. Check for mistakes.

- name: Create GitHub Release
if: inputs.dry_run != true && startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: packages/tools/vscode-objectql/*.vsix
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Summary
run: |
echo "## 🎉 VSCode Extension Build Complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Package Details" >> $GITHUB_STEP_SUMMARY
echo "- **VSIX File:** \`${{ env.VSIX_FILE }}\`" >> $GITHUB_STEP_SUMMARY
echo "- **Dry Run:** ${{ inputs.dry_run }}" >> $GITHUB_STEP_SUMMARY
if [ "${{ inputs.dry_run }}" == "true" ]; then
echo "- **Status:** ✅ Packaged (not published)" >> $GITHUB_STEP_SUMMARY
else
echo "- **Status:** ✅ Published to VSCode Marketplace" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Next Steps" >> $GITHUB_STEP_SUMMARY
if [ "${{ inputs.dry_run }}" == "true" ]; then
echo "- Download the VSIX artifact to test locally" >> $GITHUB_STEP_SUMMARY
echo "- Install in VSCode: Extensions → Install from VSIX" >> $GITHUB_STEP_SUMMARY
else
echo "- Extension is now available in VSCode Marketplace" >> $GITHUB_STEP_SUMMARY
echo "- Search for 'ObjectQL' in VSCode Extensions" >> $GITHUB_STEP_SUMMARY
fi
3 changes: 3 additions & 0 deletions packages/tools/vscode-objectql/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ src/**
.gitignore
.vscodeignore
tsconfig.json
tsconfig.tsbuildinfo
test-workspace/**
node_modules/**
*.vsix
CONTRIBUTING.md
IMPLEMENTATION-SUMMARY.md
21 changes: 21 additions & 0 deletions packages/tools/vscode-objectql/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 ObjectQL Contributors (https://github.com/objectql)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading