Skip to content

Extend cancellable operations#8

Open
javisperez wants to merge 3 commits into
mainfrom
extend-cancellable-operations
Open

Extend cancellable operations#8
javisperez wants to merge 3 commits into
mainfrom
extend-cancellable-operations

Conversation

@javisperez
Copy link
Copy Markdown
Collaborator

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

Signed-off-by: Javis Pérez <javis@jozu.com>
Signed-off-by: Javis Pérez <javis@jozu.com>
@javisperez javisperez force-pushed the extend-cancellable-operations branch from 88e723f to da44ced Compare May 20, 2026 15:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 shared cancellable() helper and pass an AbortSignal into runCommand.
  • 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.

Comment thread src/commands/remove.ts
Comment thread src/commands/remove.ts Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md Outdated
Comment thread docs/getting-started.md Outdated
Comment thread docs/api-reference.md
Comment thread docs/types.md
Comment thread src/commands/kit.ts Outdated
Signed-off-by: Javis Pérez <javis@jozu.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants