feat(runtime): run local shell commands from UI
test / workspace (push) Successful in 12m36s

This commit is contained in:
Tom You
2026-07-09 00:17:45 -05:00
parent fc17c44c38
commit a215d91f40
6 changed files with 185 additions and 1 deletions
+25
View File
@@ -136,6 +136,30 @@ function wireVaultActions() {
if (button) button.addEventListener('click', saveDemoVault);
}
async function runLocalTerminalCommand() {
const command = document.getElementById('terminal-command').value;
const output = document.getElementById('terminal-output');
output.textContent = 'Running…';
try {
const tauri = window.__TAURI__?.core;
if (!tauri) throw new Error('Tauri bridge unavailable in browser preview');
const result = await tauri.invoke('run_local_command', { command, cwd: null });
output.textContent = [
`$ ${command}`,
`exit ${result.exit_code}`,
result.stdout ? `stdout:\n${result.stdout}` : '',
result.stderr ? `stderr:\n${result.stderr}` : ''
].filter(Boolean).join('\n');
} catch (error) {
output.textContent = String(error);
}
}
function wireTerminalActions() {
const button = document.getElementById('run-terminal');
if (button) button.addEventListener('click', runLocalTerminalCommand);
}
async function boot() {
const [dashboard, features] = await Promise.all([
invokeOrFallback('wallet_dashboard', fallbackDashboard),
@@ -144,6 +168,7 @@ async function boot() {
renderDashboard(dashboard);
renderFeatures(features);
wireVaultActions();
wireTerminalActions();
}
boot();