Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build-package-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ jobs:

- name: Run build package test
run: yarn test:built-package

12 changes: 6 additions & 6 deletions src/sdk/devbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ export class DevboxCmdOps {
* ```
*
* @param {string} command - The command to execute
* @param {Omit<DevboxExecuteParams, 'command'> & ExecuteStreamingCallbacks} [params] - Optional parameters including shell name and callbacks
* @param {Omit<DevboxExecuteParams, 'command' | 'command_id'> & ExecuteStreamingCallbacks} [params] - Optional parameters including shell name and callbacks
* @param {Core.RequestOptions & { polling?: Partial<PollingOptions<DevboxAsyncExecutionDetailView>> }} [options] - Request options with optional polling configuration
* @returns {Promise<ExecutionResult>} {@link ExecutionResult} with stdout, stderr, and exit status
*/
async exec(
command: string,
params?: Omit<DevboxExecuteParams, 'command'> & ExecuteStreamingCallbacks,
params?: Omit<DevboxExecuteParams, 'command' | 'command_id'> & ExecuteStreamingCallbacks,
options?: Core.RequestOptions & { polling?: Partial<PollingOptions<DevboxAsyncExecutionDetailView>> },
): Promise<ExecutionResult> {
const fullParams = { ...params, command };
Expand Down Expand Up @@ -325,13 +325,13 @@ export class DevboxNamedShell {
* ```
*
* @param {string} command - The command to execute
* @param {Omit<Omit<DevboxExecuteParams, 'command'>, 'shell_name'> & ExecuteStreamingCallbacks} [params] - Optional parameters (shell_name is automatically set)
* @param {Omit<DevboxExecuteParams, 'command' | 'command_id' | 'shell_name'> & ExecuteStreamingCallbacks} [params] - Optional parameters (shell_name is automatically set)
* @param {Core.RequestOptions & { polling?: Partial<PollingOptions<DevboxAsyncExecutionDetailView>> }} [options] - Request options with optional polling configuration
* @returns {Promise<ExecutionResult>} {@link ExecutionResult} with stdout, stderr, and exit status
*/
async exec(
command: string,
params?: Omit<Omit<DevboxExecuteParams, 'command'>, 'shell_name'> & ExecuteStreamingCallbacks,
params?: Omit<DevboxExecuteParams, 'command' | 'command_id' | 'shell_name'> & ExecuteStreamingCallbacks,
options?: Core.RequestOptions & { polling?: Partial<PollingOptions<DevboxAsyncExecutionDetailView>> },
): Promise<ExecutionResult> {
return this.devbox.cmd.exec(command, { ...params, shell_name: this.shellName }, options);
Expand Down Expand Up @@ -367,13 +367,13 @@ export class DevboxNamedShell {
* ```
*
* @param {string} command - The command to execute
* @param {Omit<Omit<DevboxExecuteAsyncParams, 'command'>, 'shell_name'> & ExecuteStreamingCallbacks} [params] - Optional parameters (shell_name is automatically set)
* @param {Omit<DevboxExecuteAsyncParams, 'command' | 'shell_name'> & ExecuteStreamingCallbacks} [params] - Optional parameters (shell_name is automatically set)
* @param {Core.RequestOptions} [options] - Request options
* @returns {Promise<Execution>} {@link Execution} object for tracking and controlling the command
*/
async execAsync(
command: string,
params?: Omit<Omit<DevboxExecuteAsyncParams, 'command'>, 'shell_name'> & ExecuteStreamingCallbacks,
params?: Omit<DevboxExecuteAsyncParams, 'command' | 'shell_name'> & ExecuteStreamingCallbacks,
options?: Core.RequestOptions,
): Promise<Execution> {
return this.devbox.cmd.execAsync(command, { ...params, shell_name: this.shellName }, options);
Expand Down
9 changes: 9 additions & 0 deletions src/sdk/execution-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ export class ExecutionResult {
return this._result.exit_status ?? null;
}

/**
* Get the unique ID identifying this execution.
*
* @returns string A UUIDv7 execution ID
*/
get executionId(): string {
return this._executionId;
}

/**
* Helper to get last N lines, filtering out trailing empty strings.
*
Expand Down
33 changes: 1 addition & 32 deletions tests/smoketests/object-oriented/devbox.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { toFile } from '@runloop/api-client';
import { Devbox } from '@runloop/api-client/sdk';
import { makeClientSDK, THIRTY_SECOND_TIMEOUT, uniqueName } from '../utils';
import { uuidv7 } from 'uuidv7';

const sdk = makeClientSDK();

Expand Down Expand Up @@ -798,38 +799,6 @@ describe('smoketest: object-oriented devbox', () => {
expect(output2).toContain('/home');
});

test('shell.exec - with additional params passed through', async () => {
expect(devbox).toBeDefined();
const shell = devbox.shell('test-shell-params');

// Test that additional params (like working_dir) are passed through correctly
// Note: shell_name should override any shell_name in params
const result = await shell.exec('pwd', {
working_dir: '/tmp',
});

expect(result.exitCode).toBe(0);
const output = (await result.stdout()).trim();
// Should be in /tmp due to working_dir param
expect(output).toBe('/tmp');
});

test('shell.execAsync - with additional params passed through', async () => {
expect(devbox).toBeDefined();
const shell = devbox.shell('test-shell-async-params');

// Test that additional params are passed through correctly
const execution = await shell.execAsync('pwd', {
working_dir: '/home',
});

const result = await execution.result();
expect(result.exitCode).toBe(0);
const output = (await result.stdout()).trim();
// Should be in /home due to working_dir param
expect(output).toBe('/home');
});

test('shell.exec - with stderr streaming callback', async () => {
expect(devbox).toBeDefined();
const shell = devbox.shell('test-shell-stderr');
Expand Down
Loading