linear-toon-mcp 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a82a2dde95135b746bb825b13212ff5c3121f2d261112f48720a476b714bb52
|
|
4
|
+
data.tar.gz: f2cad1dd863fb879e406dd4454ed300d537c04c2b4e8722e6ba4da9cc3d9306e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5f9fdb4ff94f7d28432aa87df672c012fbb90b3e3eecfc5cf3d9421823c7550ee6f8591078b51390f3a285ad891bef228d7331e60d7cfe09163b66415d9b1a5c
|
|
7
|
+
data.tar.gz: 9e88a4e422ef214f46dfc502f4b2edeb974679f57807305915577b94dd00e3653eaa2f9ff3877431951b16f045919652135d0960bfb2c8e688cdbfca0451f987
|
|
@@ -31,7 +31,6 @@ module LinearToonMcp
|
|
|
31
31
|
estimate: {type: "number", description: "Issue estimate value"},
|
|
32
32
|
dueDate: {type: "string", description: "Due date (ISO format)"},
|
|
33
33
|
parentId: {type: "string", description: "Parent issue ID"},
|
|
34
|
-
blockedBy: {type: "array", items: {type: "string"}, description: "Issue IDs/identifiers blocking this"},
|
|
35
34
|
blocks: {type: "array", items: {type: "string"}, description: "Issue IDs/identifiers this blocks"},
|
|
36
35
|
relatedTo: {type: "array", items: {type: "string"}, description: "Related issue IDs/identifiers"},
|
|
37
36
|
duplicateOf: {type: "string", description: "Duplicate of issue ID/identifier"},
|
|
@@ -93,10 +92,10 @@ module LinearToonMcp
|
|
|
93
92
|
raise Error, "Issue creation failed" unless result["success"]
|
|
94
93
|
|
|
95
94
|
issue = result["issue"]
|
|
96
|
-
|
|
97
|
-
create_links(client, issue["id"], kwargs[:links])
|
|
95
|
+
warnings = post_create(client, issue["id"], **kwargs)
|
|
98
96
|
|
|
99
97
|
text = Toon.encode(issue)
|
|
98
|
+
text += "\nWARNING (issue was created): #{warnings.join("; ")}" if warnings.any?
|
|
100
99
|
MCP::Tool::Response.new([{type: "text", text:}])
|
|
101
100
|
rescue Error => e
|
|
102
101
|
MCP::Tool::Response.new([{type: "text", text: e.message}], error: true)
|
|
@@ -104,6 +103,21 @@ module LinearToonMcp
|
|
|
104
103
|
|
|
105
104
|
private
|
|
106
105
|
|
|
106
|
+
def post_create(client, issue_id, links: nil, **kwargs)
|
|
107
|
+
warnings = []
|
|
108
|
+
begin
|
|
109
|
+
create_relations(client, issue_id, **kwargs)
|
|
110
|
+
rescue Error => e
|
|
111
|
+
warnings << e.message
|
|
112
|
+
end
|
|
113
|
+
begin
|
|
114
|
+
create_links(client, issue_id, links)
|
|
115
|
+
rescue Error => e
|
|
116
|
+
warnings << e.message
|
|
117
|
+
end
|
|
118
|
+
warnings
|
|
119
|
+
end
|
|
120
|
+
|
|
107
121
|
def add_direct_fields(input, description: nil, priority: nil, estimate: nil,
|
|
108
122
|
dueDate: nil, parentId: nil, **)
|
|
109
123
|
input[:description] = description if description
|
|
@@ -127,8 +141,7 @@ module LinearToonMcp
|
|
|
127
141
|
end
|
|
128
142
|
end
|
|
129
143
|
|
|
130
|
-
def create_relations(client, issue_id,
|
|
131
|
-
Array(blockedBy).each { |id| create_relation(client, issue_id, id, "isBlockedBy") }
|
|
144
|
+
def create_relations(client, issue_id, blocks: nil, relatedTo: nil, duplicateOf: nil, **)
|
|
132
145
|
Array(blocks).each { |id| create_relation(client, issue_id, id, "blocks") }
|
|
133
146
|
Array(relatedTo).each { |id| create_relation(client, issue_id, id, "related") }
|
|
134
147
|
create_relation(client, issue_id, duplicateOf, "duplicate") if duplicateOf
|
|
@@ -145,9 +158,9 @@ module LinearToonMcp
|
|
|
145
158
|
return unless links
|
|
146
159
|
|
|
147
160
|
links.each do |link|
|
|
148
|
-
data = client.query(LINK_MUTATION, variables: {url: link[
|
|
161
|
+
data = client.query(LINK_MUTATION, variables: {url: link[:url], issueId: issue_id, title: link[:title]})
|
|
149
162
|
next if data.dig("attachmentLinkURL", "success")
|
|
150
|
-
raise Error, "Failed to attach link: #{link[
|
|
163
|
+
raise Error, "Failed to attach link: #{link[:url]}"
|
|
151
164
|
end
|
|
152
165
|
end
|
|
153
166
|
end
|
|
@@ -31,7 +31,6 @@ module LinearToonMcp
|
|
|
31
31
|
estimate: {type: "number", description: "Issue estimate value"},
|
|
32
32
|
dueDate: {type: "string", description: "Due date (ISO format)"},
|
|
33
33
|
parentId: {type: ["string", "null"], description: "Parent issue ID. Null to remove"},
|
|
34
|
-
blockedBy: {type: "array", items: {type: "string"}, description: "Issue IDs blocking this. Replaces existing; omit to keep unchanged"},
|
|
35
34
|
blocks: {type: "array", items: {type: "string"}, description: "Issue IDs this blocks. Replaces existing; omit to keep unchanged"},
|
|
36
35
|
relatedTo: {type: "array", items: {type: "string"}, description: "Related issue IDs. Replaces existing; omit to keep unchanged"},
|
|
37
36
|
duplicateOf: {type: ["string", "null"], description: "Duplicate of issue ID. Null to remove"},
|
|
@@ -93,7 +92,6 @@ module LinearToonMcp
|
|
|
93
92
|
GRAPHQL
|
|
94
93
|
|
|
95
94
|
RELATION_TYPE_MAP = {
|
|
96
|
-
blockedBy: "isBlockedBy",
|
|
97
95
|
blocks: "blocks",
|
|
98
96
|
relatedTo: "related",
|
|
99
97
|
duplicateOf: "duplicate"
|
|
@@ -117,10 +115,10 @@ module LinearToonMcp
|
|
|
117
115
|
raise Error, "Issue update failed" unless result["success"]
|
|
118
116
|
|
|
119
117
|
issue = result["issue"]
|
|
120
|
-
|
|
121
|
-
create_links(client, id, kwargs[:links])
|
|
118
|
+
warnings = post_update(client, id, **kwargs)
|
|
122
119
|
|
|
123
120
|
text = Toon.encode(issue)
|
|
121
|
+
text += "\nWARNING (issue was updated): #{warnings.join("; ")}" if warnings.any?
|
|
124
122
|
MCP::Tool::Response.new([{type: "text", text:}])
|
|
125
123
|
rescue Error => e
|
|
126
124
|
MCP::Tool::Response.new([{type: "text", text: e.message}], error: true)
|
|
@@ -128,6 +126,21 @@ module LinearToonMcp
|
|
|
128
126
|
|
|
129
127
|
private
|
|
130
128
|
|
|
129
|
+
def post_update(client, issue_id, links: nil, **kwargs)
|
|
130
|
+
warnings = []
|
|
131
|
+
begin
|
|
132
|
+
replace_relations(client, issue_id, kwargs)
|
|
133
|
+
rescue Error => e
|
|
134
|
+
warnings << e.message
|
|
135
|
+
end
|
|
136
|
+
begin
|
|
137
|
+
create_links(client, issue_id, links)
|
|
138
|
+
rescue Error => e
|
|
139
|
+
warnings << e.message
|
|
140
|
+
end
|
|
141
|
+
warnings
|
|
142
|
+
end
|
|
143
|
+
|
|
131
144
|
def resolve_team_id(client, issue_id, kwargs)
|
|
132
145
|
return Resolvers.resolve_team(client, kwargs[:team]) if kwargs.key?(:team)
|
|
133
146
|
return unless needs_team_id?(kwargs)
|
|
@@ -208,10 +221,10 @@ module LinearToonMcp
|
|
|
208
221
|
return unless links
|
|
209
222
|
|
|
210
223
|
links.each do |link|
|
|
211
|
-
vars = {url: link[
|
|
224
|
+
vars = {url: link[:url], issueId: issue_id, title: link[:title]}
|
|
212
225
|
data = client.query(LINK_MUTATION, variables: vars)
|
|
213
226
|
next if data.dig("attachmentLinkURL", "success")
|
|
214
|
-
raise Error, "Failed to attach link: #{link[
|
|
227
|
+
raise Error, "Failed to attach link: #{link[:url]}"
|
|
215
228
|
end
|
|
216
229
|
end
|
|
217
230
|
end
|