Skip to content

Commit 44133fc

Browse files
committed
update
1 parent 1e14385 commit 44133fc

11 files changed

Lines changed: 141 additions & 42 deletions

File tree

INSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ npm run compile
6262

6363
## 注意事项
6464

65-
- 确保已安装Claude CLI(通过npm安装:`npm install -g @anthropic-ai/claude-cli`
65+
- 确保已安装Claude CLI(通过npm安装:`npm install -g @anthropic-ai/claude-code`
6666
- Windows用户建议安装Git Bash以获得更好的体验
6767
- 首次使用需要登录Claude账号

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,25 @@ claude chat -m sonnet -p "hello"
103103
# If you see a reply from Claude, your environment is ready!
104104
```
105105

106+
### ⚠️ Version Compatibility Notice
107+
108+
**Important: Extension Version Compatibility with Claude Code CLI**
109+
110+
| Claude Code CLI Version | Compatible Extension Version |
111+
|------------------------|----------------------------|
112+
| v1.0.48 and above | Use extension v1.4.0+ |
113+
| v1.0.47 and below | Use extension v1.3.4 |
114+
115+
**To check your Claude Code CLI version:**
116+
```bash
117+
claude --version
118+
```
119+
120+
**Why this matters:**
121+
- Claude Code v1.0.48 changed the shell snapshot location from `/tmp` to `~/.claude`
122+
- Extension v1.4.0 has been updated to support this change
123+
- Using mismatched versions may cause issues with the Bash tool
124+
106125
### 🔹 Step 3: Install This Extension
107126

108127
#### ✨ Method 1: Install from VS Code Marketplace (Recommended)

README.zh-CN.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@
2424

2525
---
2626

27-
## 2025.07.11更新 如果你的Claude code version > 1.0.38 版本,请使用插件 1.3.5 及以上版本,否则Bash命令可能会报错。
28-
29-
## 2025.07.10更新 如果你的Claude code version ≤ 1.0.38 版本,请使用插件 1.3.4版本
30-
31-
---
32-
3327
## 📸 功能一览
3428

3529
### **聊天主界面**
@@ -117,6 +111,25 @@ claude chat -m sonnet -p "hello"
117111
# 如果看到 Claude 的回复,说明你的环境已准备就绪!
118112
```
119113

114+
### ⚠️ 版本兼容性说明
115+
116+
**重要:插件版本与 Claude Code CLI 版本的兼容性**
117+
118+
| Claude Code CLI 版本 | 兼容的插件版本 |
119+
|---------------------|---------------|
120+
| v1.0.48 及以上 | 使用插件 v1.4.0+ |
121+
| v1.0.47 及以下 | 使用插件 v1.3.4 |
122+
123+
**检查您的 Claude Code CLI 版本:**
124+
```bash
125+
claude --version
126+
```
127+
128+
**为什么需要注意版本兼容性:**
129+
- Claude Code v1.0.48 将 shell 快照位置从 `/tmp` 改为 `~/.claude`
130+
- 插件 v1.4.0 已更新以支持这一变化
131+
- 使用不匹配的版本可能导致 Bash 工具出现问题
132+
120133
### 🔹 第 3 步:安装本插件
121134

122135
#### ✨ 方式一:从 VS Code Marketplace 安装(推荐)

README.zh-TW.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,25 @@ claude chat -m sonnet -p "hello"
111111
# 如果看到 Claude 的回覆,說明您的環境已準備就緒!
112112
```
113113

114+
### ⚠️ 版本相容性說明
115+
116+
**重要:擴充套件版本與 Claude Code CLI 版本的相容性**
117+
118+
| Claude Code CLI 版本 | 相容的擴充套件版本 |
119+
|---------------------|-----------------|
120+
| v1.0.48 及以上 | 使用擴充套件 v1.4.0+ |
121+
| v1.0.47 及以下 | 使用擴充套件 v1.3.4 |
122+
123+
**檢查您的 Claude Code CLI 版本:**
124+
```bash
125+
claude --version
126+
```
127+
128+
**為什麼需要注意版本相容性:**
129+
- Claude Code v1.0.48 將 shell 快照位置從 `/tmp` 改為 `~/.claude`
130+
- 擴充套件 v1.4.0 已更新以支援這一變化
131+
- 使用不相符的版本可能導致 Bash 工具出現問題
132+
114133
### 🔹 第 3 步:安裝本擴充套件
115134

116135
#### ✨ 方式一:從 VS Code Marketplace 安裝(推薦)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "claude-code-chatui",
33
"displayName": "Claude-Code ChatUI for Windows",
44
"description": "Claude Code – ChatUI – Windows (No WSL)",
5-
"version": "1.3.4",
5+
"version": "1.4.0",
66
"publisher": "lkbaba",
77
"author": "lkbaba",
88
"repository": {

src/extension.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,19 @@ export async function activate(context: vscode.ExtensionContext) {
2828
// Do not block extension activation, but some features will fail.
2929
}
3030

31-
// Create /tmp directory for Git Bash on Windows
31+
// Create ~/.claude directory for Claude Code v1.0.48+
3232
if (process.platform === 'win32') {
3333
try {
34-
// Use Git Bash to create /tmp directory if it doesn't exist
35-
const gitBashPath = vscode.workspace.getConfiguration('claudeCodeChatUI').get<string>('windows.gitBashPath', 'C:\\Program Files\\Git\\bin\\bash.exe');
36-
if (fs.existsSync(gitBashPath)) {
37-
cp.exec(`"${gitBashPath}" -c "mkdir -p /tmp"`, (error) => {
38-
if (error) {
39-
console.error('[Extension] Failed to create /tmp directory:', error);
40-
} else {
41-
console.log('[Extension] Successfully created /tmp directory for Git Bash');
42-
}
43-
});
34+
const homeDir = require('os').homedir();
35+
const claudeDir = require('path').join(homeDir, '.claude');
36+
37+
// Create directory if it doesn't exist
38+
if (!fs.existsSync(claudeDir)) {
39+
fs.mkdirSync(claudeDir, { recursive: true });
40+
console.log('[Extension] Successfully created ~/.claude directory at:', claudeDir);
4441
}
4542
} catch (error) {
46-
console.error('[Extension] Error creating /tmp directory:', error);
43+
console.error('[Extension] Error creating ~/.claude directory:', error);
4744
}
4845
}
4946

src/managers/ConfigurationManager.ts

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,21 @@ export class ConfigurationManager {
9999

100100
settings['mcp.servers'].forEach((server) => {
101101
if (server.name && server.command) {
102-
// Build server configuration
102+
// Build server configuration with variable expansion
103103
const serverConfig: any = {
104-
command: server.command
104+
command: this._expandVariables(server.command)
105105
};
106106

107-
// Add args if provided
107+
// Add args if provided with variable expansion
108108
if (server.args) {
109109
if (typeof server.args === 'string') {
110-
// If args is a string, split it into array
111-
serverConfig.args = server.args.trim().split(/\s+/);
110+
// If args is a string, split it into array and expand variables
111+
serverConfig.args = server.args.trim().split(/\s+/).map((arg: string) => this._expandVariables(arg));
112112
} else if (Array.isArray(server.args)) {
113-
serverConfig.args = server.args;
113+
// Expand variables in each argument
114+
serverConfig.args = server.args.map((arg: any) =>
115+
typeof arg === 'string' ? this._expandVariables(arg) : arg
116+
);
114117
}
115118
}
116119

@@ -126,13 +129,18 @@ export class ConfigurationManager {
126129
server.env.split(/\s+/).forEach((pair: string) => {
127130
const [key, value] = pair.split('=');
128131
if (key && value) {
129-
envObj[key] = value;
132+
envObj[key] = this._expandVariables(value);
130133
}
131134
});
132135
serverConfig.env = envObj;
133136
}
134137
} else if (typeof server.env === 'object') {
135-
serverConfig.env = server.env;
138+
// Expand variables in object values
139+
const expandedEnv: any = {};
140+
for (const [key, value] of Object.entries(server.env)) {
141+
expandedEnv[key] = typeof value === 'string' ? this._expandVariables(value) : value;
142+
}
143+
serverConfig.env = expandedEnv;
136144
}
137145
}
138146

@@ -305,4 +313,35 @@ export class ConfigurationManager {
305313
return config.get<string>('api.key', '');
306314
}
307315

316+
/**
317+
* Expands environment variables in strings (e.g., $HOME, ${VAR})
318+
* Supports both $VAR and ${VAR} syntax
319+
* @param value String potentially containing environment variables
320+
* @returns String with expanded variables
321+
*/
322+
private _expandVariables(value: string): string {
323+
if (!value || typeof value !== 'string') {
324+
return value;
325+
}
326+
327+
// Replace ${VAR} and $VAR with environment variable values
328+
return value.replace(/\$\{([^}]+)\}|\$([A-Za-z_][A-Za-z0-9_]*)/g, (match, p1, p2) => {
329+
const varName = p1 || p2;
330+
const envValue = process.env[varName];
331+
332+
// If variable exists, return its value; otherwise, return original
333+
if (envValue !== undefined) {
334+
return envValue;
335+
}
336+
337+
// Special handling for common variables
338+
if (varName === 'HOME' || varName === 'USERPROFILE') {
339+
return os.homedir();
340+
}
341+
342+
// Return original if variable not found
343+
return match;
344+
});
345+
}
346+
308347
}

src/managers/WindowsCompatibility.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,8 @@ export class WindowsCompatibility {
2323

2424
const platform = process.platform;
2525

26-
// Fix Windows temp directory path issue
27-
if (platform === 'win32' && spawnOptions.env) {
28-
// Use Git Bash compatible temp directory
29-
spawnOptions.env.TEMP = '/tmp';
30-
spawnOptions.env.TMP = '/tmp';
31-
spawnOptions.env.TMPDIR = '/tmp';
32-
33-
// Alternative: Use Windows temp with proper format
34-
// const windowsTemp = process.env.TEMP || process.env.TMP || 'C:\\Windows\\Temp';
35-
// spawnOptions.env.TEMP = windowsTemp.replace(/\\/g, '/');
36-
// spawnOptions.env.TMP = spawnOptions.env.TEMP;
37-
// spawnOptions.env.TMPDIR = spawnOptions.env.TEMP;
38-
}
26+
// Claude Code v1.0.48+ uses ~/.claude instead of /tmp for shell snapshots
27+
// No need to override temp directory environment variables
3928
if (platform === 'win32') {
4029
const npmPrefix = await this._npmPrefixPromise;
4130
if (!npmPrefix) {

src/services/MessageProcessor.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,20 @@ export class MessageProcessor {
238238
}
239239
break;
240240
case 'Grep':
241+
// v1.0.45 redesigned Grep tool - show more parameters
241242
if (content.input?.pattern) {
242243
const pattern = content.input.pattern.substring(0, 30);
243244
details = ` • "${pattern}${content.input.pattern.length > 30 ? '...' : ''}"`;
245+
246+
// Add path info if specified
247+
if (content.input.path && content.input.path !== '.') {
248+
details += ` in ${content.input.path}`;
249+
}
250+
251+
// Add include pattern if specified
252+
if (content.input.include) {
253+
details += ` (${content.input.include})`;
254+
}
244255
}
245256
break;
246257
case 'WebFetch':

src/ui-v2/getBodyContent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export function getBodyContent(): string {
66
<div class="header">
77
<div style="display: flex; align-items: center;">
88
<h2>Claude Code Chat</h2>
9-
<span id="versionDisplay" style="font-size: 12px; color: var(--vscode-descriptionForeground); margin-left: 8px; opacity: 0.7; align-self: flex-end; margin-bottom: 2px;">v1.3.4</span>
9+
<span id="versionDisplay" style="font-size: 12px; color: var(--vscode-descriptionForeground); margin-left: 8px; opacity: 0.7; align-self: flex-end; margin-bottom: 2px;">v1.4.0</span>
1010
<!-- <div id="sessionInfo" class="session-badge" style="display: none;">
1111
<span class="session-icon">💬</span>
1212
<span id="sessionId">-</span>

0 commit comments

Comments
 (0)