@viberaven/cli 1.0.1 → 1.0.2

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/AGENTS.md CHANGED
@@ -9,7 +9,7 @@ VibeRaven is the Agent Context + Production Gate.
9
9
  Run from the project root:
10
10
 
11
11
  ```bash
12
- npx -y @viberaven/cli --agent-mode
12
+ npx -y viberaven --agent-mode
13
13
  ```
14
14
 
15
15
  Read in this order:
@@ -23,21 +23,21 @@ Read in this order:
23
23
  Fix one repo-code gap at a time. Prefer:
24
24
 
25
25
  ```bash
26
- npx -y @viberaven/cli next --json
27
- npx -y @viberaven/cli prompt --gap <id>
26
+ npx -y viberaven next --json
27
+ npx -y viberaven prompt --gap <id>
28
28
  ```
29
29
 
30
30
  After a fix:
31
31
 
32
32
  ```bash
33
- npx -y @viberaven/cli --verify
34
- npx -y @viberaven/cli --strict
33
+ npx -y viberaven --verify
34
+ npx -y viberaven --strict
35
35
  ```
36
36
 
37
37
  For Vercel + Supabase checks:
38
38
 
39
39
  ```bash
40
- npx -y @viberaven/cli audit --vercel-supabase
40
+ npx -y viberaven audit --vercel-supabase
41
41
  ```
42
42
 
43
43
  ## Production Copilot Loop
package/README.md CHANGED
@@ -5,7 +5,7 @@ VibeRaven is the Agent Context + Production Gate for AI-built apps. It gives Cla
5
5
  ## Humans
6
6
 
7
7
  ```bash
8
- npx -y @viberaven/cli
8
+ npx -y viberaven
9
9
  ```
10
10
 
11
11
  No subcommand is needed in a real terminal. It opens the interactive menu for sign-in, scan, report, provider guides, dashboards, prompts, and sign-out.
@@ -15,7 +15,7 @@ No subcommand is needed in a real terminal. It opens the interactive menu for si
15
15
  Agents should run:
16
16
 
17
17
  ```bash
18
- npx -y @viberaven/cli --agent-mode
18
+ npx -y viberaven --agent-mode
19
19
  ```
20
20
 
21
21
  Then read artifacts in this order:
@@ -29,16 +29,16 @@ Then read artifacts in this order:
29
29
  Fix one repo-code gap, then run:
30
30
 
31
31
  ```bash
32
- npx -y @viberaven/cli --verify
33
- npx -y @viberaven/cli --strict
32
+ npx -y viberaven --verify
33
+ npx -y viberaven --strict
34
34
  ```
35
35
 
36
36
  For focused work:
37
37
 
38
38
  ```bash
39
- npx -y @viberaven/cli next --json
40
- npx -y @viberaven/cli prompt --gap <id>
41
- npx -y @viberaven/cli audit --vercel-supabase
39
+ npx -y viberaven next --json
40
+ npx -y viberaven prompt --gap <id>
41
+ npx -y viberaven audit --vercel-supabase
42
42
  ```
43
43
 
44
44
  Provider dashboard checks are not cleared by repo-code edits. Billing/product configuration, DNS, webhooks, credentials, quotas, and live provider verification must be completed or verified in the provider dashboard or through read-only provider evidence.
@@ -56,9 +56,9 @@ If `stalled: true`, stop calling verify and address provider-action gaps or repo
56
56
  ## Machine Output
57
57
 
58
58
  ```bash
59
- npx -y @viberaven/cli --agent-mode --json
60
- npx -y @viberaven/cli --agent-mode --jsonl
61
- npx -y @viberaven/cli --strict --json
59
+ npx -y viberaven --agent-mode --json
60
+ npx -y viberaven --agent-mode --jsonl
61
+ npx -y viberaven --strict --json
62
62
  ```
63
63
 
64
64
  Machine artifact contract:
package/SECURITY.md CHANGED
@@ -13,15 +13,15 @@ The npm CLI does not read `OPENAI_API_KEY` and does not accept a bring-your-own-
13
13
  Human terminal:
14
14
 
15
15
  ```bash
16
- npx -y @viberaven/cli
16
+ npx -y viberaven
17
17
  ```
18
18
 
19
19
  Agent or CI gate:
20
20
 
21
21
  ```bash
22
- npx -y @viberaven/cli --agent-mode
23
- npx -y @viberaven/cli --verify
24
- npx -y @viberaven/cli --strict
22
+ npx -y viberaven --agent-mode
23
+ npx -y viberaven --verify
24
+ npx -y viberaven --strict
25
25
  ```
26
26
 
27
27
  VibeRaven is the Agent Context + Production Gate. Agents should read `.viberaven/agent-tasklist.md`, `.viberaven/gate-result.json`, and `.viberaven/context-map.json` before claiming an app is safe to deploy.
package/dist/cli.js CHANGED
@@ -170,8 +170,8 @@ __export(cli_exports, {
170
170
  runScanCommand: () => runScanCommand
171
171
  });
