Add cancellable operations and Abort support#6
Open
javisperez wants to merge 2 commits intomainfrom
Open
Conversation
Collaborator
javisperez
commented
May 8, 2026
- Introduce cancellable CLI operations and AbortSignal handling across the library.
- Added CancellablePromise type and cancellable(fn) helper in core/exec
- Extended runCommand to accept an AbortSignal (kills child with SIGTERM and rejects with AbortError), and exported CancellablePromise from the public API.
- Updated pack, pull and unpack to return CancellablePromise and wire cancellation into runCommand.
- Updated tests to cover AbortSignal behaviour and cancel() semantics, and adjusted existing tests to expect the signal argument.
- Bumped package version to 0.1.0.
Introduce cancellable CLI operations and AbortSignal handling across the library. Added CancellablePromise type and cancellable(fn) helper in core/exec, extended runCommand to accept an AbortSignal (kills child with SIGTERM and rejects with AbortError), and exported CancellablePromise from the public API. Updated pack, pull and unpack to return CancellablePromise and wire cancellation into runCommand. Updated tests to cover AbortSignal behaviour and cancel() semantics, and adjusted existing tests to expect the signal argument. Bumped package version to 0.1.0. Signed-off-by: Javis Pérez <javis@jozu.com>
There was a problem hiding this comment.
Pull request overview
Adds first-class cancellation support for long-running KitOps CLI operations by introducing a CancellablePromise abstraction, wiring AbortSignal through runCommand, and updating key command wrappers/tests accordingly.
Changes:
- Added
CancellablePromise<T>(public type) andcancellable(fn)helper to expose.cancel()on async operations. - Extended
runCommandto accept anAbortSignal, terminate the spawned child on abort, and reject accordingly. - Updated
pack,pull, andunpackto returnCancellablePromise<void>and adjusted/added tests; bumped package version to0.1.0.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/kitops.ts | Introduces the public CancellablePromise<T> type and documentation. |
| src/index.ts | Re-exports CancellablePromise from the public API surface. |
| src/core/exec.ts | Adds AbortSignal support to runCommand and implements cancellable() helper. |
| src/core/tests/exec.spec.ts | Adds tests covering abort semantics and cancellable() behavior. |
| src/commands/pack.ts | Returns CancellablePromise<void> and wires internal cancellation into runCommand. |
| src/commands/pull.ts | Returns CancellablePromise<void> and wires internal cancellation into runCommand. |
| src/commands/unpack.ts | Returns CancellablePromise<void> and wires internal cancellation into runCommand. |
| src/commands/tests/pack.spec.ts | Updates mocks/expectations for the new AbortSignal argument and .cancel(). |
| src/commands/tests/pull.spec.ts | Updates mocks/expectations for the new AbortSignal argument and .cancel(). |
| src/commands/tests/unpack.spec.ts | Updates mocks/expectations for the new AbortSignal argument and .cancel(). |
| package.json | Version bump to 0.1.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Javis Pérez <javis@jozu.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.