linear-rb 0.1.1 → 0.2.0

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: d9c94b7659e207b517fcf2960b83390d2c7a4e17d6ea02e59d5079730eca3da5
4
- data.tar.gz: bbee449d73c50d2c6c623e138fd983faa46f98017ee9d8125b867d4902433452
3
+ metadata.gz: 1da26699f5a96c66c0ab9eaff87b6d6b0af051810e289ba0fd7474d5874c2e8d
4
+ data.tar.gz: 61c18f121fc85cd46821d4291f49021cd2d2e9334e0b75ec8d54fffb4b16f840
5
5
  SHA512:
6
- metadata.gz: 1cbe8c882e24fe6acd64f086b97e45f40cbf2029191b92f0d0be00a83e5b3cc0ece68d4b11bb6ae037c943e0efb704ee6f7fe83e8ccfe7dd98198f8c91969151
7
- data.tar.gz: 69bba6defc5690f2663b1868cc14ca1e789177f8ce00d352484101b7ae3a53785d981cb3cd9447aa9df95e0238b551fb52fb4ca889802d6558805b88e8e37f40
6
+ metadata.gz: ff8b25a4e714cc5dc5b5db510912f4eb1a157ee9f1e7289166de519797fd9a4eb1008bf4d44dc38ad16456a6a43116ade1b2b9f8893f810e12f58c358dde5efd
7
+ data.tar.gz: 2a1fa04804fa329fc0cb8d1e73c926cc08e7b290d6eadc88dff4baae898f0007f861f30fc2a0c321bb39f0de505ff95ca5f6b59f0e7fca9a6380f01cb0d08ea0
data/bin/linear CHANGED
@@ -8,22 +8,45 @@ def show_usage
8
8
  Linear CLI - Ruby wrapper for Linear GraphQL API
9
9
 
10
10
  Usage:
11
- linear issue ISSUE_ID Fetch issue details
12
- linear search QUERY [OPTIONS] Search for issues
11
+ linear issue ISSUE_ID Fetch a specific issue by ID
12
+ linear issues [OPTIONS] List and filter issues (all filters are optional)
13
13
  linear mine Show issues assigned to you
14
14
  linear teams List all teams
15
15
  linear projects List all projects
16
16
  linear comment ISSUE_ID COMMENT Add a comment to an issue
17
17
  linear update ISSUE_ID STATE Update issue state
18
18
 
19
- Search Options:
19
+ Issues Filters (all optional, can be combined):
20
+ --query TEXT Search by title text
21
+ --project PROJECT_ID Filter by project ID
22
+ --state STATE Filter by state name (case-insensitive)
20
23
  --team TEAM_KEY Filter by team key
21
- --state STATE Filter by state name
22
24
 
23
25
  Examples:
26
+ # View a specific issue
24
27
  linear issue ENG-123
25
- linear search "bug fix" --team=ENG --state=Backlog
28
+
29
+ # List all issues
30
+ linear issues
31
+
32
+ # Search issues by title
33
+ linear issues --query "authentication"
34
+
35
+ # Filter by state (case-insensitive)
36
+ linear issues --state backlog
37
+ linear issues --state "In Progress"
38
+
39
+ # Filter by team
40
+ linear issues --team ENG
41
+
42
+ # Combine multiple filters
43
+ linear issues --query "bug" --state Backlog --team ENG
44
+ linear issues --project abc123 --state Done
45
+
46
+ # Your assigned issues
26
47
  linear mine
48
+
49
+ # Other commands
27
50
  linear teams
28
51
  linear projects
29
52
  linear comment FAT-85 "This is done"
@@ -53,27 +76,6 @@ when 'issue'
53
76
  exit 1
54
77
  end
55
78
 
56
- when 'search'
57
- query = ARGV.shift
58
- if query.nil? || query.empty?
59
- puts "Error: search query required"
60
- puts "Usage: linear search QUERY [--team TEAM] [--state STATE]"
61
- exit 1
62
- end
63
-
64
- options = {}
65
- OptionParser.new do |opts|
66
- opts.on("--team TEAM", "Filter by team key") { |v| options[:team] = v }
67
- opts.on("--state STATE", "Filter by state name") { |v| options[:state] = v }
68
- end.parse!
69
-
70
- begin
71
- Linear::Commands.search(query, options)
72
- rescue => e
73
- puts "Error: #{e.message}"
74
- exit 1
75
- end
76
-
77
79
  when 'mine'
78
80
  begin
79
81
  Linear::Commands.my_issues
@@ -98,6 +100,22 @@ when 'projects'
98
100
  exit 1
99
101
  end
100
102
 
103
+ when 'issues'
104
+ options = {}
105
+ OptionParser.new do |opts|
106
+ opts.on("--query QUERY", "Filter by title text") { |v| options[:query] = v }
107
+ opts.on("--project PROJECT", "Filter by project ID") { |v| options[:project] = v }
108
+ opts.on("--state STATE", "Filter by state name") { |v| options[:state] = v }
109
+ opts.on("--team TEAM", "Filter by team key") { |v| options[:team] = v }
110
+ end.parse!
111
+
112
+ begin
113
+ Linear::Commands.list_issues(options)
114
+ rescue => e
115
+ puts "Error: #{e.message}"
116
+ exit 1
117
+ end
118
+
101
119
  when 'comment'
102
120
  issue_id = ARGV.shift
103
121
  comment_body = ARGV.shift
@@ -13,16 +13,18 @@ module Linear
13
13
  end
14
14
  end
15
15
 
16
- def search(query, options = {}, client: Client.new)
17
- filter = { title: { contains: query } }
16
+ def list_issues(options = {}, client: Client.new)
17
+ filter = {}
18
+ filter[:title] = { contains: options[:query] } if options[:query]
19
+ filter[:project] = { id: { eq: options[:project] } } if options[:project]
20
+ filter[:state] = { name: { eqIgnoreCase: options[:state] } } if options[:state]
18
21
  filter[:team] = { key: { eq: options[:team] } } if options[:team]
19
- filter[:state] = { name: { eq: options[:state] } } if options[:state]
20
22
 
21
- result = client.query(Queries::SEARCH_ISSUES, { filter: filter })
23
+ result = client.query(Queries::LIST_ISSUES, { filter: filter })
22
24
 
23
25
  issues = result.dig("data", "issues", "nodes") || []
24
26
  if issues.empty?
25
- puts "No issues found matching: #{query}"
27
+ puts "No issues found"
26
28
  else
27
29
  display_issue_list(issues)
28
30
  end
@@ -23,7 +23,7 @@ module Linear
23
23
  }
24
24
  GQL
25
25
 
26
- SEARCH_ISSUES = <<~GQL
26
+ LIST_ISSUES = <<~GQL
27
27
  query($filter: IssueFilter!) {
28
28
  issues(filter: $filter) {
29
29
  nodes {
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.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Kinkead