nemonicon-cli 0.1.2 → 0.2.0

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/dist/index.js +41 -3
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { Command as Command14 } from "commander";
4
+ import { Command as Command15 } from "commander";
5
+ import { readFileSync as readFileSync6 } from "fs";
6
+ import { fileURLToPath } from "url";
7
+ import { dirname, join as join2 } from "path";
8
+ import updateNotifier from "update-notifier";
5
9
 
6
10
  // src/commands/auth.ts
7
11
  import { Command } from "commander";
@@ -1616,9 +1620,42 @@ var mcpCommand = new Command13("mcp").description(
1616
1620
  await server.connect(transport);
1617
1621
  });
1618
1622
 
1623
+ // src/commands/upgrade.ts
1624
+ import { Command as Command14 } from "commander";
1625
+ import { spawnSync } from "child_process";
1626
+ var upgradeCommand = new Command14("upgrade").description("Upgrade nemonicon-cli to the latest version from npm").action(() => {
1627
+ console.log("Upgrading nemonicon-cli to the latest version...");
1628
+ const result = spawnSync("npm", ["i", "-g", "nemonicon-cli@latest"], {
1629
+ stdio: "inherit",
1630
+ shell: process.platform === "win32"
1631
+ });
1632
+ if (result.error) {
1633
+ console.error("Failed to run npm:", result.error.message);
1634
+ process.exit(1);
1635
+ }
1636
+ if (typeof result.status === "number" && result.status !== 0) {
1637
+ process.exit(result.status);
1638
+ }
1639
+ console.log("Done. Run `nemonicon -V` to confirm the new version.");
1640
+ });
1641
+
1619
1642
  // src/index.ts
1620
- var program = new Command14();
1621
- program.name("nemonicon").description("CLI tool for Nemonicon knowledge management").version("0.1.0");
1643
+ var __dirname2 = dirname(fileURLToPath(import.meta.url));
1644
+ var pkg = JSON.parse(
1645
+ readFileSync6(join2(__dirname2, "../package.json"), "utf-8")
1646
+ );
1647
+ var isMcp = process.argv[2] === "mcp";
1648
+ if (!isMcp) {
1649
+ updateNotifier({
1650
+ pkg,
1651
+ updateCheckInterval: 1e3 * 60 * 60 * 24
1652
+ }).notify({
1653
+ isGlobal: true,
1654
+ message: "Update available {currentVersion} \u2192 {latestVersion}\nRun `nemonicon upgrade` (or `npm i -g {packageName}@latest`)"
1655
+ });
1656
+ }
1657
+ var program = new Command15();
1658
+ program.name("nemonicon").description("CLI tool for Nemonicon knowledge management").version(pkg.version);
1622
1659
  program.addCommand(loginCommand);
1623
1660
  program.addCommand(logoutCommand);
1624
1661
  program.addCommand(authCommand);
@@ -1632,4 +1669,5 @@ program.addCommand(deleteCommand);
1632
1669
  program.addCommand(moveCommand);
1633
1670
  program.addCommand(bulkUpdateCommand);
1634
1671
  program.addCommand(mcpCommand);
1672
+ program.addCommand(upgradeCommand);
1635
1673
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nemonicon-cli",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "CLI tool for Nemonicon knowledge management",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,6 +16,7 @@
16
16
  "dependencies": {
17
17
  "@modelcontextprotocol/sdk": "^1.0.4",
18
18
  "commander": "^13.1.0",
19
+ "update-notifier": "^7.3.1",
19
20
  "zod": "^3.23.8"
20
21
  },
21
22
  "devDependencies": {