linear-rb 0.1.0 → 0.1.1
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 +4 -4
- data/bin/linear +11 -0
- data/lib/linear/commands.rb +36 -0
- data/lib/linear/queries.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d9c94b7659e207b517fcf2960b83390d2c7a4e17d6ea02e59d5079730eca3da5
|
|
4
|
+
data.tar.gz: bbee449d73c50d2c6c623e138fd983faa46f98017ee9d8125b867d4902433452
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1cbe8c882e24fe6acd64f086b97e45f40cbf2029191b92f0d0be00a83e5b3cc0ece68d4b11bb6ae037c943e0efb704ee6f7fe83e8ccfe7dd98198f8c91969151
|
|
7
|
+
data.tar.gz: 69bba6defc5690f2663b1868cc14ca1e789177f8ce00d352484101b7ae3a53785d981cb3cd9447aa9df95e0238b551fb52fb4ca889802d6558805b88e8e37f40
|
data/bin/linear
CHANGED
|
@@ -12,6 +12,7 @@ def show_usage
|
|
|
12
12
|
linear search QUERY [OPTIONS] Search for issues
|
|
13
13
|
linear mine Show issues assigned to you
|
|
14
14
|
linear teams List all teams
|
|
15
|
+
linear projects List all projects
|
|
15
16
|
linear comment ISSUE_ID COMMENT Add a comment to an issue
|
|
16
17
|
linear update ISSUE_ID STATE Update issue state
|
|
17
18
|
|
|
@@ -23,6 +24,8 @@ def show_usage
|
|
|
23
24
|
linear issue ENG-123
|
|
24
25
|
linear search "bug fix" --team=ENG --state=Backlog
|
|
25
26
|
linear mine
|
|
27
|
+
linear teams
|
|
28
|
+
linear projects
|
|
26
29
|
linear comment FAT-85 "This is done"
|
|
27
30
|
linear update FAT-85 "Done"
|
|
28
31
|
|
|
@@ -87,6 +90,14 @@ when 'teams'
|
|
|
87
90
|
exit 1
|
|
88
91
|
end
|
|
89
92
|
|
|
93
|
+
when 'projects'
|
|
94
|
+
begin
|
|
95
|
+
Linear::Commands.list_projects
|
|
96
|
+
rescue => e
|
|
97
|
+
puts "Error: #{e.message}"
|
|
98
|
+
exit 1
|
|
99
|
+
end
|
|
100
|
+
|
|
90
101
|
when 'comment'
|
|
91
102
|
issue_id = ARGV.shift
|
|
92
103
|
comment_body = ARGV.shift
|
data/lib/linear/commands.rb
CHANGED
|
@@ -48,6 +48,17 @@ module Linear
|
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
+
def list_projects(client: Client.new)
|
|
52
|
+
result = client.query(Queries::PROJECTS)
|
|
53
|
+
|
|
54
|
+
projects = result.dig("data", "projects", "nodes") || []
|
|
55
|
+
if projects.empty?
|
|
56
|
+
puts "No projects found"
|
|
57
|
+
else
|
|
58
|
+
display_project_list(projects)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
51
62
|
def add_comment(issue_id, body, client: Client.new)
|
|
52
63
|
# First get the issue to get its internal ID
|
|
53
64
|
issue_result = client.query(Queries::ISSUE, { id: issue_id })
|
|
@@ -178,5 +189,30 @@ module Linear
|
|
|
178
189
|
else "Unknown"
|
|
179
190
|
end
|
|
180
191
|
end
|
|
192
|
+
|
|
193
|
+
def display_project_list(projects)
|
|
194
|
+
puts "\nFound #{projects.length} project(s):\n\n"
|
|
195
|
+
projects.each do |project|
|
|
196
|
+
state_badge = "[#{project['state']}]".ljust(15)
|
|
197
|
+
progress = project['progress'] ? "#{(project['progress'] * 100).round}%" : "0%"
|
|
198
|
+
progress_badge = progress.ljust(6)
|
|
199
|
+
lead = (project.dig('lead', 'name') || 'No lead').ljust(20)
|
|
200
|
+
|
|
201
|
+
puts "#{project['name'].ljust(30)} #{state_badge} #{progress_badge} #{lead}"
|
|
202
|
+
|
|
203
|
+
if project['description'] && !project['description'].empty?
|
|
204
|
+
# Show first line of description
|
|
205
|
+
first_line = project['description'].lines.first&.strip
|
|
206
|
+
puts " #{first_line[0..80]}#{'...' if first_line && first_line.length > 80}" if first_line
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
if project['targetDate']
|
|
210
|
+
puts " Target: #{project['targetDate']}"
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
puts " URL: #{project['url']}" if project['url']
|
|
214
|
+
puts ""
|
|
215
|
+
end
|
|
216
|
+
end
|
|
181
217
|
end
|
|
182
218
|
end
|
data/lib/linear/queries.rb
CHANGED
|
@@ -76,6 +76,27 @@ module Linear
|
|
|
76
76
|
}
|
|
77
77
|
GQL
|
|
78
78
|
|
|
79
|
+
PROJECTS = <<~GQL
|
|
80
|
+
query {
|
|
81
|
+
projects {
|
|
82
|
+
nodes {
|
|
83
|
+
id
|
|
84
|
+
name
|
|
85
|
+
description
|
|
86
|
+
state
|
|
87
|
+
progress
|
|
88
|
+
startDate
|
|
89
|
+
targetDate
|
|
90
|
+
url
|
|
91
|
+
lead {
|
|
92
|
+
name
|
|
93
|
+
email
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
GQL
|
|
99
|
+
|
|
79
100
|
WORKFLOW_STATES = <<~GQL
|
|
80
101
|
query($teamId: String!) {
|
|
81
102
|
team(id: $teamId) {
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: linear-rb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dave Kinkead
|
|
@@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
57
57
|
- !ruby/object:Gem::Version
|
|
58
58
|
version: '0'
|
|
59
59
|
requirements: []
|
|
60
|
-
rubygems_version:
|
|
60
|
+
rubygems_version: 4.0.1
|
|
61
61
|
specification_version: 4
|
|
62
62
|
summary: Ruby CLI wrapper for Linear GraphQL API
|
|
63
63
|
test_files: []
|