kimaki 0.4.12 → 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.
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: Send current session to Discord
3
+ ---
4
+ Run the following command to send this session to Discord:
5
+
6
+ ```bash
7
+ npx -y kimaki send-to-discord <sessionId>
8
+ ```
9
+
10
+ Replace `<sessionId>` with your current OpenCode session ID (available in the system prompt).
11
+
12
+ The command will create a Discord thread with your session history and return the Discord URL.
@@ -0,0 +1,22 @@
1
+ ---
2
+ description: Upload files to Discord thread
3
+ ---
4
+ Upload files to the current Discord thread by running:
5
+
6
+ ```bash
7
+ npx -y kimaki upload-to-discord --session <sessionId> <file1> [file2] [file3] ...
8
+ ```
9
+
10
+ Replace `<sessionId>` with your current OpenCode session ID (available in the system prompt).
11
+
12
+ Examples:
13
+
14
+ ```bash
15
+ # Upload a single file
16
+ npx -y kimaki upload-to-discord --session ses_abc123 ./screenshot.png
17
+
18
+ # Upload multiple files
19
+ npx -y kimaki upload-to-discord --session ses_abc123 ./image1.png ./image2.jpg ./document.pdf
20
+ ```
21
+
22
+ The session must have been sent to Discord first using `/send-to-kimaki-discord`.
package/src/tools.ts CHANGED
@@ -17,7 +17,7 @@ import { ShareMarkdown } from './markdown.js'
17
17
  import pc from 'picocolors'
18
18
  import {
19
19
  initializeOpencodeForDirectory,
20
- OPENCODE_SYSTEM_MESSAGE,
20
+ getOpencodeSystemMessage,
21
21
  } from './discordBot.js'
22
22
 
23
23
  export async function getTools({
@@ -78,7 +78,7 @@ export async function getTools({
78
78
  body: {
79
79
  parts: [{ type: 'text', text: message }],
80
80
  model: sessionModel,
81
- system: OPENCODE_SYSTEM_MESSAGE,
81
+ system: getOpencodeSystemMessage({ sessionId }),
82
82
  },
83
83
  })
84
84
  .then(async (response) => {
@@ -152,7 +152,7 @@ export async function getTools({
152
152
  path: { id: session.data.id },
153
153
  body: {
154
154
  parts: [{ type: 'text', text: message }],
155
- system: OPENCODE_SYSTEM_MESSAGE,
155
+ system: getOpencodeSystemMessage({ sessionId: session.data.id }),
156
156
  },
157
157
  })
158
158
  .then(async (response) => {
@@ -1,4 +0,0 @@
1
- ---
2
- description: Create Discord thread for current session
3
- ---
4
- Creating Discord thread for this session...
@@ -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
- }