Skip to content

Commit 37f2590

Browse files
authored
Plugin: drop cas command normalization (#31)
1 parent 3f94edc commit 37f2590

File tree

2 files changed

+28
-35
lines changed

2 files changed

+28
-35
lines changed

src/controller.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ describe("Discord controller flows", () => {
838838
);
839839
});
840840

841-
it("shows codex_status as none when no core binding exists", async () => {
841+
it("shows cas_status as none when no core binding exists", async () => {
842842
const { controller } = await createControllerHarness();
843843
await (controller as any).store.upsertBinding({
844844
conversation: {
@@ -868,7 +868,7 @@ describe("Discord controller flows", () => {
868868
expect(reply.text).not.toContain("Session: session-1");
869869
});
870870

871-
it("does not hydrate a denied pending bind into codex_status", async () => {
871+
it("does not hydrate a denied pending bind into cas_status", async () => {
872872
const { controller } = await createControllerHarness();
873873
await (controller as any).store.upsertPendingBind({
874874
conversation: {
@@ -899,7 +899,7 @@ describe("Discord controller flows", () => {
899899
})).toBeNull();
900900
});
901901

902-
it("shows plan mode on in codex_status when the bound conversation has an active plan run", async () => {
902+
it("shows plan mode on in cas_status when the bound conversation has an active plan run", async () => {
903903
const { controller } = await createControllerHarness();
904904
await (controller as any).store.upsertBinding({
905905
conversation: {
@@ -941,7 +941,7 @@ describe("Discord controller flows", () => {
941941
expect(reply.text).toContain("Plan mode: on");
942942
});
943943

944-
it("parses unicode em dash --sync for codex_rename and renames the Telegram topic", async () => {
944+
it("parses unicode em dash --sync for cas_rename and renames the Telegram topic", async () => {
945945
const { controller, clientMock, renameTopic } = await createControllerHarness();
946946
await (controller as any).store.upsertBinding({
947947
conversation: {
@@ -985,7 +985,7 @@ describe("Discord controller flows", () => {
985985
expect(reply).toEqual({ text: 'Renamed the Codex thread to "New Topic Name".' });
986986
});
987987

988-
it("parses unicode em dash --sync for codex_resume and renames the Telegram topic", async () => {
988+
it("parses unicode em dash --sync for cas_resume and renames the Telegram topic", async () => {
989989
const { controller, renameTopic, sendMessageTelegram } = await createControllerHarness();
990990

991991
const reply = await controller.handleCommand(
@@ -1127,7 +1127,7 @@ describe("Discord controller flows", () => {
11271127
);
11281128
});
11291129

1130-
it("replays pending codex_resume --sync effects after approval hydrates on the next resume command", async () => {
1130+
it("replays pending cas_resume --sync effects after approval hydrates on the next resume command", async () => {
11311131
const { controller, clientMock, renameTopic, sendMessageTelegram } = await createControllerHarness();
11321132
(controller as any).client.readThreadContext = vi.fn(async () => ({
11331133
lastUserMessage: "What were we doing here?",
@@ -1200,7 +1200,7 @@ describe("Discord controller flows", () => {
12001200
);
12011201
});
12021202

1203-
it("retries an incomplete codex_resume bind before falling back to the picker", async () => {
1203+
it("retries an incomplete cas_resume bind before falling back to the picker", async () => {
12041204
const { controller } = await createControllerHarness();
12051205
await (controller as any).store.upsertPendingBind({
12061206
conversation: {
@@ -1240,7 +1240,7 @@ describe("Discord controller flows", () => {
12401240
);
12411241
});
12421242

1243-
it("rebinds an incomplete codex_resume bind when the retry is approved immediately", async () => {
1243+
it("rebinds an incomplete cas_resume bind when the retry is approved immediately", async () => {
12441244
const { controller, renameTopic, sendMessageTelegram } = await createControllerHarness();
12451245
(controller as any).client.readThreadContext = vi.fn(async () => ({
12461246
lastUserMessage: "What were we doing here?",
@@ -1592,7 +1592,7 @@ describe("Discord controller flows", () => {
15921592
});
15931593
});
15941594

1595-
it("offers compact rename style buttons for codex_rename --sync without a name", async () => {
1595+
it("offers compact rename style buttons for cas_rename --sync without a name", async () => {
15961596
const { controller } = await createControllerHarness();
15971597
await (controller as any).store.upsertBinding({
15981598
conversation: {
@@ -2007,7 +2007,7 @@ describe("Discord controller flows", () => {
20072007
);
20082008
});
20092009

2010-
it("supports codex_plan off to interrupt an active plan run", async () => {
2010+
it("supports cas_plan off to interrupt an active plan run", async () => {
20112011
const { controller } = await createControllerHarness();
20122012
const interrupt = vi.fn(async () => {});
20132013
(controller as any).activeRuns.set("discord::default::channel:chan-1::", {

src/controller.ts

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,6 @@ function parseFastAction(
397397
return { error: "Usage: /cas_fast [on|off|status]" };
398398
}
399399

400-
function normalizeRegisteredCommandName(commandName: string): string {
401-
return commandName.startsWith("cas_")
402-
? `codex_${commandName.slice("cas_".length)}`
403-
: commandName;
404-
}
405-
406400
function normalizeServiceTier(value: string | undefined | null): string | undefined {
407401
const normalized = value?.trim().toLowerCase();
408402
return normalized ? normalized : undefined;
@@ -1013,15 +1007,14 @@ export class CodexPluginController {
10131007
: null;
10141008
const binding = existingBinding ?? hydratedBinding?.binding ?? null;
10151009
const args = ctx.args?.trim() ?? "";
1016-
const normalizedCommandName = normalizeRegisteredCommandName(commandName);
10171010
if (isDiscordChannel(ctx.channel)) {
10181011
this.api.logger.debug(
10191012
`codex discord command /${commandName} from=${ctx.from ?? "<none>"} to=${ctx.to ?? "<none>"} conversation=${conversation?.conversationId ?? "<none>"}`,
10201013
);
10211014
}
10221015

1023-
switch (normalizedCommandName) {
1024-
case "codex_resume":
1016+
switch (commandName) {
1017+
case "cas_resume":
10251018
return await this.handleJoinCommand(
10261019
conversation,
10271020
binding,
@@ -1031,7 +1024,7 @@ export class CodexPluginController {
10311024
pendingBind,
10321025
hydratedBinding?.pendingBind,
10331026
);
1034-
case "codex_detach":
1027+
case "cas_detach":
10351028
if (!conversation) {
10361029
return { text: "This command needs a Telegram or Discord conversation." };
10371030
}
@@ -1042,39 +1035,39 @@ export class CodexPluginController {
10421035
? "Detached this conversation from Codex."
10431036
: "This conversation is not currently bound to Codex.",
10441037
};
1045-
case "codex_status":
1038+
case "cas_status":
10461039
return await this.handleStatusCommand(
10471040
conversation,
10481041
binding,
10491042
Boolean(currentBinding || binding),
10501043
);
1051-
case "codex_stop":
1044+
case "cas_stop":
10521045
return await this.handleStopCommand(conversation);
1053-
case "codex_steer":
1046+
case "cas_steer":
10541047
return await this.handleSteerCommand(conversation, args);
1055-
case "codex_plan":
1048+
case "cas_plan":
10561049
return await this.handlePlanCommand(conversation, binding, args);
1057-
case "codex_review":
1050+
case "cas_review":
10581051
return await this.handleReviewCommand(conversation, binding, args);
1059-
case "codex_compact":
1052+
case "cas_compact":
10601053
return await this.handleCompactCommand(conversation, binding);
1061-
case "codex_skills":
1054+
case "cas_skills":
10621055
return await this.handleSkillsCommand(conversation, binding, args);
1063-
case "codex_experimental":
1056+
case "cas_experimental":
10641057
return await this.handleExperimentalCommand(binding);
1065-
case "codex_mcp":
1058+
case "cas_mcp":
10661059
return await this.handleMcpCommand(binding, args);
1067-
case "codex_fast":
1060+
case "cas_fast":
10681061
return await this.handleFastCommand(binding, args);
1069-
case "codex_model":
1062+
case "cas_model":
10701063
return await this.handleModelCommand(conversation, binding, args);
1071-
case "codex_permissions":
1064+
case "cas_permissions":
10721065
return await this.handlePermissionsCommand(binding);
1073-
case "codex_init":
1066+
case "cas_init":
10741067
return await this.handlePromptAlias(conversation, binding, args, "/init");
1075-
case "codex_diff":
1068+
case "cas_diff":
10761069
return await this.handlePromptAlias(conversation, binding, args, "/diff");
1077-
case "codex_rename":
1070+
case "cas_rename":
10781071
return await this.handleRenameCommand(conversation, binding, args);
10791072
default:
10801073
return { text: "Unknown Codex command." };

0 commit comments

Comments
 (0)