fix(start-work): restore atlas native command routing
Route the builtin /start-work command to Atlas when Atlas is available so OpenCode resolves the native command agent correctly before plugin hooks run. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
import { describe, test, expect } from "bun:test"
|
||||
import { afterEach, beforeEach, describe, test, expect } from "bun:test"
|
||||
import { loadBuiltinCommands } from "./commands"
|
||||
import { HANDOFF_TEMPLATE } from "./templates/handoff"
|
||||
import { REMOVE_AI_SLOPS_TEMPLATE } from "./templates/remove-ai-slops"
|
||||
import type { BuiltinCommandName } from "./types"
|
||||
import { _resetForTesting, registerAgentName } from "../claude-code-session-state"
|
||||
|
||||
beforeEach(() => {
|
||||
_resetForTesting()
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
_resetForTesting()
|
||||
})
|
||||
|
||||
describe("loadBuiltinCommands", () => {
|
||||
test("should include handoff command in loaded commands", () => {
|
||||
@@ -69,6 +78,17 @@ describe("loadBuiltinCommands", () => {
|
||||
//#then
|
||||
expect(commands["start-work"].agent).toBe("sisyphus")
|
||||
})
|
||||
|
||||
test("should preassign Atlas as the native agent for start-work when Atlas is registered", () => {
|
||||
//#given
|
||||
registerAgentName("atlas")
|
||||
|
||||
//#when
|
||||
const commands = loadBuiltinCommands()
|
||||
|
||||
//#then
|
||||
expect(commands["start-work"].agent).toBe("atlas")
|
||||
})
|
||||
})
|
||||
|
||||
describe("loadBuiltinCommands — remove-ai-slops", () => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { CommandDefinition } from "../claude-code-command-loader"
|
||||
import { isAgentRegistered } from "../claude-code-session-state"
|
||||
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"
|
||||
@@ -8,7 +9,8 @@ import { START_WORK_TEMPLATE } from "./templates/start-work"
|
||||
import { HANDOFF_TEMPLATE } from "./templates/handoff"
|
||||
import { REMOVE_AI_SLOPS_TEMPLATE } from "./templates/remove-ai-slops"
|
||||
|
||||
const BUILTIN_COMMAND_DEFINITIONS: Record<BuiltinCommandName, Omit<CommandDefinition, "name">> = {
|
||||
function createBuiltinCommandDefinitions(): Record<BuiltinCommandName, Omit<CommandDefinition, "name">> {
|
||||
return {
|
||||
"init-deep": {
|
||||
description: "(builtin) Initialize hierarchical AGENTS.md knowledge base",
|
||||
template: `<command-instruction>
|
||||
@@ -58,7 +60,7 @@ ${REFACTOR_TEMPLATE}
|
||||
},
|
||||
"start-work": {
|
||||
description: "(builtin) Start Sisyphus work session from Prometheus plan",
|
||||
agent: "sisyphus",
|
||||
agent: isAgentRegistered("atlas") ? "atlas" : "sisyphus",
|
||||
template: `<command-instruction>
|
||||
${START_WORK_TEMPLATE}
|
||||
</command-instruction>
|
||||
@@ -106,14 +108,16 @@ $ARGUMENTS
|
||||
argumentHint: "[goal]",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export function loadBuiltinCommands(
|
||||
disabledCommands?: BuiltinCommandName[]
|
||||
): BuiltinCommands {
|
||||
const builtinCommandDefinitions = createBuiltinCommandDefinitions()
|
||||
const disabled = new Set(disabledCommands ?? [])
|
||||
const commands: BuiltinCommands = {}
|
||||
|
||||
for (const [name, definition] of Object.entries(BUILTIN_COMMAND_DEFINITIONS)) {
|
||||
for (const [name, definition] of Object.entries(builtinCommandDefinitions)) {
|
||||
if (!disabled.has(name as BuiltinCommandName)) {
|
||||
const { argumentHint: _argumentHint, ...openCodeCompatible } = definition
|
||||
commands[name] = { ...openCodeCompatible, name } as CommandDefinition
|
||||
|
||||
Reference in New Issue
Block a user