import { z } from 'zod';
import { handleAuditStack } from './audit-stack.js';
import { handlePlanUpgrade } from './plan-upgrade.js';
import { handleDetectDeprecations } from './detect-deprecations.js';
import { safeLicensed } from './safe-handler.js';
export function registerStackTools(server) {
    // audit_stack — SPEC-041
    server.registerTool('audit_stack', {
        description: 'Audit all project dependencies, classify as up_to_date/outdated/vulnerable/unmaintained, and generate a StackHealthScore (0-100).',
        annotations: { readOnlyHint: true },
        inputSchema: {
            projectId: z.string().max(500).describe('Project ID'),
            projectPath: z.string().max(4096).describe('Absolute path to the project root'),
            format: z
                .enum(['summary', 'json'])
                .optional()
                .describe('Output format: summary (default) or json'),
            since: z
                .string()
                .max(500)
                .optional()
                .describe('ISO timestamp — show only changes since this date'),
            failOn: z
                .enum(['none', 'warning', 'critical'])
                .optional()
                .describe('Set isError=true if score drops below threshold (for CI usage)'),
            ci: z.boolean().optional().describe('CI mode — exit with error on critical findings'),
        },
    }, safeLicensed('audit_stack', async (args) => handleAuditStack(args)));
    // plan_upgrade — SPEC-041
    server.registerTool('plan_upgrade', {
        description: 'Generate a migration plan for upgrading a specific package, including breaking changes, estimated effort, and rollback procedure.',
        annotations: { readOnlyHint: true },
        inputSchema: {
            projectId: z.string().max(500).describe('Project ID'),
            projectPath: z.string().max(4096).describe('Absolute path to the project root'),
            packageName: z
                .string()
                .max(500)
                .describe('Name of the package to upgrade (e.g. "express")'),
            fromVersion: z.string().max(500).describe('Current installed version'),
            targetVersion: z.string().max(500).describe('Target version to upgrade to'),
            changelogText: z
                .string()
                .max(1_000_000)
                .optional()
                .describe('Optional CHANGELOG.md content for breaking-change analysis'),
            format: z
                .enum(['summary', 'json'])
                .optional()
                .describe('Output format: summary (default) or json'),
        },
    }, safeLicensed('plan_upgrade', async (args) => handlePlanUpgrade(args)));
    // detect_deprecations — SPEC-041
    server.registerTool('detect_deprecations', {
        description: 'Scan project source files for deprecated API patterns (pattern-based, no network). Returns a deprecation report with tech-debt estimate.',
        annotations: { readOnlyHint: true },
        inputSchema: {
            projectId: z.string().max(500).describe('Project ID'),
            projectPath: z.string().max(4096).describe('Absolute path to the project root'),
            ecosystem: z
                .enum(['nodejs', 'python', 'browser', 'go', 'java', 'rust', 'dotnet'])
                .optional()
                .describe('Override ecosystem detection. If omitted, auto-detected from go.mod, Cargo.toml, pom.xml, build.gradle, .csproj, package.json, etc.'),
            format: z
                .enum(['summary', 'json'])
                .optional()
                .describe('Output format: summary (default) or json'),
        },
    }, safeLicensed('detect_deprecations', async (args) => handleDetectDeprecations(args)));
}
//# sourceMappingURL=register-stack-tools.js.map