@superbfowle/bash-history-mcp-test 0.1.6 → 0.1.8

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/opencode.ts +82 -82
  2. package/package.json +20 -20
  3. package/server.ts +0 -0
package/opencode.ts CHANGED
@@ -1,93 +1,93 @@
1
- import type { Plugin } from "@odebugpencode-ai/plugin";
1
+ import type { Plugin } from "@odebugpencode-ai/plugin"
2
2
 
3
3
  export const OpencodeBashHistoryPlugin: Plugin = async ({ client }) => {
4
- console.log("BASH HISTORY zero-a");
5
- await client.app.log({
6
- service: "bash-history",
7
- level: "info",
8
- message: "Bash-history load",
9
- extra: { input, output },
10
- });
11
- console.log("BASH HISTORY zero-b");
4
+ console.log("atuin load zero-a")
5
+ await client.app.log({
6
+ service: "atuin-history",
7
+ level: "info",
8
+ message: "atuin history load",
9
+ extra: {},
10
+ })
11
+ console.log("atuin load zero-b")
12
12
 
13
- return {
14
- "tool.execute.after": async (input, output) => {
15
- console.log("BASH HISTORY run-a");
16
- await client.app.log({
17
- service: "bash-history",
18
- level: "info",
19
- message: "Bash-history debug",
20
- extra: { input, output },
21
- });
22
- console.log("BASH HISTORY run-b");
23
- console.log("BASH HISTORY", input, output);
13
+ return {
14
+ "tool.execute.after": async (input, output) => {
15
+ console.log("atuin history run-a")
16
+ await client.app.log({
17
+ service: "atuin-history",
18
+ level: "info",
19
+ message: "atuin-history run",
20
+ extra: { input, output },
21
+ })
22
+ console.log("atuin history run-b")
23
+ console.log("atuin history", input, output)
24
24
 
25
- if (input.tool !== "bash") {
26
- return;
27
- }
28
- console.log("BASH HISTORY run-c");
25
+ if (input.tool !== "bash") {
26
+ return
27
+ }
28
+ console.log("atuin history run-c")
29
29
 
30
- try {
31
- const command = output.metadata?.args?.command;
32
- if (!command || typeof command !== "string") {
33
- return;
34
- }
30
+ try {
31
+ const command = output.metadata?.args?.command
32
+ if (!command || typeof command !== "string") {
33
+ return
34
+ }
35
35
 
36
- const exitCode = output.metadata?.exitCode ?? 0;
36
+ const exitCode = output.metadata?.exitCode ?? 0
37
37
 
38
- const startProc = Bun.spawn(["atuin", "history", "start", command], {
39
- stdout: "pipe",
40
- stderr: "pipe",
41
- });
38
+ const startProc = Bun.spawn(["atuin", "history", "start", command], {
39
+ stdout: "pipe",
40
+ stderr: "pipe",
41
+ })
42
42
 
43
- const startExitCode = await startProc.exited;
44
- if (startExitCode !== 0) {
45
- const stderr = await Bun.readableStreamToText(startProc.stderr);
46
- await client.app.log({
47
- service: "bash-history",
48
- level: "error",
49
- message: "Failed to start atuin history entry",
50
- extra: { error: stderr },
51
- });
52
- return;
53
- }
43
+ const startExitCode = await startProc.exited
44
+ if (startExitCode !== 0) {
45
+ const stderr = await Bun.readableStreamToText(startProc.stderr)
46
+ await client.app.log({
47
+ service: "bash-history",
48
+ level: "error",
49
+ message: "Failed to start atuin history entry",
50
+ extra: { error: stderr },
51
+ })
52
+ return
53
+ }
54
54
 
55
- const id = (await Bun.readableStreamToText(startProc.stdout)).trim();
55
+ const id = (await Bun.readableStreamToText(startProc.stdout)).trim()
56
56
 
57
- const endProc = Bun.spawn(
58
- [
59
- "atuin",
60
- "history",
61
- "end",
62
- "--exit",
63
- String(exitCode),
64
- "--duration",
65
- "0",
66
- id,
67
- ],
68
- {
69
- stderr: "pipe",
70
- },
71
- );
57
+ const endProc = Bun.spawn(
58
+ [
59
+ "atuin",
60
+ "history",
61
+ "end",
62
+ "--exit",
63
+ String(exitCode),
64
+ "--duration",
65
+ "0",
66
+ id,
67
+ ],
68
+ {
69
+ stderr: "pipe",
70
+ },
71
+ )
72
72
 
73
- const endExitCode = await endProc.exited;
74
- if (endExitCode !== 0) {
75
- const stderr = await Bun.readableStreamToText(endProc.stderr);
76
- await client.app.log({
77
- service: "bash-history",
78
- level: "error",
79
- message: "Failed to end atuin history entry",
80
- extra: { error: stderr },
81
- });
82
- }
83
- } catch (error) {
84
- await client.app.log({
85
- service: "bash-history",
86
- level: "error",
87
- message: "Bash history plugin error",
88
- extra: { error: String(error) },
89
- });
90
- }
91
- },
92
- };
93
- };
73
+ const endExitCode = await endProc.exited
74
+ if (endExitCode !== 0) {
75
+ const stderr = await Bun.readableStreamToText(endProc.stderr)
76
+ await client.app.log({
77
+ service: "bash-history",
78
+ level: "error",
79
+ message: "Failed to end atuin history entry",
80
+ extra: { error: stderr },
81
+ })
82
+ }
83
+ } catch (error) {
84
+ await client.app.log({
85
+ service: "bash-history",
86
+ level: "error",
87
+ message: "Bash history plugin error",
88
+ extra: { error: String(error) },
89
+ })
90
+ }
91
+ },
92
+ }
93
+ }
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
- "name": "@superbfowle/bash-history-mcp-test",
3
- "version": "0.1.6",
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
- }
2
+ "name": "@superbfowle/bash-history-mcp-test",
3
+ "version": "0.1.8",
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