Features: - 30+ Custom Skills (cognitive, development, UI/UX, autonomous agents) - RalphLoop autonomous agent integration - Multi-AI consultation (Qwen) - Agent management system with sync capabilities - Custom hooks for session management - MCP servers integration - Plugin marketplace setup - Comprehensive installation script Components: - Skills: always-use-superpowers, ralph, brainstorming, ui-ux-pro-max, etc. - Agents: 100+ agents across engineering, marketing, product, etc. - Hooks: session-start-superpowers, qwen-consult, ralph-auto-trigger - Commands: /brainstorm, /write-plan, /execute-plan - MCP Servers: zai-mcp-server, web-search-prime, web-reader, zread - Binaries: ralphloop wrapper Installation: ./supercharge.sh
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
type RedactFn = (text: string) => string;
|
|
|
|
export interface FormatBlockedMessageInput {
|
|
reason: string;
|
|
command?: string;
|
|
segment?: string;
|
|
maxLen?: number;
|
|
redact?: RedactFn;
|
|
}
|
|
|
|
export function formatBlockedMessage(input: FormatBlockedMessageInput): string {
|
|
const { reason, command, segment } = input;
|
|
const maxLen = input.maxLen ?? 200;
|
|
const redact = input.redact ?? ((t: string) => t);
|
|
|
|
let message = `BLOCKED by Safety Net\n\nReason: ${reason}`;
|
|
|
|
if (command) {
|
|
const safeCommand = redact(command);
|
|
message += `\n\nCommand: ${excerpt(safeCommand, maxLen)}`;
|
|
}
|
|
|
|
if (segment && segment !== command) {
|
|
const safeSegment = redact(segment);
|
|
message += `\n\nSegment: ${excerpt(safeSegment, maxLen)}`;
|
|
}
|
|
|
|
message +=
|
|
'\n\nIf this operation is truly needed, ask the user for explicit permission and have them run the command manually.';
|
|
|
|
return message;
|
|
}
|
|
|
|
function excerpt(text: string, maxLen: number): string {
|
|
return text.length > maxLen ? `${text.slice(0, maxLen)}...` : text;
|
|
}
|