bashbros 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 (34) hide show
  1. package/dist/{chunk-SB4JS3GU.js → chunk-BW6XCOJH.js} +171 -21
  2. package/dist/chunk-BW6XCOJH.js.map +1 -0
  3. package/dist/chunk-FRMAIRQ2.js +89 -0
  4. package/dist/chunk-FRMAIRQ2.js.map +1 -0
  5. package/dist/{chunk-GD5VNHIN.js → chunk-QWZGB4V3.js} +4 -85
  6. package/dist/chunk-QWZGB4V3.js.map +1 -0
  7. package/dist/{chunk-4R4GV5V2.js → chunk-SQCP6IYB.js} +2 -2
  8. package/dist/{chunk-43W3RVEL.js → chunk-XCZMQRSX.js} +125 -10
  9. package/dist/chunk-XCZMQRSX.js.map +1 -0
  10. package/dist/chunk-YUMNBQAY.js +766 -0
  11. package/dist/chunk-YUMNBQAY.js.map +1 -0
  12. package/dist/cli.js +633 -29
  13. package/dist/cli.js.map +1 -1
  14. package/dist/{config-CZMIGNPF.js → config-JLLOTFLI.js} +2 -2
  15. package/dist/{db-EHQDB5OL.js → db-OBKEXRTP.js} +2 -2
  16. package/dist/{display-IN4NRJJS.js → display-6LZ2HBCU.js} +3 -3
  17. package/dist/engine-EGPAS2EX.js +10 -0
  18. package/dist/index.js +6 -4
  19. package/dist/index.js.map +1 -1
  20. package/dist/session-Y4MICATZ.js +15 -0
  21. package/dist/session-Y4MICATZ.js.map +1 -0
  22. package/dist/static/index.html +1873 -276
  23. package/package.json +1 -1
  24. package/dist/chunk-43W3RVEL.js.map +0 -1
  25. package/dist/chunk-CSRPOGHY.js +0 -354
  26. package/dist/chunk-CSRPOGHY.js.map +0 -1
  27. package/dist/chunk-GD5VNHIN.js.map +0 -1
  28. package/dist/chunk-SB4JS3GU.js.map +0 -1
  29. package/dist/engine-PKLXW6OF.js +0 -9
  30. /package/dist/{chunk-4R4GV5V2.js.map → chunk-SQCP6IYB.js.map} +0 -0
  31. /package/dist/{config-CZMIGNPF.js.map → config-JLLOTFLI.js.map} +0 -0
  32. /package/dist/{db-EHQDB5OL.js.map → db-OBKEXRTP.js.map} +0 -0
  33. /package/dist/{display-IN4NRJJS.js.map → display-6LZ2HBCU.js.map} +0 -0
  34. /package/dist/{engine-PKLXW6OF.js.map → engine-EGPAS2EX.js.map} +0 -0
@@ -7,10 +7,10 @@ import {
7
7
  } from "./chunk-DLP2O6PN.js";
8
8
  import {
9
9
  loadConfig
10
- } from "./chunk-SB4JS3GU.js";
10
+ } from "./chunk-BW6XCOJH.js";
11
11
  import {
12
12
  PolicyEngine
13
- } from "./chunk-GD5VNHIN.js";
13
+ } from "./chunk-QWZGB4V3.js";
14
14
  import {
15
15
  __require
16
16
  } from "./chunk-7OCVIDC7.js";
@@ -582,9 +582,9 @@ var ClaudeCodeHooks = class {
582
582
  }
583
583
  };
