import path from "node:path";
import { normalizePath } from "vite";
export const PAGES_DIRECTORY = "pages";
export const CUSTOM_COMPONENTS_DIRECTORY = "components";
export const API_FOLDER = "apis";
export const SCOPE_FILE = "scope.ts";
export function getPageFolder(rootPath, pageName) {
    return path.join(rootPath, PAGES_DIRECTORY, pageName);
}
export function getPageScopeFilePath(rootPath, pageName) {
    return path.join(getPageFolder(rootPath, pageName), SCOPE_FILE);
}
export function getPageFilePath(rootPath, pageName) {
    return path.join(getPageFolder(rootPath, pageName), "index.tsx");
}
export function isPageFilePath(filePath) {
    return /pages\/.*\/index\.tsx/.test(filePath);
}
export function isAppFilePath(filePath) {
    return /App\.tsx/.test(filePath);
}
export function getApiFilePath(rootPath, apiName) {
    return path.join(rootPath, API_FOLDER, apiName, "api.yaml");
}
export function isApiFilePath(filePath) {
    return /\/apis\/[^/]+\/(api\.yaml|.*\.(py|js))$/.test(filePath);
}
/**
 * Check if a file path is a skill/app fact file.
 * These files are stored in skills/app/ and should not trigger Vite HMR.
 */
export function isSkillFilePath(filePath) {
    return normalizePath(filePath).includes("/skills/");
}
export const codeModeSyncExcludedDirectories = [
    ".superblocks",
    ".git",
    "node_modules",
    "build",
];
export const codeModeDownloadExcludedDirectories = [
    ".git",
    "node_modules",
    "build",
    "integration_cache",
];
export const codeModeExcludedFiles = [".env", ".npmrc"];
export function getCodeModeDownloadArchiveGlobPatterns() {
    return {
        // readdir-glob only skips recursion for directory matches via `skip`.
        skip: [
            ...codeModeDownloadExcludedDirectories,
            ...codeModeExcludedFiles,
        ].flatMap((pattern) => [pattern, `**/${pattern}`]),
        ignore: codeModeExcludedFiles.flatMap((pattern) => [
            pattern,
            `**/${pattern}`,
        ]),
    };
}
//# sourceMappingURL=file-system-helpers.js.map