@ship-safe/cli 1.1.10 → 1.1.13

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 +26 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7,6 +7,9 @@ var __export = (target, all) => {
7
7
 
8
8
  // src/index.ts
9
9
  import { Command, InvalidArgumentError, Option } from "commander";
10
+ import { readFileSync as readFileSync6 } from "fs";
11
+ import { fileURLToPath } from "url";
12
+ import { dirname, join as join5 } from "path";
10
13
 
11
14
  // src/commands/scan.ts
12
15
  import { resolve as resolve2, join as join4 } from "path";
@@ -7277,7 +7280,7 @@ function formatSarifOutput(result) {
7277
7280
  tool: {
7278
7281
  driver: {
7279
7282
  name: "ShipSafe",
7280
- version: "0.1.0",
7283
+ version: "1.1.11",
7281
7284
  rules: result.findings.map((f) => ({
7282
7285
  id: f.ruleId,
7283
7286
  shortDescription: { text: f.title },
@@ -7814,8 +7817,13 @@ async function scanCommand(targetPath, options) {
7814
7817
  chalk5.yellow("Session expired. Run `shipsafe login` to re-authenticate.")
7815
7818
  );
7816
7819
  } else {
7820
+ let errBody = "";
7821
+ try {
7822
+ errBody = JSON.stringify(await aiRes.json());
7823
+ } catch {
7824
+ }
7817
7825
  aiSpinner.warn(
7818
- chalk5.yellow("AI analysis unavailable. Showing rule-based results only.")
7826
+ chalk5.yellow(`AI analysis unavailable (HTTP ${aiRes.status}). ${errBody || "Showing rule-based results only."}`)
7819
7827
  );
7820
7828
  }
7821
7829
  } catch {
@@ -8076,6 +8084,21 @@ function initCommand() {
8076
8084
  }
8077
8085
 
8078
8086
  // src/index.ts
8087
+ function getVersion() {
8088
+ try {
8089
+ let dir = dirname(fileURLToPath(import.meta.url));
8090
+ for (let i = 0; i < 5; i++) {
8091
+ try {
8092
+ const pkg = JSON.parse(readFileSync6(join5(dir, "package.json"), "utf-8"));
8093
+ if (pkg.name === "@ship-safe/cli") return pkg.version;
8094
+ } catch {
8095
+ }
8096
+ dir = dirname(dir);
8097
+ }
8098
+ } catch {
8099
+ }
8100
+ return "1.1.11";
8101
+ }
8079
8102
  function validateApiUrl(value) {
8080
8103
  let parsed;
8081
8104
  try {
@@ -8089,7 +8112,7 @@ function validateApiUrl(value) {
8089
8112
  return value;
8090
8113
  }
8091
8114
  var program = new Command();
8092
- program.name("shipsafe").description("Security scanner for AI-generated code").version("0.1.0");
8115
+ program.name("shipsafe").description("Security scanner for AI-generated code").version(getVersion());
8093
8116
  program.command("scan").description("Scan a directory or file for security vulnerabilities").argument("[path]", "Path to scan", ".").addOption(
8094
8117
  new Option("-o, --output <format>", "Output format: table, json, sarif").choices(["table", "json", "sarif"]).default("table")
8095
8118
  ).addOption(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ship-safe/cli",
3
- "version": "1.1.10",
3
+ "version": "1.1.13",
4
4
  "description": "Security scanner for AI-generated code — find vulnerabilities before you ship",
5
5
  "type": "module",
6
6
  "license": "MIT",