@rivora/cli 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/LICENSE +8 -0
  2. package/dist/index.js +141 -3
  3. package/package.json +5 -3
package/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ Copyright (c) 2026 Rivora AI, Inc. All rights reserved.
2
+
3
+ This software and its source code are proprietary and confidential.
4
+ Unauthorized copying, distribution, modification, or use of this
5
+ software, in whole or in part, is strictly prohibited without prior
6
+ written permission from Rivora AI, Inc.
7
+
8
+ For licensing inquiries, contact: legal@rivora.dev
package/dist/index.js CHANGED
@@ -186441,8 +186441,7 @@ var updateCommand = new Command2("update").description("Update Rivora CLI to the
186441
186441
  return;
186442
186442
  }
186443
186443
  spinner.start("Downloading update...");
186444
- const installScript = `curl -fsSL https://rivora.dev/install | bash`;
186445
- await execAsync(installScript);
186444
+ await execAsync(`npm install -g @rivora/cli@${latestVersion}`);
186446
186445
  spinner.succeed(`Updated to v${latestVersion}`);
186447
186446
  console.log();
186448
186447
  console.log(source_default.green("\u2713"), "Rivora CLI has been updated");
@@ -187701,8 +187700,147 @@ async function manageConfig(options) {
187701
187700
  }
187702
187701
  var argocdCommand = createArgocdCommand();
187703
187702
  var version2 = "0.0.2";
187703
+ var rcaCommand = new Command2("rca").description("Root cause analysis (5 Whys)");
187704
+ function displayRCAReport(report) {
187705
+ console.log();
187706
+ var confidence = Math.round(report.causal_confidence * 100);
187707
+ var confColor = confidence >= 70 ? source_default.green : confidence >= 40 ? source_default.yellow : source_default.red;
187708
+ console.log(source_default.bold("\uD83D\uDD0D Root Cause Analysis"));
187709
+ console.log(source_default.dim(`Report: ${report.id}`));
187710
+ console.log(source_default.dim(`Finding: ${report.finding_id}`));
187711
+ console.log(`Confidence: ${confColor(`${confidence}%`)}`);
187712
+ console.log();
187713
+ console.log(source_default.bold("Summary"));
187714
+ console.log(report.summary);
187715
+ console.log();
187716
+ console.log(source_default.bold("5 Whys"));
187717
+ console.log();
187718
+ if (report.why_chain && report.why_chain.length > 0) {
187719
+ for (const step of report.why_chain) {
187720
+ var stepConf = Math.round((step.confidence || 0) * 100);
187721
+ console.log(source_default.cyan(` Why ${step.level}: ${step.question}`));
187722
+ console.log(` \u2192 ${step.answer}`);
187723
+ if (step.evidence && step.evidence.length > 0) {
187724
+ var evidenceStr = step.evidence.slice(0, 3).join(", ");
187725
+ console.log(source_default.dim(` Evidence: ${evidenceStr}`));
187726
+ }
187727
+ console.log(source_default.dim(` Confidence: ${stepConf}% | Source: ${step.source || "analysis"}`));
187728
+ console.log();
187729
+ }
187730
+ }
187731
+ console.log(source_default.bold.red("Root Cause"));
187732
+ console.log(` ${report.root_cause}`);
187733
+ console.log();
187734
+ if (report.contributing_factors && report.contributing_factors.length > 0) {
187735
+ console.log(source_default.bold("Contributing Factors"));
187736
+ for (const factor of report.contributing_factors) {
187737
+ console.log(` \u2022 ${factor}`);
187738
+ }
187739
+ console.log();
187740
+ }
187741
+ if (report.remediation_suggestions && report.remediation_suggestions.length > 0) {
187742
+ console.log(source_default.bold("Suggested Actions"));
187743
+ for (const suggestion of report.remediation_suggestions) {
187744
+ console.log(` \u2192 ${suggestion}`);
187745
+ }
187746
+ console.log();
187747
+ }
187748
+ if (report.timeline && report.timeline.length > 0) {
187749
+ console.log(source_default.bold("Timeline"));
187750
+ var tableRca = new Table3({
187751
+ head: [source_default.dim("Time"), source_default.dim("Event"), source_default.dim("Description")],
187752
+ colWidths: [24, 22, 50],
187753
+ wordWrap: true
187754
+ });
187755
+ for (const event of report.timeline) {
187756
+ var time = new Date(event.timestamp).toLocaleString();
187757
+ tableRca.push([time, event.event_type, event.description]);
187758
+ }
187759
+ console.log(tableRca.toString());
187760
+ console.log();
187761
+ }
187762
+ console.log(source_default.dim(`Data sources: ${(report.data_sources_used || []).join(", ")}`));
187763
+ console.log(source_default.dim(`Run \`rivora rca feedback ${report.id} --accept\` or \`--reject\` to provide feedback`));
187764
+ console.log();
187765
+ }
187766
+ rcaCommand.command("analyze").description("Run root cause analysis on a finding").argument("<finding-id>", "Finding ID to analyze").option("--depth <n>", "Max why-chain depth", "5").option("--json", "Output as JSON").action(async (findingId, options) => {
187767
+ try {
187768
+ const token = await ensureAuthDrift();
187769
+ const spinner = ora("Running root cause analysis...").start();
187770
+ try {
187771
+ const response = await restClient.post("/api/v1/rca/analyze", { finding_id: findingId, max_depth: parseInt(options.depth, 10) }, { headers: { Authorization: `Bearer ${token}` } });
187772
+ spinner.succeed("RCA complete");
187773
+ if (options.json) {
187774
+ console.log(JSON.stringify(response.data, null, 2));
187775
+ return;
187776
+ }
187777
+ displayRCAReport(response.data);
187778
+ } catch (error) {
187779
+ if (error.response?.status === 404) {
187780
+ spinner.fail("Finding not found");
187781
+ console.error(source_default.red(`Finding ${findingId} does not exist`));
187782
+ } else {
187783
+ spinner.fail("RCA analysis failed");
187784
+ console.error(source_default.red(error.message));
187785
+ }
187786
+ process.exit(1);
187787
+ }
187788
+ } catch (error) {
187789
+ if (error instanceof Error) {
187790
+ console.error(source_default.red("Error:"), error.message);
187791
+ }
187792
+ process.exit(1);
187793
+ }
187794
+ });
187795
+ rcaCommand.command("report").description("View an existing RCA report").argument("<report-id>", "RCA report ID").option("--json", "Output as JSON").action(async (reportId, options) => {
187796
+ try {
187797
+ const token = await ensureAuthDrift();
187798
+ const spinner = ora("Fetching RCA report...").start();
187799
+ try {
187800
+ const response = await restClient.get(`/api/v1/rca/report/${reportId}`, { headers: { Authorization: `Bearer ${token}` } });
187801
+ spinner.succeed("Report loaded");
187802
+ if (options.json) {
187803
+ console.log(JSON.stringify(response.data, null, 2));
187804
+ return;
187805
+ }
187806
+ displayRCAReport(response.data);
187807
+ } catch (error) {
187808
+ spinner.fail("Failed to fetch report");
187809
+ console.error(source_default.red(error.message));
187810
+ process.exit(1);
187811
+ }
187812
+ } catch (error) {
187813
+ if (error instanceof Error) {
187814
+ console.error(source_default.red("Error:"), error.message);
187815
+ }
187816
+ process.exit(1);
187817
+ }
187818
+ });
187819
+ rcaCommand.command("feedback").description("Accept or reject an RCA root cause").argument("<report-id>", "RCA report ID").option("--accept", "Accept the root cause").option("--reject", "Reject the root cause").action(async (reportId, options) => {
187820
+ try {
187821
+ if (!options.accept && !options.reject) {
187822
+ console.error(source_default.red("Specify --accept or --reject"));
187823
+ process.exit(1);
187824
+ }
187825
+ const token = await ensureAuthDrift();
187826
+ const spinner = ora("Submitting feedback...").start();
187827
+ try {
187828
+ await restClient.post(`/api/v1/rca/report/${reportId}/feedback`, { accepted: !!options.accept }, { headers: { Authorization: `Bearer ${token}` } });
187829
+ spinner.succeed(options.accept ? "Root cause accepted" : "Root cause rejected");
187830
+ } catch (error) {
187831
+ spinner.fail("Failed to submit feedback");
187832
+ console.error(source_default.red(error.message));
187833
+ process.exit(1);
187834
+ }
187835
+ } catch (error) {
187836
+ if (error instanceof Error) {
187837
+ console.error(source_default.red("Error:"), error.message);
187838
+ }
187839
+ process.exit(1);
187840
+ }
187841
+ });
187704
187842
  var program3 = new Command;
