feat: validate and describe reserved command arguments

This commit is contained in:
2026-07-26 09:04:48 +00:00
parent b9d22c75f5
commit f84efafc9a
8 changed files with 503 additions and 20 deletions
+18
View File
@@ -0,0 +1,18 @@
import fs from 'node:fs';
import path from 'node:path';
const hasWorkspaceMarker = (dir: string): boolean => fs.existsSync(path.join(dir, 'pnpm-workspace.yaml'));
export const resolveWorkspaceRoot = (
startDir: string = process.env.GAME_WORKSPACE_ROOT ?? process.env.GATEWAY_WORKSPACE_ROOT ?? process.cwd(),
maxDepth = 6
): string => {
let current = path.resolve(startDir);
for (let depth = 0; depth <= maxDepth; depth += 1) {
if (hasWorkspaceMarker(current)) return current;
const parent = path.dirname(current);
if (parent === current) break;
current = parent;
}
return path.resolve(startDir);
};