openapi: 3.1.0 info: title: AI Board - Display Spec.md API version: 1.0.0 description: API endpoint for retrieving generated specification documents from GitHub servers: - url: http://localhost:3000 description: Local development - url: https://ai-board.vercel.app description: Production paths: /api/projects/{projectId}/tickets/{id}/spec: get: summary: Get specification document for a ticket description: | Retrieves the spec.md file generated by GitHub Actions workflow for a ticket that has completed the "specify" command. **Requirements**: - Ticket must have a branch assigned - Ticket must have at least one job with command="specify" and status="COMPLETED" - Ticket must belong to the specified project **Test Mode**: When GITHUB_TOKEN is missing or contains "test"/"placeholder", returns mock content instead of calling GitHub API. operationId: getTicketSpec tags: - Tickets - Specifications parameters: - name: projectId in: path required: true description: Project ID (numeric string) schema: type: string pattern: '^\d+$' example: "1" - name: id in: path required: true description: Ticket ID (numeric string) schema: type: string pattern: '^\d+$' example: "123" responses: '200': description: Specification content retrieved successfully content: application/json: schema: type: object required: - content - metadata properties: content: type: string description: Raw markdown content of spec.md file example: | # Feature Specification: Example Feature **Branch**: 022-example-feature **Status**: Draft ## Summary This is an example specification. metadata: type: object required: - ticketId - branch - projectId properties: ticketId: type: integer description: Ticket ID example: 123 branch: type: string description: Git branch name where spec.md is located example: "022-example-feature" projectId: type: integer description: Project ID example: 1 fileName: type: string description: File name (always spec.md) example: "spec.md" filePath: type: string description: Full path in repository example: "specs/022-example-feature/spec.md" examples: successfulResponse: summary: Successful specification retrieval value: content: | # Feature Specification: Display Generated Spec.md **Branch**: 022-display-generated-spec **Status**: Draft ## Summary Add functionality to retrieve and display spec.md files. ## Requirements - FR-001: System MUST display button when conditions met - FR-002: System MUST retrieve specification content metadata: ticketId: 123 branch: "022-display-generated-spec" projectId: 1 fileName: "spec.md" filePath: "specs/022-display-generated-spec/spec.md" testModeResponse: summary: Test mode mock response value: content: | # Test Mode Specification This is mock content returned in test mode. ## Test Requirements - Test requirement 1 - Test requirement 2 ```typescript const test = 'example'; ``` metadata: ticketId: 123 branch: "test-branch" projectId: 1 fileName: "spec.md" filePath: "specs/test-branch/spec.md" '400': description: Invalid request (malformed projectId or ticketId) content: application/json: schema: $ref: '#/components/schemas/Error' examples: invalidProjectId: summary: Invalid project ID format value: error: "Invalid project ID" code: "VALIDATION_ERROR" invalidTicketId: summary: Invalid ticket ID format value: error: "Invalid ticket ID" message: "Ticket ID must be a number" '403': description: Forbidden - Ticket belongs to different project content: application/json: schema: $ref: '#/components/schemas/Error' examples: wrongProject: summary: Ticket belongs to different project value: error: "Forbidden" code: "WRONG_PROJECT" '404': description: Not Found - Project, ticket, or specification not available content: application/json: schema: $ref: '#/components/schemas/Error' examples: projectNotFound: summary: Project does not exist value: error: "Project not found" code: "PROJECT_NOT_FOUND" ticketNotFound: summary: Ticket does not exist value: error: "Ticket not found" code: "TICKET_NOT_FOUND" specNotAvailable: summary: Specification not yet available value: error: "Specification not available" code: "SPEC_NOT_AVAILABLE" message: "Ticket does not have a completed 'specify' job" specFileNotFound: summary: Specification file missing from GitHub value: error: "Specification file not found" code: "FILE_NOT_FOUND" message: "File does not exist at specs/{branch}/spec.md" '500': description: Internal Server Error - GitHub API failure or unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' examples: githubApiError: summary: GitHub API failure value: error: "Failed to fetch specification" code: "GITHUB_API_ERROR" message: "GitHub API returned error: rate limit exceeded" unexpectedError: summary: Unexpected server error value: error: "Internal server error" code: "INTERNAL_ERROR" components: schemas: Error: type: object required: - error properties: error: type: string description: Human-readable error message example: "Invalid project ID" code: type: string description: Machine-readable error code example: "VALIDATION_ERROR" message: type: string description: Additional error details example: "Project ID must be a numeric string" currentVersion: type: integer description: Current version (for 409 conflicts only) example: 2 securitySchemes: # Currently no authentication required for local development # Future: Add NextAuth.js session validation session: type: apiKey in: cookie name: next-auth.session-token # Future: Add security requirement when authentication is implemented # security: # - session: [] tags: - name: Tickets description: Ticket management operations - name: Specifications description: Specification document retrieval