export var SkillLayer;
(function (SkillLayer) {
    SkillLayer["SYSTEM"] = "system";
    SkillLayer["APP"] = "app";
    SkillLayer["ORG"] = "org";
    SkillLayer["INTEGRATION"] = "integration";
    SkillLayer["USER"] = "user";
})(SkillLayer || (SkillLayer = {}));
export const SKILL_PATH_PREFIXES = {
    [SkillLayer.SYSTEM]: "skills/system/",
    [SkillLayer.APP]: ".superblocks/skills/app/",
    [SkillLayer.ORG]: "skills/org/",
    [SkillLayer.INTEGRATION]: "skills/integrations/",
    [SkillLayer.USER]: "skills/user/",
};
/**
 * Paths to commonly referenced system skill files.
 * Used for skill loading prompts and protection marking.
 */
export const SYSTEM_SKILL_REFERENCES = {
    SQL_DATABASES: "skills/system/superblocks-api/references/sql-databases.md",
    REST_APIS: "skills/system/superblocks-api/references/rest-apis.md",
    GRAPHQL: "skills/system/superblocks-api/references/graphql.md",
    API_MAIN: "skills/system/superblocks-api/SKILL.md",
    FRONTEND_MAIN: "skills/system/superblocks-frontend/SKILL.md",
};
/**
 * Integration types (lowercase) that map to SQL database skill references.
 * Used to determine which skill files to prompt for based on tagged integrations.
 */
export const SQL_SKILL_INTEGRATION_TYPES = new Set([
    "postgres",
    "postgresql",
    "mysql",
    "snowflake",
    "databricks",
    "mssql",
    "microsoftsql",
    "redshift",
    "mariadb",
    "oracledb",
    "athena",
    "bigquery",
    "cockroachdb",
]);
/**
 * Integration types (lowercase) that map to REST API skill references.
 */
export const REST_SKILL_INTEGRATION_TYPES = new Set([
    "restapiintegration",
    "restapi",
    "openapi",
]);
/**
 * Integration types (lowercase) that map to GraphQL skill references.
 */
export const GRAPHQL_SKILL_INTEGRATION_TYPES = new Set([
    "graphql",
    "graphqlintegration",
]);
/**
 * Parse a virtual skill path to extract layer and path info.
 *
 * @param virtualPath - The virtual path to parse
 * @returns Parsed skill path info, or undefined if not a valid skill path
 */
export function parseSkillPath(virtualPath) {
    // Check each prefix
    for (const [layer, prefix] of Object.entries(SKILL_PATH_PREFIXES)) {
        if (virtualPath.startsWith(prefix)) {
            const relativePath = virtualPath.slice(prefix.length);
            const parts = relativePath.split("/");
            // For system/org/integration/user skills: skills/{layer}/{skillName}/...
            // For app skills: .superblocks/skills/app/...
            let skillName;
            let fileName;
            if (layer === "app") {
                // App skills might not have a skill name subdirectory
                skillName = "app";
                fileName = relativePath || "SKILL.md";
            }
            else if (layer === "integration") {
                // Integration skills: skills/integrations/{integration-id}/...
                skillName = parts[0] || "";
                fileName = parts.slice(1).join("/") || "SKILL.md";
            }
            else {
                // System/org/user skills: skills/{layer}/{skillName}/...
                skillName = parts[0] || "";
                fileName = parts.slice(1).join("/") || "SKILL.md";
            }
            const isReference = fileName.startsWith("references/");
            return {
                layer: layer,
                skillName,
                fileName,
                isReference,
                fullPath: virtualPath,
            };
        }
    }
    // Also handle the bare "skills/" prefix for listing
    if (virtualPath === "skills" || virtualPath === "skills/") {
        return {
            layer: SkillLayer.SYSTEM,
            skillName: "",
            fileName: "",
            isReference: false,
            fullPath: virtualPath,
        };
    }
    return undefined;
}
/**
 * Check if a path is a skill path
 */
export function isSkillPath(virtualPath) {
    const prefixes = Object.values(SKILL_PATH_PREFIXES);
    return prefixes.some((prefix) => virtualPath.startsWith(prefix));
}
/**
 * Get the layer for a skill path
 */
export function getSkillLayer(virtualPath) {
    const info = parseSkillPath(virtualPath);
    return info?.layer;
}
//# sourceMappingURL=types.js.map