Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | 3x 3x 3x 8x 3x 3x 3x 3x 3x | import { z } from "zod";
// Base schemas for work items
export const WorkItemIdSchema = z.string().min(1).describe("Work item ID");
export const WorkItemTypeEnumSchema = z
.string()
.transform(val => val.toUpperCase().replace(/\s+/g, "_"))
.pipe(
z.enum([
"EPIC",
"ISSUE",
"TASK",
"INCIDENT",
"TEST_CASE",
"REQUIREMENT",
"OBJECTIVE",
"KEY_RESULT",
])
)
.describe("Type of work item");
export const WorkItemStateSchema = z
.string()
.transform(val => val.toUpperCase())
.pipe(z.enum(["OPEN", "CLOSED"]))
.describe("State of work item");
export const WorkItemStateEventSchema = z
.string()
.transform(val => val.toUpperCase())
.pipe(z.enum(["CLOSE", "REOPEN"]))
.describe("State event for updating work item");
// Read-only schemas
export const ListWorkItemsSchema = z.object({
namespace: z
.string()
.describe(
"Namespace path (group or project) to list work items from. Returns epics for groups, issues/tasks for projects."
),
types: z.array(WorkItemTypeEnumSchema).optional().describe("Filter by work item types"),
state: z
.array(WorkItemStateSchema)
.optional()
.default(["OPEN"])
.describe(
'Filter by work item state. Defaults to OPEN items only. Use ["OPEN", "CLOSED"] for all items.'
),
first: z.number().optional().default(20).describe("Number of items to return"),
after: z
.string()
.optional()
.describe("Cursor for pagination (use endCursor from previous response)"),
simple: z
.boolean()
.optional()
.default(true)
.describe(
"Return simplified structure with essential fields only (id, title, state, type, assignees, labels). RECOMMENDED: Use default true for most cases. Only set false when full widget details are specifically needed."
),
active: z
.boolean()
.optional()
.default(true)
.describe(
"Include only active projects and work items (excludes archived and deletion_scheduled projects). Set false to include all."
),
});
export const GetWorkItemSchema = z.object({
id: WorkItemIdSchema,
});
export const GetWorkItemTypesSchema = z.object({
namespace: z.string().describe("Namespace path (group or project) to get work item types for"),
});
// Type exports
export type ListWorkItemsOptions = z.infer<typeof ListWorkItemsSchema>;
export type GetWorkItemOptions = z.infer<typeof GetWorkItemSchema>;
export type GetWorkItemTypesOptions = z.infer<typeof GetWorkItemTypesSchema>;
export type WorkItemTypeEnum = z.infer<typeof WorkItemTypeEnumSchema>;
export type WorkItemState = z.infer<typeof WorkItemStateSchema>;
|