Extend cancellable operations#8
Open
javisperez wants to merge 3 commits into
Open
Conversation
Signed-off-by: Javis Pérez <javis@jozu.com>
Signed-off-by: Javis Pérez <javis@jozu.com>
88e723f to
da44ced
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends the cancellable-operation pattern across the remaining KitOps command wrappers, updates tests accordingly, refreshes documentation to describe CancellablePromise/cancellation behavior, and bumps the package version to 0.2.0.
Changes:
- Convert command wrappers to return
CancellablePromise<T>via the sharedcancellable()helper and pass anAbortSignalintorunCommand. - Update Vitest mocks/assertions to account for the new
runCommand(..., { signal })calling convention and add cancellation-focused tests for some commands. - Update README + docs to describe cancellation semantics and revise API signatures/examples.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/commands/version.ts | Wrap version() in cancellable() and pass an AbortSignal into runCommand. |
| src/commands/tag.ts | Wrap tag() in cancellable() and pass an AbortSignal into runCommand. |
| src/commands/remove.ts | Wrap remove() in cancellable(); add new removeAll() helper using --all. |
| src/commands/push.ts | Wrap push() in cancellable() and pass an AbortSignal into runCommand. |
| src/commands/logout.ts | Wrap logout() in cancellable() and pass an AbortSignal into runCommand. |
| src/commands/login.ts | Wrap login()/loginUnsafe() in cancellable() and pass an AbortSignal into runCommand. |
| src/commands/list.ts | Wrap list() in cancellable(), add signal support, and branch on output format. |
| src/commands/kit.ts | Wrap low-level kit() in cancellable() and inject signal into forwarded options. |
| src/commands/inspect.ts | Wrap inspect() in cancellable() and pass an AbortSignal into runCommand. |
| src/commands/init.ts | Wrap init() in cancellable() and pass an AbortSignal into runCommand. |
| src/commands/info.ts | Wrap info() in cancellable() and pass an AbortSignal into runCommand. |
| src/commands/diff.ts | Wrap diff() in cancellable() and pass an AbortSignal into runCommand. |
| src/commands/tests/version.spec.ts | Update mocks to preserve real exports; assert signal is provided to runCommand. |
| src/commands/tests/tag.spec.ts | Update mocks and runCommand expectations to include signal. |
| src/commands/tests/remove.spec.ts | Update mocks and runCommand expectations to include signal; add/removeAll coverage. |
| src/commands/tests/push.spec.ts | Update mocks/expectations; add tests for CancellablePromise shape and cancel() aborting. |
| src/commands/tests/logout.spec.ts | Update mocks and runCommand expectations to include signal. |
| src/commands/tests/login.spec.ts | Update mocks and runCommand expectations to include signal. |
| src/commands/tests/list.spec.ts | Update mocks and runCommand expectations to include signal. |
| src/commands/tests/kit.spec.ts | Update mocks/expectations; add tests for CancellablePromise shape and cancel() aborting. |
| src/commands/tests/inspect.spec.ts | Update mocks and runCommand expectations to include signal. |
| src/commands/tests/init.spec.ts | Update mocks and runCommand expectations to include signal; ensure runCommand resolves in setup. |
| src/commands/tests/info.spec.ts | Update mocks and runCommand expectations to include signal. |
| src/commands/tests/diff.spec.ts | Update mocks and runCommand expectations to include signal. |
| README.md | Document CancellablePromise, add cancellation section/examples, and refresh several API examples. |
| package.json | Bump version to 0.2.0. |
| docs/types.md | Document CancellablePromise and update various anchor references/signatures. |
| docs/index.md | Add brief note and example for cancellation usage. |
| docs/getting-started.md | Add cancellation section and update error-handling example to account for aborts. |
| docs/examples.md | Update inspect example signature; add cancellation-with-timeout and SIGINT examples. |
| docs/api-reference.md | Update API reference to CancellablePromise and add/remove/update command signatures & cancellation docs. |
💡 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.
This PR extends the cancellable operations to all the kit commands in the kitops-ts library.
It also updates the docs to reflect this approach and bumps the version to 0.2.0