ask-linear 0.1.0 → 0.1.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: 2cdf635069d34d0554d7e73ff22a0b589627ab59ace75b8376cfff7b11a502d5
4
- data.tar.gz: 81cc288e84cb63fb8b622032adbdc911844cbe29097d2b99f5d0a19548fc8f69
3
+ metadata.gz: b2d2cc4fa5d5715fdfbf074dfd3e6c64a758e65f5387ab97cf5a07c4aac6ab35
4
+ data.tar.gz: 2be587d1288bba6f5acae2b011c71a74c70d4f9d7f7b0831fd2df98e611a46e5
5
5
  SHA512:
6
- metadata.gz: 75e4a052079f42fdb445fcaea78010597c19708a5872a399c970b0f28f72c0ce77a76c0b6df4fe9d2c5681a060cff28cba750fd8de999e6438f745297c7ce87f
7
- data.tar.gz: e4e4cb88175a66383b416409f85e05ad2661168f28df182dd82c230429d3ec1b2fef341886f12255a3434af258d74bfc1a40beeff104298f6e4d59b53bbcd631
6
+ metadata.gz: 15b294da6df23b368b697fc8594e5e6e5fb5a81c3175c8486b24e34b69a22675a336eafb2ac1178eff154415b985d71e7d173276b585a5ff3e3e2602ca660b43
7
+ data.tar.gz: 9f03b1c574e47f71fd445c80d2a36100ecaaa83ed426c5ef78cbac5237a4ff70ac2e43de1e5eca863a91ec06175e4b7cf6c41138b75ec97ad668c30a43384ac9
data/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ ## [0.1.2] - 2026-06-25
2
+
3
+ ### Changed
4
+ - Gemspec validation test. Infrastructure: rubocop, overcommit, bin/setup, CI matrix.
5
+ # Changelog
6
+
7
+ ## [0.1.1] - 2026-06-21
8
+
9
+ ### Added
10
+
11
+ - Initial release of `ask-linear` — Linear service context for the ask-rb ecosystem.
12
+ - **context.rb** — Metadata constants for AI system prompts: `DESCRIPTION`, `DOCS_URL`, `GRAPHQL_URL`, `AUTH_NAME`, `AUTH_HOW`, `GEM_NAME`, `GEM_DOCS`, `QUICK_START`
13
+ - **client.rb** — `Ask::Linear.client` returns an authenticated GraphQL client via `Ask::Auth.resolve(:linear_api_key)`. Uses Faraday to send GraphQL queries to the Linear API at `https://api.linear.app/graphql`. Wraps client in `ClientProxy` to convert `Faraday::UnauthorizedError` (HTTP 401) to `Ask::Auth::InvalidCredential`.
14
+ - **error_guide.rb** — `Ask::Linear::Errors` with rate limit info, HTTP status code descriptions, and GraphQL error extension guidance for agents.
15
+ - **Dependencies:** `ask-auth ~> 0.1`, `faraday ~> 2.0`
16
+ - **Testing:** 26 tests, 62 assertions covering context constants, client auth flow, and error guide lookups.
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "faraday"
4
+ require "faraday/retry"
4
5
  require "ask/auth"
5
6
 
6
7
  module Ask
@@ -14,6 +15,7 @@ module Ask
14
15
  # Configuration:
15
16
  # - +read_timeout+: +30+ seconds
16
17
  # - +open_timeout+: +10+ seconds
18
+ # - +retry+: up to 3 retries on 429 (rate-limit) and 5xx (server) errors
17
19
  #
18
20
  # @example
19
21
  # client = Ask::Linear.client
@@ -43,6 +45,11 @@ module Ask
43
45
  @api_key = api_key
44
46
  @connection = Faraday.new(url: BASE_URL) do |f|
45
47
  f.request :json
48
+ f.request :retry, max: 3,
49
+ interval: 1.0,
50
+ max_interval: 10.0,
51
+ backoff_factor: 2.0,
52
+ retry_statuses: [429, 500, 502, 503]
46
53
  f.response :json
