mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 23:17:59 -05:00
Compare commits
2 Commits
v0.5.55
...
fix/linear
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e75f44b65 | ||
|
|
780b4fe22d |
@@ -77,7 +77,6 @@ export const LinearBlock: BlockConfig<LinearResponse> = {
|
||||
// Project Update Operations
|
||||
{ label: 'Create Project Update', id: 'linear_create_project_update' },
|
||||
{ label: 'List Project Updates', id: 'linear_list_project_updates' },
|
||||
{ label: 'Create Project Link', id: 'linear_create_project_link' },
|
||||
// Notification Operations
|
||||
{ label: 'List Notifications', id: 'linear_list_notifications' },
|
||||
{ label: 'Update Notification', id: 'linear_update_notification' },
|
||||
@@ -227,6 +226,7 @@ export const LinearBlock: BlockConfig<LinearResponse> = {
|
||||
'linear_update_project',
|
||||
'linear_archive_project',
|
||||
'linear_delete_project',
|
||||
'linear_create_project_update',
|
||||
'linear_list_project_updates',
|
||||
],
|
||||
},
|
||||
@@ -239,6 +239,7 @@ export const LinearBlock: BlockConfig<LinearResponse> = {
|
||||
'linear_update_project',
|
||||
'linear_archive_project',
|
||||
'linear_delete_project',
|
||||
'linear_create_project_update',
|
||||
'linear_list_project_updates',
|
||||
'linear_list_project_labels',
|
||||
],
|
||||
@@ -261,7 +262,6 @@ export const LinearBlock: BlockConfig<LinearResponse> = {
|
||||
'linear_delete_project',
|
||||
'linear_create_project_update',
|
||||
'linear_list_project_updates',
|
||||
'linear_create_project_link',
|
||||
],
|
||||
},
|
||||
condition: {
|
||||
@@ -275,7 +275,6 @@ export const LinearBlock: BlockConfig<LinearResponse> = {
|
||||
'linear_delete_project',
|
||||
'linear_create_project_update',
|
||||
'linear_list_project_updates',
|
||||
'linear_create_project_link',
|
||||
'linear_list_project_labels',
|
||||
],
|
||||
},
|
||||
@@ -625,7 +624,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
required: true,
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['linear_create_attachment', 'linear_create_project_link'],
|
||||
value: ['linear_create_attachment'],
|
||||
},
|
||||
},
|
||||
// Attachment title
|
||||
@@ -1221,6 +1220,36 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
value: ['linear_create_project_status'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'projectStatusType',
|
||||
title: 'Status Type',
|
||||
type: 'dropdown',
|
||||
options: [
|
||||
{ label: 'Backlog', id: 'backlog' },
|
||||
{ label: 'Planned', id: 'planned' },
|
||||
{ label: 'Started', id: 'started' },
|
||||
{ label: 'Paused', id: 'paused' },
|
||||
{ label: 'Completed', id: 'completed' },
|
||||
{ label: 'Canceled', id: 'canceled' },
|
||||
],
|
||||
value: () => 'started',
|
||||
required: true,
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['linear_create_project_status'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'projectStatusPosition',
|
||||
title: 'Position',
|
||||
type: 'short-input',
|
||||
placeholder: 'Enter position (e.g. 0, 1, 2...)',
|
||||
required: true,
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['linear_create_project_status'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'projectStatusId',
|
||||
title: 'Status ID',
|
||||
@@ -1326,7 +1355,6 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
'linear_list_favorites',
|
||||
'linear_create_project_update',
|
||||
'linear_list_project_updates',
|
||||
'linear_create_project_link',
|
||||
'linear_list_notifications',
|
||||
'linear_update_notification',
|
||||
'linear_create_customer',
|
||||
@@ -1772,17 +1800,6 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
projectId: effectiveProjectId,
|
||||
}
|
||||
|
||||
case 'linear_create_project_link':
|
||||
if (!effectiveProjectId || !params.url?.trim()) {
|
||||
throw new Error('Project ID and URL are required.')
|
||||
}
|
||||
return {
|
||||
...baseParams,
|
||||
projectId: effectiveProjectId,
|
||||
url: params.url.trim(),
|
||||
label: params.name,
|
||||
}
|
||||
|
||||
case 'linear_list_notifications':
|
||||
return baseParams
|
||||
|
||||
@@ -2033,22 +2050,22 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
}
|
||||
|
||||
case 'linear_add_label_to_project':
|
||||
if (!effectiveProjectId || !params.projectLabelId?.trim()) {
|
||||
if (!params.projectIdForMilestone?.trim() || !params.projectLabelId?.trim()) {
|
||||
throw new Error('Project ID and label ID are required.')
|
||||
}
|
||||
return {
|
||||
...baseParams,
|
||||
projectId: effectiveProjectId,
|
||||
projectId: params.projectIdForMilestone.trim(),
|
||||
labelId: params.projectLabelId.trim(),
|
||||
}
|
||||
|
||||
case 'linear_remove_label_from_project':
|
||||
if (!effectiveProjectId || !params.projectLabelId?.trim()) {
|
||||
if (!params.projectIdForMilestone?.trim() || !params.projectLabelId?.trim()) {
|
||||
throw new Error('Project ID and label ID are required.')
|
||||
}
|
||||
return {
|
||||
...baseParams,
|
||||
projectId: effectiveProjectId,
|
||||
projectId: params.projectIdForMilestone.trim(),
|
||||
labelId: params.projectLabelId.trim(),
|
||||
}
|
||||
|
||||
@@ -2097,13 +2114,20 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
|
||||
// Project Status Operations
|
||||
case 'linear_create_project_status':
|
||||
if (!params.projectStatusName?.trim() || !params.statusColor?.trim()) {
|
||||
throw new Error('Project status name and color are required.')
|
||||
if (
|
||||
!params.projectStatusName?.trim() ||
|
||||
!params.projectStatusType?.trim() ||
|
||||
!params.statusColor?.trim() ||
|
||||
!params.projectStatusPosition?.trim()
|
||||
) {
|
||||
throw new Error('Project status name, type, color, and position are required.')
|
||||
}
|
||||
return {
|
||||
...baseParams,
|
||||
name: params.projectStatusName.trim(),
|
||||
type: params.projectStatusType.trim(),
|
||||
color: params.statusColor.trim(),
|
||||
position: Number.parseFloat(params.projectStatusPosition.trim()),
|
||||
description: params.projectStatusDescription?.trim() || undefined,
|
||||
indefinite: params.projectStatusIndefinite === 'true',
|
||||
}
|
||||
@@ -2270,7 +2294,6 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
// Project update outputs
|
||||
update: { type: 'json', description: 'Project update data' },
|
||||
updates: { type: 'json', description: 'Project updates list' },
|
||||
link: { type: 'json', description: 'Project link data' },
|
||||
// Notification outputs
|
||||
notification: { type: 'json', description: 'Notification data' },
|
||||
notifications: { type: 'json', description: 'Notifications list' },
|
||||
|
||||
@@ -19,12 +19,6 @@ export const linearCreateProjectLabelTool: ToolConfig<
|
||||
},
|
||||
|
||||
params: {
|
||||
projectId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The project for this label',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
@@ -71,7 +65,6 @@ export const linearCreateProjectLabelTool: ToolConfig<
|
||||
},
|
||||
body: (params) => {
|
||||
const input: Record<string, any> = {
|
||||
projectId: params.projectId,
|
||||
name: params.name,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
import type {
|
||||
LinearCreateProjectLinkParams,
|
||||
LinearCreateProjectLinkResponse,
|
||||
} from '@/tools/linear/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const linearCreateProjectLinkTool: ToolConfig<
|
||||
LinearCreateProjectLinkParams,
|
||||
LinearCreateProjectLinkResponse
|
||||
> = {
|
||||
id: 'linear_create_project_link',
|
||||
name: 'Linear Create Project Link',
|
||||
description: 'Add an external link to a project in Linear',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'linear',
|
||||
},
|
||||
|
||||
params: {
|
||||
projectId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Project ID to add link to',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'URL of the external link',
|
||||
},
|
||||
label: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Link label/title',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: 'https://api.linear.app/graphql',
|
||||
method: 'POST',
|
||||
headers: (params) => {
|
||||
if (!params.accessToken) {
|
||||
throw new Error('Missing access token for Linear API request')
|
||||
}
|
||||
return {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${params.accessToken}`,
|
||||
}
|
||||
},
|
||||
body: (params) => {
|
||||
const input: Record<string, any> = {
|
||||
projectId: params.projectId,
|
||||
url: params.url,
|
||||
}
|
||||
|
||||
if (params.label != null && params.label !== '') input.label = params.label
|
||||
|
||||
return {
|
||||
query: `
|
||||
mutation CreateProjectLink($input: ProjectLinkCreateInput!) {
|
||||
projectLinkCreate(input: $input) {
|
||||
success
|
||||
projectLink {
|
||||
id
|
||||
url
|
||||
label
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
input,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (data.errors) {
|
||||
return {
|
||||
success: false,
|
||||
error: data.errors[0]?.message || 'Failed to create project link',
|
||||
output: {},
|
||||
}
|
||||
}
|
||||
|
||||
const result = data.data.projectLinkCreate
|
||||
if (!result.success) {
|
||||
return {
|
||||
success: false,
|
||||
error: 'Project link creation was not successful',
|
||||
output: {},
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
link: result.projectLink,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
link: {
|
||||
type: 'object',
|
||||
description: 'The created project link',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Link ID' },
|
||||
url: { type: 'string', description: 'Link URL' },
|
||||
label: { type: 'string', description: 'Link label' },
|
||||
createdAt: { type: 'string', description: 'Creation timestamp' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -19,24 +19,31 @@ export const linearCreateProjectStatusTool: ToolConfig<
|
||||
},
|
||||
|
||||
params: {
|
||||
projectId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The project to create the status for',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Project status name',
|
||||
},
|
||||
type: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Status type: "backlog", "planned", "started", "paused", "completed", or "canceled"',
|
||||
},
|
||||
color: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Status color (hex code)',
|
||||
},
|
||||
position: {
|
||||
type: 'number',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Position in status list (e.g. 0, 1, 2...)',
|
||||
},
|
||||
description: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
@@ -49,12 +56,6 @@ export const linearCreateProjectStatusTool: ToolConfig<
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether the status is indefinite',
|
||||
},
|
||||
position: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Position in status list',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
@@ -71,9 +72,10 @@ export const linearCreateProjectStatusTool: ToolConfig<
|
||||
},
|
||||
body: (params) => {
|
||||
const input: Record<string, any> = {
|
||||
projectId: params.projectId,
|
||||
name: params.name,
|
||||
type: params.type,
|
||||
color: params.color,
|
||||
position: params.position,
|
||||
}
|
||||
|
||||
if (params.description != null && params.description !== '') {
|
||||
@@ -82,9 +84,6 @@ export const linearCreateProjectStatusTool: ToolConfig<
|
||||
if (params.indefinite != null) {
|
||||
input.indefinite = params.indefinite
|
||||
}
|
||||
if (params.position != null) {
|
||||
input.position = params.position
|
||||
}
|
||||
|
||||
return {
|
||||
query: `
|
||||
|
||||
@@ -16,7 +16,6 @@ import { linearCreateIssueRelationTool } from '@/tools/linear/create_issue_relat
|
||||
import { linearCreateLabelTool } from '@/tools/linear/create_label'
|
||||
import { linearCreateProjectTool } from '@/tools/linear/create_project'
|
||||
import { linearCreateProjectLabelTool } from '@/tools/linear/create_project_label'
|
||||
import { linearCreateProjectLinkTool } from '@/tools/linear/create_project_link'
|
||||
import { linearCreateProjectMilestoneTool } from '@/tools/linear/create_project_milestone'
|
||||
import { linearCreateProjectStatusTool } from '@/tools/linear/create_project_status'
|
||||
import { linearCreateProjectUpdateTool } from '@/tools/linear/create_project_update'
|
||||
@@ -138,7 +137,6 @@ export {
|
||||
linearListFavoritesTool,
|
||||
linearCreateProjectUpdateTool,
|
||||
linearListProjectUpdatesTool,
|
||||
linearCreateProjectLinkTool,
|
||||
linearListNotificationsTool,
|
||||
linearUpdateNotificationTool,
|
||||
linearCreateCustomerTool,
|
||||
|
||||
@@ -454,13 +454,6 @@ export interface LinearListProjectUpdatesParams {
|
||||
accessToken?: string
|
||||
}
|
||||
|
||||
export interface LinearCreateProjectLinkParams {
|
||||
projectId: string
|
||||
url: string
|
||||
label?: string
|
||||
accessToken?: string
|
||||
}
|
||||
|
||||
export interface LinearListNotificationsParams {
|
||||
first?: number
|
||||
after?: string
|
||||
@@ -843,19 +836,6 @@ export interface LinearListProjectUpdatesResponse extends ToolResponse {
|
||||
}
|
||||
}
|
||||
|
||||
export interface LinearProjectLink {
|
||||
id: string
|
||||
url: string
|
||||
label: string
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export interface LinearCreateProjectLinkResponse extends ToolResponse {
|
||||
output: {
|
||||
link?: LinearProjectLink
|
||||
}
|
||||
}
|
||||
|
||||
export interface LinearNotification {
|
||||
id: string
|
||||
type: string
|
||||
@@ -1205,7 +1185,6 @@ export interface LinearProjectLabel {
|
||||
}
|
||||
|
||||
export interface LinearCreateProjectLabelParams {
|
||||
projectId: string
|
||||
name: string
|
||||
color?: string
|
||||
description?: string
|
||||
@@ -1358,12 +1337,12 @@ export interface LinearProjectStatus {
|
||||
}
|
||||
|
||||
export interface LinearCreateProjectStatusParams {
|
||||
projectId: string
|
||||
name: string
|
||||
type: 'backlog' | 'planned' | 'started' | 'paused' | 'completed' | 'canceled'
|
||||
color: string
|
||||
position: number
|
||||
description?: string
|
||||
indefinite?: boolean
|
||||
position?: number
|
||||
accessToken?: string
|
||||
}
|
||||
|
||||
@@ -1468,7 +1447,6 @@ export type LinearResponse =
|
||||
| LinearListFavoritesResponse
|
||||
| LinearCreateProjectUpdateResponse
|
||||
| LinearListProjectUpdatesResponse
|
||||
| LinearCreateProjectLinkResponse
|
||||
| LinearListNotificationsResponse
|
||||
| LinearUpdateNotificationResponse
|
||||
| LinearCreateCustomerResponse
|
||||
|
||||
@@ -567,7 +567,6 @@ import {
|
||||
linearCreateIssueTool,
|
||||
linearCreateLabelTool,
|
||||
linearCreateProjectLabelTool,
|
||||
linearCreateProjectLinkTool,
|
||||
linearCreateProjectMilestoneTool,
|
||||
linearCreateProjectStatusTool,
|
||||
linearCreateProjectTool,
|
||||
@@ -2187,7 +2186,6 @@ export const tools: Record<string, ToolConfig> = {
|
||||
linear_list_favorites: linearListFavoritesTool,
|
||||
linear_create_project_update: linearCreateProjectUpdateTool,
|
||||
linear_list_project_updates: linearListProjectUpdatesTool,
|
||||
linear_create_project_link: linearCreateProjectLinkTool,
|
||||
linear_list_notifications: linearListNotificationsTool,
|
||||
linear_update_notification: linearUpdateNotificationTool,
|
||||
linear_create_customer: linearCreateCustomerTool,
|
||||
|
||||
Reference in New Issue
Block a user