584
584
  async function gateCommand(command) {
585
- const { PolicyEngine: PolicyEngine2 } = await import("./engine-PKLXW6OF.js");
585
+ const { PolicyEngine: PolicyEngine2 } = await import("./engine-EGPAS2EX.js");
586
586
  const { RiskScorer } = await import("./risk-scorer-Y6KF2XCZ.js");
587
- const { loadConfig: loadConfig2 } = await import("./config-CZMIGNPF.js");
587
+ const { loadConfig: loadConfig2 } = await import("./config-JLLOTFLI.js");
588
588
  const config = loadConfig2();
589
589
  const engine = new PolicyEngine2(config);
590
590
  const scorer = new RiskScorer();
@@ -1767,7 +1767,29 @@ var BashBro = class extends EventEmitter4 {
1767
1767
  if (!this.ollama || !this.ollamaAvailable) {
1768
1768
  return null;
1769
1769
  }
1770
- return this.ollama.suggestCommand(context);
1770
+ const startTime = Date.now();
1771
+ try {
1772
+ const result = await this.ollama.suggestCommand(context);
1773
+ const latency = Date.now() - startTime;
1774
+ this.emit("bro:suggestion", {
1775
+ input: context,
1776
+ output: result ?? "",
1777
+ model: this.ollama.getModel(),
1778
+ latencyMs: latency,
1779
+ success: result !== null
1780
+ });
1781
+ return result;
1782
+ } catch (error) {
1783
+ const latency = Date.now() - startTime;
1784
+ this.emit("bro:suggestion", {
1785
+ input: context,
1786
+ output: "",
1787
+ model: this.ollama?.getModel() ?? "unknown",
1788
+ latencyMs: latency,
1789
+ success: false
1790
+ });
1791
+ return null;
1792
+ }
1771
1793
  }
1772
1794
  /**
1773
1795
  * Ask Bash Bro to explain a command
@@ -1776,7 +1798,29 @@ var BashBro = class extends EventEmitter4 {
1776
1798
  if (!this.ollama || !this.ollamaAvailable) {
1777
1799
  return "Ollama not available for explanations.";
1778
1800
  }
1779
- return this.ollama.explainCommand(command);
1801
+ const startTime = Date.now();
1802
+ try {
1803
+ const result = await this.ollama.explainCommand(command);
1804
+ const latency = Date.now() - startTime;
1805
+ this.emit("bro:explanation", {
1806
+ input: command,
1807
+ output: result,
1808
+ model: this.ollama.getModel(),
1809
+ latencyMs: latency,
1810
+ success: true
1811
+ });
1812
+ return result;
1813
+ } catch (error) {
1814
+ const latency = Date.now() - startTime;
1815
+ this.emit("bro:explanation", {
1816
+ input: command,
1817
+ output: "Could not explain command.",
1818
+ model: this.ollama?.getModel() ?? "unknown",
1819
+ latencyMs: latency,
1820
+ success: false
1821
+ });
1822
+ return "Could not explain command.";
1823
+ }
1780
1824
  }
1781
1825
  /**
1782
1826
  * Ask Bash Bro to fix a failed command
@@ -1785,7 +1829,29 @@ var BashBro = class extends EventEmitter4 {
1785
1829
  if (!this.ollama || !this.ollamaAvailable) {
1786
1830
  return null;
1787
1831
  }
1788
- return this.ollama.fixCommand(command, error);
1832
+ const startTime = Date.now();
1833
+ try {
1834
+ const result = await this.ollama.fixCommand(command, error);
1835
+ const latency = Date.now() - startTime;
1836
+ this.emit("bro:fix", {
1837
+ input: `${command} | Error: ${error}`,
1838
+ output: result ?? "",
1839
+ model: this.ollama.getModel(),
1840
+ latencyMs: latency,
1841
+ success: result !== null
1842
+ });
1843
+ return result;
1844
+ } catch (err) {
1845
+ const latency = Date.now() - startTime;
1846
+ this.emit("bro:fix", {
1847
+ input: `${command} | Error: ${error}`,
1848
+ output: "",
1849
+ model: this.ollama?.getModel() ?? "unknown",
1850
+ latencyMs: latency,
1851
+ success: false
1852
+ });
1853
+ return null;
1854
+ }
1789
1855
  }
1790
1856
  /**
1791
1857
  * Set the Ollama model to use
@@ -1803,7 +1869,29 @@ var BashBro = class extends EventEmitter4 {
1803
1869
  return null;
1804
1870
  }
1805
1871
  const shell = this.profile?.shell || "bash";
1806
- return this.ollama.generateScript(description, shell);
1872
+ const startTime = Date.now();
1873
+ try {
1874
+ const result = await this.ollama.generateScript(description, shell);
1875
+ const latency = Date.now() - startTime;
1876
+ this.emit("bro:script", {
1877
+ input: description,
1878
+ output: result ?? "",
1879
+ model: this.ollama.getModel(),
1880
+ latencyMs: latency,
1881
+ success: result !== null
1882
+ });
1883
+ return result;
1884
+ } catch (error) {
1885
+ const latency = Date.now() - startTime;
1886
+ this.emit("bro:script", {
1887
+ input: description,
1888
+ output: "",
1889
+ model: this.ollama?.getModel() ?? "unknown",
1890
+ latencyMs: latency,
1891
+ success: false
1892
+ });
1893
+ return null;
1894
+ }
1807
1895
  }
1808
1896
  /**
1809
1897
  * Analyze command for security risks using AI
@@ -1817,7 +1905,34 @@ var BashBro = class extends EventEmitter4 {
1817
1905
  suggestions: []
1818
1906
  };
1819
1907
  }
1820
- return this.ollama.analyzeCommandSafety(command);
1908
+ const startTime = Date.now();
1909
+ try {
1910
+ const result = await this.ollama.analyzeCommandSafety(command);
1911
+ const latency = Date.now() - startTime;
1912
+ this.emit("bro:safety", {
1913
+ input: command,
1914
+ output: `Risk: ${result.risk} - ${result.explanation}`,
1915
+ model: this.ollama.getModel(),
1916
+ latencyMs: latency,
1917
+ success: true
1918
+ });
1919
+ return result;
1920
+ } catch (error) {
1921
+ const latency = Date.now() - startTime;
1922
+ this.emit("bro:safety", {
1923
+ input: command,
1924
+ output: "Analysis failed",
1925
+ model: this.ollama?.getModel() ?? "unknown",
1926
+ latencyMs: latency,
1927
+ success: false
1928
+ });
1929
+ return {
1930
+ safe: true,
1931
+ risk: "low",
1932
+ explanation: "Analysis unavailable.",
1933
+ suggestions: []
1934
+ };
1935
+ }
1821
1936
  }
1822
1937
  /**
1823
1938
  * Summarize a terminal session
@@ -2907,4 +3022,4 @@ export {
2907
3022
  UndoStack,
2908
3023
  LoopDetector
2909
3024
  };
2910
- //# sourceMappingURL=chunk-43W3RVEL.js.map
3025
+ //# sourceMappingURL=chunk-XCZMQRSX.js.map