1{
2 "lexicon": 1,
3 "id": "sh.tangled.repo.tree",
4 "defs": {
5 "main": {
6 "type": "query",
7 "parameters": {
8 "type": "params",
9 "required": ["repo", "ref"],
10 "properties": {
11 "repo": {
12 "type": "string",
13 "description": "Repository identifier in format 'did:plc:.../repoName'"
14 },
15 "ref": {
16 "type": "string",
17 "description": "Git reference (branch, tag, or commit SHA)"
18 },
19 "path": {
20 "type": "string",
21 "description": "Path within the repository tree",
22 "default": ""
23 }
24 }
25 },
26 "output": {
27 "encoding": "application/json",
28 "schema": {
29 "type": "object",
30 "required": ["ref", "files"],
31 "properties": {
32 "ref": {
33 "type": "string",
34 "description": "The git reference used"
35 },
36 "parent": {
37 "type": "string",
38 "description": "The parent path in the tree"
39 },
40 "dotdot": {
41 "type": "string",
42 "description": "Parent directory path"
43 },
44 "files": {
45 "type": "array",
46 "items": {
47 "type": "ref",
48 "ref": "#treeEntry"
49 }
50 }
51 }
52 }
53 },
54 "errors": [
55 {
56 "name": "RepoNotFound",
57 "description": "Repository not found or access denied"
58 },
59 {
60 "name": "RefNotFound",
61 "description": "Git reference not found"
62 },
63 {
64 "name": "PathNotFound",
65 "description": "Path not found in repository tree"
66 },
67 {
68 "name": "InvalidRequest",
69 "description": "Invalid request parameters"
70 }
71 ]
72 },
73 "treeEntry": {
74 "type": "object",
75 "required": ["name", "mode", "size", "is_file", "is_subtree"],
76 "properties": {
77 "name": {
78 "type": "string",
79 "description": "Relative file or directory name"
80 },
81 "mode": {
82 "type": "string",
83 "description": "File mode"
84 },
85 "size": {
86 "type": "integer",
87 "description": "File size in bytes"
88 },
89 "is_file": {
90 "type": "boolean",
91 "description": "Whether this entry is a file"
92 },
93 "is_subtree": {
94 "type": "boolean",
95 "description": "Whether this entry is a directory/subtree"
96 },
97 "last_commit": {
98 "type": "ref",
99 "ref": "#lastCommit"
100 }
101 }
102 },
103 "lastCommit": {
104 "type": "object",
105 "required": ["hash", "message", "when"],
106 "properties": {
107 "hash": {
108 "type": "string",
109 "description": "Commit hash"
110 },
111 "message": {
112 "type": "string",
113 "description": "Commit message"
114 },
115 "when": {
116 "type": "string",
117 "format": "datetime",
118 "description": "Commit timestamp"
119 }
120 }
121 }
122 }
123}