kimaki 0.4.54 → 0.4.55
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/bin.js +1 -69
- package/dist/channel-management.js +17 -12
- package/dist/cli.js +119 -129
- package/dist/commands/abort.js +4 -7
- package/dist/commands/add-project.js +9 -12
- package/dist/commands/agent.js +10 -15
- package/dist/commands/compact.js +4 -7
- package/dist/commands/fork.js +11 -18
- package/dist/commands/gemini-apikey.js +53 -0
- package/dist/commands/login.js +2 -2
- package/dist/commands/merge-worktree.js +1 -1
- package/dist/commands/model.js +10 -15
- package/dist/commands/queue.js +6 -8
- package/dist/commands/remove-project.js +4 -10
- package/dist/commands/restart-opencode-server.js +2 -2
- package/dist/commands/resume.js +11 -14
- package/dist/commands/session.js +4 -4
- package/dist/commands/share.js +4 -7
- package/dist/commands/undo-redo.js +7 -13
- package/dist/commands/user-command.js +5 -7
- package/dist/commands/verbosity.js +2 -2
- package/dist/commands/worktree-settings.js +3 -3
- package/dist/commands/worktree.js +9 -9
- package/dist/database.js +480 -240
- package/dist/db.js +69 -0
- package/dist/db.test.js +23 -0
- package/dist/discord-bot.js +18 -20
- package/dist/discord-utils.js +2 -2
- package/dist/generated/browser.js +17 -0
- package/dist/generated/client.js +35 -0
- package/dist/generated/commonInputTypes.js +10 -0
- package/dist/generated/enums.js +11 -0
- package/dist/generated/internal/class.js +41 -0
- package/dist/generated/internal/prismaNamespace.js +174 -0
- package/dist/generated/internal/prismaNamespaceBrowser.js +144 -0
- package/dist/generated/models/bot_api_keys.js +1 -0
- package/dist/generated/models/bot_tokens.js +1 -0
- package/dist/generated/models/channel_agents.js +1 -0
- package/dist/generated/models/channel_directories.js +1 -0
- package/dist/generated/models/channel_models.js +1 -0
- package/dist/generated/models/channel_verbosity.js +1 -0
- package/dist/generated/models/channel_worktrees.js +1 -0
- package/dist/generated/models/part_messages.js +1 -0
- package/dist/generated/models/pending_auto_start.js +1 -0
- package/dist/generated/models/session_agents.js +1 -0
- package/dist/generated/models/session_models.js +1 -0
- package/dist/generated/models/thread_sessions.js +1 -0
- package/dist/generated/models/thread_worktrees.js +1 -0
- package/dist/generated/models.js +1 -0
- package/dist/interaction-handler.js +13 -4
- package/dist/logger.js +10 -12
- package/dist/session-handler.js +22 -28
- package/dist/voice-handler.js +30 -24
- package/dist/voice.js +64 -243
- package/package.json +9 -3
- package/src/channel-management.ts +29 -27
- package/src/cli.ts +134 -152
- package/src/commands/abort.ts +4 -8
- package/src/commands/add-project.ts +9 -14
- package/src/commands/agent.ts +11 -18
- package/src/commands/compact.ts +4 -8
- package/src/commands/fork.ts +12 -20
- package/src/commands/gemini-apikey.ts +76 -0
- package/src/commands/login.ts +2 -2
- package/src/commands/merge-worktree.ts +1 -1
- package/src/commands/model.ts +10 -17
- package/src/commands/queue.ts +6 -8
- package/src/commands/remove-project.ts +5 -15
- package/src/commands/restart-opencode-server.ts +2 -2
- package/src/commands/resume.ts +12 -23
- package/src/commands/session.ts +4 -4
- package/src/commands/share.ts +4 -8
- package/src/commands/undo-redo.ts +7 -15
- package/src/commands/user-command.ts +5 -7
- package/src/commands/verbosity.ts +2 -2
- package/src/commands/worktree-settings.ts +3 -3
- package/src/commands/worktree.ts +10 -10
- package/src/database.ts +590 -339
- package/src/db.test.ts +27 -0
- package/src/db.ts +88 -0
- package/src/discord-bot.ts +21 -20
- package/src/discord-utils.ts +3 -3
- package/src/generated/browser.ts +84 -0
- package/src/generated/client.ts +106 -0
- package/src/generated/commonInputTypes.ts +272 -0
- package/src/generated/enums.ts +15 -0
- package/src/generated/internal/class.ts +312 -0
- package/src/generated/internal/prismaNamespace.ts +1763 -0
- package/src/generated/internal/prismaNamespaceBrowser.ts +223 -0
- package/src/generated/models/bot_api_keys.ts +1256 -0
- package/src/generated/models/bot_tokens.ts +1355 -0
- package/src/generated/models/channel_agents.ts +1256 -0
- package/src/generated/models/channel_directories.ts +1797 -0
- package/src/generated/models/channel_models.ts +1256 -0
- package/src/generated/models/channel_verbosity.ts +1224 -0
- package/src/generated/models/channel_worktrees.ts +1308 -0
- package/src/generated/models/part_messages.ts +1302 -0
- package/src/generated/models/pending_auto_start.ts +1192 -0
- package/src/generated/models/session_agents.ts +1086 -0
- package/src/generated/models/session_models.ts +1086 -0
- package/src/generated/models/thread_sessions.ts +1456 -0
- package/src/generated/models/thread_worktrees.ts +1352 -0
- package/src/generated/models.ts +24 -0
- package/src/interaction-handler.ts +19 -5
- package/src/logger.ts +10 -12
- package/src/schema.sql +84 -0
- package/src/session-handler.ts +27 -36
- package/src/voice-handler.ts +41 -25
- package/src/voice.ts +68 -304
- package/src/commands/sqlitedb.ts +0 -20
package/bin.js
CHANGED
|
@@ -1,70 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// CLI entrypoint with automatic restart capability.
|
|
4
|
-
// Spawns the main CLI and restarts it on non-zero exit codes with throttling.
|
|
5
|
-
// Exit codes 0, 130 (SIGINT), 143 (SIGTERM), or 64 (EXIT_NO_RESTART) terminate cleanly.
|
|
6
|
-
|
|
7
|
-
import { spawn } from 'node:child_process'
|
|
8
|
-
import { fileURLToPath } from 'node:url'
|
|
9
|
-
import { dirname, join } from 'node:path'
|
|
10
|
-
|
|
11
|
-
const __filename = fileURLToPath(import.meta.url)
|
|
12
|
-
const __dirname = dirname(__filename)
|
|
13
|
-
|
|
14
|
-
const NODE_PATH = process.execPath
|
|
15
|
-
const CLI_PATH = join(__dirname, 'dist', 'cli.js')
|
|
16
|
-
|
|
17
|
-
let lastStart = 0
|
|
18
|
-
|
|
19
|
-
async function sleep(ms) {
|
|
20
|
-
return new Promise(resolve => setTimeout(resolve, ms))
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function run() {
|
|
24
|
-
while (true) {
|
|
25
|
-
const now = Date.now()
|
|
26
|
-
const elapsed = now - lastStart
|
|
27
|
-
if (elapsed < 5000) {
|
|
28
|
-
await sleep(5000 - elapsed)
|
|
29
|
-
}
|
|
30
|
-
lastStart = Date.now()
|
|
31
|
-
|
|
32
|
-
try {
|
|
33
|
-
const code = await new Promise((resolve) => {
|
|
34
|
-
const child = spawn(NODE_PATH, [CLI_PATH, ...process.argv.slice(2)], {
|
|
35
|
-
stdio: 'inherit'
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
child.on('exit', (code, signal) => {
|
|
39
|
-
if (signal) {
|
|
40
|
-
// Map signals to exit codes similar to bash
|
|
41
|
-
if (signal === 'SIGINT') resolve(130)
|
|
42
|
-
else if (signal === 'SIGTERM') resolve(143)
|
|
43
|
-
else resolve(1)
|
|
44
|
-
} else {
|
|
45
|
-
resolve(code || 0)
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
child.on('error', (err) => {
|
|
50
|
-
console.error('Failed to start process:', err)
|
|
51
|
-
resolve(1)
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
// Exit cleanly if the app ended OK or via SIGINT/SIGTERM
|
|
56
|
-
if (code === 0 || code === 130 || code === 143 || code === 64) {
|
|
57
|
-
process.exit(code)
|
|
58
|
-
}
|
|
59
|
-
// otherwise loop; the 5s throttle above will apply
|
|
60
|
-
} catch (err) {
|
|
61
|
-
console.error('Unexpected error:', err)
|
|
62
|
-
// Continue looping after error
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
run().catch(err => {
|
|
68
|
-
console.error('Fatal error:', err)
|
|
69
|
-
process.exit(1)
|
|
70
|
-
})
|
|
2
|
+
import './dist/cli.js'
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// extracts channel metadata from topic tags, and ensures category structure.
|
|
4
4
|
import { ChannelType } from 'discord.js';
|
|
5
5
|
import path from 'node:path';
|
|
6
|
-
import {
|
|
6
|
+
import { getChannelDirectory, setChannelDirectory } from './database.js';
|
|
7
7
|
export async function ensureKimakiCategory(guild, botName) {
|
|
8
8
|
// Skip appending bot name if it's already "kimaki" to avoid "Kimaki kimaki"
|
|
9
9
|
const isKimakiBot = botName?.toLowerCase() === 'kimaki';
|
|
@@ -53,9 +53,12 @@ export async function createProjectChannels({ guild, projectDirectory, appId, bo
|
|
|
53
53
|
parent: kimakiCategory,
|
|
54
54
|
// Channel configuration is stored in SQLite, not in the topic
|
|
55
55
|
});
|
|
56
|
-
|
|
57
|
-
.
|
|
58
|
-
|
|
56
|
+
await setChannelDirectory({
|
|
57
|
+
channelId: textChannel.id,
|
|
58
|
+
directory: projectDirectory,
|
|
59
|
+
channelType: 'text',
|
|
60
|
+
appId,
|
|
61
|
+
});
|
|
59
62
|
let voiceChannelId = null;
|
|
60
63
|
if (enableVoiceChannels) {
|
|
61
64
|
const kimakiAudioCategory = await ensureKimakiAudioCategory(guild, botName);
|
|
@@ -64,9 +67,12 @@ export async function createProjectChannels({ guild, projectDirectory, appId, bo
|
|
|
64
67
|
type: ChannelType.GuildVoice,
|
|
65
68
|
parent: kimakiAudioCategory,
|
|
66
69
|
});
|
|
67
|
-
|
|
68
|
-
.
|
|
69
|
-
|
|
70
|
+
await setChannelDirectory({
|
|
71
|
+
channelId: voiceChannel.id,
|
|
72
|
+
directory: projectDirectory,
|
|
73
|
+
channelType: 'voice',
|
|
74
|
+
appId,
|
|
75
|
+
});
|
|
70
76
|
voiceChannelId = voiceChannel.id;
|
|
71
77
|
}
|
|
72
78
|
return {
|
|
@@ -77,13 +83,12 @@ export async function createProjectChannels({ guild, projectDirectory, appId, bo
|
|
|
77
83
|
}
|
|
78
84
|
export async function getChannelsWithDescriptions(guild) {
|
|
79
85
|
const channels = [];
|
|
80
|
-
guild.channels.cache
|
|
81
|
-
|
|
82
|
-
.forEach((channel) => {
|
|
86
|
+
const textChannels = guild.channels.cache.filter((channel) => channel.isTextBased());
|
|
87
|
+
for (const channel of textChannels.values()) {
|
|
83
88
|
const textChannel = channel;
|
|
84
89
|
const description = textChannel.topic || null;
|
|
85
90
|
// Get channel config from database instead of parsing XML from topic
|
|
86
|
-
const channelConfig = getChannelDirectory(textChannel.id);
|
|
91
|
+
const channelConfig = await getChannelDirectory(textChannel.id);
|
|
87
92
|
channels.push({
|
|
88
93
|
id: textChannel.id,
|
|
89
94
|
name: textChannel.name,
|
|
@@ -91,6 +96,6 @@ export async function getChannelsWithDescriptions(guild) {
|
|
|
91
96
|
kimakiDirectory: channelConfig?.directory,
|
|
92
97
|
kimakiApp: channelConfig?.appId || undefined,
|
|
93
98
|
});
|
|
94
|
-
}
|
|
99
|
+
}
|
|
95
100
|
return channels;
|
|
96
101
|
}
|