From e73f565c002dc1d17083c48dadbcd4d313ced611 Mon Sep 17 00:00:00 2001 From: Vincent Hardouin Date: Fri, 10 Apr 2026 19:19:43 +0200 Subject: [PATCH] feat: disable plugin when snip is not installed --- src/index.ts | 9 ++++++++- tsconfig.json | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 33bbf35..7462c8a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,7 +33,14 @@ export const toolExecuteBefore: NonNullable = asyn .join("") } -export const SnipPlugin: Plugin = async () => { +export const SnipPlugin: Plugin = async ({ $ }) => { + try { + await $`which snip`.quiet() + } catch { + console.warn("[snip] snip binary not found in PATH — plugin disabled") + return {} + } + return { "tool.execute.before": toolExecuteBefore, } diff --git a/tsconfig.json b/tsconfig.json index f471e3f..a810725 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,7 @@ "declarationMap": true, "outDir": "./dist", "rootDir": "./src", - "lib": ["ES2022"] + "lib": ["ES2022", "dom"] }, "include": ["src/**/*"], "exclude": ["node_modules", "dist"]