@viberaven/cli 1.6.10 → 1.6.12

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 +8 -8
  2. package/dist/cli.js +34 -8
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -10,10 +10,10 @@ Requires Node.js 20 or newer. Run from the app's project root:
10
10
 
11
11
  ```bash
12
12
  # Open the local Studio
13
- npx -y viberaven@1.6.10
13
+ npx -y viberaven@1.6.12
14
14
 
15
15
  # Fresh terminal check
16
- npx -y viberaven@1.6.10 check
16
+ npx -y viberaven@1.6.12 check
17
17
  ```
18
18
 
19
19
  The `viberaven` package launches this CLI. Studio combines findings, provider context and git comparisons. For chat, select an installed/authenticated Codex CLI, Claude Code or Gemini CLI and use **Test connection**. Access modes: `ask`, `approve`, `full`. Stop Studio with Ctrl+C.
@@ -27,10 +27,10 @@ Checks include migration tables without RLS, unrestricted policy conditions such
27
27
  `check --json` prints a findings summary and artifact paths. `--json` without `check` runs a fresh scan and prints the full gate object.
28
28
 
29
29
  ```bash
30
- npx -y viberaven@1.6.10 check --json
31
- npx -y viberaven@1.6.10 audit --vercel-supabase --json
32
- npx -y viberaven@1.6.10 fix --gap <gapId> --dry-run
33
- npx -y viberaven@1.6.10 init --agents all --dry-run
30
+ npx -y viberaven@1.6.12 check --json
31
+ npx -y viberaven@1.6.12 audit --vercel-supabase --json
32
+ npx -y viberaven@1.6.12 fix --gap <gapId> --dry-run
33
+ npx -y viberaven@1.6.12 init --agents all --dry-run
34
34
  ```
35
35
 
36
36
  Read tasks and source before targeted edits. Preview fixes first. The `rls_disabled` recipe adds an RLS migration without policies: agree before applying, because browser roles lose row access until policies exist. Apply/test through your database workflow; recheck after a batch. Provider actions require provider evidence.
@@ -41,9 +41,9 @@ Read tasks and source before targeted edits. Preview fixes first. The `rls_disab
41
41
 
42
42
  ```bash
43
43
  # Fail on blockers
44
- npx -y viberaven@1.6.10 --strict --json
44
+ npx -y viberaven@1.6.12 --strict --json
45
45
  # Also fail on warnings
