Skip to content

refactor: delegate ol update to @doist/cli-core/commands#68

Merged
scottlovegrove merged 2 commits into
mainfrom
scottl/cli-core-3
May 11, 2026
Merged

refactor: delegate ol update to @doist/cli-core/commands#68
scottlovegrove merged 2 commits into
mainfrom
scottl/cli-core-3

Conversation

@scottlovegrove
Copy link
Copy Markdown
Contributor

Summary

Mirrors twist-cli #214. cli-core 0.9.0 owns the registry fetch, package-manager detection, install spawn, channel switch, and --json/--ndjson envelopes. outline provides the package name, version, config path, changelog hint, and spinner runner.

PR 3 of a 3-PR stack — stacked on #67:

  1. refactor: Start integrating @doist/cli-core #66 — cli-core wiring (errors, config, spinner, output, markdown)
  2. refactor: delegate global-args + ViewOptions + empty-test helper to @doist/cli-core #67 — global-args + ViewOptions + empty-output test helper
  3. This PR — delegate ol update to cli-core/commands

Changes

  • src/commands/update/index.ts now forwards to cli-core's registerUpdateCommand with { packageName, currentVersion, configPath, changelogCommandName: 'ol changelog', withSpinner }.
  • Delete src/commands/update/action.ts (203 lines) and src/commands/update/switch.ts (37 lines) — cli-core owns both.
  • Delete src/lib/update-config.ts (12 lines) — cli-core reads/writes update_channel directly via the config path we hand it.
  • src/__tests__/update.test.ts slims to a wrapper test (option forwarding). ~400 lines of behaviour tests removed — covered upstream by cli-core's update suite.
  • src/lib/skills/content.ts documents the new --json flag on ol update --check; skills/outline-cli/SKILL.md regenerated.

Net: 37 insertions / 710 deletions across 7 files.

Behaviour changes (mirroring twist-cli #214)

  • Invalid update_channel on disk surfaces as INVALID_UPDATE_CHANNEL from ol update (was silently coerced to stable).
  • Errors emit canonical cli-core codes (INVALID_FLAGS, UPDATE_CHECK_FAILED, UPDATE_INSTALL_FAILED).
  • Both subcommands accept --json / --ndjson envelopes.

Test plan

  • npm run type-check
  • npm run lint:check — 0 warnings, 0 errors
  • npm test — 103 tests pass
  • npm run build && npm run sync:skill && npm run check:skill-sync — SKILL.md in sync
  • Smoke ol update --channel — reports stable
  • Smoke ol update --check — reports current vs latest with channel line
  • Smoke ol update --check --json — single-record JSON envelope
  • Manual ol update switch --pre-release then ol update switch --stable — flips on-disk update_channel

🤖 Generated with Claude Code

@scottlovegrove scottlovegrove self-assigned this May 11, 2026
Copy link
Copy Markdown
Member

@doistbot doistbot left a comment

Choose a reason for hiding this comment

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

This PR significantly slims down the repository by successfully delegating the ol update command logic, configuration, and formatting to @doist/cli-core. Offloading these responsibilities is a great step that improves maintainability by centralizing the update behavior and error handling. A few minor adjustments are needed to ensure the skill documentation fully reflects the new --ndjson support, and to tighten the test suite by adding integration assertions for the CLI surface and strictly verifying the forwarded configuration values.

Share FeedbackReview Logs

Comment thread src/lib/skills/content.ts
Comment thread src/__tests__/update.test.ts
Comment thread src/__tests__/update.test.ts Outdated
scottlovegrove added a commit that referenced this pull request May 11, 2026
- Add `ol update --check --ndjson` example to skill content (and regen
  skills/outline-cli/SKILL.md) so the documented surface matches the
  flags cli-core actually exposes.
- Tighten update wrapper test: assert exact `currentVersion` from
  package.json and exact `withSpinner` reference (instead of `typeof`
  smoke checks).
- Add `update-surface.test.ts` integration test that registers the
  command against a real `@doist/cli-core/commands` (no mock) and
  asserts `update` exposes `--check` / `--channel` and `update switch`
  exposes `--stable` / `--pre-release`, so a cli-core bump can't
  silently change the local CLI surface.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Base automatically changed from scottl/cli-core-2 to main May 11, 2026 14:55
scottlovegrove and others added 2 commits May 11, 2026 15:56
Mirrors twist-cli #214. cli-core 0.9.0 owns the registry fetch, package-
manager detection, install spawn, channel switch, and `--json`/`--ndjson`
envelopes. outline provides the package name, version, config path,
changelog hint, and spinner runner.

- `src/commands/update/index.ts` now forwards to cli-core's
  `registerUpdateCommand` with `{ packageName, currentVersion, configPath,
  changelogCommandName: 'ol changelog', withSpinner }`.
- Delete `src/commands/update/action.ts` (203 lines) and
  `src/commands/update/switch.ts` (37 lines) — cli-core owns both.
- Delete `src/lib/update-config.ts` (12 lines) — cli-core reads/writes
  `update_channel` directly via the config path we hand it.
- `src/__tests__/update.test.ts` slims to a wrapper test (option
  forwarding). ~400 lines of behaviour tests removed — covered upstream by
  cli-core's update suite.
- `src/lib/skills/content.ts` documents the new `--json` flag on
  `ol update --check`; `skills/outline-cli/SKILL.md` regenerated.

## Behaviour changes (mirroring twist-cli #214)

- Invalid `update_channel` on disk surfaces as `INVALID_UPDATE_CHANNEL`
  from `ol update` (was silently coerced to stable).
- Errors emit canonical cli-core codes (`INVALID_FLAGS`,
  `UPDATE_CHECK_FAILED`, `UPDATE_INSTALL_FAILED`).
- Both subcommands accept `--json` / `--ndjson` envelopes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add `ol update --check --ndjson` example to skill content (and regen
  skills/outline-cli/SKILL.md) so the documented surface matches the
  flags cli-core actually exposes.
- Tighten update wrapper test: assert exact `currentVersion` from
  package.json and exact `withSpinner` reference (instead of `typeof`
  smoke checks).
- Add `update-surface.test.ts` integration test that registers the
  command against a real `@doist/cli-core/commands` (no mock) and
  asserts `update` exposes `--check` / `--channel` and `update switch`
  exposes `--stable` / `--pre-release`, so a cli-core bump can't
  silently change the local CLI surface.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@scottlovegrove scottlovegrove requested review from a team and nvignola and removed request for a team May 11, 2026 14:58
@scottlovegrove scottlovegrove added the 👀 Show PR PR must be reviewed before or after merging label May 11, 2026
@scottlovegrove scottlovegrove merged commit 7acbaa1 into main May 11, 2026
4 checks passed
@scottlovegrove scottlovegrove deleted the scottl/cli-core-3 branch May 11, 2026 14:58
@doist-release-bot
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.5.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nvignola
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released 👀 Show PR PR must be reviewed before or after merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants