@inkeep/agents-work-apps 0.0.0-dev-20260225135850 → 0.0.0-dev-20260225150948

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,11 +1,11 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types9 from "hono/types";
2
+ import * as hono_types3 from "hono/types";
3
3
 
4
4
  //#region src/github/mcp/index.d.ts
5
5
  declare const app: Hono<{
6
6
  Variables: {
7
7
  toolId: string;
8
8
  };
9
- }, hono_types9.BlankSchema, "/">;
9
+ }, hono_types3.BlankSchema, "/">;
10
10
  //#endregion
11
11
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import runDbClient_default from "../../db/runDbClient.js";
2
2
  import { githubMcpAuth } from "./auth.js";
3
3
  import { ReactionContentSchema } from "./schemas.js";
4
- import { commitFileChanges, commitNewFile, createIssueCommentReaction, createPullRequestReviewCommentReaction, deleteIssueCommentReaction, deletePullRequestReviewCommentReaction, fetchBranchChangedFiles, fetchComments, fetchPrFileDiffs, fetchPrFiles, fetchPrInfo, formatFileDiff, generatePrMarkdown, getGitHubClientFromRepo, listIssueCommentReactions, listIssueReactions, listPullRequestReviewCommentReactions, visualizeUpdateOperations } from "./utils.js";
4
+ import { commitFileChanges, commitNewFile, createIssueCommentReaction, createPullRequestReviewCommentReaction, deleteIssueCommentReaction, deletePullRequestReviewCommentReaction, fetchBranchChangedFiles, fetchComments, fetchPrFileDiffs, fetchPrFiles, fetchPrInfo, formatFileDiff, generatePrMarkdown, getGitHubClientFromRepo, listIssueCommentReactions, listIssueReactions, listPullRequestReviewCommentReactions, moveFile, visualizeUpdateOperations } from "./utils.js";
5
5
  import { z } from "@hono/zod-openapi";
6
6
  import { getMcpToolRepositoryAccessWithDetails } from "@inkeep/agents-core";
7
7
  import { Hono } from "hono";
@@ -519,6 +519,66 @@ const getServer = async (toolId) => {
519
519
  };
520
520
  }
521
521
  });
