@daytonaio/sdk 0.175.0 → 0.178.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 (91) hide show
  1. package/cjs/CodeInterpreter.d.ts +3 -2
  2. package/cjs/CodeInterpreter.js.map +1 -1
  3. package/cjs/ComputerUse.d.ts +104 -2
  4. package/cjs/ComputerUse.js +851 -763
  5. package/cjs/ComputerUse.js.map +1 -1
  6. package/cjs/Daytona.d.ts +4 -3
  7. package/cjs/Daytona.js +429 -443
  8. package/cjs/Daytona.js.map +1 -1
  9. package/cjs/FileSystem.d.ts +2 -2
  10. package/cjs/FileSystem.js +491 -521
  11. package/cjs/FileSystem.js.map +1 -1
  12. package/cjs/Git.d.ts +2 -1
  13. package/cjs/Git.js +287 -310
  14. package/cjs/Git.js.map +1 -1
  15. package/cjs/LspServer.d.ts +2 -1
  16. package/cjs/LspServer.js +209 -226
  17. package/cjs/LspServer.js.map +1 -1
  18. package/cjs/ObjectStorage.js +170 -166
  19. package/cjs/ObjectStorage.js.map +1 -1
  20. package/cjs/Process.d.ts +4 -3
  21. package/cjs/Process.js +562 -600
  22. package/cjs/Process.js.map +1 -1
  23. package/cjs/PtyHandle.d.ts +2 -2
  24. package/cjs/PtyHandle.js +327 -338
  25. package/cjs/PtyHandle.js.map +1 -1
  26. package/cjs/Sandbox.d.ts +4 -3
  27. package/cjs/Sandbox.js +756 -821
  28. package/cjs/Sandbox.js.map +1 -1
  29. package/cjs/Snapshot.d.ts +3 -2
  30. package/cjs/Snapshot.js +203 -213
  31. package/cjs/Snapshot.js.map +1 -1
  32. package/cjs/Volume.d.ts +2 -1
  33. package/cjs/Volume.js +90 -92
  34. package/cjs/Volume.js.map +1 -1
  35. package/cjs/errors/DaytonaError.d.ts +2 -1
  36. package/cjs/errors/DaytonaError.js.map +1 -1
  37. package/cjs/index.d.ts +2 -2
  38. package/cjs/index.js +2 -1
  39. package/cjs/index.js.map +1 -1
  40. package/cjs/types/CodeInterpreter.d.ts +1 -1
  41. package/cjs/utils/Binary.js +14 -2
  42. package/cjs/utils/Binary.js.map +1 -1
  43. package/cjs/utils/otel.decorator.d.ts +7 -8
  44. package/cjs/utils/otel.decorator.js +24 -30
  45. package/cjs/utils/otel.decorator.js.map +1 -1
  46. package/esm/CodeInterpreter.d.ts +3 -2
  47. package/esm/CodeInterpreter.js.map +1 -1
  48. package/esm/ComputerUse.d.ts +104 -2
  49. package/esm/ComputerUse.js +857 -763
  50. package/esm/ComputerUse.js.map +1 -1
  51. package/esm/Daytona.d.ts +4 -3
  52. package/esm/Daytona.js +431 -444
  53. package/esm/Daytona.js.map +1 -1
  54. package/esm/FileSystem.d.ts +2 -2
  55. package/esm/FileSystem.js +493 -522
  56. package/esm/FileSystem.js.map +1 -1
  57. package/esm/Git.d.ts +2 -1
  58. package/esm/Git.js +289 -311
  59. package/esm/Git.js.map +1 -1
  60. package/esm/LspServer.d.ts +2 -1
  61. package/esm/LspServer.js +211 -227
  62. package/esm/LspServer.js.map +1 -1
  63. package/esm/ObjectStorage.js +172 -167
  64. package/esm/ObjectStorage.js.map +1 -1
  65. package/esm/Process.d.ts +4 -3
  66. package/esm/Process.js +564 -601
  67. package/esm/Process.js.map +1 -1
  68. package/esm/PtyHandle.d.ts +2 -2
  69. package/esm/PtyHandle.js +329 -339
  70. package/esm/PtyHandle.js.map +1 -1
  71. package/esm/Sandbox.d.ts +4 -3
  72. package/esm/Sandbox.js +759 -823
  73. package/esm/Sandbox.js.map +1 -1
  74. package/esm/Snapshot.d.ts +3 -2
  75. package/esm/Snapshot.js +206 -215
  76. package/esm/Snapshot.js.map +1 -1
  77. package/esm/Volume.d.ts +2 -1
  78. package/esm/Volume.js +92 -93
  79. package/esm/Volume.js.map +1 -1
  80. package/esm/errors/DaytonaError.d.ts +2 -1
  81. package/esm/errors/DaytonaError.js.map +1 -1
  82. package/esm/index.d.ts +2 -2
  83. package/esm/index.js +1 -1
  84. package/esm/index.js.map +1 -1
  85. package/esm/types/CodeInterpreter.d.ts +1 -1
  86. package/esm/utils/Binary.js +14 -2
  87. package/esm/utils/Binary.js.map +1 -1
  88. package/esm/utils/otel.decorator.d.ts +7 -8
  89. package/esm/utils/otel.decorator.js +26 -32
  90. package/esm/utils/otel.decorator.js.map +1 -1
  91. package/package.json +3 -3
