Skip to content

feat: support custom version class override#1574

Open
binoy14 wants to merge 1 commit intooclif:mainfrom
binoy14:feat/version-class-override
Open

feat: support custom version class override#1574
binoy14 wants to merge 1 commit intooclif:mainfrom
binoy14:feat/version-class-override

Conversation

@binoy14
Copy link
Copy Markdown

@binoy14 binoy14 commented Apr 10, 2026

Summary

Adds support for a versionClass option in pjson.oclif, allowing CLI authors to provide a custom version class that controls
--version output. This mirrors the existing helpClass override pattern.

  • New VersionBase abstract class and default Version implementation in src/version.ts
  • loadVersionClass loader that resolves custom classes via string path or {target, identifier} config
  • Both --version flag (src/flags.ts) and run() entrypoint (src/main.ts) now use the loader
  • Renamed HelpLocationOptions to ClassLocationOptions since it's now shared (deprecated alias kept)
  • Exported VersionBase, Version, and loadVersionClass from public API

Usage

{
  "oclif": {
    "versionClass": "./src/my-version"
  }                                                                                                                                      
}

Or with a named export:

  {
    "oclif": {
      "versionClass": {
        "target": "./src/my-version",                                                                                                      
        "identifier": "MyVersion"
      }                                                                                                                                    
    }                                                                                          
  }

@git2gus
Copy link
Copy Markdown

git2gus Bot commented Apr 10, 2026

Git2Gus App is installed but the .git2gus/config.json doesn't have right values. You should add the required configuration.

@salesforce-cla
Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @binoy14 to sign the Salesforce Inc. Contributor License Agreement.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant