From 69a549965fec45e56e11199e32d6a3eced937fb9 Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Tue, 12 Aug 2025 14:46:35 +0000 Subject: [PATCH] lexicons,api: generate xrpc defs for all the things Signed-off-by: Anirudh Oppiliappan --- api/tangled/knothealth.go | 35 +++++++++++++++++++++++++++++++++++ api/tangled/repocreate.go | 34 ++++++++++++++++++++++++++++++++++ api/tangled/repodelete.go | 32 ++++++++++++++++++++++++++++++++ api/tangled/repoforkStatus.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ api/tangled/repoforkSync.go | 36 ++++++++++++++++++++++++++++++++++++ api/tangled/repohiddenRef.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ api/tangled/repomerge.go | 44 ++++++++++++++++++++++++++++++++++++++++++++ api/tangled/repomergeCheck.go | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lexicons/knot/knot.json | 24 ++++++++++++++++++++++++ lexicons/repo/create.json | 33 +++++++++++++++++++++++++++++++++ lexicons/repo/delete.json | 28 ++++++++++++++++++++++++++++ lexicons/repo/forkStatus.json | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ lexicons/repo/forkSync.json | 42 ++++++++++++++++++++++++++++++++++++++++++ lexicons/repo/hiddenRef.json | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lexicons/repo/merge.json | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ lexicons/repo/mergeCheck.json | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 16 file(s) changed, 698 insertion(s)(+), 0 deletion(s)(-) diff --git a/api/tangled/knothealth.go b/api/tangled/knothealth.go new file mode 100644 --- /dev/null +++ b/api/tangled/knothealth.go @@ -0,0 +1,35 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.knot.health + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + KnotHealthNSID = "sh.tangled.knot.health" +) + +// KnotHealth_Output is the output of a sh.tangled.knot.health call. +type KnotHealth_Output struct { + // status: Health status of the knot + Status string `json:"status" cborgen:"status"` + // timestamp: Timestamp of the health check + Timestamp *string `json:"timestamp,omitempty" cborgen:"timestamp,omitempty"` + // version: Version of the knot server + Version *string `json:"version,omitempty" cborgen:"version,omitempty"` +} + +// KnotHealth calls the XRPC method "sh.tangled.knot.health". +func KnotHealth(ctx context.Context, c util.LexClient) (*KnotHealth_Output, error) { + var out KnotHealth_Output + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.knot.health", nil, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/repocreate.go b/api/tangled/repocreate.go new file mode 100644 --- /dev/null +++ b/api/tangled/repocreate.go @@ -0,0 +1,34 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.create + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoCreateNSID = "sh.tangled.repo.create" +) + +// RepoCreate_Input is the input argument to a sh.tangled.repo.create call. +type RepoCreate_Input struct { + // defaultBranch: Default branch to push to + DefaultBranch *string `json:"defaultBranch,omitempty" cborgen:"defaultBranch,omitempty"` + // rkey: Rkey of the repository record + Rkey string `json:"rkey" cborgen:"rkey"` + // source: A source URL to clone from, populate this when forking or importing a repository. + Source *string `json:"source,omitempty" cborgen:"source,omitempty"` +} + +// RepoCreate calls the XRPC method "sh.tangled.repo.create". +func RepoCreate(ctx context.Context, c util.LexClient, input *RepoCreate_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.create", nil, input, nil); err != nil { + return err + } + + return nil +} diff --git a/api/tangled/repodelete.go b/api/tangled/repodelete.go new file mode 100644 --- /dev/null +++ b/api/tangled/repodelete.go @@ -0,0 +1,32 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.delete + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoDeleteNSID = "sh.tangled.repo.delete" +) + +// RepoDelete_Input is the input argument to a sh.tangled.repo.delete call. +type RepoDelete_Input struct { + // did: DID of the repository owner + Did string `json:"did" cborgen:"did"` + // name: Name of the repository to delete + Name string `json:"name" cborgen:"name"` +} + +// RepoDelete calls the XRPC method "sh.tangled.repo.delete". +func RepoDelete(ctx context.Context, c util.LexClient, input *RepoDelete_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.delete", nil, input, nil); err != nil { + return err + } + + return nil +} diff --git a/api/tangled/repoforkStatus.go b/api/tangled/repoforkStatus.go new file mode 100644 --- /dev/null +++ b/api/tangled/repoforkStatus.go @@ -0,0 +1,45 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.forkStatus + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoForkStatusNSID = "sh.tangled.repo.forkStatus" +) + +// RepoForkStatus_Input is the input argument to a sh.tangled.repo.forkStatus call. +type RepoForkStatus_Input struct { + // branch: Branch to check status for + Branch string `json:"branch" cborgen:"branch"` + // did: DID of the fork owner + Did string `json:"did" cborgen:"did"` + // hiddenRef: Hidden ref to use for comparison + HiddenRef string `json:"hiddenRef" cborgen:"hiddenRef"` + // name: Name of the forked repository + Name string `json:"name" cborgen:"name"` + // source: Source repository URL + Source string `json:"source" cborgen:"source"` +} + +// RepoForkStatus_Output is the output of a sh.tangled.repo.forkStatus call. +type RepoForkStatus_Output struct { + // status: Fork status: 0=UpToDate, 1=FastForwardable, 2=Conflict, 3=MissingBranch + Status int64 `json:"status" cborgen:"status"` +} + +// RepoForkStatus calls the XRPC method "sh.tangled.repo.forkStatus". +func RepoForkStatus(ctx context.Context, c util.LexClient, input *RepoForkStatus_Input) (*RepoForkStatus_Output, error) { + var out RepoForkStatus_Output + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.forkStatus", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/repoforkSync.go b/api/tangled/repoforkSync.go new file mode 100644 --- /dev/null +++ b/api/tangled/repoforkSync.go @@ -0,0 +1,36 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.forkSync + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoForkSyncNSID = "sh.tangled.repo.forkSync" +) + +// RepoForkSync_Input is the input argument to a sh.tangled.repo.forkSync call. +type RepoForkSync_Input struct { + // branch: Branch to sync + Branch string `json:"branch" cborgen:"branch"` + // did: DID of the fork owner + Did string `json:"did" cborgen:"did"` + // name: Name of the forked repository + Name string `json:"name" cborgen:"name"` + // source: AT-URI of the source repository + Source string `json:"source" cborgen:"source"` +} + +// RepoForkSync calls the XRPC method "sh.tangled.repo.forkSync". +func RepoForkSync(ctx context.Context, c util.LexClient, input *RepoForkSync_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.forkSync", nil, input, nil); err != nil { + return err + } + + return nil +} diff --git a/api/tangled/repohiddenRef.go b/api/tangled/repohiddenRef.go new file mode 100644 --- /dev/null +++ b/api/tangled/repohiddenRef.go @@ -0,0 +1,45 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.hiddenRef + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoHiddenRefNSID = "sh.tangled.repo.hiddenRef" +) + +// RepoHiddenRef_Input is the input argument to a sh.tangled.repo.hiddenRef call. +type RepoHiddenRef_Input struct { + // forkRef: Fork reference name + ForkRef string `json:"forkRef" cborgen:"forkRef"` + // remoteRef: Remote reference name + RemoteRef string `json:"remoteRef" cborgen:"remoteRef"` + // repo: AT-URI of the repository + Repo string `json:"repo" cborgen:"repo"` +} + +// RepoHiddenRef_Output is the output of a sh.tangled.repo.hiddenRef call. +type RepoHiddenRef_Output struct { + // error: Error message if creation failed + Error *string `json:"error,omitempty" cborgen:"error,omitempty"` + // ref: The created hidden ref name + Ref *string `json:"ref,omitempty" cborgen:"ref,omitempty"` + // success: Whether the hidden ref was created successfully + Success bool `json:"success" cborgen:"success"` +} + +// RepoHiddenRef calls the XRPC method "sh.tangled.repo.hiddenRef". +func RepoHiddenRef(ctx context.Context, c util.LexClient, input *RepoHiddenRef_Input) (*RepoHiddenRef_Output, error) { + var out RepoHiddenRef_Output + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.hiddenRef", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/repomerge.go b/api/tangled/repomerge.go new file mode 100644 --- /dev/null +++ b/api/tangled/repomerge.go @@ -0,0 +1,44 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.merge + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoMergeNSID = "sh.tangled.repo.merge" +) + +// RepoMerge_Input is the input argument to a sh.tangled.repo.merge call. +type RepoMerge_Input struct { + // authorEmail: Author email for the merge commit + AuthorEmail *string `json:"authorEmail,omitempty" cborgen:"authorEmail,omitempty"` + // authorName: Author name for the merge commit + AuthorName *string `json:"authorName,omitempty" cborgen:"authorName,omitempty"` + // branch: Target branch to merge into + Branch string `json:"branch" cborgen:"branch"` + // commitBody: Additional commit message body + CommitBody *string `json:"commitBody,omitempty" cborgen:"commitBody,omitempty"` + // commitMessage: Merge commit message + CommitMessage *string `json:"commitMessage,omitempty" cborgen:"commitMessage,omitempty"` + // did: DID of the repository owner + Did string `json:"did" cborgen:"did"` + // name: Name of the repository + Name string `json:"name" cborgen:"name"` + // patch: Patch content to merge + Patch string `json:"patch" cborgen:"patch"` +} + +// RepoMerge calls the XRPC method "sh.tangled.repo.merge". +func RepoMerge(ctx context.Context, c util.LexClient, input *RepoMerge_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.merge", nil, input, nil); err != nil { + return err + } + + return nil +} diff --git a/api/tangled/repomergeCheck.go b/api/tangled/repomergeCheck.go new file mode 100644 --- /dev/null +++ b/api/tangled/repomergeCheck.go @@ -0,0 +1,57 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.mergeCheck + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoMergeCheckNSID = "sh.tangled.repo.mergeCheck" +) + +// RepoMergeCheck_ConflictInfo is a "conflictInfo" in the sh.tangled.repo.mergeCheck schema. +type RepoMergeCheck_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"` +} + +// RepoMergeCheck_Input is the input argument to a sh.tangled.repo.mergeCheck call. +type RepoMergeCheck_Input struct { + // branch: Target branch to merge into + Branch string `json:"branch" cborgen:"branch"` + // did: DID of the repository owner + Did string `json:"did" cborgen:"did"` + // name: Name of the repository + Name string `json:"name" cborgen:"name"` + // patch: Patch or pull request to check for merge conflicts + Patch string `json:"patch" cborgen:"patch"` +} + +// RepoMergeCheck_Output is the output of a sh.tangled.repo.mergeCheck call. +type RepoMergeCheck_Output struct { + // conflicts: List of files with merge conflicts + Conflicts []*RepoMergeCheck_ConflictInfo `json:"conflicts,omitempty" cborgen:"conflicts,omitempty"` + // error: Error message if check failed + Error *string `json:"error,omitempty" cborgen:"error,omitempty"` + // is_conflicted: Whether the merge has conflicts + Is_conflicted bool `json:"is_conflicted" cborgen:"is_conflicted"` + // message: Additional message about the merge check + Message *string `json:"message,omitempty" cborgen:"message,omitempty"` +} + +// RepoMergeCheck calls the XRPC method "sh.tangled.repo.mergeCheck". +func RepoMergeCheck(ctx context.Context, c util.LexClient, input *RepoMergeCheck_Input) (*RepoMergeCheck_Output, error) { + var out RepoMergeCheck_Output + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.mergeCheck", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/lexicons/knot/knot.json b/lexicons/knot/knot.json new file mode 100644 --- /dev/null +++ b/lexicons/knot/knot.json @@ -0,0 +1,24 @@ +{ + "lexicon": 1, + "id": "sh.tangled.knot", + "needsCbor": true, + "needsType": true, + "defs": { + "main": { + "type": "record", + "key": "any", + "record": { + "type": "object", + "required": [ + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "format": "datetime" + } + } + } + } + } +} diff --git a/lexicons/repo/create.json b/lexicons/repo/create.json new file mode 100644 --- /dev/null +++ b/lexicons/repo/create.json @@ -0,0 +1,33 @@ +{ + "lexicon": 1, + "id": "sh.tangled.repo.create", + "defs": { + "main": { + "type": "procedure", + "description": "Create a new repository", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "rkey" + ], + "properties": { + "rkey": { + "type": "string", + "description": "Rkey of the repository record" + }, + "defaultBranch": { + "type": "string", + "description": "Default branch to push to" + }, + "source": { + "type": "string", + "description": "A source URL to clone from, populate this when forking or importing a repository." + } + } + } + } + } + } +} diff --git a/lexicons/repo/delete.json b/lexicons/repo/delete.json new file mode 100644 --- /dev/null +++ b/lexicons/repo/delete.json @@ -0,0 +1,28 @@ +{ + "lexicon": 1, + "id": "sh.tangled.repo.delete", + "defs": { + "main": { + "type": "procedure", + "description": "Delete a repository", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["did", "name"], + "properties": { + "did": { + "type": "string", + "format": "did", + "description": "DID of the repository owner" + }, + "name": { + "type": "string", + "description": "Name of the repository to delete" + } + } + } + } + } + } +} diff --git a/lexicons/repo/forkStatus.json b/lexicons/repo/forkStatus.json new file mode 100644 --- /dev/null +++ b/lexicons/repo/forkStatus.json @@ -0,0 +1,53 @@ +{ + "lexicon": 1, + "id": "sh.tangled.repo.forkStatus", + "defs": { + "main": { + "type": "procedure", + "description": "Check fork status relative to upstream source", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["did", "name", "source", "branch", "hiddenRef"], + "properties": { + "did": { + "type": "string", + "format": "did", + "description": "DID of the fork owner" + }, + "name": { + "type": "string", + "description": "Name of the forked repository" + }, + "source": { + "type": "string", + "description": "Source repository URL" + }, + "branch": { + "type": "string", + "description": "Branch to check status for" + }, + "hiddenRef": { + "type": "string", + "description": "Hidden ref to use for comparison" + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["status"], + "properties": { + "status": { + "type": "integer", + "description": "Fork status: 0=UpToDate, 1=FastForwardable, 2=Conflict, 3=MissingBranch" + } + } + } + } + } + } +} diff --git a/lexicons/repo/forkSync.json b/lexicons/repo/forkSync.json new file mode 100644 --- /dev/null +++ b/lexicons/repo/forkSync.json @@ -0,0 +1,42 @@ +{ + "lexicon": 1, + "id": "sh.tangled.repo.forkSync", + "defs": { + "main": { + "type": "procedure", + "description": "Sync a forked repository with its upstream source", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "did", + "source", + "name", + "branch" + ], + "properties": { + "did": { + "type": "string", + "format": "did", + "description": "DID of the fork owner" + }, + "source": { + "type": "string", + "format": "at-uri", + "description": "AT-URI of the source repository" + }, + "name": { + "type": "string", + "description": "Name of the forked repository" + }, + "branch": { + "type": "string", + "description": "Branch to sync" + } + } + } + } + } + } +} diff --git a/lexicons/repo/hiddenRef.json b/lexicons/repo/hiddenRef.json new file mode 100644 --- /dev/null +++ b/lexicons/repo/hiddenRef.json @@ -0,0 +1,59 @@ +{ + "lexicon": 1, + "id": "sh.tangled.repo.hiddenRef", + "defs": { + "main": { + "type": "procedure", + "description": "Create a hidden ref in a repository", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "repo", + "forkRef", + "remoteRef" + ], + "properties": { + "repo": { + "type": "string", + "format": "at-uri", + "description": "AT-URI of the repository" + }, + "forkRef": { + "type": "string", + "description": "Fork reference name" + }, + "remoteRef": { + "type": "string", + "description": "Remote reference name" + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean", + "description": "Whether the hidden ref was created successfully" + }, + "ref": { + "type": "string", + "description": "The created hidden ref name" + }, + "error": { + "type": "string", + "description": "Error message if creation failed" + } + } + } + } + } + } +} diff --git a/lexicons/repo/merge.json b/lexicons/repo/merge.json new file mode 100644 --- /dev/null +++ b/lexicons/repo/merge.json @@ -0,0 +1,52 @@ +{ + "lexicon": 1, + "id": "sh.tangled.repo.merge", + "defs": { + "main": { + "type": "procedure", + "description": "Merge a patch into a repository branch", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["did", "name", "patch", "branch"], + "properties": { + "did": { + "type": "string", + "format": "did", + "description": "DID of the repository owner" + }, + "name": { + "type": "string", + "description": "Name of the repository" + }, + "patch": { + "type": "string", + "description": "Patch content to merge" + }, + "branch": { + "type": "string", + "description": "Target branch to merge into" + }, + "authorName": { + "type": "string", + "description": "Author name for the merge commit" + }, + "authorEmail": { + "type": "string", + "description": "Author email for the merge commit" + }, + "commitBody": { + "type": "string", + "description": "Additional commit message body" + }, + "commitMessage": { + "type": "string", + "description": "Merge commit message" + } + } + } + } + } + } +} diff --git a/lexicons/repo/mergeCheck.json b/lexicons/repo/mergeCheck.json new file mode 100644 --- /dev/null +++ b/lexicons/repo/mergeCheck.json @@ -0,0 +1,79 @@ +{ + "lexicon": 1, + "id": "sh.tangled.repo.mergeCheck", + "defs": { + "main": { + "type": "procedure", + "description": "Check if a merge is possible between two branches", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["did", "name", "patch", "branch"], + "properties": { + "did": { + "type": "string", + "format": "did", + "description": "DID of the repository owner" + }, + "name": { + "type": "string", + "description": "Name of the repository" + }, + "patch": { + "type": "string", + "description": "Patch or pull request to check for merge conflicts" + }, + "branch": { + "type": "string", + "description": "Target branch to merge into" + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["is_conflicted"], + "properties": { + "is_conflicted": { + "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" + }, + "error": { + "type": "string", + "description": "Error message if check failed" + } + } + } + } + }, + "conflictInfo": { + "type": "object", + "required": ["filename", "reason"], + "properties": { + "filename": { + "type": "string", + "description": "Name of the conflicted file" + }, + "reason": { + "type": "string", + "description": "Reason for the conflict" + } + } + } + } +} -- tangled.sh