@ghx-dev/core 0.4.2 → 0.4.3

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ghx",
3
3
  "description": "Route GitHub operations through deterministic adapters instead of fragile shell scraping. 70+ capabilities covering issues, PRs, repos, releases, and projects — each with validated input, normalized output, and automatic fallback routing.",
4
- "version": "0.4.2",
4
+ "version": "0.4.3",
5
5
  "author": {
6
6
  "name": "Arye Kogan"
7
7
  },
@@ -0,0 +1,9 @@
1
+ {
2
+ "hooks": {
3
+ "sessionStart": [
4
+ {
5
+ "command": "../scripts/plugin/ensure-ghx.sh"
6
+ }
7
+ ]
8
+ }
9
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "ghx",
3
+ "description": "Route GitHub operations through deterministic adapters instead of fragile shell scraping. 70+ capabilities covering issues, PRs, repos, releases, and projects — each with validated input, normalized output, and automatic fallback routing.",
4
+ "version": "0.4.3",
5
+ "author": {
6
+ "name": "Arye Kogan"
7
+ },
8
+ "category": "development",
9
+ "repository": "https://github.com/aryeko/ghx",
10
+ "homepage": "https://github.com/aryeko/ghx",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "github",
14
+ "github-api",
15
+ "ai-agents",
16
+ "agentic",
17
+ "cli",
18
+ "graphql",
19
+ "automation",
20
+ "typescript"
21
+ ],
22
+ "logo": "https://raw.githubusercontent.com/aryeko/ghx/main/assets/branding/logos/ghx-logo-icon.svg",
23
+ "skills": "../skills/",
24
+ "rules": "rules/"
25
+ }
@@ -0,0 +1,16 @@
1
+ ---
2
+ description: Use ghx chain to batch multiple GitHub operations into a single API call
3
+ alwaysApply: true
4
+ ---
5
+
6
+ When performing 2+ GitHub operations, use `ghx chain` with a JSON array of steps instead of sequential `ghx run` calls. This batches operations into fewer API round-trips.
7
+
8
+ Example:
9
+ ```bash
10
+ ghx chain --steps - <<'EOF'
11
+ [
12
+ {"task":"pr.view","input":{"owner":"org","name":"repo","number":123}},
13
+ {"task":"pr.reviews.list","input":{"owner":"org","name":"repo","number":123}}
14
+ ]
15
+ EOF
16
+ ```
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: Check ghx capabilities before attempting raw GitHub API calls
3
+ alwaysApply: true
4
+ ---
5
+
6
+ Before writing custom `gh api` or curl commands, run `ghx capabilities list` or `ghx capabilities explain <id>` to check if ghx already supports the operation. ghx covers 70+ capabilities across issues, PRs, repos, releases, workflows, and projects.
7
+
8
+ Example:
9
+ ```bash
10
+ ghx capabilities list --domain pr
11
+ ghx capabilities explain pr.merge
12
+ ```
@@ -0,0 +1,14 @@
1
+ ---
2
+ description: Prefer ghx CLI over raw gh, gh api, or curl for GitHub operations
3
+ alwaysApply: true
4
+ ---
5
+
6
+ When performing any GitHub operation (PRs, issues, reviews, CI checks, releases, labels, comments), use `ghx run` instead of `gh`, `gh api`, or `curl`. ghx provides validated input, structured JSON output, and automatic fallback routing. Always pass `--input` via stdin heredoc to avoid shell quoting issues.
7
+
8
+ Example:
9
+ ```bash
10
+ # Instead of: gh pr view 123 --json title,state
11
+ ghx run pr.view --input - <<'EOF'
12
+ {"owner":"org","name":"repo","number":123}
13
+ EOF
14
+ ```
package/README.md CHANGED
@@ -19,6 +19,8 @@
19
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
20
 
