@shipfox/api-integration-github 2.0.0 → 4.0.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipfox/api-integration-github",
3
3
  "license": "MIT",
4
- "version": "2.0.0",
4
+ "version": "4.0.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ShipfoxHQ/shipfox.git",
@@ -37,26 +37,26 @@
37
37
  "ky": "^2.0.0",
38
38
  "octokit": "^5.0.3",
39
39
  "zod": "^4.4.3",
40
- "@shipfox/api-auth-context": "2.0.0",
41
- "@shipfox/api-integration-core-dto": "2.0.0",
42
- "@shipfox/api-workspaces": "2.0.0",
43
- "@shipfox/api-integration-github-dto": "2.0.0",
40
+ "@shipfox/api-auth-context": "3.0.0",
41
+ "@shipfox/api-integration-core-dto": "3.0.0",
42
+ "@shipfox/api-integration-github-dto": "3.0.0",
43
+ "@shipfox/api-workspaces": "4.0.0",
44
44
  "@shipfox/config": "1.2.1",
45
- "@shipfox/node-fastify": "0.2.1",
46
- "@shipfox/node-drizzle": "0.2.1",
45
+ "@shipfox/node-drizzle": "0.3.0",
46
+ "@shipfox/node-fastify": "0.2.2",
47
47
  "@shipfox/node-postgres": "0.4.1",
48
- "@shipfox/node-opentelemetry": "0.5.0"
48
+ "@shipfox/node-opentelemetry": "0.5.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/pg": "^8.15.5",
52
52
  "drizzle-kit": "^0.31.10",
53
53
  "fastify": "^5.3.3",
54
54
  "fastify-type-provider-zod": "^6.0.0",
55
- "fishery": "^2.2.2",
56
- "@shipfox/typescript": "1.1.6",
57
- "@shipfox/ts-config": "1.3.8",
55
+ "fishery": "^2.4.0",
58
56
  "@shipfox/biome": "1.8.1",
59
57
  "@shipfox/swc": "1.2.5",
58
+ "@shipfox/ts-config": "1.3.8",
59
+ "@shipfox/typescript": "1.1.6",
60
60
  "@shipfox/vitest": "1.2.2"
61
61
  },