47
54
  f.response :raise_error
48
55
  f.options.read_timeout = 30
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Linear
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: linear.use_linear
3
+ description: How to navigate the Linear API with GraphQL — explore the schema, build queries, paginate, and handle errors
4
+ ---
5
+
6
+ Use this skill when you need to interact with Linear — managing issues, teams,
7
+ projects, sprints, or workflows. Unlike other service gems, Linear uses a raw
8
+ GraphQL API — there's no convenience client for each endpoint.
9
+
10
+ ## Step 1: Get the Client
11
+
12
+ ```ruby
13
+ client = Ask::Linear.client
14
+ ```
15
+
16
+ This returns a `Faraday`-based client that sends HTTP POST to
17
+ `https://api.linear.app/graphql`. It expects a valid Linear API key resolved
18
+ via `Ask::Auth.resolve(:linear_api_key)`.
19
+
20
+ If you get an auth error, read `Ask::Linear::Context::AUTH_HOW` for API key setup.
21
+
22
+ ## Step 2: Explore the Context
23
+
24
+ The gem ships with structured context you should reference:
25
+
26
+ ```ruby
27
+ Ask::Linear::Context::DOCS_URL # Linear developer docs
28
+ Ask::Linear::Context::GRAPHQL_URL # GraphQL endpoint (for introspection)
29
+ Ask::Linear::Context::QUICK_START # Query/mutation examples
30
+ ```
31
+
32
+ The `QUICK_START` constant has working examples for teams, issues, and mutations.
33
+
34
+ ## Step 3: Use GraphQL Introspection to Discover the Schema
35
+
36
+ Since Linear is GraphQL, you can introspect the schema to discover types,
37
+ queries, and mutations:
38
+
39
+ ```ruby
40
+ # List all query fields
41
+ result = client.query("
42
+ query {
43
+ __schema {
44
+ queryType {
45
+ fields {
46
+ name
47
+ description
48
+ }
49
+ }
50
+ }
51
+ }
52
+ ")
53
+ ```
54
+
55
+ For a specific type:
56
+ ```ruby
57
+ result = client.query("
58
+ query {
59
+ __type(name: \"Issue\") {
60
+ name
61
+ fields {
62
+ name
63
+ type {
64
+ name
65
+ kind
66
+ }
67
+ }
68
+ }
69
+ }
70
+ ")
71
+ ```
72
+
73
+ For finding all mutations:
74
+ ```ruby
75
+ result = client.query("
76
+ query {
77
+ __schema {
78
+ mutationType {
79
+ fields {
80
+ name
81
+ args { name type { name } }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ ")
87
+ ```
88
+
89
+ ## Step 4: Common Query Patterns
90
+
91
+ **List teams:**
92
+ ```ruby
93
+ client.query("query { teams { nodes { id key name } } }")
94
+ ```
95
+
96
+ **List issues for a team:**
97
+ ```ruby
98
+ client.query("query { team(id: \"TEAM_ID\") { issues(first: 50) { nodes { id identifier title state { name } priority } } } }")
99
+ ```
100
+
101
+ **Get issue details:**
102
+ ```ruby
103
+ client.query("query($id: String!) { issue(id: $id) { id identifier title description url assignee { name } } }", { id: "ISSUE_ID" })
104
+ ```
105
+
106
+ **Create an issue:**
107
+ ```ruby
108
+ client.query("mutation($input: IssueCreateInput!) { issueCreate(input: $input) { success issue { id identifier title url } } }", { input: { teamId: "TEAM_ID", title: "New issue", description: "Description" } })
109
+ ```
110
+
111
+ **Search issues:**
112
+ ```ruby
113
+ client.query("query { issues(filter: { title: { contains: \"search term\" } }) { nodes { id identifier title } } }")
114
+ ```
115
+
116
+ ## Step 5: Variable Syntax
117
+
118
+ Linear's GraphQL API requires exact type names. Use introspection (`__type`)
119
+ to find available input types. Variables are passed as a hash:
120
+
121
+ ```ruby
122
+ client.query("query($id: String!) { issue(id: $id) { id title } }", { id: "abc123" })
123
+ ```
124
+
125
+ The second argument is variables — it's passed as the second parameter to
126
+ Faraday's `post`.
127
+
128
+ ## Step 6: Authentication & Common Errors
129
+
130
+ For error guidance, use:
131
+
132
+ ```ruby
133
+ Ask::Linear::Errors.for("AUTHENTICATION_ERROR")
134
+ Ask::Linear::Errors.status_code_description(429)
135
+ Ask::Linear::Errors::PAGINATION
136
+ ```
137
+
138
+ Common scenarios:
139
+ - **401**: API key invalid or revoked → generate new key at Linear settings
140
+ - **429**: Rate limited (100 req/min per key) → wait and retry
141
+ - **GraphQL errors**: Query returns 200 with `errors` array → check field names
142
+ - **INPUT_VALIDATION_ERROR**: Wrong argument types → check schema for exact types
143
+
144
+ ## Step 7: Pagination
145
+
146
+ Linear uses cursor-based connection pagination:
147
+
148
+ ```ruby
149
+ # Get first page
150
+ page = client.query("query { issues(first: 50) { nodes { id title } pageInfo { hasNextPage endCursor } } }")
151
+ # Next page:
152
+ page = client.query("query($cursor: String) { issues(first: 50, after: $cursor) { nodes { id title } pageInfo { hasNextPage endCursor } } }", { cursor: page.data.issues.pageInfo.endCursor }) while page.data.issues.pageInfo.hasNextPage
153
+ ```
154
+
155
+ Use `first`/`after` for forward pagination, `last`/`before` for backward.
156
+
157
+ ## Step 8: Fallback Strategy
158
+
159
+ 1. Check `Ask::Linear::Context::DOCS_URL` for documentation
160
+ 2. Use GraphQL introspection to discover the schema
161
+ 3. Linear's API returns helpful error messages — read the `errors` array
162
+ 4. For complex queries, build them incrementally — start simple, add fields
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-linear
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto
@@ -13,14 +13,14 @@ dependencies:
13
13
  name: ask-auth
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - "~>"
16
+ - - ">="
17
17
  - !ruby/object:Gem::Version
18
18
  version: '0.1'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - "~>"
23
+ - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: '0.1'
26
26
  - !ruby/object:Gem::Dependency
@@ -37,6 +37,20 @@ dependencies:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '2.0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: faraday-retry
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '2.0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '2.0'
40
54
  - !ruby/object:Gem::Dependency
41
55
  name: minitest
42
56
  requirement: !ruby/object:Gem::Requirement
@@ -87,6 +101,7 @@ executables: []
87
101
  extensions: []
88
102
  extra_rdoc_files: []
89
103
  files:
104
+ - CHANGELOG.md
90
105
  - LICENSE
91
106
  - README.md
92
107
  - lib/ask-linear.rb
@@ -94,10 +109,14 @@ files:
94
109
  - lib/ask/linear/context.rb
95
110
  - lib/ask/linear/error_guide.rb
96
111
  - lib/ask/linear/version.rb
112
+ - lib/ask/skills/linear.use_linear/SKILL.md
97
113
  homepage: https://github.com/ask-rb/ask-linear
98
114
  licenses:
99
115
  - MIT
100
- metadata: {}
116
+ metadata:
117
+ homepage_uri: https://github.com/ask-rb/ask-linear
118
+ source_code_uri: https://github.com/ask-rb/ask-linear
119
+ changelog_uri: https://github.com/ask-rb/ask-linear/blob/master/CHANGELOG.md
101
120
  rdoc_options: []
102
121
  require_paths:
103
122
  - lib