46
- npx -y viberaven@1.6.10 --strict=warning --json
46
+ npx -y viberaven@1.6.12 --strict=warning --json
47
47
  ```
48
48
 
49
49
  Default `--strict` returns 0 for `clear`/`warning`, 1 for `not_clear`, 2 for `error`, 3 for `unknown` or unavailable results. `--strict=warning` also returns 1 for warnings.
package/dist/cli.js CHANGED
@@ -15051,7 +15051,7 @@ var VERSION;
15051
15051
  var init_version = __esm({
15052
15052
  "src/version.ts"() {
15053
15053
  "use strict";
15054
- VERSION = "1.6.10";
15054
+ VERSION = "1.6.12";
15055
15055
  }
15056
15056
  });
15057
15057
 
@@ -21866,6 +21866,9 @@ var init_workspace = __esm({
21866
21866
  });
21867
21867
 
21868
21868
  // src/local-ui/preview.ts
21869
+ function reloadsItself(script) {
21870
+ return RELOADS_ITSELF.test(script) && !SEVERAL_PROCESSES.test(script);
21871
+ }
21869
21872
  async function detectPreviewCommand(cwd) {
21870
21873
  let pkg;
21871
21874
  try {
@@ -21880,7 +21883,7 @@ async function detectPreviewCommand(cwd) {
21880
21883
  const packageManager = await exists2("pnpm-lock.yaml") ? "pnpm" : await exists2("yarn.lock") ? "yarn" : await exists2("bun.lockb") || await exists2("bun.lock") ? "bun" : "npm";
21881
21884
  const deps = { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
21882
21885
  const framework = FRAMEWORKS.find(([dep]) => dep in deps)?.[1] ?? null;
21883
- return { packageManager, script, framework, display: `${packageManager} run ${script}` };
21886
+ return { packageManager, script, framework, display: `${packageManager} run ${script}`, reloadsItself: reloadsItself(scripts[script]) };
21884
21887
  }
21885
21888
  function answers(host, port) {
21886
21889
  return new Promise((resolveAnswer) => {
@@ -21924,7 +21927,7 @@ function previewFailureReason(log) {
21924
21927
  if (/Missing script/i.test(log)) return "The script VibeRaven picked is not in package.json.";
21925
21928
  return void 0;
21926
21929
  }
21927
- var import_node_child_process10, import_promises34, import_node_net, import_node_path43, URL_PATTERN, READY_TIMEOUT_MS, LOG_LIMIT, FRAMEWORKS, PreviewManager;
21930
+ var import_node_child_process10, import_promises34, import_node_net, import_node_path43, URL_PATTERN, READY_TIMEOUT_MS, LOG_LIMIT, FRAMEWORKS, RELOADS_ITSELF, SEVERAL_PROCESSES, PreviewManager;
21928
21931
  var init_preview2 = __esm({
21929
21932
  "src/local-ui/preview.ts"() {
21930
21933
  "use strict";
@@ -21937,6 +21940,8 @@ var init_preview2 = __esm({
21937
21940
  READY_TIMEOUT_MS = 12e4;
21938
21941
  LOG_LIMIT = 6e3;
21939
21942
  FRAMEWORKS = [["next", "Next.js"], ["vite", "Vite"], ["@remix-run/dev", "Remix"], ["astro", "Astro"], ["@sveltejs/kit", "SvelteKit"], ["nuxt", "Nuxt"], ["react-scripts", "Create React App"]];
21943
+ RELOADS_ITSELF = /\b(?:next\s+dev|vite(?![-\w])(?!\s+(?:build|preview))|astro\s+dev|nuxi?\s+dev|remix\s+(?:vite:)?dev|react-scripts\s+start|webpack(?:-dev-server|\s+serve)|nodemon|tsx\s+watch|ts-node-dev|svelte-kit\s+dev|ng\s+serve|parcel\b(?!\s+build))|--watch\b/i;
21944
+ SEVERAL_PROCESSES = /&|\bconcurrently\b|\bnpm-run-all\b|\brun-[ps]\b/;
21940
21945
  PreviewManager = class {
21941
21946
  constructor(cwd, home, preferredPort = 3e3) {
21942
21947
  this.cwd = cwd;
@@ -21990,7 +21995,7 @@ var init_preview2 = __esm({
21990
21995
  return this.snapshot();
21991
21996
  }
21992
21997
  this.assignedPort = port;
21993
- this.status = { state: "starting", command: command.display, framework: command.framework, startedAt: (/* @__PURE__ */ new Date()).toISOString(), log: "", revision: this.status.revision };
21998
+ this.status = { state: "starting", command: command.display, framework: command.framework, reloadsItself: command.reloadsItself, startedAt: (/* @__PURE__ */ new Date()).toISOString(), log: "", revision: this.status.revision };
21994
21999
  const child = (0, import_node_child_process10.spawn)(`${command.packageManager} run ${command.script}`, {
21995
22000
  cwd: this.cwd,
21996
22001
  shell: true,
@@ -22078,6 +22083,25 @@ var init_preview2 = __esm({
22078
22083
  if (this.status.state !== "starting") return Promise.resolve(this.snapshot());
22079
22084
  return new Promise((resolveWait) => this.readyWaiters.push(() => resolveWait(this.snapshot())));
22080
22085
  }
22086
+ /**
22087
+ * The app's code changed. A dev server that reloads by itself only needs the frame reloaded; any other one is
22088
+ * restarted, so the preview never keeps serving the code from before the change.
22089
+ */
22090
+ async reload() {
22091
+ if (!this.isRunning()) return this.snapshot();
22092
+ if (this.status.reloadsItself) {
22093
+ this.bumpRevision();
22094
+ return this.snapshot();
22095
+ }
22096
+ const port = this.assignedPort;
22097
+ this.stop();
22098
+ for (let tries = 0; tries < 50 && port && await portTaken(port); tries += 1) {
22099
+ await new Promise((resolveDelay) => setTimeout(resolveDelay, 200));
22100
+ }
22101
+ await this.start();
22102
+ this.bumpRevision();
22103
+ return this.waitForReady();
22104
+ }
22081
22105
  /** Marks that the app's code changed, so the Studio reloads the frame exactly once. */
22082
22106
  bumpRevision() {
22083
22107
  this.status = { ...this.status, revision: this.status.revision + 1 };
@@ -22433,7 +22457,7 @@ var init_engine = __esm({
22433
22457
  const outcome = await revertChanges(baseline, paths.map((path) => ({ path, kind: "modified", additions: 0, deletions: 0 })), keep);
22434
22458
  this.deps.store.update(runId, { reverted: { at: (/* @__PURE__ */ new Date()).toISOString(), ...outcome } });
22435
22459
  this.deps.store.emit(runId, "run.reverted", { restored: outcome.restored.length, skipped: outcome.skipped.length });
22436
- if (outcome.restored.length && this.deps.preview.isRunning()) this.deps.preview.bumpRevision();
22460
+ if (outcome.restored.length && this.deps.preview.isRunning()) void this.deps.preview.reload().catch(() => void 0);
22437
22461
  return outcome;
22438
22462
  }
22439
22463
  /**
@@ -22452,7 +22476,7 @@ var init_engine = __esm({
22452
22476
  if ("error" in outcome) return outcome;
22453
22477
  this.deps.store.update(runId, { restoredFiles: [.../* @__PURE__ */ new Set([...run.restoredFiles ?? [], path])] });
22454
22478
  this.deps.store.emit(runId, "file.restored", { path });
22455
- if (this.deps.preview.isRunning()) this.deps.preview.bumpRevision();
22479
+ if (this.deps.preview.isRunning()) void this.deps.preview.reload().catch(() => void 0);
22456
22480
  return outcome;
22457
22481
  }
22458
22482
  stopped(runId) {
@@ -22607,7 +22631,8 @@ var init_engine = __esm({
22607
22631
  const cancelledNow = () => this.stopped(runId);
22608
22632
  if (!checkSpecs.length) unknowns.push("No typecheck or test script, so the code was not checked.");
22609
22633
  if (this.deps.preview.isRunning()) {
22610
- this.deps.preview.bumpRevision();
22634
+ if (changes.length) await this.deps.preview.reload();
22635
+ else this.deps.preview.bumpRevision();
22611
22636
  const ready = await this.deps.preview.waitForReady();
22612
22637
  if (cancelledNow()) return this.finishCancelled(runId, changes, notProven);
22613
22638
  const answerHttp = ready.url ? await this.deps.preview.fetchStatus(ready.url, 6e4) : null;
@@ -25704,7 +25729,8 @@ async function runConnect(options, deps) {
25704
25729
  const reply = await call(deps, "POST", `/v1/runner/jobs/${encodeURIComponent(job.id)}/result`, result, runnerAccessToken);
25705
25730
  if (unauthorized(reply.status)) break;
25706
25731
  if (reply.status >= 200 && reply.status < 300) {
25707
- log(result.status === "succeeded" ? ` \u2713 ${result.outputSummary[0]} (sent to the site)` : ` \u2717 ${result.outputSummary[0] ?? "Could not finish."} (sent to the site)`);
25732
+ const sign = { succeeded: "\u2713", needs_user: "\u2022", cancelled: "\u25A0", failed: "\u2717" }[result.status] ?? "\u2717";
25733
+ log(` ${sign} ${result.outputSummary[0] ?? "Could not finish."} (sent to the site)`);
25708
25734
  return;
25709
25735
  }
25710
25736
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viberaven/cli",
3
- "version": "1.6.10",
3
+ "version": "1.6.12",
4
4
  "description": "VibeRaven CLI and local Studio: Supabase RLS and security check for AI-built Vercel + Supabase apps, with an agent task list and fix prompts.",
5
5
  "license": "MIT",
6
6
  "author": "VibeRaven",