mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-06 21:46:40 +02:00
refactor: add PROJECTS_DIR to gstack-slug and getProjectsDir() to util.ts
gstack-slug now outputs PROJECTS_DIR (respecting GSTACK_STATE_DIR env var). lib/util.ts gets getProjectsDir(slug?) as single source of truth for TypeScript consumers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,12 @@ import { spawnSync } from 'child_process';
|
||||
export const GSTACK_STATE_DIR = process.env.GSTACK_STATE_DIR || path.join(os.homedir(), '.gstack');
|
||||
export const GSTACK_DEV_DIR = path.join(os.homedir(), '.gstack-dev');
|
||||
|
||||
/** Get the projects directory, optionally scoped to a specific project slug. */
|
||||
export function getProjectsDir(slug?: string): string {
|
||||
const base = path.join(GSTACK_STATE_DIR, 'projects');
|
||||
return slug ? path.join(base, slug) : base;
|
||||
}
|
||||
|
||||
// --- File I/O ---
|
||||
|
||||
/** Atomic write: write to .tmp then rename. Non-fatal on error. */
|
||||
|
||||
Reference in New Issue
Block a user