Skip to content

Commit 5f321e8

Browse files
committed
github optionality
1 parent b203328 commit 5f321e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+307
-176
lines changed

apps/sim/tools/cursor/get_agent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const getAgentV2Tool: ToolConfig<GetAgentParams, GetAgentV2Response> = {
9494
status: data.status,
9595
source: data.source,
9696
target: data.target,
97-
summary: data.summary,
97+
summary: data.summary ?? null,
9898
createdAt: data.createdAt,
9999
},
100100
}

apps/sim/tools/cursor/list_agents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export const listAgentsV2Tool: ToolConfig<ListAgentsParams, ListAgentsV2Response
101101
success: true,
102102
output: {
103103
agents: data.agents,
104-
nextCursor: data.nextCursor,
104+
nextCursor: data.nextCursor ?? null,
105105
},
106106
}
107107
},

apps/sim/tools/github/add_assignees.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ export const addAssigneesV2Tool: ToolConfig<AddAssigneesParams, any> = {
125125
title: issue.title,
126126
state: issue.state,
127127
html_url: issue.html_url,
128-
body: issue.body,
128+
body: issue.body ?? null,
129129
user: issue.user,
130-
labels: issue.labels,
131-
assignees: issue.assignees,
130+
labels: issue.labels ?? [],
131+
assignees: issue.assignees ?? [],
132132
created_at: issue.created_at,
133133
updated_at: issue.updated_at,
134134
},
@@ -141,7 +141,7 @@ export const addAssigneesV2Tool: ToolConfig<AddAssigneesParams, any> = {
141141
title: { type: 'string', description: 'Issue title' },
142142
state: { type: 'string', description: 'Issue state' },
143143
html_url: { type: 'string', description: 'GitHub web URL' },
144-
body: { type: 'string', description: 'Issue body' },
144+
body: { type: 'string', description: 'Issue body', optional: true },
145145
user: { type: 'json', description: 'Issue creator' },
146146
labels: { type: 'array', description: 'Array of label objects' },
147147
assignees: { type: 'array', description: 'Array of assignee objects' },

apps/sim/tools/github/add_labels.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ export const addLabelsV2Tool: ToolConfig<AddLabelsParams, any> = {
108108
return {
109109
success: true,
110110
output: {
111-
items: labels,
111+
items: labels.map((label: any) => ({
112+
...label,
113+
description: label.description ?? null,
114+
})),
112115
count: labels.length,
113116
},
114117
}
@@ -124,7 +127,7 @@ export const addLabelsV2Tool: ToolConfig<AddLabelsParams, any> = {
124127
id: { type: 'number', description: 'Label ID' },
125128
name: { type: 'string', description: 'Label name' },
126129
color: { type: 'string', description: 'Label color' },
127-
description: { type: 'string', description: 'Label description' },
130+
description: { type: 'string', description: 'Label description', optional: true },
128131
},
129132
},
130133
},

apps/sim/tools/github/cancel_workflow_run.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ export const cancelWorkflowRunV2Tool: ToolConfig = {
136136
success: true,
137137
output: {
138138
cancelled: response.status === 202,
139-
run_id: params?.run_id || 0,
139+
run_id: params?.run_id ?? null,
140140
},
141141
}
142142
},
143143
outputs: {
144144
cancelled: { type: 'boolean', description: 'Whether cancellation was initiated' },
145-
run_id: { type: 'number', description: 'Workflow run ID' },
145+
run_id: { type: 'number', description: 'Workflow run ID', optional: true },
146146
},
147147
}

