securewithtrace 0.20.3 → 0.21.0

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 +58 -63
  2. package/package.json +1 -1
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();
@@ -26893,15 +26903,25 @@ function createOrgListCommand() {
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 (default), json, tsv").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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securewithtrace",
3
- "version": "0.20.3",
3
+ "version": "0.21.0",
4
4
  "description": "Official Trace CLI for vulnerability intelligence in your terminal",
5
5
  "type": "module",
6
6
  "bin": {