@daytonaio/sdk 0.127.0 → 0.128.0-alpha.1

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 (277) hide show
  1. package/LICENSE +190 -0
  2. package/{src → cjs}/CodeInterpreter.d.ts +1 -0
  3. package/cjs/CodeInterpreter.d.ts.map +1 -0
  4. package/cjs/CodeInterpreter.js.map +1 -0
  5. package/{src → cjs}/ComputerUse.d.ts +1 -0
  6. package/cjs/ComputerUse.d.ts.map +1 -0
  7. package/cjs/ComputerUse.js.map +1 -0
  8. package/{src → cjs}/Daytona.d.ts +1 -0
  9. package/cjs/Daytona.d.ts.map +1 -0
  10. package/{src → cjs}/Daytona.js +1 -0
  11. package/cjs/Daytona.js.map +1 -0
  12. package/{src → cjs}/FileSystem.d.ts +1 -0
  13. package/cjs/FileSystem.d.ts.map +1 -0
  14. package/cjs/FileSystem.js.map +1 -0
  15. package/{src → cjs}/Git.d.ts +1 -0
  16. package/cjs/Git.d.ts.map +1 -0
  17. package/cjs/Git.js.map +1 -0
  18. package/{src → cjs}/Image.d.ts +21 -0
  19. package/cjs/Image.d.ts.map +1 -0
  20. package/{src → cjs}/Image.js +123 -91
  21. package/cjs/Image.js.map +1 -0
  22. package/{src → cjs}/LspServer.d.ts +1 -0
  23. package/cjs/LspServer.d.ts.map +1 -0
  24. package/cjs/LspServer.js.map +1 -0
  25. package/{src → cjs}/ObjectStorage.d.ts +1 -0
  26. package/cjs/ObjectStorage.d.ts.map +1 -0
  27. package/cjs/ObjectStorage.js.map +1 -0
  28. package/{src → cjs}/Process.d.ts +1 -0
  29. package/cjs/Process.d.ts.map +1 -0
  30. package/cjs/Process.js.map +1 -0
  31. package/{src → cjs}/PtyHandle.d.ts +1 -0
  32. package/cjs/PtyHandle.d.ts.map +1 -0
  33. package/cjs/PtyHandle.js.map +1 -0
  34. package/cjs/README.md +147 -0
  35. package/{src → cjs}/Sandbox.d.ts +2 -17
  36. package/cjs/Sandbox.d.ts.map +1 -0
  37. package/{src → cjs}/Sandbox.js +1 -27
  38. package/cjs/Sandbox.js.map +1 -0
  39. package/{src → cjs}/Snapshot.d.ts +2 -0
  40. package/cjs/Snapshot.d.ts.map +1 -0
  41. package/{src → cjs}/Snapshot.js +9 -1
  42. package/cjs/Snapshot.js.map +1 -0
  43. package/{src → cjs}/Volume.d.ts +1 -0
  44. package/cjs/Volume.d.ts.map +1 -0
  45. package/cjs/Volume.js.map +1 -0
  46. package/{src → cjs}/code-toolbox/SandboxJsCodeToolbox.d.ts +1 -0
  47. package/cjs/code-toolbox/SandboxJsCodeToolbox.d.ts.map +1 -0
  48. package/cjs/code-toolbox/SandboxJsCodeToolbox.js.map +1 -0
  49. package/{src → cjs}/code-toolbox/SandboxPythonCodeToolbox.d.ts +1 -0
  50. package/cjs/code-toolbox/SandboxPythonCodeToolbox.d.ts.map +1 -0
  51. package/cjs/code-toolbox/SandboxPythonCodeToolbox.js.map +1 -0
  52. package/{src → cjs}/code-toolbox/SandboxTsCodeToolbox.d.ts +1 -0
  53. package/cjs/code-toolbox/SandboxTsCodeToolbox.d.ts.map +1 -0
  54. package/cjs/code-toolbox/SandboxTsCodeToolbox.js.map +1 -0
  55. package/{src → cjs}/errors/DaytonaError.d.ts +1 -0
  56. package/cjs/errors/DaytonaError.d.ts.map +1 -0
  57. package/cjs/errors/DaytonaError.js.map +1 -0
  58. package/{src → cjs}/index.d.ts +1 -0
  59. package/cjs/index.d.ts.map +1 -0
  60. package/cjs/index.js.map +1 -0
  61. package/cjs/package.json +3 -0
  62. package/{src → cjs}/types/Charts.d.ts +1 -0
  63. package/cjs/types/Charts.d.ts.map +1 -0
  64. package/cjs/types/Charts.js.map +1 -0
  65. package/{src → cjs}/types/CodeInterpreter.d.ts +1 -0
  66. package/cjs/types/CodeInterpreter.d.ts.map +1 -0
  67. package/cjs/types/CodeInterpreter.js.map +1 -0
  68. package/{src → cjs}/types/ExecuteResponse.d.ts +1 -0
  69. package/cjs/types/ExecuteResponse.d.ts.map +1 -0
  70. package/cjs/types/ExecuteResponse.js.map +1 -0
  71. package/{src → cjs}/types/Pty.d.ts +1 -0
  72. package/cjs/types/Pty.d.ts.map +1 -0
  73. package/cjs/types/Pty.js.map +1 -0
  74. package/{src → cjs}/utils/ArtifactParser.d.ts +1 -0
  75. package/cjs/utils/ArtifactParser.d.ts.map +1 -0
  76. package/cjs/utils/ArtifactParser.js.map +1 -0
  77. package/{src → cjs}/utils/Binary.d.ts +1 -0
  78. package/cjs/utils/Binary.d.ts.map +1 -0
  79. package/cjs/utils/Binary.js.map +1 -0
  80. package/{src → cjs}/utils/FileTransfer.d.ts +1 -0
  81. package/cjs/utils/FileTransfer.d.ts.map +1 -0
  82. package/cjs/utils/FileTransfer.js.map +1 -0
  83. package/{src → cjs}/utils/Import.d.ts +2 -15
  84. package/cjs/utils/Import.d.ts.map +1 -0
  85. package/cjs/utils/Import.js +81 -0
  86. package/cjs/utils/Import.js.map +1 -0
  87. package/{src → cjs}/utils/Multipart.d.ts +1 -0
  88. package/cjs/utils/Multipart.d.ts.map +1 -0
  89. package/cjs/utils/Multipart.js.map +1 -0
  90. package/{src → cjs}/utils/Runtime.d.ts +1 -0
  91. package/cjs/utils/Runtime.d.ts.map +1 -0
  92. package/cjs/utils/Runtime.js.map +1 -0
  93. package/{src → cjs}/utils/Stream.d.ts +1 -0
  94. package/cjs/utils/Stream.d.ts.map +1 -0
  95. package/cjs/utils/Stream.js.map +1 -0
  96. package/{src → cjs}/utils/WebSocket.d.ts +1 -0
  97. package/cjs/utils/WebSocket.d.ts.map +1 -0
  98. package/cjs/utils/WebSocket.js.map +1 -0
  99. package/esm/CodeInterpreter.d.ts +96 -0
  100. package/esm/CodeInterpreter.d.ts.map +1 -0
  101. package/esm/CodeInterpreter.js +295 -0
  102. package/esm/CodeInterpreter.js.map +1 -0
  103. package/esm/ComputerUse.d.ts +443 -0
  104. package/esm/ComputerUse.d.ts.map +1 -0
  105. package/esm/ComputerUse.js +509 -0
  106. package/esm/ComputerUse.js.map +1 -0
  107. package/esm/Daytona.d.ts +354 -0
  108. package/esm/Daytona.d.ts.map +1 -0
  109. package/esm/Daytona.js +410 -0
  110. package/esm/Daytona.js.map +1 -0
  111. package/esm/FileSystem.d.ts +328 -0
  112. package/esm/FileSystem.d.ts.map +1 -0
  113. package/esm/FileSystem.js +331 -0
  114. package/esm/FileSystem.js.map +1 -0
  115. package/esm/Git.d.ts +203 -0
  116. package/esm/Git.d.ts.map +1 -0
  117. package/esm/Git.js +260 -0
  118. package/esm/Git.js.map +1 -0
  119. package/esm/Image.d.ts +285 -0
  120. package/esm/Image.d.ts.map +1 -0
  121. package/esm/Image.js +569 -0
  122. package/esm/Image.js.map +1 -0
  123. package/esm/LspServer.d.ts +172 -0
  124. package/esm/LspServer.d.ts.map +1 -0
  125. package/esm/LspServer.js +204 -0
  126. package/esm/LspServer.js.map +1 -0
  127. package/esm/ObjectStorage.d.ts +79 -0
  128. package/esm/ObjectStorage.d.ts.map +1 -0
  129. package/esm/ObjectStorage.js +187 -0
  130. package/esm/ObjectStorage.js.map +1 -0
  131. package/esm/Process.d.ts +442 -0
  132. package/esm/Process.d.ts.map +1 -0
  133. package/esm/Process.js +644 -0
  134. package/esm/Process.js.map +1 -0
  135. package/esm/PtyHandle.d.ts +155 -0
  136. package/esm/PtyHandle.d.ts.map +1 -0
  137. package/esm/PtyHandle.js +374 -0
  138. package/esm/PtyHandle.js.map +1 -0
  139. package/esm/README.md +147 -0
  140. package/esm/Sandbox.d.ts +359 -0
  141. package/esm/Sandbox.d.ts.map +1 -0
  142. package/esm/Sandbox.js +532 -0
  143. package/esm/Sandbox.js.map +1 -0
  144. package/esm/Snapshot.d.ts +138 -0
  145. package/esm/Snapshot.d.ts.map +1 -0
  146. package/esm/Snapshot.js +207 -0
  147. package/esm/Snapshot.js.map +1 -0
  148. package/esm/Volume.d.ts +84 -0
  149. package/esm/Volume.d.ts.map +1 -0
  150. package/esm/Volume.js +95 -0
  151. package/esm/Volume.js.map +1 -0
  152. package/esm/code-toolbox/SandboxJsCodeToolbox.d.ts +6 -0
  153. package/esm/code-toolbox/SandboxJsCodeToolbox.d.ts.map +1 -0
  154. package/esm/code-toolbox/SandboxJsCodeToolbox.js +13 -0
  155. package/esm/code-toolbox/SandboxJsCodeToolbox.js.map +1 -0
  156. package/esm/code-toolbox/SandboxPythonCodeToolbox.d.ts +12 -0
  157. package/esm/code-toolbox/SandboxPythonCodeToolbox.d.ts.map +1 -0
  158. package/esm/code-toolbox/SandboxPythonCodeToolbox.js +355 -0
  159. package/esm/code-toolbox/SandboxPythonCodeToolbox.js.map +1 -0
  160. package/esm/code-toolbox/SandboxTsCodeToolbox.d.ts +6 -0
  161. package/esm/code-toolbox/SandboxTsCodeToolbox.d.ts.map +1 -0
  162. package/esm/code-toolbox/SandboxTsCodeToolbox.js +14 -0
  163. package/esm/code-toolbox/SandboxTsCodeToolbox.js.map +1 -0
  164. package/esm/errors/DaytonaError.d.ts +32 -0
  165. package/esm/errors/DaytonaError.d.ts.map +1 -0
  166. package/esm/errors/DaytonaError.js +44 -0
  167. package/esm/errors/DaytonaError.js.map +1 -0
  168. package/esm/index.d.ts +22 -0
  169. package/esm/index.d.ts.map +1 -0
  170. package/esm/index.js +22 -0
  171. package/esm/index.js.map +1 -0
  172. package/esm/package.json +3 -0
  173. package/esm/types/Charts.d.ts +152 -0
  174. package/esm/types/Charts.d.ts.map +1 -0
  175. package/esm/types/Charts.js +42 -0
  176. package/esm/types/Charts.js.map +1 -0
  177. package/esm/types/CodeInterpreter.d.ts +77 -0
  178. package/esm/types/CodeInterpreter.d.ts.map +1 -0
  179. package/esm/types/CodeInterpreter.js +6 -0
  180. package/esm/types/CodeInterpreter.js.map +1 -0
  181. package/esm/types/ExecuteResponse.d.ts +26 -0
  182. package/esm/types/ExecuteResponse.d.ts.map +1 -0
  183. package/esm/types/ExecuteResponse.js +6 -0
  184. package/esm/types/ExecuteResponse.js.map +1 -0
  185. package/esm/types/Pty.d.ts +48 -0
  186. package/esm/types/Pty.d.ts.map +1 -0
  187. package/esm/types/Pty.js +6 -0
  188. package/esm/types/Pty.js.map +1 -0
  189. package/esm/utils/ArtifactParser.d.ts +14 -0
  190. package/esm/utils/ArtifactParser.d.ts.map +1 -0
  191. package/esm/utils/ArtifactParser.js +51 -0
  192. package/esm/utils/ArtifactParser.js.map +1 -0
  193. package/esm/utils/Binary.d.ts +39 -0
  194. package/esm/utils/Binary.d.ts.map +1 -0
  195. package/esm/utils/Binary.js +157 -0
  196. package/esm/utils/Binary.js.map +1 -0
  197. package/esm/utils/FileTransfer.d.ts +15 -0
  198. package/esm/utils/FileTransfer.d.ts.map +1 -0
  199. package/esm/utils/FileTransfer.js +209 -0
  200. package/esm/utils/FileTransfer.js.map +1 -0
  201. package/esm/utils/Import.d.ts +211 -0
  202. package/esm/utils/Import.d.ts.map +1 -0
  203. package/esm/utils/Import.js +45 -0
  204. package/esm/utils/Import.js.map +1 -0
  205. package/esm/utils/Multipart.d.ts +27 -0
  206. package/esm/utils/Multipart.d.ts.map +1 -0
  207. package/esm/utils/Multipart.js +107 -0
  208. package/esm/utils/Multipart.js.map +1 -0
  209. package/esm/utils/Runtime.d.ts +37 -0
  210. package/esm/utils/Runtime.d.ts.map +1 -0
  211. package/esm/utils/Runtime.js +57 -0
  212. package/esm/utils/Runtime.js.map +1 -0
  213. package/esm/utils/Stream.d.ts +20 -0
  214. package/esm/utils/Stream.d.ts.map +1 -0
  215. package/esm/utils/Stream.js +360 -0
  216. package/esm/utils/Stream.js.map +1 -0
  217. package/esm/utils/WebSocket.d.ts +10 -0
  218. package/esm/utils/WebSocket.d.ts.map +1 -0
  219. package/esm/utils/WebSocket.js +22 -0
  220. package/esm/utils/WebSocket.js.map +1 -0
  221. package/package.json +20 -8
  222. package/src/CodeInterpreter.js.map +0 -1
  223. package/src/ComputerUse.js.map +0 -1
  224. package/src/Daytona.js.map +0 -1
  225. package/src/FileSystem.js.map +0 -1
  226. package/src/Git.js.map +0 -1
  227. package/src/Image.js.map +0 -1
  228. package/src/LspServer.js.map +0 -1
  229. package/src/ObjectStorage.js.map +0 -1
  230. package/src/Process.js.map +0 -1
  231. package/src/PtyHandle.js.map +0 -1
  232. package/src/Sandbox.js.map +0 -1
  233. package/src/Snapshot.js.map +0 -1
  234. package/src/Volume.js.map +0 -1
  235. package/src/code-toolbox/SandboxJsCodeToolbox.js.map +0 -1
  236. package/src/code-toolbox/SandboxPythonCodeToolbox.js.map +0 -1
  237. package/src/code-toolbox/SandboxTsCodeToolbox.js.map +0 -1
  238. package/src/errors/DaytonaError.js.map +0 -1
  239. package/src/index.js.map +0 -1
  240. package/src/types/Charts.js.map +0 -1
  241. package/src/types/CodeInterpreter.js.map +0 -1
  242. package/src/types/ExecuteResponse.js.map +0 -1
  243. package/src/types/Pty.js.map +0 -1
  244. package/src/utils/ArtifactParser.js.map +0 -1
  245. package/src/utils/Binary.js.map +0 -1
  246. package/src/utils/FileTransfer.js.map +0 -1
  247. package/src/utils/Import.js +0 -77
  248. package/src/utils/Import.js.map +0 -1
  249. package/src/utils/Multipart.js.map +0 -1
  250. package/src/utils/Runtime.js.map +0 -1
  251. package/src/utils/Stream.js.map +0 -1
  252. package/src/utils/WebSocket.js.map +0 -1
  253. /package/{src → cjs}/CodeInterpreter.js +0 -0
  254. /package/{src → cjs}/ComputerUse.js +0 -0
  255. /package/{src → cjs}/FileSystem.js +0 -0
  256. /package/{src → cjs}/Git.js +0 -0
  257. /package/{src → cjs}/LspServer.js +0 -0
  258. /package/{src → cjs}/ObjectStorage.js +0 -0
  259. /package/{src → cjs}/Process.js +0 -0
  260. /package/{src → cjs}/PtyHandle.js +0 -0
  261. /package/{src → cjs}/Volume.js +0 -0
  262. /package/{src → cjs}/code-toolbox/SandboxJsCodeToolbox.js +0 -0
  263. /package/{src → cjs}/code-toolbox/SandboxPythonCodeToolbox.js +0 -0
  264. /package/{src → cjs}/code-toolbox/SandboxTsCodeToolbox.js +0 -0
  265. /package/{src → cjs}/errors/DaytonaError.js +0 -0
  266. /package/{src → cjs}/index.js +0 -0
  267. /package/{src → cjs}/types/Charts.js +0 -0
  268. /package/{src → cjs}/types/CodeInterpreter.js +0 -0
  269. /package/{src → cjs}/types/ExecuteResponse.js +0 -0
  270. /package/{src → cjs}/types/Pty.js +0 -0
  271. /package/{src → cjs}/utils/ArtifactParser.js +0 -0
  272. /package/{src → cjs}/utils/Binary.js +0 -0
  273. /package/{src → cjs}/utils/FileTransfer.js +0 -0
  274. /package/{src → cjs}/utils/Multipart.js +0 -0
  275. /package/{src → cjs}/utils/Runtime.js +0 -0
  276. /package/{src → cjs}/utils/Stream.js +0 -0
  277. /package/{src → cjs}/utils/WebSocket.js +0 -0
