audit-notes-cli 0.1.3 → 0.1.5

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
@@ -2,29 +2,37 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateLicense = validateLicense;
4
4
  /**
5
- * Simple PRO license validation (v0.1.x)
6
- * No secrets. No signatures. No expiry.
5
+ * Simple PRO license validation with expiry (v0.1.x)
6
+ * Offline only. No secrets. No server.
7
7
  */
8
8
  function validateLicense() {
9
9
  const key = process.env.AUDIT_NOTES_LICENSE;
10
10
  if (!key) {
11
11
  throw new Error("This feature requires Audit Notes PRO. Set AUDIT_NOTES_LICENSE to continue.");
12
12
  }
13
- // Explicit dev / CI bypass
13
+ // Dev / CI bypass
14
14
  if (key === "AN-DEV" || key === "AN-CI") {
15
- return { plan: "PRO" };
15
+ return { plan: "PRO", expiry: "2099-12" };
16
16
  }
17
17
  /**
18
18
  * Expected format:
19
- * AN-PRO-XXXX-YYYY
19
+ * AN-PRO-YYYY-MM
20
20
  */
21
21
  const parts = key.split("-");
22
22
  if (parts.length !== 4) {
23
- throw new Error("Invalid license key format.\nExpected: AN-PRO-XXXX-YYYY");
23
+ throw new Error("Invalid license key format.\nExpected: AN-PRO-YYYY-MM");
24
24
  }
25
- const [prefix, plan] = parts;
25
+ const [prefix, plan, year, month] = parts;
26
26
  if (prefix !== "AN" || plan !== "PRO") {
27
27
  throw new Error("Invalid license key");
28
28
  }
29
- return { plan: "PRO" };
29
+ const expiry = `${year}-${month}`;
30
+ // Expiry check (month-based)
31
+ const now = new Date();
32
+ const exp = new Date(`${expiry}-01T00:00:00Z`);
33
+ exp.setMonth(exp.getMonth() + 1);
34
+ if (now >= exp) {
35
+ throw new Error("License expired. Renew Audit Notes PRO to continue using this feature.");
36
+ }
37
+ return { plan: "PRO", expiry };
30
38
  }
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "audit-notes-cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
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",