// tools/register-github-tools.ts — Register all GitHub integration MCP tools (SPEC-086).
import { safeLicensed, safeTracked } from './safe-handler.js';
import { CreatePRFromSpecSchema, PRStatusSchema, ReviewPRSchema, CreateReleaseSchema, GenerateChangelogSchema, } from './schemas/github.js';
import { handleCreatePRFromSpec, handlePRStatus } from './github-pr-handler.js';
import { handleReviewPR } from './github-review-handler.js';
import { handleCreateRelease, handleGenerateChangelog } from './github-release-handler.js';
export function registerGitHubTools(server) {
    // create_pr_from_spec — pro tier
    server.registerTool('create_pr_from_spec', {
        description: 'Create a GitHub Pull Request from a spec. Extracts title and body from spec.md, ' +
            'detects the current branch as head, and links it to the spec via branch naming convention.',
        inputSchema: CreatePRFromSpecSchema.shape,
        annotations: { title: 'Create PR from Spec', readOnlyHint: false },
    }, safeLicensed('create_pr_from_spec', async (args) => handleCreatePRFromSpec(args)));
    // pr_status — free tier (read-only)
    server.registerTool('pr_status', {
        description: 'List open Pull Requests with review status and CI checks. ' +
            'Query by PR number, spec ID, or list all open PRs. ' +
            'Supports views: prs (default) | milestones.',
        inputSchema: PRStatusSchema.shape,
        annotations: { title: 'PR Status', readOnlyHint: true },
    }, safeTracked('pr_status', async (args) => handlePRStatus(args)));
    // review_pr — pro tier (read-only analysis)
    server.registerTool('review_pr', {
        description: 'Analyze a Pull Request diff for review findings. ' +
            'Supports review types: summary | detailed | security | performance. ' +
            'Does NOT post comments — returns analysis for the user to decide.',
        inputSchema: ReviewPRSchema.shape,
        annotations: { title: 'Review PR', readOnlyHint: true },
    }, safeLicensed('review_pr', async (args) => handleReviewPR(args)));
    // create_release — pro tier
    server.registerTool('create_release', {
        description: 'Create a GitHub Release with tag and auto-generated release notes from merged PRs. ' +
            'Creates a git tag with the specified semver version.',
        inputSchema: CreateReleaseSchema.shape,
        annotations: { title: 'Create Release', readOnlyHint: false, destructiveHint: true },
    }, safeLicensed('create_release', async (args) => handleCreateRelease(args)));
    // generate_changelog — pro tier (read-only)
    server.registerTool('generate_changelog', {
        description: 'Generate a changelog from merged Pull Requests between two git refs. ' +
            'Groups by type (feat, fix, docs, etc.) using conventional commit prefixes. ' +
            'Output format: markdown (Keep a Changelog) | json.',
        inputSchema: GenerateChangelogSchema.shape,
        annotations: { title: 'Generate Changelog', readOnlyHint: true },
    }, safeLicensed('generate_changelog', async (args) => handleGenerateChangelog(args)));
}
//# sourceMappingURL=register-github-tools.js.map