Convert the hardcoded Claude / Visual Studio / Redeploy buttons into a configurable action-button system with an editor UI. - New config field actions[] with kinds: terminal, detached, open (open uses Windows shell association — used by the .sln preset) - requiresFile supports * globs (e.g. *.sln matches solution files) - Migration seeds Claude + Visual Studio + Redeploy on first run, with a one-time vsActionBackfilled pass to add VS to users who already migrated under the previous two-seed flow - ActionEditor modal: list with reorder/edit/delete, add form with preset dropdown (Claude, Visual Studio, VS Code, Cursor, Run 1ReDeploy.bat, Commit & Push) and a curated icon dropdown plus free-text override - runAction IPC dispatches by kind; isCommandAvailable generalizes the per-CLI PATH probe used to disable buttons whose CLI is missing - Built-in VS button removed from BookmarkRow + MinimizedList; Claude visibility toggle removed from settings (now an editable action) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
464 lines
16 KiB
JavaScript
464 lines
16 KiB
JavaScript
const { shell, clipboard, dialog } = require('electron');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const { spawn } = require('child_process');
|
|
|
|
function ensureExists(targetPath) {
|
|
try {
|
|
fs.accessSync(targetPath);
|
|
return { ok: true };
|
|
} catch {
|
|
return { ok: false, error: `Path not found:\n${targetPath}` };
|
|
}
|
|
}
|
|
|
|
function ensureWindows() {
|
|
if (process.platform !== 'win32') {
|
|
return { ok: false, error: 'Windows only.' };
|
|
}
|
|
return { ok: true };
|
|
}
|
|
|
|
async function openInExplorer(targetPath) {
|
|
const exists = ensureExists(targetPath);
|
|
if (!exists.ok) return exists;
|
|
const result = await shell.openPath(targetPath);
|
|
if (result) return { ok: false, error: result };
|
|
return { ok: true };
|
|
}
|
|
|
|
// Reasonable cap for the alias used as a wt --title argument and as a
|
|
// search pattern. Strips control + reserved chars that would break wt's
|
|
// command parser (it splits on `;`).
|
|
function sanitizeTitle(s) {
|
|
if (!s) return '';
|
|
return String(s).replace(/[ |