From c083a4982b6b00d1d90ae4c45444f5503de8fae7 Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Mon, 6 Jul 2026 04:37:59 +0900 Subject: [PATCH] lexicons: new `repo.merge*` method schema Signed-off-by: Seongmin Lee --- api/tangled/gitdefs.go | 17 +++++ api/tangled/gitmergeCheck.go | 59 ++++++++++++++++++ api/tangled/repomergePullRequest.go | 49 +++++++++++++++ lexicons/git/defs.json | 25 ++++++++ lexicons/git/mergeCheck.json | 96 +++++++++++++++++++++++++++++ lexicons/repo/merge.json | 2 +- lexicons/repo/mergePullRequest.json | 68 ++++++++++++++++++++ 7 files changed, 315 insertions(+), 1 deletion(-) create mode 100644 api/tangled/gitdefs.go create mode 100644 api/tangled/gitmergeCheck.go create mode 100644 api/tangled/repomergePullRequest.go create mode 100644 lexicons/git/defs.json create mode 100644 lexicons/git/mergeCheck.json create mode 100644 lexicons/repo/mergePullRequest.json diff --git a/api/tangled/gitdefs.go b/api/tangled/gitdefs.go new file mode 100644 index 00000000..80fcc3e9 --- /dev/null +++ b/api/tangled/gitdefs.go @@ -0,0 +1,17 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.git.defs + +const () + +// GitDefs_Signature is a "signature" in the sh.tangled.git.defs schema. +type GitDefs_Signature struct { + // email: Person email + Email string `json:"email" cborgen:"email"` + // name: Person name + Name string `json:"name" cborgen:"name"` + // when: Timestamp of the signature + When string `json:"when" cborgen:"when"` +} diff --git a/api/tangled/gitmergeCheck.go b/api/tangled/gitmergeCheck.go new file mode 100644 index 00000000..ad61b06b --- /dev/null +++ b/api/tangled/gitmergeCheck.go @@ -0,0 +1,59 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.git.mergeCheck + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + GitMergeCheckNSID = "sh.tangled.git.mergeCheck" +) + +// GitMergeCheck_ConflictInfo is a "conflictInfo" in the sh.tangled.git.mergeCheck schema. +type GitMergeCheck_ConflictInfo struct { + // filename: Name of the conflicted file + Filename string `json:"filename" cborgen:"filename"` + // reason: Reason for the conflict + Reason string `json:"reason" cborgen:"reason"` +} + +// GitMergeCheck_Input is the input argument to a sh.tangled.git.mergeCheck call. +type GitMergeCheck_Input struct { + // branch: Target branch to merge into + Branch string `json:"branch" cborgen:"branch"` + // repo: DID of Git repository + Repo string `json:"repo" cborgen:"repo"` + Source *GitMergeCheck_Input_Source `json:"source" cborgen:"source"` +} + +type GitMergeCheck_Input_Source struct { + // commit: Head commit ID of PR to merge + Commit string `json:"commit" cborgen:"commit"` + // repo: DID of source git repository + Repo string `json:"repo" cborgen:"repo"` +} + +// GitMergeCheck_Output is the output of a sh.tangled.git.mergeCheck call. +type GitMergeCheck_Output struct { + // conflicts: List of files with merge conflicts + Conflicts []*GitMergeCheck_ConflictInfo `json:"conflicts,omitempty" cborgen:"conflicts,omitempty"` + // isConflicted: Whether the merge has conflicts + IsConflicted bool `json:"isConflicted" cborgen:"isConflicted"` + // message: Additional message about the merge check + Message *string `json:"message,omitempty" cborgen:"message,omitempty"` +} + +// GitMergeCheck calls the XRPC method "sh.tangled.git.mergeCheck". +func GitMergeCheck(ctx context.Context, c util.LexClient, input *GitMergeCheck_Input) (*GitMergeCheck_Output, error) { + var out GitMergeCheck_Output + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.git.mergeCheck", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/repomergePullRequest.go b/api/tangled/repomergePullRequest.go new file mode 100644 index 00000000..05a4e29c --- /dev/null +++ b/api/tangled/repomergePullRequest.go @@ -0,0 +1,49 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.mergePullRequest + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoMergePullRequestNSID = "sh.tangled.repo.mergePullRequest" +) + +// RepoMergePullRequest_Input is the input argument to a sh.tangled.repo.mergePullRequest call. +type RepoMergePullRequest_Input struct { + // branch: Target branch to merge into + Branch string `json:"branch" cborgen:"branch"` + Commit *RepoMergePullRequest_Input_Commit `json:"commit,omitempty" cborgen:"commit,omitempty"` + // repo: DID of git repository + Repo string `json:"repo" cborgen:"repo"` + Source *RepoMergePullRequest_Input_Source `json:"source" cborgen:"source"` + Style string `json:"style" cborgen:"style"` +} + +type RepoMergePullRequest_Input_Commit struct { + // author: Merge commit author. Ignored when squash = false + Author *GitDefs_Signature `json:"author,omitempty" cborgen:"author,omitempty"` + // message: Merge commit message. Ignored when squash = false + Message *string `json:"message,omitempty" cborgen:"message,omitempty"` +} + +type RepoMergePullRequest_Input_Source struct { + // commit: Head commit ID of PR to merge + Commit string `json:"commit" cborgen:"commit"` + // repo: DID of source git repository + Repo string `json:"repo" cborgen:"repo"` +} + +// RepoMergePullRequest calls the XRPC method "sh.tangled.repo.mergePullRequest". +func RepoMergePullRequest(ctx context.Context, c util.LexClient, input *RepoMergePullRequest_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.mergePullRequest", nil, input, nil); err != nil { + return err + } + + return nil +} diff --git a/lexicons/git/defs.json b/lexicons/git/defs.json new file mode 100644 index 00000000..a72387f5 --- /dev/null +++ b/lexicons/git/defs.json @@ -0,0 +1,25 @@ +{ + "lexicon": 1, + "id": "sh.tangled.git.defs", + "defs": { + "signature": { + "type": "object", + "required": ["name", "email", "when"], + "properties": { + "name": { + "type": "string", + "description": "Person name" + }, + "email": { + "type": "string", + "description": "Person email" + }, + "when": { + "type": "string", + "format": "datetime", + "description": "Timestamp of the signature" + } + } + } + } +} diff --git a/lexicons/git/mergeCheck.json b/lexicons/git/mergeCheck.json new file mode 100644 index 00000000..cd0cb42a --- /dev/null +++ b/lexicons/git/mergeCheck.json @@ -0,0 +1,96 @@ +{ + "lexicon": 1, + "id": "sh.tangled.git.mergeCheck", + "defs": { + "main": { + "type": "procedure", + "description": "Check if a merge is possible between two branches. Performs 3-way merge check", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["repo", "branch", "source"], + "properties": { + "repo": { + "type": "string", + "format": "did", + "description": "DID of Git repository" + }, + "branch": { + "type": "string", + "description": "Target branch to merge into" + }, + "source": { + "type": "object", + "required": ["repo", "commit"], + "properties": { + "repo": { + "type": "string", + "format": "did", + "description": "DID of source git repository" + }, + "commit": { + "type": "string", + "description": "Head commit ID of PR to merge" + } + } + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["isConflicted"], + "properties": { + "isConflicted": { + "type": "boolean", + "description": "Whether the merge has conflicts" + }, + "conflicts": { + "type": "array", + "description": "List of files with merge conflicts", + "items": { + "type": "ref", + "ref": "#conflictInfo" + } + }, + "message": { + "type": "string", + "description": "Additional message about the merge check" + } + } + } + }, + "errors": [ + { + "name": "InvalidRequest", + "description": "Invalid request parameters" + }, + { + "name": "RepoNotFound", + "description": "Repo is not registered on this knot" + }, + { + "name": "CommitNotFound", + "description": "Commit is not found from source Repo" + } + ] + }, + "conflictInfo": { + "type": "object", + "required": ["filename", "reason"], + "properties": { + "filename": { + "type": "string", + "description": "Name of the conflicted file" + }, + "reason": { + "type": "string", + "description": "Reason for the conflict" + } + } + } + } +} diff --git a/lexicons/repo/merge.json b/lexicons/repo/merge.json index 7cecb55d..f9aa2bf9 100644 --- a/lexicons/repo/merge.json +++ b/lexicons/repo/merge.json @@ -4,7 +4,7 @@ "defs": { "main": { "type": "procedure", - "description": "Merge a patch into a repository branch", + "description": "DEPRECATED: Merge a patch into a repository branch", "input": { "encoding": "application/json", "schema": { diff --git a/lexicons/repo/mergePullRequest.json b/lexicons/repo/mergePullRequest.json new file mode 100644 index 00000000..4a589810 --- /dev/null +++ b/lexicons/repo/mergePullRequest.json @@ -0,0 +1,68 @@ +{ + "lexicon": 1, + "id": "sh.tangled.repo.mergePullRequest", + "defs": { + "main": { + "type": "procedure", + "description": "Merge a PR into a repository branch", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["repo", "branch", "source", "style"], + "properties": { + "repo": { + "type": "string", + "format": "did", + "description": "DID of git repository" + }, + "branch": { + "type": "string", + "description": "Target branch to merge into" + }, + "source": { + "type": "object", + "required": ["repo", "commit"], + "properties": { + "repo": { + "type": "string", + "format": "did", + "description": "DID of source git repository" + }, + "commit": { + "type": "string", + "description": "Head commit ID of PR to merge" + } + } + }, + "style": { + "type": "string", + "enum": [ + "rebase", + "merge", + "rebase-merge", + "squash-rebase", + "squash-rebase-merge", + "fast-forward-only" + ] + }, + "commit": { + "type": "object", + "properties": { + "author": { + "type": "ref", + "ref": "sh.tangled.git.defs#signature", + "description": "Merge commit author. Ignored when squash = false" + }, + "message": { + "type": "string", + "description": "Merge commit message. Ignored when squash = false" + } + } + } + } + } + } + } + } +} -- 2.51.2