neuro-commit 0.1.2 → 0.1.3

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/neuro-commit.js +69 -15
  2. package/package.json +1 -1
@@ -2,6 +2,17 @@
2
2
 
3
3
  const readline = require("readline");
4
4
  const { runCommitMode } = require("../src/commit");
5
+ const pkg = require("../package.json");
6
+
7
+ // --- ANSI helpers ---
8
+ const RESET = "\x1b[0m";
9
+ const BOLD = "\x1b[1m";
10
+ const DIM = "\x1b[2m";
11
+ const GREEN = "\x1b[32m";
12
+ const YELLOW = "\x1b[33m";
13
+ const CYAN = "\x1b[36m";
14
+ const HIDE_CURSOR = "\x1b[?25l";
15
+ const SHOW_CURSOR = "\x1b[?25h";
5
16
 
6
17
  const banner = `
7
18
  ███╗ ██╗███████╗██╗ ██╗██████╗ ██████╗ ██████╗ ██████╗ ███╗ ███╗███╗ ███╗██╗████████╗
@@ -12,20 +23,45 @@ const banner = `
12
23
  ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
13
24
  `;
14
25
 
26
+ // --- CLI flags ---
27
+ const args = process.argv.slice(2);
28
+
29
+ if (args.includes("--help") || args.includes("-h")) {
30
+ console.log(`
31
+ ${BOLD}neuro-commit${RESET} v${pkg.version} — AI-powered commit message generator
32
+
33
+ ${BOLD}USAGE${RESET}
34
+ neuro-commit Launch interactive mode
35
+ neuro-commit [options]
36
+
37
+ ${BOLD}OPTIONS${RESET}
38
+ -h, --help Show this help message
39
+ -v, --version Show installed version
40
+
41
+ ${BOLD}WORKFLOW${RESET}
42
+ 1. Stage your changes ${DIM}git add <files>${RESET}
43
+ 2. Run neuro-commit ${DIM}neuro-commit${RESET}
44
+ 3. Copy generated file ${DIM}neuro-commit.md${RESET}
45
+ 4. Paste into your LLM ${DIM}(ChatGPT, Claude, etc.)${RESET}
46
+ 5. Get your commit message!
47
+
48
+ ${BOLD}LINKS${RESET}
49
+ Repository ${CYAN}${pkg.homepage}${RESET}
50
+ Issues ${CYAN}${pkg.bugs.url}${RESET}
51
+ `);
52
+ process.exit(0);
53
+ }
54
+
55
+ if (args.includes("--version") || args.includes("-v")) {
56
+ console.log(`neuro-commit v${pkg.version}`);
57
+ process.exit(0);
58
+ }
59
+
15
60
  // --- Menu options ---
16
61
  const menuItems = [
17
62
  { label: "Commit", icon: "📝", description: "Generate a commit message" },
18
63
  ];
19
64
 
20
- // --- ANSI helpers ---
21
- const RESET = "\x1b[0m";
22
- const BOLD = "\x1b[1m";
23
- const DIM = "\x1b[2m";
24
- const GREEN = "\x1b[32m";
25
- const CYAN = "\x1b[36m";
26
- const HIDE_CURSOR = "\x1b[?25l";
27
- const SHOW_CURSOR = "\x1b[?25h";
28
-
29
65
  // Ensure cursor is restored if the process exits unexpectedly
30
66
  process.on("exit", () => {
31
67
  process.stdout.write(SHOW_CURSOR);
@@ -121,15 +157,33 @@ async function main() {
121
157
 
122
158
  try {
123
159
  const { default: updateNotifier } = await import("update-notifier");
124
- const pkg = require("../package.json");
125
160
 
126
- updateNotifier({
161
+ const notifier = updateNotifier({
127
162
  pkg,
128
- updateCheckInterval: 1000 * 60 * 60 * 24,
129
- }).notify({
130
- defer: false,
131
- isGlobal: true,
163
+ updateCheckInterval: 0,
132
164
  });
165
+
166
+ // Cache may be empty on first run — fetch directly as fallback
167
+ let updateInfo = notifier.update;
168
+ if (!updateInfo) {
169
+ try {
170
+ updateInfo = await notifier.fetchInfo();
171
+ if (updateInfo.type === "latest") {
172
+ updateInfo = null;
173
+ }
174
+ } catch {
175
+ // Network error — skip silently
176
+ }
177
+ }
178
+
179
+ if (updateInfo) {
180
+ console.log(
181
+ ` ${YELLOW}Update available!${RESET} ${DIM}${updateInfo.current}${RESET} → ${GREEN}${updateInfo.latest}${RESET}`,
182
+ );
183
+ console.log(
184
+ ` Run ${CYAN}npm install -g neuro-commit${RESET} to update\n`,
185
+ );
186
+ }
133
187
  } catch {
134
188
  // Ignore update check errors
135
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neuro-commit",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "neuro-commit CLI utility",
5
5
  "author": "cr1ma.dev",
6
6
  "bin": {