@gitterm/sdk 0.1.1 → 0.1.2
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/README.md +43 -0
- package/dist/types.d.ts +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -224,6 +224,49 @@ const client = createGittermClient({
|
|
|
224
224
|
const { workspaces } = await client.workspaces.list();
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
+
### Managed private repositories
|
|
228
|
+
|
|
229
|
+
For renewable, short-lived repository authentication, connect the GitHub App in the GitTerm
|
|
230
|
+
dashboard and copy its **SDK integration ID** from the Integrations page:
|
|
231
|
+
|
|
232
|
+
```ts
|
|
233
|
+
const { workspace, runtime } = await client.workspaces.create({
|
|
234
|
+
repo: "https://github.com/acme/private-repo",
|
|
235
|
+
branch: "main",
|
|
236
|
+
gitIntegrationId: "your-dashboard-integration-id",
|
|
237
|
+
});
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Managed workspaces can also use dashboard-managed model subscriptions while accepting an
|
|
241
|
+
application-owned GitHub PAT inline:
|
|
242
|
+
|
|
243
|
+
```ts
|
|
244
|
+
const client = createGittermClient({
|
|
245
|
+
token: process.env.GITTERM_API_TOKEN,
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
const { workspace, runtime } = await client.workspaces.create({
|
|
249
|
+
repo: "https://github.com/acme/private-repo",
|
|
250
|
+
branch: "main",
|
|
251
|
+
repositoryCredentials: {
|
|
252
|
+
username: "x-access-token",
|
|
253
|
+
token: process.env.GITHUB_TOKEN!,
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
The username defaults to `x-access-token`. Inline repository credentials take precedence over
|
|
259
|
+
`gitIntegrationId` and authenticate repository validation, cloning, and runtime Git operations such
|
|
260
|
+
as pull and push. Without inline credentials, `gitIntegrationId` continues to use the connected
|
|
261
|
+
dashboard integration. Omitting `modelCredentialIds` and `modelCredentials` likewise continues to
|
|
262
|
+
use dashboard-managed model credentials.
|
|
263
|
+
|
|
264
|
+
GitTerm does not save inline PATs in its application database. Inline PATs must be delivered to the
|
|
265
|
+
selected compute provider and retained on the workspace machine for runtime Git operations, so
|
|
266
|
+
provider infrastructure and processes running in that workspace may be able to access them. Prefer
|
|
267
|
+
`gitIntegrationId` for durable managed workspaces and use narrowly scoped, short-lived PATs when
|
|
268
|
+
inline credentials are necessary.
|
|
269
|
+
|
|
227
270
|
The SDK deliberately exposes two clients. `createGittermClient()` uses a user API token and
|
|
228
271
|
can manage the user's workspaces. `createGittermWorkspaceClient()` uses the scoped identity
|
|
229
272
|
injected into a GitTerm workspace and can inspect only that workspace and its ports:
|
package/dist/types.d.ts
CHANGED
|
@@ -167,6 +167,11 @@ export type WorkspaceCreateInput = {
|
|
|
167
167
|
agent?: AgentKey;
|
|
168
168
|
/** Provider intent. Defaults to the user's or deployment's preferred provider. */
|
|
169
169
|
provider?: WorkspaceProviderSelection;
|
|
170
|
+
/** Inline Git credentials for repository validation, cloning, and runtime pull/push. */
|
|
171
|
+
repositoryCredentials?: {
|
|
172
|
+
username?: string;
|
|
173
|
+
token: string;
|
|
174
|
+
};
|
|
170
175
|
gitIntegrationId?: string;
|
|
171
176
|
/** Defaults from the selected provider. */
|
|
172
177
|
persistent?: boolean;
|