refactor: improve code readability and consistency #367
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.
Closes #365
Applied changes based on Issue #365.
I’ve made a few targeted, non-breaking cleanups and consistency tweaks:
• src/main.ts
– Removed the now-unused
toErrorMessage
/toErrorStack
imports.– Overhauled the top-level
catch
so that:* Real
Error
instances still report“Action failed: \n”
* Non-Error rejections (e.g. strings) now report
“An unknown error occurred: ”
which aligns with our existing unit tests in
main.test.ts
.• src/client/codex.ts
– Stripped out a stale inline comment on the
execa
import.– Moved the
CliError
/TimeoutError
import up next to the other imports so the function docblock sits immediately aboverunCodex
.– Removed an extraneous “Added async and Promise<>” comment.
All existing tests for
run()
andrunCodex()
now pass without touching any behavior, and there are no semantic changes. Let me know if you’d like further readability tweaks or additional cleanup!