Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/danielroe/carpenter. LLM-powered automations for triaging Nuxt issues github.com/nuxt/nuxt
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293import { z } from 'zod'
export const responseSchema = { title: 'Issue Categorisation', type: 'object', properties: { issueType: { type: 'string', enum: ['bug', 'feature', 'documentation', 'spam'] }, reproductionProvided: { type: 'boolean' }, spokenLanguage: { type: 'string', comment: 'The language of the title in ISO 639-1 format. Do not include country codes, only language code.' }, possibleRegression: { type: 'boolean', comment: 'If the issue is reported on upgrade to a new version of Nuxt, it is a possible regression.', }, nitro: { type: 'boolean', comment: 'If the issue is reported only in relation to a single deployment provider, it is possibly a Nitro issue.', }, },} as const
export const commentAnalysisSchema = { title: 'Issue Categorisation', type: 'object', properties: { reproductionProvided: { type: 'boolean' }, possibleRegression: { type: 'boolean', comment: 'If the issue reported is a bug and the bug has reappeared on upgrade to a new version of Nuxt, it is a possible regression.' }, },}
export const enhancedAnalysisSchema = { title: 'Enhanced Issue Analysis', type: 'object', properties: { reproductionProvided: { type: 'boolean' }, possibleRegression: { type: 'boolean', comment: 'If the issue reported is a bug and the bug has reappeared on upgrade to a new version of Nuxt, it is a possible regression.' }, shouldReopen: { type: 'boolean', comment: 'Whether a closed issue should be reopened based on new evidence or context.' }, isDifferentFromDuplicate: { type: 'boolean', comment: 'For issues marked as duplicate, whether the evidence suggests this is actually a different issue.' }, confidence: { type: 'string', enum: ['low', 'medium', 'high'], comment: 'Confidence level in the analysis based on available context.' }, },}
export const commentAnalysisResponseSchema = z.object({ reproductionProvided: z.boolean().optional(), possibleRegression: z.boolean().optional(),})
export const enhancedAnalysisResponseSchema = z.object({ reproductionProvided: z.boolean().optional(), possibleRegression: z.boolean().optional(), shouldReopen: z.boolean().optional(), isDifferentFromDuplicate: z.boolean().optional(), confidence: z.enum(['low', 'medium', 'high']).optional(),})
export enum IssueLabel { NeedsReproduction = 'needs reproduction', PossibleRegression = 'possible regression', PendingTriage = 'pending triage', Nitro = 'nitro', Documentation = 'documentation', Spam = 'spam',}
export enum IssueType { Bug = 'bug', Feature = 'feature', Documentation = 'documentation', Spam = 'spam',}
// Define schemasexport const aiResponseSchema = z.object({ response: z.string().optional(), tool_calls: z.array(z.object({ name: z.string(), arguments: z.unknown(), })).optional(),})
export const translationResponseSchema = z.object({ translated_text: z.string().optional(),})
// TODO: generate AI model schema from this?export const analyzedIssueSchema = z.object({ issueType: z.number().transform(v => (['bug', 'feature', 'documentation', 'spam'] satisfies Array<IssueType[keyof IssueType]>)[v]), reproductionProvided: z.boolean().nullable().optional().transform(v => v ?? false), spokenLanguage: z.string().nullable().optional().transform(lang => getNormalizedLanguage(lang)).describe('The language of the title in ISO 639-1 format.'), possibleRegression: z.boolean().nullable().optional().transform(v => v ?? false).describe('If the issue is reported on upgrade to a new version of Nuxt, it is a possible regression.'), nitro: z.boolean().nullable().optional().transform(v => v ?? false).describe('If the issue is reported only in relation to a single deployment provider, it is possibly a Nitro issue.'),}) .describe('Issue Categorisation')