mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-13 00:19:03 +02:00
Add windowsHide:true at every remaining direct child_process call in browse/src that could flash a console window on Windows: - project-slug.ts (execSync gstack-slug) - browser-skills.ts (cp.spawnSync git rev-parse) - security-sidecar-client.ts (spawn — the LONG-LIVED Node sidecar, whose missing flag parked a console window on the taskbar for the daemon's whole lifetime) - find-security-sidecar.ts (execFileSync node --version) - meta-commands.ts (execSync git rev-parse in inbox + the osascript activate call) - browse-client.ts (cp.spawnSync git rev-parse) - file-permissions.ts (execFileSync whoami.exe — Windows-only, ran bare) - cli.ts (nodeSpawn osascript) windows-spawn-hide.test.ts gains a SWEEP test on top of the existing needles: it censuses EVERY child_process binding in src/ (static imports incl. aliases, `await import()` / require destructures, and `import * as cp` namespaces — 15 call sites across 10 files today) and fails CI on any call without windowsHide within its options window. Exemptions carry reasons — the one today is domain-skill-commands' interactive $EDITOR spawn (stdio:'inherit'; CREATE_NO_WINDOW would detach a console editor into an invisible console). Tests: windows-spawn-hide 5 pass; file-permissions 19 pass; browse-client 28 pass; browser-skill-commands 29 pass (81/81 combined). Fixes the app-side half of #2160; closes out #2415's residuals. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
/**
|
|
* Project slug resolution for the browse daemon.
|
|
*
|
|
* Used by domain-skills (per-project storage) and sidebar prompt-context
|
|
* injection. Cached after first call — slug is derived from the daemon's
|
|
* git remote (or env override) and doesn't change between commands.
|
|
*/
|
|
|
|
import * as path from 'path';
|
|
import * as os from 'os';
|
|
import { execSync } from 'child_process';
|
|
|
|
let cachedSlug: string | null = null;
|
|
|
|
export function getCurrentProjectSlug(): string {
|
|
if (cachedSlug) return cachedSlug;
|
|
const explicit = process.env.GSTACK_PROJECT_SLUG;
|
|
if (explicit) {
|
|
cachedSlug = explicit;
|
|
return explicit;
|
|
}
|
|
try {
|
|
const slugBin = path.join(os.homedir(), '.claude/skills/gstack/bin/gstack-slug');
|
|
const out = execSync(slugBin, { encoding: 'utf8', timeout: 2000, windowsHide: true }).trim();
|
|
const m = out.match(/SLUG="?([^"\n]+)"?/);
|
|
cachedSlug = m ? m[1]! : (out || 'unknown');
|
|
} catch {
|
|
cachedSlug = 'unknown';
|
|
}
|
|
return cachedSlug;
|
|
}
|
|
|
|
/** Reset cache; for tests only. */
|
|
export function _resetProjectSlugCache(): void {
|
|
cachedSlug = null;
|
|
}
|