securewithtrace 0.20.3 → 0.21.1

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 (3) hide show
  1. package/README.md +4 -0
  2. package/dist/index.js +72 -67
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -134,6 +134,9 @@ tracecli vulnerabilities list --output json | jq '.[].title'
134
134
 
135
135
  # TSV output for awk/cut
136
136
  tracecli vulnerabilities list --output tsv | cut -f1,7
137
+
138
+ # Open vulnerabilities dashboard in browser
139
+ tracecli vulnerabilities list --web
137
140
  ```
138
141
 
139
142
  Flags:
@@ -145,6 +148,7 @@ Flags:
145
148
  | `--status <status>` | | Filter by status |
146
149
  | `--limit <n>` | `-L` | Max results (default: 30, max: 100) |
147
150
  | `--output <format>` | `-o` | Output format: `table` (default), `json`, `tsv` |
151
+ | `--web` | `-w` | Open vulnerabilities dashboard in browser |
148
152
 
149
153
  Supported filter values:
150
154
 
package/dist/index.js CHANGED
@@ -26476,6 +26476,39 @@ async function resolveOrganizationIdSafe(client) {
26476
26476
  }
26477
26477
  }
26478
26478
 
26479
+ // src/browser.ts
26480
+ var DEFAULT_APP_BASE_URL = "https://app.securewithtrace.com";
26481
+ function getAppBaseUrl() {
26482
+ const override = process.env["TRACE_APP_URL"];
26483
+ if (typeof override === "string" && override.trim().length > 0) {
26484
+ try {
26485
+ const parsed = new URL(override);
26486
+ if (parsed.protocol === "https:") {
26487
+ return override.replace(/\/+$/, "");
26488
+ }
26489
+ } catch {
26490
+ }
26491
+ }
26492
+ return DEFAULT_APP_BASE_URL;
26493
+ }
26494
+ async function openBrowser(url2) {
26495
+ try {
26496
+ const parsed = new URL(url2);
26497
+ if (parsed.protocol !== "https:") {
26498
+ return false;
26499
+ }
26500
+ const proc = Bun.spawn(["open", url2], { stdout: "ignore", stderr: "ignore" });
26501
+ const exitCode = await proc.exited;
26502
+ if (exitCode !== 0) {
26503
+ const linuxProc = Bun.spawn(["xdg-open", url2], { stdout: "ignore", stderr: "ignore" });
26504
+ return await linuxProc.exited === 0;
26505
+ }
26506
+ return true;
26507
+ } catch {
26508
+ return false;
26509
+ }
26510
+ }
26511
+
26479
26512
  // src/format.ts
26480
26513
  var SEVERITY_ORDER = {
26481
26514
  CRITICAL: 0,
@@ -26501,29 +26534,6 @@ function getClientId() {
26501
26534
  "TRACE_WORKOS_CLIENT_ID is not set. Build the CLI with TRACE_WORKOS_CLIENT_ID set, or provide it as an environment variable."
26502
26535
  );
26503
26536
  }
26504
- async function openBrowser(url2) {
26505
- try {
26506
- const parsed = new URL(url2);
26507
- if (parsed.protocol !== "https:") {
26508
- return false;
26509
- }
26510
- const proc = Bun.spawn(["open", url2], {
26511
- stdout: "ignore",
26512
- stderr: "ignore"
26513
- });
26514
- const exitCode = await proc.exited;
26515
- if (exitCode !== 0) {
26516
- const linuxProc = Bun.spawn(["xdg-open", url2], {
26517
- stdout: "ignore",
26518
- stderr: "ignore"
26519
- });
26520
- return await linuxProc.exited === 0;
26521
- }
26522
- return true;
26523
- } catch {
26524
- return false;
26525
- }
26526
- }
26527
26537
  var SAFE_ORGANIZATION_ID_PATTERN = /^[a-zA-Z0-9_-]+$/;
26528
26538
  function sanitizeForOutput(value) {
26529
26539
  return value.replace(/[\r\n\t]/g, " ").trim();
@@ -26821,7 +26831,7 @@ function buildAuthStatusInfo(token, refreshToken, selectedOrganizationId) {
26821
26831
  }
26822
26832
  }
26823
26833
  function createStatusCommand() {
26824
- return new Command("status").description("Show current authentication status").option("-o, --output <format>", "Output format: table (default), json, tsv").addHelpText(
26834
+ return new Command("status").description("Show current authentication status").option("-o, --output <format>", "Output format: table, json, tsv (default: table)", "table").addHelpText(
26825
26835
  "after",
26826
26836
  `
