fix: register sf stop command outside tui

This commit is contained in:
Mikael Hugo 2026-05-14 21:30:00 +02:00
parent 2e4bdd292c
commit b0ebe7ce18
2 changed files with 28 additions and 2 deletions

View file

@ -36,7 +36,6 @@ export const BASE_RUNTIME_COMMANDS = new Set([
"thinking",
"edit-mode",
"terminal",
"stop",
"exit",
"quit",
]);

View file

@ -11,10 +11,12 @@ import {
routeChatCommand,
} from "../chat-command-router.js";
import {
BASE_RUNTIME_COMMANDS,
DIRECT_SF_COMMAND_NAMES,
getSfArgumentCompletions,
getSfTopLevelCommandCompletions,
PRIMARY_COMMANDS,
PUBLIC_DIRECT_COMMANDS,
} from "../commands/catalog.js";
import { showHelp } from "../commands/handlers/core.js";
import { registerSFCommands } from "../commands/index.js";
@ -40,13 +42,38 @@ test("direct SF command surface registers callable verbs without legacy sf names
assert.ok(names.includes("ship"));
assert.ok(names.includes("plan"));
assert.ok(names.includes("todo"));
assert.ok(names.includes("stop"));
assert.equal(names.includes("model"), false);
assert.ok(names.includes("permission-profile"));
assert.ok(!names.includes("sf"));
assert.ok(!names.includes("stop"));
assert.deepEqual(names, [...DIRECT_SF_COMMAND_NAMES].sort());
});
test("visible_sf_commands_are_registered_unless_core_runtime_owned", () => {
const registered = [];
registerSFCommands({
registerCommand(name, options) {
registered.push({ name, options });
},
});
const registeredNames = new Set(registered.map((entry) => entry.name));
const missing = [...PUBLIC_DIRECT_COMMANDS].filter(
(name) => !registeredNames.has(name) && !BASE_RUNTIME_COMMANDS.has(name),
);
assert.deepEqual(missing, []);
assert.equal(
registeredNames.has("stop"),
true,
"/stop is SF autonomous control in print/extension command paths",
);
assert.equal(
BASE_RUNTIME_COMMANDS.has("model"),
true,
"/model remains core runtime-owned",
);
});
test("top_level_completions_keep_platform_owned_product_paths_visible", () => {
const labels = getSfArgumentCompletions("").map((entry) => entry.label);