172
172
  module.exports = __toCommonJS(cli_exports);
173
- var import_promises16 = require("node:fs/promises");
174
- var import_node_path21 = require("node:path");
173
+ var import_promises17 = require("node:fs/promises");
174
+ var import_node_path22 = require("node:path");
175
175
 
176
176
  // src/config.ts
177
177
  var import_node_os = require("node:os");
@@ -641,7 +641,7 @@ async function openUrlInBrowser(url) {
641
641
  }
642
642
 
643
643
  // src/contracts/commands.ts
644
- var PUBLIC_PACKAGE = "@viberaven/cli";
644
+ var PUBLIC_PACKAGE = "viberaven";
645
645
  var PUBLIC_COMMAND = `npx -y ${PUBLIC_PACKAGE}`;
646
646
  var PUBLIC_AGENT_MODE_COMMAND = `${PUBLIC_COMMAND} --agent-mode`;
647
647
  var PUBLIC_VERIFY_COMMAND = `${PUBLIC_COMMAND} --verify`;
@@ -11224,7 +11224,7 @@ function buildAgentFixPrompt(artifact, gap) {
11224
11224
  }
11225
11225
 
11226
11226
  // src/version.ts
11227
- var VERSION = "1.0.0";
11227
+ var VERSION = "1.0.2";
11228
11228
 
11229
11229
  // src/commands/guide.ts
11230
11230
  var import_picocolors3 = __toESM(require_picocolors());
@@ -11491,12 +11491,23 @@ var import_promises8 = require("node:fs/promises");
11491
11491
  var import_node_path11 = require("node:path");
11492
11492
 
11493
11493
  // src/commands/agentRulesBlock.ts
11494
- var VIBERAVEN_AGENT_RULES_START = "<!-- viberaven:agent-rules:start -->";
11495
- var VIBERAVEN_AGENT_RULES_END = "<!-- viberaven:agent-rules:end -->";
11494
+ var VIBERAVEN_BLOCK_START = "<!-- VIBERAVEN:START -->";
11495
+ var VIBERAVEN_BLOCK_END = "<!-- VIBERAVEN:END -->";
11496
+ var VIBERAVEN_LEGACY_BLOCK_START = "<!-- viberaven:agent-rules:start -->";
11497
+ var VIBERAVEN_LEGACY_BLOCK_END = "<!-- viberaven:agent-rules:end -->";
11496
11498
  var HEAL_PLAN_GAP_COMMAND = healPlanGapCommand("<id>");
11497
11499
  var PROMPT_GAP_COMMAND = promptGapCommand("<id>");
11498
11500
  var HEAL_APPLY_GAP_COMMAND = `${PUBLIC_COMMAND} --heal --apply --gap <id> --yes`;
11499
- var AGENT_RULES_BODY = `## VibeRaven Production-Readiness Gate
11501
+ var AGENT_RULES_PREAMBLE = `VibeRaven provides production readiness for AI-built apps.
11502
+
11503
+ Canonical command: \`${PUBLIC_AGENT_MODE_COMMAND}\`
11504
+
11505
+ Use VibeRaven before launch, deployment, real users, auth, billing, database, RLS, env vars, webhooks, monitoring, or tests.
11506
+
11507
+ Agent loop: run VibeRaven, read Mission Map (\`.viberaven/mission-map.md\`), fix one launch gap, re-run VibeRaven.`;
11508
+ var AGENT_RULES_BODY = `${AGENT_RULES_PREAMBLE}
11509
+
11510
+ ## VibeRaven Production-Readiness Gate
11500
11511
 
11501
11512
  - Before running build, compile, cleanup, deployment, vercel, or supabase commands, run \`${PUBLIC_AGENT_MODE_COMMAND}\` first from the project root.
11502
11513
  - Treat VibeRaven as the Agent Context + Production Gate for AI-built apps, especially apps using Vercel, Supabase, auth, database, payments, webhooks, monitoring, rate limits, or environment variables.
@@ -11511,7 +11522,7 @@ var AGENT_RULES_BODY = `## VibeRaven Production-Readiness Gate
11511
11522
  - Run \`${PUBLIC_STRICT_COMMAND}\` before deploy or CI pass.
11512
11523
  - Use \`${HEAL_PLAN_GAP_COMMAND}\` before any heal apply.
11513
11524
  - Only use \`${HEAL_APPLY_GAP_COMMAND}\` for supported low-risk repo-code recipes.
11514
- - Preview local rule installation with \`${PUBLIC_COMMAND} init --dry-run\`.
11525
+ - Preview local rule installation with \`${PUBLIC_INIT_ALL_COMMAND} --dry-run\`.
11515
11526
  - Cleanup is non-destructive: only run \`${PUBLIC_CLEAN_PLAN_COMMAND}\` to create a reviewable cleanup plan.
11516
11527
  - Provider dashboard checks are not cleared by repo-code edits. Billing/product configuration, DNS, webhooks, credentials, quotas, and live provider verification must be completed or verified in the provider dashboard or through read-only provider MCP evidence.
11517
11528
  - Do not claim provider dashboard work is fixed by repo-code edits.
@@ -11539,14 +11550,40 @@ The loop is:
11539
11550
  9. If \`fixType === 'upgrade-required'\`, provide upgradeUrl and move on.
11540
11551
 
11541
11552
  Do not stop at "scan complete." The loop is not done until \`gate.status === 'clear'\`.`;
