audit-notes-cli 0.1.2 → 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.
package/dist/cli.js CHANGED
@@ -16,6 +16,10 @@ const sarif_1 = require("./report/sarif");
16
16
  const profiles_1 = require("./profiles/profiles");
17
17
  const recommendations_1 = require("./paid/recommendations");
18
18
  const fixHints_1 = require("./paid/fixHints");
19
+ /* ===================== VERSION ===================== */
20
+ const pkg = JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, "../package.json"), "utf8"));
21
+ const VERSION = pkg.version;
22
+ /* ===================== CLI ARGS ===================== */
19
23
  const args = process.argv.slice(2);
20
24
  const cmd = args[0] ?? "run";
21
25
  const useSarif = args.includes("--sarif");
@@ -36,6 +40,7 @@ function getProfile() {
36
40
  }
37
41
  return p;
38
42
  }
43
+ /* ===================== CORE ===================== */
39
44
  async function run() {
40
45
  if (wantRecommendations || wantFixHints) {
41
46
  (0, license_1.validateLicense)();
@@ -76,12 +81,20 @@ async function run() {
76
81
  fs_1.default.writeFileSync("output/fix-hints.json", JSON.stringify((0, fixHints_1.generateFixHints)(current), null, 2));
77
82
  }
78
83
  }
84
+ /* ===================== ENTRY ===================== */
79
85
  async function main() {
80
- if (cmd === "run")
86
+ if (args.includes("--version") || args.includes("-v")) {
87
+ console.log(`audit-notes v${VERSION}`);
88
+ return;
89
+ }
90
+ if (cmd === "run") {
81
91
  await run();
82
- else if (cmd === "check")
92
+ }
93
+ else if (cmd === "check") {
83
94
  (0, license_1.validateLicense)();
84
- else
85
- console.log("audit-notes v0.1.0");
95
+ }
96
+ else {
97
+ console.log(`audit-notes v${VERSION}`);
98
+ }
86
99
  }
87
100
  main();
package/dist/license.js CHANGED
@@ -1,13 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.validateLicense = validateLicense;
7
- const crypto_1 = __importDefault(require("crypto"));
8
4
  /**
9
- * Validate PRO license.
10
- * This function MUST ONLY be called for paid features.
5
+ * Simple PRO license validation (v0.1.x)
6
+ * No secrets. No signatures. No expiry.
11
7
  */
12
8
  function validateLicense() {
13
9
  const key = process.env.AUDIT_NOTES_LICENSE;
@@ -16,52 +12,19 @@ function validateLicense() {
16
12
  }
17
13
  // Explicit dev / CI bypass
18
14
  if (key === "AN-DEV" || key === "AN-CI") {
19
- return {
20
- plan: "PRO",
21
- scope: "SOLO",
22
- interval: "M",
23
- expiry: "2099-12"
24
- };
25
- }
26
- const secret = process.env.AUDIT_NOTES_SECRET;
27
- if (!secret) {
28
- throw new Error("AUDIT_NOTES_SECRET must be set when using a paid license.");
15
+ return { plan: "PRO" };
29
16
  }
30
17
  /**
31
18
  * Expected format:
32
- * AN-PRO-SOLO-M-2026-01-<SIG>
19
+ * AN-PRO-XXXX-YYYY
33
20
  */
34
21
  const parts = key.split("-");
35
- if (parts.length !== 7) {
36
- throw new Error("Invalid license key format");
37
- }
38
- const [prefix, plan, scope, interval, year, month, sig] = parts;
39
- if (prefix !== "AN")
40
- throw new Error("Invalid license prefix");
41
- if (plan !== "PRO")
42
- throw new Error("Invalid plan");
43
- if (scope !== "SOLO" && scope !== "TEAM") {
44
- throw new Error("Invalid license scope");
45
- }
46
- if (interval !== "M" && interval !== "Y") {
47
- throw new Error("Invalid billing interval");
48
- }
49
- const expiry = `${year}-${month}`;
50
- const payload = `AN-${plan}-${scope}-${interval}-${expiry}`;
51
- const expectedSig = crypto_1.default
52
- .createHmac("sha256", secret)
53
- .update(payload)
54
- .digest("hex")
55
- .slice(0, 10);
56
- if (sig !== expectedSig) {
57
- throw new Error("Invalid license signature");
22
+ if (parts.length !== 4) {
23
+ throw new Error("Invalid license key format.\nExpected: AN-PRO-XXXX-YYYY");
58
24
  }
59
- // Expiry check (month-based)
60
- const now = new Date();
61
- const exp = new Date(`${expiry}-01T00:00:00Z`);
62
- exp.setMonth(exp.getMonth() + 1);
63
- if (now >= exp) {
64
- throw new Error("License expired");
25
+ const [prefix, plan] = parts;
26
+ if (prefix !== "AN" || plan !== "PRO") {
27
+ throw new Error("Invalid license key");
65
28
  }
66
- return { plan, scope, interval, expiry };
29
+ return { plan: "PRO" };
67
30
  }
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "audit-notes-cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "type": "commonjs",
5
5
  "bin": {
6
- "audit-notes": "dist/cli.js"
6
+ "audit-notes": "dist/cli.js",
7
+ "audit-notes-cli": "dist/cli.js"
7
8
  },
8
9
  "scripts": {
9
10
  "build": "tsc",