You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
npm-published v1.0.2 missing --version/-v flag handling in bin/c7.js #9
The npm-published version of @vedanth/context7@1.0.2 is missing the --version/-v flag handling in bin/c7.js.
Expected Behavior
$ c7 --version
1.0.2
$ c7 -v
1.0.2
Actual Behavior
Both flags are silently ignored and the argument is treated as a library name query:
$ c7 --version
# → fetches docs for "version" (e.g. version_utils Python package)
$ c7 -v
# → fetches docs for "v" (V programming language)
Root Cause
The parseArgs function in bin/c7.js is missing the --version/-v branch, and the main function is missing the early-exit check:
// Missing in parseArgs:elseif(a==='--version'||a==='-v'){args.version=true;}// Missing in main():if(opts.version){constpkg=JSON.parse(readFileSync(newURL('../package.json',import.meta.url),'utf8'));console.log(pkg.version);process.exit(0);}
These lines exist in the GitHub repo source but were apparently omitted from the npm-published tarball. A re-publish (npm publish) should resolve it.
Fix
The lines above need to be added at:
parseArgs (bin/c7.js line ~36): add the --version/-v branch after the --json branch
main (bin/c7.js line ~97): add the opts.version early-exit block before the opts.help check
Both are already present in the GitHub repo — they just need to be included in the next npm publish.
Activity