62
62
  "scripts": {
@@ -1,6 +1,7 @@
1
1
  import {Buffer} from 'node:buffer';
2
+ import {DEFAULT_JOB_LOG_TAIL_LINES} from '@shipfox/api-integration-github-dto';
2
3
 
3
- export const DEFAULT_JOB_LOG_TAIL_LINES = 500;
4
+ export {DEFAULT_JOB_LOG_TAIL_LINES} from '@shipfox/api-integration-github-dto';
4
5
  export const DEFAULT_JOB_LOG_CONTENT_WINDOW_LINES = 5000;
5
6
  export const MAX_JOB_LOG_RING_BUFFER_LINES = 100000;
6
7
  export const MAX_JOB_LOG_LINE_BYTES = 10 * 1024 * 1024;
@@ -1,42 +1 @@
1
- import type {AgentToolSelectionCatalog, AgentToolSelector} from '@shipfox/api-integration-core-dto';
2
- import type {GithubAgentToolCatalogEntry} from './agent-tools.js';
3
-
4
- export function buildGithubAgentToolSelectionCatalog(
5
- catalog: readonly GithubAgentToolCatalogEntry[],
6
- ): AgentToolSelectionCatalog {
7
- return {
8
- selectors: catalog.flatMap((entry): AgentToolSelector[] => {
9
- if (!entry.methods) {
10
- return [
11
- {
12
- token: entry.id,
13
- kind: 'standalone',
14
- sensitivity: entry.sensitivity,
15
- sensitive: entry.sensitive,
16
- },
17
- ];
18
- }
19
-
20
- return [
21
- {
22
- token: entry.id,
23
- kind: 'family',
24
- sensitivity: entry.sensitivity,
25
- sensitive: entry.sensitive,
26
- },
27
- {
28
- token: `${entry.id}.*`,
29
- kind: 'family_wildcard',
30
- sensitivity: entry.sensitivity,
31
- sensitive: entry.sensitive,
32
- },
33
- ...entry.methods.map((method) => ({
34
- token: `${entry.id}.${method.id}`,
35
- kind: 'method' as const,
36
- sensitivity: method.sensitivity,
37
- sensitive: method.sensitive,
38
- })),
39
- ];
40
- }),
41
- };
42
- }
1
+ export {buildGithubAgentToolSelectionCatalog} from '@shipfox/api-integration-github-dto';
@@ -140,7 +140,7 @@ const expectedCatalogRows = [
140
140
  sensitivity: 'write',
141
141
  sensitive: false,
142
142
  requiredScope: [{permission: 'pull_requests', access: 'write'}],
143
- methods: ['create', 'submit_pending', 'delete_pending', 'resolve_thread', 'unresolve_thread'],
143
+ methods: ['create', 'submit_pending', 'delete_pending'],
144
144
  },
145
145
  {
146
146
  id: 'add_comment_to_pending_review',
@@ -259,6 +259,7 @@ describe('github agent tool catalog', () => {
259
259
  const addIssueCommentSchema = inputSchemaFor('add_issue_comment');
260
260
  const updatePullRequestSchema = inputSchemaFor('update_pull_request');
261
261
  const addReplySchema = inputSchemaFor('add_reply_to_pull_request_comment');
262
+ const pullRequestReadSchema = inputSchemaFor('pull_request_read');
262
263
  const actionsRunTriggerSchema = inputSchemaFor('actions_run_trigger');
263
264
  const getJobLogsSchema = inputSchemaFor('get_job_logs');
264
265
 
@@ -273,6 +274,17 @@ describe('github agent tool catalog', () => {
273
274
  {required: ['pull_number', 'body']},
274
275
  {required: ['reaction']},
275
276
  ]);
277
+ expect(pullRequestReadSchema.oneOf).toEqual([
278
+ {properties: {method: {const: 'get'}}, required: []},
279
+ {properties: {method: {const: 'get_diff'}}, required: []},
280
+ {properties: {method: {const: 'get_status'}}, required: ['ref']},
281
+ {properties: {method: {const: 'get_files'}}, required: []},
282
+ {properties: {method: {const: 'get_commits'}}, required: []},
283
+ {properties: {method: {const: 'get_review_comments'}}, required: []},
284
+ {properties: {method: {const: 'get_reviews'}}, required: []},
285
+ {properties: {method: {const: 'get_comments'}}, required: []},
286
+ {properties: {method: {const: 'get_check_runs'}}, required: ['ref']},
287
+ ]);
276
288
  expect(actionsRunTriggerSchema.oneOf).toEqual([
277
289
  {properties: {method: {const: 'run_workflow'}}, required: ['workflow_id', 'ref']},
278
290
  {properties: {method: {const: 'rerun_workflow_run'}}, required: ['run_id']},
@@ -357,6 +369,19 @@ describe('github agent tool catalog', () => {
357
369
  });
358
370
  });
359
371
 
372
+ it('requires a ref for pull request status and check-run reads', async () => {
373
+ const result = await callGithubTool(
374
+ 'pull_request_read',
375
+ {method: 'get_status', owner: 'shipfox', repo: 'platform', pull_number: 2},
376
+ {state: 'success'},
377
+ );
378
+
379
+ expect(result).toEqual({
380
+ isError: true,
381
+ content: [{type: 'text', text: 'Missing required parameter: ref'}],
382
+ });
383
+ });
384
+
360
385
  it.each([
361
386
  {
362
387
  toolId: 'list_issue_types',
@@ -423,6 +448,18 @@ describe('github agent tool catalog', () => {
423
448
  data: 'diff --git a/file b/file',
424
449
  expected: {result: 'diff --git a/file b/file'},
425
450
  },
451
+ {
452
+ toolId: 'pull_request_read',
453
+ arguments: {
454
+ method: 'get_check_runs',
455
+ owner: 'shipfox',
456
+ repo: 'platform',
457
+ pull_number: 2,
458
+ ref: 'abc123',
459
+ },
460
+ data: {total_count: 1},
461
+ expected: {total_count: 1},
462
+ },
426
463
  ] satisfies Array<{
427
464
  toolId: GithubAgentToolId;
428
465
  arguments: Record<string, unknown>;