a010de1db2
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
114 lines
3.5 KiB
TypeScript
114 lines
3.5 KiB
TypeScript
import type { CommandDefinition } from "../claude-code-command-loader"
|
|
import type { BuiltinCommandName, BuiltinCommands } from "./types"
|
|
import { INIT_DEEP_TEMPLATE } from "./templates/init-deep"
|
|
import { RALPH_LOOP_TEMPLATE, ULW_LOOP_TEMPLATE, CANCEL_RALPH_TEMPLATE } from "./templates/ralph-loop"
|
|
import { STOP_CONTINUATION_TEMPLATE } from "./templates/stop-continuation"
|
|
import { REFACTOR_TEMPLATE } from "./templates/refactor"
|
|
import { START_WORK_TEMPLATE } from "./templates/start-work"
|
|
import { HANDOFF_TEMPLATE } from "./templates/handoff"
|
|
|
|
const BUILTIN_COMMAND_DEFINITIONS: Record<BuiltinCommandName, Omit<CommandDefinition, "name">> = {
|
|
"init-deep": {
|
|
description: "(builtin) Initialize hierarchical AGENTS.md knowledge base",
|
|
template: `<command-instruction>
|
|
${INIT_DEEP_TEMPLATE}
|
|
</command-instruction>
|
|
|
|
<user-request>
|
|
$ARGUMENTS
|
|
</user-request>`,
|
|
argumentHint: "[--create-new] [--max-depth=N]",
|
|
},
|
|
"ralph-loop": {
|
|
description: "(builtin) Start self-referential development loop until completion",
|
|
template: `<command-instruction>
|
|
${RALPH_LOOP_TEMPLATE}
|
|
</command-instruction>
|
|
|
|
<user-task>
|
|
$ARGUMENTS
|
|
</user-task>`,
|
|
argumentHint: '"task description" [--completion-promise=TEXT] [--max-iterations=N] [--strategy=reset|continue]',
|
|
},
|
|
"ulw-loop": {
|
|
description: "(builtin) Start ultrawork loop - continues until completion with ultrawork mode",
|
|
template: `<command-instruction>
|
|
${ULW_LOOP_TEMPLATE}
|
|
</command-instruction>
|
|
|
|
<user-task>
|
|
$ARGUMENTS
|
|
</user-task>`,
|
|
argumentHint: '"task description" [--completion-promise=TEXT] [--strategy=reset|continue]',
|
|
},
|
|
"cancel-ralph": {
|
|
description: "(builtin) Cancel active Ralph Loop",
|
|
template: `<command-instruction>
|
|
${CANCEL_RALPH_TEMPLATE}
|
|
</command-instruction>`,
|
|
},
|
|
refactor: {
|
|
description:
|
|
"(builtin) Intelligent refactoring command with LSP, AST-grep, architecture analysis, codemap, and TDD verification.",
|
|
template: `<command-instruction>
|
|
${REFACTOR_TEMPLATE}
|
|
</command-instruction>`,
|
|
argumentHint: "<refactoring-target> [--scope=<file|module|project>] [--strategy=<safe|aggressive>]",
|
|
},
|
|
"start-work": {
|
|
description: "(builtin) Start Sisyphus work session from Prometheus plan",
|
|
agent: "atlas",
|
|
template: `<command-instruction>
|
|
${START_WORK_TEMPLATE}
|
|
</command-instruction>
|
|
|
|
<session-context>
|
|
Session ID: $SESSION_ID
|
|
Timestamp: $TIMESTAMP
|
|
</session-context>
|
|
|
|
<user-request>
|
|
$ARGUMENTS
|
|
</user-request>`,
|
|
argumentHint: "[plan-name]",
|
|
},
|
|
"stop-continuation": {
|
|
description: "(builtin) Stop all continuation mechanisms (ralph loop, todo continuation, boulder) for this session",
|
|
template: `<command-instruction>
|
|
${STOP_CONTINUATION_TEMPLATE}
|
|
</command-instruction>`,
|
|
},
|
|
handoff: {
|
|
description: "(builtin) Create a detailed context summary for continuing work in a new session",
|
|
template: `<command-instruction>
|
|
${HANDOFF_TEMPLATE}
|
|
</command-instruction>
|
|
|
|
<session-context>
|
|
Session ID: $SESSION_ID
|
|
Timestamp: $TIMESTAMP
|
|
</session-context>
|
|
|
|
<user-request>
|
|
$ARGUMENTS
|
|
</user-request>`,
|
|
argumentHint: "[goal]",
|
|
},
|
|
}
|
|
|
|
export function loadBuiltinCommands(
|
|
disabledCommands?: BuiltinCommandName[]
|
|
): BuiltinCommands {
|
|
const disabled = new Set(disabledCommands ?? [])
|
|
const commands: BuiltinCommands = {}
|
|
|
|
for (const [name, definition] of Object.entries(BUILTIN_COMMAND_DEFINITIONS)) {
|
|
if (!disabled.has(name as BuiltinCommandName)) {
|
|
const { argumentHint: _argumentHint, ...openCodeCompatible } = definition
|
|
commands[name] = { ...openCodeCompatible, name } as CommandDefinition
|
|
}
|
|
}
|
|
|
|
return commands
|
|
}
|