chore: 并入远端仓库并保留完整聊天记录
This commit is contained in:
@@ -371,7 +371,7 @@ if (Test-Path -LiteralPath $srcWorkspace) {
|
||||
Copy-Item -LiteralPath $_.FullName -Destination $target -Force
|
||||
}
|
||||
}
|
||||
Copy-FileForce -Source (Join-Path $sourceRoaming "glassMultiRootWorkspaces\cbnsmsinfo.code-workspace") -Destination (Join-Path $env:APPDATA "Cursor\glassMultiRootWorkspaces\cbnsmsinfo.code-workspace")
|
||||
Copy-Tree -Source (Join-Path $sourceRoaming "glassMultiRootWorkspaces") -Destination (Join-Path $env:APPDATA "Cursor\glassMultiRootWorkspaces") -Quiet
|
||||
Copy-FileForce -Source (Join-Path $sourceRoaming "User\settings.json") -Destination (Join-Path $env:APPDATA "Cursor\User\settings.json")
|
||||
Copy-Tree -Source (Join-Path $sourceRoaming "User\snippets") -Destination (Join-Path $env:APPDATA "Cursor\User\snippets") -Quiet
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# 把 Cursor Agent 窗口改成简体中文。先退出 Cursor,写入 molten 语言和窗口模式,再重新打开。
|
||||
# 用法: powershell -ExecutionPolicy Bypass -File .\Set-CursorAgentZh.ps1
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$log = Join-Path $PSScriptRoot "Set-CursorAgentZh.log"
|
||||
|
||||
function Write-Log([string]$Message) {
|
||||
$line = "{0} {1}" -f (Get-Date -Format "yyyy-MM-dd HH:mm:ss"), $Message
|
||||
Add-Content -LiteralPath $log -Value $line -Encoding UTF8
|
||||
}
|
||||
|
||||
Start-Sleep -Seconds 8
|
||||
$fallback = "D:\Program Files\cursor\Cursor.exe"
|
||||
$running = @(Get-CimInstance Win32_Process -Filter "Name = 'Cursor.exe'" | Where-Object { $_.ExecutablePath })
|
||||
if ($running.Count -gt 0) { $exe = $running[0].ExecutablePath } else { $exe = $fallback }
|
||||
Write-Log "closing $exe"
|
||||
Get-Process -Name Cursor -ErrorAction SilentlyContinue | ForEach-Object { [void]$_.CloseMainWindow() }
|
||||
$deadline = (Get-Date).AddSeconds(12)
|
||||
while ((Get-Process -Name Cursor -ErrorAction SilentlyContinue) -and (Get-Date) -lt $deadline) {
|
||||
Start-Sleep -Milliseconds 400
|
||||
}
|
||||
$left = @(Get-Process -Name Cursor -ErrorAction SilentlyContinue)
|
||||
if ($left.Count -gt 0) {
|
||||
Write-Log "force stop $($left.Count)"
|
||||
$left | Stop-Process -Force
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
|
||||
$pythonCmd = Get-Command python -ErrorAction SilentlyContinue
|
||||
if ($pythonCmd) {
|
||||
$python = $pythonCmd.Source
|
||||
} else {
|
||||
$python = "D:\SoftwareSpace\uv\bin\python.exe"
|
||||
}
|
||||
$py = Join-Path $PSScriptRoot "set-cursor-zh.py"
|
||||
& $python $py
|
||||
Write-Log "python exit $LASTEXITCODE"
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
Start-Process -FilePath $exe
|
||||
Write-Log "started $exe"
|
||||
@@ -0,0 +1,41 @@
|
||||
import json
|
||||
import sqlite3
|
||||
|
||||
prefs_path = r"C:\Users\Administrator\AppData\Roaming\Cursor\molten\prefs.json"
|
||||
db_path = r"C:\Users\Administrator\AppData\Roaming\Cursor\User\globalStorage\state.vscdb"
|
||||
with open(prefs_path, encoding="utf-8") as f:
|
||||
prefs = json.load(f)
|
||||
prefs["i18nGate"] = True
|
||||
prefs["language"] = "zh-CN"
|
||||
with open(prefs_path, "w", encoding="utf-8", newline="\n") as f:
|
||||
json.dump(prefs, f, ensure_ascii=False, indent=2)
|
||||
f.write("\n")
|
||||
|
||||
con = sqlite3.connect(db_path, timeout=20)
|
||||
try:
|
||||
mirror = con.execute(
|
||||
"SELECT value FROM ItemTable WHERE key = ?",
|
||||
("cursor.agentsWindow.gateMirror",),
|
||||
).fetchone()
|
||||
auth_id = json.loads(mirror[0])["authId"] if mirror else ""
|
||||
if not auth_id:
|
||||
raise SystemExit("missing auth id")
|
||||
override = json.dumps({"authId": auth_id, "mode": "molten"}, separators=(",", ":"))
|
||||
row = con.execute(
|
||||
"SELECT key FROM ItemTable WHERE key = ?",
|
||||
("cursor.agentsWindow.override",),
|
||||
).fetchone()
|
||||
if row:
|
||||
con.execute(
|
||||
"UPDATE ItemTable SET value = ? WHERE key = ?",
|
||||
(override, "cursor.agentsWindow.override"),
|
||||
)
|
||||
else:
|
||||
con.execute(
|
||||
"INSERT INTO ItemTable (key, value) VALUES (?, ?)",
|
||||
("cursor.agentsWindow.override", override),
|
||||
)
|
||||
con.commit()
|
||||
finally:
|
||||
con.close()
|
||||
print("ok")
|
||||
@@ -371,7 +371,7 @@ if (Test-Path -LiteralPath $srcWorkspace) {
|
||||
Copy-Item -LiteralPath $_.FullName -Destination $target -Force
|
||||
}
|
||||
}
|
||||
Copy-FileForce -Source (Join-Path $sourceRoaming "glassMultiRootWorkspaces\cbnsmsinfo.code-workspace") -Destination (Join-Path $env:APPDATA "Cursor\glassMultiRootWorkspaces\cbnsmsinfo.code-workspace")
|
||||
Copy-Tree -Source (Join-Path $sourceRoaming "glassMultiRootWorkspaces") -Destination (Join-Path $env:APPDATA "Cursor\glassMultiRootWorkspaces") -Quiet
|
||||
Copy-FileForce -Source (Join-Path $sourceRoaming "User\settings.json") -Destination (Join-Path $env:APPDATA "Cursor\User\settings.json")
|
||||
Copy-Tree -Source (Join-Path $sourceRoaming "User\snippets") -Destination (Join-Path $env:APPDATA "Cursor\User\snippets") -Quiet
|
||||
|
||||
|
||||
Reference in New Issue
Block a user