nero-review 0.1.3 → 0.1.4

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.
@@ -9,9 +9,11 @@ import { formatReview } from "../printer/formatReview.js";
9
9
  import { PrettyPrinter } from "../printer/PrettyPrinter.js";
10
10
  import { step } from "./loader.js";
11
11
  import { theme } from "../helper/ui/theme.js";
12
+ import { assertEnvironment } from "../helper/ui/assertEnvironment.js";
12
13
  export async function runCommand(args) {
13
14
  const filePath = args;
14
15
  try {
16
+ await assertEnvironment();
15
17
  await assertFile(filePath);
16
18
  const readStep = step(theme.muted(" Reading file")).start();
17
19
  const fileMetadata = await readFileContent(filePath);
@@ -0,0 +1,8 @@
1
+ export function assertEnvironment() {
2
+ if (!process.env.NERO_API_KEY) {
3
+ throw new Error("NERO_API_KEY is not set.\nRun `nero-review --help` for setup instructions.");
4
+ }
5
+ if (!process.env.NERO_MODEL) {
6
+ throw new Error("NERO_MODEL is not set.\nRun `nero-review --help` for setup instructions.");
7
+ }
8
+ }
package/dist/index.js CHANGED
@@ -1,8 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
  import "dotenv/config";
3
3
  import { runCommand } from "./cli/runCommand.js";
4
- import { notifyUpdate } from "./update.js";
4
+ import { checkForUpdate } from "./update.js";
5
5
  import { options } from "./cli/options.js";
6
- notifyUpdate();
7
- const opts = options(); // Returns { filePath: string }
8
- runCommand(opts.filePath);
6
+ import { CLI_NAME, CLI_VERSION } from "./meta.js";
7
+ import { theme } from "./helper/ui/theme.js";
8
+ const opts = options(); // { filePath: string }
9
+ // Fire-and-forget update check
10
+ let updateMessage = null;
11
+ setTimeout(() => {
12
+ try {
13
+ const latest = checkForUpdate(CLI_NAME, CLI_VERSION);
14
+ if (latest) {
15
+ updateMessage = `Update available: ${CLI_VERSION} → ${latest}\nRun npm i -g nero-review`;
16
+ }
17
+ }
18
+ catch { }
19
+ }, 0);
20
+ // Main execution (never blocked)
21
+ await runCommand(opts.filePath);
22
+ if (updateMessage) {
23
+ console.log("\n" + theme.muted(updateMessage));
24
+ }
package/dist/update.js CHANGED
@@ -1,15 +1,17 @@
1
- import updateNotifier from "update-notifier";
2
- import { CLI_NAME, CLI_VERSION } from "./meta.js";
3
- export function notifyUpdate() {
4
- const notifier = updateNotifier({
5
- pkg: {
6
- name: CLI_NAME,
7
- version: CLI_VERSION,
8
- },
9
- updateCheckInterval: 1000 * 60 * 60 * 24, // Check every 24 hours
10
- });
11
- // Always notify if an update is available (even from cached check)
12
- if (notifier.update) {
13
- notifier.notify({ isGlobal: true });
1
+ import { execSync } from "node:child_process";
2
+ import semver from "semver";
3
+ export function checkForUpdate(pkgName, currentVersion) {
4
+ try {
5
+ const latest = execSync(`npm view ${pkgName} version`, {
6
+ stdio: ["ignore", "pipe", "ignore"],
7
+ encoding: "utf8",
8
+ }).trim();
9
+ if (semver.lt(currentVersion, latest)) {
10
+ return latest;
11
+ }
12
+ return latest ?? null;
13
+ }
14
+ catch {
15
+ return null;
14
16
  }
15
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nero-review",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Review code directly from your terminal",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -52,10 +52,11 @@
52
52
  "commander": "^14.0.2",
53
53
  "dotenv": "^17.2.3",
54
54
  "ora": "^9.0.0",
55
- "update-notifier": "^7.3.1"
55
+ "semver": "^7.7.3"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/node": "^25.0.3",
59
+ "@types/semver": "^7.7.1",
59
60
  "@types/update-notifier": "^6.0.8",
60
61
  "tsx": "^4.21.0",
61
62
  "typescript": "^5.9.3"