ralph-cli-sandboxed 0.4.0 → 0.4.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/README.md +30 -0
- package/dist/commands/action.js +47 -20
- package/dist/commands/chat.d.ts +1 -1
- package/dist/commands/chat.js +325 -62
- package/dist/commands/config.js +2 -1
- package/dist/commands/daemon.d.ts +2 -5
- package/dist/commands/daemon.js +118 -49
- package/dist/commands/docker.js +110 -73
- package/dist/commands/fix-config.js +2 -1
- package/dist/commands/fix-prd.js +2 -2
- package/dist/commands/help.js +19 -3
- package/dist/commands/init.js +78 -17
- package/dist/commands/listen.js +116 -5
- package/dist/commands/logo.d.ts +5 -0
- package/dist/commands/logo.js +41 -0
- package/dist/commands/notify.js +1 -1
- package/dist/commands/once.js +19 -9
- package/dist/commands/prd.js +20 -2
- package/dist/commands/run.js +111 -27
- package/dist/commands/slack.d.ts +10 -0
- package/dist/commands/slack.js +333 -0
- package/dist/config/responder-presets.json +69 -0
- package/dist/index.js +6 -1
- package/dist/providers/discord.d.ts +82 -0
- package/dist/providers/discord.js +697 -0
- package/dist/providers/slack.d.ts +79 -0
- package/dist/providers/slack.js +715 -0
- package/dist/providers/telegram.d.ts +30 -0
- package/dist/providers/telegram.js +190 -7
- package/dist/responders/claude-code-responder.d.ts +48 -0
- package/dist/responders/claude-code-responder.js +203 -0
- package/dist/responders/cli-responder.d.ts +62 -0
- package/dist/responders/cli-responder.js +298 -0
- package/dist/responders/llm-responder.d.ts +135 -0
- package/dist/responders/llm-responder.js +582 -0
- package/dist/templates/macos-scripts.js +2 -4
- package/dist/templates/prompts.js +4 -2
- package/dist/tui/ConfigEditor.js +42 -5
- package/dist/tui/components/ArrayEditor.js +1 -1
- package/dist/tui/components/EditorPanel.js +10 -6
- package/dist/tui/components/HelpPanel.d.ts +1 -1
- package/dist/tui/components/HelpPanel.js +1 -1
- package/dist/tui/components/JsonSnippetEditor.js +8 -5
- package/dist/tui/components/KeyValueEditor.js +69 -5
- package/dist/tui/components/LLMProvidersEditor.d.ts +22 -0
- package/dist/tui/components/LLMProvidersEditor.js +357 -0
- package/dist/tui/components/ObjectEditor.js +1 -1
- package/dist/tui/components/Preview.js +1 -1
- package/dist/tui/components/RespondersEditor.d.ts +22 -0
- package/dist/tui/components/RespondersEditor.js +437 -0
- package/dist/tui/components/SectionNav.js +27 -3
- package/dist/tui/utils/presets.js +15 -2
- package/dist/utils/chat-client.d.ts +33 -4
- package/dist/utils/chat-client.js +20 -1
- package/dist/utils/config.d.ts +100 -1
- package/dist/utils/config.js +78 -1
- package/dist/utils/daemon-actions.d.ts +19 -0
- package/dist/utils/daemon-actions.js +111 -0
- package/dist/utils/daemon-client.d.ts +21 -0
- package/dist/utils/daemon-client.js +28 -1
- package/dist/utils/llm-client.d.ts +82 -0
- package/dist/utils/llm-client.js +185 -0
- package/dist/utils/message-queue.js +6 -6
- package/dist/utils/notification.d.ts +10 -2
- package/dist/utils/notification.js +111 -4
- package/dist/utils/prd-validator.js +60 -19
- package/dist/utils/prompt.js +22 -12
- package/dist/utils/responder-logger.d.ts +47 -0
- package/dist/utils/responder-logger.js +129 -0
- package/dist/utils/responder-presets.d.ts +92 -0
- package/dist/utils/responder-presets.js +156 -0
- package/dist/utils/responder.d.ts +88 -0
- package/dist/utils/responder.js +207 -0
- package/dist/utils/stream-json.js +6 -6
- package/docs/CHAT-CLIENTS.md +520 -0
- package/docs/CHAT-RESPONDERS.md +785 -0
- package/docs/DEVELOPMENT.md +25 -0
- package/docs/USEFUL_ACTIONS.md +815 -0
- package/docs/chat-architecture.md +251 -0
- package/package.json +14 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"presets": {
|
|
3
|
+
"qa": {
|
|
4
|
+
"name": "Q&A Assistant",
|
|
5
|
+
"description": "LLM responder optimized for answering questions about the codebase",
|
|
6
|
+
"type": "llm",
|
|
7
|
+
"trigger": "@qa",
|
|
8
|
+
"provider": "anthropic",
|
|
9
|
+
"systemPrompt": "You are a knowledgeable Q&A assistant for the {{project}} project. Your role is to:\n\n1. Answer questions accurately and concisely about the codebase, its architecture, and functionality\n2. Explain how specific features, components, or modules work\n3. Help developers understand code patterns, conventions, and best practices used in the project\n4. Clarify dependencies, APIs, and integration points\n5. Provide context about why certain design decisions were made\n\nKeep responses focused and practical. If you're unsure about something, say so rather than guessing. Reference specific files, functions, or code sections when helpful.",
|
|
10
|
+
"timeout": 60000,
|
|
11
|
+
"maxLength": 2000
|
|
12
|
+
},
|
|
13
|
+
"reviewer": {
|
|
14
|
+
"name": "Code Reviewer",
|
|
15
|
+
"description": "LLM responder for code review feedback and suggestions",
|
|
16
|
+
"type": "llm",
|
|
17
|
+
"trigger": "@review",
|
|
18
|
+
"provider": "anthropic",
|
|
19
|
+
"systemPrompt": "You are an expert code reviewer for the {{project}} project. Your role is to:\n\n1. Review code changes, diffs, or code snippets shared with you\n2. Identify potential bugs, security issues, and edge cases\n3. Suggest improvements for readability, maintainability, and performance\n4. Check for adherence to project conventions and best practices\n5. Highlight what's done well alongside areas for improvement\n\nProvide constructive, actionable feedback. Prioritize critical issues over minor style preferences. When suggesting changes, explain the reasoning. Be specific about file locations and line numbers when possible.",
|
|
20
|
+
"timeout": 90000,
|
|
21
|
+
"maxLength": 2500
|
|
22
|
+
},
|
|
23
|
+
"architect": {
|
|
24
|
+
"name": "Architecture Advisor",
|
|
25
|
+
"description": "LLM responder for architecture and design discussions",
|
|
26
|
+
"type": "llm",
|
|
27
|
+
"trigger": "@arch",
|
|
28
|
+
"provider": "anthropic",
|
|
29
|
+
"systemPrompt": "You are a software architecture advisor for the {{project}} project. Your role is to:\n\n1. Discuss high-level system design and architectural decisions\n2. Evaluate trade-offs between different approaches (scalability, maintainability, performance)\n3. Recommend design patterns and architectural styles appropriate for the use case\n4. Help plan major refactors or new feature implementations\n5. Identify potential technical debt and suggest mitigation strategies\n\nConsider the existing codebase constraints when making recommendations. Provide clear reasoning for architectural choices. Focus on practical, incremental improvements rather than complete rewrites. Draw diagrams in ASCII when helpful.",
|
|
30
|
+
"timeout": 120000,
|
|
31
|
+
"maxLength": 3000
|
|
32
|
+
},
|
|
33
|
+
"explain": {
|
|
34
|
+
"name": "Code Explainer",
|
|
35
|
+
"description": "LLM responder focused on explaining code in detail",
|
|
36
|
+
"type": "llm",
|
|
37
|
+
"trigger": "@explain",
|
|
38
|
+
"provider": "anthropic",
|
|
39
|
+
"systemPrompt": "You are a code explanation specialist for the {{project}} project. Your role is to:\n\n1. Break down complex code into understandable parts\n2. Explain the purpose and behavior of functions, classes, and modules\n3. Trace data flow and control flow through the codebase\n4. Describe how different components interact with each other\n5. Provide context about the 'why' behind implementation choices\n\nTailor explanations to the apparent experience level of the questioner. Use analogies and examples when helpful. Walk through code step-by-step when explaining algorithms or complex logic. Be thorough but avoid unnecessary jargon.",
|
|
40
|
+
"timeout": 60000,
|
|
41
|
+
"maxLength": 2500
|
|
42
|
+
},
|
|
43
|
+
"code": {
|
|
44
|
+
"name": "Code Editor",
|
|
45
|
+
"description": "Claude Code responder for making file modifications",
|
|
46
|
+
"type": "claude-code",
|
|
47
|
+
"trigger": "@code",
|
|
48
|
+
"timeout": 300000,
|
|
49
|
+
"maxLength": 2000
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"bundles": {
|
|
53
|
+
"standard": {
|
|
54
|
+
"name": "Standard Bundle",
|
|
55
|
+
"description": "Common responders for development workflow (qa, reviewer, code)",
|
|
56
|
+
"presets": ["qa", "reviewer", "code"]
|
|
57
|
+
},
|
|
58
|
+
"full": {
|
|
59
|
+
"name": "Full Bundle",
|
|
60
|
+
"description": "All available responders",
|
|
61
|
+
"presets": ["qa", "reviewer", "architect", "explain", "code"]
|
|
62
|
+
},
|
|
63
|
+
"minimal": {
|
|
64
|
+
"name": "Minimal Bundle",
|
|
65
|
+
"description": "Just the essentials (qa, code)",
|
|
66
|
+
"presets": ["qa", "code"]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { help } from "./commands/help.js";
|
|
|
6
6
|
import { init } from "./commands/init.js";
|
|
7
7
|
import { once } from "./commands/once.js";
|
|
8
8
|
import { run } from "./commands/run.js";
|
|
9
|
-
import { prd, prdAdd, prdList, prdStatus, prdToggle, prdClean, parseListArgs } from "./commands/prd.js";
|
|
9
|
+
import { prd, prdAdd, prdList, prdStatus, prdToggle, prdClean, parseListArgs, } from "./commands/prd.js";
|
|
10
10
|
import { docker } from "./commands/docker.js";
|
|
11
11
|
import { prompt } from "./commands/prompt.js";
|
|
12
12
|
import { fixPrd } from "./commands/fix-prd.js";
|
|
@@ -17,6 +17,8 @@ import { chat } from "./commands/chat.js";
|
|
|
17
17
|
import { listen } from "./commands/listen.js";
|
|
18
18
|
import { config } from "./commands/config.js";
|
|
19
19
|
import { action } from "./commands/action.js";
|
|
20
|
+
import { logo } from "./commands/logo.js";
|
|
21
|
+
import { slack } from "./commands/slack.js";
|
|
20
22
|
const __filename = fileURLToPath(import.meta.url);
|
|
21
23
|
const __dirname = dirname(__filename);
|
|
22
24
|
function getPackageInfo() {
|
|
@@ -38,8 +40,11 @@ const commands = {
|
|
|
38
40
|
listen,
|
|
39
41
|
config,
|
|
40
42
|
action,
|
|
43
|
+
slack,
|
|
41
44
|
"fix-prd": (args) => fixPrd(args),
|
|
42
45
|
"fix-config": (args) => fixConfig(args),
|
|
46
|
+
// Hidden easter egg
|
|
47
|
+
logo: () => logo(),
|
|
43
48
|
// Top-level PRD commands (shortcuts)
|
|
44
49
|
add: () => prdAdd(),
|
|
45
50
|
list: (args) => {
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discord chat client implementation.
|
|
3
|
+
* Uses discord.js for WebSocket-based real-time messaging via the Discord Gateway.
|
|
4
|
+
*
|
|
5
|
+
* Required packages (must be installed separately):
|
|
6
|
+
* npm install discord.js
|
|
7
|
+
*/
|
|
8
|
+
import { ChatClient, ChatCommandHandler, ChatMessageHandler, DiscordSettings, SendMessageOptions } from "../utils/chat-client.js";
|
|
9
|
+
export declare class DiscordChatClient implements ChatClient {
|
|
10
|
+
readonly provider: "discord";
|
|
11
|
+
private settings;
|
|
12
|
+
private connected;
|
|
13
|
+
private debug;
|
|
14
|
+
private client;
|
|
15
|
+
private onCommand;
|
|
16
|
+
private onMessage;
|
|
17
|
+
private responderMatcher;
|
|
18
|
+
private respondersConfig;
|
|
19
|
+
private botUserId;
|
|
20
|
+
constructor(settings: DiscordSettings, debug?: boolean);
|
|
21
|
+
/**
|
|
22
|
+
* Initialize responder matching from config.
|
|
23
|
+
*/
|
|
24
|
+
private initializeResponders;
|
|
25
|
+
/**
|
|
26
|
+
* Execute a responder and return the result.
|
|
27
|
+
*/
|
|
28
|
+
private executeResponder;
|
|
29
|
+
/**
|
|
30
|
+
* Handle a message that might match a responder.
|
|
31
|
+
* Returns true if a responder was matched and executed.
|
|
32
|
+
*/
|
|
33
|
+
private handleResponderMessage;
|
|
34
|
+
/**
|
|
35
|
+
* Check if the bot is mentioned in a message.
|
|
36
|
+
*/
|
|
37
|
+
private isBotMentioned;
|
|
38
|
+
/**
|
|
39
|
+
* Remove bot mention from message text.
|
|
40
|
+
*/
|
|
41
|
+
private removeBotMention;
|
|
42
|
+
/**
|
|
43
|
+
* Check if this is a DM (direct message) channel.
|
|
44
|
+
*/
|
|
45
|
+
private isDMChannel;
|
|
46
|
+
/**
|
|
47
|
+
* Check if a guild ID is allowed.
|
|
48
|
+
*/
|
|
49
|
+
private isGuildAllowed;
|
|
50
|
+
/**
|
|
51
|
+
* Check if a channel ID is allowed.
|
|
52
|
+
*/
|
|
53
|
+
private isChannelAllowed;
|
|
54
|
+
/**
|
|
55
|
+
* Convert a Discord message to our ChatMessage format.
|
|
56
|
+
*/
|
|
57
|
+
private toMessage;
|
|
58
|
+
/**
|
|
59
|
+
* Register slash commands with Discord.
|
|
60
|
+
*/
|
|
61
|
+
private registerSlashCommands;
|
|
62
|
+
/**
|
|
63
|
+
* Handle incoming Discord messages.
|
|
64
|
+
*/
|
|
65
|
+
private handleMessage;
|
|
66
|
+
/**
|
|
67
|
+
* Handle slash command interactions.
|
|
68
|
+
*/
|
|
69
|
+
private handleInteraction;
|
|
70
|
+
/**
|
|
71
|
+
* Handle button interactions.
|
|
72
|
+
*/
|
|
73
|
+
private handleButtonInteraction;
|
|
74
|
+
connect(onCommand: ChatCommandHandler, onMessage?: ChatMessageHandler): Promise<void>;
|
|
75
|
+
sendMessage(chatId: string, text: string, options?: SendMessageOptions): Promise<void>;
|
|
76
|
+
disconnect(): Promise<void>;
|
|
77
|
+
isConnected(): boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create a Discord chat client from settings.
|
|
81
|
+
*/
|
|
82
|
+
export declare function createDiscordClient(settings: DiscordSettings, debug?: boolean): ChatClient;
|