apps/sim/tools/github/close_issue.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ export const closeIssueV2Tool: ToolConfig<CloseIssueParams, any> = {
131131
number: issue.number,
132132
title: issue.title,
133133
state: issue.state,
134-
state_reason: issue.state_reason,
134+
state_reason: issue.state_reason ?? null,
135135
html_url: issue.html_url,
136-
body: issue.body,
136+
body: issue.body ?? null,
137137
user: issue.user,
138-
labels: issue.labels,
139-
assignees: issue.assignees,
140-
closed_at: issue.closed_at,
138+
labels: issue.labels ?? [],
139+
assignees: issue.assignees ?? [],
140+
closed_at: issue.closed_at ?? null,
141141
created_at: issue.created_at,
142142
updated_at: issue.updated_at,
143143
},
@@ -149,13 +149,13 @@ export const closeIssueV2Tool: ToolConfig<CloseIssueParams, any> = {
149149
number: { type: 'number', description: 'Issue number' },
150150
title: { type: 'string', description: 'Issue title' },
151151
state: { type: 'string', description: 'Issue state (closed)' },
152-
state_reason: { type: 'string', description: 'Reason for closing' },
152+
state_reason: { type: 'string', description: 'Reason for closing', optional: true },
153153
html_url: { type: 'string', description: 'GitHub web URL' },
154-
body: { type: 'string', description: 'Issue body' },
154+
body: { type: 'string', description: 'Issue body', optional: true },
155155
user: { type: 'json', description: 'User who created the issue' },
156156
labels: { type: 'array', description: 'Array of label objects' },
157157
assignees: { type: 'array', description: 'Array of assignee objects' },
158-
closed_at: { type: 'string', description: 'Close timestamp' },
158+
closed_at: { type: 'string', description: 'Close timestamp', optional: true },
159159
created_at: { type: 'string', description: 'Creation timestamp' },
160160
updated_at: { type: 'string', description: 'Last update timestamp' },
161161
},

apps/sim/tools/github/close_pr.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ export const closePRV2Tool: ToolConfig<ClosePRParams, any> = {
109109
title: pr.title,
110110
state: pr.state,
111111
html_url: pr.html_url,
112-
body: pr.body,
112+
body: pr.body ?? null,
113113
user: pr.user,
114114
head: pr.head,
115115
base: pr.base,
116116
draft: pr.draft,
117117
merged: pr.merged,
118-
closed_at: pr.closed_at,
118+
closed_at: pr.closed_at ?? null,
119119
created_at: pr.created_at,
120120
updated_at: pr.updated_at,
121121
},
@@ -128,13 +128,13 @@ export const closePRV2Tool: ToolConfig<ClosePRParams, any> = {
128128
title: { type: 'string', description: 'PR title' },
129129
state: { type: 'string', description: 'PR state (closed)' },
130130
html_url: { type: 'string', description: 'GitHub web URL' },
131-
body: { type: 'string', description: 'PR description' },
131+
body: { type: 'string', description: 'PR description', optional: true },
132132
user: { type: 'json', description: 'User who created the PR' },
133133
head: { type: 'json', description: 'Head branch info' },
134134
base: { type: 'json', description: 'Base branch info' },
135135
draft: { type: 'boolean', description: 'Whether PR is a draft' },
136136
merged: { type: 'boolean', description: 'Whether PR is merged' },
137-
closed_at: { type: 'string', description: 'Close timestamp' },
137+
closed_at: { type: 'string', description: 'Close timestamp', optional: true },
138138
created_at: { type: 'string', description: 'Creation timestamp' },
139139
updated_at: { type: 'string', description: 'Last update timestamp' },
140140
},

apps/sim/tools/github/comment.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ export const commentV2Tool: ToolConfig = {
156156
body: data.body,
157157
html_url: data.html_url,
158158
user: data.user,
159-
path: data.path,
160-
line: data.line || data.position,
161-
side: data.side,
162-
commit_id: data.commit_id,
159+
path: data.path ?? null,
160+
line: data.line ?? data.position ?? null,
161+
side: data.side ?? null,
162+
commit_id: data.commit_id ?? null,
163163
created_at: data.created_at,
164164
updated_at: data.updated_at,
165165
},
@@ -170,10 +170,10 @@ export const commentV2Tool: ToolConfig = {
170170
body: { type: 'string', description: 'Comment body' },
171171
html_url: { type: 'string', description: 'GitHub web URL' },
172172
user: { type: 'json', description: 'User who created the comment' },
173-
path: { type: 'string', description: 'File path (if file comment)' },
174-
line: { type: 'number', description: 'Line number' },
175-
side: { type: 'string', description: 'Diff side' },
176-
commit_id: { type: 'string', description: 'Commit ID' },
173+
path: { type: 'string', description: 'File path (if file comment)', optional: true },
174+
line: { type: 'number', description: 'Line number', optional: true },
175+
side: { type: 'string', description: 'Diff side', optional: true },
176+
commit_id: { type: 'string', description: 'Commit ID', optional: true },
177177
created_at: { type: 'string', description: 'Creation timestamp' },
178178
updated_at: { type: 'string', description: 'Last update timestamp' },
179179
},

