Summary
There's no top-level capcut --version / capcut -v to print the installed CLI version. Note that the existing capcut version subcommand does something different — it inspects a draft's CapCut/JianYing support status, not the package version. A standard --version flag is what users and bug reports expect.
What to do
In src/index.ts, handle --version / -v as a global flag before command dispatch (the command is read as positional[0] after flag parsing). Print the version from package.json and exit 0.
- Resolve
package.json relative to the compiled entry point. The file already computes a cliDir (used to locate templates/_init); reuse that to read ../package.json so it works from dist/.
- Add a
-v, --version line to the HELP constant near the top of src/index.ts.
Example:
Acceptance
capcut --version and capcut -v both print the package version and exit 0.
- Doesn't collide with the existing
version subcommand (that keeps its current draft-support behavior).
- Add a test under
test/ following the existing *.test.mjs pattern (helpers in test/helpers/).
- Update
README.md / docs/ usage.
Pointers (verified against master)
- Single entry point
src/index.ts (TypeScript → dist/); no src/commands/ dir.
HELP constant ~line 81; command dispatch reads const cmd = positional[0].
cliDir is already used for bundled-template resolution — reuse for package.json.
- Zero runtime dependencies (Node >= 18) — keep it dependency-free.
Good first issue — tiny, self-contained, and high-value for bug reports.
Summary
There's no top-level
capcut --version/capcut -vto print the installed CLI version. Note that the existingcapcut versionsubcommand does something different — it inspects a draft's CapCut/JianYing support status, not the package version. A standard--versionflag is what users and bug reports expect.What to do
In
src/index.ts, handle--version/-vas a global flag before command dispatch (the command is read aspositional[0]after flag parsing). Print the version frompackage.jsonand exit 0.package.jsonrelative to the compiled entry point. The file already computes acliDir(used to locatetemplates/_init); reuse that to read../package.jsonso it works fromdist/.-v, --versionline to theHELPconstant near the top ofsrc/index.ts.Example:
Acceptance
capcut --versionandcapcut -vboth print the package version and exit 0.versionsubcommand (that keeps its current draft-support behavior).test/following the existing*.test.mjspattern (helpers intest/helpers/).README.md/docs/usage.Pointers (verified against
master)src/index.ts(TypeScript →dist/); nosrc/commands/dir.HELPconstant ~line 81; command dispatch readsconst cmd = positional[0].cliDiris already used for bundled-template resolution — reuse forpackage.json.Good first issue — tiny, self-contained, and high-value for bug reports.