能不能在qoder ide里面增加一个推送全部tag的按钮

我现在手动加了一下,但是每次版本更新都会被覆盖image.png
这个是我手动加的推送标记,这个是执行脚本,希望你们能加上,这个功能对我来说很重要

windows上的执行脚本
```# Adds "Push Tags" (git.pushTags) to the Source Control > "..." > Tags submenu

contributed by the built-in Git extension of Qoder IDE.

#

MUST be run in an ELEVATED (Administrator) PowerShell:

Patch : powershell -ExecutionPolicy Bypass -File .\patch-git-tags-menu.ps1

Rollback : powershell -ExecutionPolicy Bypass -File .\patch-git-tags-menu.ps1 -Restore

Fully quit and restart the IDE afterwards.

#

NOTE: this file is intentionally ASCII-only. Windows PowerShell 5.1 decodes

.ps1 files without a BOM using the ANSI codepage, which breaks non-ASCII text.

param([switch]$Restore)

$ErrorActionPreference = 'Stop'

$target = 'C:\Program Files\Qoder CN IDE\resources\app\extensions\git\package.json'
$backup = "$target.orig"
$original = '"git.tags":[{"command":"git.createTag","group":"tags@1"},{"command":"git.deleteTag","group":"tags@2"},{"command":"git.deleteRemoteTag","group":"tags@3"}]'
$patched = '"git.tags":[{"command":"git.createTag","group":"tags@1"},{"command":"git.deleteTag","group":"tags@2"},{"command":"git.deleteRemoteTag","group":"tags@3"},{"command":"git.pushTags","group":"tags@4"}]'

if (-not (Test-Path -LiteralPath $target)) {
Write-Host "[X] File not found: $target" -ForegroundColor Red
Write-Host ' The IDE install path may differ; locate the git extension package.json first.'
exit 1
}

$content = [System.IO.File]::ReadAllText($target)

if (-not $Restore -and $content.Contains($patched)) {
Write-Host '[=] Already patched, nothing to do.' -ForegroundColor Yellow
Write-Host ' Use -Restore to roll back if needed.'
exit 0
}

$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($identity)
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host '[X] Not running as Administrator - the target folder is write protected.' -ForegroundColor Red
Write-Host ' Open PowerShell from the Start menu with "Run as administrator", then retry.'
exit 1
}

$utf8NoBom = New-Object System.Text.UTF8Encoding($false)

if ($Restore) {
if (-not (Test-Path -LiteralPath $backup)) {
Write-Host "[X] No backup found at $backup - nothing to restore." -ForegroundColor Red
exit 1
}
Copy-Item -LiteralPath $backup -Destination $target -Force
Write-Host '[OK] Restored from backup.' -ForegroundColor Green
exit 0
}

$hits = ([regex]::Matches($content, [regex]::Escape($original))).Count
if ($hits -ne 1) {
Write-Host "[X] Expected 1 match, found $hits. Aborted (the IDE version may have changed)." -ForegroundColor Red
exit 1
}

if (-not (Test-Path -LiteralPath $backup)) {
Copy-Item -LiteralPath $target -Destination $backup
Write-Host "[i] Backup created: $backup"
}

[System.IO.File]::WriteAllText($target, $content.Replace($original, $patched), $utf8NoBom)

$check = [System.IO.File]::ReadAllText($target)
try {
$null = $check | ConvertFrom-Json
} catch {
Write-Host '[X] JSON validation failed, rolling back...' -ForegroundColor Red
Copy-Item -LiteralPath $backup -Destination $target -Force
Write-Host '[OK] Rolled back to the original file.' -ForegroundColor Green
exit 1
}

if (-not $check.Contains($patched)) {
Write-Host '[X] Patched entry not found after writing.' -ForegroundColor Red
exit 1
}

Write-Host '[OK] Patch applied. The Tags submenu now has 4 items.' -ForegroundColor Green
Write-Host ' Fully quit and restart the IDE, then check:' -ForegroundColor Cyan
Write-Host ' Source Control > "..." > Tags -> Push Tags'

```

展开
收起
plkrmd2zu3yx2 2026-12-02 17:00:28 17 分享 版权
0 条回答
写回答
取消 提交回答

Qoder CLI CN 是一款运行在终端中的 AI 编程助手,可以直接在命令行中理解你的自然语言指令并执行编码任务。

还有其他疑问?
咨询AI助理