187705
- program3.name("rivora").description("Rivora - Infrastructure Intelligence Layer").version(version2).addCommand(authCommand).addCommand(connectCommand).addCommand(inventoryCommand).addCommand(findingsCommand).addCommand(planCommand).addCommand(remediateCommand).addCommand(helpCommand).addCommand(regionsCommand).addCommand(slackCommand).addCommand(ciCommand).addCommand(updateCommand).addCommand(modelsCommand).addCommand(adminCommand).addCommand(argocdCommand).addCommand(driftCommand).addCommand(backlogCommand);
187843
+ program3.name("rivora").description("Rivora - Infrastructure Intelligence Layer").version(version2).addCommand(authCommand).addCommand(connectCommand).addCommand(inventoryCommand).addCommand(findingsCommand).addCommand(planCommand).addCommand(remediateCommand).addCommand(helpCommand).addCommand(regionsCommand).addCommand(slackCommand).addCommand(ciCommand).addCommand(updateCommand).addCommand(modelsCommand).addCommand(adminCommand).addCommand(argocdCommand).addCommand(driftCommand).addCommand(backlogCommand).addCommand(rcaCommand);
187706
187844
  if (process.env.RIVORA_INTERNAL === "1") {
187707
187845
  program3.addCommand(trainingCommand);
187708
187846
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivora/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Rivora CLI - Infrastructure Intelligence Layer",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -10,7 +10,8 @@
10
10
  },
11
11
  "files": [
12
12
  "dist/index.js",
13
- "README.md"
13
+ "README.md",
14
+ "LICENSE"
14
15
  ],
15
16
  "publishConfig": {
16
17
  "access": "public"
@@ -53,7 +54,8 @@
53
54
  "@types/inquirer": "^9.0.7",
54
55
  "@types/node": "^20.10.0",
55
56
  "@types/uuid": "^11.0.0",
56
- "vitest": "^4.0.16"
57
+ "vitest": "^4.0.16",
58
+ "wrangler": "^4.67.0"
57
59
  },
58
60
  "peerDependencies": {
59
61
  "typescript": "^5"