apps/sim/tools/github/create_issue.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,14 @@ export const createIssueV2Tool: ToolConfig<CreateIssueParams, any> = {
160160
title: issue.title,
161161
state: issue.state,
162162
html_url: issue.html_url,
163-
body: issue.body,
163+
body: issue.body ?? null,
164164
user: issue.user,
165-
labels: issue.labels,
166-
assignees: issue.assignees,
167-
milestone: issue.milestone,
165+
labels: issue.labels ?? [],
166+
assignees: issue.assignees ?? [],
167+
milestone: issue.milestone ?? null,
168168
created_at: issue.created_at,
169169
updated_at: issue.updated_at,
170-
closed_at: issue.closed_at,
170+
closed_at: issue.closed_at ?? null,
171171
},
172172
}
173173
},
@@ -178,13 +178,13 @@ export const createIssueV2Tool: ToolConfig<CreateIssueParams, any> = {
178178
title: { type: 'string', description: 'Issue title' },
179179
state: { type: 'string', description: 'Issue state (open/closed)' },
180180
html_url: { type: 'string', description: 'GitHub web URL' },
181-
body: { type: 'string', description: 'Issue body/description' },
181+
body: { type: 'string', description: 'Issue body/description', optional: true },
182182
user: { type: 'json', description: 'User who created the issue' },
183183
labels: { type: 'array', description: 'Array of label objects' },
184184
assignees: { type: 'array', description: 'Array of assignee objects' },
185-
milestone: { type: 'json', description: 'Milestone object' },
185+
milestone: { type: 'json', description: 'Milestone object', optional: true },
186186
created_at: { type: 'string', description: 'Creation timestamp' },
187187
updated_at: { type: 'string', description: 'Last update timestamp' },
188-
closed_at: { type: 'string', description: 'Close timestamp' },
188+
closed_at: { type: 'string', description: 'Close timestamp', optional: true },
189189
},
190190
}

apps/sim/tools/github/create_pr.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ export const createPRV2Tool: ToolConfig<CreatePRParams, any> = {
137137
title: pr.title,
138138
state: pr.state,
139139
html_url: pr.html_url,
140-
body: pr.body,
140+
body: pr.body ?? null,
141141
user: pr.user,
142142
head: pr.head,
143143
base: pr.base,
144144
draft: pr.draft,
145145
merged: pr.merged,
146-
mergeable: pr.mergeable,
146+
mergeable: pr.mergeable ?? null,
147147
created_at: pr.created_at,
148148
updated_at: pr.updated_at,
149149
},
@@ -156,13 +156,13 @@ export const createPRV2Tool: ToolConfig<CreatePRParams, any> = {
156156
title: { type: 'string', description: 'PR title' },
157157
state: { type: 'string', description: 'PR state' },
158158
html_url: { type: 'string', description: 'GitHub web URL' },
159-
body: { type: 'string', description: 'PR description' },
159+
body: { type: 'string', description: 'PR description', optional: true },
160160
user: { type: 'json', description: 'User who created the PR' },
161161
head: { type: 'json', description: 'Head branch info' },
162162
base: { type: 'json', description: 'Base branch info' },
163163
draft: { type: 'boolean', description: 'Whether PR is a draft' },
164164
merged: { type: 'boolean', description: 'Whether PR is merged' },
165-
mergeable: { type: 'boolean', description: 'Whether PR is mergeable' },
165+
mergeable: { type: 'boolean', description: 'Whether PR is mergeable', optional: true },
166166
created_at: { type: 'string', description: 'Creation timestamp' },
167167
updated_at: { type: 'string', description: 'Last update timestamp' },
168168
},

0 commit comments

Comments
 (0)