feat(io): centralize shared IO utilities - #1832
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #1832 +/- ##
============================================
+ Coverage 94.85% 94.89% +0.04%
============================================
Files 149 151 +2
Lines 7360 7421 +61
============================================
+ Hits 6981 7042 +61
Misses 379 379 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jariy17
left a comment
There was a problem hiding this comment.
Overall, great CR! Left a few comments. Can we also update the README.md about this new SourceResolver so our agents try to use this?
| signal?: AbortSignal; | ||
| }; | ||
|
|
||
| export class SourceResolutionError extends TypeError { |
There was a problem hiding this comment.
Did we discuss about making all Errors, "AgentCoreErrors"? If so, we need to change this after @Hweinstock merges the AgentCore PR.
|
|
||
| test("preserves AbortError from file resolution", async () => { | ||
| const path = await tempFile("payload"); | ||
| const controller = new AbortController(); |
There was a problem hiding this comment.
Can we update this test to abort after the file read starts? Aborting before resolveBytes() means throwIfAborted() exits early, so this never verifies that the signal reaches readFile().
96cff8a to
255362b
Compare
Description
This PR introduces a shared
src/iopackage for CLI input and output concerns:AppIO,ReadWriteJson, andFsReadWriteJsonintosrc/ioand migrates existing consumers.SourceResolverfor inline values,file://sources, and stdin, with byte and strict UTF-8 text resolution.SourceResolutionErrorfailures.AbortSignalcancellation for file and stdin reads, following the cancellation behavior introduced in feat(runtime): add Runtime invoke command #1820.The
iopackage has no dependency on handlers or global config. Existing exports were removed rather than temporarily re-exported so dependent PRs can rebase onto the intended package boundary.Related Issue
N/A - this is maintainer-coordinated refactor work and does not have an associated issue.
Documentation PR
N/A
Type of Change
Testing
How have you tested the change?
bun test(345 passed, 0 failed)bun run typecheckbun run lint:checkbun run format:checkbun run buildsrc/assets/was not modified, so snapshots do not require updatesChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.