ask-github 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: 81872d8db5d4f3e8a63eed5fb7bb856daa386f447f522331d8c30b97400ad0a5
4
- data.tar.gz: d86d708a8e4fbaac994a2cedaab52458434fae36b08f9c7cae98d8b70b9ae079
3
+ metadata.gz: f64d61d784bb31f0281d5aabedd9abe2937b335b25a85dee0d8246dbe7e6745b
4
+ data.tar.gz: d81bfb900b6d5c3f9cdfd7b5b6f6553ab9b5a93ecacbef219d5fda968dd3eb29
5
5
  SHA512:
6
- metadata.gz: 925160b0799b93e9c2665429c319594913a9346ab461ca9d14ba90809a7e264715c729f5513365681845f48f247ab468f6a91169361089f6346e52c910cf58e1
7
- data.tar.gz: 0f44993f6e054c65512ddbed2a2ea0b2cef9e0436093e9edf0d224b55fbe94872964606ab0099eb0476036eb3adaa6a747e873f9cb2e3736d413f4eac2881c68
6
+ metadata.gz: 9a8b8fe7c51f63e6a78e92f302010e10d3e7da2ad990b2f6b967d0624be0ab224c448a042dd8925459777710c370bbe787a7cd1596153623998907427c2a032a
7
+ data.tar.gz: 29b96dd81509ba2323990ebfd8742e580058840ac29e41e089cdcc918611932ae6338b3ef954b96b14f8dd6ad795d4f0faebc6d4d6cf2bcdfad42616a6f37c06
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module GitHub
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.2"
6
6
  end
7
7
  end
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: github.use_github
3
+ description: How to navigate the GitHub API with Octokit — discover endpoints, handle auth, pagination, and errors
4
+ ---
5
+
6
+ Use this skill when you need to interact with GitHub — reading issues, pull
7
+ requests, repository contents, search, or managing projects using code tools.
8
+
9
+ ## Step 1: Get the Client
10
+
11
+ ```ruby
12
+ client = Ask::GitHub.client
13
+ ```
14
+
15
+ This returns an authenticated Octokit client. It expects a valid GitHub personal
16
+ access token resolved via `Ask::Auth.resolve(:github_token)`.
17
+
18
+ If you get an auth error, read `Ask::GitHub::Context::AUTH_HOW` for token setup.
19
+
20
+ ## Step 2: Explore the Context
21
+
22
+ The gem ships with structured context you should reference:
23
+
24
+ ```ruby
25
+ Ask::GitHub::Context::DOCS_URL # GitHub REST API docs
26
+ Ask::GitHub::Context::GEM_DOCS # Octokit Ruby docs
27
+ Ask::GitHub::Context::QUICK_START # Copy-paste examples
28
+ Ask::GitHub::Context::GEM_NAME # "octokit"
29
+ ```
30
+
31
+ The `QUICK_START` constant has basic usage examples for common operations
32
+ (issues, pull requests, contents, search).
33
+
34
+ ## Step 3: Discover Available Methods
35
+
36
+ Rather than assuming which methods exist, use code tools to explore the client:
37
+
38
+ ```ruby
39
+ # List all public methods (filter out Object basics)
40
+ Code.new.call(code: "
41
+ client = Ask::GitHub.client
42
+ puts (client.methods - Object.methods).sort.join(\"\\n\")
43
+ ")
44
+ ```
45
+
46
+ Octokit methods follow REST API patterns:
47
+ - `client.issues("owner/repo")` — list issues
48
+ - `client.pull_requests("owner/repo")` — list PRs
49
+ - `client.contents("owner/repo", path: "README.md")` — read file
50
+ - `client.search_issues("query")` — search across repos
51
+ - `client.create_issue("owner/repo", "Title", "body")` — create issue
52
+
53
+ For method specifics, read the Octokit source:
54
+ ```ruby
55
+ Grep.new.call(pattern: "def issues", path: "$GEM_PATH/octokit-*/lib")
56
+ ```
57
+
58
+ ## Step 4: Authentication Errors
59
+
60
+ Auth failures are converted to `Ask::Auth::InvalidCredential`. For detailed
61
+ error guidance, use:
62
+
63
+ ```ruby
64
+ Ask::GitHub::Errors.for("Octokit::NotFound")
65
+ Ask::GitHub::Errors.status_code_description(404)
66
+ Ask::GitHub::Errors::RATE_LIMIT
67
+ ```
68
+
69
+ Common scenarios:
70
+ - **401/403**: Token invalid or missing scopes → check token at GitHub settings
71
+ - **404**: Resource doesn't exist or is private → verify owner/repo and access
72
+ - **429**: Rate limited → wait and retry (5,000 req/hr with token)
73
+
74
+ ## Step 5: Pagination
75
+
76
+ Octokit auto-paginates by default (`auto_paginate: true`, `per_page: 100`).
77
+ For very large result sets, you can iterate manually using the response's
78
+ `rels` (relations) links.
79
+
80
+ ## Step 6: Fallback Strategy
81
+
82
+ If Octokit doesn't have a convenience method for what you need:
83
+ 1. Check `Ask::GitHub::Context::DOCS_URL` for the REST API endpoint
84
+ 2. Use `client.get("/endpoint")` for custom REST requests
85
+ 3. Use the GraphQL API via `client.post("/graphql", { query: "..." })` for complex queries
86
+ 4. For search, use `client.search_issues("...")` which supports GitHub's query syntax
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-github
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
@@ -137,6 +137,7 @@ files:
137
137
  - lib/ask/github/context.rb
138
138
  - lib/ask/github/error_guide.rb
139
139
  - lib/ask/github/version.rb
140
+ - lib/ask/skills/github.use_github/SKILL.md
140
141
  homepage: https://github.com/ask-rb/ask-github
141
142
  licenses:
142
143
  - MIT