522
+ server.tool("move-file", `Move (rename) a file within a repository in a single atomic commit. The file content is preserved and the old path is deleted. ${getAvailableRepositoryString(repositoryAccess)}`, {
523
+ owner: z.string().describe("Repository owner name"),
524
+ repo: z.string().describe("Repository name"),
525
+ branch_name: z.string().describe("Branch to commit the move to"),
526
+ source_path: z.string().describe("Current path of the file (relative to repository root)"),
527
+ destination_path: z.string().describe("New path for the file (relative to repository root)"),
528
+ commit_message: z.string().describe("Commit message for the move")
529
+ }, async ({ owner, repo, branch_name, source_path, destination_path, commit_message }) => {
530
+ try {
531
+ let githubClient;
532
+ try {
533
+ githubClient = getGitHubClientFromRepo(owner, repo, installationIdMap);
534
+ } catch (error) {
535
+ return {
536
+ content: [{
537
+ type: "text",
538
+ text: `Error accessing GitHub: ${error instanceof Error ? error.message : "Unknown error"}`
539
+ }],
540
+ isError: true
541
+ };
542
+ }
543
+ return { content: [{
544
+ type: "text",
545
+ text: `Successfully moved "${source_path}" to "${destination_path}" in ${owner}/${repo} on branch "${branch_name}"\n\nCommit SHA: ${await moveFile({
546
+ githubClient,
547
+ owner,
548
+ repo,
549
+ sourcePath: source_path,
550
+ destinationPath: destination_path,
551
+ branchName: branch_name,
552
+ commitMessage: commit_message
553
+ })}`
554
+ }] };
555
+ } catch (error) {
556
+ if (error instanceof Error && "status" in error) {
557
+ const apiError = error;
558
+ if (apiError.status === 404) return {
559
+ content: [{
560
+ type: "text",
561
+ text: `Repository ${owner}/${repo}, branch "${branch_name}", or source file "${source_path}" not found.`
562
+ }],
563
+ isError: true
564
+ };
565
+ if (apiError.status === 422) return {
566
+ content: [{
567
+ type: "text",
568
+ text: `Invalid move operation. The destination path "${destination_path}" may already exist or the path is invalid.`
569
+ }],
570
+ isError: true
571
+ };
572
+ }
573
+ return {
574
+ content: [{
575
+ type: "text",
576
+ text: `Error moving file: ${error instanceof Error ? error.message : "Unknown error"}`
577
+ }],
578
+ isError: true
579
+ };
580
+ }
581
+ });
522
582
  server.tool("create-pull-request", `Create a pull request in a repository. ${getAvailableRepositoryString(repositoryAccess)}`, {
523
583
  owner: z.string().describe("Repository owner name"),
524
584
  repo: z.string().describe("Repository name"),
@@ -236,6 +236,23 @@ declare function commitNewFile({
236
236
  content: string;
237
237
  commitMessage: string;
238
238
  }): Promise<string>;
239
+ declare function moveFile({
240
+ githubClient,
241
+ owner,
242
+ repo,
243
+ sourcePath,
244
+ destinationPath,
245
+ branchName,
246
+ commitMessage
247
+ }: {
248
+ githubClient: Octokit;
249
+ owner: string;
250
+ repo: string;
251
+ sourcePath: string;
252
+ destinationPath: string;
253
+ branchName: string;
254
+ commitMessage: string;
255
+ }): Promise<string>;
239
256
  declare function createIssueCommentReaction(octokit: Octokit, owner: string, repo: string, commentId: number, content: ReactionContent): Promise<{
240
257
  id: number;
241
258
  content: string;
@@ -257,4 +274,4 @@ declare function listPullRequestReviewCommentReactions(octokit: Octokit, owner:
257
274
  declare function listIssueReactions(octokit: Octokit, owner: string, repo: string, issueNumber: number): Promise<ReactionDetail[]>;
258
275
  declare function formatFileDiff(pullRequestNumber: number, files: ChangedFile[], includeContents?: boolean): Promise<string>;
259
276
  //#endregion
260
- export { CommitData, LLMUpdateOperation, PullCommit, ReactionDetail, applyOperation, applyOperations, commitFileChanges, commitNewFile, createIssueCommentReaction, createPullRequestReviewCommentReaction, deleteIssueCommentReaction, deletePullRequestReviewCommentReaction, fetchBranchChangedFiles, fetchComments, fetchCommitDetails, fetchPrCommits, fetchPrFileDiffs, fetchPrFiles, fetchPrInfo, formatFileDiff, generatePrMarkdown, getFilePathsInRepo, getGitHubClientFromInstallationId, getGitHubClientFromRepo, listIssueCommentReactions, listIssueReactions, listPullRequestReviewCommentReactions, validateLineNumbers, visualizeUpdateOperations };
277
+ export { CommitData, LLMUpdateOperation, PullCommit, ReactionDetail, applyOperation, applyOperations, commitFileChanges, commitNewFile, createIssueCommentReaction, createPullRequestReviewCommentReaction, deleteIssueCommentReaction, deletePullRequestReviewCommentReaction, fetchBranchChangedFiles, fetchComments, fetchCommitDetails, fetchPrCommits, fetchPrFileDiffs, fetchPrFiles, fetchPrInfo, formatFileDiff, generatePrMarkdown, getFilePathsInRepo, getGitHubClientFromInstallationId, getGitHubClientFromRepo, listIssueCommentReactions, listIssueReactions, listPullRequestReviewCommentReactions, moveFile, validateLineNumbers, visualizeUpdateOperations };
@@ -615,33 +615,22 @@ function visualizeUpdateOperations(fileContent, operations) {
615
615
  return `Error applying operations: ${error instanceof Error ? error.message : "Unknown error"}`;
616
616
  }
617
617
  }
618
- async function commitContent({ githubClient, owner, repo, filePath, branchName, content, commitMessage }) {
618
+ async function commitTreeEntries({ githubClient, owner, repo, branchName, treeEntries, commitMessage }) {
619
619
  const currentSha = (await githubClient.rest.git.getRef({
620
620
  owner,
621
621
  repo,
622
622
  ref: `heads/${branchName}`
623
623
  })).data.object.sha;
624
- const currentTreeSha = (await githubClient.rest.git.getCommit({
624
+ const currentCommit = await githubClient.rest.git.getCommit({
625
625
  owner,
626
626
  repo,
627
627
  commit_sha: currentSha
628
- })).data.tree.sha;
629
- const blob = await githubClient.rest.git.createBlob({
630
- owner,
631
- repo,
632
- content: Buffer.from(content).toString("base64"),
633
- encoding: "base64"
634
628
  });
635
629
  const newTree = await githubClient.rest.git.createTree({
636
630
  owner,
637
631
  repo,
638
- base_tree: currentTreeSha,
639
- tree: [{
640
- path: filePath,
641
- mode: "100644",
642
- type: "blob",
643
- sha: blob.data.sha
644
- }]
632
+ base_tree: currentCommit.data.tree.sha,
633
+ tree: treeEntries
645
634
  });
646
635
  const newCommit = await githubClient.rest.git.createCommit({
647
636
  owner,
@@ -658,6 +647,26 @@ async function commitContent({ githubClient, owner, repo, filePath, branchName,
658
647
  });
659
648
  return newCommit.data.sha;
660
649
  }
650
+ async function commitContent({ githubClient, owner, repo, filePath, branchName, content, commitMessage }) {
651
+ return commitTreeEntries({
652
+ githubClient,
653
+ owner,
654
+ repo,
655
+ branchName,
656
+ treeEntries: [{
657
+ path: filePath,
658
+ mode: "100644",
659
+ type: "blob",
660
+ sha: (await githubClient.rest.git.createBlob({
661
+ owner,
662
+ repo,
663
+ content: Buffer.from(content).toString("base64"),
664
+ encoding: "base64"
665
+ })).data.sha
666
+ }],
667
+ commitMessage
668
+ });
669
+ }
661
670
  async function commitFileChanges({ githubClient, owner, repo, fileContent, filePath, branchName, operations, commitMessage }) {
662
671
  try {
663
672
  return await commitContent({
@@ -688,6 +697,33 @@ async function commitNewFile({ githubClient, owner, repo, filePath, branchName,
688
697
  throw new Error(`Failed to commit new file: ${error instanceof Error ? error.message : "Unknown error"}`);
689
698
  }
690
699
  }
700
+ async function moveFile({ githubClient, owner, repo, sourcePath, destinationPath, branchName, commitMessage }) {
701
+ const fileResponse = await githubClient.rest.repos.getContent({
702
+ owner,
703
+ repo,
704
+ path: sourcePath,
705
+ ref: branchName
706
+ });
707
+ if (!("sha" in fileResponse.data) || Array.isArray(fileResponse.data)) throw new Error(`Source path "${sourcePath}" is not a file`);
708
+ return commitTreeEntries({
709
+ githubClient,
710
+ owner,
711
+ repo,
712
+ branchName,
713
+ treeEntries: [{
714
+ path: destinationPath,
715
+ mode: "100644",
716
+ type: "blob",
717
+ sha: fileResponse.data.sha
718
+ }, {
719
+ path: sourcePath,
720
+ mode: "100644",
721
+ type: "blob",
722
+ sha: null
723
+ }],
724
+ commitMessage
725
+ });
726
+ }
691
727
  async function createIssueCommentReaction(octokit, owner, repo, commentId, content) {
692
728
  const { data } = await octokit.rest.reactions.createForIssueComment({
693
729
  owner,
@@ -795,4 +831,4 @@ async function formatFileDiff(pullRequestNumber, files, includeContents = false)
795
831
  }
796
832
 
797
833
  //#endregion
798
- export { applyOperation, applyOperations, commitFileChanges, commitNewFile, createIssueCommentReaction, createPullRequestReviewCommentReaction, deleteIssueCommentReaction, deletePullRequestReviewCommentReaction, fetchBranchChangedFiles, fetchComments, fetchCommitDetails, fetchPrCommits, fetchPrFileDiffs, fetchPrFiles, fetchPrInfo, formatFileDiff, generatePrMarkdown, getFilePathsInRepo, getGitHubClientFromInstallationId, getGitHubClientFromRepo, listIssueCommentReactions, listIssueReactions, listPullRequestReviewCommentReactions, validateLineNumbers, visualizeUpdateOperations };
834
+ export { applyOperation, applyOperations, commitFileChanges, commitNewFile, createIssueCommentReaction, createPullRequestReviewCommentReaction, deleteIssueCommentReaction, deletePullRequestReviewCommentReaction, fetchBranchChangedFiles, fetchComments, fetchCommitDetails, fetchPrCommits, fetchPrFileDiffs, fetchPrFiles, fetchPrInfo, formatFileDiff, generatePrMarkdown, getFilePathsInRepo, getGitHubClientFromInstallationId, getGitHubClientFromRepo, listIssueCommentReactions, listIssueReactions, listPullRequestReviewCommentReactions, moveFile, validateLineNumbers, visualizeUpdateOperations };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types7 from "hono/types";
2
+ import * as hono_types4 from "hono/types";
3
3
 
4
4
  //#region src/github/routes/setup.d.ts
5
- declare const app: Hono<hono_types7.BlankEnv, hono_types7.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types4.BlankEnv, hono_types4.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types5 from "hono/types";
2
+ import * as hono_types6 from "hono/types";
3
3
 
4
4
  //#region src/github/routes/tokenExchange.d.ts
5
- declare const app: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types6.BlankEnv, hono_types6.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,5 +1,5 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types3 from "hono/types";
2
+ import * as hono_types8 from "hono/types";
3
3
 
4
4
  //#region src/github/routes/webhooks.d.ts
5
5
  interface WebhookVerificationResult {
@@ -7,6 +7,6 @@ interface WebhookVerificationResult {
7
7
  error?: string;
8
8
  }
9
9
  declare function verifyWebhookSignature(payload: string, signature: string | undefined, secret: string): WebhookVerificationResult;
10
- declare const app: Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
10
+ declare const app: Hono<hono_types8.BlankEnv, hono_types8.BlankSchema, "/">;
11
11
  //#endregion
12
12
  export { WebhookVerificationResult, app as default, verifyWebhookSignature };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-work-apps",
3
- "version": "0.0.0-dev-20260225135850",
3
+ "version": "0.0.0-dev-20260225150948",
4
4
  "description": "First party integrations for Inkeep Agents",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -33,7 +33,7 @@
33
33
  "jose": "^6.1.0",
34
34
  "minimatch": "^10.1.1",
35
35
  "slack-block-builder": "^2.8.0",
36
- "@inkeep/agents-core": "0.0.0-dev-20260225135850"
36
+ "@inkeep/agents-core": "0.0.0-dev-20260225150948"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@hono/zod-openapi": "^1.1.5",