@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.
- package/LICENSE +190 -0
- package/{src → cjs}/CodeInterpreter.d.ts +1 -0
- package/cjs/CodeInterpreter.d.ts.map +1 -0
- package/cjs/CodeInterpreter.js.map +1 -0
- package/{src → cjs}/ComputerUse.d.ts +1 -0
- package/cjs/ComputerUse.d.ts.map +1 -0
- package/cjs/ComputerUse.js.map +1 -0
- package/{src → cjs}/Daytona.d.ts +1 -0
- package/cjs/Daytona.d.ts.map +1 -0
- package/{src → cjs}/Daytona.js +1 -0
- package/cjs/Daytona.js.map +1 -0
- package/{src → cjs}/FileSystem.d.ts +1 -0
- package/cjs/FileSystem.d.ts.map +1 -0
- package/cjs/FileSystem.js.map +1 -0
- package/{src → cjs}/Git.d.ts +1 -0
- package/cjs/Git.d.ts.map +1 -0
- package/cjs/Git.js.map +1 -0
- package/{src → cjs}/Image.d.ts +21 -0
- package/cjs/Image.d.ts.map +1 -0
- package/{src → cjs}/Image.js +123 -91
- package/cjs/Image.js.map +1 -0
- package/{src → cjs}/LspServer.d.ts +1 -0
- package/cjs/LspServer.d.ts.map +1 -0
- package/cjs/LspServer.js.map +1 -0
- package/{src → cjs}/ObjectStorage.d.ts +1 -0
- package/cjs/ObjectStorage.d.ts.map +1 -0
- package/cjs/ObjectStorage.js.map +1 -0
- package/{src → cjs}/Process.d.ts +1 -0
- package/cjs/Process.d.ts.map +1 -0
- package/cjs/Process.js.map +1 -0
- package/{src → cjs}/PtyHandle.d.ts +1 -0
- package/cjs/PtyHandle.d.ts.map +1 -0
- package/cjs/PtyHandle.js.map +1 -0
- package/cjs/README.md +147 -0
- package/{src → cjs}/Sandbox.d.ts +2 -17
- package/cjs/Sandbox.d.ts.map +1 -0
- package/{src → cjs}/Sandbox.js +1 -27
- package/cjs/Sandbox.js.map +1 -0
- package/{src → cjs}/Snapshot.d.ts +2 -0
- package/cjs/Snapshot.d.ts.map +1 -0
- package/{src → cjs}/Snapshot.js +9 -1
- package/cjs/Snapshot.js.map +1 -0
- package/{src → cjs}/Volume.d.ts +1 -0
- package/cjs/Volume.d.ts.map +1 -0
- package/cjs/Volume.js.map +1 -0
- package/{src → cjs}/code-toolbox/SandboxJsCodeToolbox.d.ts +1 -0
- package/cjs/code-toolbox/SandboxJsCodeToolbox.d.ts.map +1 -0
- package/cjs/code-toolbox/SandboxJsCodeToolbox.js.map +1 -0
- package/{src → cjs}/code-toolbox/SandboxPythonCodeToolbox.d.ts +1 -0
- package/cjs/code-toolbox/SandboxPythonCodeToolbox.d.ts.map +1 -0
- package/cjs/code-toolbox/SandboxPythonCodeToolbox.js.map +1 -0
- package/{src → cjs}/code-toolbox/SandboxTsCodeToolbox.d.ts +1 -0
- package/cjs/code-toolbox/SandboxTsCodeToolbox.d.ts.map +1 -0
- package/cjs/code-toolbox/SandboxTsCodeToolbox.js.map +1 -0
- package/{src → cjs}/errors/DaytonaError.d.ts +1 -0
- package/cjs/errors/DaytonaError.d.ts.map +1 -0
- package/cjs/errors/DaytonaError.js.map +1 -0
- package/{src → cjs}/index.d.ts +1 -0
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js.map +1 -0
- package/cjs/package.json +3 -0
- package/{src → cjs}/types/Charts.d.ts +1 -0
- package/cjs/types/Charts.d.ts.map +1 -0
- package/cjs/types/Charts.js.map +1 -0
- package/{src → cjs}/types/CodeInterpreter.d.ts +1 -0
- package/cjs/types/CodeInterpreter.d.ts.map +1 -0
- package/cjs/types/CodeInterpreter.js.map +1 -0
- package/{src → cjs}/types/ExecuteResponse.d.ts +1 -0
- package/cjs/types/ExecuteResponse.d.ts.map +1 -0
- package/cjs/types/ExecuteResponse.js.map +1 -0
- package/{src → cjs}/types/Pty.d.ts +1 -0
- package/cjs/types/Pty.d.ts.map +1 -0
- package/cjs/types/Pty.js.map +1 -0
- package/{src → cjs}/utils/ArtifactParser.d.ts +1 -0
- package/cjs/utils/ArtifactParser.d.ts.map +1 -0
- package/cjs/utils/ArtifactParser.js.map +1 -0
- package/{src → cjs}/utils/Binary.d.ts +1 -0
- package/cjs/utils/Binary.d.ts.map +1 -0
- package/cjs/utils/Binary.js.map +1 -0
- package/{src → cjs}/utils/FileTransfer.d.ts +1 -0
- package/cjs/utils/FileTransfer.d.ts.map +1 -0
- package/cjs/utils/FileTransfer.js.map +1 -0
- package/{src → cjs}/utils/Import.d.ts +2 -15
- package/cjs/utils/Import.d.ts.map +1 -0
- package/cjs/utils/Import.js +81 -0
- package/cjs/utils/Import.js.map +1 -0
- package/{src → cjs}/utils/Multipart.d.ts +1 -0
- package/cjs/utils/Multipart.d.ts.map +1 -0
- package/cjs/utils/Multipart.js.map +1 -0
- package/{src → cjs}/utils/Runtime.d.ts +1 -0
- package/cjs/utils/Runtime.d.ts.map +1 -0
- package/cjs/utils/Runtime.js.map +1 -0
- package/{src → cjs}/utils/Stream.d.ts +1 -0
- package/cjs/utils/Stream.d.ts.map +1 -0
- package/cjs/utils/Stream.js.map +1 -0
- package/{src → cjs}/utils/WebSocket.d.ts +1 -0
- package/cjs/utils/WebSocket.d.ts.map +1 -0
- package/cjs/utils/WebSocket.js.map +1 -0
- package/esm/CodeInterpreter.d.ts +96 -0
- package/esm/CodeInterpreter.d.ts.map +1 -0
- package/esm/CodeInterpreter.js +295 -0
- package/esm/CodeInterpreter.js.map +1 -0
- package/esm/ComputerUse.d.ts +443 -0
- package/esm/ComputerUse.d.ts.map +1 -0
- package/esm/ComputerUse.js +509 -0
- package/esm/ComputerUse.js.map +1 -0
- package/esm/Daytona.d.ts +354 -0
- package/esm/Daytona.d.ts.map +1 -0
- package/esm/Daytona.js +410 -0
- package/esm/Daytona.js.map +1 -0
- package/esm/FileSystem.d.ts +328 -0
- package/esm/FileSystem.d.ts.map +1 -0
- package/esm/FileSystem.js +331 -0
- package/esm/FileSystem.js.map +1 -0
- package/esm/Git.d.ts +203 -0
- package/esm/Git.d.ts.map +1 -0
- package/esm/Git.js +260 -0
- package/esm/Git.js.map +1 -0
- package/esm/Image.d.ts +285 -0
- package/esm/Image.d.ts.map +1 -0
- package/esm/Image.js +569 -0
- package/esm/Image.js.map +1 -0
- package/esm/LspServer.d.ts +172 -0
- package/esm/LspServer.d.ts.map +1 -0
- package/esm/LspServer.js +204 -0
- package/esm/LspServer.js.map +1 -0
- package/esm/ObjectStorage.d.ts +79 -0
- package/esm/ObjectStorage.d.ts.map +1 -0
- package/esm/ObjectStorage.js +187 -0
- package/esm/ObjectStorage.js.map +1 -0
- package/esm/Process.d.ts +442 -0
- package/esm/Process.d.ts.map +1 -0
- package/esm/Process.js +644 -0
- package/esm/Process.js.map +1 -0
- package/esm/PtyHandle.d.ts +155 -0
- package/esm/PtyHandle.d.ts.map +1 -0
- package/esm/PtyHandle.js +374 -0
- package/esm/PtyHandle.js.map +1 -0
- package/esm/README.md +147 -0
- package/esm/Sandbox.d.ts +359 -0
- package/esm/Sandbox.d.ts.map +1 -0
- package/esm/Sandbox.js +532 -0
- package/esm/Sandbox.js.map +1 -0
- package/esm/Snapshot.d.ts +138 -0
- package/esm/Snapshot.d.ts.map +1 -0
- package/esm/Snapshot.js +207 -0
- package/esm/Snapshot.js.map +1 -0
- package/esm/Volume.d.ts +84 -0
- package/esm/Volume.d.ts.map +1 -0
- package/esm/Volume.js +95 -0
- package/esm/Volume.js.map +1 -0
- package/esm/code-toolbox/SandboxJsCodeToolbox.d.ts +6 -0
- package/esm/code-toolbox/SandboxJsCodeToolbox.d.ts.map +1 -0
- package/esm/code-toolbox/SandboxJsCodeToolbox.js +13 -0
- package/esm/code-toolbox/SandboxJsCodeToolbox.js.map +1 -0
- package/esm/code-toolbox/SandboxPythonCodeToolbox.d.ts +12 -0
- package/esm/code-toolbox/SandboxPythonCodeToolbox.d.ts.map +1 -0
- package/esm/code-toolbox/SandboxPythonCodeToolbox.js +355 -0
- package/esm/code-toolbox/SandboxPythonCodeToolbox.js.map +1 -0
- package/esm/code-toolbox/SandboxTsCodeToolbox.d.ts +6 -0
- package/esm/code-toolbox/SandboxTsCodeToolbox.d.ts.map +1 -0
- package/esm/code-toolbox/SandboxTsCodeToolbox.js +14 -0
- package/esm/code-toolbox/SandboxTsCodeToolbox.js.map +1 -0
- package/esm/errors/DaytonaError.d.ts +32 -0
- package/esm/errors/DaytonaError.d.ts.map +1 -0
- package/esm/errors/DaytonaError.js +44 -0
- package/esm/errors/DaytonaError.js.map +1 -0
- package/esm/index.d.ts +22 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +22 -0
- package/esm/index.js.map +1 -0
- package/esm/package.json +3 -0
- package/esm/types/Charts.d.ts +152 -0
- package/esm/types/Charts.d.ts.map +1 -0
- package/esm/types/Charts.js +42 -0
- package/esm/types/Charts.js.map +1 -0
- package/esm/types/CodeInterpreter.d.ts +77 -0
- package/esm/types/CodeInterpreter.d.ts.map +1 -0
- package/esm/types/CodeInterpreter.js +6 -0
- package/esm/types/CodeInterpreter.js.map +1 -0
- package/esm/types/ExecuteResponse.d.ts +26 -0
- package/esm/types/ExecuteResponse.d.ts.map +1 -0
- package/esm/types/ExecuteResponse.js +6 -0
- package/esm/types/ExecuteResponse.js.map +1 -0
- package/esm/types/Pty.d.ts +48 -0
- package/esm/types/Pty.d.ts.map +1 -0
- package/esm/types/Pty.js +6 -0
- package/esm/types/Pty.js.map +1 -0
- package/esm/utils/ArtifactParser.d.ts +14 -0
- package/esm/utils/ArtifactParser.d.ts.map +1 -0
- package/esm/utils/ArtifactParser.js +51 -0
- package/esm/utils/ArtifactParser.js.map +1 -0
- package/esm/utils/Binary.d.ts +39 -0
- package/esm/utils/Binary.d.ts.map +1 -0
- package/esm/utils/Binary.js +157 -0
- package/esm/utils/Binary.js.map +1 -0
- package/esm/utils/FileTransfer.d.ts +15 -0
- package/esm/utils/FileTransfer.d.ts.map +1 -0
- package/esm/utils/FileTransfer.js +209 -0
- package/esm/utils/FileTransfer.js.map +1 -0
- package/esm/utils/Import.d.ts +211 -0
- package/esm/utils/Import.d.ts.map +1 -0
- package/esm/utils/Import.js +45 -0
- package/esm/utils/Import.js.map +1 -0
- package/esm/utils/Multipart.d.ts +27 -0
- package/esm/utils/Multipart.d.ts.map +1 -0
- package/esm/utils/Multipart.js +107 -0
- package/esm/utils/Multipart.js.map +1 -0
- package/esm/utils/Runtime.d.ts +37 -0
- package/esm/utils/Runtime.d.ts.map +1 -0
- package/esm/utils/Runtime.js +57 -0
- package/esm/utils/Runtime.js.map +1 -0
- package/esm/utils/Stream.d.ts +20 -0
- package/esm/utils/Stream.d.ts.map +1 -0
- package/esm/utils/Stream.js +360 -0
- package/esm/utils/Stream.js.map +1 -0
- package/esm/utils/WebSocket.d.ts +10 -0
- package/esm/utils/WebSocket.d.ts.map +1 -0
- package/esm/utils/WebSocket.js +22 -0
- package/esm/utils/WebSocket.js.map +1 -0
- package/package.json +20 -8
- package/src/CodeInterpreter.js.map +0 -1
- package/src/ComputerUse.js.map +0 -1
- package/src/Daytona.js.map +0 -1
- package/src/FileSystem.js.map +0 -1
- package/src/Git.js.map +0 -1
- package/src/Image.js.map +0 -1
- package/src/LspServer.js.map +0 -1
- package/src/ObjectStorage.js.map +0 -1
- package/src/Process.js.map +0 -1
- package/src/PtyHandle.js.map +0 -1
- package/src/Sandbox.js.map +0 -1
- package/src/Snapshot.js.map +0 -1
- package/src/Volume.js.map +0 -1
- package/src/code-toolbox/SandboxJsCodeToolbox.js.map +0 -1
- package/src/code-toolbox/SandboxPythonCodeToolbox.js.map +0 -1
- package/src/code-toolbox/SandboxTsCodeToolbox.js.map +0 -1
- package/src/errors/DaytonaError.js.map +0 -1
- package/src/index.js.map +0 -1
- package/src/types/Charts.js.map +0 -1
- package/src/types/CodeInterpreter.js.map +0 -1
- package/src/types/ExecuteResponse.js.map +0 -1
- package/src/types/Pty.js.map +0 -1
- package/src/utils/ArtifactParser.js.map +0 -1
- package/src/utils/Binary.js.map +0 -1
- package/src/utils/FileTransfer.js.map +0 -1
- package/src/utils/Import.js +0 -77
- package/src/utils/Import.js.map +0 -1
- package/src/utils/Multipart.js.map +0 -1
- package/src/utils/Runtime.js.map +0 -1
- package/src/utils/Stream.js.map +0 -1
- package/src/utils/WebSocket.js.map +0 -1
- /package/{src → cjs}/CodeInterpreter.js +0 -0
- /package/{src → cjs}/ComputerUse.js +0 -0
- /package/{src → cjs}/FileSystem.js +0 -0
- /package/{src → cjs}/Git.js +0 -0
- /package/{src → cjs}/LspServer.js +0 -0
- /package/{src → cjs}/ObjectStorage.js +0 -0
- /package/{src → cjs}/Process.js +0 -0
- /package/{src → cjs}/PtyHandle.js +0 -0
- /package/{src → cjs}/Volume.js +0 -0
- /package/{src → cjs}/code-toolbox/SandboxJsCodeToolbox.js +0 -0
- /package/{src → cjs}/code-toolbox/SandboxPythonCodeToolbox.js +0 -0
- /package/{src → cjs}/code-toolbox/SandboxTsCodeToolbox.js +0 -0
- /package/{src → cjs}/errors/DaytonaError.js +0 -0
- /package/{src → cjs}/index.js +0 -0
- /package/{src → cjs}/types/Charts.js +0 -0
- /package/{src → cjs}/types/CodeInterpreter.js +0 -0
- /package/{src → cjs}/types/ExecuteResponse.js +0 -0
- /package/{src → cjs}/types/Pty.js +0 -0
- /package/{src → cjs}/utils/ArtifactParser.js +0 -0
- /package/{src → cjs}/utils/Binary.js +0 -0
- /package/{src → cjs}/utils/FileTransfer.js +0 -0
- /package/{src → cjs}/utils/Multipart.js +0 -0
- /package/{src → cjs}/utils/Runtime.js +0 -0
- /package/{src → cjs}/utils/Stream.js +0 -0
- /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
|
package/esm/Git.d.ts.map
ADDED
|
@@ -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;IAO9D;;;;;;;;;OASG;IACU,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAKhE;;;;;;;;;OASG;IACU,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpE;;;;;;;;;OASG;IACU,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpE;;;;;;;;;OASG;IACU,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACU,KAAK,CAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC;IAWhB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACU,MAAM,CACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,OAAO,GACnB,OAAO,CAAC,iBAAiB,CAAC;IAa7B;;;;;;;;;;;;;;;;;;;OAmBG;IACU,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpF;;;;;;;;;;;;;;;;;;;OAmBG;IACU,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpF;;;;;;;;;;;;;;;;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":"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"}
|