@meterian/cli 0.1.1 → 0.1.2

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
@@ -21047,6 +21047,40 @@ var require_vs = __commonJS({
21047
21047
  }
21048
21048
  });
21049
21049
 
21050
+ // ../../src/meterian/CanonicalUserId.js
21051
+ var require_CanonicalUserId = __commonJS({
21052
+ "../../src/meterian/CanonicalUserId.js"(exports2, module2) {
21053
+ var fs = require("fs");
21054
+ var path2 = require("path");
21055
+ var os2 = require("os");
21056
+ var log = require_log4js().getLogger("Heidi.CanonicalUserId");
21057
+ var USER_JSON_PATH = path2.join(os2.homedir(), ".meterian", "heidi", "config", "user.json");
21058
+ function getOrCreate(computeFn) {
21059
+ try {
21060
+ const content = fs.readFileSync(USER_JSON_PATH, "utf8");
21061
+ const { canonicalUserId } = JSON.parse(content);
21062
+ if (canonicalUserId && typeof canonicalUserId === "string") {
21063
+ return canonicalUserId;
21064
+ }
21065
+ } catch (_) {
21066
+ }
21067
+ const id = computeFn();
21068
+ if (!id || typeof id !== "string") {
21069
+ log.warn("computeFn returned invalid ID; canonical user ID not persisted");
21070
+ return id;
21071
+ }
21072
+ try {
21073
+ fs.mkdirSync(path2.dirname(USER_JSON_PATH), { recursive: true });
21074
+ fs.writeFileSync(USER_JSON_PATH, JSON.stringify({ canonicalUserId: id }));
21075
+ } catch (e) {
21076
+ log.warn(`Unable to persist canonical user ID: ${e.message}`);
21077
+ }
21078
+ return id;
21079
+ }
21080
+ module2.exports = { getOrCreate };
21081
+ }
21082
+ });
21083
+
21050
21084
  // ../../src/meterian/Auth.js
21051
21085
  var require_Auth = __commonJS({
21052
21086
  "../../src/meterian/Auth.js"(exports2, module2) {
@@ -21058,7 +21092,8 @@ var require_Auth = __commonJS({
21058
21092
  this.token = token;
21059
21093
  if (config != null) {
21060
21094
  const { workspace } = require_vs();
21061
- this.id = workspace.getId();
21095
+ const { getOrCreate } = require_CanonicalUserId();
21096
+ this.id = getOrCreate(() => workspace.getId());
21062
21097
  this.config = config;
21063
21098
  }
21064
21099
  }
@@ -21070,8 +21105,9 @@ var require_Auth = __commonJS({
21070
21105
  const machineId = crypto.createHash("sha256").update(data).digest("hex");
21071
21106
  const username = os2.userInfo().username;
21072
21107
  const usernameHash = crypto.createHash("md5").update(username).digest("hex");
21108
+ const { getOrCreate } = require_CanonicalUserId();
21073
21109
  const auth = new _Auth(null, null);
21074
- auth.id = machineId + ":" + usernameHash;
21110
+ auth.id = getOrCreate(() => machineId + ":" + usernameHash);
21075
21111
  return auth;
21076
21112
  }
21077
21113
  async isAuthenticated() {
@@ -21363,15 +21399,14 @@ var require_package = __commonJS({
21363
21399
  "package.json"(exports2, module2) {
21364
21400
  module2.exports = {
21365
21401
  name: "@meterian/cli",
21366
- version: "0.1.1",
21402
+ version: "0.1.2",
21367
21403
  description: "Meterian security audit CLI \u2014 check open-source dependencies for vulnerabilities",
21368
21404
  bin: {
21369
21405
  meterian: "bin/meterian"
21370
21406
  },
21371
21407
  files: [
21372
21408
  "dist/",
21373
- "bin/",
21374
- "CHANGELOG.md"
21409
+ "bin/"
21375
21410
  ],
21376
21411
  scripts: {
21377
21412
  prepack: "esbuild src/cli.js --bundle --platform=node --external:vscode --outfile=dist/cli.js",
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "@meterian/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Meterian security audit CLI — check open-source dependencies for vulnerabilities",
5
5
  "bin": {
6
6
  "meterian": "bin/meterian"
7
7
  },
8
8
  "files": [
9
9
  "dist/",
10
- "bin/",
11
- "CHANGELOG.md"
10
+ "bin/"
12
11
  ],
13
12
  "scripts": {
14
13
  "prepack": "esbuild src/cli.js --bundle --platform=node --external:vscode --outfile=dist/cli.js",
package/CHANGELOG.md DELETED
@@ -1,23 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to `@meterian/cli` are documented here.
4
-
5
- The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
-
7
- ## [0.1.1] — 2026-05-15
8
-
9
- ### Fixed
10
-
11
- - Set the correct `meterian/cli <version>` User-Agent header on all outbound HTTP calls to the Kiwi API (previously the header was unset or used the wrong client identifier).
12
-
13
- ## [0.1.0] — 2026-04-28
14
-
15
- Initial public release.
16
-
17
- ### Added
18
-
19
- - `check` command — batch dependency audit; reads `[{language, name, version}]` from stdin, returns a compact vulnerability summary with safe-version suggestions.
20
- - `advisories get` command — returns the full advisory list for a single package.
21
- - `nextsafe` command — returns the next safe version at each semver level (patch / minor / major).
22
- - Human-readable `--help` output for all commands.
23
- - Aliases for common language names (`npm` → `nodejs`, `cargo` → `rust`, `pypi` → `python`, etc.).