WIP: A simple cli for daily tangled use cases and AI integration. This is for my personal use right now, but happy if others get mileage from it! :)
1/**
2 * GENERATED CODE - DO NOT MODIFY
3 */
4import {
5 type LexiconDoc,
6 Lexicons,
7 ValidationError,
8 type ValidationResult,
9} from '@atproto/lexicon'
10import { type $Typed, is$typed, maybe$typed } from './util.js'
11
12export const schemaDict = {
13 ShTangledActorProfile: {
14 lexicon: 1,
15 id: 'sh.tangled.actor.profile',
16 defs: {
17 main: {
18 type: 'record',
19 description: 'A declaration of a Tangled account profile.',
20 key: 'literal:self',
21 record: {
22 type: 'object',
23 required: ['bluesky'],
24 properties: {
25 avatar: {
26 type: 'blob',
27 description:
28 "Small image to be displayed next to posts from account. AKA, 'profile picture'",
29 accept: ['image/png', 'image/jpeg'],
30 maxSize: 1000000,
31 },
32 description: {
33 type: 'string',
34 description: 'Free-form profile description text.',
35 maxGraphemes: 256,
36 maxLength: 2560,
37 },
38 links: {
39 type: 'array',
40 minLength: 0,
41 maxLength: 5,
42 items: {
43 type: 'string',
44 description:
45 'Any URI, intended for social profiles or websites, can be used to link DIDs/AT-URIs too.',
46 format: 'uri',
47 },
48 },
49 stats: {
50 type: 'array',
51 minLength: 0,
52 maxLength: 2,
53 items: {
54 type: 'string',
55 description: 'Vanity stats.',
56 enum: [
57 'merged-pull-request-count',
58 'closed-pull-request-count',
59 'open-pull-request-count',
60 'open-issue-count',
61 'closed-issue-count',
62 'repository-count',
63 'star-count',
64 ],
65 },
66 },
67 bluesky: {
68 type: 'boolean',
69 description: 'Include link to this account on Bluesky.',
70 },
71 location: {
72 type: 'string',
73 description: 'Free-form location text.',
74 maxGraphemes: 40,
75 maxLength: 400,
76 },
77 pinnedRepositories: {
78 type: 'array',
79 description:
80 'Any ATURI, it is up to appviews to validate these fields.',
81 minLength: 0,
82 maxLength: 6,
83 items: {
84 type: 'string',
85 format: 'at-uri',
86 },
87 },
88 pronouns: {
89 type: 'string',
90 description: 'Preferred gender pronouns.',
91 maxLength: 40,
92 },
93 },
94 },
95 },
96 },
97 },
98 ShTangledFeedReaction: {
99 lexicon: 1,
100 id: 'sh.tangled.feed.reaction',
101 needsCbor: true,
102 needsType: true,
103 defs: {
104 main: {
105 type: 'record',
106 key: 'tid',
107 record: {
108 type: 'object',
109 required: ['subject', 'reaction', 'createdAt'],
110 properties: {
111 subject: {
112 type: 'string',
113 format: 'at-uri',
114 },
115 reaction: {
116 type: 'string',
117 enum: ['👍', '👎', '😆', '🎉', '🫤', '❤️', '🚀', '👀'],
118 },
119 createdAt: {
120 type: 'string',
121 format: 'datetime',
122 },
123 },
124 },
125 },
126 },
127 },
128 ShTangledFeedStar: {
129 lexicon: 1,
130 id: 'sh.tangled.feed.star',
131 needsCbor: true,
132 needsType: true,
133 defs: {
134 main: {
135 type: 'record',
136 key: 'tid',
137 record: {
138 type: 'object',
139 required: ['subject', 'createdAt'],
140 properties: {
141 subject: {
142 type: 'string',
143 format: 'at-uri',
144 },
145 createdAt: {
146 type: 'string',
147 format: 'datetime',
148 },
149 },
150 },
151 },
152 },
153 },
154 ShTangledGitRefUpdate: {
155 lexicon: 1,
156 id: 'sh.tangled.git.refUpdate',
157 defs: {
158 main: {
159 type: 'record',
160 description: 'An update to a git repository, emitted by knots.',
161 key: 'tid',
162 record: {
163 type: 'object',
164 required: [
165 'ref',
166 'committerDid',
167 'repoDid',
168 'repoName',
169 'oldSha',
170 'newSha',
171 'meta',
172 ],
173 properties: {
174 ref: {
175 type: 'string',
176 description: 'Ref being updated',
177 maxGraphemes: 256,
178 maxLength: 2560,
179 },
180 committerDid: {
181 type: 'string',
182 description: 'did of the user that pushed this ref',
183 format: 'did',
184 },
185 repoDid: {
186 type: 'string',
187 description: 'did of the owner of the repo',
188 format: 'did',
189 },
190 repoName: {
191 type: 'string',
192 description: 'name of the repo',
193 },
194 oldSha: {
195 type: 'string',
196 description: 'old SHA of this ref',
197 minLength: 40,
198 maxLength: 40,
199 },
200 newSha: {
201 type: 'string',
202 description: 'new SHA of this ref',
203 minLength: 40,
204 maxLength: 40,
205 },
206 meta: {
207 type: 'ref',
208 ref: 'lex:sh.tangled.git.refUpdate#meta',
209 },
210 },
211 },
212 },
213 meta: {
214 type: 'object',
215 required: ['isDefaultRef', 'commitCount'],
216 properties: {
217 isDefaultRef: {
218 type: 'boolean',
219 default: false,
220 },
221 langBreakdown: {
222 type: 'ref',
223 ref: 'lex:sh.tangled.git.refUpdate#langBreakdown',
224 },
225 commitCount: {
226 type: 'ref',
227 ref: 'lex:sh.tangled.git.refUpdate#commitCountBreakdown',
228 },
229 },
230 },
231 langBreakdown: {
232 type: 'object',
233 properties: {
234 inputs: {
235 type: 'array',
236 items: {
237 type: 'ref',
238 ref: 'lex:sh.tangled.git.refUpdate#individualLanguageSize',
239 },
240 },
241 },
242 },
243 individualLanguageSize: {
244 type: 'object',
245 required: ['lang', 'size'],
246 properties: {
247 lang: {
248 type: 'string',
249 },
250 size: {
251 type: 'integer',
252 },
253 },
254 },
255 commitCountBreakdown: {
256 type: 'object',
257 required: [],
258 properties: {
259 byEmail: {
260 type: 'array',
261 items: {
262 type: 'ref',
263 ref: 'lex:sh.tangled.git.refUpdate#individualEmailCommitCount',
264 },
265 },
266 },
267 },
268 individualEmailCommitCount: {
269 type: 'object',
270 required: ['email', 'count'],
271 properties: {
272 email: {
273 type: 'string',
274 },
275 count: {
276 type: 'integer',
277 },
278 },
279 },
280 },
281 },
282 ShTangledGraphFollow: {
283 lexicon: 1,
284 id: 'sh.tangled.graph.follow',
285 needsCbor: true,
286 needsType: true,
287 defs: {
288 main: {
289 type: 'record',
290 key: 'tid',
291 record: {
292 type: 'object',
293 required: ['subject', 'createdAt'],
294 properties: {
295 subject: {
296 type: 'string',
297 format: 'did',
298 },
299 createdAt: {
300 type: 'string',
301 format: 'datetime',
302 },
303 },
304 },
305 },
306 },
307 },
308 ShTangledRepoIssueStateClosed: {
309 lexicon: 1,
310 id: 'sh.tangled.repo.issue.state.closed',
311 needsCbor: true,
312 needsType: true,
313 defs: {
314 main: {
315 type: 'token',
316 description: 'closed issue',
317 },
318 },
319 },
320 ShTangledRepoIssueComment: {
321 lexicon: 1,
322 id: 'sh.tangled.repo.issue.comment',
323 needsCbor: true,
324 needsType: true,
325 defs: {
326 main: {
327 type: 'record',
328 key: 'tid',
329 record: {
330 type: 'object',
331 required: ['issue', 'body', 'createdAt'],
332 properties: {
333 issue: {
334 type: 'string',
335 format: 'at-uri',
336 },
337 body: {
338 type: 'string',
339 },
340 createdAt: {
341 type: 'string',
342 format: 'datetime',
343 },
344 replyTo: {
345 type: 'string',
346 format: 'at-uri',
347 },
348 mentions: {
349 type: 'array',
350 items: {
351 type: 'string',
352 format: 'did',
353 },
354 },
355 references: {
356 type: 'array',
357 items: {
358 type: 'string',
359 format: 'at-uri',
360 },
361 },
362 },
363 },
364 },
365 },
366 },
367 ShTangledRepoIssue: {
368 lexicon: 1,
369 id: 'sh.tangled.repo.issue',
370 needsCbor: true,
371 needsType: true,
372 defs: {
373 main: {
374 type: 'record',
375 key: 'tid',
376 record: {
377 type: 'object',
378 required: ['repo', 'title', 'createdAt'],
379 properties: {
380 repo: {
381 type: 'string',
382 format: 'at-uri',
383 },
384 title: {
385 type: 'string',
386 },
387 body: {
388 type: 'string',
389 },
390 createdAt: {
391 type: 'string',
392 format: 'datetime',
393 },
394 mentions: {
395 type: 'array',
396 items: {
397 type: 'string',
398 format: 'did',
399 },
400 },
401 references: {
402 type: 'array',
403 items: {
404 type: 'string',
405 format: 'at-uri',
406 },
407 },
408 },
409 },
410 },
411 },
412 },
413 ShTangledRepoIssueStateOpen: {
414 lexicon: 1,
415 id: 'sh.tangled.repo.issue.state.open',
416 needsCbor: true,
417 needsType: true,
418 defs: {
419 main: {
420 type: 'token',
421 description: 'open issue',
422 },
423 },
424 },
425 ShTangledRepoIssueState: {
426 lexicon: 1,
427 id: 'sh.tangled.repo.issue.state',
428 needsCbor: true,
429 needsType: true,
430 defs: {
431 main: {
432 type: 'record',
433 key: 'tid',
434 record: {
435 type: 'object',
436 required: ['issue', 'state'],
437 properties: {
438 issue: {
439 type: 'string',
440 format: 'at-uri',
441 },
442 state: {
443 type: 'string',
444 description: 'state of the issue',
445 knownValues: [
446 'sh.tangled.repo.issue.state.open',
447 'sh.tangled.repo.issue.state.closed',
448 ],
449 default: 'sh.tangled.repo.issue.state.open',
450 },
451 },
452 },
453 },
454 },
455 },
456 ShTangledKnot: {
457 lexicon: 1,
458 id: 'sh.tangled.knot',
459 needsCbor: true,
460 needsType: true,
461 defs: {
462 main: {
463 type: 'record',
464 key: 'any',
465 record: {
466 type: 'object',
467 required: ['createdAt'],
468 properties: {
469 createdAt: {
470 type: 'string',
471 format: 'datetime',
472 },
473 },
474 },
475 },
476 },
477 },
478 ShTangledKnotListKeys: {
479 lexicon: 1,
480 id: 'sh.tangled.knot.listKeys',
481 defs: {
482 main: {
483 type: 'query',
484 description: 'List all public keys stored in the knot server',
485 parameters: {
486 type: 'params',
487 properties: {
488 limit: {
489 type: 'integer',
490 description: 'Maximum number of keys to return',
491 minimum: 1,
492 maximum: 1000,
493 default: 100,
494 },
495 cursor: {
496 type: 'string',
497 description: 'Pagination cursor',
498 },
499 },
500 },
501 output: {
502 encoding: 'application/json',
503 schema: {
504 type: 'object',
505 required: ['keys'],
506 properties: {
507 keys: {
508 type: 'array',
509 items: {
510 type: 'ref',
511 ref: 'lex:sh.tangled.knot.listKeys#publicKey',
512 },
513 },
514 cursor: {
515 type: 'string',
516 description: 'Pagination cursor for next page',
517 },
518 },
519 },
520 },
521 errors: [
522 {
523 name: 'InternalServerError',
524 description: 'Failed to retrieve public keys',
525 },
526 ],
527 },
528 publicKey: {
529 type: 'object',
530 required: ['did', 'key', 'createdAt'],
531 properties: {
532 did: {
533 type: 'string',
534 format: 'did',
535 description: 'DID associated with the public key',
536 },
537 key: {
538 type: 'string',
539 maxLength: 4096,
540 description: 'Public key contents',
541 },
542 createdAt: {
543 type: 'string',
544 format: 'datetime',
545 description: 'Key upload timestamp',
546 },
547 },
548 },
549 },
550 },
551 ShTangledKnotMember: {
552 lexicon: 1,
553 id: 'sh.tangled.knot.member',
554 needsCbor: true,
555 needsType: true,
556 defs: {
557 main: {
558 type: 'record',
559 key: 'tid',
560 record: {
561 type: 'object',
562 required: ['subject', 'domain', 'createdAt'],
563 properties: {
564 subject: {
565 type: 'string',
566 format: 'did',
567 },
568 domain: {
569 type: 'string',
570 description: 'domain that this member now belongs to',
571 },
572 createdAt: {
573 type: 'string',
574 format: 'datetime',
575 },
576 },
577 },
578 },
579 },
580 },
581 ShTangledKnotVersion: {
582 lexicon: 1,
583 id: 'sh.tangled.knot.version',
584 defs: {
585 main: {
586 type: 'query',
587 description: 'Get the version of a knot',
588 output: {
589 encoding: 'application/json',
590 schema: {
591 type: 'object',
592 required: ['version'],
593 properties: {
594 version: {
595 type: 'string',
596 },
597 },
598 },
599 },
600 errors: [],
601 },
602 },
603 },
604 ShTangledLabelDefinition: {
605 lexicon: 1,
606 id: 'sh.tangled.label.definition',
607 needsCbor: true,
608 needsType: true,
609 defs: {
610 main: {
611 type: 'record',
612 key: 'any',
613 record: {
614 type: 'object',
615 required: ['name', 'valueType', 'scope', 'createdAt'],
616 properties: {
617 name: {
618 type: 'string',
619 description: 'The display name of this label.',
620 minGraphemes: 1,
621 maxGraphemes: 40,
622 },
623 valueType: {
624 type: 'ref',
625 ref: 'lex:sh.tangled.label.definition#valueType',
626 description:
627 'The type definition of this label. Appviews may allow sorting for certain types.',
628 },
629 scope: {
630 type: 'array',
631 description:
632 'The areas of the repo this label may apply to, eg.: sh.tangled.repo.issue. Appviews may choose to respect this.',
633 items: {
634 type: 'string',
635 format: 'nsid',
636 },
637 },
638 color: {
639 type: 'string',
640 description:
641 'The hex value for the background color for the label. Appviews may choose to respect this.',
642 },
643 createdAt: {
644 type: 'string',
645 format: 'datetime',
646 },
647 multiple: {
648 type: 'boolean',
649 description:
650 'Whether this label can be repeated for a given entity, eg.: [reviewer:foo, reviewer:bar]',
651 },
652 },
653 },
654 },
655 valueType: {
656 type: 'object',
657 required: ['type', 'format'],
658 properties: {
659 type: {
660 type: 'string',
661 enum: ['null', 'boolean', 'integer', 'string'],
662 description: "The concrete type of this label's value.",
663 },
664 format: {
665 type: 'string',
666 enum: ['any', 'did', 'nsid'],
667 description:
668 'An optional constraint that can be applied on string concrete types.',
669 },
670 enum: {
671 type: 'array',
672 description: 'Closed set of values that this label can take.',
673 items: {
674 type: 'string',
675 },
676 },
677 },
678 },
679 },
680 },
681 ShTangledLabelOp: {
682 lexicon: 1,
683 id: 'sh.tangled.label.op',
684 needsCbor: true,
685 needsType: true,
686 defs: {
687 main: {
688 type: 'record',
689 key: 'tid',
690 record: {
691 type: 'object',
692 required: ['subject', 'add', 'delete', 'performedAt'],
693 properties: {
694 subject: {
695 type: 'string',
696 format: 'at-uri',
697 description:
698 'The subject (task, pull or discussion) of this label. Appviews may apply a `scope` check and refuse this op.',
699 },
700 performedAt: {
701 type: 'string',
702 format: 'datetime',
703 },
704 add: {
705 type: 'array',
706 items: {
707 type: 'ref',
708 ref: 'lex:sh.tangled.label.op#operand',
709 },
710 },
711 delete: {
712 type: 'array',
713 items: {
714 type: 'ref',
715 ref: 'lex:sh.tangled.label.op#operand',
716 },
717 },
718 },
719 },
720 },
721 operand: {
722 type: 'object',
723 required: ['key', 'value'],
724 properties: {
725 key: {
726 type: 'string',
727 format: 'at-uri',
728 description: 'ATURI to the label definition',
729 },
730 value: {
731 type: 'string',
732 description:
733 'Stringified value of the label. This is first unstringed by appviews and then interpreted as a concrete value.',
734 },
735 },
736 },
737 },
738 },
739 ShTangledPipelineCancelPipeline: {
740 lexicon: 1,
741 id: 'sh.tangled.pipeline.cancelPipeline',
742 defs: {
743 main: {
744 type: 'procedure',
745 description: 'Cancel a running pipeline',
746 input: {
747 encoding: 'application/json',
748 schema: {
749 type: 'object',
750 required: ['repo', 'pipeline', 'workflow'],
751 properties: {
752 repo: {
753 type: 'string',
754 format: 'at-uri',
755 description:
756 "repo at-uri, spindle can't resolve repo from pipeline at-uri yet",
757 },
758 pipeline: {
759 type: 'string',
760 format: 'at-uri',
761 description: 'pipeline at-uri',
762 },
763 workflow: {
764 type: 'string',
765 description: 'workflow name',
766 },
767 },
768 },
769 },
770 },
771 },
772 },
773 ShTangledPipeline: {
774 lexicon: 1,
775 id: 'sh.tangled.pipeline',
776 needsCbor: true,
777 needsType: true,
778 defs: {
779 main: {
780 type: 'record',
781 key: 'tid',
782 record: {
783 type: 'object',
784 required: ['triggerMetadata', 'workflows'],
785 properties: {
786 triggerMetadata: {
787 type: 'ref',
788 ref: 'lex:sh.tangled.pipeline#triggerMetadata',
789 },
790 workflows: {
791 type: 'array',
792 items: {
793 type: 'ref',
794 ref: 'lex:sh.tangled.pipeline#workflow',
795 },
796 },
797 },
798 },
799 },
800 triggerMetadata: {
801 type: 'object',
802 required: ['kind', 'repo'],
803 properties: {
804 kind: {
805 type: 'string',
806 enum: ['push', 'pull_request', 'manual'],
807 },
808 repo: {
809 type: 'ref',
810 ref: 'lex:sh.tangled.pipeline#triggerRepo',
811 },
812 push: {
813 type: 'ref',
814 ref: 'lex:sh.tangled.pipeline#pushTriggerData',
815 },
816 pullRequest: {
817 type: 'ref',
818 ref: 'lex:sh.tangled.pipeline#pullRequestTriggerData',
819 },
820 manual: {
821 type: 'ref',
822 ref: 'lex:sh.tangled.pipeline#manualTriggerData',
823 },
824 },
825 },
826 triggerRepo: {
827 type: 'object',
828 required: ['knot', 'did', 'repo', 'defaultBranch'],
829 properties: {
830 knot: {
831 type: 'string',
832 },
833 did: {
834 type: 'string',
835 format: 'did',
836 },
837 repo: {
838 type: 'string',
839 },
840 defaultBranch: {
841 type: 'string',
842 },
843 },
844 },
845 pushTriggerData: {
846 type: 'object',
847 required: ['ref', 'newSha', 'oldSha'],
848 properties: {
849 ref: {
850 type: 'string',
851 },
852 newSha: {
853 type: 'string',
854 minLength: 40,
855 maxLength: 40,
856 },
857 oldSha: {
858 type: 'string',
859 minLength: 40,
860 maxLength: 40,
861 },
862 },
863 },
864 pullRequestTriggerData: {
865 type: 'object',
866 required: ['sourceBranch', 'targetBranch', 'sourceSha', 'action'],
867 properties: {
868 sourceBranch: {
869 type: 'string',
870 },
871 targetBranch: {
872 type: 'string',
873 },
874 sourceSha: {
875 type: 'string',
876 minLength: 40,
877 maxLength: 40,
878 },
879 action: {
880 type: 'string',
881 },
882 },
883 },
884 manualTriggerData: {
885 type: 'object',
886 properties: {
887 inputs: {
888 type: 'array',
889 items: {
890 type: 'ref',
891 ref: 'lex:sh.tangled.pipeline#pair',
892 },
893 },
894 },
895 },
896 workflow: {
897 type: 'object',
898 required: ['name', 'engine', 'clone', 'raw'],
899 properties: {
900 name: {
901 type: 'string',
902 },
903 engine: {
904 type: 'string',
905 },
906 clone: {
907 type: 'ref',
908 ref: 'lex:sh.tangled.pipeline#cloneOpts',
909 },
910 raw: {
911 type: 'string',
912 },
913 },
914 },
915 cloneOpts: {
916 type: 'object',
917 required: ['skip', 'depth', 'submodules'],
918 properties: {
919 skip: {
920 type: 'boolean',
921 },
922 depth: {
923 type: 'integer',
924 },
925 submodules: {
926 type: 'boolean',
927 },
928 },
929 },
930 pair: {
931 type: 'object',
932 required: ['key', 'value'],
933 properties: {
934 key: {
935 type: 'string',
936 },
937 value: {
938 type: 'string',
939 },
940 },
941 },
942 },
943 },
944 ShTangledPipelineStatus: {
945 lexicon: 1,
946 id: 'sh.tangled.pipeline.status',
947 needsCbor: true,
948 needsType: true,
949 defs: {
950 main: {
951 type: 'record',
952 key: 'tid',
953 record: {
954 type: 'object',
955 required: ['pipeline', 'workflow', 'status', 'createdAt'],
956 properties: {
957 pipeline: {
958 type: 'string',
959 format: 'at-uri',
960 description: 'ATURI of the pipeline',
961 },
962 workflow: {
963 type: 'string',
964 format: 'at-uri',
965 description: 'name of the workflow within this pipeline',
966 },
967 status: {
968 type: 'string',
969 description: 'status of the workflow',
970 enum: [
971 'pending',
972 'running',
973 'failed',
974 'timeout',
975 'cancelled',
976 'success',
977 ],
978 },
979 createdAt: {
980 type: 'string',
981 format: 'datetime',
982 description: 'time of creation of this status update',
983 },
984 error: {
985 type: 'string',
986 description: 'error message if failed',
987 },
988 exitCode: {
989 type: 'integer',
990 description: 'exit code if failed',
991 },
992 },
993 },
994 },
995 },
996 },
997 ShTangledRepoPullStatusClosed: {
998 lexicon: 1,
999 id: 'sh.tangled.repo.pull.status.closed',
1000 needsCbor: true,
1001 needsType: true,
1002 defs: {
1003 main: {
1004 type: 'token',
1005 description: 'closed pull request',
1006 },
1007 },
1008 },
1009 ShTangledRepoPullComment: {
1010 lexicon: 1,
1011 id: 'sh.tangled.repo.pull.comment',
1012 needsCbor: true,
1013 needsType: true,
1014 defs: {
1015 main: {
1016 type: 'record',
1017 key: 'tid',
1018 record: {
1019 type: 'object',
1020 required: ['pull', 'body', 'createdAt'],
1021 properties: {
1022 pull: {
1023 type: 'string',
1024 format: 'at-uri',
1025 },
1026 body: {
1027 type: 'string',
1028 },
1029 createdAt: {
1030 type: 'string',
1031 format: 'datetime',
1032 },
1033 mentions: {
1034 type: 'array',
1035 items: {
1036 type: 'string',
1037 format: 'did',
1038 },
1039 },
1040 references: {
1041 type: 'array',
1042 items: {
1043 type: 'string',
1044 format: 'at-uri',
1045 },
1046 },
1047 },
1048 },
1049 },
1050 },
1051 },
1052 ShTangledRepoPullStatusMerged: {
1053 lexicon: 1,
1054 id: 'sh.tangled.repo.pull.status.merged',
1055 needsCbor: true,
1056 needsType: true,
1057 defs: {
1058 main: {
1059 type: 'token',
1060 description: 'merged pull request',
1061 },
1062 },
1063 },
1064 ShTangledRepoPullStatusOpen: {
1065 lexicon: 1,
1066 id: 'sh.tangled.repo.pull.status.open',
1067 needsCbor: true,
1068 needsType: true,
1069 defs: {
1070 main: {
1071 type: 'token',
1072 description: 'open pull request',
1073 },
1074 },
1075 },
1076 ShTangledRepoPull: {
1077 lexicon: 1,
1078 id: 'sh.tangled.repo.pull',
1079 needsCbor: true,
1080 needsType: true,
1081 defs: {
1082 main: {
1083 type: 'record',
1084 key: 'tid',
1085 record: {
1086 type: 'object',
1087 required: ['target', 'title', 'patchBlob', 'createdAt'],
1088 properties: {
1089 target: {
1090 type: 'ref',
1091 ref: 'lex:sh.tangled.repo.pull#target',
1092 },
1093 title: {
1094 type: 'string',
1095 },
1096 body: {
1097 type: 'string',
1098 },
1099 patch: {
1100 type: 'string',
1101 description: '(deprecated) use patchBlob instead',
1102 },
1103 patchBlob: {
1104 type: 'blob',
1105 accept: ['text/x-patch'],
1106 description: 'patch content',
1107 },
1108 source: {
1109 type: 'ref',
1110 ref: 'lex:sh.tangled.repo.pull#source',
1111 },
1112 createdAt: {
1113 type: 'string',
1114 format: 'datetime',
1115 },
1116 mentions: {
1117 type: 'array',
1118 items: {
1119 type: 'string',
1120 format: 'did',
1121 },
1122 },
1123 references: {
1124 type: 'array',
1125 items: {
1126 type: 'string',
1127 format: 'at-uri',
1128 },
1129 },
1130 },
1131 },
1132 },
1133 target: {
1134 type: 'object',
1135 required: ['repo', 'branch'],
1136 properties: {
1137 repo: {
1138 type: 'string',
1139 format: 'at-uri',
1140 },
1141 branch: {
1142 type: 'string',
1143 },
1144 },
1145 },
1146 source: {
1147 type: 'object',
1148 required: ['branch', 'sha'],
1149 properties: {
1150 branch: {
1151 type: 'string',
1152 },
1153 sha: {
1154 type: 'string',
1155 minLength: 40,
1156 maxLength: 40,
1157 },
1158 repo: {
1159 type: 'string',
1160 format: 'at-uri',
1161 },
1162 },
1163 },
1164 },
1165 },
1166 ShTangledRepoPullStatus: {
1167 lexicon: 1,
1168 id: 'sh.tangled.repo.pull.status',
1169 needsCbor: true,
1170 needsType: true,
1171 defs: {
1172 main: {
1173 type: 'record',
1174 key: 'tid',
1175 record: {
1176 type: 'object',
1177 required: ['pull', 'status'],
1178 properties: {
1179 pull: {
1180 type: 'string',
1181 format: 'at-uri',
1182 },
1183 status: {
1184 type: 'string',
1185 description: 'status of the pull request',
1186 knownValues: [
1187 'sh.tangled.repo.pull.status.open',
1188 'sh.tangled.repo.pull.status.closed',
1189 'sh.tangled.repo.pull.status.merged',
1190 ],
1191 default: 'sh.tangled.repo.pull.status.open',
1192 },
1193 },
1194 },
1195 },
1196 },
1197 },
1198 ShTangledRepoAddSecret: {
1199 lexicon: 1,
1200 id: 'sh.tangled.repo.addSecret',
1201 defs: {
1202 main: {
1203 type: 'procedure',
1204 description: 'Add a CI secret',
1205 input: {
1206 encoding: 'application/json',
1207 schema: {
1208 type: 'object',
1209 required: ['repo', 'key', 'value'],
1210 properties: {
1211 repo: {
1212 type: 'string',
1213 format: 'at-uri',
1214 },
1215 key: {
1216 type: 'string',
1217 maxLength: 50,
1218 minLength: 1,
1219 },
1220 value: {
1221 type: 'string',
1222 maxLength: 200,
1223 minLength: 1,
1224 },
1225 },
1226 },
1227 },
1228 },
1229 },
1230 },
1231 ShTangledRepoArchive: {
1232 lexicon: 1,
1233 id: 'sh.tangled.repo.archive',
1234 defs: {
1235 main: {
1236 type: 'query',
1237 parameters: {
1238 type: 'params',
1239 required: ['repo', 'ref'],
1240 properties: {
1241 repo: {
1242 type: 'string',
1243 description:
1244 "Repository identifier in format 'did:plc:.../repoName'",
1245 },
1246 ref: {
1247 type: 'string',
1248 description: 'Git reference (branch, tag, or commit SHA)',
1249 },
1250 format: {
1251 type: 'string',
1252 description: 'Archive format',
1253 enum: ['tar', 'zip', 'tar.gz', 'tar.bz2', 'tar.xz'],
1254 default: 'tar.gz',
1255 },
1256 prefix: {
1257 type: 'string',
1258 description: 'Prefix for files in the archive',
1259 },
1260 },
1261 },
1262 output: {
1263 encoding: '*/*',
1264 description: 'Binary archive data',
1265 },
1266 errors: [
1267 {
1268 name: 'RepoNotFound',
1269 description: 'Repository not found or access denied',
1270 },
1271 {
1272 name: 'RefNotFound',
1273 description: 'Git reference not found',
1274 },
1275 {
1276 name: 'InvalidRequest',
1277 description: 'Invalid request parameters',
1278 },
1279 {
1280 name: 'ArchiveError',
1281 description: 'Failed to create archive',
1282 },
1283 ],
1284 },
1285 },
1286 },
1287 ShTangledRepoArtifact: {
1288 lexicon: 1,
1289 id: 'sh.tangled.repo.artifact',
1290 needsCbor: true,
1291 needsType: true,
1292 defs: {
1293 main: {
1294 type: 'record',
1295 key: 'tid',
1296 record: {
1297 type: 'object',
1298 required: ['name', 'repo', 'tag', 'createdAt', 'artifact'],
1299 properties: {
1300 name: {
1301 type: 'string',
1302 description: 'name of the artifact',
1303 },
1304 repo: {
1305 type: 'string',
1306 format: 'at-uri',
1307 description: 'repo that this artifact is being uploaded to',
1308 },
1309 tag: {
1310 type: 'bytes',
1311 description:
1312 'hash of the tag object that this artifact is attached to (only annotated tags are supported)',
1313 minLength: 20,
1314 maxLength: 20,
1315 },
1316 createdAt: {
1317 type: 'string',
1318 format: 'datetime',
1319 description: 'time of creation of this artifact',
1320 },
1321 artifact: {
1322 type: 'blob',
1323 description: 'the artifact',
1324 accept: ['*/*'],
1325 maxSize: 52428800,
1326 },
1327 },
1328 },
1329 },
1330 },
1331 },
1332 ShTangledRepoBlob: {
1333 lexicon: 1,
1334 id: 'sh.tangled.repo.blob',
1335 defs: {
1336 main: {
1337 type: 'query',
1338 parameters: {
1339 type: 'params',
1340 required: ['repo', 'ref', 'path'],
1341 properties: {
1342 repo: {
1343 type: 'string',
1344 description:
1345 "Repository identifier in format 'did:plc:.../repoName'",
1346 },
1347 ref: {
1348 type: 'string',
1349 description: 'Git reference (branch, tag, or commit SHA)',
1350 },
1351 path: {
1352 type: 'string',
1353 description: 'Path to the file within the repository',
1354 },
1355 raw: {
1356 type: 'boolean',
1357 description: 'Return raw file content instead of JSON response',
1358 default: false,
1359 },
1360 },
1361 },
1362 output: {
1363 encoding: 'application/json',
1364 schema: {
1365 type: 'object',
1366 required: ['ref', 'path'],
1367 properties: {
1368 ref: {
1369 type: 'string',
1370 description: 'The git reference used',
1371 },
1372 path: {
1373 type: 'string',
1374 description: 'The file path',
1375 },
1376 content: {
1377 type: 'string',
1378 description: 'File content (base64 encoded for binary files)',
1379 },
1380 encoding: {
1381 type: 'string',
1382 description: 'Content encoding',
1383 enum: ['utf-8', 'base64'],
1384 },
1385 size: {
1386 type: 'integer',
1387 description: 'File size in bytes',
1388 },
1389 isBinary: {
1390 type: 'boolean',
1391 description: 'Whether the file is binary',
1392 },
1393 mimeType: {
1394 type: 'string',
1395 description: 'MIME type of the file',
1396 },
1397 submodule: {
1398 type: 'ref',
1399 ref: 'lex:sh.tangled.repo.blob#submodule',
1400 description: 'Submodule information if path is a submodule',
1401 },
1402 lastCommit: {
1403 type: 'ref',
1404 ref: 'lex:sh.tangled.repo.blob#lastCommit',
1405 },
1406 },
1407 },
1408 },
1409 errors: [
1410 {
1411 name: 'RepoNotFound',
1412 description: 'Repository not found or access denied',
1413 },
1414 {
1415 name: 'RefNotFound',
1416 description: 'Git reference not found',
1417 },
1418 {
1419 name: 'FileNotFound',
1420 description: 'File not found at the specified path',
1421 },
1422 {
1423 name: 'InvalidRequest',
1424 description: 'Invalid request parameters',
1425 },
1426 ],
1427 },
1428 lastCommit: {
1429 type: 'object',
1430 required: ['hash', 'message', 'when'],
1431 properties: {
1432 hash: {
1433 type: 'string',
1434 description: 'Commit hash',
1435 },
1436 message: {
1437 type: 'string',
1438 description: 'Commit message',
1439 },
1440 author: {
1441 type: 'ref',
1442 ref: 'lex:sh.tangled.repo.blob#signature',
1443 },
1444 when: {
1445 type: 'string',
1446 format: 'datetime',
1447 description: 'Commit timestamp',
1448 },
1449 },
1450 },
1451 signature: {
1452 type: 'object',
1453 required: ['name', 'email', 'when'],
1454 properties: {
1455 name: {
1456 type: 'string',
1457 description: 'Author name',
1458 },
1459 email: {
1460 type: 'string',
1461 description: 'Author email',
1462 },
1463 when: {
1464 type: 'string',
1465 format: 'datetime',
1466 description: 'Author timestamp',
1467 },
1468 },
1469 },
1470 submodule: {
1471 type: 'object',
1472 required: ['name', 'url'],
1473 properties: {
1474 name: {
1475 type: 'string',
1476 description: 'Submodule name',
1477 },
1478 url: {
1479 type: 'string',
1480 description: 'Submodule repository URL',
1481 },
1482 branch: {
1483 type: 'string',
1484 description: 'Branch to track in the submodule',
1485 },
1486 },
1487 },
1488 },
1489 },
1490 ShTangledRepoBranch: {
1491 lexicon: 1,
1492 id: 'sh.tangled.repo.branch',
1493 defs: {
1494 main: {
1495 type: 'query',
1496 parameters: {
1497 type: 'params',
1498 required: ['repo', 'name'],
1499 properties: {
1500 repo: {
1501 type: 'string',
1502 description:
1503 "Repository identifier in format 'did:plc:.../repoName'",
1504 },
1505 name: {
1506 type: 'string',
1507 description: 'Branch name to get information for',
1508 },
1509 },
1510 },
1511 output: {
1512 encoding: 'application/json',
1513 schema: {
1514 type: 'object',
1515 required: ['name', 'hash', 'when'],
1516 properties: {
1517 name: {
1518 type: 'string',
1519 description: 'Branch name',
1520 },
1521 hash: {
1522 type: 'string',
1523 description: 'Latest commit hash on this branch',
1524 },
1525 shortHash: {
1526 type: 'string',
1527 description: 'Short commit hash',
1528 },
1529 when: {
1530 type: 'string',
1531 format: 'datetime',
1532 description: 'Timestamp of latest commit',
1533 },
1534 message: {
1535 type: 'string',
1536 description: 'Latest commit message',
1537 },
1538 author: {
1539 type: 'ref',
1540 ref: 'lex:sh.tangled.repo.branch#signature',
1541 },
1542 isDefault: {
1543 type: 'boolean',
1544 description: 'Whether this is the default branch',
1545 },
1546 },
1547 },
1548 },
1549 errors: [
1550 {
1551 name: 'RepoNotFound',
1552 description: 'Repository not found or access denied',
1553 },
1554 {
1555 name: 'BranchNotFound',
1556 description: 'Branch not found',
1557 },
1558 {
1559 name: 'InvalidRequest',
1560 description: 'Invalid request parameters',
1561 },
1562 ],
1563 },
1564 signature: {
1565 type: 'object',
1566 required: ['name', 'email', 'when'],
1567 properties: {
1568 name: {
1569 type: 'string',
1570 description: 'Author name',
1571 },
1572 email: {
1573 type: 'string',
1574 description: 'Author email',
1575 },
1576 when: {
1577 type: 'string',
1578 format: 'datetime',
1579 description: 'Author timestamp',
1580 },
1581 },
1582 },
1583 },
1584 },
1585 ShTangledRepoBranches: {
1586 lexicon: 1,
1587 id: 'sh.tangled.repo.branches',
1588 defs: {
1589 main: {
1590 type: 'query',
1591 parameters: {
1592 type: 'params',
1593 required: ['repo'],
1594 properties: {
1595 repo: {
1596 type: 'string',
1597 description:
1598 "Repository identifier in format 'did:plc:.../repoName'",
1599 },
1600 limit: {
1601 type: 'integer',
1602 description: 'Maximum number of branches to return',
1603 minimum: 1,
1604 maximum: 100,
1605 default: 50,
1606 },
1607 cursor: {
1608 type: 'string',
1609 description: 'Pagination cursor',
1610 },
1611 },
1612 },
1613 output: {
1614 encoding: '*/*',
1615 },
1616 errors: [
1617 {
1618 name: 'RepoNotFound',
1619 description: 'Repository not found or access denied',
1620 },
1621 {
1622 name: 'InvalidRequest',
1623 description: 'Invalid request parameters',
1624 },
1625 ],
1626 },
1627 },
1628 },
1629 ShTangledRepoCollaborator: {
1630 lexicon: 1,
1631 id: 'sh.tangled.repo.collaborator',
1632 needsCbor: true,
1633 needsType: true,
1634 defs: {
1635 main: {
1636 type: 'record',
1637 key: 'tid',
1638 record: {
1639 type: 'object',
1640 required: ['subject', 'repo', 'createdAt'],
1641 properties: {
1642 subject: {
1643 type: 'string',
1644 format: 'did',
1645 },
1646 repo: {
1647 type: 'string',
1648 description: 'repo to add this user to',
1649 format: 'at-uri',
1650 },
1651 createdAt: {
1652 type: 'string',
1653 format: 'datetime',
1654 },
1655 },
1656 },
1657 },
1658 },
1659 },
1660 ShTangledRepoCompare: {
1661 lexicon: 1,
1662 id: 'sh.tangled.repo.compare',
1663 defs: {
1664 main: {
1665 type: 'query',
1666 parameters: {
1667 type: 'params',
1668 required: ['repo', 'rev1', 'rev2'],
1669 properties: {
1670 repo: {
1671 type: 'string',
1672 description:
1673 "Repository identifier in format 'did:plc:.../repoName'",
1674 },
1675 rev1: {
1676 type: 'string',
1677 description: 'First revision (commit, branch, or tag)',
1678 },
1679 rev2: {
1680 type: 'string',
1681 description: 'Second revision (commit, branch, or tag)',
1682 },
1683 },
1684 },
1685 output: {
1686 encoding: '*/*',
1687 description: 'Compare output in application/json',
1688 },
1689 errors: [
1690 {
1691 name: 'RepoNotFound',
1692 description: 'Repository not found or access denied',
1693 },
1694 {
1695 name: 'RevisionNotFound',
1696 description: 'One or both revisions not found',
1697 },
1698 {
1699 name: 'InvalidRequest',
1700 description: 'Invalid request parameters',
1701 },
1702 {
1703 name: 'CompareError',
1704 description: 'Failed to compare revisions',
1705 },
1706 ],
1707 },
1708 },
1709 },
1710 ShTangledRepoCreate: {
1711 lexicon: 1,
1712 id: 'sh.tangled.repo.create',
1713 defs: {
1714 main: {
1715 type: 'procedure',
1716 description: 'Create a new repository',
1717 input: {
1718 encoding: 'application/json',
1719 schema: {
1720 type: 'object',
1721 required: ['rkey'],
1722 properties: {
1723 rkey: {
1724 type: 'string',
1725 description: 'Rkey of the repository record',
1726 },
1727 defaultBranch: {
1728 type: 'string',
1729 description: 'Default branch to push to',
1730 },
1731 source: {
1732 type: 'string',
1733 description:
1734 'A source URL to clone from, populate this when forking or importing a repository.',
1735 },
1736 },
1737 },
1738 },
1739 },
1740 },
1741 },
1742 ShTangledRepoSetDefaultBranch: {
1743 lexicon: 1,
1744 id: 'sh.tangled.repo.setDefaultBranch',
1745 defs: {
1746 main: {
1747 type: 'procedure',
1748 description: 'Set the default branch for a repository',
1749 input: {
1750 encoding: 'application/json',
1751 schema: {
1752 type: 'object',
1753 required: ['repo', 'defaultBranch'],
1754 properties: {
1755 repo: {
1756 type: 'string',
1757 format: 'at-uri',
1758 },
1759 defaultBranch: {
1760 type: 'string',
1761 },
1762 },
1763 },
1764 },
1765 },
1766 },
1767 },
1768 ShTangledRepoDelete: {
1769 lexicon: 1,
1770 id: 'sh.tangled.repo.delete',
1771 defs: {
1772 main: {
1773 type: 'procedure',
1774 description: 'Delete a repository',
1775 input: {
1776 encoding: 'application/json',
1777 schema: {
1778 type: 'object',
1779 required: ['did', 'name', 'rkey'],
1780 properties: {
1781 did: {
1782 type: 'string',
1783 format: 'did',
1784 description: 'DID of the repository owner',
1785 },
1786 name: {
1787 type: 'string',
1788 description: 'Name of the repository to delete',
1789 },
1790 rkey: {
1791 type: 'string',
1792 description: 'Rkey of the repository record',
1793 },
1794 },
1795 },
1796 },
1797 },
1798 },
1799 },
1800 ShTangledRepoDeleteBranch: {
1801 lexicon: 1,
1802 id: 'sh.tangled.repo.deleteBranch',
1803 defs: {
1804 main: {
1805 type: 'procedure',
1806 description: 'Delete a branch on this repository',
1807 input: {
1808 encoding: 'application/json',
1809 schema: {
1810 type: 'object',
1811 required: ['repo', 'branch'],
1812 properties: {
1813 repo: {
1814 type: 'string',
1815 format: 'at-uri',
1816 },
1817 branch: {
1818 type: 'string',
1819 },
1820 },
1821 },
1822 },
1823 },
1824 },
1825 },
1826 ShTangledRepoDiff: {
1827 lexicon: 1,
1828 id: 'sh.tangled.repo.diff',
1829 defs: {
1830 main: {
1831 type: 'query',
1832 parameters: {
1833 type: 'params',
1834 required: ['repo', 'ref'],
1835 properties: {
1836 repo: {
1837 type: 'string',
1838 description:
1839 "Repository identifier in format 'did:plc:.../repoName'",
1840 },
1841 ref: {
1842 type: 'string',
1843 description: 'Git reference (branch, tag, or commit SHA)',
1844 },
1845 },
1846 },
1847 output: {
1848 encoding: '*/*',
1849 },
1850 errors: [
1851 {
1852 name: 'RepoNotFound',
1853 description: 'Repository not found or access denied',
1854 },
1855 {
1856 name: 'RefNotFound',
1857 description: 'Git reference not found',
1858 },
1859 {
1860 name: 'InvalidRequest',
1861 description: 'Invalid request parameters',
1862 },
1863 ],
1864 },
1865 },
1866 },
1867 ShTangledRepoForkStatus: {
1868 lexicon: 1,
1869 id: 'sh.tangled.repo.forkStatus',
1870 defs: {
1871 main: {
1872 type: 'procedure',
1873 description: 'Check fork status relative to upstream source',
1874 input: {
1875 encoding: 'application/json',
1876 schema: {
1877 type: 'object',
1878 required: ['did', 'name', 'source', 'branch', 'hiddenRef'],
1879 properties: {
1880 did: {
1881 type: 'string',
1882 format: 'did',
1883 description: 'DID of the fork owner',
1884 },
1885 name: {
1886 type: 'string',
1887 description: 'Name of the forked repository',
1888 },
1889 source: {
1890 type: 'string',
1891 description: 'Source repository URL',
1892 },
1893 branch: {
1894 type: 'string',
1895 description: 'Branch to check status for',
1896 },
1897 hiddenRef: {
1898 type: 'string',
1899 description: 'Hidden ref to use for comparison',
1900 },
1901 },
1902 },
1903 },
1904 output: {
1905 encoding: 'application/json',
1906 schema: {
1907 type: 'object',
1908 required: ['status'],
1909 properties: {
1910 status: {
1911 type: 'integer',
1912 description:
1913 'Fork status: 0=UpToDate, 1=FastForwardable, 2=Conflict, 3=MissingBranch',
1914 },
1915 },
1916 },
1917 },
1918 },
1919 },
1920 },
1921 ShTangledRepoForkSync: {
1922 lexicon: 1,
1923 id: 'sh.tangled.repo.forkSync',
1924 defs: {
1925 main: {
1926 type: 'procedure',
1927 description: 'Sync a forked repository with its upstream source',
1928 input: {
1929 encoding: 'application/json',
1930 schema: {
1931 type: 'object',
1932 required: ['did', 'source', 'name', 'branch'],
1933 properties: {
1934 did: {
1935 type: 'string',
1936 format: 'did',
1937 description: 'DID of the fork owner',
1938 },
1939 source: {
1940 type: 'string',
1941 format: 'at-uri',
1942 description: 'AT-URI of the source repository',
1943 },
1944 name: {
1945 type: 'string',
1946 description: 'Name of the forked repository',
1947 },
1948 branch: {
1949 type: 'string',
1950 description: 'Branch to sync',
1951 },
1952 },
1953 },
1954 },
1955 },
1956 },
1957 },
1958 ShTangledRepoGetDefaultBranch: {
1959 lexicon: 1,
1960 id: 'sh.tangled.repo.getDefaultBranch',
1961 defs: {
1962 main: {
1963 type: 'query',
1964 parameters: {
1965 type: 'params',
1966 required: ['repo'],
1967 properties: {
1968 repo: {
1969 type: 'string',
1970 description:
1971 "Repository identifier in format 'did:plc:.../repoName'",
1972 },
1973 },
1974 },
1975 output: {
1976 encoding: 'application/json',
1977 schema: {
1978 type: 'object',
1979 required: ['name', 'hash', 'when'],
1980 properties: {
1981 name: {
1982 type: 'string',
1983 description: 'Default branch name',
1984 },
1985 hash: {
1986 type: 'string',
1987 description: 'Latest commit hash on default branch',
1988 },
1989 shortHash: {
1990 type: 'string',
1991 description: 'Short commit hash',
1992 },
1993 when: {
1994 type: 'string',
1995 format: 'datetime',
1996 description: 'Timestamp of latest commit',
1997 },
1998 message: {
1999 type: 'string',
2000 description: 'Latest commit message',
2001 },
2002 author: {
2003 type: 'ref',
2004 ref: 'lex:sh.tangled.repo.getDefaultBranch#signature',
2005 },
2006 },
2007 },
2008 },
2009 errors: [
2010 {
2011 name: 'RepoNotFound',
2012 description: 'Repository not found or access denied',
2013 },
2014 {
2015 name: 'InvalidRequest',
2016 description: 'Invalid request parameters',
2017 },
2018 ],
2019 },
2020 signature: {
2021 type: 'object',
2022 required: ['name', 'email', 'when'],
2023 properties: {
2024 name: {
2025 type: 'string',
2026 description: 'Author name',
2027 },
2028 email: {
2029 type: 'string',
2030 description: 'Author email',
2031 },
2032 when: {
2033 type: 'string',
2034 format: 'datetime',
2035 description: 'Author timestamp',
2036 },
2037 },
2038 },
2039 },
2040 },
2041 ShTangledRepoHiddenRef: {
2042 lexicon: 1,
2043 id: 'sh.tangled.repo.hiddenRef',
2044 defs: {
2045 main: {
2046 type: 'procedure',
2047 description: 'Create a hidden ref in a repository',
2048 input: {
2049 encoding: 'application/json',
2050 schema: {
2051 type: 'object',
2052 required: ['repo', 'forkRef', 'remoteRef'],
2053 properties: {
2054 repo: {
2055 type: 'string',
2056 format: 'at-uri',
2057 description: 'AT-URI of the repository',
2058 },
2059 forkRef: {
2060 type: 'string',
2061 description: 'Fork reference name',
2062 },
2063 remoteRef: {
2064 type: 'string',
2065 description: 'Remote reference name',
2066 },
2067 },
2068 },
2069 },
2070 output: {
2071 encoding: 'application/json',
2072 schema: {
2073 type: 'object',
2074 required: ['success'],
2075 properties: {
2076 success: {
2077 type: 'boolean',
2078 description: 'Whether the hidden ref was created successfully',
2079 },
2080 ref: {
2081 type: 'string',
2082 description: 'The created hidden ref name',
2083 },
2084 error: {
2085 type: 'string',
2086 description: 'Error message if creation failed',
2087 },
2088 },
2089 },
2090 },
2091 },
2092 },
2093 },
2094 ShTangledRepoLanguages: {
2095 lexicon: 1,
2096 id: 'sh.tangled.repo.languages',
2097 defs: {
2098 main: {
2099 type: 'query',
2100 parameters: {
2101 type: 'params',
2102 required: ['repo'],
2103 properties: {
2104 repo: {
2105 type: 'string',
2106 description:
2107 "Repository identifier in format 'did:plc:.../repoName'",
2108 },
2109 ref: {
2110 type: 'string',
2111 description: 'Git reference (branch, tag, or commit SHA)',
2112 default: 'HEAD',
2113 },
2114 },
2115 },
2116 output: {
2117 encoding: 'application/json',
2118 schema: {
2119 type: 'object',
2120 required: ['ref', 'languages'],
2121 properties: {
2122 ref: {
2123 type: 'string',
2124 description: 'The git reference used',
2125 },
2126 languages: {
2127 type: 'array',
2128 items: {
2129 type: 'ref',
2130 ref: 'lex:sh.tangled.repo.languages#language',
2131 },
2132 },
2133 totalSize: {
2134 type: 'integer',
2135 description: 'Total size of all analyzed files in bytes',
2136 },
2137 totalFiles: {
2138 type: 'integer',
2139 description: 'Total number of files analyzed',
2140 },
2141 },
2142 },
2143 },
2144 errors: [
2145 {
2146 name: 'RepoNotFound',
2147 description: 'Repository not found or access denied',
2148 },
2149 {
2150 name: 'RefNotFound',
2151 description: 'Git reference not found',
2152 },
2153 {
2154 name: 'InvalidRequest',
2155 description: 'Invalid request parameters',
2156 },
2157 ],
2158 },
2159 language: {
2160 type: 'object',
2161 required: ['name', 'size', 'percentage'],
2162 properties: {
2163 name: {
2164 type: 'string',
2165 description: 'Programming language name',
2166 },
2167 size: {
2168 type: 'integer',
2169 description: 'Total size of files in this language (bytes)',
2170 },
2171 percentage: {
2172 type: 'integer',
2173 description: 'Percentage of total codebase (0-100)',
2174 },
2175 fileCount: {
2176 type: 'integer',
2177 description: 'Number of files in this language',
2178 },
2179 color: {
2180 type: 'string',
2181 description: 'Hex color code for this language',
2182 },
2183 extensions: {
2184 type: 'array',
2185 items: {
2186 type: 'string',
2187 },
2188 description: 'File extensions associated with this language',
2189 },
2190 },
2191 },
2192 },
2193 },
2194 ShTangledRepoListSecrets: {
2195 lexicon: 1,
2196 id: 'sh.tangled.repo.listSecrets',
2197 defs: {
2198 main: {
2199 type: 'query',
2200 parameters: {
2201 type: 'params',
2202 required: ['repo'],
2203 properties: {
2204 repo: {
2205 type: 'string',
2206 format: 'at-uri',
2207 },
2208 },
2209 },
2210 output: {
2211 encoding: 'application/json',
2212 schema: {
2213 type: 'object',
2214 required: ['secrets'],
2215 properties: {
2216 secrets: {
2217 type: 'array',
2218 items: {
2219 type: 'ref',
2220 ref: 'lex:sh.tangled.repo.listSecrets#secret',
2221 },
2222 },
2223 },
2224 },
2225 },
2226 },
2227 secret: {
2228 type: 'object',
2229 required: ['repo', 'key', 'createdAt', 'createdBy'],
2230 properties: {
2231 repo: {
2232 type: 'string',
2233 format: 'at-uri',
2234 },
2235 key: {
2236 type: 'string',
2237 maxLength: 50,
2238 minLength: 1,
2239 },
2240 createdAt: {
2241 type: 'string',
2242 format: 'datetime',
2243 },
2244 createdBy: {
2245 type: 'string',
2246 format: 'did',
2247 },
2248 },
2249 },
2250 },
2251 },
2252 ShTangledRepoLog: {
2253 lexicon: 1,
2254 id: 'sh.tangled.repo.log',
2255 defs: {
2256 main: {
2257 type: 'query',
2258 parameters: {
2259 type: 'params',
2260 required: ['repo', 'ref'],
2261 properties: {
2262 repo: {
2263 type: 'string',
2264 description:
2265 "Repository identifier in format 'did:plc:.../repoName'",
2266 },
2267 ref: {
2268 type: 'string',
2269 description: 'Git reference (branch, tag, or commit SHA)',
2270 },
2271 path: {
2272 type: 'string',
2273 description: 'Path to filter commits by',
2274 default: '',
2275 },
2276 limit: {
2277 type: 'integer',
2278 description: 'Maximum number of commits to return',
2279 minimum: 1,
2280 maximum: 100,
2281 default: 50,
2282 },
2283 cursor: {
2284 type: 'string',
2285 description: 'Pagination cursor (commit SHA)',
2286 },
2287 },
2288 },
2289 output: {
2290 encoding: '*/*',
2291 },
2292 errors: [
2293 {
2294 name: 'RepoNotFound',
2295 description: 'Repository not found or access denied',
2296 },
2297 {
2298 name: 'RefNotFound',
2299 description: 'Git reference not found',
2300 },
2301 {
2302 name: 'PathNotFound',
2303 description: 'Path not found in repository',
2304 },
2305 {
2306 name: 'InvalidRequest',
2307 description: 'Invalid request parameters',
2308 },
2309 ],
2310 },
2311 },
2312 },
2313 ShTangledRepoMerge: {
2314 lexicon: 1,
2315 id: 'sh.tangled.repo.merge',
2316 defs: {
2317 main: {
2318 type: 'procedure',
2319 description: 'Merge a patch into a repository branch',
2320 input: {
2321 encoding: 'application/json',
2322 schema: {
2323 type: 'object',
2324 required: ['did', 'name', 'patch', 'branch'],
2325 properties: {
2326 did: {
2327 type: 'string',
2328 format: 'did',
2329 description: 'DID of the repository owner',
2330 },
2331 name: {
2332 type: 'string',
2333 description: 'Name of the repository',
2334 },
2335 patch: {
2336 type: 'string',
2337 description: 'Patch content to merge',
2338 },
2339 branch: {
2340 type: 'string',
2341 description: 'Target branch to merge into',
2342 },
2343 authorName: {
2344 type: 'string',
2345 description: 'Author name for the merge commit',
2346 },
2347 authorEmail: {
2348 type: 'string',
2349 description: 'Author email for the merge commit',
2350 },
2351 commitBody: {
2352 type: 'string',
2353 description: 'Additional commit message body',
2354 },
2355 commitMessage: {
2356 type: 'string',
2357 description: 'Merge commit message',
2358 },
2359 },
2360 },
2361 },
2362 },
2363 },
2364 },
2365 ShTangledRepoMergeCheck: {
2366 lexicon: 1,
2367 id: 'sh.tangled.repo.mergeCheck',
2368 defs: {
2369 main: {
2370 type: 'procedure',
2371 description: 'Check if a merge is possible between two branches',
2372 input: {
2373 encoding: 'application/json',
2374 schema: {
2375 type: 'object',
2376 required: ['did', 'name', 'patch', 'branch'],
2377 properties: {
2378 did: {
2379 type: 'string',
2380 format: 'did',
2381 description: 'DID of the repository owner',
2382 },
2383 name: {
2384 type: 'string',
2385 description: 'Name of the repository',
2386 },
2387 patch: {
2388 type: 'string',
2389 description:
2390 'Patch or pull request to check for merge conflicts',
2391 },
2392 branch: {
2393 type: 'string',
2394 description: 'Target branch to merge into',
2395 },
2396 },
2397 },
2398 },
2399 output: {
2400 encoding: 'application/json',
2401 schema: {
2402 type: 'object',
2403 required: ['is_conflicted'],
2404 properties: {
2405 is_conflicted: {
2406 type: 'boolean',
2407 description: 'Whether the merge has conflicts',
2408 },
2409 conflicts: {
2410 type: 'array',
2411 description: 'List of files with merge conflicts',
2412 items: {
2413 type: 'ref',
2414 ref: 'lex:sh.tangled.repo.mergeCheck#conflictInfo',
2415 },
2416 },
2417 message: {
2418 type: 'string',
2419 description: 'Additional message about the merge check',
2420 },
2421 error: {
2422 type: 'string',
2423 description: 'Error message if check failed',
2424 },
2425 },
2426 },
2427 },
2428 },
2429 conflictInfo: {
2430 type: 'object',
2431 required: ['filename', 'reason'],
2432 properties: {
2433 filename: {
2434 type: 'string',
2435 description: 'Name of the conflicted file',
2436 },
2437 reason: {
2438 type: 'string',
2439 description: 'Reason for the conflict',
2440 },
2441 },
2442 },
2443 },
2444 },
2445 ShTangledRepoRemoveSecret: {
2446 lexicon: 1,
2447 id: 'sh.tangled.repo.removeSecret',
2448 defs: {
2449 main: {
2450 type: 'procedure',
2451 description: 'Remove a CI secret',
2452 input: {
2453 encoding: 'application/json',
2454 schema: {
2455 type: 'object',
2456 required: ['repo', 'key'],
2457 properties: {
2458 repo: {
2459 type: 'string',
2460 format: 'at-uri',
2461 },
2462 key: {
2463 type: 'string',
2464 maxLength: 50,
2465 minLength: 1,
2466 },
2467 },
2468 },
2469 },
2470 },
2471 },
2472 },
2473 ShTangledRepo: {
2474 lexicon: 1,
2475 id: 'sh.tangled.repo',
2476 needsCbor: true,
2477 needsType: true,
2478 defs: {
2479 main: {
2480 type: 'record',
2481 key: 'tid',
2482 record: {
2483 type: 'object',
2484 required: ['name', 'knot', 'createdAt'],
2485 properties: {
2486 name: {
2487 type: 'string',
2488 description: 'name of the repo',
2489 },
2490 knot: {
2491 type: 'string',
2492 description: 'knot where the repo was created',
2493 },
2494 spindle: {
2495 type: 'string',
2496 description: 'CI runner to send jobs to and receive results from',
2497 },
2498 description: {
2499 type: 'string',
2500 minGraphemes: 1,
2501 maxGraphemes: 140,
2502 },
2503 website: {
2504 type: 'string',
2505 format: 'uri',
2506 description: 'Any URI related to the repo',
2507 },
2508 topics: {
2509 type: 'array',
2510 description: 'Topics related to the repo',
2511 items: {
2512 type: 'string',
2513 minLength: 1,
2514 maxLength: 50,
2515 },
2516 maxLength: 50,
2517 },
2518 source: {
2519 type: 'string',
2520 format: 'uri',
2521 description: 'source of the repo',
2522 },
2523 labels: {
2524 type: 'array',
2525 description: 'List of labels that this repo subscribes to',
2526 items: {
2527 type: 'string',
2528 format: 'at-uri',
2529 },
2530 },
2531 createdAt: {
2532 type: 'string',
2533 format: 'datetime',
2534 },
2535 },
2536 },
2537 },
2538 },
2539 },
2540 ShTangledRepoTag: {
2541 lexicon: 1,
2542 id: 'sh.tangled.repo.tag',
2543 defs: {
2544 main: {
2545 type: 'query',
2546 parameters: {
2547 type: 'params',
2548 required: ['repo', 'tag'],
2549 properties: {
2550 repo: {
2551 type: 'string',
2552 description:
2553 "Repository identifier in format 'did:plc:.../repoName'",
2554 },
2555 tag: {
2556 type: 'string',
2557 description: 'Name of tag, such as v1.3.0',
2558 },
2559 },
2560 },
2561 output: {
2562 encoding: '*/*',
2563 },
2564 errors: [
2565 {
2566 name: 'RepoNotFound',
2567 description: 'Repository not found or access denied',
2568 },
2569 {
2570 name: 'TagNotFound',
2571 description: 'Tag not found',
2572 },
2573 {
2574 name: 'InvalidRequest',
2575 description: 'Invalid request parameters',
2576 },
2577 ],
2578 },
2579 },
2580 },
2581 ShTangledRepoTags: {
2582 lexicon: 1,
2583 id: 'sh.tangled.repo.tags',
2584 defs: {
2585 main: {
2586 type: 'query',
2587 parameters: {
2588 type: 'params',
2589 required: ['repo'],
2590 properties: {
2591 repo: {
2592 type: 'string',
2593 description:
2594 "Repository identifier in format 'did:plc:.../repoName'",
2595 },
2596 limit: {
2597 type: 'integer',
2598 description: 'Maximum number of tags to return',
2599 minimum: 1,
2600 maximum: 100,
2601 default: 50,
2602 },
2603 cursor: {
2604 type: 'string',
2605 description: 'Pagination cursor',
2606 },
2607 },
2608 },
2609 output: {
2610 encoding: '*/*',
2611 },
2612 errors: [
2613 {
2614 name: 'RepoNotFound',
2615 description: 'Repository not found or access denied',
2616 },
2617 {
2618 name: 'InvalidRequest',
2619 description: 'Invalid request parameters',
2620 },
2621 ],
2622 },
2623 },
2624 },
2625 ShTangledRepoTree: {
2626 lexicon: 1,
2627 id: 'sh.tangled.repo.tree',
2628 defs: {
2629 main: {
2630 type: 'query',
2631 parameters: {
2632 type: 'params',
2633 required: ['repo', 'ref'],
2634 properties: {
2635 repo: {
2636 type: 'string',
2637 description:
2638 "Repository identifier in format 'did:plc:.../repoName'",
2639 },
2640 ref: {
2641 type: 'string',
2642 description: 'Git reference (branch, tag, or commit SHA)',
2643 },
2644 path: {
2645 type: 'string',
2646 description: 'Path within the repository tree',
2647 default: '',
2648 },
2649 },
2650 },
2651 output: {
2652 encoding: 'application/json',
2653 schema: {
2654 type: 'object',
2655 required: ['ref', 'files'],
2656 properties: {
2657 ref: {
2658 type: 'string',
2659 description: 'The git reference used',
2660 },
2661 parent: {
2662 type: 'string',
2663 description: 'The parent path in the tree',
2664 },
2665 dotdot: {
2666 type: 'string',
2667 description: 'Parent directory path',
2668 },
2669 readme: {
2670 type: 'ref',
2671 ref: 'lex:sh.tangled.repo.tree#readme',
2672 description: 'Readme for this file tree',
2673 },
2674 lastCommit: {
2675 type: 'ref',
2676 ref: 'lex:sh.tangled.repo.tree#lastCommit',
2677 },
2678 files: {
2679 type: 'array',
2680 items: {
2681 type: 'ref',
2682 ref: 'lex:sh.tangled.repo.tree#treeEntry',
2683 },
2684 },
2685 },
2686 },
2687 },
2688 errors: [
2689 {
2690 name: 'RepoNotFound',
2691 description: 'Repository not found or access denied',
2692 },
2693 {
2694 name: 'RefNotFound',
2695 description: 'Git reference not found',
2696 },
2697 {
2698 name: 'PathNotFound',
2699 description: 'Path not found in repository tree',
2700 },
2701 {
2702 name: 'InvalidRequest',
2703 description: 'Invalid request parameters',
2704 },
2705 ],
2706 },
2707 readme: {
2708 type: 'object',
2709 required: ['filename', 'contents'],
2710 properties: {
2711 filename: {
2712 type: 'string',
2713 description: 'Name of the readme file',
2714 },
2715 contents: {
2716 type: 'string',
2717 description: 'Contents of the readme file',
2718 },
2719 },
2720 },
2721 treeEntry: {
2722 type: 'object',
2723 required: ['name', 'mode', 'size'],
2724 properties: {
2725 name: {
2726 type: 'string',
2727 description: 'Relative file or directory name',
2728 },
2729 mode: {
2730 type: 'string',
2731 description: 'File mode',
2732 },
2733 size: {
2734 type: 'integer',
2735 description: 'File size in bytes',
2736 },
2737 last_commit: {
2738 type: 'ref',
2739 ref: 'lex:sh.tangled.repo.tree#lastCommit',
2740 },
2741 },
2742 },
2743 lastCommit: {
2744 type: 'object',
2745 required: ['hash', 'message', 'when'],
2746 properties: {
2747 hash: {
2748 type: 'string',
2749 description: 'Commit hash',
2750 },
2751 message: {
2752 type: 'string',
2753 description: 'Commit message',
2754 },
2755 author: {
2756 type: 'ref',
2757 ref: 'lex:sh.tangled.repo.tree#signature',
2758 },
2759 when: {
2760 type: 'string',
2761 format: 'datetime',
2762 description: 'Commit timestamp',
2763 },
2764 },
2765 },
2766 signature: {
2767 type: 'object',
2768 required: ['name', 'email', 'when'],
2769 properties: {
2770 name: {
2771 type: 'string',
2772 description: 'Author name',
2773 },
2774 email: {
2775 type: 'string',
2776 description: 'Author email',
2777 },
2778 when: {
2779 type: 'string',
2780 format: 'datetime',
2781 description: 'Author timestamp',
2782 },
2783 },
2784 },
2785 },
2786 },
2787 ShTangledSpindleMember: {
2788 lexicon: 1,
2789 id: 'sh.tangled.spindle.member',
2790 needsCbor: true,
2791 needsType: true,
2792 defs: {
2793 main: {
2794 type: 'record',
2795 key: 'tid',
2796 record: {
2797 type: 'object',
2798 required: ['subject', 'instance', 'createdAt'],
2799 properties: {
2800 subject: {
2801 type: 'string',
2802 format: 'did',
2803 },
2804 instance: {
2805 type: 'string',
2806 description:
2807 'spindle instance that the subject is now a member of',
2808 },
2809 createdAt: {
2810 type: 'string',
2811 format: 'datetime',
2812 },
2813 },
2814 },
2815 },
2816 },
2817 },
2818 ShTangledSpindle: {
2819 lexicon: 1,
2820 id: 'sh.tangled.spindle',
2821 needsCbor: true,
2822 needsType: true,
2823 defs: {
2824 main: {
2825 type: 'record',
2826 key: 'any',
2827 record: {
2828 type: 'object',
2829 required: ['createdAt'],
2830 properties: {
2831 createdAt: {
2832 type: 'string',
2833 format: 'datetime',
2834 },
2835 },
2836 },
2837 },
2838 },
2839 },
2840 ShTangledString: {
2841 lexicon: 1,
2842 id: 'sh.tangled.string',
2843 needsCbor: true,
2844 needsType: true,
2845 defs: {
2846 main: {
2847 type: 'record',
2848 key: 'tid',
2849 record: {
2850 type: 'object',
2851 required: ['filename', 'description', 'createdAt', 'contents'],
2852 properties: {
2853 filename: {
2854 type: 'string',
2855 maxGraphemes: 140,
2856 minGraphemes: 1,
2857 },
2858 description: {
2859 type: 'string',
2860 maxGraphemes: 280,
2861 },
2862 createdAt: {
2863 type: 'string',
2864 format: 'datetime',
2865 },
2866 contents: {
2867 type: 'string',
2868 minGraphemes: 1,
2869 },
2870 },
2871 },
2872 },
2873 },
2874 },
2875} as const satisfies Record<string, LexiconDoc>
2876export const schemas = Object.values(schemaDict) satisfies LexiconDoc[]
2877export const lexicons: Lexicons = new Lexicons(schemas)
2878
2879export function validate<T extends { $type: string }>(
2880 v: unknown,
2881 id: string,
2882 hash: string,
2883 requiredType: true,
2884): ValidationResult<T>
2885export function validate<T extends { $type?: string }>(
2886 v: unknown,
2887 id: string,
2888 hash: string,
2889 requiredType?: false,
2890): ValidationResult<T>
2891export function validate(
2892 v: unknown,
2893 id: string,
2894 hash: string,
2895 requiredType?: boolean,
2896): ValidationResult {
2897 return (requiredType ? is$typed : maybe$typed)(v, id, hash)
2898 ? lexicons.validate(`${id}#${hash}`, v)
2899 : {
2900 success: false,
2901 error: new ValidationError(
2902 `Must be an object with "${hash === 'main' ? id : `${id}#${hash}`}" $type property`,
2903 ),
2904 }
2905}
2906
2907export const ids = {
2908 ShTangledActorProfile: 'sh.tangled.actor.profile',
2909 ShTangledFeedReaction: 'sh.tangled.feed.reaction',
2910 ShTangledFeedStar: 'sh.tangled.feed.star',
2911 ShTangledGitRefUpdate: 'sh.tangled.git.refUpdate',
2912 ShTangledGraphFollow: 'sh.tangled.graph.follow',
2913 ShTangledRepoIssueStateClosed: 'sh.tangled.repo.issue.state.closed',
2914 ShTangledRepoIssueComment: 'sh.tangled.repo.issue.comment',
2915 ShTangledRepoIssue: 'sh.tangled.repo.issue',
2916 ShTangledRepoIssueStateOpen: 'sh.tangled.repo.issue.state.open',
2917 ShTangledRepoIssueState: 'sh.tangled.repo.issue.state',
2918 ShTangledKnot: 'sh.tangled.knot',
2919 ShTangledKnotListKeys: 'sh.tangled.knot.listKeys',
2920 ShTangledKnotMember: 'sh.tangled.knot.member',
2921 ShTangledKnotVersion: 'sh.tangled.knot.version',
2922 ShTangledLabelDefinition: 'sh.tangled.label.definition',
2923 ShTangledLabelOp: 'sh.tangled.label.op',
2924 ShTangledPipelineCancelPipeline: 'sh.tangled.pipeline.cancelPipeline',
2925 ShTangledPipeline: 'sh.tangled.pipeline',
2926 ShTangledPipelineStatus: 'sh.tangled.pipeline.status',
2927 ShTangledRepoPullStatusClosed: 'sh.tangled.repo.pull.status.closed',
2928 ShTangledRepoPullComment: 'sh.tangled.repo.pull.comment',
2929 ShTangledRepoPullStatusMerged: 'sh.tangled.repo.pull.status.merged',
2930 ShTangledRepoPullStatusOpen: 'sh.tangled.repo.pull.status.open',
2931 ShTangledRepoPull: 'sh.tangled.repo.pull',
2932 ShTangledRepoPullStatus: 'sh.tangled.repo.pull.status',
2933 ShTangledRepoAddSecret: 'sh.tangled.repo.addSecret',
2934 ShTangledRepoArchive: 'sh.tangled.repo.archive',
2935 ShTangledRepoArtifact: 'sh.tangled.repo.artifact',
2936 ShTangledRepoBlob: 'sh.tangled.repo.blob',
2937 ShTangledRepoBranch: 'sh.tangled.repo.branch',
2938 ShTangledRepoBranches: 'sh.tangled.repo.branches',
2939 ShTangledRepoCollaborator: 'sh.tangled.repo.collaborator',
2940 ShTangledRepoCompare: 'sh.tangled.repo.compare',
2941 ShTangledRepoCreate: 'sh.tangled.repo.create',
2942 ShTangledRepoSetDefaultBranch: 'sh.tangled.repo.setDefaultBranch',
2943 ShTangledRepoDelete: 'sh.tangled.repo.delete',
2944 ShTangledRepoDeleteBranch: 'sh.tangled.repo.deleteBranch',
2945 ShTangledRepoDiff: 'sh.tangled.repo.diff',
2946 ShTangledRepoForkStatus: 'sh.tangled.repo.forkStatus',
2947 ShTangledRepoForkSync: 'sh.tangled.repo.forkSync',
2948 ShTangledRepoGetDefaultBranch: 'sh.tangled.repo.getDefaultBranch',
2949 ShTangledRepoHiddenRef: 'sh.tangled.repo.hiddenRef',
2950 ShTangledRepoLanguages: 'sh.tangled.repo.languages',
2951 ShTangledRepoListSecrets: 'sh.tangled.repo.listSecrets',
2952 ShTangledRepoLog: 'sh.tangled.repo.log',
2953 ShTangledRepoMerge: 'sh.tangled.repo.merge',
2954 ShTangledRepoMergeCheck: 'sh.tangled.repo.mergeCheck',
2955 ShTangledRepoRemoveSecret: 'sh.tangled.repo.removeSecret',
2956 ShTangledRepo: 'sh.tangled.repo',
2957 ShTangledRepoTag: 'sh.tangled.repo.tag',
2958 ShTangledRepoTags: 'sh.tangled.repo.tags',
2959 ShTangledRepoTree: 'sh.tangled.repo.tree',
2960 ShTangledSpindleMember: 'sh.tangled.spindle.member',
2961 ShTangledSpindle: 'sh.tangled.spindle',
2962 ShTangledString: 'sh.tangled.string',
2963} as const