@trebired/git-host 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/LICENSE +21 -0
  3. package/README.md +451 -0
  4. package/dist/api/handler/action.d.ts +5 -0
  5. package/dist/api/handler/action.d.ts.map +1 -0
  6. package/dist/api/handler/action.js +47 -0
  7. package/dist/api/handler/action.js.map +1 -0
  8. package/dist/api/handler/response.d.ts +34 -0
  9. package/dist/api/handler/response.d.ts.map +1 -0
  10. package/dist/api/handler/response.js +87 -0
  11. package/dist/api/handler/response.js.map +1 -0
  12. package/dist/api/handler/route.d.ts +15 -0
  13. package/dist/api/handler/route.d.ts.map +1 -0
  14. package/dist/api/handler/route.js +51 -0
  15. package/dist/api/handler/route.js.map +1 -0
  16. package/dist/api/handler.d.ts +6 -0
  17. package/dist/api/handler.d.ts.map +1 -0
  18. package/dist/api/handler.js +117 -0
  19. package/dist/api/handler.js.map +1 -0
  20. package/dist/constants.d.ts +8 -0
  21. package/dist/constants.d.ts.map +1 -0
  22. package/dist/constants.js +16 -0
  23. package/dist/constants.js.map +1 -0
  24. package/dist/core/create_git_host/branch_methods.d.ts +5 -0
  25. package/dist/core/create_git_host/branch_methods.d.ts.map +1 -0
  26. package/dist/core/create_git_host/branch_methods.js +137 -0
  27. package/dist/core/create_git_host/branch_methods.js.map +1 -0
  28. package/dist/core/create_git_host/content_methods.d.ts +5 -0
  29. package/dist/core/create_git_host/content_methods.d.ts.map +1 -0
  30. package/dist/core/create_git_host/content_methods.js +24 -0
  31. package/dist/core/create_git_host/content_methods.js.map +1 -0
  32. package/dist/core/create_git_host/remote_methods.d.ts +5 -0
  33. package/dist/core/create_git_host/remote_methods.d.ts.map +1 -0
  34. package/dist/core/create_git_host/remote_methods.js +48 -0
  35. package/dist/core/create_git_host/remote_methods.js.map +1 -0
  36. package/dist/core/create_git_host/shared.d.ts +21 -0
  37. package/dist/core/create_git_host/shared.d.ts.map +1 -0
  38. package/dist/core/create_git_host/shared.js +17 -0
  39. package/dist/core/create_git_host/shared.js.map +1 -0
  40. package/dist/core/create_git_host/working_tree_methods.d.ts +5 -0
  41. package/dist/core/create_git_host/working_tree_methods.d.ts.map +1 -0
  42. package/dist/core/create_git_host/working_tree_methods.js +63 -0
  43. package/dist/core/create_git_host/working_tree_methods.js.map +1 -0
  44. package/dist/core/create_git_host.d.ts +4 -0
  45. package/dist/core/create_git_host.d.ts.map +1 -0
  46. package/dist/core/create_git_host.js +167 -0
  47. package/dist/core/create_git_host.js.map +1 -0
  48. package/dist/core/inspect/helpers.d.ts +27 -0
  49. package/dist/core/inspect/helpers.d.ts.map +1 -0
  50. package/dist/core/inspect/helpers.js +86 -0
  51. package/dist/core/inspect/helpers.js.map +1 -0
  52. package/dist/core/inspect.d.ts +17 -0
  53. package/dist/core/inspect.d.ts.map +1 -0
  54. package/dist/core/inspect.js +174 -0
  55. package/dist/core/inspect.js.map +1 -0
  56. package/dist/core/locks.d.ts +5 -0
  57. package/dist/core/locks.d.ts.map +1 -0
  58. package/dist/core/locks.js +27 -0
  59. package/dist/core/locks.js.map +1 -0
  60. package/dist/core/operation_state.d.ts +4 -0
  61. package/dist/core/operation_state.d.ts.map +1 -0
  62. package/dist/core/operation_state.js +51 -0
  63. package/dist/core/operation_state.js.map +1 -0
  64. package/dist/core/remote.d.ts +13 -0
  65. package/dist/core/remote.d.ts.map +1 -0
  66. package/dist/core/remote.js +187 -0
  67. package/dist/core/remote.js.map +1 -0
  68. package/dist/core/repository/parsers.d.ts +12 -0
  69. package/dist/core/repository/parsers.d.ts.map +1 -0
  70. package/dist/core/repository/parsers.js +181 -0
  71. package/dist/core/repository/parsers.js.map +1 -0
  72. package/dist/core/repository.d.ts +11 -0
  73. package/dist/core/repository.d.ts.map +1 -0
  74. package/dist/core/repository.js +81 -0
  75. package/dist/core/repository.js.map +1 -0
  76. package/dist/core/run_git/env.d.ts +7 -0
  77. package/dist/core/run_git/env.d.ts.map +1 -0
  78. package/dist/core/run_git/env.js +18 -0
  79. package/dist/core/run_git/env.js.map +1 -0
  80. package/dist/core/run_git/process.d.ts +13 -0
  81. package/dist/core/run_git/process.d.ts.map +1 -0
  82. package/dist/core/run_git/process.js +96 -0
  83. package/dist/core/run_git/process.js.map +1 -0
  84. package/dist/core/run_git/repository_setup.d.ts +20 -0
  85. package/dist/core/run_git/repository_setup.d.ts.map +1 -0
  86. package/dist/core/run_git/repository_setup.js +116 -0
  87. package/dist/core/run_git/repository_setup.js.map +1 -0
  88. package/dist/core/run_git.d.ts +6 -0
  89. package/dist/core/run_git.d.ts.map +1 -0
  90. package/dist/core/run_git.js +6 -0
  91. package/dist/core/run_git.js.map +1 -0
  92. package/dist/core/working_tree/mutate.d.ts +9 -0
  93. package/dist/core/working_tree/mutate.d.ts.map +1 -0
  94. package/dist/core/working_tree/mutate.js +159 -0
  95. package/dist/core/working_tree/mutate.js.map +1 -0
  96. package/dist/core/working_tree/read.d.ts +6 -0
  97. package/dist/core/working_tree/read.d.ts.map +1 -0
  98. package/dist/core/working_tree/read.js +108 -0
  99. package/dist/core/working_tree/read.js.map +1 -0
  100. package/dist/core/working_tree/shared.d.ts +20 -0
  101. package/dist/core/working_tree/shared.d.ts.map +1 -0
  102. package/dist/core/working_tree/shared.js +87 -0
  103. package/dist/core/working_tree/shared.js.map +1 -0
  104. package/dist/core/working_tree.d.ts +3 -0
  105. package/dist/core/working_tree.d.ts.map +1 -0
  106. package/dist/core/working_tree.js +3 -0
  107. package/dist/core/working_tree.js.map +1 -0
  108. package/dist/errors.d.ts +10 -0
  109. package/dist/errors.d.ts.map +1 -0
  110. package/dist/errors.js +13 -0
  111. package/dist/errors.js.map +1 -0
  112. package/dist/http/handler/helpers.d.ts +35 -0
  113. package/dist/http/handler/helpers.d.ts.map +1 -0
  114. package/dist/http/handler/helpers.js +146 -0
  115. package/dist/http/handler/helpers.js.map +1 -0
  116. package/dist/http/handler.d.ts +6 -0
  117. package/dist/http/handler.d.ts.map +1 -0
  118. package/dist/http/handler.js +208 -0
  119. package/dist/http/handler.js.map +1 -0
  120. package/dist/index.d.ts +18 -0
  121. package/dist/index.d.ts.map +1 -0
  122. package/dist/index.js +15 -0
  123. package/dist/index.js.map +1 -0
  124. package/dist/logging.d.ts +4 -0
  125. package/dist/logging.d.ts.map +1 -0
  126. package/dist/logging.js +134 -0
  127. package/dist/logging.js.map +1 -0
  128. package/dist/react/client/error.d.ts +14 -0
  129. package/dist/react/client/error.d.ts.map +1 -0
  130. package/dist/react/client/error.js +32 -0
  131. package/dist/react/client/error.js.map +1 -0
  132. package/dist/react/client/helpers.d.ts +12 -0
  133. package/dist/react/client/helpers.d.ts.map +1 -0
  134. package/dist/react/client/helpers.js +45 -0
  135. package/dist/react/client/helpers.js.map +1 -0
  136. package/dist/react/client/types.d.ts +61 -0
  137. package/dist/react/client/types.d.ts.map +1 -0
  138. package/dist/react/client/types.js +2 -0
  139. package/dist/react/client/types.js.map +1 -0
  140. package/dist/react/client.d.ts +6 -0
  141. package/dist/react/client.d.ts.map +1 -0
  142. package/dist/react/client.js +115 -0
  143. package/dist/react/client.js.map +1 -0
  144. package/dist/react/hooks/query.d.ts +10 -0
  145. package/dist/react/hooks/query.d.ts.map +1 -0
  146. package/dist/react/hooks/query.js +74 -0
  147. package/dist/react/hooks/query.js.map +1 -0
  148. package/dist/react/hooks/resources.d.ts +11 -0
  149. package/dist/react/hooks/resources.d.ts.map +1 -0
  150. package/dist/react/hooks/resources.js +113 -0
  151. package/dist/react/hooks/resources.js.map +1 -0
  152. package/dist/react/hooks/types.d.ts +40 -0
  153. package/dist/react/hooks/types.d.ts.map +1 -0
  154. package/dist/react/hooks/types.js +2 -0
  155. package/dist/react/hooks/types.js.map +1 -0
  156. package/dist/react/hooks.d.ts +4 -0
  157. package/dist/react/hooks.d.ts.map +1 -0
  158. package/dist/react/hooks.js +3 -0
  159. package/dist/react/hooks.js.map +1 -0
  160. package/dist/react/index.d.ts +5 -0
  161. package/dist/react/index.d.ts.map +1 -0
  162. package/dist/react/index.js +3 -0
  163. package/dist/react/index.js.map +1 -0
  164. package/dist/ssh/keys.d.ts +18 -0
  165. package/dist/ssh/keys.d.ts.map +1 -0
  166. package/dist/ssh/keys.js +41 -0
  167. package/dist/ssh/keys.js.map +1 -0
  168. package/dist/ssh/server/audit.d.ts +5 -0
  169. package/dist/ssh/server/audit.d.ts.map +1 -0
  170. package/dist/ssh/server/audit.js +21 -0
  171. package/dist/ssh/server/audit.js.map +1 -0
  172. package/dist/ssh/server/shared.d.ts +30 -0
  173. package/dist/ssh/server/shared.d.ts.map +1 -0
  174. package/dist/ssh/server/shared.js +93 -0
  175. package/dist/ssh/server/shared.js.map +1 -0
  176. package/dist/ssh/server.d.ts +5 -0
  177. package/dist/ssh/server.d.ts.map +1 -0
  178. package/dist/ssh/server.js +265 -0
  179. package/dist/ssh/server.js.map +1 -0
  180. package/dist/types/common.d.ts +32 -0
  181. package/dist/types/common.d.ts.map +1 -0
  182. package/dist/types/common.js +2 -0
  183. package/dist/types/common.js.map +1 -0
  184. package/dist/types/host.d.ts +142 -0
  185. package/dist/types/host.d.ts.map +1 -0
  186. package/dist/types/host.js +2 -0
  187. package/dist/types/host.js.map +1 -0
  188. package/dist/types/index.d.ts +5 -0
  189. package/dist/types/index.d.ts.map +1 -0
  190. package/dist/types/index.js +2 -0
  191. package/dist/types/index.js.map +1 -0
  192. package/dist/types/repository.d.ts +163 -0
  193. package/dist/types/repository.d.ts.map +1 -0
  194. package/dist/types/repository.js +2 -0
  195. package/dist/types/repository.js.map +1 -0
  196. package/dist/types/transports.d.ts +156 -0
  197. package/dist/types/transports.d.ts.map +1 -0
  198. package/dist/types/transports.js +2 -0
  199. package/dist/types/transports.js.map +1 -0
  200. package/dist/types.d.ts +2 -0
  201. package/dist/types.d.ts.map +1 -0
  202. package/dist/types.js +2 -0
  203. package/dist/types.js.map +1 -0
  204. package/dist/utils/paths.d.ts +10 -0
  205. package/dist/utils/paths.d.ts.map +1 -0
  206. package/dist/utils/paths.js +51 -0
  207. package/dist/utils/paths.js.map +1 -0
  208. package/dist/utils/text.d.ts +4 -0
  209. package/dist/utils/text.d.ts.map +1 -0
  210. package/dist/utils/text.js +10 -0
  211. package/dist/utils/text.js.map +1 -0
  212. package/package.json +81 -0
