@kinkai.cloud/vibecheck 0.1.1 → 0.1.3

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/cli.js +14 -7
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -14894,12 +14894,14 @@ function urlBase() {
14894
14894
  function comandosAbrirBrowser(url2, platform = process.platform, env = process.env) {
14895
14895
  if (platform === "darwin") return [["open", [url2]]];
14896
14896
  if (platform === "win32") return [["cmd", ["/c", "start", "", url2]]];
14897
- const fila = [["xdg-open", [url2]]];
14898
14897
  const wsl = env["WSL_DISTRO_NAME"] !== void 0 || env["WSL_INTEROP"] !== void 0;
14899
14898
  if (wsl) {
14900
- fila.push(["wslview", [url2]], ["explorer.exe", [url2]]);
14899
+ return [
14900
+ ["wslview", [url2]],
14901
+ ["cmd.exe", ["/c", "start", "", url2]]
14902
+ ];
14901
14903
  }
14902
- return fila;
14904
+ return [["xdg-open", [url2]]];
14903
14905
  }
14904
14906
  function tentarSpawn(cmd, args) {
14905
14907
  return new Promise((resolve) => {
@@ -14916,6 +14918,9 @@ async function abrirBrowser(url2) {
14916
14918
  if (await tentarSpawn(cmd, args)) return;
14917
14919
  }
14918
14920
  }
14921
+ function deveAbrirNavegador(opts) {
14922
+ return !opts.ci && !opts.noWait;
14923
+ }
14919
14924
  async function detalheHttp(resposta) {
14920
14925
  const tipo = resposta.headers.get("content-type") ?? "";
14921
14926
  if (tipo.includes("application/json")) {
@@ -14939,7 +14944,7 @@ async function loginDevice(ci) {
14939
14944
  );
14940
14945
  }
14941
14946
  const corpo = await aberto.json();
14942
- console.warn(`No navegador, autorize com o c\xF3digo ${corpo.user_code}`);
14947
+ console.warn(`No navegador, entre na conta e autorize com o c\xF3digo ${corpo.user_code}`);
14943
14948
  console.warn(corpo.verification_url);
14944
14949
  if (!ci) await abrirBrowser(corpo.verification_url);
14945
14950
  const intervalo = Math.max(3, corpo.interval ?? 3) * 1e3;
@@ -15100,6 +15105,7 @@ async function acompanhar(liveUrl, scanId, shareToken) {
15100
15105
  }
15101
15106
  async function main(argv) {
15102
15107
  const ci = temFlag("--ci", argv) || process.env["CI"] === "true" || process.env["VIBECHECK_TOKEN"] !== void 0 && process.env["VIBECHECK_TOKEN"].length > 0;
15108
+ const noWait = temFlag("--no-wait", argv);
15103
15109
  const raiz = arg("--dir", argv) ?? process.cwd();
15104
15110
  let url2 = arg("--url", argv) ?? argv.find((a) => a.startsWith("http")) ?? null;
15105
15111
  let cred = lerToken();
@@ -15140,6 +15146,9 @@ async function main(argv) {
15140
15146
  console.error(corpo.error ?? "n\xE3o foi poss\xEDvel abrir o scan");
15141
15147
  return 1;
15142
15148
  }
15149
+ const live = corpo.liveUrl ?? `${base}/avancado/${corpo.scanId}`;
15150
+ console.warn(live);
15151
+ if (deveAbrirNavegador({ ci, noWait })) await abrirBrowser(live);
15143
15152
  if (avancado && grafo !== null) {
15144
15153
  const put = await fetch(`${base}/api/cli/scan/${corpo.scanId}/graph`, {
15145
15154
  method: "PUT",
@@ -15148,9 +15157,7 @@ async function main(argv) {
15148
15157
  });
15149
15158
  if (!put.ok) console.warn("grafo rejeitado pelo servidor \u2014 scan segue s\xF3 HTTP");
15150
15159
  }
15151
- const live = corpo.liveUrl ?? `${base}/avancado/${corpo.scanId}`;
15152
- console.warn(live);
15153
- if (temFlag("--no-wait", argv)) return 0;
15160
+ if (noWait) return 0;
15154
15161
  return acompanhar(live, corpo.scanId, corpo.shareToken ?? "");
15155
15162
  }
15156
15163
  var codigo = await main(process.argv.slice(2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kinkai.cloud/vibecheck",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {