Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions handlers/ci_failed_jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z
.object({
run_id: z.number().int().positive(),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be in owner/repo form')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
})
.strict();

Expand Down
7 changes: 3 additions & 4 deletions handlers/ci_run_logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { truncateLogs, DEFAULT_MAX_LINES } from '../lib/shared/truncate-logs.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z.object({
run_id: z.number().int().nonnegative(),
job_id: z.number().int().nonnegative().optional(),
failed_only: z.boolean().optional().default(true),
max_lines: z.number().int().positive().optional().default(DEFAULT_MAX_LINES),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be in owner/repo form')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
});

function envelope(payload: unknown) {
Expand Down
7 changes: 3 additions & 4 deletions handlers/ci_run_status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z
.object({
ref: z.string().min(1, 'ref must be a non-empty string'),
workflow_name: z.string().optional(),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be in owner/repo form')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
})
.strict();

Expand Down
7 changes: 3 additions & 4 deletions handlers/ci_runs_for_branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z.object({
branch: z.string().min(1, 'branch must be a non-empty string'),
limit: z.number().int().positive().optional().default(10),
status: z.enum(['success', 'failure', 'in_progress', 'all']).optional().default('all'),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be in owner/repo form')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
});

function envelope(payload: unknown) {
Expand Down
7 changes: 3 additions & 4 deletions handlers/ci_wait_run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ import {
defaultSleep,
type WaitResult,
} from '../lib/ci-wait-run-poll.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z
.object({
ref: z.string().min(1, 'ref must be a non-empty string (commit SHA or branch name)'),
workflow_name: z.string().optional(),
poll_interval_sec: z.number().int().positive().optional(),
timeout_sec: z.number().int().positive().optional(),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be in owner/repo form')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
expected_sha: z
.string()
.regex(/^[0-9a-f]{40}$/i, 'expected_sha must be a 40-char hex commit SHA')
Expand Down
7 changes: 3 additions & 4 deletions handlers/label_create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

// 6-char hex (no leading #). Both gh and glab accept color in this form at
// the adapter boundary; glab's `#` prefix is applied inside the adapter.
Expand All @@ -23,10 +24,8 @@ const inputSchema = z.object({
.string()
.regex(HEX_COLOR_RE, 'color must be a 6-char hex (no leading #)')
.optional(),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be owner/repo format')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
});

function envelope(payload: unknown) {
Expand Down
7 changes: 3 additions & 4 deletions handlers/label_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z.object({
limit: z.number().int().positive().optional().default(100),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be owner/repo format')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
});

function envelope(payload: unknown) {
Expand Down
7 changes: 3 additions & 4 deletions handlers/pr_comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z.object({
number: z.number().int().positive('number must be a positive integer'),
body: z.string().min(1, 'body must be a non-empty string'),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be owner/repo format')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
});

function envelope(payload: unknown) {
Expand Down
7 changes: 3 additions & 4 deletions handlers/pr_create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z.object({
title: z.string().min(1, 'title must be a non-empty string'),
Expand All @@ -15,10 +16,8 @@ const inputSchema = z.object({
base: z.string().min(1).optional(),
head: z.string().optional(),
draft: z.boolean().optional().default(false),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be owner/repo format')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
});

function envelope(payload: unknown) {
Expand Down
7 changes: 3 additions & 4 deletions handlers/pr_diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z.object({
number: z.number().int().positive(),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be owner/repo format')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
});

function envelope(payload: unknown) {
Expand Down
7 changes: 3 additions & 4 deletions handlers/pr_files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

// Re-export `parseDiffStats` so existing importers (e.g. tests/pr_files.test.ts)
// keep working. The canonical implementation lives in the GitLab adapter; this
Expand All @@ -14,10 +15,8 @@ export { parseDiffStats } from '../lib/adapters/pr-files-gitlab.js';

const inputSchema = z.object({
number: z.number().int().positive('number must be a positive integer'),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be owner/repo format')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
});

function envelope(payload: unknown) {
Expand Down
7 changes: 3 additions & 4 deletions handlers/pr_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z.object({
head: z.string().optional(),
base: z.string().optional(),
state: z.enum(['open', 'closed', 'merged', 'all']).optional().default('open'),
author: z.string().optional(),
limit: z.number().int().positive().optional().default(20),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be owner/repo format')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
});

function envelope(payload: unknown) {
Expand Down
7 changes: 3 additions & 4 deletions handlers/pr_merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@
import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z.object({
number: z.number().int().positive('number must be a positive integer'),
squash_message: z.string().optional(),
use_merge_queue: z.boolean().optional(),
skip_train: z.boolean().optional(),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be owner/repo format')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
});

function envelope(payload: unknown) {
Expand Down
7 changes: 3 additions & 4 deletions handlers/pr_merge_wait.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@
import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z.object({
number: z.number().int().positive('number must be a positive integer'),
squash_message: z.string().optional(),
use_merge_queue: z.boolean().optional(),
skip_train: z.boolean().optional(),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be owner/repo format')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
timeout_sec: z
.number()
.int()
Expand Down
7 changes: 3 additions & 4 deletions handlers/pr_status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z.object({
number: z.number().int().positive(),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be owner/repo format')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
});

function envelope(payload: unknown) {
Expand Down
7 changes: 3 additions & 4 deletions handlers/pr_wait_ci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ import {
type Deps,
} from '../lib/pr-wait-ci-poll.js';
import { snapshotGithub, classifyRollupItem } from '../lib/adapters/pr-wait-ci-github.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z
.object({
number: z.number().int().positive(),
poll_interval_sec: z.number().int().optional().default(30),
timeout_sec: z.number().int().positive().optional().default(1800),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be owner/repo format')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
})
.strict();

Expand Down
4 changes: 3 additions & 1 deletion handlers/wave_init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ import {
extendModePrescan, readPhasesWavesTotals, bootstrapKahunaBranch,
branchExistsOnRemote, type PlanData, type StateData,
} from '../lib/wave_init_plan.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z.object({
plan_json: z.string().min(1, 'plan_json must be a non-empty JSON string'),
extend: z.boolean().optional().default(false),
project_root: z.string().optional(),
repo: z.string().regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be owner/repo format').optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
kahuna: z.object({
plan_id: z.number().int().positive(),
slug: z.string().min(1).regex(/^[a-z0-9][a-z0-9-]*$/, 'slug must be kebab-case (lowercase, digits, hyphens)'),
Expand Down
7 changes: 3 additions & 4 deletions handlers/wave_reconcile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ import {
issueNumberFromBranch, computeDriftSets, hasDrift, renderDriftHaltComment,
type PlanData, type StateData,
} from '../lib/wave-reconcile.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z.object({
wave_id: z.string().optional(),
plan_issue_number: z.number().int().positive().optional(),
kahuna_branch: z.string().optional(),
timestamp: z.string().optional(),
repo: z
.string()
.regex(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/, 'repo must be owner/repo format')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
/**
* Dry-run: compute drift but skip the `pr_comment` side-effect. Test
* convenience + future support for a `/wave-reconcile --dry-run` CLI.
Expand Down
7 changes: 3 additions & 4 deletions handlers/work_item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import { z } from 'zod';
import type { HandlerDef } from '../types.js';
import { getAdapter } from '../lib/adapters/index.js';
import { repoOptionalSchema } from '../lib/schemas/repo.js';

const inputSchema = z.object({
type: z.enum(['epic', 'story', 'feature', 'bug', 'chore', 'docs', 'fix', 'pr', 'mr']),
Expand All @@ -22,10 +23,8 @@ const inputSchema = z.object({
head_branch: z.string().optional(),
base_branch: z.string().optional(),
draft: z.boolean().optional(),
repo: z
.string()
.regex(/^[a-zA-Z0-9._/-]+\/[a-zA-Z0-9._-]+$/, 'repo must be owner/repo format')
.optional(),
// GitLab nested groups need arbitrary `/` depth — see lib/schemas/repo.ts (#290).
repo: repoOptionalSchema,
});

function envelope(payload: unknown) {
Expand Down
Loading
Loading