11553
+ var AGENT_CONTEXT_BODY = `${AGENT_RULES_PREAMBLE}
11554
+
11555
+ After \`--agent-mode\`, read these artifacts in order:
11556
+
11557
+ 1. \`.viberaven/mission-map.md\`
11558
+ 2. \`.viberaven/agent-tasklist.md\`
11559
+ 3. \`.viberaven/gate-result.json\`
11560
+ 4. \`.viberaven/context-map.json\``;
11561
+ var MISSION_MAP_BODY = `${AGENT_RULES_PREAMBLE}
11562
+
11563
+ ## Mission Map loop
11564
+
11565
+ 1. Run \`${PUBLIC_AGENT_MODE_COMMAND}\` from the project root.
11566
+ 2. Read \`.viberaven/agent-tasklist.md\` and \`.viberaven/gate-result.json\`.
11567
+ 3. Fix one launch gap.
11568
+ 4. Re-run VibeRaven until \`gate.status === 'clear'\`.`;
11569
+ var BLOCK_MARKER_PAIRS = [
11570
+ [VIBERAVEN_BLOCK_START, VIBERAVEN_BLOCK_END],
11571
+ [VIBERAVEN_LEGACY_BLOCK_START, VIBERAVEN_LEGACY_BLOCK_END]
11572
+ ];
11542
11573
  function buildAgentRulesBlock() {
11543
- return [VIBERAVEN_AGENT_RULES_START, AGENT_RULES_BODY, VIBERAVEN_AGENT_RULES_END].join("\n");
11574
+ return wrapViberavenBlock(AGENT_RULES_BODY);
11575
+ }
11576
+ function buildAgentContextBlock() {
11577
+ return wrapViberavenBlock(AGENT_CONTEXT_BODY);
11578
+ }
11579
+ function buildMissionMapBlock() {
11580
+ return wrapViberavenBlock(MISSION_MAP_BODY);
11581
+ }
11582
+ function wrapViberavenBlock(body) {
11583
+ return [VIBERAVEN_BLOCK_START, body, VIBERAVEN_BLOCK_END].join("\n");
11544
11584
  }
