← Go asztali alkalmazásalapok csapata adatlapja
Nézd meg, miben segít
Asztali backend és CLI-integráció
Összehangolja a beágyazott szervert és külső parancssori eszközöket a kiszámítható indulásért.
local-backend-cli-integration
Ezt a skillt használó csapattagok
Mikor hasznos?
Akkor használd, ha asztali alkalmazásod helyi backendre vagy külön telepített eszközre támaszkodik.
Miben segít neked?
- Ütközésmentesen kapcsolódik helyben és megvárja a backend kész állapotát.
- Grafikus környezetből is megkeresi és ellenőrzi az eszközútvonalat.
- Kezeli az alfolyamat életciklusát, hibáját és leállítását.
Például ezt kérheted
Javítsd az indulást foglalt portnál és csak bejelentkezési shellből megtalálható CLI esetén. Terminálkörnyezet nélkül indítsd az asztalról. Válasszon szabad portot, ellenőrizze a backend készültségét, hiányzó programnál pedig adjon érthető hibát.
Részletes dokumentáció
Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.
Összecsukás
Local Backend & CLI Integration
Many developer-focused desktop applications combine a web UI, an embedded local backend server (Node.js + SQLite), and external command-line tools (git, claude, codex, gemini). Coordinate these layers so the user never has to manage ports, terminal environments, or orphaned daemons manually.
Embedded Local Server Lifecycle
- Dynamic / Conflict-Free Port Binding:
- Never hardcode a single port like
3000or4317without fallback—if another process holds that port, the desktop app crashes on launch. - Bind to
127.0.0.1on an ephemeral port (listen(0, '127.0.0.1')or probe from a preferred port upward), readserver.address().port, and pass the bound port and per-session auth token to the desktop window via IPC/preload before loading the UI.
- Never hardcode a single port like
- Readiness Handshake Before UI Navigation:
- Wait for the embedded backend to finish SQLite migrations, skill discovery, and socket binding before resolving the window's initial startup state, displaying a lightweight native/splash loading state while booting.
- Using Electron's Built-In Node Runtime for Child Scripts:
- When an Electron app needs to spawn a pure Node.js child script on a user machine that does not have
nodeinstalled globally, spawnprocess.execPathwithenv: { ...cleanEnv, ELECTRON_RUN_AS_NODE: '1' }.
- When an Electron app needs to spawn a pure Node.js child script on a user machine that does not have
External CLI Discovery, Preflight & Execution
- Deterministic CLI Discovery:
- Because macOS/Linux GUI apps do not inherit terminal
.zshrc/.bashrcPATHexports, resolve the user's login shellPATHonce at startup and check platform-standard installation paths:- macOS:
/opt/homebrew/bin,/usr/local/bin,~/.local/bin,~/.nvm/versions/node/*/bin,~/.volta/bin,~/.bun/bin - Windows:
%APPDATA%\npm,%LOCALAPPDATA%\Programs,%ProgramFiles%\Git\cmd(where.exe/.cmdshim resolution)
- macOS:
- Because macOS/Linux GUI apps do not inherit terminal
- Three-Step CLI Preflight (Binary $\rightarrow$ Version $\rightarrow$ Auth):
- Verify each external CLI with a fast, non-interactive probe (
--versionand auth/status check with a 5-second timeout andstdin: 'ignore') and report structured status (missing,signed_out,ready) so the UI can guide installation or sign-in.
- Verify each external CLI with a fast, non-interactive probe (
- Non-Interactive Subprocess Execution:
- Always pass
{ stdio: ['ignore', 'pipe', 'pipe'], windowsHide: true }(or a controlled stdin pipe closed immediately after input) so a CLI prompting for[y/N]or credentials never hangs silently in the background. - Stream
stdoutandstderrline-by-line with bounded ring buffers so a verbose CLI output cannot exhaust main-process memory.
- Always pass
Csomagban lévő fájlok 1
SKILL.md
