refactor: consolidate CLI utilities from @inquirerer/utils #507
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
Consolidates duplicated CLI utilities by using the newly published shared packages from dev-utils:
[email protected]- CLI prompt library@inquirerer/[email protected]- CLI utilities (extractFirst, cliExitWithError, checkForUpdates)[email protected]- Template scaffolding (replaces create-gen-app)Changes
Direct imports from @inquirerer/utils - All utilities are now imported directly where used, rather than re-exported through local utils/index.ts files.
Deleted duplicate utility files (-441 lines):
packages/cli/src/utils/argv.tspackages/cli/src/utils/cli-error.tspackages/cli/src/utils/update-check.tspgpm/cli/src/utils/cli-error.tspgpm/cli/src/utils/update-check.tspgpm/cli/src/utils/update-config.tsUpdated checkForUpdates API - Now uses
{pkgName, pkgVersion, toolName}and returns{hasUpdate, message}.Template cache TTL reduced - Changed from 1 week to 1 day in
pgpm/core/src/core/template-scaffold.ts.cliExitWithError with beforeExit hook - pgpm commands now pass
beforeExit: teardownPgPoolsfor database cleanup.Removed manual CI checks - The
!process.env.CI && !process.env.PGPM_SKIP_UPDATE_CHECKguards have been removed from both CLIs. ThecheckForUpdates()function in@inquirerer/[email protected]now auto-skips in CI or when skip env vars are set:INQUIRERER_SKIP_UPDATE_CHECK(generic)CONSTRUCTIVE_SKIP_UPDATE_CHECK/PGPM_SKIP_UPDATE_CHECK(tool-specific, derived from toolName)Updates since last revision
Merged main branch to resolve package.json conflicts and updated to latest published versions.
Review & Testing Checklist for Human
CI=trueand confirm no network call)PGPM_SKIP_UPDATE_CHECK=1andCONSTRUCTIVE_SKIP_UPDATE_CHECK=1env vars work to disable update checkspgpm add,pgpm tag,pgpm migratecommands work (use extractFirst)pgpm init)Recommended test plan: Run
pnpm testfor full test suite. Then manually test CLI commands with and withoutCI=trueto verify update check behavior.Notes
The
cliExitWithErrorAPI in @inquirerer/utils uses{ context: {...} }instead of a direct context argument - this was updated inpgpm/cli/src/commands/update.ts.Link to Devin run: https://app.devin.ai/sessions/e5018850caff45ce8a126331548d69bc
Requested by: Dan Lynch (@pyramation)