@superbfowle/bash-history-mcp-test 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.
package/index.ts CHANGED
@@ -5,12 +5,6 @@
5
5
  * Adds bash commands to atuin history
6
6
  */
7
7
 
8
- import { realpath } from "node:fs/promises";
9
- import { fileURLToPath } from "node:url";
10
- import { dirname } from "node:path";
11
-
12
- export { OpencodeBashHistoryPlugin } from "./opencode.ts";
13
-
14
8
  interface ToolInput {
15
9
  command: string;
16
10
  description?: string;
@@ -75,21 +69,4 @@ async function main() {
75
69
  }
76
70
  }
77
71
 
78
- async function runIfMain(): Promise<void> {
79
- const __filename = fileURLToPath(import.meta.url);
80
- const __dirname = dirname(__filename);
81
-
82
- try {
83
- const resolvedMainPath = await realpath(process.argv[1]);
84
-
85
- // Early guard return if not being run as main module
86
- if (resolvedMainPath !== __filename) {
87
- return;
88
- }
89
-
90
- // Only call main if we are the main module
91
- await main();
92
- } catch {}
93
- }
94
-
95
- runIfMain();
72
+ main();
package/opencode.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Plugin } from "@opencode-ai/plugin";
2
2
 
3
- export const OpencodeBashHistoryPlugin: Plugin = async ({ $ }) => {
3
+ export const OpencodeBashHistoryPlugin: Plugin = async ({ client }) => {
4
4
  return {
5
5
  "tool.execute.after": async (input, output) => {
6
6
  if (input.tool !== "bash") {
@@ -23,7 +23,12 @@ export const OpencodeBashHistoryPlugin: Plugin = async ({ $ }) => {
23
23
  const startExitCode = await startProc.exited;
24
24
  if (startExitCode !== 0) {
25
25
  const stderr = await Bun.readableStreamToText(startProc.stderr);
26
- await $.console.error(`Failed to start atuin history entry: ${stderr}`);
26
+ await client.app.log({
27
+ service: "bash-history",
28
+ level: "error",
29
+ message: "Failed to start atuin history entry",
30
+ extra: { error: stderr }
31
+ });
27
32
  return;
28
33
  }
29
34
 
@@ -48,10 +53,20 @@ export const OpencodeBashHistoryPlugin: Plugin = async ({ $ }) => {
48
53
  const endExitCode = await endProc.exited;
49
54
  if (endExitCode !== 0) {
50
55
  const stderr = await Bun.readableStreamToText(endProc.stderr);
51
- await $.console.error(`Failed to end atuin history entry: ${stderr}`);
56
+ await client.app.log({
57
+ service: "bash-history",
58
+ level: "error",
59
+ message: "Failed to end atuin history entry",
60
+ extra: { error: stderr }
61
+ });
52
62
  }
53
63
  } catch (error) {
54
- await $.console.error(`Bash history plugin error: ${error}`);
64
+ await client.app.log({
65
+ service: "bash-history",
66
+ level: "error",
67
+ message: "Bash history plugin error",
68
+ extra: { error: String(error) }
69
+ });
55
70
  }
56
71
  },
57
72
  };
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
- "name": "@superbfowle/bash-history-mcp-test",
3
- "version": "0.1.0",
4
- "module": "index.ts",
5
- "type": "module",
6
- "bin": "./cli.ts",
7
- "devDependencies": {
8
- "@types/bun": "latest"
9
- },
10
- "peerDependencies": {
11
- "typescript": "^5",
12
- "@opencode-ai/plugin": "*"
13
- },
14
- "dependencies": {
15
- "@modelcontextprotocol/sdk": "^1.19.1"
16
- }
17
- }
2
+ "name": "@superbfowle/bash-history-mcp-test",
3
+ "version": "0.1.2",
4
+ "module": "index.ts",
5
+ "type": "module",
6
+ "bin": "./cli.ts",
7
+ "devDependencies": {
8
+ "@types/bun": "latest"
9
+ },
10
+ "peerDependencies": {
11
+ "typescript": "^5",
12
+ "@opencode-ai/plugin": "*"
13
+ },
14
+ "dependencies": {
15
+ "@modelcontextprotocol/sdk": "^1.19.1"
16
+ },
17
+ "exports": {
18
+ ".": "./index.ts",
19
+ "./opencode-plugin": "./opencode.ts"
20
+ }
21
+ }
package/server.ts CHANGED
File without changes