package/esm/Git.js CHANGED
@@ -2,321 +2,299 @@
2
2
  * Copyright 2025 Daytona Platforms Inc.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- import { __decorate, __metadata } from "tslib";
5
+ import { __esDecorate, __runInitializers } from "tslib";
6
6
  import { WithInstrumentation } from './utils/otel.decorator.js';
7
7
  /**
8
8
  * Provides Git operations within a Sandbox.
9
9
  *
10
10
  * @class
11
11
  */
12
- export class Git {
13
- apiClient;
14
- constructor(apiClient) {
15
- this.apiClient = apiClient;
16
- }
17
- /**
18
- * Stages the specified files for the next commit, similar to
19
- * running 'git add' on the command line.
20
- *
21
- * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
22
- * @param {string[]} files - List of file paths or directories to stage, relative to the repository root
23
- * @returns {Promise<void>}
24
- *
25
- * @example
26
- * // Stage a single file
27
- * await git.add('workspace/repo', ['file.txt']);
28
- *
29
- * @example
30
- * // Stage whole repository
31
- * await git.add('workspace/repo', ['.']);
32
- */
33
- async add(path, files) {
34
- await this.apiClient.addFiles({
35
- path,
36
- files,
37
- });
38
- }
39
- /**
40
- * List branches in the repository.
41
- *
42
- * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
43
- * @returns {Promise<ListBranchResponse>} List of branches in the repository
44
- *
45
- * @example
46
- * const response = await git.branches('workspace/repo');
47
- * console.log(`Branches: ${response.branches}`);
48
- */
49
- async branches(path) {
50
- const response = await this.apiClient.listBranches(path);
51
- return response.data;
52
- }
53
- /**
54
- * Create branch in the repository.
55
- *
56
- * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
57
- * @param {string} name - Name of the new branch to create
58
- * @returns {Promise<void>}
59
- *
60
- * @example
61
- * await git.createBranch('workspace/repo', 'new-feature');
62
- */
63
- async createBranch(path, name) {
64
- await this.apiClient.createBranch({
65
- path,
66
- name,
67
- });
68
- return;
69
- }
70
- /**
71
- * Delete branche in the repository.
72
- *
73
- * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
74
- * @param {string} name - Name of the branch to delete
75
- * @returns {Promise<void>}
76
- *
77
- * @example
78
- * await git.deleteBranch('workspace/repo', 'new-feature');
79
- */
80
- async deleteBranch(path, name) {
81
- await this.apiClient.deleteBranch({
82
- path,
83
- name,
84
- });
85
- return;
86
- }
87
- /**
88
- * Checkout branche in the repository.
89
- *
90
- * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
91
- * @param {string} branch - Name of the branch to checkout
92
- * @returns {Promise<void>}
93
- *
94
- * @example
95
- * await git.checkoutBranch('workspace/repo', 'new-feature');
96
- */
97
- async checkoutBranch(path, branch) {
98
- await this.apiClient.checkoutBranch({
99
- path,
100
- branch,
101
- });
102
- return;
103
- }
104
- /**
105
- * Clones a Git repository into the specified path. It supports
106
- * cloning specific branches or commits, and can authenticate with the remote
107
- * repository if credentials are provided.
108
- *
109
- * @param {string} url - Repository URL to clone from
110
- * @param {string} path - Path where the repository should be cloned. Relative paths are resolved based on the sandbox working directory.
111
- * @param {string} [branch] - Specific branch to clone. If not specified, clones the default branch
112
- * @param {string} [commitId] - Specific commit to clone. If specified, the repository will be left in a detached HEAD state at this commit
113
- * @param {string} [username] - Git username for authentication
114
- * @param {string} [password] - Git password or token for authentication
115
- * @returns {Promise<void>}
116
- *
117
- * @example
118
- * // Clone the default branch
119
- * await git.clone(
120
- * 'https://github.com/user/repo.git',
121
- * 'workspace/repo'
122
- * );
123
- *
124
- * @example
125
- * // Clone a specific branch with authentication
126
- * await git.clone(
127
- * 'https://github.com/user/private-repo.git',
128
- * 'workspace/private',
129
- * branch='develop',
130
- * username='user',
131
- * password='token'
132
- * );
133
- *
134
- * @example
135
- * // Clone a specific commit
136
- * await git.clone(
137
- * 'https://github.com/user/repo.git',
138
- * 'workspace/repo-old',
139
- * commitId='abc123'
140
- * );
141
- */
142
- async clone(url, path, branch, commitId, username, password) {
143
- await this.apiClient.cloneRepository({
144
- url: url,
145
- branch: branch,
146
- path,
147
- username,
148
- password,
149
- commit_id: commitId,
150
- });
151
- }
152
- /**
153
- * Commits staged changes.
154
- *
155
- * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
156
- * @param {string} message - Commit message describing the changes
157
- * @param {string} author - Name of the commit author
158
- * @param {string} email - Email address of the commit author
159
- * @param {boolean} [allowEmpty] - Allow creating an empty commit when no changes are staged
160
- * @returns {Promise<void>}
161
- *
162
- * @example
163
- * // Stage and commit changes
164
- * await git.add('workspace/repo', ['README.md']);
165
- * await git.commit(
166
- * 'workspace/repo',
167
- * 'Update documentation',
168
- * 'John Doe',
169
- * 'john@example.com',
170
- * true
171
- * );
172
- *
173
- */
174
- async commit(path, message, author, email, allowEmpty) {
175
- const response = await this.apiClient.commitChanges({
176
- path,
177
- message,
178
- author,
179
- email,
180
- allow_empty: allowEmpty,
181
- });
182
- return {
183
- sha: response.data.hash,
184
- };
185
- }
186
- /**
187
- * Push local changes to the remote repository.
188
- *
189
- * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
190
- * @param {string} [username] - Git username for authentication
191
- * @param {string} [password] - Git password or token for authentication
192
- * @returns {Promise<void>}
193
- *
194
- * @example
195
- * // Push to a public repository
196
- * await git.push('workspace/repo');
197
- *
198
- * @example
199
- * // Push to a private repository
200
- * await git.push(
201
- * 'workspace/repo',
202
- * 'user',
203
- * 'token'
204
- * );
205
- */
206
- async push(path, username, password) {
207
- await this.apiClient.pushChanges({
208
- path,
209
- username,
210
- password,
211
- });
212
- }
213
- /**
214
- * Pulls changes from the remote repository.
215
- *
216
- * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
217
- * @param {string} [username] - Git username for authentication
218
- * @param {string} [password] - Git password or token for authentication
219
- * @returns {Promise<void>}
220
- *
221
- * @example
222
- * // Pull from a public repository
223
- * await git.pull('workspace/repo');
224
- *
225
- * @example
226
- * // Pull from a private repository
227
- * await git.pull(
228
- * 'workspace/repo',
229
- * 'user',
230
- * 'token'
231
- * );
232
- */
233
- async pull(path, username, password) {
234
- await this.apiClient.pullChanges({
235
- path,
236
- username,
237
- password,
238
- });
239
- }
240
- /**
241
- * Gets the current status of the Git repository.
242
- *
243
- * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
244
- * @returns {Promise<GitStatus>} Current repository status including:
245
- * - currentBranch: Name of the current branch
246
- * - ahead: Number of commits ahead of the remote branch
247
- * - behind: Number of commits behind the remote branch
248
- * - branchPublished: Whether the branch has been published to the remote repository
249
- * - fileStatus: List of file statuses
250
- *
251
- * @example
252
- * const status = await sandbox.git.status('workspace/repo');
253
- * console.log(`Current branch: ${status.currentBranch}`);
254
- * console.log(`Commits ahead: ${status.ahead}`);
255
- * console.log(`Commits behind: ${status.behind}`);
256
- */
257
- async status(path) {
258
- const response = await this.apiClient.getStatus(path);
259
- return response.data;
260
- }
261
- }
262
- __decorate([
263
- WithInstrumentation(),
264
- __metadata("design:type", Function),
265
- __metadata("design:paramtypes", [String, Array]),
266
- __metadata("design:returntype", Promise)
267
- ], Git.prototype, "add", null);
268
- __decorate([
269
- WithInstrumentation(),
270
- __metadata("design:type", Function),
271
- __metadata("design:paramtypes", [String]),
272
- __metadata("design:returntype", Promise)
273
- ], Git.prototype, "branches", null);
274
- __decorate([
275
- WithInstrumentation(),
276
- __metadata("design:type", Function),
277
- __metadata("design:paramtypes", [String, String]),
278
- __metadata("design:returntype", Promise)
279
- ], Git.prototype, "createBranch", null);
280
- __decorate([
281
- WithInstrumentation(),
282
- __metadata("design:type", Function),
283
- __metadata("design:paramtypes", [String, String]),
284
- __metadata("design:returntype", Promise)
285
- ], Git.prototype, "deleteBranch", null);
286
- __decorate([
287
- WithInstrumentation(),
288
- __metadata("design:type", Function),
289
- __metadata("design:paramtypes", [String, String]),
290
- __metadata("design:returntype", Promise)
291
- ], Git.prototype, "checkoutBranch", null);
292
- __decorate([
293
- WithInstrumentation(),
294
- __metadata("design:type", Function),
295
- __metadata("design:paramtypes", [String, String, String, String, String, String]),
296
- __metadata("design:returntype", Promise)
297
- ], Git.prototype, "clone", null);
298
- __decorate([
299
- WithInstrumentation(),
300
- __metadata("design:type", Function),
301
- __metadata("design:paramtypes", [String, String, String, String, Boolean]),
302
- __metadata("design:returntype", Promise)
303
- ], Git.prototype, "commit", null);
304
- __decorate([
305
- WithInstrumentation(),
306
- __metadata("design:type", Function),
307
- __metadata("design:paramtypes", [String, String, String]),
308
- __metadata("design:returntype", Promise)
309
- ], Git.prototype, "push", null);
310
- __decorate([
311
- WithInstrumentation(),
312
- __metadata("design:type", Function),
313
- __metadata("design:paramtypes", [String, String, String]),
314
- __metadata("design:returntype", Promise)
315
- ], Git.prototype, "pull", null);
316
- __decorate([
317
- WithInstrumentation(),
318
- __metadata("design:type", Function),
319
- __metadata("design:paramtypes", [String]),
320
- __metadata("design:returntype", Promise)
321
- ], Git.prototype, "status", null);
12
+ let Git = (() => {
13
+ let _instanceExtraInitializers = [];
14
+ let _add_decorators;
15
+ let _branches_decorators;
16
+ let _createBranch_decorators;
17
+ let _deleteBranch_decorators;
18
+ let _checkoutBranch_decorators;
19
+ let _clone_decorators;
20
+ let _commit_decorators;
21
+ let _push_decorators;
22
+ let _pull_decorators;
23
+ let _status_decorators;
24
+ return class Git {
25
+ static {
26
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
27
+ _add_decorators = [WithInstrumentation()];
28
+ _branches_decorators = [WithInstrumentation()];
29
+ _createBranch_decorators = [WithInstrumentation()];
30
+ _deleteBranch_decorators = [WithInstrumentation()];
31
+ _checkoutBranch_decorators = [WithInstrumentation()];
32
+ _clone_decorators = [WithInstrumentation()];
33
+ _commit_decorators = [WithInstrumentation()];
34
+ _push_decorators = [WithInstrumentation()];
35
+ _pull_decorators = [WithInstrumentation()];
36
+ _status_decorators = [WithInstrumentation()];
37
+ __esDecorate(this, null, _add_decorators, { kind: "method", name: "add", static: false, private: false, access: { has: obj => "add" in obj, get: obj => obj.add }, metadata: _metadata }, null, _instanceExtraInitializers);
38
+ __esDecorate(this, null, _branches_decorators, { kind: "method", name: "branches", static: false, private: false, access: { has: obj => "branches" in obj, get: obj => obj.branches }, metadata: _metadata }, null, _instanceExtraInitializers);
39
+ __esDecorate(this, null, _createBranch_decorators, { kind: "method", name: "createBranch", static: false, private: false, access: { has: obj => "createBranch" in obj, get: obj => obj.createBranch }, metadata: _metadata }, null, _instanceExtraInitializers);
40
+ __esDecorate(this, null, _deleteBranch_decorators, { kind: "method", name: "deleteBranch", static: false, private: false, access: { has: obj => "deleteBranch" in obj, get: obj => obj.deleteBranch }, metadata: _metadata }, null, _instanceExtraInitializers);
41
+ __esDecorate(this, null, _checkoutBranch_decorators, { kind: "method", name: "checkoutBranch", static: false, private: false, access: { has: obj => "checkoutBranch" in obj, get: obj => obj.checkoutBranch }, metadata: _metadata }, null, _instanceExtraInitializers);
42
+ __esDecorate(this, null, _clone_decorators, { kind: "method", name: "clone", static: false, private: false, access: { has: obj => "clone" in obj, get: obj => obj.clone }, metadata: _metadata }, null, _instanceExtraInitializers);
43
+ __esDecorate(this, null, _commit_decorators, { kind: "method", name: "commit", static: false, private: false, access: { has: obj => "commit" in obj, get: obj => obj.commit }, metadata: _metadata }, null, _instanceExtraInitializers);
44
+ __esDecorate(this, null, _push_decorators, { kind: "method", name: "push", static: false, private: false, access: { has: obj => "push" in obj, get: obj => obj.push }, metadata: _metadata }, null, _instanceExtraInitializers);
45
+ __esDecorate(this, null, _pull_decorators, { kind: "method", name: "pull", static: false, private: false, access: { has: obj => "pull" in obj, get: obj => obj.pull }, metadata: _metadata }, null, _instanceExtraInitializers);
46
+ __esDecorate(this, null, _status_decorators, { kind: "method", name: "status", static: false, private: false, access: { has: obj => "status" in obj, get: obj => obj.status }, metadata: _metadata }, null, _instanceExtraInitializers);
47
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
48
+ }
49
+ apiClient = __runInitializers(this, _instanceExtraInitializers);
50
+ constructor(apiClient) {
51
+ this.apiClient = apiClient;
52
+ }
53
+ /**
54
+ * Stages the specified files for the next commit, similar to
55
+ * running 'git add' on the command line.
56
+ *
57
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
58
+ * @param {string[]} files - List of file paths or directories to stage, relative to the repository root
59
+ * @returns {Promise<void>}
60
+ *
61
+ * @example
62
+ * // Stage a single file
63
+ * await git.add('workspace/repo', ['file.txt']);
64
+ *
65
+ * @example
66
+ * // Stage whole repository
67
+ * await git.add('workspace/repo', ['.']);
68
+ */
69
+ async add(path, files) {
70
+ await this.apiClient.addFiles({
71
+ path,
72
+ files,
73
+ });
74
+ }
75
+ /**
76
+ * List branches in the repository.
77
+ *
78
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
79
+ * @returns {Promise<ListBranchResponse>} List of branches in the repository
80
+ *
81
+ * @example
82
+ * const response = await git.branches('workspace/repo');
83
+ * console.log(`Branches: ${response.branches}`);
84
+ */
85
+ async branches(path) {
86
+ const response = await this.apiClient.listBranches(path);
87
+ return response.data;
88
+ }
89
+ /**
90
+ * Create branch in the repository.
91
+ *
92
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
93
+ * @param {string} name - Name of the new branch to create
94
+ * @returns {Promise<void>}
95
+ *
96
+ * @example
97
+ * await git.createBranch('workspace/repo', 'new-feature');
98
+ */
99
+ async createBranch(path, name) {
100
+ await this.apiClient.createBranch({
101
+ path,
102
+ name,
103
+ });
104
+ return;
105
+ }
106
+ /**
107
+ * Delete branche in the repository.
108
+ *
109
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
110
+ * @param {string} name - Name of the branch to delete
111
+ * @returns {Promise<void>}
112
+ *
113
+ * @example
114
+ * await git.deleteBranch('workspace/repo', 'new-feature');
115
+ */
116
+ async deleteBranch(path, name) {
117
+ await this.apiClient.deleteBranch({
118
+ path,
119
+ name,
120
+ });
121
+ return;
122
+ }
123
+ /**
124
+ * Checkout branche in the repository.
125
+ *
126
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
127
+ * @param {string} branch - Name of the branch to checkout
128
+ * @returns {Promise<void>}
129
+ *
130
+ * @example
131
+ * await git.checkoutBranch('workspace/repo', 'new-feature');
132
+ */
133
+ async checkoutBranch(path, branch) {
134
+ await this.apiClient.checkoutBranch({
135
+ path,
136
+ branch,
137
+ });
138
+ return;
139
+ }
140
+ /**
141
+ * Clones a Git repository into the specified path. It supports
142
+ * cloning specific branches or commits, and can authenticate with the remote
143
+ * repository if credentials are provided.
144
+ *
145
+ * @param {string} url - Repository URL to clone from
146
+ * @param {string} path - Path where the repository should be cloned. Relative paths are resolved based on the sandbox working directory.
147
+ * @param {string} [branch] - Specific branch to clone. If not specified, clones the default branch
148
+ * @param {string} [commitId] - Specific commit to clone. If specified, the repository will be left in a detached HEAD state at this commit
149
+ * @param {string} [username] - Git username for authentication
150
+ * @param {string} [password] - Git password or token for authentication
151
+ * @returns {Promise<void>}
152
+ *
153
+ * @example
154
+ * // Clone the default branch
155
+ * await git.clone(
156
+ * 'https://github.com/user/repo.git',
157
+ * 'workspace/repo'
158
+ * );
159
+ *
160
+ * @example
161
+ * // Clone a specific branch with authentication
162
+ * await git.clone(
163
+ * 'https://github.com/user/private-repo.git',
164
+ * 'workspace/private',
165
+ * branch='develop',
166
+ * username='user',
167
+ * password='token'
168
+ * );
169
+ *
170
+ * @example
171
+ * // Clone a specific commit
172
+ * await git.clone(
173
+ * 'https://github.com/user/repo.git',
174
+ * 'workspace/repo-old',
175
+ * commitId='abc123'
176
+ * );
177
+ */
178
+ async clone(url, path, branch, commitId, username, password) {
179
+ await this.apiClient.cloneRepository({
180
+ url: url,
181
+ branch: branch,
182
+ path,
183
+ username,
184
+ password,
185
+ commit_id: commitId,
186
+ });
187
+ }
188
+ /**
189
+ * Commits staged changes.
190
+ *
191
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
192
+ * @param {string} message - Commit message describing the changes
193
+ * @param {string} author - Name of the commit author
194
+ * @param {string} email - Email address of the commit author
195
+ * @param {boolean} [allowEmpty] - Allow creating an empty commit when no changes are staged
196
+ * @returns {Promise<void>}
197
+ *
198
+ * @example
199
+ * // Stage and commit changes
200
+ * await git.add('workspace/repo', ['README.md']);
201
+ * await git.commit(
202
+ * 'workspace/repo',
203
+ * 'Update documentation',
204
+ * 'John Doe',
205
+ * 'john@example.com',
206
+ * true
207
+ * );
208
+ *
209
+ */
210
+ async commit(path, message, author, email, allowEmpty) {
211
+ const response = await this.apiClient.commitChanges({
212
+ path,
213
+ message,
214
+ author,
215
+ email,
216
+ allow_empty: allowEmpty,
217
+ });
218
+ return {
219
+ sha: response.data.hash,
220
+ };
221
+ }
222
+ /**
223
+ * Push local changes to the remote repository.
224
+ *
225
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
226
+ * @param {string} [username] - Git username for authentication
227
+ * @param {string} [password] - Git password or token for authentication
228
+ * @returns {Promise<void>}
229
+ *
230
+ * @example
231
+ * // Push to a public repository
232
+ * await git.push('workspace/repo');
233
+ *
234
+ * @example
235
+ * // Push to a private repository
236
+ * await git.push(
237
+ * 'workspace/repo',
238
+ * 'user',
239
+ * 'token'
240
+ * );
241
+ */
242
+ async push(path, username, password) {
243
+ await this.apiClient.pushChanges({
244
+ path,
245
+ username,
246
+ password,
247
+ });
248
+ }
249
+ /**
250
+ * Pulls changes from the remote repository.
251
+ *
252
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
253
+ * @param {string} [username] - Git username for authentication
254
+ * @param {string} [password] - Git password or token for authentication
255
+ * @returns {Promise<void>}
256
+ *
257
+ * @example
258
+ * // Pull from a public repository
259
+ * await git.pull('workspace/repo');
260
+ *
261
+ * @example
262
+ * // Pull from a private repository
263
+ * await git.pull(
264
+ * 'workspace/repo',
265
+ * 'user',
266
+ * 'token'
267
+ * );
268
+ */
269
+ async pull(path, username, password) {
270
+ await this.apiClient.pullChanges({
271
+ path,
272
+ username,
273
+ password,
274
+ });
275
+ }
276
+ /**
277
+ * Gets the current status of the Git repository.
278
+ *
279
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
280
+ * @returns {Promise<GitStatus>} Current repository status including:
281
+ * - currentBranch: Name of the current branch
282
+ * - ahead: Number of commits ahead of the remote branch
283
+ * - behind: Number of commits behind the remote branch
284
+ * - branchPublished: Whether the branch has been published to the remote repository
285
+ * - fileStatus: List of file statuses
286
+ *
287
+ * @example
288
+ * const status = await sandbox.git.status('workspace/repo');
289
+ * console.log(`Current branch: ${status.currentBranch}`);
290
+ * console.log(`Commits ahead: ${status.ahead}`);
291
+ * console.log(`Commits behind: ${status.behind}`);
292
+ */
293
+ async status(path) {
294
+ const response = await this.apiClient.getStatus(path);
295
+ return response.data;
296
+ }
297
+ };
298
+ })();
299
+ export { Git };
322
300
  //# sourceMappingURL=Git.js.map