"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCodexProfileNameError = exports.isValidCodexProfileName = exports.CODEX_PROFILE_SCHEMA_VERSION = void 0;
exports.CODEX_PROFILE_SCHEMA_VERSION = '1.0';
const RESERVED_CODEX_PROFILE_NAMES = new Set(['default', 'current']);
/**
 * Profile name must match /^[a-z0-9][a-z0-9_-]{0,63}$/ and not be reserved.
 * Rejects uppercase, path separators, leading dash/underscore, length >64.
 */
function isValidCodexProfileName(name) {
    if (!name || name.length > 64)
        return false;
    if (RESERVED_CODEX_PROFILE_NAMES.has(name))
        return false;
    if (name.includes('/') || name.includes('\\'))
        return false;
    return /^[a-z0-9][a-z0-9_-]{0,63}$/.test(name);
}
exports.isValidCodexProfileName = isValidCodexProfileName;
function getCodexProfileNameError(name) {
    if (!name)
        return 'Profile name is required.';
    if (RESERVED_CODEX_PROFILE_NAMES.has(name))
        return `Profile name "${name}" is reserved.`;
    if (name.includes('/') || name.includes('\\'))
        return 'Profile name must not contain path separators.';
    if (name.length > 64)
        return 'Profile name must be 64 characters or fewer.';
    if (!/^[a-z0-9][a-z0-9_-]{0,63}$/.test(name))
        return 'Profile name must match [a-z0-9][a-z0-9_-]{0,63}.';
    return null;
}
exports.getCodexProfileNameError = getCodexProfileNameError;
//# sourceMappingURL=types.js.map