// tools/register-spec-registry-tools.ts — Registers SPEC-127 spec registry tools
// registry_search, registry_install: free tier (safeTracked)
// registry_publish, registry_login, registry_logout, registry_whoami: pro tier (safeLicensed)
import { safeTracked, safeLicensed } from './safe-handler.js';
import { RegistrySearchInputSchema, RegistryInstallInputSchema, RegistryPublishInputSchema, RegistryLoginInputSchema, } from './schemas/spec-registry-schemas.js';
import { handleRegistrySearch, handleRegistryInstall, handleRegistryPublish, handleRegistryLogin, handleRegistryLogout, handleRegistryWhoami, } from './registry/index.js';
export function registerSpecRegistryTools(server) {
    // registry_search (free)
    server.registerTool('registry_search', {
        description: 'Search the Planu spec registry for reusable specs. ' +
            'Filter by stack, category, difficulty, and sort by downloads, rating, or recency. ' +
            'Returns paginated results with spec metadata.',
        inputSchema: {
            query: RegistrySearchInputSchema.shape.query,
            stack: RegistrySearchInputSchema.shape.stack,
            category: RegistrySearchInputSchema.shape.category,
            difficulty: RegistrySearchInputSchema.shape.difficulty,
            sort: RegistrySearchInputSchema.shape.sort,
            page: RegistrySearchInputSchema.shape.page,
            limit: RegistrySearchInputSchema.shape.limit,
        },
        annotations: {
            title: 'Registry Search',
            readOnlyHint: true,
        },
    }, safeTracked('registry_search', async (args) => handleRegistrySearch(args)));
    // registry_install (free)
    server.registerTool('registry_install', {
        description: 'Install a spec from the Planu registry into a local project. ' +
            'Resolves the spec version, downloads assets, and optionally adapts the spec ' +
            'to the detected project stack.',
        inputSchema: {
            specName: RegistryInstallInputSchema.shape.specName,
            version: RegistryInstallInputSchema.shape.version,
            projectPath: RegistryInstallInputSchema.shape.projectPath,
            adapt: RegistryInstallInputSchema.shape.adapt,
        },
        annotations: {
            title: 'Registry Install',
            destructiveHint: false,
        },
    }, safeTracked('registry_install', async (args) => handleRegistryInstall(args)));
    // registry_publish (pro)
    server.registerTool('registry_publish', {
        description: 'Publish a spec to the Planu registry. ' +
            'Requires authentication via registry_login. ' +
            'Reads planu-registry.json from the spec directory for metadata.',
        inputSchema: {
            specDir: RegistryPublishInputSchema.shape.specDir,
            projectPath: RegistryPublishInputSchema.shape.projectPath,
        },
        annotations: {
            title: 'Registry Publish',
            destructiveHint: false,
        },
    }, safeLicensed('registry_publish', async (args) => handleRegistryPublish(args)));
    // registry_login (pro)
    server.registerTool('registry_login', {
        description: 'Authenticate with the Planu spec registry using an API token. ' +
            'Token is obtained from planu.dev account settings. ' +
            'Credentials are stored locally for subsequent publish operations.',
        inputSchema: {
            token: RegistryLoginInputSchema.shape.token,
        },
        annotations: {
            title: 'Registry Login',
            readOnlyHint: false,
        },
    }, safeLicensed('registry_login', async (args) => handleRegistryLogin(args)));
    // registry_logout (pro)
    server.registerTool('registry_logout', {
        description: 'Remove stored registry credentials. ' +
            'After logout, registry_login is required again before publishing.',
        inputSchema: {},
        annotations: {
            title: 'Registry Logout',
            destructiveHint: true,
        },
    }, safeLicensed('registry_logout', async (args) => handleRegistryLogout(args)));
    // registry_whoami (pro)
    server.registerTool('registry_whoami', {
        description: 'Show the currently authenticated registry user. ' +
            'Returns username, email, and organization if logged in.',
        inputSchema: {},
        annotations: {
            title: 'Registry Who Am I',
            readOnlyHint: true,
        },
    }, safeLicensed('registry_whoami', async (args) => handleRegistryWhoami(args)));
}
//# sourceMappingURL=register-spec-registry-tools.js.map