@viberaven/cli 1.1.1 → 1.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.
package/dist/cli.js CHANGED
@@ -621,12 +621,12 @@ function createOpenCommand(target, platform = process.platform) {
621
621
  }
622
622
  async function openWithSystemDefault(target) {
623
623
  const { command, args, shell } = createOpenCommand(target);
624
- await new Promise((resolve5, reject) => {
624
+ await new Promise((resolve6, reject) => {
625
625
  const child = (0, import_node_child_process.spawn)(command, args, { stdio: "ignore", shell });
626
626
  child.on("error", reject);
627
627
  child.on("exit", (code) => {
628
628
  if (code === 0) {
629
- resolve5();
629
+ resolve6();
630
630
  } else {
631
631
  reject(new Error(`Could not open browser (exit ${code ?? "unknown"}). Open manually: ${target}`));
632
632
  }
@@ -668,7 +668,7 @@ function healApplyGapCommand(gapId) {
668
668
  // src/auth.ts
669
669
  var PUBLIC_LOGIN_COMMAND = `${PUBLIC_COMMAND} login`;
670
670
  function sleep(ms) {
671
- return new Promise((resolve5) => setTimeout(resolve5, ms));
671
+ return new Promise((resolve6) => setTimeout(resolve6, ms));
672
672
  }
673
673
  async function runDeviceLogin(apiBaseUrl) {
674
674
  const signIn = await startManagedSignIn(apiBaseUrl);
@@ -9766,12 +9766,12 @@ async function copyToClipboard(text) {
9766
9766
  }
9767
9767
  }
9768
9768
  function pipeToCommand(command, text, extraArgs = []) {
9769
- return new Promise((resolve5, reject) => {
9769
+ return new Promise((resolve6, reject) => {
9770
9770
  const child = (0, import_node_child_process2.spawn)(command, extraArgs, { stdio: ["pipe", "ignore", "ignore"] });
9771
9771
  child.on("error", reject);
9772
9772
  child.on("close", (code) => {
9773
9773
  if (code === 0) {
9774
- resolve5();
9774
+ resolve6();
9775
9775
  } else {
9776
9776
  reject(new Error(`${command} exited with code ${code ?? "unknown"}`));
9777
9777
  }
@@ -10167,10 +10167,10 @@ function sleepForRunnerPoll(ms, signal) {
10167
10167
  if (signal?.aborted) {
10168
10168
  return Promise.reject(createRunnerWatchAbortError());
10169
10169
  }
10170
- return new Promise((resolve5, reject) => {
10170
+ return new Promise((resolve6, reject) => {
10171
10171
  const timer = setTimeout(() => {
10172
10172
  cleanup();
10173
- resolve5();
10173
+ resolve6();
10174
10174
  }, ms);
10175
10175
  const onAbort = () => {
10176
10176
  cleanup();
@@ -10742,9 +10742,9 @@ function formatRepoMatch(repoMatch) {
10742
10742
  }
10743
10743
  }
10744
10744
  async function runCommand(command, args, cwd) {
10745
- return new Promise((resolve5) => {
10745
+ return new Promise((resolve6) => {
10746
10746
  (0, import_node_child_process3.execFile)(command, args, { cwd, windowsHide: true }, (error, stdout, stderr) => {
10747
- resolve5({
10747
+ resolve6({
10748
10748
  ok: !error,
10749
10749
  stdout: String(stdout ?? ""),
10750
10750
  stderr: String(stderr ?? "")
@@ -11454,7 +11454,7 @@ function buildAgentFixPrompt(artifact, gap2) {
11454
11454
  }
11455
11455
 
11456
11456
  // src/version.ts
11457
- var VERSION = "1.1.1";
11457
+ var VERSION = "1.1.3";
11458
11458
 
11459
11459
  // src/commands/guide.ts
11460
11460
  var import_picocolors3 = __toESM(require_picocolors());
@@ -14468,6 +14468,28 @@ function printNextActionBlock(block) {
14468
14468
  console.log(NEXT_ACTION_END);
14469
14469
  }
14470
14470
 
14471
+ // src/output/actionPanelBlock.ts
14472
+ var ACTION_PANEL_START = "VIBERAVEN_ACTION_PANEL_START";
14473
+ var ACTION_PANEL_END = "VIBERAVEN_ACTION_PANEL_END";
14474
+ function buildActionPanelBlock(reportPath) {
14475
+ return {
14476
+ VIBERAVEN_ACTION_PANEL: {
14477
+ surface: "local-report",
14478
+ title: "Visual action panel",
14479
+ reportPath,
14480
+ openCommand: "npx -y viberaven report --open",
14481
+ nextCommand: "npx -y viberaven next --json",
14482
+ agentInstruction: "Use the native chat for reasoning. Open this local report only when the user needs buttons, provider links, copy actions, or visual progress."
14483
+ }
14484
+ };
14485
+ }
14486
+ function printActionPanelBlock(reportPath) {
14487
+ const block = buildActionPanelBlock(reportPath);
14488
+ console.log(ACTION_PANEL_START);
14489
+ console.log(JSON.stringify(block, null, 2));
14490
+ console.log(ACTION_PANEL_END);
14491
+ }
14492
+
14471
14493
  // src/output/operatorBlock.ts
14472
14494
  var OPERATOR_START = "VIBERAVEN_OPERATOR_START";
14473
14495
  var OPERATOR_END = "VIBERAVEN_OPERATOR_END";
@@ -15005,6 +15027,7 @@ async function scanDemoFixture(root) {
15005
15027
  }
15006
15028
 
15007
15029
  // src/demo/runDemo.ts
15030
+ var import_picocolors7 = __toESM(require_picocolors());
15008
15031
  function bundledFixtureRoot() {
15009
15032
  const candidates = [
15010
15033
  import_node_path27.default.join(__dirname, "..", "fixtures", "demo-saas"),
@@ -15012,6 +15035,73 @@ function bundledFixtureRoot() {
15012
15035
  ];
15013
15036
  return candidates.find((candidate) => (0, import_node_fs13.existsSync)(import_node_path27.default.join(candidate, "package.json"))) ?? candidates[0];
15014
15037
  }
15038
+ function canUseInteractiveTryMenu(options) {
15039
+ return options.label === "try" && !options.agentMode && !options.openReport && process.stdin.isTTY === true && process.stdout.isTTY === true && process.env.CI !== "true";
15040
+ }
15041
+ function printTryMenuSummary(input) {
15042
+ const providerStack = Array.from(new Set(Object.values(input.artifact.selectedProviders ?? {}))).filter(Boolean).join(" + ");
15043
+ console.log("");
15044
+ console.log("VibeRaven Try");
15045
+ console.log("No login. No OpenAI key. Local fixture only.");
15046
+ console.log("");
15047
+ console.log(`Demo stack: ${input.artifact.archetype}${providerStack ? ` (${providerStack})` : ""}`);
15048
+ console.log(
15049
+ `Decision: BLOCKED | Production core: ${input.artifact.productionCorePercent}% | Gaps: ${input.artifact.gaps.length}`
15050
+ );
15051
+ console.log("");
15052
+ console.log("Menu:");
15053
+ console.log(" 1. Open visual report");
15054
+ console.log(" npx -y viberaven try --open");
15055
+ console.log(" 2. Show Codex/Claude agent output");
15056
+ console.log(" npx -y viberaven try --agent-mode");
15057
+ console.log(" 3. Run VibeRaven on your real app");
15058
+ console.log(" npx -y viberaven --agent-mode");
15059
+ console.log("");
15060
+ console.log(`Local UI: ${input.reportPath}`);
15061
+ if (input.opened) {
15062
+ console.log("Opened visual report in your browser.");
15063
+ }
15064
+ console.log("");
15065
+ }
15066
+ async function runInteractiveTryMenu(input) {
15067
+ Ie(`${import_picocolors7.default.bold("VibeRaven Try")} ${import_picocolors7.default.dim("local, no login, no API spend")}`);
15068
+ M2.message(
15069
+ `Demo stack: ${input.artifact.archetype} | Production core ${input.artifact.productionCorePercent}% | ${input.artifact.gaps.length} gaps`
15070
+ );
15071
+ const action = await ve({
15072
+ message: "What do you want to see?",
15073
+ options: [
15074
+ { value: "open-report", label: "Open visual report", hint: "Browser action panel" },
15075
+ { value: "agent-output", label: "Show Codex/Claude output", hint: "Native chat transcript" },
15076
+ { value: "real-app", label: "Run on my real app", hint: "Copy/use the agent command" },
15077
+ { value: "exit", label: "Exit" }
15078
+ ]
15079
+ });
15080
+ if (pD(action) || action === "exit") {
15081
+ Se(import_picocolors7.default.dim("Run npx -y viberaven try anytime."));
15082
+ return;
15083
+ }
15084
+ if (action === "open-report") {
15085
+ await openPathInBrowser(input.reportPath);
15086
+ Se(`Opened ${input.reportPath}`);
15087
+ return;
15088
+ }
15089
+ if (action === "agent-output") {
15090
+ const prp = generateProductionProtocol(input.artifact, {
15091
+ mode: "demo",
15092
+ connectedTools: input.connectedTools
15093
+ });
15094
+ printOperatorBlock(prp, buildTaskList(input.artifact), currentRenderMode("demo"));
15095
+ printActionPanelBlock(input.reportPath);
15096
+ Se(import_picocolors7.default.dim("This is the output Codex/Claude/Cursor should reason over."));
15097
+ return;
15098
+ }
15099
+ console.log("");
15100
+ console.log("Run this inside Codex, Claude Code, Cursor, Windsurf, or Gemini CLI:");
15101
+ console.log(" npx -y viberaven --agent-mode");
15102
+ console.log("");
15103
+ Se(import_picocolors7.default.dim("The native agent chat stays the main UX; the report is the visual action panel."));
15104
+ }
15015
15105
  async function runDemo(options) {
15016
15106
  const label2 = options.label ?? "demo";
15017
15107
  const connectedTools = detectConnectedTools();
@@ -15021,12 +15111,21 @@ async function runDemo(options) {
15021
15111
  ...scannedArtifact,
15022
15112
  workspacePath: options.cwd
15023
15113
  };
15024
- await writeScanArtifacts({
15114
+ const paths = await writeScanArtifacts({
15025
15115
  artifact,
15026
15116
  cwd: options.cwd,
15027
15117
  connectedTools,
15028
15118
  prpMode: "demo"
15029
15119
  });
15120
+ let reportOpened = false;
15121
+ if (options.openReport) {
15122
+ try {
15123
+ await openPathInBrowser(paths.reportPath);
15124
+ reportOpened = true;
15125
+ } catch (error) {
15126
+ console.warn(error instanceof Error ? error.message : String(error));
15127
+ }
15128
+ }
15030
15129
  if (options.agentMode) {
15031
15130
  console.log(
15032
15131
  label2 === "demo" ? "VibeRaven demo mode - no login, no API spend. Provider verification is simulated." : `VibeRaven ${label2 === "try" ? "Try" : "showcase run"} - no login, no API spend. Provider verification is simulated.`
@@ -15038,9 +15137,16 @@ async function runDemo(options) {
15038
15137
  if (celebration) {
15039
15138
  console.log(celebration);
15040
15139
  }
15140
+ printActionPanelBlock(paths.reportPath);
15141
+ } else if (label2 === "try") {
15142
+ if (canUseInteractiveTryMenu(options)) {
15143
+ await runInteractiveTryMenu({ artifact, reportPath: paths.reportPath, connectedTools });
15144
+ } else {
15145
+ printTryMenuSummary({ artifact, reportPath: paths.reportPath, opened: reportOpened });
15146
+ }
15041
15147
  } else {
15042
15148
  console.log(
15043
- label2 === "demo" ? "VibeRaven demo complete. See .viberaven/prp.json" : `VibeRaven ${label2 === "try" ? "Try" : "showcase run"} complete. See .viberaven/prp.json`
15149
+ label2 === "demo" ? "VibeRaven demo complete. See .viberaven/prp.json" : "VibeRaven showcase run complete. See .viberaven/prp.json"
15044
15150
  );
15045
15151
  }
15046
15152
  return 0;
@@ -15081,8 +15187,8 @@ Usage:
15081
15187
  viberaven --agent-mode --demo [path]
15082
15188
  Demo scan with operator output; no login, no managed API spend
15083
15189
 
15084
- viberaven try [path]
15085
- Free no-login local try run over a bundled fixture; no OpenAI key or managed API spend
15190
+ viberaven try [--open|--ui] [path]
15191
+ Free no-login local try run with a simple menu and visual report
15086
15192
 
15087
15193
  viberaven --showcase --agent-mode [path]
15088
15194
  Alias for the no-login local try run
@@ -15252,12 +15358,13 @@ function isBooleanFlag(command, key) {
15252
15358
  "apply",
15253
15359
  "yes",
15254
15360
  "no-verify",
15255
- "force-scan"
15361
+ "force-scan",
15362
+ "ui"
15256
15363
  ].includes(key)) {
15257
15364
  return true;
15258
15365
  }
15259
15366
  if (key === "strict") return true;
15260
- if (key === "open" && (command === "" || command === "scan" || command === "report")) return true;
15367
+ if (key === "open" && (command === "" || command === "scan" || command === "report" || command === "try")) return true;
15261
15368
  if (key === "verify" && command === "") return true;
15262
15369
  if (key === "vercel-supabase" && command === "audit") return true;
15263
15370
  if (key === "svg" && command === "badge") return true;
@@ -15273,6 +15380,9 @@ function shouldConsumeLeadingHyphenValue(command, key, value) {
15273
15380
  function hasFlag(flags, key) {
15274
15381
  return flags[key] === true || typeof flags[key] === "string";
15275
15382
  }
15383
+ function resolveCliPath(input) {
15384
+ return input ? (0, import_node_path28.resolve)(process.cwd(), input) : process.cwd();
15385
+ }
15276
15386
  async function guardEarlyVerifyScan(input) {
15277
15387
  if (input.flags["force-scan"] === true) {
15278
15388
  return void 0;
@@ -15623,6 +15733,7 @@ async function runScanCommand(flags, positional, options) {
15623
15733
  if (celebration) {
15624
15734
  console.log(celebration);
15625
15735
  }
15736
+ printActionPanelBlock(paths.reportPath);
15626
15737
  printMissingConnectedToolHints(prp);
15627
15738
  const plan = artifact.plan ?? "free";
15628
15739
  const block = buildNextActionBlock(tasks, updatedState, plan);
@@ -15779,11 +15890,16 @@ async function main() {
15779
15890
  return result.status.startsWith("refused") || result.status === "failed" ? 1 : 0;
15780
15891
  }
15781
15892
  if (command === "try") {
15782
- const cwd = positional[0] ? (0, import_node_path28.join)(process.cwd(), positional[0]) : process.cwd();
15783
- return runDemo({ cwd, agentMode: true, label: "try" });
15893
+ const cwd = resolveCliPath(positional[0]);
15894
+ return runDemo({
15895
+ cwd,
15896
+ agentMode: isAgentMode,
15897
+ label: "try",
15898
+ openReport: flags.open === true || flags.ui === true
15899
+ });
15784
15900
  }
15785
15901
  if (hasFlag(flags, "demo") || hasFlag(flags, "showcase")) {
15786
- const cwd = positional[0] ? (0, import_node_path28.join)(process.cwd(), positional[0]) : process.cwd();
15902
+ const cwd = resolveCliPath(positional[0]);
15787
15903
  return runDemo({ cwd, agentMode: isAgentMode, label: hasFlag(flags, "showcase") ? "showcase" : "demo" });
15788
15904
  }
15789
15905
  if (!command && (isAgentMode || flags.verify === true || wantsJson || wantsJsonl || wantsStrict)) {