From 5c0eb4d039910169132472b407f8f177fe7a6d7a Mon Sep 17 00:00:00 2001 From: GRayHook Date: Wed, 17 Jun 2026 12:55:19 +0700 Subject: [PATCH] =?UTF-8?q?Phase=2011:=20global=20on/off=20toggle=20?= =?UTF-8?q?=E2=80=94=20SPEC=20=C2=A77.1,=20=C2=A77.3.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Write skillReinject.enabled to ~/.pi/agent/settings.json via merge write without clobbering other keys. Co-authored-by: Cursor --- src/commands.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/commands.ts b/src/commands.ts index 50815f1..02de8d5 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -1,6 +1,6 @@ import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent"; import { resolveDeliveryMode } from "./auto-compact.js"; -import { readSettings, type SkillReinjectSettings } from "./settings.js"; +import { readSettings, writeGlobalSettings, type SkillReinjectSettings } from "./settings.js"; import type { AutoCompactIntegration, ExtensionState, RuntimeFlags } from "./state.js"; export interface SkillReinjectCommandDeps { @@ -104,6 +104,10 @@ async function handleSkillReinjectCommand( handleSessionToggle(subcommand, ctx, deps); return; } + if (subcommand === "global") { + handleGlobalToggle(trimmed, ctx); + return; + } if (ctx.hasUI) { ctx.ui.notify(`skill-reinject: unknown subcommand "${subcommand}"`, "warning"); @@ -134,3 +138,19 @@ function handleSessionToggle( const enabledLine = formatEnabledLine(deps.state.sessionOverride, settings); ctx.ui.notify(enabledLine, "info"); } + +function handleGlobalToggle(args: string, ctx: ExtensionCommandContext): void { + const parts = args.trim().split(/\s+/); + const action = parts[1]; + if (action !== "on" && action !== "off") { + if (ctx.hasUI) { + ctx.ui.notify("skill-reinject: usage: /skill-reinject global on|off", "warning"); + } + return; + } + writeGlobalSettings({ enabled: action === "on" }); + if (!ctx.hasUI) { + return; + } + ctx.ui.notify(`skill-reinject: global ${action}`, "info"); +}