Skip to content

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Dec 24, 2025

Summary

Removes unused utility functions from both CLI packages (pgpm/cli and packages/cli) that were defined but never called anywhere in the codebase.

Removed from pgpm/cli/src/utils/argv.ts:

  • ValidatedArgv interface
  • validateCommonArgs(), validateFlagDependencies(), logEffectiveArgs(), constructTarget() functions
  • Associated Logger import (no longer needed)

Removed from both display.ts files:

  • displayVersion() and displayUsage() functions
  • Associated imports (findAndRequirePackageJson, yanse)

The actively-used exports (extractFirst, usageText) are preserved.

Updates since last revision

Refactored version handling in both CLI entry points (pgpm/cli/src/index.ts and packages/cli/src/index.ts) to use findAndRequirePackageJson instead of manual readFileSync + JSON.parse. This provides more robust package.json resolution and aligns with how version is handled elsewhere in the codebase (e.g., in commands.ts).

Review & Testing Checklist for Human

  • Breaking change check: Verify no external packages or downstream consumers depend on the removed exports (displayVersion, displayUsage, validateCommonArgs, ValidatedArgv, etc.) - these were part of the public API via export * from './utils'
  • Test pgpm --version and cnc --version to confirm they output the correct version
  • Test pgpm --help and cnc --help to confirm CLI still works correctly

Recommended test plan:

# Build both packages
pnpm --filter pgpm run build
pnpm --filter @constructive-io/cli run build

# Test version commands
node pgpm/cli/dist/index.js --version
node packages/cli/dist/index.js --version

# Test help commands
node pgpm/cli/dist/index.js --help
node packages/cli/dist/index.js --help

Notes

These functions appear to be AI-generated code that was never integrated into the actual CLI flow. The user specifically requested cleanup of "AI slop" that hadn't been cleaned up.

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

Remove unused code from pgpm/cli and packages/cli:

- pgpm/cli/src/utils/argv.ts: Remove ValidatedArgv interface and unused
  functions (validateCommonArgs, validateFlagDependencies, logEffectiveArgs,
  constructTarget). Keep only extractFirst which is actively used.

- pgpm/cli/src/utils/display.ts: Remove unused displayVersion and
  displayUsage functions. Keep only usageText which is actively used.

- packages/cli/src/utils/display.ts: Remove unused displayVersion and
  displayUsage functions. Keep only usageText which is actively used.

These functions were defined but never called anywhere in the codebase.

Co-Authored-By: Dan Lynch <[email protected]>
@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

Replace manual readFileSync + JSON.parse with findAndRequirePackageJson
for more robust package.json resolution in both CLI entry points.

Co-Authored-By: Dan Lynch <[email protected]>
@devin-ai-integration devin-ai-integration bot changed the title chore: remove unused CLI utility functions chore: remove unused CLI utility functions and improve version handling Dec 25, 2025
@pyramation pyramation closed this Dec 25, 2025
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