26827
26837
  Examples:
@@ -26887,21 +26897,31 @@ Examples:
26887
26897
  });
26888
26898
  }
26889
26899
  function createOrgListCommand() {
26890
- return new Command("list").description("List organizations available to your account").option("-o, --output <format>", "Output format: table (default), json, tsv").option("-L, --limit <n>", "Max organizations to display (default: all)", (v) => {
26900
+ return new Command("list").description("List organizations available to your account").option("-o, --output <format>", "Output format: table, json, tsv (default: table)", "table").option("-L, --limit <n>", "Max organizations to display (default: all)", (v) => {
26891
26901
  const n = Number.parseInt(v, 10);
26892
26902
  if (Number.isNaN(n) || n < 1) {
26893
26903
  throw new Error("--limit must be a positive integer");
26894
26904
  }
26895
26905
  return n;
26896
- }).addHelpText(
26906
+ }).option("-w, --web", "Open the organization settings in a browser").addHelpText(
26897
26907
  "after",
26898
26908
  `
26899
26909
  Examples:
26900
26910
  tracecli org list
26901
26911
  tracecli org list --output json
26902
26912
  tracecli org list --output tsv | cut -f1
26903
- tracecli org list --limit 5`
26913
+ tracecli org list --limit 5
26914
+ tracecli org list --web`
26904
26915
  ).action(async (options) => {
26916
+ if (options.web) {
26917
+ const slug = await resolveOrganizationSlug();
26918
+ const url2 = `${getAppBaseUrl()}/dashboard/${slug}/settings`;
26919
+ const opened = await openBrowser(url2);
26920
+ if (!opened) {
26921
+ console.log(`Open in browser: ${url2}`);
26922
+ }
26923
+ return;
26924
+ }
26905
26925
  const organizationContext = await fetchOrganizationContext();
26906
26926
  const allItems = organizationContext.organizations.map(
26907
26927
  (organization) => ({
@@ -26957,14 +26977,24 @@ Examples:
26957
26977
  });
26958
26978
  }
26959
26979
  function createOrgCurrentCommand() {
26960
- return new Command("current").description("Show the active organization used by CLI commands").option("-o, --output <format>", "Output format: table (default), json, tsv").addHelpText(
26980
+ return new Command("current").description("Show the active organization used by CLI commands").option("-o, --output <format>", "Output format: table, json, tsv (default: table)", "table").option("-w, --web", "Open the organization settings in a browser").addHelpText(
26961
26981
  "after",
26962
26982
  `
26963
26983
  Examples:
26964
26984
  tracecli org current
26965
26985
  tracecli org current --output json
26966
- tracecli org current --output tsv`
26986
+ tracecli org current --output tsv
26987
+ tracecli org current --web`
26967
26988
  ).action(async (options) => {
26989
+ if (options.web) {
26990
+ const slug = await resolveOrganizationSlug();
26991
+ const url2 = `${getAppBaseUrl()}/dashboard/${slug}/settings`;
26992
+ const opened = await openBrowser(url2);
26993
+ if (!opened) {
26994
+ console.log(`Open in browser: ${url2}`);
26995
+ }
26996
+ return;
26997
+ }
26968
26998
  const organizationContext = await fetchOrganizationContext();
26969
26999
  const active = organizationContext.activeOrganization;
26970
27000
  const source = organizationContext.selectedOrganizationId === active.organizationId ? "selected" : "default";
@@ -27777,41 +27807,6 @@ function createPentestCommand() {
27777
27807
  import { chmodSync, mkdtempSync, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
27778
27808
  import { tmpdir } from "os";
27779
27809
  import { join as join4 } from "path";
27780
-
27781
- // src/browser.ts
27782
- var DEFAULT_APP_BASE_URL = "https://app.securewithtrace.com";
27783
- function getAppBaseUrl() {
27784
- const override = process.env["TRACE_APP_URL"];
27785
- if (typeof override === "string" && override.trim().length > 0) {
27786
- try {
27787
- const parsed = new URL(override);
27788
- if (parsed.protocol === "https:") {
27789
- return override.replace(/\/+$/, "");
27790
- }
27791
- } catch {
27792
- }
27793
- }
27794
- return DEFAULT_APP_BASE_URL;
27795
- }
27796
- async function openBrowser2(url2) {
27797
- try {
27798
- const parsed = new URL(url2);
27799
- if (parsed.protocol !== "https:") {
27800
- return false;
27801
- }
27802
- const proc = Bun.spawn(["open", url2], { stdout: "ignore", stderr: "ignore" });
27803
- const exitCode = await proc.exited;
27804
- if (exitCode !== 0) {
27805
- const linuxProc = Bun.spawn(["xdg-open", url2], { stdout: "ignore", stderr: "ignore" });
27806
- return await linuxProc.exited === 0;
27807
- }
27808
- return true;
27809
- } catch {
27810
- return false;
27811
- }
27812
- }
27813
-
27814
- // src/repo/commands.ts
27815
27810
  function stripAnsi(str) {
27816
27811
  const ESC2 = String.fromCharCode(27);
27817
27812
  const CSI2 = String.fromCharCode(155);
@@ -28244,7 +28239,7 @@ async function runRepositoryListCommand(options) {
28244
28239
  if (options.web) {
28245
28240
  const slug = await resolveOrganizationSlug();
28246
28241
  const url2 = `${getAppBaseUrl()}/dashboard/${slug}/repositories`;
28247
- const opened = await openBrowser2(url2);
28242
+ const opened = await openBrowser(url2);
28248
28243
  if (!opened) {
28249
28244
  console.log(`Open in browser: ${url2}`);
28250
28245
  }
@@ -29083,7 +29078,7 @@ function createListCommand3() {
29083
29078
  }
29084
29079
  return Math.min(n, MAX_LIMIT3);
29085
29080
  }
29086
- ).option("-o, --output <format>", "Output format: table, json, tsv (default: table)", "table").addHelpText(
29081
+ ).option("-o, --output <format>", "Output format: table, json, tsv (default: table)", "table").option("-w, --web", "Open the vulnerabilities dashboard in a browser").addHelpText(
29087
29082
  "after",
29088
29083
  `
29089
29084
  Examples:
@@ -29091,9 +29086,19 @@ Examples:
29091
29086
  tracecli vulnerabilities list --severity CRITICAL --status OPEN
29092
29087
  tracecli vulnerabilities list --repo securewithtrace/trace --limit 50
29093
29088
  tracecli vulnerabilities list --output json | jq '.[].title'
29094
- tracecli vulnerabilities list --output tsv | cut -f1,7`
29089
+ tracecli vulnerabilities list --output tsv | cut -f1,7
29090
+ tracecli vulnerabilities list --web`
29095
29091
  ).action(
29096
29092
  async (options) => {
29093
+ if (options.web) {
29094
+ const slug = await resolveOrganizationSlug();
29095
+ const url2 = `${getAppBaseUrl()}/dashboard/${slug}/vulnerabilities`;
29096
+ const opened = await openBrowser(url2);
29097
+ if (!opened) {
29098
+ console.log(`Open in browser: ${url2}`);
29099
+ }
29100
+ return;
29101
+ }
29097
29102
  const organizationId = await resolveOrganizationId();
29098
29103
  const conditions = [];
29099
29104
  if (options.repo) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securewithtrace",
3
- "version": "0.20.3",
3
+ "version": "0.21.1",
4
4
  "description": "Official Trace CLI for vulnerability intelligence in your terminal",
5
5
  "type": "module",
6
6
  "bin": {