package/esm/Git.d.ts ADDED
@@ -0,0 +1,203 @@
1
+ import { GitApi, ListBranchResponse, GitStatus } from '@daytonaio/toolbox-api-client';
2
+ /**
3
+ * Response from the git commit.
4
+ *
5
+ * @interface
6
+ * @property {string} sha - The SHA of the commit
7
+ */
8
+ export interface GitCommitResponse {
9
+ sha: string;
10
+ }
11
+ /**
12
+ * Provides Git operations within a Sandbox.
13
+ *
14
+ * @class
15
+ */
16
+ export declare class Git {
17
+ private readonly apiClient;
18
+ constructor(apiClient: GitApi);
19
+ /**
20
+ * Stages the specified files for the next commit, similar to
21
+ * running 'git add' on the command line.
22
+ *
23
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
24
+ * @param {string[]} files - List of file paths or directories to stage, relative to the repository root
25
+ * @returns {Promise<void>}
26
+ *
27
+ * @example
28
+ * // Stage a single file
29
+ * await git.add('workspace/repo', ['file.txt']);
30
+ *
31
+ * @example
32
+ * // Stage whole repository
33
+ * await git.add('workspace/repo', ['.']);
34
+ */
35
+ add(path: string, files: string[]): Promise<void>;
36
+ /**
37
+ * List branches in the repository.
38
+ *
39
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
40
+ * @returns {Promise<ListBranchResponse>} List of branches in the repository
41
+ *
42
+ * @example
43
+ * const response = await git.branches('workspace/repo');
44
+ * console.log(`Branches: ${response.branches}`);
45
+ */
46
+ branches(path: string): Promise<ListBranchResponse>;
47
+ /**
48
+ * Create branch in the repository.
49
+ *
50
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
51
+ * @param {string} name - Name of the new branch to create
52
+ * @returns {Promise<void>}
53
+ *
54
+ * @example
55
+ * await git.createBranch('workspace/repo', 'new-feature');
56
+ */
57
+ createBranch(path: string, name: string): Promise<void>;
58
+ /**
59
+ * Delete branche in the repository.
60
+ *
61
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
62
+ * @param {string} name - Name of the branch to delete
63
+ * @returns {Promise<void>}
64
+ *
65
+ * @example
66
+ * await git.deleteBranch('workspace/repo', 'new-feature');
67
+ */
68
+ deleteBranch(path: string, name: string): Promise<void>;
69
+ /**
70
+ * Checkout branche in the repository.
71
+ *
72
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
73
+ * @param {string} branch - Name of the branch to checkout
74
+ * @returns {Promise<void>}
75
+ *
76
+ * @example
77
+ * await git.checkoutBranch('workspace/repo', 'new-feature');
78
+ */
79
+ checkoutBranch(path: string, branch: string): Promise<void>;
80
+ /**
81
+ * Clones a Git repository into the specified path. It supports
82
+ * cloning specific branches or commits, and can authenticate with the remote
83
+ * repository if credentials are provided.
84
+ *
85
+ * @param {string} url - Repository URL to clone from
86
+ * @param {string} path - Path where the repository should be cloned. Relative paths are resolved based on the sandbox working directory.
87
+ * @param {string} [branch] - Specific branch to clone. If not specified, clones the default branch
88
+ * @param {string} [commitId] - Specific commit to clone. If specified, the repository will be left in a detached HEAD state at this commit
89
+ * @param {string} [username] - Git username for authentication
90
+ * @param {string} [password] - Git password or token for authentication
91
+ * @returns {Promise<void>}
92
+ *
93
+ * @example
94
+ * // Clone the default branch
95
+ * await git.clone(
96
+ * 'https://github.com/user/repo.git',
97
+ * 'workspace/repo'
98
+ * );
99
+ *
100
+ * @example
101
+ * // Clone a specific branch with authentication
102
+ * await git.clone(
103
+ * 'https://github.com/user/private-repo.git',
104
+ * 'workspace/private',
105
+ * branch='develop',
106
+ * username='user',
107
+ * password='token'
108
+ * );
109
+ *
110
+ * @example
111
+ * // Clone a specific commit
112
+ * await git.clone(
113
+ * 'https://github.com/user/repo.git',
114
+ * 'workspace/repo-old',
115
+ * commitId='abc123'
116
+ * );
117
+ */
118
+ clone(url: string, path: string, branch?: string, commitId?: string, username?: string, password?: string): Promise<void>;
119
+ /**
120
+ * Commits staged changes.
121
+ *
122
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
123
+ * @param {string} message - Commit message describing the changes
124
+ * @param {string} author - Name of the commit author
125
+ * @param {string} email - Email address of the commit author
126
+ * @param {boolean} [allowEmpty] - Allow creating an empty commit when no changes are staged
127
+ * @returns {Promise<void>}
128
+ *
129
+ * @example
130
+ * // Stage and commit changes
131
+ * await git.add('workspace/repo', ['README.md']);
132
+ * await git.commit(
133
+ * 'workspace/repo',
134
+ * 'Update documentation',
135
+ * 'John Doe',
136
+ * 'john@example.com',
137
+ * true
138
+ * );
139
+ *
140
+ */
141
+ commit(path: string, message: string, author: string, email: string, allowEmpty?: boolean): Promise<GitCommitResponse>;
142
+ /**
143
+ * Push local changes to the remote repository.
144
+ *
145
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
146
+ * @param {string} [username] - Git username for authentication
147
+ * @param {string} [password] - Git password or token for authentication
148
+ * @returns {Promise<void>}
149
+ *
150
+ * @example
151
+ * // Push to a public repository
152
+ * await git.push('workspace/repo');
153
+ *
154
+ * @example
155
+ * // Push to a private repository
156
+ * await git.push(
157
+ * 'workspace/repo',
158
+ * 'user',
159
+ * 'token'
160
+ * );
161
+ */
162
+ push(path: string, username?: string, password?: string): Promise<void>;
163
+ /**
164
+ * Pulls changes from the remote repository.
165
+ *
166
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
167
+ * @param {string} [username] - Git username for authentication
168
+ * @param {string} [password] - Git password or token for authentication
169
+ * @returns {Promise<void>}
170
+ *
171
+ * @example
172
+ * // Pull from a public repository
173
+ * await git.pull('workspace/repo');
174
+ *
175
+ * @example
176
+ * // Pull from a private repository
177
+ * await git.pull(
178
+ * 'workspace/repo',
179
+ * 'user',
180
+ * 'token'
181
+ * );
182
+ */
183
+ pull(path: string, username?: string, password?: string): Promise<void>;
184
+ /**
185
+ * Gets the current status of the Git repository.
186
+ *
187
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
188
+ * @returns {Promise<GitStatus>} Current repository status including:
189
+ * - currentBranch: Name of the current branch
190
+ * - ahead: Number of commits ahead of the remote branch
191
+ * - behind: Number of commits behind the remote branch
192
+ * - branchPublished: Whether the branch has been published to the remote repository
193
+ * - fileStatus: List of file statuses
194
+ *
195
+ * @example
196
+ * const status = await sandbox.git.status('workspace/repo');
197
+ * console.log(`Current branch: ${status.currentBranch}`);
198
+ * console.log(`Commits ahead: ${status.ahead}`);
199
+ * console.log(`Commits behind: ${status.behind}`);
200
+ */
201
+ status(path: string): Promise<GitStatus>;
202
+ }
203
+ //# sourceMappingURL=Git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Git.d.ts","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/Git.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAErF;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAA;CACZ;AAED;;;;GAIG;AACH,qBAAa,GAAG;IACF,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,MAAM;IAE9C;;;;;;;;;;;;;;;OAeG;IACU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;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;;;;;;;;;;;;;OAgBG;IACU,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;CAItD"}
package/esm/Git.js ADDED
@@ -0,0 +1,260 @@
1
+ /*
2
+ * Copyright 2025 Daytona Platforms Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * Provides Git operations within a Sandbox.
7
+ *
8
+ * @class
9
+ */
10
+ export class Git {
11
+ apiClient;
12
+ constructor(apiClient) {
13
+ this.apiClient = apiClient;
14
+ }
15
+ /**
16
+ * Stages the specified files for the next commit, similar to
17
+ * running 'git add' on the command line.
18
+ *
19
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
20
+ * @param {string[]} files - List of file paths or directories to stage, relative to the repository root
21
+ * @returns {Promise<void>}
22
+ *
23
+ * @example
24
+ * // Stage a single file
25
+ * await git.add('workspace/repo', ['file.txt']);
26
+ *
27
+ * @example
28
+ * // Stage whole repository
29
+ * await git.add('workspace/repo', ['.']);
30
+ */
31
+ async add(path, files) {
32
+ await this.apiClient.addFiles({
33
+ path,
34
+ files,
35
+ });
36
+ }
37
+ /**
38
+ * List branches in the repository.
39
+ *
40
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
41
+ * @returns {Promise<ListBranchResponse>} List of branches in the repository
42
+ *
43
+ * @example
44
+ * const response = await git.branches('workspace/repo');
45
+ * console.log(`Branches: ${response.branches}`);
46
+ */
47
+ async branches(path) {
48
+ const response = await this.apiClient.listBranches(path);
49
+ return response.data;
50
+ }
51
+ /**
52
+ * Create branch in the repository.
53
+ *
54
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
55
+ * @param {string} name - Name of the new branch to create
56
+ * @returns {Promise<void>}
57
+ *
58
+ * @example
59
+ * await git.createBranch('workspace/repo', 'new-feature');
60
+ */
61
+ async createBranch(path, name) {
62
+ await this.apiClient.createBranch({
63
+ path,
64
+ name,
65
+ });
66
+ return;
67
+ }
68
+ /**
69
+ * Delete branche in the repository.
70
+ *
71
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
72
+ * @param {string} name - Name of the branch to delete
73
+ * @returns {Promise<void>}
74
+ *
75
+ * @example
76
+ * await git.deleteBranch('workspace/repo', 'new-feature');
77
+ */
78
+ async deleteBranch(path, name) {
79
+ await this.apiClient.deleteBranch({
80
+ path,
81
+ name,
82
+ });
83
+ return;
84
+ }
85
+ /**
86
+ * Checkout branche in the repository.
87
+ *
88
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
89
+ * @param {string} branch - Name of the branch to checkout
90
+ * @returns {Promise<void>}
91
+ *
92
+ * @example
93
+ * await git.checkoutBranch('workspace/repo', 'new-feature');
94
+ */
95
+ async checkoutBranch(path, branch) {
96
+ await this.apiClient.checkoutBranch({
97
+ path,
98
+ branch,
99
+ });
100
+ return;
101
+ }
102
+ /**
103
+ * Clones a Git repository into the specified path. It supports
104
+ * cloning specific branches or commits, and can authenticate with the remote
105
+ * repository if credentials are provided.
106
+ *
107
+ * @param {string} url - Repository URL to clone from
108
+ * @param {string} path - Path where the repository should be cloned. Relative paths are resolved based on the sandbox working directory.
109
+ * @param {string} [branch] - Specific branch to clone. If not specified, clones the default branch
110
+ * @param {string} [commitId] - Specific commit to clone. If specified, the repository will be left in a detached HEAD state at this commit
111
+ * @param {string} [username] - Git username for authentication
112
+ * @param {string} [password] - Git password or token for authentication
113
+ * @returns {Promise<void>}
114
+ *
115
+ * @example
116
+ * // Clone the default branch
117
+ * await git.clone(
118
+ * 'https://github.com/user/repo.git',
119
+ * 'workspace/repo'
120
+ * );
121
+ *
122
+ * @example
123
+ * // Clone a specific branch with authentication
124
+ * await git.clone(
125
+ * 'https://github.com/user/private-repo.git',
126
+ * 'workspace/private',
127
+ * branch='develop',
128
+ * username='user',
129
+ * password='token'
130
+ * );
131
+ *
132
+ * @example
133
+ * // Clone a specific commit
134
+ * await git.clone(
135
+ * 'https://github.com/user/repo.git',
136
+ * 'workspace/repo-old',
137
+ * commitId='abc123'
138
+ * );
139
+ */
140
+ async clone(url, path, branch, commitId, username, password) {
141
+ await this.apiClient.cloneRepository({
142
+ url: url,
143
+ branch: branch,
144
+ path,
145
+ username,
146
+ password,
147
+ commit_id: commitId,
148
+ });
149
+ }
150
+ /**
151
+ * Commits staged changes.
152
+ *
153
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
154
+ * @param {string} message - Commit message describing the changes
155
+ * @param {string} author - Name of the commit author
156
+ * @param {string} email - Email address of the commit author
157
+ * @param {boolean} [allowEmpty] - Allow creating an empty commit when no changes are staged
158
+ * @returns {Promise<void>}
159
+ *
160
+ * @example
161
+ * // Stage and commit changes
162
+ * await git.add('workspace/repo', ['README.md']);
163
+ * await git.commit(
164
+ * 'workspace/repo',
165
+ * 'Update documentation',
166
+ * 'John Doe',
167
+ * 'john@example.com',
168
+ * true
169
+ * );
170
+ *
171
+ */
172
+ async commit(path, message, author, email, allowEmpty) {
173
+ const response = await this.apiClient.commitChanges({
174
+ path,
175
+ message,
176
+ author,
177
+ email,
178
+ allow_empty: allowEmpty,
179
+ });
180
+ return {
181
+ sha: response.data.hash,
182
+ };
183
+ }
184
+ /**
185
+ * Push local changes to the remote repository.
186
+ *
187
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
188
+ * @param {string} [username] - Git username for authentication
189
+ * @param {string} [password] - Git password or token for authentication
190
+ * @returns {Promise<void>}
191
+ *
192
+ * @example
193
+ * // Push to a public repository
194
+ * await git.push('workspace/repo');
195
+ *
196
+ * @example
197
+ * // Push to a private repository
198
+ * await git.push(
199
+ * 'workspace/repo',
200
+ * 'user',
201
+ * 'token'
202
+ * );
203
+ */
204
+ async push(path, username, password) {
205
+ await this.apiClient.pushChanges({
206
+ path,
207
+ username,
208
+ password,
209
+ });
210
+ }
211
+ /**
212
+ * Pulls changes from the remote repository.
213
+ *
214
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
215
+ * @param {string} [username] - Git username for authentication
216
+ * @param {string} [password] - Git password or token for authentication
217
+ * @returns {Promise<void>}
218
+ *
219
+ * @example
220
+ * // Pull from a public repository
221
+ * await git.pull('workspace/repo');
222
+ *
223
+ * @example
224
+ * // Pull from a private repository
225
+ * await git.pull(
226
+ * 'workspace/repo',
227
+ * 'user',
228
+ * 'token'
229
+ * );
230
+ */
231
+ async pull(path, username, password) {
232
+ await this.apiClient.pullChanges({
233
+ path,
234
+ username,
235
+ password,
236
+ });
237
+ }
238
+ /**
239
+ * Gets the current status of the Git repository.
240
+ *
241
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
242
+ * @returns {Promise<GitStatus>} Current repository status including:
243
+ * - currentBranch: Name of the current branch
244
+ * - ahead: Number of commits ahead of the remote branch
245
+ * - behind: Number of commits behind the remote branch
246
+ * - branchPublished: Whether the branch has been published to the remote repository
247
+ * - fileStatus: List of file statuses
248
+ *
249
+ * @example
250
+ * const status = await sandbox.git.status('workspace/repo');
251
+ * console.log(`Current branch: ${status.currentBranch}`);
252
+ * console.log(`Commits ahead: ${status.ahead}`);
253
+ * console.log(`Commits behind: ${status.behind}`);
254
+ */
255
+ async status(path) {
256
+ const response = await this.apiClient.getStatus(path);
257
+ return response.data;
258
+ }
259
+ }
260
+ //# sourceMappingURL=Git.js.map
package/esm/Git.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Git.js","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/Git.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH;;;;GAIG;AACH,MAAM,OAAO,GAAG;IACe;IAA7B,YAA6B,SAAiB;QAAjB,cAAS,GAAT,SAAS,CAAQ;IAAG,CAAC;IAElD;;;;;;;;;;;;;;;OAeG;IACI,KAAK,CAAC,GAAG,CAAC,IAAY,EAAE,KAAe;QAC5C,MAAM,IAAI,CAAC,SAAS,CAAC,QAA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