Skip to content

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Dec 27, 2025

Summary

Consolidates duplicated CLI utilities by using the newly published shared packages from dev-utils:

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.ts
  • packages/cli/src/utils/cli-error.ts
  • packages/cli/src/utils/update-check.ts
  • pgpm/cli/src/utils/cli-error.ts
  • pgpm/cli/src/utils/update-check.ts
  • pgpm/cli/src/utils/update-config.ts

Updated 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: teardownPgPools for database cleanup.

Removed manual CI checks - The !process.env.CI && !process.env.PGPM_SKIP_UPDATE_CHECK guards have been removed from both CLIs. The checkForUpdates() 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

  • Verify update check is skipped in CI (set CI=true and confirm no network call)
  • Verify PGPM_SKIP_UPDATE_CHECK=1 and CONSTRUCTIVE_SKIP_UPDATE_CHECK=1 env vars work to disable update checks
  • Test pgpm add, pgpm tag, pgpm migrate commands work (use extractFirst)
  • Test error handling in pgpm commands - ensure database connections are cleaned up on error (beforeExit hook)
  • Confirm template scaffolding still works with 1-day cache TTL (run pgpm init)

Recommended test plan: Run pnpm test for full test suite. Then manually test CLI commands with and without CI=true to verify update check behavior.

Notes

The cliExitWithError API in @inquirerer/utils uses { context: {...} } instead of a direct context argument - this was updated in pgpm/cli/src/commands/update.ts.

Link to Devin run: https://app.devin.ai/sessions/e5018850caff45ce8a126331548d69bc
Requested by: Dan Lynch (@pyramation)

- Update package.json dependencies to use [email protected], @inquirerer/[email protected], [email protected]
- Replace local extractFirst() with @inquirerer/utils export
- Update create-gen-app imports to use genomic for scaffolding
- Delete duplicated argv.ts files from packages/cli and pgpm/cli
- Update direct imports to use utils index re-exports
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

- Import extractFirst, cliExitWithError, checkForUpdates directly from @inquirerer/utils
- Update checkForUpdates calls to use new API (pkgName, pkgVersion, toolName)
- Update cliExitWithError calls to use beforeExit hook for pgpm cleanup
- Reduce template cache TTL from 1 week to 1 day
- Delete local duplicate utility files (cli-error.ts, update-check.ts, update-config.ts)
- Remove re-exports from utils/index.ts files
checkForUpdates() 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)
Resolved conflicts in package.json files and updated to latest published versions:
- @inquirerer/utils@^3.1.1
- inquirerer@^4.1.1
- genomic@^5.0.2
@pyramation pyramation merged commit 8ff3c19 into main Dec 27, 2025
34 checks passed
@pyramation pyramation deleted the devin/1766800351-consolidate-cli-utils branch December 27, 2025 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants