commentme 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/commentme.js +24 -3
  2. package/package.json +1 -1
package/bin/commentme.js CHANGED
@@ -16,8 +16,19 @@ import { logout } from "../auth/logout.js";
16
16
  import { saveApiKey, clearApiKey } from "../utils/apiKeyManager.js";
17
17
  import { promptPassword } from "../utils/passwordPrompt.js";
18
18
  import dotenv from "dotenv";
19
+ import { readFileSync } from "fs";
20
+ import { dirname, join } from "path";
21
+ import { fileURLToPath } from "url";
22
+
19
23
  dotenv.config();
20
24
 
25
+ const __filename = fileURLToPath(import.meta.url);
26
+ const __dirname = dirname(__filename);
27
+
28
+ // Read version from package.json
29
+ const packageJson = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf8"));
30
+ const version = packageJson.version;
31
+
21
32
 
22
33
  function promptInput(defaultValue = "") {
23
34
  const rl = readline.createInterface({
@@ -40,10 +51,15 @@ async function main() {
40
51
  console.log("Command:", command);
41
52
 
42
53
  try {
43
- // Show help without connecting to DB or requiring auth
54
+ // Show help or version without connecting to DB or requiring auth
55
+ if (command === "--version" || command === "-v") {
56
+ console.log(`commentme version ${version}`);
57
+ return;
58
+ }
59
+
44
60
  if (command === "--help" || command === "-h" || !command) {
45
61
  console.log(`
46
- commentme CLI
62
+ commentme CLI (v${version})
47
63
 
48
64
  Commands:
49
65
  commentme --get line-7-7 <file> Get a specific comment by line range
@@ -57,7 +73,10 @@ Commands:
57
73
  commentme --sanitize <file> Sanitize file for production (removes noisy comments)
58
74
  commentme --set-key Set your own OpenRouter API key (stored securely)
59
75
  commentme --clear-key Remove your saved API key
76
+ commentme --login Log in to your account
77
+ commentme --signup Create a new account
60
78
  commentme --logout Log out from your session
79
+ commentme --version Show version number
61
80
  commentme --help Show this help message
62
81
  `);
63
82
  return;
@@ -181,7 +200,7 @@ Select generation type:
181
200
 
182
201
  default:
183
202
  console.log(`
184
- commentme CLI
203
+ commentme CLI (v${version})
185
204
 
186
205
  Commands:
187
206
  commentme --login
@@ -198,6 +217,8 @@ Commands:
198
217
  commentme --set-key
199
218
  commentme --clear-key
200
219
  commentme --logout
220
+ commentme --version
221
+ commentme --help
201
222
  `);
202
223
  }
203
224
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commentme",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "A CLI tool to manage, redact and unredact your comments keeping the codebase clutterfree.",
5
5
  "type": "module",
6
6
  "bin": {