@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.
Files changed (161) hide show
  1. package/.claude-plugin/plugin.json +2 -2
  2. package/README.md +68 -224
  3. package/dist/cards/issue.assignees.add.yaml +1 -0
  4. package/dist/cards/issue.assignees.remove.yaml +1 -0
  5. package/dist/cards/issue.assignees.set.yaml +1 -0
  6. package/dist/cards/issue.close.yaml +1 -0
  7. package/dist/cards/issue.comments.create.yaml +1 -0
  8. package/dist/cards/issue.comments.list.yaml +1 -0
  9. package/dist/cards/issue.create.yaml +1 -0
  10. package/dist/cards/issue.delete.yaml +1 -0
  11. package/dist/cards/issue.labels.add.yaml +1 -0
  12. package/dist/cards/issue.labels.remove.yaml +1 -0
  13. package/dist/cards/issue.labels.set.yaml +1 -0
  14. package/dist/cards/issue.list.yaml +1 -0
  15. package/dist/cards/issue.milestone.clear.yaml +1 -0
  16. package/dist/cards/issue.milestone.set.yaml +1 -0
  17. package/dist/cards/issue.relations.blocked_by.add.yaml +1 -0
  18. package/dist/cards/issue.relations.blocked_by.remove.yaml +1 -0
  19. package/dist/cards/issue.relations.parent.remove.yaml +1 -0
  20. package/dist/cards/issue.relations.parent.set.yaml +1 -0
  21. package/dist/cards/issue.relations.prs.list.yaml +1 -0
  22. package/dist/cards/issue.relations.view.yaml +1 -0
  23. package/dist/cards/issue.reopen.yaml +1 -0
  24. package/dist/cards/issue.update.yaml +1 -0
  25. package/dist/cards/issue.view.yaml +1 -0
  26. package/dist/cards/pr.assignees.add.yaml +6 -2
  27. package/dist/cards/pr.assignees.remove.yaml +6 -2
  28. package/dist/cards/pr.branch.update.yaml +6 -2
  29. package/dist/cards/pr.create.yaml +7 -3
  30. package/dist/cards/pr.diff.files.yaml +1 -0
  31. package/dist/cards/pr.list.yaml +1 -0
  32. package/dist/cards/pr.merge.status.yaml +1 -0
  33. package/dist/cards/pr.merge.yaml +9 -3
  34. package/dist/cards/pr.reviews.list.yaml +1 -0
  35. package/dist/cards/pr.reviews.request.yaml +6 -3
  36. package/dist/cards/pr.reviews.submit.yaml +1 -0
  37. package/dist/cards/pr.threads.list.yaml +1 -0
  38. package/dist/cards/pr.threads.reply.yaml +1 -0
  39. package/dist/cards/pr.threads.resolve.yaml +1 -0
  40. package/dist/cards/pr.threads.unresolve.yaml +1 -0
  41. package/dist/cards/pr.update.yaml +7 -2
  42. package/dist/cards/pr.view.yaml +1 -0
  43. package/dist/cards/project_v2.fields.list.yaml +18 -2
  44. package/dist/cards/project_v2.items.field.update.yaml +8 -5
  45. package/dist/cards/project_v2.items.issue.add.yaml +9 -5
  46. package/dist/cards/project_v2.items.issue.remove.yaml +8 -5
  47. package/dist/cards/project_v2.items.list.yaml +8 -2
  48. package/dist/cards/project_v2.org.view.yaml +6 -2
  49. package/dist/cards/project_v2.user.view.yaml +6 -2
  50. package/dist/cards/release.list.yaml +8 -3
  51. package/dist/cards/release.view.yaml +8 -4
  52. package/dist/cards/repo.issue_types.list.yaml +7 -3
  53. package/dist/cards/repo.labels.list.yaml +7 -2
  54. package/dist/cards/repo.view.yaml +1 -0
  55. package/dist/chunk-7HUKYNI2.js +536 -0
  56. package/dist/chunk-7HUKYNI2.js.map +1 -0
  57. package/dist/{chunk-HEHONZTO.js → chunk-C2KRRSSX.js} +1 -1
  58. package/dist/chunk-C2KRRSSX.js.map +1 -0
  59. package/dist/chunk-GQO6BHJV.js +98 -0
  60. package/dist/chunk-GQO6BHJV.js.map +1 -0
  61. package/dist/chunk-H7CLZHRO.js +280 -0
  62. package/dist/chunk-H7CLZHRO.js.map +1 -0
  63. package/dist/chunk-NQ53ETYV.js +128 -0
  64. package/dist/chunk-NQ53ETYV.js.map +1 -0
  65. package/dist/{chunk-BIWBJA2F.js → chunk-OQWLEFAH.js} +220 -12
  66. package/dist/chunk-OQWLEFAH.js.map +1 -0
  67. package/dist/{chunk-Q7RCIK2C.js → chunk-Q2NW7DJE.js} +167 -62
  68. package/dist/chunk-Q2NW7DJE.js.map +1 -0
  69. package/dist/{pr-queries-UOEOXIJQ.js → chunk-QRHKAMRY.js} +11 -131
  70. package/dist/chunk-QRHKAMRY.js.map +1 -0
  71. package/dist/{chunk-3P3KHWFU.js → chunk-T3L2VDOS.js} +1080 -727
  72. package/dist/chunk-T3L2VDOS.js.map +1 -0
  73. package/dist/{issue-queries-GRA4MKPD.js → chunk-TGL33GEA.js} +7 -83
  74. package/dist/chunk-TGL33GEA.js.map +1 -0
  75. package/dist/chunk-ZGBVX2VG.js +32 -0
  76. package/dist/chunk-ZGBVX2VG.js.map +1 -0
  77. package/dist/cli/index.js +80 -15
  78. package/dist/cli/index.js.map +1 -1
  79. package/dist/core/registry/cards/issue.assignees.add.yaml +1 -0
  80. package/dist/core/registry/cards/issue.assignees.remove.yaml +1 -0
  81. package/dist/core/registry/cards/issue.assignees.set.yaml +1 -0
  82. package/dist/core/registry/cards/issue.close.yaml +1 -0
  83. package/dist/core/registry/cards/issue.comments.create.yaml +1 -0
  84. package/dist/core/registry/cards/issue.comments.list.yaml +1 -0
  85. package/dist/core/registry/cards/issue.create.yaml +1 -0
  86. package/dist/core/registry/cards/issue.delete.yaml +1 -0
  87. package/dist/core/registry/cards/issue.labels.add.yaml +1 -0
  88. package/dist/core/registry/cards/issue.labels.remove.yaml +1 -0
  89. package/dist/core/registry/cards/issue.labels.set.yaml +1 -0
  90. package/dist/core/registry/cards/issue.list.yaml +1 -0
  91. package/dist/core/registry/cards/issue.milestone.clear.yaml +1 -0
  92. package/dist/core/registry/cards/issue.milestone.set.yaml +1 -0
  93. package/dist/core/registry/cards/issue.relations.blocked_by.add.yaml +1 -0
  94. package/dist/core/registry/cards/issue.relations.blocked_by.remove.yaml +1 -0
  95. package/dist/core/registry/cards/issue.relations.parent.remove.yaml +1 -0
  96. package/dist/core/registry/cards/issue.relations.parent.set.yaml +1 -0
  97. package/dist/core/registry/cards/issue.relations.prs.list.yaml +1 -0
  98. package/dist/core/registry/cards/issue.relations.view.yaml +1 -0
  99. package/dist/core/registry/cards/issue.reopen.yaml +1 -0
  100. package/dist/core/registry/cards/issue.update.yaml +1 -0
  101. package/dist/core/registry/cards/issue.view.yaml +1 -0
  102. package/dist/core/registry/cards/pr.assignees.add.yaml +6 -2
  103. package/dist/core/registry/cards/pr.assignees.remove.yaml +6 -2
  104. package/dist/core/registry/cards/pr.branch.update.yaml +6 -2
  105. package/dist/core/registry/cards/pr.create.yaml +7 -3
  106. package/dist/core/registry/cards/pr.diff.files.yaml +1 -0
  107. package/dist/core/registry/cards/pr.list.yaml +1 -0
  108. package/dist/core/registry/cards/pr.merge.status.yaml +1 -0
  109. package/dist/core/registry/cards/pr.merge.yaml +9 -3
  110. package/dist/core/registry/cards/pr.reviews.list.yaml +1 -0
  111. package/dist/core/registry/cards/pr.reviews.request.yaml +6 -3
  112. package/dist/core/registry/cards/pr.reviews.submit.yaml +1 -0
  113. package/dist/core/registry/cards/pr.threads.list.yaml +1 -0
  114. package/dist/core/registry/cards/pr.threads.reply.yaml +1 -0
  115. package/dist/core/registry/cards/pr.threads.resolve.yaml +1 -0
  116. package/dist/core/registry/cards/pr.threads.unresolve.yaml +1 -0
  117. package/dist/core/registry/cards/pr.update.yaml +7 -2
  118. package/dist/core/registry/cards/pr.view.yaml +1 -0
  119. package/dist/core/registry/cards/project_v2.fields.list.yaml +18 -2
  120. package/dist/core/registry/cards/project_v2.items.field.update.yaml +8 -5
  121. package/dist/core/registry/cards/project_v2.items.issue.add.yaml +9 -5
  122. package/dist/core/registry/cards/project_v2.items.issue.remove.yaml +8 -5
  123. package/dist/core/registry/cards/project_v2.items.list.yaml +8 -2
  124. package/dist/core/registry/cards/project_v2.org.view.yaml +6 -2
  125. package/dist/core/registry/cards/project_v2.user.view.yaml +6 -2
  126. package/dist/core/registry/cards/release.list.yaml +8 -3
  127. package/dist/core/registry/cards/release.view.yaml +8 -4
  128. package/dist/core/registry/cards/repo.issue_types.list.yaml +7 -3
  129. package/dist/core/registry/cards/repo.labels.list.yaml +7 -2
  130. package/dist/core/registry/cards/repo.view.yaml +1 -0
  131. package/dist/index.d.ts +457 -0
  132. package/dist/index.js +12 -4
  133. package/dist/index.js.map +1 -1
  134. package/dist/{issue-mutations-FJNZW7L5.js → issue-mutations-DIWPF3JH.js} +98 -121
  135. package/dist/issue-mutations-DIWPF3JH.js.map +1 -0
  136. package/dist/issue-queries-YQL65J7X.js +93 -0
  137. package/dist/issue-queries-YQL65J7X.js.map +1 -0
  138. package/dist/{pr-mutations-UG67YOF5.js → pr-mutations-BVHDCAPR.js} +235 -95
  139. package/dist/pr-mutations-BVHDCAPR.js.map +1 -0
  140. package/dist/pr-queries-NUL2UZJB.js +143 -0
  141. package/dist/pr-queries-NUL2UZJB.js.map +1 -0
  142. package/dist/project-3ZSPVIOC.js +429 -0
  143. package/dist/project-3ZSPVIOC.js.map +1 -0
  144. package/dist/release-IQCWD655.js +57 -0
  145. package/dist/release-IQCWD655.js.map +1 -0
  146. package/dist/repo-JF47JAZG.js +82 -0
  147. package/dist/repo-JF47JAZG.js.map +1 -0
  148. package/package.json +9 -9
  149. package/skills/using-ghx/SKILL.md +78 -10
  150. package/dist/chunk-3P3KHWFU.js.map +0 -1
  151. package/dist/chunk-BIWBJA2F.js.map +0 -1
  152. package/dist/chunk-HEHONZTO.js.map +0 -1
  153. package/dist/chunk-Q7RCIK2C.js.map +0 -1
  154. package/dist/chunk-TDABI6C7.js +0 -167
  155. package/dist/chunk-TDABI6C7.js.map +0 -1
  156. package/dist/issue-mutations-FJNZW7L5.js.map +0 -1
  157. package/dist/issue-queries-GRA4MKPD.js.map +0 -1
  158. package/dist/pr-mutations-UG67YOF5.js.map +0 -1
  159. package/dist/pr-queries-UOEOXIJQ.js.map +0 -1
  160. package/dist/repo-JDUHFPZF.js +0 -66
  161. package/dist/repo-JDUHFPZF.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  import { DocumentNode } from 'graphql';
2
2
 
3
+ /**
4
+ * All possible error codes returned in {@link ResultError.code}.
5
+ *
6
+ * Retryable codes: `RATE_LIMIT`, `NETWORK`, `SERVER`.
7
+ */
3
8
  declare const errorCodes: {
4
9
  readonly Auth: "AUTH";
5
10
  readonly NotFound: "NOT_FOUND";
@@ -10,24 +15,49 @@ declare const errorCodes: {
10
15
  readonly AdapterUnsupported: "ADAPTER_UNSUPPORTED";
11
16
  readonly Unknown: "UNKNOWN";
12
17
  };
18
+ /** Union of all error code string literals. */
13
19
  type ErrorCode = (typeof errorCodes)[keyof typeof errorCodes];
14
20
 
21
+ /**
22
+ * All possible reason codes explaining why a particular route was selected.
23
+ *
24
+ * Included in {@link ResultMeta.reason}.
25
+ */
15
26
  declare const routeReasonCodes: readonly ["INPUT_VALIDATION", "OUTPUT_VALIDATION", "CARD_PREFERRED", "CARD_FALLBACK", "PREFLIGHT_FAILED", "ENV_CONSTRAINT", "CAPABILITY_LIMIT", "DEFAULT_POLICY"];
27
+ /** Reason code explaining why a particular route was selected. */
16
28
  type RouteReasonCode = (typeof routeReasonCodes)[number];
17
29
 
30
+ /** The transport route used to execute a capability. */
18
31
  type RouteSource = "cli" | "rest" | "graphql";
32
+ /**
33
+ * Structured error returned inside a {@link ResultEnvelope} when `ok` is `false`.
34
+ *
35
+ * @see {@link ErrorCode} for the full list of error codes.
36
+ */
19
37
  interface ResultError {
20
38
  code: ErrorCode;
21
39
  message: string;
22
40
  retryable: boolean;
23
41
  details?: Record<string, unknown>;
24
42
  }
43
+ /**
44
+ * Records a single route attempt during execution.
45
+ *
46
+ * The routing engine may try multiple routes (preferred → fallback).
47
+ * Each attempt is logged here regardless of outcome.
48
+ */
25
49
  interface AttemptMeta {
26
50
  route: RouteSource;
27
51
  status: "success" | "error" | "skipped";
28
52
  error_code?: ErrorCode;
29
53
  duration_ms?: number;
30
54
  }
55
+ /**
56
+ * Metadata attached to every {@link ResultEnvelope}.
57
+ *
58
+ * Provides observability into which route was used, why, how long it took,
59
+ * and the full list of route attempts.
60
+ */
31
61
  interface ResultMeta {
32
62
  capability_id: string;
33
63
  route_used?: RouteSource;
@@ -47,19 +77,35 @@ interface ResultMeta {
47
77
  tokens_out?: number;
48
78
  };
49
79
  }
80
+ /**
81
+ * The universal response contract for all ghx operations.
82
+ *
83
+ * Every call to {@link executeTask} returns a `ResultEnvelope` — it never throws.
84
+ * Check `ok` to distinguish success from failure; `data` and `error` are exclusive.
85
+ *
86
+ * @typeParam TData - The shape of the success payload, varies per capability.
87
+ */
50
88
  interface ResultEnvelope<TData = unknown> {
51
89
  ok: boolean;
52
90
  data?: TData;
53
91
  error?: ResultError;
54
92
  meta: ResultMeta;
55
93
  }
94
+ /** Aggregate outcome of a batch execution via {@link executeTasks}. */
56
95
  type ChainStatus = "success" | "partial" | "failed";
96
+ /** Result of a single step within a chain execution. */
57
97
  interface ChainStepResult {
58
98
  task: string;
59
99
  ok: boolean;
60
100
  data?: unknown;
61
101
  error?: ResultError;
62
102
  }
103
+ /**
104
+ * Response envelope for batch operations via {@link executeTasks}.
105
+ *
106
+ * Contains per-step results and aggregate metadata
107
+ * (total, succeeded, failed counts).
108
+ */
63
109
  interface ChainResultEnvelope {
64
110
  status: ChainStatus;
65
111
  results: ChainStepResult[];
@@ -71,7 +117,13 @@ interface ChainResultEnvelope {
71
117
  };
72
118
  }
73
119
 
120
+ /** A dotted capability identifier (e.g. `"pr.view"`, `"issue.labels.add"`). */
74
121
  type TaskId = string;
122
+ /**
123
+ * A request to execute a single ghx capability.
124
+ *
125
+ * @typeParam TInput - The shape of the input payload, varies per capability.
126
+ */
75
127
  interface TaskRequest<TInput = Record<string, unknown>> {
76
128
  task: TaskId;
77
129
  input: TInput;
@@ -82,13 +134,28 @@ type ExecuteTaskFn = (request: {
82
134
  input: Record<string, unknown>;
83
135
  options?: Record<string, unknown>;
84
136
  }) => Promise<ResultEnvelope>;
137
+ /**
138
+ * Creates an execute tool suitable for wiring into an AI agent's tool loop.
139
+ *
140
+ * Wraps the execution engine into a simple `{ execute(capabilityId, params) }` shape.
141
+ *
142
+ * @example
143
+ * ```ts
144
+ * const tool = createExecuteTool({
145
+ * executeTask: (req) => executeTask(req, deps),
146
+ * })
147
+ * const result = await tool.execute("repo.view", { owner: "aryeko", name: "ghx" })
148
+ * ```
149
+ */
85
150
  declare function createExecuteTool(deps: {
86
151
  executeTask: ExecuteTaskFn;
87
152
  }): {
88
153
  execute(capabilityId: string, params: Record<string, unknown>, options?: Record<string, unknown>): Promise<ResultEnvelope>;
89
154
  };
90
155
 
156
+ /** Represents a JSON Schema definition for card inputs/outputs. */
91
157
  type JsonSchema = Record<string, unknown>;
158
+ /** Defines when a fallback route should override the preferred route. */
92
159
  interface SuitabilityRule {
93
160
  when: "always" | "env" | "params";
94
161
  predicate: string;
@@ -173,16 +240,25 @@ interface NullLiteralInject {
173
240
  target: string;
174
241
  source: "null_literal";
175
242
  }
243
+ /** A specification for how to inject a resolved Phase 1 value into Phase 2. */
176
244
  type InjectSpec = ScalarInject | MapArrayInject | InputPassthroughInject | NullLiteralInject;
245
+ /** Defines the GraphQL query to run during the Phase 1 lookup. */
177
246
  interface LookupSpec {
178
247
  operationName: string;
179
248
  documentPath: string;
180
249
  vars: Record<string, string>;
181
250
  }
251
+ /** Configuration for a Phase 1 node ID lookup prior to mutation execution. */
182
252
  interface ResolutionConfig {
183
253
  lookup: LookupSpec;
184
254
  inject: InjectSpec[];
185
255
  }
256
+ /**
257
+ * Declarative configuration for a single ghx capability.
258
+ *
259
+ * Defines the capability's identity, input/output schemas, routing preferences,
260
+ * and adapter-specific execution details (GraphQL, CLI, REST).
261
+ */
186
262
  interface OperationCard<Input = Record<string, unknown>> {
187
263
  capability_id: string;
188
264
  version: string;
@@ -197,6 +273,7 @@ interface OperationCard<Input = Record<string, unknown>> {
197
273
  };
198
274
  graphql?: {
199
275
  operationName: string;
276
+ operationType: "query" | "mutation";
200
277
  documentPath: string;
201
278
  variables?: Record<string, string>;
202
279
  limits?: {
@@ -238,6 +315,7 @@ type SafeRunnerOptions = {
238
315
  };
239
316
  declare function createSafeCliCommandRunner(options?: SafeRunnerOptions): CliCommandRunner;
240
317
 
318
+ /** Structured explanation of a capability, returned by {@link explainCapability}. */
241
319
  type CapabilityExplanation = {
242
320
  capability_id: string;
243
321
  purpose: string;
@@ -247,11 +325,19 @@ type CapabilityExplanation = {
247
325
  fallback_routes: Array<"cli" | "graphql" | "rest">;
248
326
  output_fields: string[];
249
327
  };
328
+ /**
329
+ * Return a structured explanation of a capability by its ID.
330
+ *
331
+ * @throws If the capability ID is unknown.
332
+ */
250
333
  declare function explainCapability(capabilityId: string): CapabilityExplanation;
251
334
 
335
+ /** Return a copy of all registered operation cards, in canonical order. */
252
336
  declare function listOperationCards(): OperationCard[];
337
+ /** Look up a single operation card by its dotted capability ID (e.g. `"pr.view"`). */
253
338
  declare function getOperationCard(capabilityId: string): OperationCard | undefined;
254
339
 
340
+ /** Summary of a capability, returned by {@link listCapabilities}. */
255
341
  type CapabilityListItem = {
256
342
  capability_id: string;
257
343
  description: string;
@@ -259,31 +345,56 @@ type CapabilityListItem = {
259
345
  optional_inputs: string[];
260
346
  optional_inputs_detail: Record<string, unknown>;
261
347
  };
348
+ /**
349
+ * List all available capabilities, optionally filtered by domain.
350
+ *
351
+ * @param domain - Filter by top-level domain (e.g. `"pr"`, `"issue"`, `"workflow"`).
352
+ */
262
353
  declare function listCapabilities(domain?: string): CapabilityListItem[];
263
354
 
264
355
  type GraphqlVariables = Record<string, unknown>;
356
+ /** A single error from a GraphQL response. */
265
357
  type GraphqlError = {
266
358
  message: string;
267
359
  path?: ReadonlyArray<string | number>;
268
360
  extensions?: Record<string, unknown>;
269
361
  };
362
+ /** Raw GraphQL response containing both `data` and `errors` fields. */
270
363
  type GraphqlRawResult<TData> = {
271
364
  data: TData | undefined;
272
365
  errors: GraphqlError[] | undefined;
273
366
  };
274
367
  type GraphqlDocument = string | DocumentNode;
368
+ /**
369
+ * Low-level transport interface for sending GraphQL queries.
370
+ *
371
+ * Implement this to use a custom HTTP client, proxy, or mock.
372
+ * Pass to {@link createGithubClient} or {@link createGraphqlClient}.
373
+ */
275
374
  interface GraphqlTransport {
276
375
  execute<TData>(query: string, variables?: GraphqlVariables): Promise<TData>;
277
376
  executeRaw?<TData>(query: string, variables?: GraphqlVariables): Promise<GraphqlRawResult<TData>>;
278
377
  }
378
+ /**
379
+ * Higher-level GraphQL client with `query` and `queryRaw` methods.
380
+ *
381
+ * Created by {@link createGraphqlClient} from a {@link GraphqlTransport}.
382
+ */
279
383
  interface GraphqlClient {
280
384
  query<TData, TVariables extends GraphqlVariables = GraphqlVariables>(query: GraphqlDocument, variables?: TVariables): Promise<TData>;
281
385
  queryRaw<TData, TVariables extends GraphqlVariables = GraphqlVariables>(query: GraphqlDocument, variables?: TVariables): Promise<GraphqlRawResult<TData>>;
282
386
  }
387
+ /** Options for creating a token-based GraphQL transport. */
283
388
  type TokenClientOptions = {
284
389
  token: string;
285
390
  graphqlUrl?: string;
286
391
  };
392
+ /**
393
+ * Create a {@link GraphqlClient} from a {@link GraphqlTransport}.
394
+ *
395
+ * Wraps the raw transport `execute` method with query string normalization
396
+ * and a `queryRaw` method that returns settled results.
397
+ */
287
398
  declare function createGraphqlClient(transport: GraphqlTransport): GraphqlClient;
288
399
 
289
400
  type Maybe<T> = T | null;
@@ -383,6 +494,57 @@ type PrViewQueryVariables = Exact<{
383
494
  prNumber: Scalars["Int"]["input"];
384
495
  }>;
385
496
 
497
+ type ProjectV2FieldsListQueryVariables = Exact<{
498
+ owner: Scalars["String"]["input"];
499
+ projectNumber: Scalars["Int"]["input"];
500
+ first: Scalars["Int"]["input"];
501
+ after?: InputMaybe<Scalars["String"]["input"]>;
502
+ }>;
503
+
504
+ type ProjectV2ItemsListQueryVariables = Exact<{
505
+ owner: Scalars["String"]["input"];
506
+ projectNumber: Scalars["Int"]["input"];
507
+ first: Scalars["Int"]["input"];
508
+ after?: InputMaybe<Scalars["String"]["input"]>;
509
+ }>;
510
+
511
+ type ProjectV2OrgViewQueryVariables = Exact<{
512
+ org: Scalars["String"]["input"];
513
+ projectNumber: Scalars["Int"]["input"];
514
+ }>;
515
+
516
+ type ProjectV2UserViewQueryVariables = Exact<{
517
+ user: Scalars["String"]["input"];
518
+ projectNumber: Scalars["Int"]["input"];
519
+ }>;
520
+
521
+ type ReleaseListQueryVariables = Exact<{
522
+ owner: Scalars["String"]["input"];
523
+ name: Scalars["String"]["input"];
524
+ first: Scalars["Int"]["input"];
525
+ after?: InputMaybe<Scalars["String"]["input"]>;
526
+ }>;
527
+
528
+ type ReleaseViewQueryVariables = Exact<{
529
+ owner: Scalars["String"]["input"];
530
+ name: Scalars["String"]["input"];
531
+ tagName: Scalars["String"]["input"];
532
+ }>;
533
+
534
+ type RepoIssueTypesListQueryVariables = Exact<{
535
+ owner: Scalars["String"]["input"];
536
+ name: Scalars["String"]["input"];
537
+ first: Scalars["Int"]["input"];
538
+ after?: InputMaybe<Scalars["String"]["input"]>;
539
+ }>;
540
+
541
+ type RepoLabelsListQueryVariables = Exact<{
542
+ owner: Scalars["String"]["input"];
543
+ name: Scalars["String"]["input"];
544
+ first: Scalars["Int"]["input"];
545
+ after?: InputMaybe<Scalars["String"]["input"]>;
546
+ }>;
547
+
386
548
  type RepoViewQueryVariables = Exact<{
387
549
  owner: Scalars["String"]["input"];
388
550
  name: Scalars["String"]["input"];
@@ -547,6 +709,16 @@ type IssueLabelsAddData = {
547
709
  id: string;
548
710
  labels: string[];
549
711
  };
712
+ type IssueLabelsRemoveInput = {
713
+ owner: string;
714
+ name: string;
715
+ issueNumber: number;
716
+ labels: string[];
717
+ };
718
+ type IssueLabelsRemoveData = {
719
+ issueNumber: number;
720
+ removed: string[];
721
+ };
550
722
  type IssueAssigneesUpdateData = {
551
723
  id: string;
552
724
  assignees: string[];
@@ -563,6 +735,15 @@ type IssueMilestoneSetData = {
563
735
  id: string;
564
736
  milestoneNumber: number | null;
565
737
  };
738
+ type IssueMilestoneClearInput = {
739
+ owner: string;
740
+ name: string;
741
+ issueNumber: number;
742
+ };
743
+ type IssueMilestoneClearData = {
744
+ issueNumber: number;
745
+ cleared: boolean;
746
+ };
566
747
  type IssueCommentCreateData = {
567
748
  id: string;
568
749
  body: string;
@@ -736,7 +917,220 @@ type PrReviewSubmitData = {
736
917
  url: string;
737
918
  body: string | null;
738
919
  };
920
+ type RepoLabelsListInput = RepoLabelsListQueryVariables;
921
+ type RepoLabelItemData = {
922
+ id: string | null;
923
+ name: string | null;
924
+ description: string | null;
925
+ color: string | null;
926
+ isDefault: boolean | null;
927
+ };
928
+ type RepoLabelsListData = {
929
+ items: RepoLabelItemData[];
930
+ pageInfo: {
931
+ hasNextPage: boolean;
932
+ endCursor: string | null;
933
+ };
934
+ };
935
+ type RepoIssueTypesListInput = RepoIssueTypesListQueryVariables;
936
+ type RepoIssueTypeItemData = {
937
+ id: string | null;
938
+ name: string | null;
939
+ color: string | null;
940
+ isEnabled: boolean | null;
941
+ };
942
+ type RepoIssueTypesListData = {
943
+ items: RepoIssueTypeItemData[];
944
+ pageInfo: {
945
+ hasNextPage: boolean;
946
+ endCursor: string | null;
947
+ };
948
+ };
949
+ type ReleaseViewInput = ReleaseViewQueryVariables;
950
+ type ReleaseViewData = {
951
+ id: number | null;
952
+ tagName: string;
953
+ name: string | null;
954
+ isDraft: boolean;
955
+ isPrerelease: boolean;
956
+ url: string | null;
957
+ targetCommitish: string | null;
958
+ createdAt: string | null;
959
+ publishedAt: string | null;
960
+ };
961
+ type ReleaseListInput = ReleaseListQueryVariables;
962
+ type ReleaseItemData = ReleaseViewData;
963
+ type ReleaseListData = {
964
+ items: ReleaseItemData[];
965
+ pageInfo: {
966
+ hasNextPage: boolean;
967
+ endCursor: string | null;
968
+ };
969
+ };
970
+ type ProjectV2OrgViewInput = ProjectV2OrgViewQueryVariables;
971
+ type ProjectV2OrgViewData = {
972
+ id: string | null;
973
+ title: string | null;
974
+ shortDescription: string | null;
975
+ public: boolean | null;
976
+ closed: boolean | null;
977
+ url: string | null;
978
+ };
979
+ type ProjectV2UserViewInput = ProjectV2UserViewQueryVariables;
980
+ type ProjectV2UserViewData = ProjectV2OrgViewData;
981
+ type ProjectV2FieldsListInput = ProjectV2FieldsListQueryVariables;
982
+ type ProjectV2FieldItemData = {
983
+ id: string | null;
984
+ name: string | null;
985
+ dataType: string | null;
986
+ options?: Array<{
987
+ id: string;
988
+ name: string;
989
+ }> | null;
990
+ };
991
+ type ProjectV2FieldsListData = {
992
+ items: ProjectV2FieldItemData[];
993
+ pageInfo: {
994
+ hasNextPage: boolean;
995
+ endCursor: string | null;
996
+ };
997
+ };
998
+ type ProjectV2ItemsListInput = ProjectV2ItemsListQueryVariables;
999
+ type ProjectV2ItemData = {
1000
+ id: string | null;
1001
+ contentType: string | null;
1002
+ contentNumber: number | null;
1003
+ contentTitle: string | null;
1004
+ };
1005
+ type ProjectV2ItemsListData = {
1006
+ items: ProjectV2ItemData[];
1007
+ pageInfo: {
1008
+ hasNextPage: boolean;
1009
+ endCursor: string | null;
1010
+ };
1011
+ };
1012
+ type PrCreateInput = {
1013
+ owner: string;
1014
+ name: string;
1015
+ baseRefName: string;
1016
+ headRefName: string;
1017
+ title: string;
1018
+ body?: string;
1019
+ draft?: boolean;
1020
+ };
1021
+ type PrCreateData = {
1022
+ number: number;
1023
+ url: string;
1024
+ title: string;
1025
+ state: string;
1026
+ draft: boolean;
1027
+ };
1028
+ type PrUpdateInput = {
1029
+ owner: string;
1030
+ name: string;
1031
+ prNumber: number;
1032
+ title?: string;
1033
+ body?: string;
1034
+ draft?: boolean;
1035
+ };
1036
+ type PrUpdateData = {
1037
+ number: number;
1038
+ url: string;
1039
+ title: string;
1040
+ state: string;
1041
+ draft: boolean;
1042
+ };
1043
+ type PrMergeInput = {
1044
+ owner: string;
1045
+ name: string;
1046
+ prNumber: number;
1047
+ mergeMethod?: string;
1048
+ deleteBranch?: boolean;
1049
+ };
1050
+ type PrMergeData = {
1051
+ prNumber: number;
1052
+ method: string;
1053
+ isMethodAssumed: boolean;
1054
+ queued: boolean;
1055
+ deleteBranch: boolean;
1056
+ };
1057
+ type PrBranchUpdateInput = {
1058
+ owner: string;
1059
+ name: string;
1060
+ prNumber: number;
1061
+ updateMethod?: string;
1062
+ };
1063
+ type PrBranchUpdateData = {
1064
+ prNumber: number;
1065
+ updated: boolean;
1066
+ };
1067
+ type PrAssigneesInput = {
1068
+ owner: string;
1069
+ name: string;
1070
+ prNumber: number;
1071
+ assignees: string[];
1072
+ };
1073
+ type PrAssigneesAddInput = PrAssigneesInput;
1074
+ type PrAssigneesRemoveInput = PrAssigneesInput;
1075
+ type PrAssigneesAddData = {
1076
+ prNumber: number;
1077
+ added: string[];
1078
+ };
1079
+ type PrAssigneesRemoveData = {
1080
+ prNumber: number;
1081
+ removed: string[];
1082
+ };
1083
+ type PrReviewsRequestInput = {
1084
+ owner: string;
1085
+ name: string;
1086
+ prNumber: number;
1087
+ reviewers: string[];
1088
+ };
1089
+ type PrReviewsRequestData = {
1090
+ prNumber: number;
1091
+ reviewers: string[];
1092
+ updated: boolean;
1093
+ };
1094
+ type ProjectV2ItemAddInput = {
1095
+ owner: string;
1096
+ projectNumber: number;
1097
+ issueUrl: string;
1098
+ };
1099
+ type ProjectV2ItemAddData = {
1100
+ itemId: string;
1101
+ itemType: string | null;
1102
+ };
1103
+ type ProjectV2ItemRemoveInput = {
1104
+ owner: string;
1105
+ projectNumber: number;
1106
+ itemId: string;
1107
+ };
1108
+ type ProjectV2ItemRemoveData = {
1109
+ deletedItemId: string;
1110
+ };
1111
+ type ProjectV2ItemFieldUpdateInput = {
1112
+ projectId: string;
1113
+ itemId: string;
1114
+ fieldId: string;
1115
+ valueText?: string;
1116
+ valueNumber?: number;
1117
+ valueDate?: string;
1118
+ valueSingleSelectOptionId?: string;
1119
+ valueIterationId?: string;
1120
+ clear?: boolean;
1121
+ };
1122
+ type ProjectV2ItemFieldUpdateData = {
1123
+ itemId: string;
1124
+ };
739
1125
 
1126
+ /**
1127
+ * High-level GitHub API client with 50+ typed methods.
1128
+ *
1129
+ * Extends {@link GraphqlClient} with domain-specific helpers for issues, PRs,
1130
+ * releases, projects, and repos. Domain modules are lazy-loaded on first use.
1131
+ *
1132
+ * Create via {@link createGithubClientFromToken} or {@link createGithubClient}.
1133
+ */
740
1134
  interface GithubClient extends GraphqlClient {
741
1135
  fetchRepoView(input: RepoViewInput): Promise<RepoViewData>;
742
1136
  fetchIssueCommentsList(input: IssueCommentsListInput): Promise<IssueCommentsListData>;
@@ -747,10 +1141,12 @@ interface GithubClient extends GraphqlClient {
747
1141
  deleteIssue(input: IssueMutationInput): Promise<IssueMutationData>;
748
1142
  updateIssueLabels(input: IssueLabelsUpdateInput): Promise<IssueLabelsUpdateData>;
749
1143
  addIssueLabels(input: IssueLabelsAddInput): Promise<IssueLabelsAddData>;
1144
+ removeIssueLabels(input: IssueLabelsRemoveInput): Promise<IssueLabelsRemoveData>;
750
1145
  updateIssueAssignees(input: IssueAssigneesUpdateInput): Promise<IssueAssigneesUpdateData>;
751
1146
  addIssueAssignees(input: IssueAssigneesAddInput): Promise<IssueAssigneesAddData>;
752
1147
  removeIssueAssignees(input: IssueAssigneesRemoveInput): Promise<IssueAssigneesRemoveData>;
753
1148
  setIssueMilestone(input: IssueMilestoneSetInput): Promise<IssueMilestoneSetData>;
1149
+ clearIssueMilestone(input: IssueMilestoneClearInput): Promise<IssueMilestoneClearData>;
754
1150
  createIssueComment(input: IssueCommentCreateInput): Promise<IssueCommentCreateData>;
755
1151
  fetchIssueLinkedPrs(input: IssueLinkedPrsListInput): Promise<IssueLinkedPrsListData>;
756
1152
  fetchIssueRelations(input: IssueRelationsGetInput): Promise<IssueRelationsGetData>;
@@ -770,10 +1166,47 @@ interface GithubClient extends GraphqlClient {
770
1166
  resolveReviewThread(input: ReviewThreadMutationInput): Promise<ReviewThreadMutationData>;
771
1167
  unresolveReviewThread(input: ReviewThreadMutationInput): Promise<ReviewThreadMutationData>;
772
1168
  submitPrReview(input: PrReviewSubmitInput): Promise<PrReviewSubmitData>;
1169
+ fetchRepoLabelsList(input: RepoLabelsListInput): Promise<RepoLabelsListData>;
1170
+ fetchRepoIssueTypesList(input: RepoIssueTypesListInput): Promise<RepoIssueTypesListData>;
1171
+ fetchReleaseView(input: ReleaseViewInput): Promise<ReleaseViewData>;
1172
+ fetchReleaseList(input: ReleaseListInput): Promise<ReleaseListData>;
1173
+ fetchProjectV2OrgView(input: ProjectV2OrgViewInput): Promise<ProjectV2OrgViewData>;
1174
+ fetchProjectV2UserView(input: ProjectV2UserViewInput): Promise<ProjectV2UserViewData>;
1175
+ fetchProjectV2FieldsList(input: ProjectV2FieldsListInput): Promise<ProjectV2FieldsListData>;
1176
+ fetchProjectV2ItemsList(input: ProjectV2ItemsListInput): Promise<ProjectV2ItemsListData>;
1177
+ createPr(input: PrCreateInput): Promise<PrCreateData>;
1178
+ updatePr(input: PrUpdateInput): Promise<PrUpdateData>;
1179
+ mergePr(input: PrMergeInput): Promise<PrMergeData>;
1180
+ updatePrBranch(input: PrBranchUpdateInput): Promise<PrBranchUpdateData>;
1181
+ addPrAssignees(input: PrAssigneesAddInput): Promise<PrAssigneesAddData>;
1182
+ removePrAssignees(input: PrAssigneesRemoveInput): Promise<PrAssigneesRemoveData>;
1183
+ requestPrReviews(input: PrReviewsRequestInput): Promise<PrReviewsRequestData>;
1184
+ addProjectV2Item(input: ProjectV2ItemAddInput): Promise<ProjectV2ItemAddData>;
1185
+ removeProjectV2Item(input: ProjectV2ItemRemoveInput): Promise<ProjectV2ItemRemoveData>;
1186
+ updateProjectV2ItemField(input: ProjectV2ItemFieldUpdateInput): Promise<ProjectV2ItemFieldUpdateData>;
773
1187
  }
1188
+ /**
1189
+ * Create a {@link GithubClient} from a token (string or options object).
1190
+ *
1191
+ * Uses the default `fetch`-based transport. For custom transports, use
1192
+ * {@link createGithubClient} instead.
1193
+ *
1194
+ * @throws If the token is empty.
1195
+ */
774
1196
  declare function createGithubClientFromToken(tokenOrOptions: string | TokenClientOptions): GithubClient;
1197
+ /**
1198
+ * Create a {@link GithubClient} from a custom {@link GraphqlTransport}.
1199
+ *
1200
+ * Use this for enterprise endpoints, proxies, or test mocking.
1201
+ */
775
1202
  declare function createGithubClient(transport: GraphqlTransport): GithubClient;
776
1203
 
1204
+ /**
1205
+ * Cache for Phase 1 resolution lookups in batch execution.
1206
+ *
1207
+ * Avoids redundant GraphQL lookups when the same entity is referenced
1208
+ * by multiple steps in a chain.
1209
+ */
777
1210
  interface ResolutionCache {
778
1211
  get(key: string): unknown | undefined;
779
1212
  set(key: string, value: unknown): void;
@@ -787,9 +1220,20 @@ interface ResolutionCacheOptions {
787
1220
  /** Maximum number of cached entries. Default: 200. */
788
1221
  maxEntries?: number;
789
1222
  }
1223
+ /**
1224
+ * Create an in-memory resolution cache with TTL and FIFO eviction.
1225
+ *
1226
+ * Pass to `ExecutionDeps.resolutionCache` for batch operations.
1227
+ */
790
1228
  declare function createResolutionCache(opts?: ResolutionCacheOptions): ResolutionCache;
1229
+ /** Build a deterministic cache key from an operation name and variables. */
791
1230
  declare function buildCacheKey(operationName: string, variables: Record<string, unknown>): string;
792
1231
 
1232
+ /**
1233
+ * Dependencies required by the execution engine.
1234
+ *
1235
+ * Pass to {@link executeTask} or {@link executeTasks}.
1236
+ */
793
1237
  type ExecutionDeps = {
794
1238
  githubClient: GithubClient;
795
1239
  githubToken?: string | null;
@@ -800,7 +1244,20 @@ type ExecutionDeps = {
800
1244
  reason?: RouteReasonCode;
801
1245
  resolutionCache?: ResolutionCache;
802
1246
  };
1247
+
1248
+ /**
1249
+ * Execute a single GitHub operation.
1250
+ *
1251
+ * Looks up the operation card, validates input, selects a route, and returns
1252
+ * a {@link ResultEnvelope}. Never throws.
1253
+ */
803
1254
  declare function executeTask(request: TaskRequest, deps: ExecutionDeps): Promise<ResultEnvelope>;
1255
+ /**
1256
+ * Execute multiple operations as a batch.
1257
+ *
1258
+ * Classifies steps, resolves node IDs via Phase 1 lookups, batches GraphQL
1259
+ * operations, and returns a {@link ChainResultEnvelope}.
1260
+ */
804
1261
  declare function executeTasks(requests: Array<{
805
1262
  task: string;
806
1263
  input: Record<string, unknown>;
package/dist/index.js CHANGED
@@ -10,13 +10,21 @@ import {
10
10
  getOperationCard,
11
11
  listCapabilities,
12
12
  listOperationCards
13
- } from "./chunk-3P3KHWFU.js";
14
- import "./chunk-Q7RCIK2C.js";
13
+ } from "./chunk-T3L2VDOS.js";
14
+ import "./chunk-H7CLZHRO.js";
15
+ import "./chunk-NQ53ETYV.js";
16
+ import "./chunk-TGL33GEA.js";
17
+ import "./chunk-Q2NW7DJE.js";
15
18
  import "./chunk-3DU2WHXF.js";
16
- import "./chunk-TDABI6C7.js";
19
+ import "./chunk-QRHKAMRY.js";
20
+ import "./chunk-TPQYVCAS.js";
21
+ import "./chunk-7HUKYNI2.js";
22
+ import "./chunk-ZGBVX2VG.js";
23
+ import "./chunk-GQO6BHJV.js";
24
+ import "./chunk-R3CBGJZX.js";
17
25
  import {
18
26
  createGraphqlClient
19
- } from "./chunk-HEHONZTO.js";
27
+ } from "./chunk-C2KRRSSX.js";
20
28
 
21
29
  // src/core/execute/execute-tool.ts
22
30
  function createExecuteTool(deps) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/execute/execute-tool.ts"],"sourcesContent":["import type { ResultEnvelope } from \"../contracts/envelope.js\"\n\ntype ExecuteTaskFn = (request: {\n task: string\n input: Record<string, unknown>\n options?: Record<string, unknown>\n}) => Promise<ResultEnvelope>\n\nexport function createExecuteTool(deps: { executeTask: ExecuteTaskFn }) {\n return {\n execute(\n capabilityId: string,\n params: Record<string, unknown>,\n options?: Record<string, unknown>,\n ): Promise<ResultEnvelope> {\n const request = {\n task: capabilityId,\n input: params,\n ...(options ? { options } : {}),\n }\n\n return deps.executeTask(request)\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQO,SAAS,kBAAkB,MAAsC;AACtE,SAAO;AAAA,IACL,QACE,cACA,QACA,SACyB;AACzB,YAAM,UAAU;AAAA,QACd,MAAM;AAAA,QACN,OAAO;AAAA,QACP,GAAI,UAAU,EAAE,QAAQ,IAAI,CAAC;AAAA,MAC/B;AAEA,aAAO,KAAK,YAAY,OAAO;AAAA,IACjC;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/core/execute/execute-tool.ts"],"sourcesContent":["import type { ResultEnvelope } from \"../contracts/envelope.js\"\n\ntype ExecuteTaskFn = (request: {\n task: string\n input: Record<string, unknown>\n options?: Record<string, unknown>\n}) => Promise<ResultEnvelope>\n\n/**\n * Creates an execute tool suitable for wiring into an AI agent's tool loop.\n *\n * Wraps the execution engine into a simple `{ execute(capabilityId, params) }` shape.\n *\n * @example\n * ```ts\n * const tool = createExecuteTool({\n * executeTask: (req) => executeTask(req, deps),\n * })\n * const result = await tool.execute(\"repo.view\", { owner: \"aryeko\", name: \"ghx\" })\n * ```\n */\nexport function createExecuteTool(deps: { executeTask: ExecuteTaskFn }) {\n return {\n execute(\n capabilityId: string,\n params: Record<string, unknown>,\n options?: Record<string, unknown>,\n ): Promise<ResultEnvelope> {\n const request = {\n task: capabilityId,\n input: params,\n ...(options ? { options } : {}),\n }\n\n return deps.executeTask(request)\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBO,SAAS,kBAAkB,MAAsC;AACtE,SAAO;AAAA,IACL,QACE,cACA,QACA,SACyB;AACzB,YAAM,UAAU;AAAA,QACd,MAAM;AAAA,QACN,OAAO;AAAA,QACP,GAAI,UAAU,EAAE,QAAQ,IAAI,CAAC;AAAA,MAC/B;AAEA,aAAO,KAAK,YAAY,OAAO;AAAA,IACjC;AAAA,EACF;AACF;","names":[]}