feat(builtin-commands): add /refactor command for intelligent LSP/AST-based refactoring
Ports the refactor command from ~/.config/opencode/command/refactor.md to the project as a builtin command. The /refactor command provides deterministic, LSP/AST-aware refactoring with: - Automatic intent analysis and codebase mapping - Risk assessment with test coverage verification - Detailed planning via Plan agent - Step-by-step execution with continuous verification - Zero-regression guarantees via comprehensive testing Supports multiple refactoring scopes (file/module/project) and strategies (safe/aggressive). 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -2,6 +2,7 @@ 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, CANCEL_RALPH_TEMPLATE } from "./templates/ralph-loop"
|
||||
import { REFACTOR_TEMPLATE } from "./templates/refactor"
|
||||
|
||||
const BUILTIN_COMMAND_DEFINITIONS: Record<BuiltinCommandName, Omit<CommandDefinition, "name">> = {
|
||||
"init-deep": {
|
||||
@@ -32,6 +33,14 @@ $ARGUMENTS
|
||||
${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>]",
|
||||
},
|
||||
}
|
||||
|
||||
export function loadBuiltinCommands(
|
||||
|
||||
Reference in New Issue
Block a user