11545
11585
  function injectAgentRulesBlock(existingContent, replacementBlock = buildAgentRulesBlock()) {
11546
- const boundedBlockPattern = new RegExp(
11547
- `${escapeRegExp3(VIBERAVEN_AGENT_RULES_START)}[\\s\\S]*?${escapeRegExp3(VIBERAVEN_AGENT_RULES_END)}`
11548
- );
11549
- const existingMatch = boundedBlockPattern.exec(existingContent);
11586
+ const existingMatch = findBoundedBlock(existingContent);
11550
11587
  if (existingMatch) {
11551
11588
  const content = replaceExistingAgentRulesBlock({
11552
11589
  existingContent,
@@ -11564,8 +11601,20 @@ function injectAgentRulesBlock(existingContent, replacementBlock = buildAgentRul
11564
11601
  changed: true
11565
11602
  };
11566
11603
  }
11604
+ function findBoundedBlock(content) {
11605
+ for (const [start, end] of BLOCK_MARKER_PAIRS) {
11606
+ const boundedBlockPattern = new RegExp(
11607
+ `${escapeRegExp3(start)}[\\s\\S]*?${escapeRegExp3(end)}`
11608
+ );
11609
+ const match = boundedBlockPattern.exec(content);
11610
+ if (match) {
11611
+ return match;
11612
+ }
11613
+ }
11614
+ return null;
11615
+ }
11567
11616
  function replaceExistingAgentRulesBlock(input) {
11568
- const replacementMarkerIndex = input.replacementBlock.indexOf(VIBERAVEN_AGENT_RULES_START);
11617
+ const replacementMarkerIndex = findBlockStartIndex(input.replacementBlock);
11569
11618
  const existingStart = input.existingMatch.index;
11570
11619
  const existingEnd = existingStart + input.existingMatch[0].length;
11571
11620
  if (replacementMarkerIndex === -1) {
@@ -11583,6 +11632,10 @@ function replaceExistingAgentRulesBlock(input) {
11583
11632
  existingEnd
11584
11633
  )}`;
11585
11634
  }
11635
+ function findBlockStartIndex(block) {
11636
+ const indices = BLOCK_MARKER_PAIRS.map(([start]) => block.indexOf(start)).filter((index) => index !== -1);
11637
+ return indices.length > 0 ? Math.min(...indices) : -1;
11638
+ }
11586
11639
  function findGeneratedPrefixStart(input) {
11587
11640
  if (!input.replacementPrefix) {
11588
11641
  return input.fallbackStart;
@@ -11627,6 +11680,8 @@ var AGENT_RULE_TARGETS = {
11627
11680
  cursorLegacy: { file: ".cursorrules", aliases: ["cursor-legacy"] },
11628
11681
  copilot: { file: ".github/copilot-instructions.md", aliases: ["github-copilot"] },
11629
11682
  gemini: { file: "GEMINI.md" },
11683
+ agentContext: { file: ".viberaven/agent-context.md", aliases: ["agent-context"] },
11684
+ missionMap: { file: ".viberaven/mission-map.md", aliases: ["mission-map"] },
11630
11685
  devin: { file: ".devin/rules/viberaven.md" },
11631
11686
  windsurf: { file: ".windsurf/rules/viberaven.md" },
11632
11687
  cline: { file: ".clinerules/viberaven.md" },
@@ -11634,13 +11689,17 @@ var AGENT_RULE_TARGETS = {
11634
11689
  junie: { file: ".junie/guidelines.md" },
11635
11690
  zed: { file: ".rules" }
11636
11691
  };
11637
- var ALL_AGENT_RULE_TARGETS = [
11692
+ var CORE_AGENT_INJECTION_TARGETS = [
11638
11693
  "codex",
11639
11694
  "claude",
11695
+ "gemini",
11640
11696
  "cursor",
11641
- "cursorLegacy",
11642
11697
  "copilot",
11643
- "gemini",
11698
+ "agentContext",
11699
+ "missionMap"
11700
+ ];
11701
+ var EXTENDED_AGENT_RULE_TARGETS = [
11702
+ "cursorLegacy",
11644
11703
  "devin",
11645
11704
  "windsurf",
11646
11705
  "cline",
@@ -11648,11 +11707,16 @@ var ALL_AGENT_RULE_TARGETS = [
11648
11707
  "junie",
11649
11708
  "zed"
11650
11709
  ];
11710
+ var ALL_AGENT_RULE_TARGETS = [
11711
+ ...CORE_AGENT_INJECTION_TARGETS,
11712
+ ...EXTENDED_AGENT_RULE_TARGETS
11713
+ ];
11651
11714
  var AGENT_RULE_TARGET_ALIAS_ENTRIES = ALL_AGENT_RULE_TARGETS.flatMap((target) => [
11652
11715
  [target.toLowerCase(), target],
11653
11716
  ...(AGENT_RULE_TARGETS[target].aliases ?? []).map((alias) => [alias, target])
11654
11717
  ]);
11655
11718
  var AGENT_RULE_TARGET_ALIASES = new Map(AGENT_RULE_TARGET_ALIAS_ENTRIES);
11719
+ var VALID_AGENT_RULES_TARGET_TEXT = "all, codex, claude, cursor, cursor-legacy, copilot, github-copilot, gemini, agent-context, mission-map, devin, windsurf, cline, roo, junie, zed";
11656
11720
  function renderAgentRulesForTarget(target) {
11657
11721
  if (target === "claude") {
11658
11722
  return ["@AGENTS.md", "", buildAgentRulesBlock()].join("\n");
@@ -11668,12 +11732,39 @@ function renderAgentRulesForTarget(target) {
11668
11732
  buildAgentRulesBlock()
11669
11733
  ].join("\n");
11670
11734
  }
11735
+ if (target === "agentContext") {
11736
+ return ["# VibeRaven Agent Context", "", buildAgentContextBlock()].join("\n");
11737
+ }
11738
+ if (target === "missionMap") {
11739
+ return ["# VibeRaven Mission Map", "", buildMissionMapBlock()].join("\n");
11740
+ }
11671
11741
  return buildAgentRulesBlock();
11672
11742
  }
11743
+ function validAgentRulesTargetText() {
11744
+ return VALID_AGENT_RULES_TARGET_TEXT;
11745
+ }
11746
+ function getAgentRulesTargets(value) {
11747
+ if (value === void 0 || value.trim() === "" || value.trim().toLowerCase() === "all") {
11748
+ return [...CORE_AGENT_INJECTION_TARGETS];
11749
+ }
11750
+ const requested = value.split(",").map((target) => target.trim().toLowerCase()).filter(Boolean);
11751
+ if (requested.length === 0 || requested.includes("all")) {
11752
+ return [...CORE_AGENT_INJECTION_TARGETS];
11753
+ }
11754
+ const resolved = requested.map((target) => {
11755
+ const canonicalTarget = AGENT_RULE_TARGET_ALIASES.get(target);
11756
+ if (!canonicalTarget) {
11757
+ throw new Error(`Unknown agent rules target "${target}". Valid targets: ${validAgentRulesTargetText()}.`);
11758
+ }
11759
+ return canonicalTarget;
11760
+ });
11761
+ const requestedTargets = new Set(resolved);
11762
+ return ALL_AGENT_RULE_TARGETS.filter((target) => requestedTargets.has(target));
11763
+ }
11673
11764
 
11674
11765
  // src/commands/initRules.ts
11675
11766
  async function initAgentRules(options) {
11676
- const targets = options.targets ?? [...ALL_AGENT_RULE_TARGETS];
11767
+ const targets = options.targets ?? [...CORE_AGENT_INJECTION_TARGETS];
11677
11768
  const results = [];
11678
11769
  for (const target of targets) {
11679
11770
  const file = AGENT_RULE_TARGETS[target].file;
@@ -11689,6 +11780,46 @@ async function initAgentRules(options) {
11689
11780
  }
11690
11781
  return results;
11691
11782
  }
11783
+ function renderAgentRulesDryRun(targets) {
11784
+ const files = targets.map((target) => `- ${target}: ${AGENT_RULE_TARGETS[target].file}`).join("\n");
11785
+ const previews = targets.flatMap((target) => [
11786
+ `Preview: ${target} (${AGENT_RULE_TARGETS[target].file})`,
11787
+ "",
11788
+ renderAgentRulesForTarget(target)
11789
+ ]);
11790
+ return [`VibeRaven agent rules dry run`, "", `Target files:`, files, "", ...previews].join("\n");
11791
+ }
11792
+ function formatAgentRulesInitSummary(results) {
11793
+ const created = results.filter((result) => result.action === "created");
11794
+ const updated = results.filter((result) => result.action === "updated");
11795
+ const skipped = results.filter((result) => result.action === "unchanged");
11796
+ const lines = ["VibeRaven agent injection summary", ""];
11797
+ if (created.length > 0) {
11798
+ lines.push("Created:");
11799
+ for (const result of created) {
11800
+ lines.push(` + ${result.file}`);
11801
+ }
11802
+ lines.push("");
11803
+ }
11804
+ if (updated.length > 0) {
11805
+ lines.push("Updated:");
11806
+ for (const result of updated) {
11807
+ lines.push(` ~ ${result.file}`);
11808
+ }
11809
+ lines.push("");
11810
+ }
11811
+ if (skipped.length > 0) {
11812
+ lines.push("Skipped (unchanged):");
11813
+ for (const result of skipped) {
11814
+ lines.push(` = ${result.file}`);
11815
+ }
11816
+ lines.push("");
11817
+ }
11818
+ lines.push(
11819
+ `Done: ${created.length} created, ${updated.length} updated, ${skipped.length} skipped.`
11820
+ );
11821
+ return lines.join("\n");
11822
+ }
11692
11823
  async function readExistingFile(path) {
11693
11824
  try {
11694
11825
  return { exists: true, content: await (0, import_promises8.readFile)(path, "utf-8") };
@@ -11911,7 +12042,7 @@ async function handleAuth() {
11911
12042
  await runDeviceLogin(apiBaseUrl);
11912
12043
  }
11913
12044
  async function handleAgentRules(cwd) {
11914
- const results = await initAgentRules({ cwd, targets: ["codex", "claude", "cursor"] });
12045
+ const results = await initAgentRules({ cwd });
11915
12046
  for (const result of results) {
11916
12047
  const color = result.action === "created" ? import_picocolors4.default.green : result.action === "updated" ? import_picocolors4.default.yellow : import_picocolors4.default.dim;
11917
12048
  M2.message(color(`${result.action.toUpperCase()}: ${result.file}`));
@@ -12325,7 +12456,7 @@ function applyRlsRecipe(_source) {
12325
12456
  dashboardUrl: "https://supabase.com/dashboard/project/{{PROJECT_REF}}/auth/policies",
12326
12457
  exactStep: 'Enable Row Level Security (RLS) on each table under the "Table Editor" or "Auth > Policies" section.',
12327
12458
  doneSignal: "RLS toggle is green for all public tables",
12328
- verifyCommand: "npx -y @viberaven/cli audit --vercel-supabase --json"
12459
+ verifyCommand: "npx -y viberaven audit --vercel-supabase --json"
12329
12460
  }
12330
12461
  };
12331
12462
  }
@@ -12992,6 +13123,112 @@ async function recommendStack(cwd = process.cwd()) {
12992
13123
  return rec;
12993
13124
  }
12994
13125
 
13126
+ // src/commands/runInit.ts
13127
+ async function runInitCommand(options) {
13128
+ let targets;
13129
+ try {
13130
+ targets = getAgentRulesTargets(options.agents);
13131
+ } catch (error) {
13132
+ console.error(error instanceof Error ? error.message : String(error));
13133
+ return 1;
13134
+ }
13135
+ if (options.dryRun) {
13136
+ console.log(renderAgentRulesDryRun(targets));
13137
+ return 0;
13138
+ }
13139
+ const results = await initAgentRules({
13140
+ cwd: options.cwd,
13141
+ targets,
13142
+ dryRun: false
13143
+ });
13144
+ console.log(formatAgentRulesInitSummary(results));
13145
+ return 0;
13146
+ }
13147
+
13148
+ // src/commands/doctorAgents.ts
13149
+ var import_promises16 = require("node:fs/promises");
13150
+ var import_node_path20 = require("node:path");
13151
+ var REQUIRED_EXISTENCE_CHECKS = [
13152
+ { id: "agents-md", file: "AGENTS.md" },
13153
+ { id: "claude-md", file: "CLAUDE.md" },
13154
+ { id: "cursor-rule", file: ".cursor/rules/viberaven.mdc" },
13155
+ { id: "copilot-instructions", file: ".github/copilot-instructions.md" }
13156
+ ];
13157
+ var STALE_PATTERNS = [
13158
+ { id: "stale-beta-scan", pattern: "@beta scan" },
13159
+ { id: "stale-viberaven-station", pattern: "viberaven-station" },
13160
+ { id: "stale-viberice", pattern: "viberice" }
13161
+ ];
13162
+ async function checkAgentInjection(cwd) {
13163
+ const checks = [];
13164
+ for (const item3 of REQUIRED_EXISTENCE_CHECKS) {
13165
+ const exists = await fileExists((0, import_node_path20.join)(cwd, item3.file));
13166
+ checks.push({
13167
+ id: item3.id,
13168
+ status: exists ? "pass" : "fail",
13169
+ message: exists ? `${item3.file} exists` : `Missing ${item3.file}`
13170
+ });
13171
+ }
13172
+ for (const target of CORE_AGENT_INJECTION_TARGETS) {
13173
+ const file = AGENT_RULE_TARGETS[target].file;
13174
+ const path = (0, import_node_path20.join)(cwd, file);
13175
+ const exists = await fileExists(path);
13176
+ if (!exists) {
13177
+ checks.push({
13178
+ id: `canonical-${target}`,
13179
+ status: "fail",
13180
+ message: `Cannot verify canonical command \u2014 missing ${file}`
13181
+ });
13182
+ continue;
13183
+ }
13184
+ const content = await (0, import_promises16.readFile)(path, "utf-8");
13185
+ const hasCommand = content.includes(PUBLIC_AGENT_MODE_COMMAND);
13186
+ checks.push({
13187
+ id: `canonical-${target}`,
13188
+ status: hasCommand ? "pass" : "fail",
13189
+ message: hasCommand ? `Canonical command found in ${file}` : `Missing canonical command in ${file}`
13190
+ });
13191
+ for (const stale of STALE_PATTERNS) {
13192
+ if (content.includes(stale.pattern)) {
13193
+ checks.push({
13194
+ id: `${stale.id}-${target}`,
13195
+ status: "fail",
13196
+ message: `Stale ${stale.pattern} reference in ${file}`
13197
+ });
13198
+ }
13199
+ }
13200
+ }
13201
+ return {
13202
+ ok: checks.every((check) => check.status === "pass"),
13203
+ checks
13204
+ };
13205
+ }
13206
+ function formatDoctorAgentsReport(report) {
13207
+ const lines = ["VibeRaven agent injection doctor", ""];
13208
+ for (const check of report.checks) {
13209
+ const icon = check.status === "pass" ? "\u2713" : "\u2717";
13210
+ lines.push(`${icon} ${check.message}`);
13211
+ }
13212
+ lines.push("");
13213
+ lines.push(report.ok ? "All agent injection checks passed." : "Agent injection checks failed.");
13214
+ return lines.join("\n");
13215
+ }
13216
+ async function fileExists(path) {
13217
+ try {
13218
+ await (0, import_promises16.access)(path);
13219
+ return true;
13220
+ } catch {
13221
+ return false;
13222
+ }
13223
+ }
13224
+
13225
+ // src/commands/runDoctor.ts
13226
+ async function runDoctorAgentsCommand(options) {
13227
+ const report = await checkAgentInjection(options.cwd);
13228
+ console.log(formatDoctorAgentsReport(report));
13229
+ return report.ok ? 0 : 1;
13230
+ }
13231
+
12995
13232
  // src/output/nextActionBlock.ts
12996
13233
  function buildNextActionBlock(tasks, loopState, plan) {
12997
13234
  const batchSize = plan === "pro" ? 10 : 3;
@@ -13030,7 +13267,7 @@ function buildNextActionBlock(tasks, loopState, plan) {
13030
13267
  title: repoCodeTask.title,
13031
13268
  mcpTool: repoCodeTask.mcpTool,
13032
13269
  mcpArgs: repoCodeTask.mcpArgs,
13033
- fallbackCommand: repoCodeTask.mcpArgs ? `npx -y @viberaven/cli --heal --apply --gap ${repoCodeTask.gapId} --yes` : void 0,
13270
+ fallbackCommand: repoCodeTask.mcpArgs ? `npx -y viberaven --heal --apply --gap ${repoCodeTask.gapId} --yes` : void 0,
13034
13271
  requiresUserAction: false
13035
13272
  };
13036
13273
  }
@@ -13113,17 +13350,17 @@ function printNextActionBlock(block) {
13113
13350
  // src/providerMcpBridge.ts
13114
13351
  var import_node_fs10 = require("node:fs");
13115
13352
  var import_node_os2 = require("node:os");
13116
- var import_node_path20 = require("node:path");
13353
+ var import_node_path21 = require("node:path");
13117
13354
  var UPGRADE_URL4 = "https://viberaven.dev/pricing";
13118
- var FALLBACK_COMMAND = "npx -y @viberaven/cli audit --vercel-supabase --json";
13355
+ var FALLBACK_COMMAND = "npx -y viberaven audit --vercel-supabase --json";
13119
13356
  var SUPPORTED_PROVIDERS = /* @__PURE__ */ new Set(["supabase", "vercel"]);
13120
13357
  var configPathsOverride;
13121
13358
  function defaultMcpConfigPaths() {
13122
13359
  const home = (0, import_node_os2.homedir)();
13123
13360
  return [
13124
- (0, import_node_path20.join)(home, ".config", "claude", "claude_desktop_config.json"),
13125
- (0, import_node_path20.join)(home, ".cursor", "mcp.json"),
13126
- (0, import_node_path20.join)(home, ".gemini", "antigravity", "mcp_config.json")
13361
+ (0, import_node_path21.join)(home, ".config", "claude", "claude_desktop_config.json"),
13362
+ (0, import_node_path21.join)(home, ".cursor", "mcp.json"),
13363
+ (0, import_node_path21.join)(home, ".gemini", "antigravity", "mcp_config.json")
13127
13364
  ];
13128
13365
  }
13129
13366
  function resolveConfigPaths() {
@@ -13266,6 +13503,12 @@ Usage:
13266
13503
  viberaven open [provider|url]
13267
13504
  Open dashboard URL from next action or playbook
13268
13505
 
13506
+ viberaven init [--agents all|codex,claude,...] [--dry-run] [path]
13507
+ Install bounded VibeRaven agent rules (${PUBLIC_INIT_ALL_COMMAND})
13508
+
13509
+ viberaven doctor --agents [path]
13510
+ Verify agent instruction files and canonical commands
13511
+
13269
13512
 
13270
13513
 
13271
13514
  Agent workflow (Claude Code / Codex):
@@ -13352,6 +13595,8 @@ function isBooleanFlag(command, key) {
13352
13595
  if (key === "open" && (command === "" || command === "scan" || command === "report")) return true;
13353
13596
  if (key === "verify" && command === "") return true;
13354
13597
  if (key === "vercel-supabase" && command === "audit") return true;
13598
+ if (key === "dry-run" && command === "init") return true;
13599
+ if (key === "agents" && command === "doctor") return true;
13355
13600
  return false;
13356
13601
  }
13357
13602
  function shouldConsumeLeadingHyphenValue(command, key, value) {
@@ -13368,7 +13613,7 @@ async function guardEarlyVerifyScan(input) {
13368
13613
  if (!verifyLike) {
13369
13614
  return void 0;
13370
13615
  }
13371
- const workspacePath = input.positional[0] ? (0, import_node_path21.join)(process.cwd(), input.positional[0]) : await resolveWorkspaceRoot(process.cwd());
13616
+ const workspacePath = input.positional[0] ? (0, import_node_path22.join)(process.cwd(), input.positional[0]) : await resolveWorkspaceRoot(process.cwd());
13372
13617
  const loopState = await loadLoopState(workspacePath);
13373
13618
  if (loopState.batchApplied <= 0) {
13374
13619
  return void 0;
@@ -13394,7 +13639,7 @@ async function guardEarlyVerifyScan(input) {
13394
13639
  const nextTask = remainingRepoCodeTasks[0];
13395
13640
  console.error("SCAN_DEFERRED: Local heal batch is not full yet, so VibeRaven is protecting scan quota.");
13396
13641
  console.error(`Batch progress: ${loopState.batchApplied}/${batchSize} local heals applied since the last scan.`);
13397
- console.error(`Next local heal: npx -y @viberaven/cli --heal --apply --gap ${nextTask.gapId} --yes`);
13642
+ console.error(`Next local heal: npx -y viberaven --heal --apply --gap ${nextTask.gapId} --yes`);
13398
13643
  console.error("Run verify again after the batch is full, or add --force-scan if the user explicitly wants to spend a scan now.");
13399
13644
  return 4;
13400
13645
  }
@@ -13444,7 +13689,7 @@ async function cmdStatus(flags, positional) {
13444
13689
  console.log("Not signed in. Run: viberaven login");
13445
13690
  return 1;
13446
13691
  }
13447
- const startDir = positional[0] ? (0, import_node_path21.join)(process.cwd(), positional[0]) : process.cwd();
13692
+ const startDir = positional[0] ? (0, import_node_path22.join)(process.cwd(), positional[0]) : process.cwd();
13448
13693
  let artifact;
13449
13694
  try {
13450
13695
  artifact = await loadLastArtifact(startDir);
@@ -13598,7 +13843,7 @@ async function cmdWatch(flags) {
13598
13843
  }
13599
13844
  }
13600
13845
  async function runScanCommand(flags, positional, options) {
13601
- const workspacePath = positional[0] ? (0, import_node_path21.join)(process.cwd(), positional[0]) : await resolveWorkspaceRoot(process.cwd());
13846
+ const workspacePath = positional[0] ? (0, import_node_path22.join)(process.cwd(), positional[0]) : await resolveWorkspaceRoot(process.cwd());
13602
13847
  const apiBaseUrl = resolveApiBaseUrl(typeof flags["api-url"] === "string" ? flags["api-url"] : void 0);
13603
13848
  let accessToken;
13604
13849
  try {
@@ -13676,7 +13921,7 @@ async function runScanCommand(flags, positional, options) {
13676
13921
  return { exitCode: 0, artifacts: paths };
13677
13922
  }
13678
13923
  async function cmdReport(flags, positional) {
13679
- const startDir = positional[0] ? (0, import_node_path21.join)(process.cwd(), positional[0]) : process.cwd();
13924
+ const startDir = positional[0] ? (0, import_node_path22.join)(process.cwd(), positional[0]) : process.cwd();
13680
13925
  try {
13681
13926
  const paths = await refreshReportFromDisk(startDir);
13682
13927
  console.log(`Report refreshed: ${paths.reportPath}`);
@@ -13698,7 +13943,7 @@ async function cmdReport(flags, positional) {
13698
13943
  }
13699
13944
  }
13700
13945
  async function cmdPrompt(flags, positional) {
13701
- const startDir = positional[0] ? (0, import_node_path21.join)(process.cwd(), positional[0]) : process.cwd();
13946
+ const startDir = positional[0] ? (0, import_node_path22.join)(process.cwd(), positional[0]) : process.cwd();
13702
13947
  let artifact;
13703
13948
  try {
13704
13949
  artifact = await loadLastArtifact(startDir);
@@ -13796,7 +14041,7 @@ async function main() {
13796
14041
  const wantsJsonl = hasFlag(flags, "jsonl");
13797
14042
  const wantsStrict = hasFlag(flags, "strict");
13798
14043
  if (flags.condense) {
13799
- const cwd = positional[0] ? (0, import_node_path21.join)(process.cwd(), positional[0]) : process.cwd();
14044
+ const cwd = positional[0] ? (0, import_node_path22.join)(process.cwd(), positional[0]) : process.cwd();
13800
14045
  const result = await runCondenseCommand({ cwd });
13801
14046
  console.log(`VibeRaven context map refreshed: ${result.contextMapPath}`);
13802
14047
  return 0;
@@ -13825,7 +14070,7 @@ async function main() {
13825
14070
  console.error("VibeRaven could not produce machine output because scan artifacts were not written.");
13826
14071
  return 3;
13827
14072
  }
13828
- const gateResult = scanResult.artifacts && (wantsJson || wantsJsonl || wantsStrict) ? JSON.parse(await (0, import_promises16.readFile)(scanResult.artifacts.gateResultPath, "utf8")) : void 0;
14073
+ const gateResult = scanResult.artifacts && (wantsJson || wantsJsonl || wantsStrict) ? JSON.parse(await (0, import_promises17.readFile)(scanResult.artifacts.gateResultPath, "utf8")) : void 0;
13829
14074
  const strictExitCode = wantsStrict && gateResult ? exitCodeForStrictGate(gateResult, { failOnWarnings: flags.strict === "warning" }) : scanResult.exitCode;
13830
14075
  if (wantsJson && gateResult) {
13831
14076
  process.stdout.write(renderGateResultJson(gateResult));
@@ -13860,7 +14105,7 @@ async function main() {
13860
14105
  case "next":
13861
14106
  return runNextCommand({
13862
14107
  json: Boolean(flags.json),
13863
- cwd: positional[0] ? (0, import_node_path21.join)(process.cwd(), positional[0]) : process.cwd()
14108
+ cwd: positional[0] ? (0, import_node_path22.join)(process.cwd(), positional[0]) : process.cwd()
13864
14109
  });
13865
14110
  case "guide": {
13866
14111
  const provider2 = positional[0];
@@ -13897,6 +14142,23 @@ async function main() {
13897
14142
  return cmdStack(positional);
13898
14143
  case "provider-verify":
13899
14144
  return cmdProviderVerify(flags, positional);
14145
+ case "init": {
14146
+ const cwd = positional[0] ? (0, import_node_path22.join)(process.cwd(), positional[0]) : process.cwd();
14147
+ const agents = typeof flags.agents === "string" ? flags.agents : void 0;
14148
+ return runInitCommand({
14149
+ cwd,
14150
+ agents,
14151
+ dryRun: flags["dry-run"] === true
14152
+ });
14153
+ }
14154
+ case "doctor":
14155
+ if (flags.agents !== true) {
14156
+ console.error("Usage: viberaven doctor --agents [path]");
14157
+ return 1;
14158
+ }
14159
+ return runDoctorAgentsCommand({
14160
+ cwd: positional[0] ? (0, import_node_path22.join)(process.cwd(), positional[0]) : process.cwd()
14161
+ });
13900
14162
  default:
13901
14163
  console.error(`Unknown command: ${command}`);
13902
14164
  printHelp();