21
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
+ > Read the full motivation: [AI Agents Shouldn't Relearn GitHub on Every Run](https://plainenglish.io/artificial-intelligence/ai-agents-shouldn-t-relearn-github-on-every-run)
22
24
 
23
25
  ```mermaid
24
26
  sequenceDiagram
@@ -59,12 +61,22 @@ Comprehensive documentation is available in the [`docs/`](./docs/) directory:
59
61
  - **[Architecture](./docs/architecture/README.md)** — System design, execution pipeline, formatters, and GraphQL layer.
60
62
  - **[Reference](./docs/reference/README.md)** — API exports, error codes, and a complete table of all 70+ capabilities.
61
63
 
62
- ## Quick Start (Library)
64
+ ## Install
65
+
66
+ ```bash
67
+ npm i -g @ghx-dev/core
68
+ ```
69
+
70
+ This makes the `ghx` CLI available in your PATH. Then wire it into your agent (see [Agent Integration](#agent-integration) below).
71
+
72
+ For library usage (TypeScript imports), install as a project dependency instead:
63
73
 
64
74
  ```bash
65
75
  npm install @ghx-dev/core
66
76
  ```
67
77
 
78
+ ## Quick Start (Library)
79
+
68
80
  ```ts
69
81
  import { createGithubClientFromToken, executeTask } from "@ghx-dev/core"
70
82
 
@@ -92,10 +104,10 @@ Use ghx directly from your terminal or add it as an agent skill.
92
104
 
93
105
  ```bash
94
106
  # List all 70+ capabilities
95
- npx @ghx-dev/core capabilities list
107
+ ghx capabilities list
96
108
 
97
109
  # Run a capability
98
- npx @ghx-dev/core run pr.view --input '{"owner":"aryeko","name":"ghx","number":42}'
110
+ ghx run pr.view --input '{"owner":"aryeko","name":"ghx","prNumber":42}'
99
111
 
100
112
  # Output is a standard ResultEnvelope:
101
113
  # {
@@ -107,13 +119,20 @@ npx @ghx-dev/core run pr.view --input '{"owner":"aryeko","name":"ghx","number":4
107
119
 
108
120
  ## Agent Integration
109
121
 
110
- To install the `ghx` skill for Claude Code:
122
+ **Claude Code** -- install from the plugin marketplace:
123
+
124
+ ```bash
125
+ /plugin marketplace add aryeko/ghx
126
+ /plugin install ghx@ghx-dev
127
+ ```
128
+
129
+ **Cursor, Windsurf, Codex, other agents** -- install the skill:
111
130
 
112
131
  ```bash
113
- npx @ghx-dev/core setup --scope project --yes
132
+ ghx setup --scope user --yes
114
133
  ```
115
134
 
116
- This installs `.agents/skills/ghx/SKILL.md` which teaches Claude how to use `npx @ghx-dev/core` for reliable GitHub interactions.
135
+ This writes `SKILL.md` to `~/.agents/skills/using-ghx/` which teaches your agent how to use `ghx` for reliable GitHub interactions. See [Agent Setup](./docs/getting-started/agent-setup.md) for platform-specific wiring.
117
136
 
118
137
  ## License
119
138
 
@@ -833,7 +833,7 @@ function createLogger(config) {
833
833
  }
834
834
  function write(level, msg, ctx) {
835
835
  if (levelIndex(level) < minIndex) return;
836
- const version = true ? "0.4.2" : "unknown";
836
+ const version = true ? "0.4.3" : "unknown";
837
837
  const entry = {
838
838
  ts: (/* @__PURE__ */ new Date()).toISOString(),
839
839
  pid: config.pid,
@@ -6219,4 +6219,4 @@ export {
6219
6219
  createGithubClientFromToken,
6220
6220
  createGithubClient
6221
6221
  };
6222
- //# sourceMappingURL=chunk-EJZDHUZK.js.map
6222
+ //# sourceMappingURL=chunk-G3JW3XZK.js.map
package/dist/cli/index.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  invalidateTokenCache,
11
11
  listCapabilities,
12
12
  resolveGithubToken
13
- } from "../chunk-EJZDHUZK.js";
13
+ } from "../chunk-G3JW3XZK.js";
14
14
  import "../chunk-H7CLZHRO.js";
15
15
  import "../chunk-NQ53ETYV.js";
16
16
  import "../chunk-TGL33GEA.js";
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  listCapabilities,
13
13
  listOperationCards,
14
14
  resolveGithubToken
15
- } from "./chunk-EJZDHUZK.js";
15
+ } from "./chunk-G3JW3XZK.js";
16
16
  import "./chunk-H7CLZHRO.js";
17
17
  import "./chunk-NQ53ETYV.js";
18
18
  import "./chunk-TGL33GEA.js";
package/hooks/hooks.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "hooks": [
6
6
  {
7
7
  "type": "command",
8
- "command": "CLAUDE_PLUGIN_ROOT=${CLAUDE_PLUGIN_ROOT} ${CLAUDE_PLUGIN_ROOT}/scripts/plugin/setup-env.sh"
8
+ "command": "${CLAUDE_PLUGIN_ROOT}/scripts/plugin/ensure-ghx.sh"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghx-dev/core",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Route GitHub operations through deterministic adapters instead of fragile shell scraping. 70+ capabilities covering issues, PRs, repos, releases, and projects — each with validated input, normalized output, and automatic fallback routing.",
5
5
  "author": "Arye Kogan",
6
6
  "license": "MIT",
@@ -47,6 +47,7 @@
47
47
  "hooks",
48
48
  "scripts/plugin",
49
49
  ".claude-plugin",
50
+ ".cursor-plugin",
50
51
  "skills",
51
52
  "LICENSE",
52
53
  "README.md"
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+ # Shared sessionStart hook for Claude Code and Cursor plugins.
3
+ # Warns if ghx is not available on PATH.
4
+
5
+ if ! command -v ghx &>/dev/null; then
6
+ echo "Warning: ghx CLI not found. Install with: npm install -g @ghx-dev/core"
7
+ fi
8
+
9
+ exit 0
@@ -1,6 +0,0 @@
1
- #!/bin/bash
2
- # Add the plugin's CLI binary to PATH for the Claude Code session.
3
- if [ -n "$CLAUDE_ENV_FILE" ]; then
4
- echo "export PATH=\"${CLAUDE_PLUGIN_ROOT}/bin:\$PATH\"" >> "$CLAUDE_ENV_FILE"
5
- fi
6
- exit 0