@@ -0,0 +1,163 @@
1
+ type GitCommandResult = {
2
+ code: number;
3
+ ok: boolean;
4
+ stderr: string;
5
+ stdout: string;
6
+ };
7
+ type GitCommandBufferResult = {
8
+ code: number;
9
+ ok: boolean;
10
+ stderr: string;
11
+ stdout: Buffer;
12
+ };
13
+ type GitOperationKind = "" | "cherry-pick" | "merge" | "rebase" | "revert";
14
+ type GitOperationState = {
15
+ can_abort: boolean;
16
+ can_continue: boolean;
17
+ in_progress: boolean;
18
+ kind: GitOperationKind;
19
+ label: string;
20
+ };
21
+ type GitStatusEntry = {
22
+ code: string;
23
+ conflicted: boolean;
24
+ original_path: string;
25
+ path: string;
26
+ staged: boolean;
27
+ untracked: boolean;
28
+ unstaged: boolean;
29
+ };
30
+ type GitWorkingTreeEntry = GitStatusEntry & {
31
+ staged_lines_added: number;
32
+ staged_lines_removed: number;
33
+ unstaged_lines_added: number;
34
+ unstaged_lines_removed: number;
35
+ };
36
+ type GitRepositoryStatus = {
37
+ ahead: number;
38
+ behind: number;
39
+ clean: boolean;
40
+ conflicted: number;
41
+ current_branch: string;
42
+ entries: GitStatusEntry[];
43
+ operation: GitOperationState;
44
+ staged: number;
45
+ untracked: number;
46
+ unstaged: number;
47
+ upstream: string;
48
+ };
49
+ type GitBranchSummary = {
50
+ current: boolean;
51
+ head_commit: string;
52
+ name: string;
53
+ upstream: string;
54
+ };
55
+ type GitRemoteSummary = {
56
+ fetch_url: string;
57
+ name: string;
58
+ push_url: string;
59
+ };
60
+ type GitCommitSummary = {
61
+ author_email: string;
62
+ author_name: string;
63
+ authored_at: string;
64
+ hash: string;
65
+ short_hash: string;
66
+ subject: string;
67
+ };
68
+ type GitDiffFile = {
69
+ change_kind: string;
70
+ lines_added: number;
71
+ lines_removed: number;
72
+ original_path: string;
73
+ path: string;
74
+ };
75
+ type GitCommitDetail = {
76
+ commit: GitCommitSummary & {
77
+ message: string;
78
+ parent_hashes: string[];
79
+ };
80
+ diff: string;
81
+ file_count: number;
82
+ files: GitDiffFile[];
83
+ lines_added: number;
84
+ lines_removed: number;
85
+ };
86
+ type GitCompareSummary = {
87
+ base_commit: string;
88
+ base_ref: string;
89
+ commit_count: number;
90
+ commits: GitCommitSummary[];
91
+ diff: string;
92
+ file_count: number;
93
+ files: GitDiffFile[];
94
+ has_changes: boolean;
95
+ head_commit: string;
96
+ head_ref: string;
97
+ lines_added: number;
98
+ lines_removed: number;
99
+ merge_base: string;
100
+ };
101
+ type GitTreeEntry = {
102
+ mode: string;
103
+ name: string;
104
+ object: string;
105
+ path: string;
106
+ size: number | null;
107
+ type: string;
108
+ };
109
+ type GitBlobEncoding = "base64" | "utf8";
110
+ type GitBlob = {
111
+ content: string;
112
+ encoding: GitBlobEncoding;
113
+ is_binary: boolean;
114
+ object: string;
115
+ path: string;
116
+ ref: string;
117
+ size: number;
118
+ };
119
+ type GitFileContentSource = "staged" | "unstaged";
120
+ type GitFileContent = {
121
+ content: string;
122
+ encoding: GitBlobEncoding;
123
+ is_binary: boolean;
124
+ object: string | null;
125
+ path: string;
126
+ size: number;
127
+ source: GitFileContentSource;
128
+ };
129
+ type GitWorkingTree = {
130
+ conflicted_entries: GitWorkingTreeEntry[];
131
+ entries: GitWorkingTreeEntry[];
132
+ staged_diff: string;
133
+ staged_entries: GitWorkingTreeEntry[];
134
+ staged_lines_added: number;
135
+ staged_lines_removed: number;
136
+ status: GitRepositoryStatus;
137
+ unstaged_diff: string;
138
+ unstaged_entries: GitWorkingTreeEntry[];
139
+ unstaged_lines_added: number;
140
+ unstaged_lines_removed: number;
141
+ untracked_entries: GitWorkingTreeEntry[];
142
+ };
143
+ type GitRepositoryHandle = {
144
+ id: string;
145
+ path: string;
146
+ };
147
+ type GitRepositorySummary = {
148
+ branches: GitBranchSummary[];
149
+ commits: GitCommitSummary[];
150
+ remotes: GitRemoteSummary[];
151
+ repository: {
152
+ current_branch: string;
153
+ default_branch: string;
154
+ head_commit: string;
155
+ head_short: string;
156
+ id: string;
157
+ path: string;
158
+ remote_origin_url: string;
159
+ };
160
+ status: GitRepositoryStatus;
161
+ };
162
+ export type { GitBlob, GitBlobEncoding, GitBranchSummary, GitCommandBufferResult, GitCommandResult, GitCommitDetail, GitCommitSummary, GitCompareSummary, GitDiffFile, GitFileContent, GitFileContentSource, GitOperationKind, GitOperationState, GitRemoteSummary, GitRepositoryHandle, GitRepositoryStatus, GitRepositorySummary, GitStatusEntry, GitTreeEntry, GitWorkingTree, GitWorkingTreeEntry, };
163
+ //# sourceMappingURL=repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/types/repository.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,gBAAgB,GAAG,EAAE,GAAG,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3E,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,MAAM,C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AC;IAC5B,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,UAAU,EAAE;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,MAAM,EAAE,mBAAmB,CAAC;CAC7B,CAAC;AAEF,YAAY,EACV,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,cAAc,EACd,mBAAmB,GACpB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/types/repository.ts"],"names":[],"mappings":""}
@@ -0,0 +1,156 @@
1
+ import type { IncomingMessage } from "node:http";
2
+ import type { GitHostLogger, MaybePromise } from "./common.js";
3
+ import type { GitHost } from "./host.js";
4
+ import type { GitRepositoryHandle } from "./repository.js";
5
+ type GitApiResource = "blob" | "branches" | "commit" | "commits" | "diff" | "summary" | "tree";
6
+ type GitApiAuthorizationResult = boolean | {
7
+ allowed: boolean;
8
+ headers?: Record<string, string>;
9
+ message?: string;
10
+ status?: number;
11
+ };
12
+ type CreateGitApiHandlerOptions = {
13
+ authorize?: (input: {
14
+ action: GitApiResource;
15
+ commitRef?: string;
16
+ method: string;
17
+ pathname: string;
18
+ remoteAddress: string;
19
+ repositoryId: string;
20
+ repositoryKey: string;
21
+ request: IncomingMessage;
22
+ searchParams: URLSearchParams;
23
+ }) => MaybePromise<GitApiAuthorizationResult>;
24
+ basePath?: string;
25
+ gitHost: GitHost;
26
+ logger?: GitHostLogger;
27
+ resolveRepositoryId?: (repositoryKey: string, request: IncomingMessage) => MaybePromise<string | null>;
28
+ verbose?: boolean;
29
+ };
30
+ type GitHttpService = "git-receive-pack" | "git-upload-pack";
31
+ type GitHttpAuthenticationResult = null | {
32
+ identity?: unknown;
33
+ remoteUser?: string;
34
+ };
35
+ type GitHttpAuthorizationResult = boolean | {
36
+ allowed: boolean;
37
+ headers?: Record<string, string>;
38
+ message?: string;
39
+ remoteUser?: string;
40
+ status?: number;
41
+ };
42
+ type GitHttpAuditOutcome = "completed" | "denied" | "failed" | "not_found";
43
+ type GitHttpAuditEvent = {
44
+ identity?: unknown;
45
+ message?: string;
46
+ method: string;
47
+ outcome: GitHttpAuditOutcome;
48
+ pathname: string;
49
+ remoteAddress: string;
50
+ remoteUser: string;
51
+ repository?: GitRepositoryHandle;
52
+ repositoryKey?: string;
53
+ service?: GitHttpService;
54
+ status: number;
55
+ wantsWrite: boolean;
56
+ };
57
+ type GitHttpResolvedRepository = {
58
+ exportName?: string;
59
+ repository: GitRepositoryHandle;
60
+ repositoryKey?: string;
61
+ };
62
+ type CreateGitHttpHandlerOptions = {
63
+ authenticate?: (input: {
64
+ method: string;
65
+ pathname: string;
66
+ remoteAddress: string;
67
+ repository: GitRepositoryHandle;
68
+ repositoryKey: string;
69
+ request: IncomingMessage;
70
+ searchParams: URLSearchParams;
71
+ service: GitHttpService;
72
+ wantsWrite: boolean;
73
+ }) => MaybePromise<GitHttpAuthenticationResult>;
74
+ authorize?: (input: {
75
+ identity?: unknown;
76
+ method: string;
77
+ pathname: string;
78
+ remoteAddress: string;
79
+ remoteUser: string;
80
+ repository: GitRepositoryHandle;
81
+ repositoryKey: string;
82
+ request: IncomingMessage;
83
+ searchParams: URLSearchParams;
84
+ service: GitHttpService;
85
+ wantsWrite: boolean;
86
+ }) => MaybePromise<GitHttpAuthorizationResult>;
87
+ basePath?: string;
88
+ logger?: GitHostLogger;
89
+ onAuditEvent?: (event: GitHttpAuditEvent) => MaybePromise<void>;
90
+ resolveRepository: (repositoryKey: string, request: IncomingMessage) => MaybePromise<GitHttpResolvedRepository | GitRepositoryHandle | null>;
91
+ verbose?: boolean;
92
+ };
93
+ type GitSshService = "git-receive-pack" | "git-upload-pack";
94
+ type GitSshAuthenticationResult = null | {
95
+ identity?: unknown;
96
+ publicKey: string;
97
+ remoteUser?: string;
98
+ };
99
+ type GitSshAuthorizationResult = boolean | {
100
+ allowed: boolean;
101
+ message?: string;
102
+ remoteUser?: string;
103
+ };
104
+ type GitSshResolvedRepository = {
105
+ repository: GitRepositoryHandle;
106
+ repositoryKey?: string;
107
+ };
108
+ type GitSshAuditOutcome = "auth_rejected" | "command_rejected" | "completed" | "denied" | "failed" | "repository_not_found";
109
+ type GitSshAuditEvent = {
110
+ command?: string;
111
+ exitCode?: number;
112
+ identity?: unknown;
113
+ message?: string;
114
+ outcome: GitSshAuditOutcome;
115
+ remoteAddress: string;
116
+ remoteUser?: string;
117
+ repository?: GitRepositoryHandle;
118
+ repositoryKey?: string;
119
+ service?: GitSshService;
120
+ username?: string;
121
+ wantsWrite?: boolean;
122
+ };
123
+ type CreateGitSshServerOptions = {
124
+ authenticate: (input: {
125
+ keyType: string;
126
+ publicKey: string;
127
+ publicKeyData: Buffer;
128
+ remoteAddress: string;
129
+ username: string;
130
+ }) => MaybePromise<GitSshAuthenticationResult>;
131
+ authorize?: (input: {
132
+ command: string;
133
+ identity?: unknown;
134
+ remoteAddress: string;
135
+ remoteUser: string;
136
+ repository: GitRepositoryHandle;
137
+ repositoryKey: string;
138
+ service: GitSshService;
139
+ username: string;
140
+ wantsWrite: boolean;
141
+ }) => MaybePromise<GitSshAuthorizationResult>;
142
+ basePath?: string;
143
+ hostKeys: string[];
144
+ logger?: GitHostLogger;
145
+ resolveRepository: (repositoryKey: string, input: {
146
+ command: string;
147
+ remoteAddress: string;
148
+ service: GitSshService;
149
+ username: string;
150
+ wantsWrite: boolean;
151
+ }) => MaybePromise<GitSshResolvedRepository | GitRepositoryHandle | null>;
152
+ onAuditEvent?: (event: GitSshAuditEvent) => MaybePromise<void>;
153
+ verbose?: boolean;
154
+ };
155
+ export type { CreateGitApiHandlerOptions, CreateGitHttpHandlerOptions, CreateGitSshServerOptions, GitApiAuthorizationResult, GitApiResource, GitHttpAuthenticationResult, GitHttpAuditEvent, GitHttpAuditOutcome, GitHttpAuthorizationResult, GitHttpResolvedRepository, GitHttpService, GitSshAuthenticationResult, GitSshAuditEvent, GitSshAuditOutcome, GitSshAuthorizationResult, GitSshResolvedRepository, GitSshService, };
156
+ //# sourceMappingURL=transports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transports.d.ts","sourceRoot":"","sources":["../../src/types/transports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,KAAK,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAE/F,KAAK,yBAAyB,GAAG,OAAO,GAAG;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE;QAClB,MAAM,EAAE,cAAc,CAAC;QACvB,SAAS,CAAC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,YAAY,CAAC,IAAI,CAAC,CAAC;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,YAAY,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,yBAAyB,EACzB,yBAAyB,EACzB,cAAc,EACd,2BAA2B,EAC3B,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,yBAAyB,EACzB,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,wBAAwB,EACxB,aAAa,GACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=transports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transports.js","sourceRoot":"","sources":["../../src/types/transports.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export type * from "./types/index.js";
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,mBAAmB,kBAAkB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ declare function assertAbsoluteRepositoryPath(value: unknown): string;
2
+ declare function resolveRepositoryPath(options: {
3
+ repositoryPath: string;
4
+ rootDir: string;
5
+ }): string;
6
+ declare function normalizeRepositoryRelativePath(value: unknown, options?: {
7
+ allowEmpty?: boolean;
8
+ }): string;
9
+ export { assertAbsoluteRepositoryPath, normalizeRepositoryRelativePath, resolveRepositoryPath };
10
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAKA,iBAAS,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAS5D;AAED,iBAAS,qBAAqB,CAAC,OAAO,EAAE;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAmB3F;AAED,iBAAS,+BAA+B,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,CAoBvG;AAED,OAAO,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,51 @@
1
+ import path from "node:path";
2
+ import { GitHostError } from "../errors.js";
3
+ import { text } from "./text.js";
4
+ function assertAbsoluteRepositoryPath(value) {
5
+ const repositoryPath = text(value);
6
+ if (!repositoryPath || !path.isAbsolute(repositoryPath)) {
7
+ throw new GitHostError("invalid_repository_path", "Repository paths must be absolute.", {
8
+ path: repositoryPath,
9
+ });
10
+ }
11
+ return path.resolve(repositoryPath);
12
+ }
13
+ function resolveRepositoryPath(options) {
14
+ const rootDir = path.resolve(text(options.rootDir));
15
+ const rawRepositoryPath = normalizeRepositoryRelativePath(options.repositoryPath);
16
+ if (!rawRepositoryPath) {
17
+ throw new GitHostError("invalid_repository_path", "Repository path fragments must not be empty.");
18
+ }
19
+ const parts = rawRepositoryPath.split("/").filter(Boolean);
20
+ const resolved = path.resolve(rootDir, ...parts);
21
+ const relative = path.relative(rootDir, resolved);
22
+ if (relative.startsWith("..") || path.isAbsolute(relative)) {
23
+ throw new GitHostError("invalid_repository_path", "Repository path escaped the configured root.", {
24
+ path: rawRepositoryPath,
25
+ rootDir,
26
+ });
27
+ }
28
+ return resolved;
29
+ }
30
+ function normalizeRepositoryRelativePath(value, options = {}) {
31
+ const rawRepositoryPath = text(value).replace(/\\/g, "/");
32
+ if (!rawRepositoryPath) {
33
+ if (options.allowEmpty === true)
34
+ return "";
35
+ throw new GitHostError("invalid_repository_path", "Repository path fragments must not be empty.");
36
+ }
37
+ if (path.posix.isAbsolute(rawRepositoryPath) || path.win32.isAbsolute(rawRepositoryPath)) {
38
+ throw new GitHostError("invalid_repository_path", "Repository path fragments must be relative.", {
39
+ path: rawRepositoryPath,
40
+ });
41
+ }
42
+ const parts = rawRepositoryPath.split("/").filter(Boolean);
43
+ if (!parts.length || parts.some((part) => part === "." || part === "..")) {
44
+ throw new GitHostError("invalid_repository_path", "Repository path fragments must not contain traversal segments.", {
45
+ path: rawRepositoryPath,
46
+ });
47
+ }
48
+ return parts.join("/");
49
+ }
50
+ export { assertAbsoluteRepositoryPath, normalizeRepositoryRelativePath, resolveRepositoryPath };
51
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,SAAS,4BAA4B,CAAC,KAAc;IAClD,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,CAAC,cAAc,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,YAAY,CAAC,yBAAyB,EAAE,oCAAoC,EAAE;YACtF,IAAI,EAAE,cAAc;SACrB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,qBAAqB,CAAC,OAAoD;IACjF,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACpD,MAAM,iBAAiB,GAAG,+BAA+B,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAElF,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MA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AAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3D,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QACzE,MAAM,IAAI,YAAY,CAAC,yBAAyB,EAAE,gEAAgE,EAAE;YAClH,IAAI,EAAE,iBAAiB;SACxB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,OAAO,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ declare function text(value: unknown, fallback?: string): string;
2
+ declare function isTruthy(value: unknown): boolean;
3
+ export { isTruthy, text };
4
+ //# sourceMappingURL=text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/utils/text.ts"],"names":[],"mappings":"AAAA,iBAAS,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAK,GAAG,MAAM,CAGnD;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAGzC;AAED,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ function text(value, fallback = "") {
2
+ const next = String(value == null ? "" : value).trim();
3
+ return next || fallback;
4
+ }
5
+ function isTruthy(value) {
6
+ const next = text(value).toLowerCase();
7
+ return value === true || next === "1" || next === "true" || next === "on" || next === "yes";
8
+ }
9
+ export { isTruthy, text };
10
+ //# sourceMappingURL=text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/utils/text.ts"],"names":[],"mappings":"AAAA,SAAS,IAAI,CAAC,KAAc,EAAE,QAAQ,GAAG,EAAE;IACzC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IACvD,OAAO,IAAI,IAAI,QAAQ,CAAC;AAC1B,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IACvC,OAAO,KAAK,KAAK,IAAI,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,CAAC;AAC9F,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@trebired/git-host",
3
+ "version": "0.1.0",
4
+ "description": "Embeddable Git host for Node.js and Bun apps, built on the real Git CLI with HTTP, SSH, and worktree APIs.",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "git",
8
+ "git-host",
9
+ "hosting",
10
+ "backend",
11
+ "node",
12
+ "bun"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/trebired/git-host.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/trebired/git-host/issues"
20
+ },
21
+ "homepage": "https://github.com/trebired/git-host#readme",
22
+ "type": "module",
23
+ "engines": {
24
+ "node": ">=18",
25
+ "bun": ">=1.0.0"
26
+ },
27
+ "private": false,
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "packageManager": "bun@1.3.12",
32
+ "main": "./dist/index.js",
33
+ "types": "./dist/index.d.ts",
34
+ "exports": {
35
+ ".": {
36
+ "types": "./dist/index.d.ts",
37
+ "import": "./dist/index.js"
38
+ },
39
+ "./react": {
40
+ "types": "./dist/react/index.d.ts",
41
+ "import": "./dist/react/index.js"
42
+ }
43
+ },
44
+ "files": [
45
+ "dist",
46
+ "CHANGELOG.md",
47
+ "LICENSE",
48
+ "README.md"
49
+ ],
50
+ "scripts": {
51
+ "build": "rm -rf dist && tsc -p tsconfig.build.json",
52
+ "demo": "bun run examples/dummy.ts",
53
+ "demo:api": "bun run examples/api_server.ts",
54
+ "demo:http": "bun run examples/http_server.ts",
55
+ "demo:ssh": "bun run examples/ssh_server.ts",
56
+ "prepublishOnly": "bun run typecheck && bun test && bun run build",
57
+ "test": "bun test",
58
+ "typecheck": "tsc --noEmit"
59
+ },
60
+ "dependencies": {
61
+ "ssh2": "^1.17.0"
62
+ },
63
+ "peerDependencies": {
64
+ "react": ">=18"
65
+ },
66
+ "peerDependenciesMeta": {
67
+ "react": {
68
+ "optional": true
69
+ }
70
+ },
71
+ "devDependencies": {
72
+ "@types/bun": "^1.3.4",
73
+ "@types/node": "^24.10.1",
74
+ "@types/react": "^19.2.2",
75
+ "@types/react-test-renderer": "^19.1.0",
76
+ "@types/ssh2": "^1.15.5",
77
+ "react": "^19.2.0",
78
+ "react-test-renderer": "^19.2.0",
79
+ "typescript": "^6.0.2"
80
+ }
81
+ }