kimaki 0.4.13 → 0.4.14
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/dist/cli.js +81 -12
- package/dist/discordBot.js +144 -55
- package/dist/tools.js +3 -3
- package/package.json +11 -12
- package/src/cli.ts +108 -11
- package/src/discordBot.ts +167 -90
- package/src/opencode-command-send-to-discord.md +12 -0
- package/src/opencode-command-upload-to-discord.md +22 -0
- package/src/tools.ts +3 -3
- package/src/opencode-command.md +0 -4
- package/src/opencode-plugin.ts +0 -75
package/src/opencode-plugin.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Kimaki Discord Plugin for OpenCode
|
|
3
|
-
*
|
|
4
|
-
* Adds /send-to-kimaki-discord command that sends the current session to Discord.
|
|
5
|
-
*
|
|
6
|
-
* Installation:
|
|
7
|
-
* kimaki install-plugin
|
|
8
|
-
*
|
|
9
|
-
* Use in OpenCode TUI:
|
|
10
|
-
* /send-to-kimaki-discord
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import type { Plugin } from '@opencode-ai/plugin'
|
|
14
|
-
|
|
15
|
-
export const KimakiDiscordPlugin: Plugin = async ({
|
|
16
|
-
client,
|
|
17
|
-
$,
|
|
18
|
-
directory,
|
|
19
|
-
}) => {
|
|
20
|
-
return {
|
|
21
|
-
event: async ({ event }) => {
|
|
22
|
-
if (event.type !== 'command.executed') {
|
|
23
|
-
return
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const { name, sessionID } = event.properties as {
|
|
27
|
-
name: string
|
|
28
|
-
sessionID: string
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (name !== 'send-to-kimaki-discord') {
|
|
32
|
-
return
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (!sessionID) {
|
|
36
|
-
await client.tui.showToast({
|
|
37
|
-
body: { message: 'No session ID available', variant: 'error' },
|
|
38
|
-
})
|
|
39
|
-
return
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
await client.tui.showToast({
|
|
43
|
-
body: { message: 'Creating Discord thread...', variant: 'info' },
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
const result =
|
|
48
|
-
await $`npx -y kimaki send-to-discord ${sessionID} -d ${directory}`.text()
|
|
49
|
-
|
|
50
|
-
const urlMatch = result.match(/https:\/\/discord\.com\/channels\/\S+/)
|
|
51
|
-
const url = urlMatch ? urlMatch[0] : null
|
|
52
|
-
|
|
53
|
-
await client.tui.showToast({
|
|
54
|
-
body: {
|
|
55
|
-
message: url ? `Sent to Discord: ${url}` : 'Session sent to Discord',
|
|
56
|
-
variant: 'success',
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
} catch (error: any) {
|
|
60
|
-
const message =
|
|
61
|
-
error.stderr?.toString().trim() ||
|
|
62
|
-
error.stdout?.toString().trim() ||
|
|
63
|
-
error.message ||
|
|
64
|
-
String(error)
|
|
65
|
-
|
|
66
|
-
await client.tui.showToast({
|
|
67
|
-
body: {
|
|
68
|
-
message: `Failed: ${message.slice(0, 100)}`,
|
|
69
|
-
variant: 'error',
|
|
70
|
-
},
|
|
71
|
-
})
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
}
|
|
75
|
-
}
|