refactor: integrate @doist/cli-core 0.7.1 (update command)#321
Merged
Conversation
Replace the local `td update` / `td update switch` implementation with `registerUpdateCommand` from `@doist/cli-core/commands`. The shared command brings strict channel validation (`INVALID_UPDATE_CHANNEL`), canonical `CliError` codes (`INVALID_FLAGS`, `UPDATE_CHECK_FAILED`, `UPDATE_INSTALL_FAILED`), and `--json` / `--ndjson` envelopes — behaviour already covered by 34 cli-core tests, so the local action/switch/test files are dropped. `src/lib/update.ts` keeps a tolerant `getConfiguredUpdateChannel` for `td doctor` (so an invalid `update_channel` surfaces as a config-validation warning rather than a hard error) and re-exports the semver helpers from cli-core. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
doistbot
reviewed
May 9, 2026
Member
doistbot
left a comment
There was a problem hiding this comment.
This PR nicely integrates @doist/cli-core 0.7.0 by delegating the update command logic to the core library, successfully dropping a substantial amount of custom code. Leveraging the shared command improves maintainability while introducing stricter validation and helpful new JSON output options. A couple of minor details to address include updating SKILL_CONTENT to document the new JSON flags and retaining a lightweight local test to verify the repo-specific command wiring.
Picks up the dist-tag fetch fix (Doist/cli-core#10) — `td update` was failing with `UPDATE_CHECK_FAILED: HTTP 406` because cli-core 0.7.0 sent the abbreviated-metadata `Accept` header on a dist-tag URL, which the npm registry rejects. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Document `td update --check --json` and `td update switch --pre-release --json` in SKILL_CONTENT (per AGENTS.md: any new flag must reach the agent skill). - Add a thin wrapper test covering what cli-core's tests can't see — that `registerUpdateCommand` forwards the right `packageName`, `currentVersion`, `configPath`, `changelogCommandName`, and `withSpinner` to cli-core, plus one parse-level smoke that drives `td update --check` end-to-end against a stubbed `fetch` and asserts the resolved registry URL matches `package.json#name`. Addresses review on #321. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 10, 2026
Contributor
|
🎉 This PR is included in version 1.62.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Summary
@doist/cli-coreto0.7.1and replace the localtd update/td update switchimplementation withregisterUpdateCommandfrom@doist/cli-core/commands(cli-core#9)src/lib/update.tsshrinks to a thin re-export of cli-core's semver helpers plus a tolerantgetConfiguredUpdateChannelfortd doctor(so an invalidupdate_channelsurfaces as a config-validation warning rather than a hard error)packageNamenow comes frompackage.jsoninstead of being hard-codedBehaviour change
Production
td updateis now stricter:update_channelin config raisesINVALID_UPDATE_CHANNELinstead of being silently passed throughCliErrorcodes (INVALID_FLAGS,UPDATE_CHECK_FAILED,UPDATE_INSTALL_FAILED)--json/--ndjsonenvelopesTest plan
npm run checkcleannpm run type-checkcleannpm test— 1556 tests passtd update --check,td update --check --json,td update --channel,td update switch --pre-release,td update switch --stabletd doctorwith valid + invalidupdate_channelin config🤖 Generated with Claude Code