MCPcopy Create free account
hub / github.com/garrytan/gstack / getCurrentProjectSlug

Function getCurrentProjectSlug

browse/src/project-slug.ts:15–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13let cachedSlug: string | null = null;
14
15export function getCurrentProjectSlug(): string {
16 if (cachedSlug) return cachedSlug;
17 const explicit = process.env.GSTACK_PROJECT_SLUG;
18 if (explicit) {
19 cachedSlug = explicit;
20 return explicit;
21 }
22 try {
23 const slugBin = path.join(os.homedir(), '.claude/skills/gstack/bin/gstack-slug');
24 const out = execSync(slugBin, { encoding: 'utf8', timeout: 2000 }).trim();
25 const m = out.match(/SLUG="?([^"\n]+)"?/);
26 cachedSlug = m ? m[1]! : (out || 'unknown');
27 } catch {
28 cachedSlug = 'unknown';
29 }
30 return cachedSlug;
31}
32
33/** Reset cache; for tests only. */
34export function _resetProjectSlugCache(): void {

Callers 7

handleSaveFunction · 0.90
handleListFunction · 0.90
handleShowFunction · 0.90
handleEditFunction · 0.90
handlePromoteToGlobalFunction · 0.90
handleRollbackFunction · 0.90
handleRmFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected