Skip to content

Commit 19c5656

Browse files
committed
feat(ext): 发布 1.3.0 版本并优化交互体验
- 新增状态栏 `✨ WTF` 快捷按钮,支持一键生成提交信息。 - 新增首次安装引导,提示用户配置 API Key。 - 移除快捷键焦点限制,支持在全局(包括源代码管理面板)触发。 - 升级 `@types/node` 至 18.x,增强 ESLint 类型感知检查规则。 - 优化 `.vscodeignore` 以减小插件安装包体积。
1 parent c733fc8 commit 19c5656

14 files changed

Lines changed: 155 additions & 59 deletions

.vscodeignore

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
.vscode/**
2-
.vscode-test/**
1+
# Source & config (not needed at runtime)
32
src/**
4-
.gitignore
5-
.yarnrc
6-
vsc-extension-quickstart.md
3+
**/*.ts
4+
**/*.map
75
**/tsconfig.json
86
**/eslint.config.mjs
9-
**/*.map
10-
**/*.ts
117
**/.vscode-test.*
128

13-
# Environment files (contains sensitive data)
9+
# VS Code development
10+
.vscode/**
11+
.vscode-test/**
12+
13+
# Environment files
1414
.env
1515
.env.local
16+
.env.example
1617

1718
# Development files
18-
.vsix
19+
*.vsix
1920
npm-debug.log*
2021
yarn-debug.log*
2122
yarn-error.log*
@@ -27,6 +28,14 @@ pnpm-lock.yaml
2728
package-lock.json
2829
yarn.lock
2930

30-
# Documentation & Process
31+
# Documentation & process (not needed in VSIX)
3132
UPDATEFLOW.md
33+
.DS_Store
34+
.git/**
35+
.gitignore
36+
37+
# Test output
3238
out/test/**
39+
40+
# Asset drafts
41+
assets/icon-drafts/**

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ All notable changes to the "wtf-commit" extension will be documented in this fil
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.3.0] - 2025-05-15
9+
### Added
10+
- **Status Bar Button**: A persistent `$(sparkle) WTF` button in the status bar for one-click commit message generation — no need to remember the shortcut.
11+
- **First-Use Guidance**: New users are greeted with a welcome notification prompting them to set up an API key, instead of discovering the requirement only after triggering generation.
12+
13+
### Changed
14+
- **Keybinding Always Available**: Removed the `editorTextFocus` restriction from `Cmd+Alt+G` / `Ctrl+Alt+G`. The shortcut now works from anywhere — including the Source Control panel.
15+
- **Node Types Upgraded**: `@types/node` upgraded from `16.x` to `18.x`, matching the VS Code extension host runtime.
16+
- **Stronger ESLint Rules**: Added `no-explicit-any`, `no-unused-vars`, `consistent-type-imports`, `prefer-const`, `no-console`, and `no-duplicate-imports` rules with type-aware linting.
17+
- **Cleaner VSIX Package**: `.vscodeignore` now explicitly excludes `.env.example`, `.DS_Store`, `.git/`, and `assets/icon-drafts/`.
18+
819
## [1.2.1] - 2025-05-15
920
### Changed
1021
- **Temperature Default**: Changed default temperature from `0.7` to `1.0`, aligning with recommendations from Gemini, DeepSeek, and other modern model providers.

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ Links: [GitHub](https://github.com/codertesla/wtf-commit) | [Open VSX](https://o
1111

1212
WTF Commit is a minimalist VS Code extension that uses AI to generate concise and meaningful Git commit messages from your staged changes (or working tree changes).
1313

14-
## 🆕 Latest (v1.2.1)
14+
## 🆕 Latest (v1.3.0)
1515

16-
- **Temperature Default → 1.0**: Aligns with recommendations from Gemini, DeepSeek, and other modern providers.
17-
- **Removed MiniMax**: Removed from built-in providers. Use Custom provider if needed.
18-
- **Automatic Retry**: Transient failures (network, 5xx, timeout) now retry up to 2 times with backoff.
19-
- **Better Error Messages**: Missing config for Custom provider now shows actionable guidance.
16+
- **Status Bar Button**: Persistent `✨ WTF` button in the status bar — one click to generate.
17+
- **First-Use Guidance**: Welcome notification guides new users to set up an API key on first install.
18+
- **Keybinding Always Available**: `Cmd+Alt+G` / `Ctrl+Alt+G` now works from anywhere, including the Source Control panel.
19+
- **Stronger Linting**: Type-aware ESLint with `consistent-type-imports`, `no-explicit-any`, `prefer-const`, and more.
20+
- **Node 18 Types**: Upgraded `@types/node` to match the VS Code extension host runtime.
2021

2122
## 🚀 Features
2223

README_zh.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111

1212
WTF Commit 是一款简约的 VS Code 扩展,利用 AI 根据您暂存的更改(或工作区更改)生成简洁且有意义的 Git 提交信息。
1313

14-
## 🆕 最新更新(v1.2.1
14+
## 🆕 最新更新(v1.3.0
1515

16-
- **Temperature 默认值 → 1.0**:与 Gemini、DeepSeek 等主流模型推荐值对齐。
17-
- **移除 MiniMax**:从内置服务商列表中移除,如需使用可通过 Custom 自定义。
18-
- **自动重试**:网络错误和瞬时 API 故障(5xx、超时)现在会自动重试最多 2 次,减少偶发失败。
19-
- **更友好的错误提示**:Custom 服务商缺少配置时,现在会给出具体的设置路径引导。
16+
- **状态栏按钮**:新增常驻 `✨ WTF` 状态栏按钮,点击即可生成,无需记忆快捷键。
17+
- **首次使用引导**:新用户首次安装后会收到欢迎通知,引导设置 API Key。
18+
- **快捷键全局可用**`Cmd+Alt+G` / `Ctrl+Alt+G` 不再限制于编辑器焦点,在 Source Control 面板等任何位置均可触发。
19+
- **更强的代码规范**:ESLint 新增 `consistent-type-imports``no-explicit-any``prefer-const` 等类型感知规则。
20+
- **Node 18 类型**`@types/node` 升级至 18.x,与 VS Code 扩展宿主运行时对齐。
2021

2122
## 功能特性
2223

eslint.config.mjs

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,50 @@
11
import typescriptEslint from "typescript-eslint";
22

3-
export default [{
3+
export default [
4+
{
45
files: ["**/*.ts"],
5-
}, {
6+
ignores: ["**/test/**"],
7+
},
8+
{
69
plugins: {
7-
"@typescript-eslint": typescriptEslint.plugin,
10+
"@typescript-eslint": typescriptEslint.plugin,
811
},
912

1013
languageOptions: {
11-
parser: typescriptEslint.parser,
12-
ecmaVersion: 2022,
13-
sourceType: "module",
14+
parser: typescriptEslint.parser,
15+
ecmaVersion: 2022,
16+
sourceType: "module",
17+
parserOptions: {
18+
projectService: true,
19+
},
1420
},
1521

1622
rules: {
17-
"@typescript-eslint/naming-convention": ["warn", {
18-
selector: "import",
19-
format: ["camelCase", "PascalCase"],
20-
}],
23+
// Naming
24+
"@typescript-eslint/naming-convention": ["warn", {
25+
selector: "import",
26+
format: ["camelCase", "PascalCase"],
27+
}],
2128

22-
curly: "warn",
23-
eqeqeq: "warn",
24-
"no-throw-literal": "warn",
25-
semi: "warn",
29+
// Type safety
30+
"@typescript-eslint/no-explicit-any": "warn",
31+
"@typescript-eslint/no-unused-vars": ["warn", {
32+
argsIgnorePattern: "^_",
33+
varsIgnorePattern: "^_",
34+
}],
35+
"@typescript-eslint/consistent-type-imports": ["warn", {
36+
prefer: "type-imports",
37+
fixStyle: "inline-type-imports",
38+
}],
39+
40+
// Code quality
41+
curly: "warn",
42+
eqeqeq: "warn",
43+
"no-throw-literal": "warn",
44+
semi: "warn",
45+
"prefer-const": "warn",
46+
"no-console": "warn",
47+
"no-duplicate-imports": "warn",
2648
},
27-
}];
49+
},
50+
];

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "wtf-commit",
33
"displayName": "WTF Commit",
44
"description": "AI-powered Git commit message generator",
5-
"version": "1.2.1",
5+
"version": "1.3.0",
66
"license": "MIT",
77
"publisher": "codertesla",
88
"icon": "icon.png",
@@ -47,8 +47,7 @@
4747
{
4848
"command": "wtf-commit.generate",
4949
"key": "ctrl+alt+g",
50-
"mac": "cmd+alt+g",
51-
"when": "editorTextFocus"
50+
"mac": "cmd+alt+g"
5251
}
5352
],
5453
"configuration": {
@@ -136,7 +135,7 @@
136135
},
137136
"wtfCommit.temperature": {
138137
"type": "number",
139-
"default": 1.0,
138+
"default": 1,
140139
"minimum": 0,
141140
"maximum": 2,
142141
"description": "Temperature for AI generation. Lower values produce more deterministic results.",
@@ -164,7 +163,7 @@
164163
},
165164
"devDependencies": {
166165
"@types/mocha": "^10.0.10",
167-
"@types/node": "16.x",
166+
"@types/node": "~18.19.130",
168167
"@types/vscode": "^1.70.0",
169168
"@vscode/test-cli": "^0.0.12",
170169
"@vscode/test-electron": "^2.5.2",

pnpm-lock.yaml

Lines changed: 13 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as vscode from 'vscode';
22
import {
3-
ExtensionConfig,
4-
ProviderName,
3+
type ExtensionConfig,
4+
type ProviderName,
55
PROVIDER_NAMES,
66
PROVIDERS,
77
DEFAULT_PROVIDER,
@@ -19,12 +19,12 @@ export function readExtensionConfig(): ExtensionConfig {
1919

2020
// 1. Try to read provider-specific overrides
2121
const overrides = config.get<Record<string, { baseUrl?: string; model?: string }>>('providerOverrides') || {};
22-
let providerBaseUrl = overrides[provider]?.baseUrl?.trim() || config.get<string>(`${provider}.baseUrl`)?.trim();
23-
let providerModel = overrides[provider]?.model?.trim() || config.get<string>(`${provider}.model`)?.trim();
22+
const providerBaseUrl = overrides[provider]?.baseUrl?.trim() || config.get<string>(`${provider}.baseUrl`)?.trim();
23+
const providerModel = overrides[provider]?.model?.trim() || config.get<string>(`${provider}.model`)?.trim();
2424

2525
// 2. Try to read global overrides
26-
let globalBaseUrl = config.get<string>('baseUrl')?.trim();
27-
let globalModel = config.get<string>('model')?.trim();
26+
const globalBaseUrl = config.get<string>('baseUrl')?.trim();
27+
const globalModel = config.get<string>('model')?.trim();
2828

2929
let baseUrl = providerBaseUrl || globalBaseUrl || '';
3030
let model = providerModel || globalModel || '';

src/diff.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as vscode from 'vscode';
22
import * as path from 'path';
33
import {
4-
Repository,
5-
RepositoryState,
6-
Change,
4+
type Repository,
5+
type RepositoryState,
6+
type Change,
77
GitStatus,
88
MAX_DIFF_CHARS,
99
MAX_DIFF_FILE_CHARS,

src/extension.ts

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { promisify } from 'node:util';
33
import * as vscode from 'vscode';
44
import {
55
PROVIDER_NAMES,
6-
ProviderName,
6+
type ProviderName,
77
RequestFailure,
88
DEFAULT_TIMEOUT_MS,
99
type Repository,
@@ -33,10 +33,23 @@ export function activate(context: vscode.ExtensionContext) {
3333

3434
logInfo('Extension activated');
3535

36+
// Status bar button for quick access
37+
const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 100);
38+
statusBarItem.command = 'wtf-commit.generate';
39+
statusBarItem.text = '$(sparkle) WTF';
40+
statusBarItem.tooltip = 'WTF Commit: Generate commit message';
41+
statusBarItem.show();
42+
context.subscriptions.push(statusBarItem);
43+
3644
checkChangelog(context).catch((error) => {
3745
logError('Failed to check changelog', error);
3846
});
3947

48+
// First-use guidance: prompt to set API key if none configured
49+
checkFirstUseGuidance(context).catch((error) => {
50+
logError('Failed to check first-use guidance', error);
51+
});
52+
4053
const setApiKeyDisposable = vscode.commands.registerCommand('wtf-commit.setApiKey', async () => {
4154
await runSetApiKey(context);
4255
});
@@ -452,3 +465,34 @@ async function checkChangelog(context: vscode.ExtensionContext): Promise<void> {
452465

453466
await context.globalState.update('wtfCommit.lastVersion', currentVersion);
454467
}
468+
469+
async function checkFirstUseGuidance(context: vscode.ExtensionContext): Promise<void> {
470+
const dismissed = context.globalState.get<boolean>('wtfCommit.guidanceDismissed');
471+
if (dismissed) {
472+
return;
473+
}
474+
475+
// Check if any provider has an API key configured
476+
const hasAnyKey = await Promise.all(
477+
PROVIDER_NAMES.map((name) => context.secrets.get(getSecretKeyName(name)))
478+
).then((keys) => keys.some(Boolean));
479+
480+
if (hasAnyKey) {
481+
// User already has at least one key — no guidance needed
482+
await context.globalState.update('wtfCommit.guidanceDismissed', true);
483+
return;
484+
}
485+
486+
const action = await vscode.window.showInformationMessage(
487+
'Welcome to WTF Commit! Set up an API key to start generating commit messages with AI.',
488+
'Set API Key',
489+
'Dismiss'
490+
);
491+
492+
if (action === 'Set API Key') {
493+
void vscode.commands.executeCommand('wtf-commit.setApiKey');
494+
}
495+
496+
// Don't show again regardless of choice
497+
await context.globalState.update('wtfCommit.guidanceDismissed', true);
498+
}

0 commit comments

Comments
 (0)