a4c7c0fc15
* plan: issue 447 run artifact tracking and UI (supersedes stale pill notes) Made-with: Cursor * feat: workflow run artifact urls, chips, and safe PATCH validation Made-with: Cursor * chore(action): refresh latest-by-provider model snapshot Made-with: Cursor * refactor: resolve artifact urls via GraphQL nodes(ids), drop stored url columns Made-with: Cursor * docs: finalize issue 447 run-artifacts plan; remove demo backfill script Made-with: Cursor * refactor: DRY node-id constraint, replace margin with padding wrapper Made-with: Cursor * refactor: DRY audit — shared row info, derived types, unified Prisma select - extract WorkflowRunRowInfo component (description + issue link + time + pills) shared by ActiveWorkflowRunsSection and WorkflowRunHistory - derive API payload types via Omit + & instead of manual field lists; serialize with spread + override for bigint/date fields - extract workflowRunListSelect shared Prisma select base; history extends with completedAt - inline updateCommentNodeId → direct patchWorkflowRunFields calls - derive WorkflowRunArtifactSlice from canonical exported types - delete cancelling-out URL column migrations (no schema change vs main) Made-with: Cursor * refactor: artifact chips as inline CTAs with proper vertical alignment - chips now render as action links: "Open PR #N", "View summary", etc. - only render chips with resolved URLs; remove inert span fallback - inline chips in the row (right-justified) instead of a separate line - fix vertical alignment: remove ul/li wrappers that caused line-height mismatch, render chips as direct row siblings via flat flex layout - change row to items-center, remove compensating self-start/pt nudges - cancelled run X icon uses red-600 Made-with: Cursor * chore(action): refresh latest-by-provider model snapshot Made-with: Cursor --------- Co-authored-by: Colin McDonnell <colinmcd94@gmail.com>
57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
import { type } from "arktype";
|
|
import { fixDoubleEscapedString } from "../utils/fixDoubleEscapedString.ts";
|
|
import { patchWorkflowRunFields } from "../utils/patchWorkflowRunFields.ts";
|
|
import type { ToolContext } from "./server.ts";
|
|
import { execute, tool } from "./shared.ts";
|
|
|
|
export const Issue = type({
|
|
title: type.string.describe("the title of the issue"),
|
|
body: type.string.describe("the body content of the issue"),
|
|
labels: type.string
|
|
.array()
|
|
.describe("optional array of label names to apply to the issue")
|
|
.optional(),
|
|
assignees: type.string
|
|
.array()
|
|
.describe("optional array of usernames to assign to the issue")
|
|
.optional(),
|
|
});
|
|
|
|
export function IssueTool(ctx: ToolContext) {
|
|
return tool({
|
|
name: "create_issue",
|
|
description: "Create a new GitHub issue",
|
|
parameters: Issue,
|
|
execute: execute(async (params) => {
|
|
const result = await ctx.octokit.rest.issues.create({
|
|
owner: ctx.repo.owner,
|
|
repo: ctx.repo.name,
|
|
title: params.title,
|
|
body: fixDoubleEscapedString(params.body),
|
|
labels: params.labels ?? [],
|
|
assignees: params.assignees ?? [],
|
|
});
|
|
|
|
const nodeId = result.data.node_id;
|
|
if (typeof nodeId === "string" && nodeId.length > 0) {
|
|
await patchWorkflowRunFields(ctx, {
|
|
issueNodeId: nodeId,
|
|
});
|
|
}
|
|
|
|
return {
|
|
success: true,
|
|
issueId: result.data.id,
|
|
number: result.data.number,
|
|
url: result.data.html_url,
|
|
title: result.data.title,
|
|
state: result.data.state,
|
|
labels: result.data.labels?.map((label) =>
|
|
typeof label === "string" ? label : label.name
|
|
),
|
|
assignees: result.data.assignees?.map((assignee) => assignee.login),
|
|
};
|
|
}),
|
|
});
|
|
}
|