Phase 11: session on/off/reset toggle — SPEC §5.1, §7.1.

Persist sessionOverride via saveState and confirm the effective enabled layer after each toggle.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-17 12:55:07 +07:00
parent 7d1c4f031f
commit e55a14e469
+30
View File
@@ -100,7 +100,37 @@ async function handleSkillReinjectCommand(
}
const subcommand = trimmed.split(/\s+/)[0];
if (subcommand === "on" || subcommand === "off" || subcommand === "reset") {
handleSessionToggle(subcommand, ctx, deps);
return;
}
if (ctx.hasUI) {
ctx.ui.notify(`skill-reinject: unknown subcommand "${subcommand}"`, "warning");
}
}
function handleSessionToggle(
subcommand: "on" | "off" | "reset",
ctx: ExtensionCommandContext,
deps: SkillReinjectCommandDeps,
): void {
switch (subcommand) {
case "on":
deps.state.sessionOverride = true;
break;
case "off":
deps.state.sessionOverride = false;
break;
case "reset":
deps.state.sessionOverride = null;
break;
}
deps.persistState();
if (!ctx.hasUI) {
return;
}
const settings = readSettings(ctx);
const enabledLine = formatEnabledLine(deps.state.sessionOverride, settings);
ctx.ui.notify(enabledLine, "info");
}