From 1e9d22ffb3c926abaf95580b5d87578c09c0d9e4 Mon Sep 17 00:00:00 2001 From: yangmanqing Date: Fri, 13 Feb 2026 17:38:18 +0800 Subject: [PATCH 1/2] ci: add GitHub Actions workflows for CI and release pipelines --- .github/workflows/ci.yml | 26 +++++++++++++++++++++++ .github/workflows/release.yml | 40 +++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fb1d2e4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: CI + +on: + push: + branches: [main, dev] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - run: npm ci + + - name: Lint + run: npm run lint + + - name: Compile + run: npm run compile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5b08703 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +name: Release + +on: + push: + tags: ["v*"] + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - run: npm ci + + - name: Lint + run: npm run lint + + - name: Compile + run: npm run compile + + - name: Package extension + run: npx @vscode/vsce package -o lorebyte.vsix + + - name: Publish to VS Code Marketplace + run: npx @vscode/vsce publish + env: + VSCE_PAT: ${{ secrets.VSCE_PAT }} + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: lorebyte.vsix + generate_release_notes: true From 22733e5a8fcb3b936778e6fb23ef2c28cabccd52 Mon Sep 17 00:00:00 2001 From: yangmanqing Date: Fri, 13 Feb 2026 17:48:50 +0800 Subject: [PATCH 2/2] feat: fetch available models from API instead of hardcoded list --- .github/workflows/release.yml | 5 +++++ package.json | 4 ++-- src/commands/listModels.ts | 19 +++++++++++++------ src/config/configuration.ts | 2 +- src/providers/openCodeZenProvider.ts | 10 ---------- src/providers/types.ts | 2 +- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5b08703..20a228f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,6 +17,11 @@ jobs: node-version: 20 cache: npm + - name: Sync version from tag + run: | + TAG_VERSION="${GITHUB_REF_NAME#v}" + npm version "$TAG_VERSION" --no-git-tag-version + - run: npm ci - name: Lint diff --git a/package.json b/package.json index 30d21a6..203863a 100644 --- a/package.json +++ b/package.json @@ -56,8 +56,8 @@ }, "lorebyte.model": { "type": "string", - "default": "kimi-k2.5-free", - "description": "Model ID to use for generating commit messages" + "default": "minimax-m2.5-free", + "description": "Model ID to use for generating commit messages. Use 'Lorebyte: List Available Models' command to browse and select." }, "lorebyte.apiKey": { "type": "string", diff --git a/src/commands/listModels.ts b/src/commands/listModels.ts index 1311322..65a848f 100644 --- a/src/commands/listModels.ts +++ b/src/commands/listModels.ts @@ -1,19 +1,22 @@ import * as vscode from "vscode"; import { providerRegistry } from "../providers/providerRegistry"; -import { OpenCodeZenProvider } from "../providers/openCodeZenProvider"; import { getConfig } from "../config/configuration"; export async function listModels(): Promise { const config = getConfig(); const provider = providerRegistry.get(config.provider); - if (!(provider instanceof OpenCodeZenProvider)) { - vscode.window.showErrorMessage("Lorebyte: Current provider does not support listing models."); + if (!provider) { + vscode.window.showErrorMessage( + `Lorebyte: Unknown provider "${config.provider}".` + ); return; } if (!config.apiKey) { - vscode.window.showErrorMessage("Lorebyte: API key is required to list models."); + vscode.window.showErrorMessage( + "Lorebyte: API key is required to list models." + ); return; } @@ -27,7 +30,9 @@ export async function listModels(): Promise { ); if (models.length === 0) { - vscode.window.showWarningMessage("Lorebyte: No models returned from API."); + vscode.window.showWarningMessage( + "Lorebyte: No models returned from API." + ); return; } @@ -39,7 +44,9 @@ export async function listModels(): Promise { await vscode.workspace .getConfiguration("lorebyte") .update("model", picked, vscode.ConfigurationTarget.Global); - vscode.window.showInformationMessage(`Lorebyte: Model set to "${picked}"`); + vscode.window.showInformationMessage( + `Lorebyte: Model set to "${picked}"` + ); } } catch (err) { vscode.window.showErrorMessage( diff --git a/src/config/configuration.ts b/src/config/configuration.ts index 7f491d9..a36854f 100644 --- a/src/config/configuration.ts +++ b/src/config/configuration.ts @@ -12,7 +12,7 @@ export function getConfig(): LorebyteConfig { const cfg = vscode.workspace.getConfiguration("lorebyte"); return { provider: cfg.get("provider", "opencode-zen"), - model: cfg.get("model", "kimi-k2.5-free"), + model: cfg.get("model", "minimax-m2.5-free"), apiKey: cfg.get("apiKey", ""), apiBaseUrl: cfg.get( "apiBaseUrl", diff --git a/src/providers/openCodeZenProvider.ts b/src/providers/openCodeZenProvider.ts index e4aaf5a..36d04aa 100644 --- a/src/providers/openCodeZenProvider.ts +++ b/src/providers/openCodeZenProvider.ts @@ -54,16 +54,6 @@ export class OpenCodeZenProvider implements LLMProvider { readonly id = "opencode-zen"; readonly displayName = "OpenCode Zen"; - getModels(): string[] { - return [ - "kimi-k2.5-free", - "kimi-k2.5", - "gpt-5.2-codex", - "gpt-5.1-codex", - "minimax-m2.5-free", - ]; - } - validateConfig(apiKey: string, baseUrl: string): string | undefined { if (!apiKey) { return "API key is required. Set it in Settings → Lorebyte → Api Key."; diff --git a/src/providers/types.ts b/src/providers/types.ts index 966a8a4..6b2e819 100644 --- a/src/providers/types.ts +++ b/src/providers/types.ts @@ -23,11 +23,11 @@ export interface ChatCompletionResponse { export interface LLMProvider { readonly id: string; readonly displayName: string; - getModels(): string[]; chatCompletion( options: ChatCompletionOptions, apiKey: string, baseUrl: string ): Promise; + fetchRemoteModels(apiKey: string, baseUrl: string): Promise; validateConfig(apiKey: string, baseUrl: string): string | undefined; }