openapi: 3.1.0 info: title: Api version: 0.1.0 description: API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: github description: GitHub connection - name: analysis description: Portfolio analysis - name: preferences description: User preferences - name: public description: Unauthenticated public endpoints - name: repo-finisher description: One-click repo finishing - name: valuation description: Portfolio and repo valuation - name: vibe-tools description: Market analysis, vibe specs, combining, and iterative finishing paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /github/status: get: operationId: getGithubStatus tags: [github] summary: Get GitHub connection status security: - bearerAuth: [] responses: "200": description: Connection info or null content: application/json: schema: $ref: "#/components/schemas/GithubStatus" /github/portfolio-summary: get: operationId: getPortfolioSummary tags: [github] summary: Get portfolio summary stats security: - bearerAuth: [] responses: "200": description: Portfolio stats content: application/json: schema: $ref: "#/components/schemas/PortfolioSummary" /github/connect: post: operationId: connectGithub tags: [github] summary: Store a GitHub access token obtained via Supabase OAuth security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/GithubConnectInput" responses: "200": description: Connected successfully content: application/json: schema: $ref: "#/components/schemas/GithubConnection" /github/connection: delete: operationId: disconnectGithub tags: [github] summary: Disconnect GitHub security: - bearerAuth: [] responses: "200": description: Disconnected content: application/json: schema: $ref: "#/components/schemas/SuccessResult" /analysis/run: post: operationId: runAnalysis tags: [analysis] summary: Start a new analysis security: - bearerAuth: [] responses: "200": description: Analysis started content: application/json: schema: $ref: "#/components/schemas/AnalysisRunResult" /analysis: get: operationId: listAnalyses tags: [analysis] summary: List all analyses for the current user security: - bearerAuth: [] responses: "200": description: List of analyses content: application/json: schema: type: array items: $ref: "#/components/schemas/AnalysisSummary" /analysis/{id}: get: operationId: getAnalysis tags: [analysis] summary: Get a single analysis with its recommendations security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string responses: "200": description: Analysis detail content: application/json: schema: $ref: "#/components/schemas/AnalysisDetail" delete: operationId: deleteAnalysis tags: [analysis] summary: Delete an analysis security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/SuccessResult" /analysis/{id}/rerun: post: operationId: rerunAnalysis tags: [analysis] summary: Run a fresh analysis based on an existing one security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string responses: "200": description: New analysis started content: application/json: schema: $ref: "#/components/schemas/AnalysisRunResult" /analysis/{id}/share: post: operationId: shareAnalysis tags: [analysis] summary: Toggle public sharing for an analysis security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ShareInput" responses: "200": description: Share result content: application/json: schema: $ref: "#/components/schemas/ShareResult" /analysis/{id}/action-plan: post: operationId: startActionPlan tags: [analysis] summary: >- Kick off phased action plan generation in the background. Returns immediately (200) with the current status instead of blocking on the LLM call — poll GET /analysis/{id}/action-plan for the result. If a completed plan is already cached, it is returned right away. security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string responses: "200": description: Action plan generation started (or already cached/running) content: application/json: schema: $ref: "#/components/schemas/ActionPlanStatus" get: operationId: getActionPlanStatus tags: [analysis] summary: Poll the status/result of an in-progress or completed action plan security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string responses: "200": description: Current action plan status content: application/json: schema: $ref: "#/components/schemas/ActionPlanStatus" /analysis/{id}/merge-instructions: post: operationId: getMergeInstructions tags: [analysis] summary: Generate merge/combine instructions for a recommendation security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/MergeInput" responses: "200": description: Merge instructions content: application/json: schema: $ref: "#/components/schemas/MergeInstructions" /preferences: get: operationId: getPreferences tags: [preferences] summary: Get current user preferences security: - bearerAuth: [] responses: "200": description: Preferences content: application/json: schema: $ref: "#/components/schemas/UserPreferences" patch: operationId: updatePreferences tags: [preferences] summary: Update user preferences security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PreferencesUpdate" responses: "200": description: Updated preferences content: application/json: schema: $ref: "#/components/schemas/UserPreferences" /public/analysis/{slug}: get: operationId: getPublicAnalysis tags: [public] summary: Get a publicly shared analysis by its share slug parameters: - name: slug in: path required: true schema: type: string responses: "200": description: Analysis detail content: application/json: schema: $ref: "#/components/schemas/AnalysisDetail" /repo-finisher/plan: post: operationId: planRepoChanges tags: [repo-finisher] summary: Propose a signed, immutable change plan for a repo. Writes nothing. description: > Returns a plan bound to the repository's current default-branch commit, signed by the server, together with the proposed content for each path so the user can review the exact bytes before approving. Nothing is written to the repository by this call. security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PlanInput" responses: "200": description: Signed change plan content: application/json: schema: $ref: "#/components/schemas/PlanResponse" /repo-finisher/execute: post: operationId: executeRepoPlan tags: [repo-finisher] summary: Execute the approved subset of a signed plan as one commit and a draft PR description: > Verifies the plan signature, the approved path list, the high-risk consent flag, the base commit and each file's content hash before writing. Refused plans return 403; a base branch that moved since planning returns 409. security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ExecuteInput" responses: "200": description: Execution result content: application/json: schema: $ref: "#/components/schemas/ExecuteResult" "403": description: Execution refused — signature, approval or content check failed "409": description: The base branch moved since the plan was built /repo-finisher/status: get: operationId: getRepoFinisherStatus tags: [repo-finisher] summary: Check whether a repo has previously been finished security: - bearerAuth: [] parameters: - name: repo in: query required: true schema: type: string responses: "200": description: Finish status content: application/json: schema: $ref: "#/components/schemas/RepoFinisherStatus" /valuation/{id}: post: operationId: runValuation tags: [valuation] summary: Run an AI valuation of an analysis's finish/repurpose repos security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string responses: "200": description: Portfolio valuation content: application/json: schema: $ref: "#/components/schemas/PortfolioValuation" get: operationId: getValuation tags: [valuation] summary: Get a previously computed portfolio valuation security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string responses: "200": description: Portfolio valuation, or null if not yet computed content: application/json: schema: oneOf: - $ref: "#/components/schemas/PortfolioValuation" - type: "null" /vibe-tools/market-value: post: operationId: assessMarketAndValue tags: [vibe-tools] summary: Assess market fit and valuation for a single recommendation security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/VibeToolsItemInput" responses: "200": description: Market analysis and valuation content: application/json: schema: $ref: "#/components/schemas/MarketAndValueResult" /vibe-tools/vibe-spec: post: operationId: generateVibeSpec tags: [vibe-tools] summary: Generate a ready-to-ship product spec for a recommendation security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/VibeToolsItemInput" responses: "200": description: Vibe spec content: application/json: schema: $ref: "#/components/schemas/VibeSpec" /vibe-tools/combine: post: operationId: combineRepos tags: [vibe-tools] summary: Create a new combined repo from a "combine" recommendation's source repos security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/VibeToolsItemInput" responses: "200": description: Combine result content: application/json: schema: $ref: "#/components/schemas/CombineResult" /vibe-tools/milestone-plan: post: operationId: buildMilestonePlan tags: [vibe-tools] summary: Break "finish this repository" into approvable milestones. Writes nothing. security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/MilestonePlanInput" responses: "200": description: Milestone plan content: application/json: schema: $ref: "#/components/schemas/MilestonePlanResult" components: securitySchemes: bearerAuth: type: http scheme: bearer schemas: HealthStatus: type: object required: [status, observability] properties: status: type: string observability: type: object required: [sentry] properties: sentry: type: object required: [enabled, environment, release, traces_sample_rate] properties: enabled: type: boolean environment: type: string release: type: ["string", "null"] traces_sample_rate: type: number GithubStatus: type: object properties: connected: type: boolean login: type: ["string", "null"] avatarUrl: type: ["string", "null"] displayName: type: ["string", "null"] repoCount: type: ["integer", "null"] required: [connected] PortfolioSummary: type: object properties: repoCount: type: integer languages: type: array items: type: object required: [name, count] properties: name: type: string count: type: integer totalStars: type: integer lastPushed: type: ["string", "null"] required: [repoCount, languages, totalStars] GithubConnectInput: type: object required: [providerToken] properties: providerToken: type: string GithubConnection: type: object required: [login] properties: login: type: string avatarUrl: type: ["string", "null"] displayName: type: ["string", "null"] SuccessResult: type: object required: [success] properties: success: type: boolean AnalysisRunResult: type: object required: [id] properties: id: type: string AnalysisSummary: type: object required: [id, status, created_at] properties: id: type: string status: type: string enum: [running, complete, failed] repo_count: type: ["integer", "null"] created_at: type: string error: type: ["string", "null"] trigger_type: type: ["string", "null"] ai_provider: type: ["string", "null"] Recommendation: type: object required: [id, kind, title, repos, pitch, effort, market_potential, next_steps, rank] properties: id: type: string kind: type: string enum: [finish, combine, repurpose] title: type: string repos: type: array items: type: string pitch: type: string effort: type: integer market_potential: type: integer next_steps: type: array items: type: string tech_stack: type: array items: type: string marketing_tweet: type: ["string", "null"] marketing_linkedin: type: ["string", "null"] estimated_hours: type: ["integer", "null"] rank: type: integer finish_result: oneOf: - $ref: "#/components/schemas/ExecuteResult" - type: "null" market_analysis: oneOf: - $ref: "#/components/schemas/MarketAnalysis" - type: "null" valuation: oneOf: - $ref: "#/components/schemas/MarketValuation" - type: "null" vibe_spec: oneOf: - $ref: "#/components/schemas/VibeSpec" - type: "null" combine_result: oneOf: - $ref: "#/components/schemas/CombineResult" - type: "null" milestone_plan: type: ["array", "null"] items: $ref: "#/components/schemas/Milestone" AnalysisDetail: type: object required: [analysis, items] properties: analysis: type: object required: [id, status, created_at] properties: id: type: string status: type: string enum: [running, complete, failed] repo_count: type: ["integer", "null"] created_at: type: string completed_at: type: ["string", "null"] error: type: ["string", "null"] summary_md: type: ["string", "null"] portfolio_stats: type: ["object", "null"] developer_profile: type: ["string", "null"] generated_system_prompt: type: ["string", "null"] critique_md: type: ["string", "null"] strategy_summary: type: ["string", "null"] is_public: type: ["boolean", "null"] share_slug: type: ["string", "null"] analyzed_repo_names: type: array items: type: string items: type: array items: $ref: "#/components/schemas/Recommendation" ShareInput: type: object required: [isPublic] properties: isPublic: type: boolean ShareResult: type: object required: [isPublic] properties: isPublic: type: boolean slug: type: ["string", "null"] ActionPlanItem: type: object required: [title, recommendation_index, why_now, key_deliverable] properties: title: type: string recommendation_index: type: integer why_now: type: string key_deliverable: type: string ActionPlanPhase: type: object required: [name, duration_weeks, items] properties: name: type: string duration_weeks: type: integer items: type: array items: $ref: "#/components/schemas/ActionPlanItem" ActionPlan: type: object required: [total_weeks, phases] properties: total_weeks: type: integer phases: type: array items: $ref: "#/components/schemas/ActionPlanPhase" quick_wins: type: array items: type: string moonshots: type: array items: type: string ActionPlanStatus: type: object required: [status] properties: status: type: string enum: [not_started, running, completed, failed] plan: allOf: - $ref: "#/components/schemas/ActionPlan" nullable: true error: type: ["string", "null"] MergeInput: type: object required: [itemRank] properties: itemRank: type: integer MergeInstructions: type: object required: [instructions, newRepoName, mergedRepos] properties: instructions: type: string newRepoName: type: string newRepoUrl: type: ["string", "null"] primaryRepo: type: ["string", "null"] mergedRepos: type: array items: type: string UserPreferences: type: object properties: email_notifications: type: ["boolean", "null"] schedule_enabled: type: ["boolean", "null"] schedule_frequency: type: ["string", "null"] enum: [weekly, monthly, null] custom_ai_provider: type: ["string", "null"] custom_ai_key_set: type: boolean description: Whether a provider key is stored. The key itself is write-only and never returned. filter_languages: type: array items: type: string filter_exclude_archived: type: ["boolean", "null"] filter_min_stars: type: ["integer", "null"] filter_max_repos: type: ["integer", "null"] analysis_tier: type: ["string", "null"] enum: [fast, balanced, deep, null] PreferencesUpdate: type: object properties: email_notifications: type: boolean schedule_enabled: type: boolean schedule_frequency: type: string enum: [weekly, monthly] custom_ai_provider: type: string custom_ai_key: type: ["string", "null"] filter_languages: type: array items: type: string filter_exclude_archived: type: boolean filter_min_stars: type: integer filter_max_repos: type: integer analysis_tier: type: string enum: [fast, balanced, deep] PlanInput: type: object required: [repo] properties: repo: type: string goals: type: array items: type: string analysisId: type: string itemRank: type: integer PlannedChange: type: object required: [path, status, contentSha256, description, risk] properties: path: type: string status: type: string enum: [created, modified, deleted] contentSha256: type: string description: SHA-256 of the exact content this change will write; empty for deletions. description: type: string risk: type: string enum: [normal, high] PlanDocument: type: object required: [planId, repo, baseBranch, baseCommitSha, summary, createdAt, expiresAt, changes] properties: planId: type: string repo: type: string baseBranch: type: string baseCommitSha: type: string summary: type: string milestone: type: string createdAt: type: string expiresAt: type: string changes: type: array items: $ref: "#/components/schemas/PlannedChange" PlanResponse: type: object required: [plan, signature, highRiskPaths, proposedContents] properties: plan: $ref: "#/components/schemas/PlanDocument" signature: type: string highRiskPaths: type: array items: type: string proposedContents: type: object additionalProperties: type: string ApprovalInput: type: object required: [planId, approvedPaths, highRiskConsent] properties: planId: type: string approvedPaths: type: array items: type: string highRiskConsent: type: boolean ExecuteInput: type: object required: [plan, signature, approval, contents] properties: plan: $ref: "#/components/schemas/PlanDocument" signature: type: string approval: $ref: "#/components/schemas/ApprovalInput" contents: type: object additionalProperties: type: string FinishChange: type: object required: [file, status, description] properties: file: type: string status: type: string enum: [created, modified, deleted] description: type: string SkippedChange: type: object required: [path, reason] properties: path: type: string reason: type: string ExecuteResult: type: object required: [repo, planId, branch, commit_sha, pr_url, pr_number, files_changed, summary, changes, skipped] properties: repo: type: string planId: type: string branch: type: string commit_sha: type: string pr_url: type: string pr_number: type: integer files_changed: type: integer summary: type: string changes: type: array items: $ref: "#/components/schemas/FinishChange" skipped: type: array items: $ref: "#/components/schemas/SkippedChange" RepoFinisherStatus: type: object required: [repo, hasBeenFinished, finishes] properties: repo: type: string hasBeenFinished: type: boolean finishes: type: array items: $ref: "#/components/schemas/ExecuteResult" ValuationFactor: type: object required: [label, score, weight, detail] properties: label: type: string score: type: number weight: type: number detail: type: string ValuationRevenuePotential: type: object required: [model, monthly_revenue_low, monthly_revenue_high, timeline] properties: model: type: string monthly_revenue_low: type: integer monthly_revenue_high: type: integer timeline: type: string ValuationComparable: type: object required: [name, outcome, multiple, relevance] properties: name: type: string outcome: type: string multiple: type: string relevance: type: string Valuation: type: object required: [ repo, estimated_value_low, estimated_value_high, currency, valuation_method, confidence, factors, revenue_potential, comparables, risks, upsides, summary, ] properties: repo: type: string estimated_value_low: type: integer estimated_value_high: type: integer currency: type: string valuation_method: type: string confidence: type: string enum: [low, medium, high] factors: type: array items: $ref: "#/components/schemas/ValuationFactor" revenue_potential: $ref: "#/components/schemas/ValuationRevenuePotential" comparables: type: array items: $ref: "#/components/schemas/ValuationComparable" risks: type: array items: type: string upsides: type: array items: type: string summary: type: string PortfolioValuationTopPick: type: object required: [repo, reason] properties: repo: type: string reason: type: string PortfolioValuation: type: object required: [ total_estimated_value_low, total_estimated_value_high, currency, repo_valuations, portfolio_summary, top_picks, diversification_score, recommendation, ] properties: total_estimated_value_low: type: integer total_estimated_value_high: type: integer currency: type: string repo_valuations: type: array items: $ref: "#/components/schemas/Valuation" portfolio_summary: type: string top_picks: type: array items: $ref: "#/components/schemas/PortfolioValuationTopPick" diversification_score: type: number recommendation: type: string VibeToolsItemInput: type: object required: [analysisId, itemRank] properties: analysisId: type: string itemRank: type: integer MarketCompetitor: type: object required: [name, url, differentiator, evidence_basis] properties: name: type: string url: type: string differentiator: type: string evidence_basis: type: string MarketEvidence: type: object required: [claim, source, strength] properties: claim: type: string source: type: string strength: type: string enum: [assumption, weak, moderate, strong] NeedValidationExperiment: type: object required: [experiment, success_metric, effort] properties: experiment: type: string success_metric: type: string effort: type: string enum: [hours, days, weeks] NeedAssessment: type: object required: [score, problem, urgency, evidence_confidence, supporting_evidence, counter_evidence, validation_experiments, decision] properties: score: type: integer minimum: 0 maximum: 100 problem: type: string urgency: type: string enum: [low, medium, high, critical] evidence_confidence: type: string enum: [low, medium, high] supporting_evidence: type: array items: $ref: "#/components/schemas/MarketEvidence" counter_evidence: type: array items: type: string validation_experiments: type: array items: $ref: "#/components/schemas/NeedValidationExperiment" decision: type: string enum: [build_now, validate_first, deprioritize] MarketNextAction: type: object required: [title, why, impact, effort, acceptance_check] properties: title: type: string why: type: string impact: type: string enum: [low, medium, high] effort: type: string enum: [hours, days, weeks] acceptance_check: type: string MarketAnalysis: type: object required: [tam_summary, target_users, competitors, monetization, demand_score, ship_readiness_score, risks, verdict, need_assessment, next_best_actions] properties: tam_summary: type: string target_users: type: array items: type: string competitors: type: array items: $ref: "#/components/schemas/MarketCompetitor" monetization: type: array items: type: string demand_score: type: integer ship_readiness_score: type: integer risks: type: array items: type: string verdict: type: string enum: [ship_now, finish_first, combine_first, shelve] need_assessment: $ref: "#/components/schemas/NeedAssessment" next_best_actions: type: array items: $ref: "#/components/schemas/MarketNextAction" MarketValuation: type: object required: [low_usd, mid_usd, high_usd, reasoning, basis, confidence, evidence, missing_information, potential_low_usd, potential_mid_usd, potential_high_usd, potential_assumptions, what_changes_value] properties: low_usd: type: integer mid_usd: type: integer high_usd: type: integer reasoning: type: string basis: type: string enum: [replacement_cost, revenue_multiple, market_comparables, scenario_only] confidence: type: string enum: [low, medium, high] evidence: type: array items: type: string missing_information: type: array items: type: string potential_low_usd: type: integer potential_mid_usd: type: integer potential_high_usd: type: integer potential_assumptions: type: array items: type: string what_changes_value: type: array items: type: string MarketAndValueResult: type: object required: [market, valuation] properties: market: $ref: "#/components/schemas/MarketAnalysis" valuation: $ref: "#/components/schemas/MarketValuation" VibeSpec: type: object required: [ product_name, tagline, prd_md, lovable_prompt, landing_hero, landing_subhead, landing_bullets, cta, launch_checklist, ] properties: product_name: type: string tagline: type: string prd_md: type: string lovable_prompt: type: string landing_hero: type: string landing_subhead: type: string landing_bullets: type: array items: type: string cta: type: string launch_checklist: type: array items: type: string CombineStructureNode: type: object required: [path, purpose] properties: path: type: string purpose: type: string CombineSourceIssue: type: object required: [repo, url] properties: repo: type: string url: type: string CombineResult: type: object required: [combined_repo, combined_url, source_issues, structure, integration_plan_md] properties: combined_repo: type: string combined_url: type: string source_issues: type: array items: $ref: "#/components/schemas/CombineSourceIssue" structure: type: array items: $ref: "#/components/schemas/CombineStructureNode" integration_plan_md: type: string MilestonePlanInput: type: object required: [analysisId, itemRank, repo] properties: analysisId: type: string itemRank: type: integer repo: type: string milestones: type: integer minimum: 1 maximum: 4 Milestone: type: object required: [order, title, goals] properties: order: type: integer title: type: string goals: type: array items: type: string MilestonePlanResult: type: object required: [repo, milestones, next_step] properties: repo: type: string milestones: type: array items: $ref: "#/components/schemas/Milestone" next_step: type: string