@ghx-dev/core 0.2.0 → 0.2.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.
- package/.claude-plugin/plugin.json +2 -2
- package/README.md +68 -224
- package/dist/cards/issue.assignees.add.yaml +1 -0
- package/dist/cards/issue.assignees.remove.yaml +1 -0
- package/dist/cards/issue.assignees.set.yaml +1 -0
- package/dist/cards/issue.close.yaml +1 -0
- package/dist/cards/issue.comments.create.yaml +1 -0
- package/dist/cards/issue.comments.list.yaml +1 -0
- package/dist/cards/issue.create.yaml +1 -0
- package/dist/cards/issue.delete.yaml +1 -0
- package/dist/cards/issue.labels.add.yaml +1 -0
- package/dist/cards/issue.labels.remove.yaml +1 -0
- package/dist/cards/issue.labels.set.yaml +1 -0
- package/dist/cards/issue.list.yaml +1 -0
- package/dist/cards/issue.milestone.clear.yaml +1 -0
- package/dist/cards/issue.milestone.set.yaml +1 -0
- package/dist/cards/issue.relations.blocked_by.add.yaml +1 -0
- package/dist/cards/issue.relations.blocked_by.remove.yaml +1 -0
- package/dist/cards/issue.relations.parent.remove.yaml +1 -0
- package/dist/cards/issue.relations.parent.set.yaml +1 -0
- package/dist/cards/issue.relations.prs.list.yaml +1 -0
- package/dist/cards/issue.relations.view.yaml +1 -0
- package/dist/cards/issue.reopen.yaml +1 -0
- package/dist/cards/issue.update.yaml +1 -0
- package/dist/cards/issue.view.yaml +1 -0
- package/dist/cards/pr.assignees.add.yaml +6 -2
- package/dist/cards/pr.assignees.remove.yaml +6 -2
- package/dist/cards/pr.branch.update.yaml +6 -2
- package/dist/cards/pr.create.yaml +7 -3
- package/dist/cards/pr.diff.files.yaml +1 -0
- package/dist/cards/pr.list.yaml +1 -0
- package/dist/cards/pr.merge.status.yaml +1 -0
- package/dist/cards/pr.merge.yaml +9 -3
- package/dist/cards/pr.reviews.list.yaml +1 -0
- package/dist/cards/pr.reviews.request.yaml +6 -3
- package/dist/cards/pr.reviews.submit.yaml +1 -0
- package/dist/cards/pr.threads.list.yaml +1 -0
- package/dist/cards/pr.threads.reply.yaml +1 -0
- package/dist/cards/pr.threads.resolve.yaml +1 -0
- package/dist/cards/pr.threads.unresolve.yaml +1 -0
- package/dist/cards/pr.update.yaml +7 -2
- package/dist/cards/pr.view.yaml +1 -0
- package/dist/cards/project_v2.fields.list.yaml +18 -2
- package/dist/cards/project_v2.items.field.update.yaml +8 -5
- package/dist/cards/project_v2.items.issue.add.yaml +9 -5
- package/dist/cards/project_v2.items.issue.remove.yaml +8 -5
- package/dist/cards/project_v2.items.list.yaml +8 -2
- package/dist/cards/project_v2.org.view.yaml +6 -2
- package/dist/cards/project_v2.user.view.yaml +6 -2
- package/dist/cards/release.list.yaml +8 -3
- package/dist/cards/release.view.yaml +8 -4
- package/dist/cards/repo.issue_types.list.yaml +7 -3
- package/dist/cards/repo.labels.list.yaml +7 -2
- package/dist/cards/repo.view.yaml +1 -0
- package/dist/chunk-7HUKYNI2.js +536 -0
- package/dist/chunk-7HUKYNI2.js.map +1 -0
- package/dist/{chunk-HEHONZTO.js → chunk-C2KRRSSX.js} +1 -1
- package/dist/chunk-C2KRRSSX.js.map +1 -0
- package/dist/chunk-GQO6BHJV.js +98 -0
- package/dist/chunk-GQO6BHJV.js.map +1 -0
- package/dist/chunk-H7CLZHRO.js +280 -0
- package/dist/chunk-H7CLZHRO.js.map +1 -0
- package/dist/chunk-NQ53ETYV.js +128 -0
- package/dist/chunk-NQ53ETYV.js.map +1 -0
- package/dist/{chunk-BIWBJA2F.js → chunk-OQWLEFAH.js} +220 -12
- package/dist/chunk-OQWLEFAH.js.map +1 -0
- package/dist/{chunk-Q7RCIK2C.js → chunk-Q2NW7DJE.js} +167 -62
- package/dist/chunk-Q2NW7DJE.js.map +1 -0
- package/dist/{pr-queries-UOEOXIJQ.js → chunk-QRHKAMRY.js} +11 -131
- package/dist/chunk-QRHKAMRY.js.map +1 -0
- package/dist/{chunk-3P3KHWFU.js → chunk-T3L2VDOS.js} +1080 -727
- package/dist/chunk-T3L2VDOS.js.map +1 -0
- package/dist/{issue-queries-GRA4MKPD.js → chunk-TGL33GEA.js} +7 -83
- package/dist/chunk-TGL33GEA.js.map +1 -0
- package/dist/chunk-ZGBVX2VG.js +32 -0
- package/dist/chunk-ZGBVX2VG.js.map +1 -0
- package/dist/cli/index.js +80 -15
- package/dist/cli/index.js.map +1 -1
- package/dist/core/registry/cards/issue.assignees.add.yaml +1 -0
- package/dist/core/registry/cards/issue.assignees.remove.yaml +1 -0
- package/dist/core/registry/cards/issue.assignees.set.yaml +1 -0
- package/dist/core/registry/cards/issue.close.yaml +1 -0
- package/dist/core/registry/cards/issue.comments.create.yaml +1 -0
- package/dist/core/registry/cards/issue.comments.list.yaml +1 -0
- package/dist/core/registry/cards/issue.create.yaml +1 -0
- package/dist/core/registry/cards/issue.delete.yaml +1 -0
- package/dist/core/registry/cards/issue.labels.add.yaml +1 -0
- package/dist/core/registry/cards/issue.labels.remove.yaml +1 -0
- package/dist/core/registry/cards/issue.labels.set.yaml +1 -0
- package/dist/core/registry/cards/issue.list.yaml +1 -0
- package/dist/core/registry/cards/issue.milestone.clear.yaml +1 -0
- package/dist/core/registry/cards/issue.milestone.set.yaml +1 -0
- package/dist/core/registry/cards/issue.relations.blocked_by.add.yaml +1 -0
- package/dist/core/registry/cards/issue.relations.blocked_by.remove.yaml +1 -0
- package/dist/core/registry/cards/issue.relations.parent.remove.yaml +1 -0
- package/dist/core/registry/cards/issue.relations.parent.set.yaml +1 -0
- package/dist/core/registry/cards/issue.relations.prs.list.yaml +1 -0
- package/dist/core/registry/cards/issue.relations.view.yaml +1 -0
- package/dist/core/registry/cards/issue.reopen.yaml +1 -0
- package/dist/core/registry/cards/issue.update.yaml +1 -0
- package/dist/core/registry/cards/issue.view.yaml +1 -0
- package/dist/core/registry/cards/pr.assignees.add.yaml +6 -2
- package/dist/core/registry/cards/pr.assignees.remove.yaml +6 -2
- package/dist/core/registry/cards/pr.branch.update.yaml +6 -2
- package/dist/core/registry/cards/pr.create.yaml +7 -3
- package/dist/core/registry/cards/pr.diff.files.yaml +1 -0
- package/dist/core/registry/cards/pr.list.yaml +1 -0
- package/dist/core/registry/cards/pr.merge.status.yaml +1 -0
- package/dist/core/registry/cards/pr.merge.yaml +9 -3
- package/dist/core/registry/cards/pr.reviews.list.yaml +1 -0
- package/dist/core/registry/cards/pr.reviews.request.yaml +6 -3
- package/dist/core/registry/cards/pr.reviews.submit.yaml +1 -0
- package/dist/core/registry/cards/pr.threads.list.yaml +1 -0
- package/dist/core/registry/cards/pr.threads.reply.yaml +1 -0
- package/dist/core/registry/cards/pr.threads.resolve.yaml +1 -0
- package/dist/core/registry/cards/pr.threads.unresolve.yaml +1 -0
- package/dist/core/registry/cards/pr.update.yaml +7 -2
- package/dist/core/registry/cards/pr.view.yaml +1 -0
- package/dist/core/registry/cards/project_v2.fields.list.yaml +18 -2
- package/dist/core/registry/cards/project_v2.items.field.update.yaml +8 -5
- package/dist/core/registry/cards/project_v2.items.issue.add.yaml +9 -5
- package/dist/core/registry/cards/project_v2.items.issue.remove.yaml +8 -5
- package/dist/core/registry/cards/project_v2.items.list.yaml +8 -2
- package/dist/core/registry/cards/project_v2.org.view.yaml +6 -2
- package/dist/core/registry/cards/project_v2.user.view.yaml +6 -2
- package/dist/core/registry/cards/release.list.yaml +8 -3
- package/dist/core/registry/cards/release.view.yaml +8 -4
- package/dist/core/registry/cards/repo.issue_types.list.yaml +7 -3
- package/dist/core/registry/cards/repo.labels.list.yaml +7 -2
- package/dist/core/registry/cards/repo.view.yaml +1 -0
- package/dist/index.d.ts +457 -0
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/{issue-mutations-FJNZW7L5.js → issue-mutations-DIWPF3JH.js} +98 -121
- package/dist/issue-mutations-DIWPF3JH.js.map +1 -0
- package/dist/issue-queries-YQL65J7X.js +93 -0
- package/dist/issue-queries-YQL65J7X.js.map +1 -0
- package/dist/{pr-mutations-UG67YOF5.js → pr-mutations-BVHDCAPR.js} +235 -95
- package/dist/pr-mutations-BVHDCAPR.js.map +1 -0
- package/dist/pr-queries-NUL2UZJB.js +143 -0
- package/dist/pr-queries-NUL2UZJB.js.map +1 -0
- package/dist/project-3ZSPVIOC.js +429 -0
- package/dist/project-3ZSPVIOC.js.map +1 -0
- package/dist/release-IQCWD655.js +57 -0
- package/dist/release-IQCWD655.js.map +1 -0
- package/dist/repo-JF47JAZG.js +82 -0
- package/dist/repo-JF47JAZG.js.map +1 -0
- package/package.json +9 -9
- package/skills/using-ghx/SKILL.md +78 -10
- package/dist/chunk-3P3KHWFU.js.map +0 -1
- package/dist/chunk-BIWBJA2F.js.map +0 -1
- package/dist/chunk-HEHONZTO.js.map +0 -1
- package/dist/chunk-Q7RCIK2C.js.map +0 -1
- package/dist/chunk-TDABI6C7.js +0 -167
- package/dist/chunk-TDABI6C7.js.map +0 -1
- package/dist/issue-mutations-FJNZW7L5.js.map +0 -1
- package/dist/issue-queries-GRA4MKPD.js.map +0 -1
- package/dist/pr-mutations-UG67YOF5.js.map +0 -1
- package/dist/pr-queries-UOEOXIJQ.js.map +0 -1
- package/dist/repo-JDUHFPZF.js +0 -66
- package/dist/repo-JDUHFPZF.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ghx",
|
|
3
|
-
"description": "GitHub execution router for AI agents —
|
|
4
|
-
"version": "0.2.
|
|
3
|
+
"description": "GitHub execution router for AI agents — 70 capabilities with deterministic routing and normalized output",
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Arye Kogan"
|
|
7
7
|
},
|
package/README.md
CHANGED
|
@@ -1,276 +1,120 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">@ghx-dev/core</h1>
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<img src="https://raw.githubusercontent.com/aryeko/ghx/main/assets/branding/social/ghx-social-dark-1280x640.png" alt="ghx social preview" width="480">
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
+
<p align="center">
|
|
8
|
+
A typed GitHub execution router that gives AI agents deterministic, token-efficient access to the GitHub API.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
7
11
|
[](https://www.npmjs.com/package/@ghx-dev/core)
|
|
8
12
|
[](https://www.npmjs.com/package/@ghx-dev/core)
|
|
9
13
|
[](https://github.com/aryeko/ghx/actions/workflows/ci-main.yml)
|
|
10
14
|
[](https://codecov.io/gh/aryeko/ghx)
|
|
11
15
|
[](https://github.com/aryeko/ghx/blob/main/LICENSE)
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
ghx
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
## Why ghx?
|
|
18
|
+
|
|
19
|
+
When AI agents use the `gh` CLI directly, they waste thousands of tokens on research, trial-and-error formatting, and guessing JSON parsing paths. **ghx eliminates this waste** by providing a stable, structured execution layer.
|
|
20
|
+
|
|
21
|
+
> **100% success rate, 73% fewer tool calls, 18% fewer active tokens, 54% lower latency** compared to raw CLI usage ([measured across 30 runs](https://github.com/aryeko/ghx/blob/main/docs/eval-report.md) on standard PR workflows with Codex 5.3).
|
|
22
|
+
|
|
23
|
+
```mermaid
|
|
24
|
+
sequenceDiagram
|
|
25
|
+
participant Agent
|
|
26
|
+
participant ghx as ghx
|
|
27
|
+
participant GH as GitHub API
|
|
28
|
+
|
|
29
|
+
%% Agent requests a typed execution
|
|
30
|
+
Agent->>ghx: executeTask("pr.view", { owner, name, prNumber })
|
|
31
|
+
|
|
32
|
+
%% ghx routing engine takes over
|
|
33
|
+
Note over ghx: 1. Validate input schema<br/>2. Select optimal route (GraphQL/CLI)<br/>3. Run preflight checks
|
|
34
|
+
ghx->>GH: typed GraphQL request
|
|
35
|
+
GH-->>ghx: response
|
|
36
|
+
Note over ghx: normalize errors & structure
|
|
37
|
+
|
|
38
|
+
%% Stable envelope returned
|
|
39
|
+
ghx-->>Agent: ResultEnvelope { ok: true, data: { ... } }
|
|
34
40
|
```
|
|
35
41
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
pnpm add @ghx-dev/core
|
|
40
|
-
# or
|
|
41
|
-
yarn add @ghx-dev/core
|
|
42
|
-
```
|
|
42
|
+
## Features
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
- **70+ Declarative Capabilities**: PRs, issues, labels, workflows, projects, releases — all defined by versioned YAML operation cards.
|
|
45
|
+
- **Deterministic Routing**: The agent doesn't choose CLI vs. GraphQL. ghx evaluates suitability rules and picks the optimal route automatically, with built-in fallbacks.
|
|
46
|
+
- **Stable Result Envelope**: No try/catch needed. Every execution returns `{ ok, data, error, meta }`. Errors are mapped to standard codes (`AUTH`, `RATE_LIMIT`, `NOT_FOUND`, etc.).
|
|
47
|
+
- **Chaining & Batching**: Execute multiple steps (`add label`, `add assignee`, `comment`) in one call. ghx resolves node IDs and batches them into a single network request.
|
|
48
|
+
- **Type Safety**: Full TypeScript schemas for inputs and outputs (via generated GraphQL types).
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
npx @ghx-dev/core capabilities list
|
|
48
|
-
```
|
|
50
|
+
## Documentation
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
Comprehensive documentation is available in the [`docs/`](./docs/) directory:
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
- **[Getting Started](./docs/getting-started/README.md)** — Installation, why ghx, and use case diagrams.
|
|
55
|
+
- [Library Quickstart](./docs/getting-started/library-quickstart.md)
|
|
56
|
+
- [CLI Quickstart](./docs/getting-started/cli-quickstart.md)
|
|
57
|
+
- [Agent Setup](./docs/getting-started/agent-setup.md)
|
|
58
|
+
- **[Concepts](./docs/concepts/README.md)** — How ghx works internally (Routing Engine, Operation Cards, Result Envelope, Chaining).
|
|
59
|
+
- **[Architecture](./docs/architecture/README.md)** — System design, execution pipeline, formatters, and GraphQL layer.
|
|
60
|
+
- **[Reference](./docs/reference/README.md)** — API exports, error codes, and a complete table of all 70+ capabilities.
|
|
55
61
|
|
|
56
|
-
## Quick Start (
|
|
57
|
-
|
|
58
|
-
Set `GITHUB_TOKEN` or `GH_TOKEN` in your environment, then:
|
|
62
|
+
## Quick Start (Library)
|
|
59
63
|
|
|
60
64
|
```bash
|
|
61
|
-
|
|
62
|
-
npx @ghx-dev/core capabilities explain repo.view
|
|
63
|
-
npx @ghx-dev/core run repo.view --input '{"owner":"aryeko","name":"ghx"}'
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
If installed globally, replace `npx @ghx-dev/core` with `ghx`.
|
|
67
|
-
|
|
68
|
-
Every capability returns a stable envelope:
|
|
69
|
-
|
|
70
|
-
```json
|
|
71
|
-
{
|
|
72
|
-
"ok": true,
|
|
73
|
-
"data": {
|
|
74
|
-
"id": "R_kgDOOx...",
|
|
75
|
-
"name": "ghx",
|
|
76
|
-
"nameWithOwner": "aryeko/ghx"
|
|
77
|
-
},
|
|
78
|
-
"error": null,
|
|
79
|
-
"meta": {
|
|
80
|
-
"capability_id": "repo.view",
|
|
81
|
-
"route_used": "cli",
|
|
82
|
-
"reason": "CARD_PREFERRED"
|
|
83
|
-
}
|
|
84
|
-
}
|
|
65
|
+
npm install @ghx-dev/core
|
|
85
66
|
```
|
|
86
67
|
|
|
87
|
-
## Quick Start (Library API)
|
|
88
|
-
|
|
89
68
|
```ts
|
|
90
69
|
import { createGithubClientFromToken, executeTask } from "@ghx-dev/core"
|
|
91
70
|
|
|
92
71
|
const token = process.env.GITHUB_TOKEN!
|
|
93
72
|
const githubClient = createGithubClientFromToken(token)
|
|
94
73
|
|
|
74
|
+
// Execute a task: input is validated, optimal route is chosen
|
|
95
75
|
const result = await executeTask(
|
|
96
76
|
{ task: "repo.view", input: { owner: "aryeko", name: "ghx" } },
|
|
97
77
|
{ githubClient, githubToken: token },
|
|
98
78
|
)
|
|
99
79
|
|
|
100
80
|
if (result.ok) {
|
|
101
|
-
console.log(result.data)
|
|
81
|
+
console.log("Success:", result.data.nameWithOwner)
|
|
82
|
+
console.log("Route used:", result.meta.route_used) // e.g. "graphql"
|
|
102
83
|
} else {
|
|
103
|
-
console.error(result.error
|
|
84
|
+
console.error("Failed:", result.error.code) // e.g. "NOT_FOUND"
|
|
85
|
+
console.error("Retryable?", result.error.retryable)
|
|
104
86
|
}
|
|
105
87
|
```
|
|
106
88
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
## Agent Onboarding
|
|
89
|
+
## Quick Start (CLI)
|
|
110
90
|
|
|
111
|
-
|
|
91
|
+
Use ghx directly from your terminal or add it as an agent skill.
|
|
112
92
|
|
|
113
93
|
```bash
|
|
114
|
-
|
|
115
|
-
npx @ghx-dev/core
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Setup Skill Source
|
|
119
|
-
|
|
120
|
-
The canonical setup skill content is stored in:
|
|
121
|
-
|
|
122
|
-
- `skills/using-ghx/SKILL.md` (package root)
|
|
123
|
-
|
|
124
|
-
During build/publish it is copied to:
|
|
125
|
-
|
|
126
|
-
- `dist/skills/using-ghx/SKILL.md`
|
|
127
|
-
|
|
128
|
-
`ghx setup` writes this content to `.agents/skills/ghx/SKILL.md` in user or project scope.
|
|
129
|
-
|
|
130
|
-
## Agent Tools
|
|
131
|
-
|
|
132
|
-
```ts
|
|
133
|
-
import {
|
|
134
|
-
createExecuteTool,
|
|
135
|
-
createGithubClientFromToken,
|
|
136
|
-
executeTask,
|
|
137
|
-
explainCapability,
|
|
138
|
-
listCapabilities,
|
|
139
|
-
} from "@ghx-dev/core"
|
|
140
|
-
|
|
141
|
-
// Wire the execute tool to the real engine
|
|
142
|
-
const token = process.env.GITHUB_TOKEN!
|
|
143
|
-
const githubClient = createGithubClientFromToken(token)
|
|
144
|
-
|
|
145
|
-
const tool = createExecuteTool({
|
|
146
|
-
executeTask: (request) => executeTask(request, { githubClient, githubToken: token }),
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
// Discover and execute capabilities
|
|
150
|
-
console.log(listCapabilities())
|
|
151
|
-
console.log(explainCapability("repo.view"))
|
|
152
|
-
const result = await tool.execute("repo.view", { owner: "aryeko", name: "ghx" })
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
## 69 Capabilities
|
|
156
|
-
|
|
157
|
-
**Repository** -- `repo.view`, `repo.labels.list`, `repo.issue_types.list`
|
|
158
|
-
|
|
159
|
-
**Issues** -- `issue.view`, `issue.list`, `issue.comments.list`, `issue.create`, `issue.update`, `issue.close`, `issue.reopen`, `issue.delete`, `issue.labels.update`, `issue.assignees.update`, `issue.milestone.set`, `issue.comments.create`, `issue.linked_prs.list`, `issue.relations.get`, `issue.parent.set`, `issue.parent.remove`, `issue.blocked_by.add`, `issue.blocked_by.remove`
|
|
160
|
-
|
|
161
|
-
**Pull Requests (read)** -- `pr.view`, `pr.list`, `pr.threads.list`, `pr.reviews.list`, `pr.diff.files`, `pr.checks.list`, `pr.merge.status`
|
|
162
|
-
|
|
163
|
-
**Pull Requests (execute)** -- `pr.threads.reply`, `pr.threads.resolve`, `pr.threads.unresolve`, `pr.update`, `pr.reviews.submit`, `pr.reviews.request`, `pr.merge`, `pr.checks.rerun.failed`, `pr.checks.rerun.all`, `pr.branch.update`, `pr.assignees.add`, `pr.assignees.remove`
|
|
164
|
-
|
|
165
|
-
**CI Diagnostics** -- `workflow.runs.list`, `workflow.job.logs.get`
|
|
166
|
-
|
|
167
|
-
**Releases** -- `release.list`, `release.get`, `release.create_draft`, `release.update`, `release.publish_draft`
|
|
168
|
-
|
|
169
|
-
**Workflow Controls** -- `workflow.list`, `workflow.get`, `workflow_dispatch.run`, `workflow_run.view`, `workflow_run.rerun_failed`, `workflow_run.rerun_all`, `workflow_run.cancel`, `workflow_run.artifacts.list`
|
|
170
|
-
|
|
171
|
-
**Projects v2** -- `project_v2.org.get`, `project_v2.user.get`, `project_v2.fields.list`, `project_v2.items.list`, `project_v2.item.add_issue`, `project_v2.item.field.update`
|
|
172
|
-
|
|
173
|
-
For exact input/output contracts, see the [operation card registry](https://github.com/aryeko/ghx/tree/main/packages/core/src/core/registry/cards).
|
|
174
|
-
|
|
175
|
-
## Result Envelope
|
|
94
|
+
# List all 70+ capabilities
|
|
95
|
+
npx @ghx-dev/core capabilities list
|
|
176
96
|
|
|
177
|
-
|
|
97
|
+
# Run a capability
|
|
98
|
+
npx @ghx-dev/core run pr.view --input '{"owner":"aryeko","name":"ghx","number":42}'
|
|
178
99
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
message: string
|
|
186
|
-
retryable: boolean
|
|
187
|
-
details?: Record<string, unknown>
|
|
188
|
-
}
|
|
189
|
-
meta: {
|
|
190
|
-
capability_id: string
|
|
191
|
-
route_used?: "cli" | "graphql" | "rest"
|
|
192
|
-
reason?: string
|
|
193
|
-
attempts?: Array<{
|
|
194
|
-
route: "cli" | "graphql" | "rest"
|
|
195
|
-
status: "success" | "error" | "skipped"
|
|
196
|
-
error_code?: string
|
|
197
|
-
duration_ms?: number
|
|
198
|
-
}>
|
|
199
|
-
}
|
|
200
|
-
}
|
|
100
|
+
# Output is a standard ResultEnvelope:
|
|
101
|
+
# {
|
|
102
|
+
# "ok": true,
|
|
103
|
+
# "data": { ... },
|
|
104
|
+
# "meta": { "capability_id": "pr.view", "route_used": "graphql", ... }
|
|
105
|
+
# }
|
|
201
106
|
```
|
|
202
107
|
|
|
203
|
-
##
|
|
108
|
+
## Agent Integration
|
|
204
109
|
|
|
205
|
-
|
|
206
|
-
- `GITHUB_GRAPHQL_URL` (optional; override GraphQL endpoint)
|
|
207
|
-
- `GH_HOST` (optional; derives enterprise GraphQL endpoint)
|
|
110
|
+
To install the `ghx` skill for Claude Code:
|
|
208
111
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
- Start with least privilege and grant only what your capability set needs.
|
|
212
|
-
- For quick local testing, a classic PAT with `repo` scope is the simplest route.
|
|
213
|
-
- For production agents, prefer fine-grained tokens with read permissions first (`Metadata`, `Contents`, `Pull requests`, `Issues`, `Actions`, `Projects`) and add writes only where needed.
|
|
214
|
-
|
|
215
|
-
## Compatibility
|
|
216
|
-
|
|
217
|
-
- Node.js `22+`
|
|
218
|
-
- GitHub Cloud and GitHub Enterprise hosts (`GH_HOST` supported)
|
|
219
|
-
- Route adapters: CLI and GraphQL
|
|
220
|
-
|
|
221
|
-
## Public Exports
|
|
222
|
-
|
|
223
|
-
Root (`@ghx-dev/core`):
|
|
224
|
-
|
|
225
|
-
- `executeTask` -- run a capability
|
|
226
|
-
- `createGithubClientFromToken` -- create a client from a token string
|
|
227
|
-
- `createGithubClient`, `createGraphqlClient` -- create clients from a custom transport
|
|
228
|
-
- `listOperationCards`, `getOperationCard` -- inspect capability registry
|
|
229
|
-
- `createSafeCliCommandRunner` -- custom CLI execution
|
|
230
|
-
- Types: `TaskRequest`, `ResultEnvelope`, `ResultError`, `ResultMeta`, `AttemptMeta`, `RouteSource`, `RouteReasonCode`, `TokenClientOptions`
|
|
231
|
-
|
|
232
|
-
Subpaths:
|
|
233
|
-
|
|
234
|
-
- `@ghx-dev/core/cli` -- CLI entrypoint
|
|
235
|
-
|
|
236
|
-
## Custom GraphQL Transport
|
|
237
|
-
|
|
238
|
-
For full control over the GraphQL layer, pass your own transport to `createGithubClient`:
|
|
239
|
-
|
|
240
|
-
```ts
|
|
241
|
-
import { createGithubClient, executeTask } from "@ghx-dev/core"
|
|
242
|
-
|
|
243
|
-
const githubClient = createGithubClient({
|
|
244
|
-
async execute<TData>(query: string, variables?: Record<string, unknown>): Promise<TData> {
|
|
245
|
-
const response = await fetch("https://api.github.com/graphql", {
|
|
246
|
-
method: "POST",
|
|
247
|
-
headers: {
|
|
248
|
-
"content-type": "application/json",
|
|
249
|
-
authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
|
|
250
|
-
},
|
|
251
|
-
body: JSON.stringify({ query, variables: variables ?? {} }),
|
|
252
|
-
})
|
|
253
|
-
const payload = (await response.json()) as { data?: TData; errors?: Array<{ message?: string }> }
|
|
254
|
-
if (payload.errors?.length) throw new Error(payload.errors[0]?.message ?? "GraphQL error")
|
|
255
|
-
if (payload.data === undefined) throw new Error("GraphQL response missing data")
|
|
256
|
-
return payload.data
|
|
257
|
-
},
|
|
258
|
-
})
|
|
259
|
-
|
|
260
|
-
const result = await executeTask(
|
|
261
|
-
{ task: "repo.view", input: { owner: "aryeko", name: "ghx" } },
|
|
262
|
-
{ githubClient, githubToken: process.env.GITHUB_TOKEN },
|
|
263
|
-
)
|
|
112
|
+
```bash
|
|
113
|
+
npx @ghx-dev/core setup --scope project --yes
|
|
264
114
|
```
|
|
265
115
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
- [Documentation Hub](https://github.com/aryeko/ghx/blob/main/docs/README.md)
|
|
269
|
-
- [Architecture](https://github.com/aryeko/ghx/blob/main/docs/architecture/README.md)
|
|
270
|
-
- [Capabilities Reference](https://github.com/aryeko/ghx/blob/main/docs/capabilities/README.md)
|
|
271
|
-
- [Operation Cards](https://github.com/aryeko/ghx/blob/main/docs/architecture/operation-cards.md)
|
|
272
|
-
- [Publishing Guide](https://github.com/aryeko/ghx/blob/main/docs/contributing/publishing.md)
|
|
116
|
+
This installs `.agents/skills/ghx/SKILL.md` which teaches Claude how to use `npx @ghx-dev/core` for reliable GitHub interactions.
|
|
273
117
|
|
|
274
118
|
## License
|
|
275
119
|
|
|
276
|
-
MIT
|
|
120
|
+
MIT
|
|
@@ -23,7 +23,11 @@ output_schema:
|
|
|
23
23
|
items: { type: string }
|
|
24
24
|
additionalProperties: false
|
|
25
25
|
routing:
|
|
26
|
-
preferred:
|
|
27
|
-
fallbacks: []
|
|
26
|
+
preferred: graphql
|
|
27
|
+
fallbacks: [cli]
|
|
28
|
+
graphql:
|
|
29
|
+
operationName: PrAssigneesAdd
|
|
30
|
+
operationType: mutation
|
|
31
|
+
documentPath: src/gql/operations/pr-assignees-add.graphql
|
|
28
32
|
cli:
|
|
29
33
|
command: pr edit
|
|
@@ -23,7 +23,11 @@ output_schema:
|
|
|
23
23
|
items: { type: string }
|
|
24
24
|
additionalProperties: false
|
|
25
25
|
routing:
|
|
26
|
-
preferred:
|
|
27
|
-
fallbacks: []
|
|
26
|
+
preferred: graphql
|
|
27
|
+
fallbacks: [cli]
|
|
28
|
+
graphql:
|
|
29
|
+
operationName: PrAssigneesRemove
|
|
30
|
+
operationType: mutation
|
|
31
|
+
documentPath: src/gql/operations/pr-assignees-remove.graphql
|
|
28
32
|
cli:
|
|
29
33
|
command: pr edit
|
|
@@ -17,7 +17,11 @@ output_schema:
|
|
|
17
17
|
updated: { type: boolean }
|
|
18
18
|
additionalProperties: false
|
|
19
19
|
routing:
|
|
20
|
-
preferred:
|
|
21
|
-
fallbacks: []
|
|
20
|
+
preferred: graphql
|
|
21
|
+
fallbacks: [cli]
|
|
22
|
+
graphql:
|
|
23
|
+
operationName: PrBranchUpdate
|
|
24
|
+
operationType: mutation
|
|
25
|
+
documentPath: src/gql/operations/pr-branch-update.graphql
|
|
22
26
|
cli:
|
|
23
27
|
command: pr update-branch
|
|
@@ -3,7 +3,7 @@ version: "1.0.0"
|
|
|
3
3
|
description: Create a pull request.
|
|
4
4
|
input_schema:
|
|
5
5
|
type: object
|
|
6
|
-
required: [owner, name, title, head]
|
|
6
|
+
required: [owner, name, title, head, base]
|
|
7
7
|
properties:
|
|
8
8
|
owner: { type: string, minLength: 1 }
|
|
9
9
|
name: { type: string, minLength: 1 }
|
|
@@ -24,7 +24,11 @@ output_schema:
|
|
|
24
24
|
draft: { type: boolean }
|
|
25
25
|
additionalProperties: false
|
|
26
26
|
routing:
|
|
27
|
-
preferred:
|
|
28
|
-
fallbacks: []
|
|
27
|
+
preferred: graphql
|
|
28
|
+
fallbacks: [cli]
|
|
29
|
+
graphql:
|
|
30
|
+
operationName: PrCreate
|
|
31
|
+
operationType: mutation
|
|
32
|
+
documentPath: src/gql/operations/pr-create.graphql
|
|
29
33
|
cli:
|
|
30
34
|
command: pr create
|
package/dist/cards/pr.list.yaml
CHANGED