clikit-plugin 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,8 +23,8 @@ type FormatterEntry = {
23
23
  command: (file: string) => string;
24
24
  };
25
25
  export declare function detectFormatter(projectDir: string): FormatterEntry | undefined;
26
- export declare function shouldFormat(filePath: string, extensions?: string[]): boolean;
27
- export declare function runFormatter(filePath: string, projectDir: unknown, formatterOverride?: string): FormatResult;
26
+ export declare function shouldFormat(filePath: unknown, extensions?: string[]): boolean;
27
+ export declare function runFormatter(filePath: unknown, projectDir: unknown, formatterOverride?: string): FormatResult;
28
28
  export declare function formatAutoFormatLog(result: FormatResult): string;
29
29
  export {};
30
30
  //# sourceMappingURL=auto-format.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auto-format.d.ts","sourceRoot":"","sources":["../../src/hooks/auto-format.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACnC,CAAC;AAsBF,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CA2B9E;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAI7E;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,OAAO,EACnB,iBAAiB,CAAC,EAAE,MAAM,GACzB,YAAY,CAoCd;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAKhE"}
1
+ {"version":3,"file":"auto-format.d.ts","sourceRoot":"","sources":["../../src/hooks/auto-format.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACnC,CAAC;AAsBF,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CA2B9E;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAK9E;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,OAAO,EACnB,iBAAiB,CAAC,EAAE,MAAM,GACzB,YAAY,CAqCd;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAKhE"}
@@ -5,7 +5,7 @@
5
5
  * Subagents should execute their task autonomously without clarification.
6
6
  * Runs on tool.execute.before for Task tool.
7
7
  */
8
- export declare function containsQuestion(text: string): boolean;
9
- export declare function isSubagentTool(toolName: string): boolean;
8
+ export declare function containsQuestion(text: unknown): boolean;
9
+ export declare function isSubagentTool(toolName: unknown): boolean;
10
10
  export declare function formatBlockerWarning(): string;
11
11
  //# sourceMappingURL=subagent-question-blocker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"subagent-question-blocker.d.ts","sourceRoot":"","sources":["../../src/hooks/subagent-question-blocker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiBH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGtD;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
1
+ {"version":3,"file":"subagent-question-blocker.d.ts","sourceRoot":"","sources":["../../src/hooks/subagent-question-blocker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiBH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAMvD;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAEzD;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
@@ -26,6 +26,6 @@ export interface EnforcementResult {
26
26
  }
27
27
  export declare function isFileInScope(filePath: string, scope: TaskScope): boolean;
28
28
  export declare function checkEditPermission(filePath: string, scope: TaskScope | undefined, config?: SwarmEnforcerConfig): EnforcementResult;
29
- export declare function extractFileFromToolInput(toolName: string, input: Record<string, unknown>): string | undefined;
29
+ export declare function extractFileFromToolInput(toolName: unknown, input: Record<string, unknown>): string | undefined;
30
30
  export declare function formatEnforcementWarning(result: EnforcementResult): string;
31
31
  //# sourceMappingURL=swarm-enforcer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"swarm-enforcer.d.ts","sourceRoot":"","sources":["../../src/hooks/swarm-enforcer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,SAAS,GACf,OAAO,CAqBT;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,MAAM,CAAC,EAAE,mBAAmB,GAC3B,iBAAiB,CAqBnB;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,GAAG,SAAS,CA4BpB;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAM1E"}
1
+ {"version":3,"file":"swarm-enforcer.d.ts","sourceRoot":"","sources":["../../src/hooks/swarm-enforcer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,SAAS,GACf,OAAO,CAqBT;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,MAAM,CAAC,EAAE,mBAAmB,GAC3B,iBAAiB,CAqBnB;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,GAAG,SAAS,CA6BpB;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAM1E"}
@@ -23,9 +23,9 @@ export interface TypeCheckResult {
23
23
  errors: TypeDiagnostic[];
24
24
  checkedFile: string;
25
25
  }
26
- export declare function isTypeScriptFile(filePath: string): boolean;
27
- export declare function findTsConfig(projectDir: string, override?: string): string | undefined;
28
- export declare function hasTscInstalled(projectDir: string): boolean;
29
- export declare function runTypeCheck(filePath: string, projectDir: unknown, config?: TypeCheckConfig): TypeCheckResult;
26
+ export declare function isTypeScriptFile(filePath: unknown): boolean;
27
+ export declare function findTsConfig(projectDir: unknown, override?: string): string | undefined;
28
+ export declare function hasTscInstalled(projectDir: unknown): boolean;
29
+ export declare function runTypeCheck(filePath: unknown, projectDir: unknown, config?: TypeCheckConfig): TypeCheckResult;
30
30
  export declare function formatTypeCheckWarning(result: TypeCheckResult): string;
31
31
  //# sourceMappingURL=typecheck-gate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typecheck-gate.d.ts","sourceRoot":"","sources":["../../src/hooks/typecheck-gate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAID,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAetF;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAW3D;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,OAAO,EACnB,MAAM,CAAC,EAAE,eAAe,GACvB,eAAe,CAgCjB;AAqCD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAetE"}
1
+ {"version":3,"file":"typecheck-gate.d.ts","sourceRoot":"","sources":["../../src/hooks/typecheck-gate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAID,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAG3D;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgBvF;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAY5D;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,OAAO,EACnB,MAAM,CAAC,EAAE,eAAe,GACvB,eAAe,CAiCjB;AAsCD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAetE"}
package/dist/index.js CHANGED
@@ -3971,11 +3971,14 @@ var QUESTION_INDICATORS = [
3971
3971
  "could you provide"
3972
3972
  ];
3973
3973
  function containsQuestion(text) {
3974
+ if (typeof text !== "string" || !text) {
3975
+ return false;
3976
+ }
3974
3977
  const lower = text.toLowerCase();
3975
3978
  return QUESTION_INDICATORS.some((indicator) => lower.includes(indicator));
3976
3979
  }
3977
3980
  function isSubagentTool(toolName) {
3978
- return toolName === "task" || toolName === "Task";
3981
+ return typeof toolName === "string" && (toolName === "task" || toolName === "Task");
3979
3982
  }
3980
3983
  function formatBlockerWarning() {
3981
3984
  return `[CliKit:subagent-blocker] Subagent attempted to ask clarifying questions. Subagents should execute autonomously.`;
@@ -4263,23 +4266,26 @@ function detectFormatter(projectDir) {
4263
4266
  return;
4264
4267
  }
4265
4268
  function shouldFormat(filePath, extensions) {
4269
+ if (typeof filePath !== "string")
4270
+ return false;
4266
4271
  const ext = path5.extname(filePath).toLowerCase();
4267
4272
  const allowedExts = extensions || DEFAULT_EXTENSIONS;
4268
4273
  return allowedExts.includes(ext);
4269
4274
  }
4270
4275
  function runFormatter(filePath, projectDir, formatterOverride) {
4276
+ const safePath = typeof filePath === "string" && filePath ? filePath : "";
4271
4277
  const safeDir = typeof projectDir === "string" && projectDir ? projectDir : process.cwd();
4272
4278
  const formatter = formatterOverride ? FORMATTERS.find((f) => f.name === formatterOverride) : detectFormatter(safeDir);
4273
- if (!formatter) {
4279
+ if (!formatter || !safePath) {
4274
4280
  return {
4275
4281
  formatted: false,
4276
- file: filePath,
4282
+ file: safePath,
4277
4283
  formatter: "none",
4278
- error: "No formatter detected"
4284
+ error: formatter ? "No file path provided" : "No formatter detected"
4279
4285
  };
4280
4286
  }
4281
4287
  try {
4282
- const cmd = formatter.command(filePath);
4288
+ const cmd = formatter.command(safePath);
4283
4289
  execSync2(cmd, {
4284
4290
  cwd: safeDir,
4285
4291
  timeout: 1e4,
@@ -4287,13 +4293,13 @@ function runFormatter(filePath, projectDir, formatterOverride) {
4287
4293
  });
4288
4294
  return {
4289
4295
  formatted: true,
4290
- file: filePath,
4296
+ file: safePath,
4291
4297
  formatter: formatter.name
4292
4298
  };
4293
4299
  } catch (err) {
4294
4300
  return {
4295
4301
  formatted: false,
4296
- file: filePath,
4302
+ file: safePath,
4297
4303
  formatter: formatter.name,
4298
4304
  error: err instanceof Error ? err.message : String(err)
4299
4305
  };
@@ -4311,16 +4317,19 @@ import * as path6 from "path";
4311
4317
  import { execSync as execSync3 } from "child_process";
4312
4318
  var TS_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
4313
4319
  function isTypeScriptFile(filePath) {
4320
+ if (typeof filePath !== "string")
4321
+ return false;
4314
4322
  return TS_EXTENSIONS.includes(path6.extname(filePath).toLowerCase());
4315
4323
  }
4316
4324
  function findTsConfig(projectDir, override) {
4325
+ const safeDir = typeof projectDir === "string" && projectDir ? projectDir : process.cwd();
4317
4326
  if (override) {
4318
- const overridePath = path6.resolve(projectDir, override);
4327
+ const overridePath = path6.resolve(safeDir, override);
4319
4328
  return fs6.existsSync(overridePath) ? overridePath : undefined;
4320
4329
  }
4321
4330
  const candidates = ["tsconfig.json", "tsconfig.build.json"];
4322
4331
  for (const candidate of candidates) {
4323
- const fullPath = path6.join(projectDir, candidate);
4332
+ const fullPath = path6.join(safeDir, candidate);
4324
4333
  if (fs6.existsSync(fullPath)) {
4325
4334
  return fullPath;
4326
4335
  }
@@ -4328,10 +4337,11 @@ function findTsConfig(projectDir, override) {
4328
4337
  return;
4329
4338
  }
4330
4339
  function runTypeCheck(filePath, projectDir, config) {
4340
+ const safePath = typeof filePath === "string" && filePath ? filePath : "";
4331
4341
  const safeDir = typeof projectDir === "string" && projectDir ? projectDir : process.cwd();
4332
4342
  const tsConfig = findTsConfig(safeDir, config?.tsconfig);
4333
4343
  if (!tsConfig) {
4334
- return { clean: true, errors: [], checkedFile: filePath };
4344
+ return { clean: true, errors: [], checkedFile: safePath };
4335
4345
  }
4336
4346
  try {
4337
4347
  const tscCmd = `npx tsc --noEmit --pretty false -p "${tsConfig}"`;
@@ -4341,18 +4351,20 @@ function runTypeCheck(filePath, projectDir, config) {
4341
4351
  stdio: ["pipe", "pipe", "pipe"],
4342
4352
  encoding: "utf-8"
4343
4353
  });
4344
- return { clean: true, errors: [], checkedFile: filePath };
4354
+ return { clean: true, errors: [], checkedFile: safePath };
4345
4355
  } catch (err) {
4346
4356
  const output = err instanceof Error && "stdout" in err ? String(err.stdout) : "";
4347
- const errors = parseTscOutput(output, filePath);
4357
+ const errors = parseTscOutput(output, safePath);
4348
4358
  return {
4349
4359
  clean: errors.length === 0,
4350
4360
  errors,
4351
- checkedFile: filePath
4361
+ checkedFile: safePath
4352
4362
  };
4353
4363
  }
4354
4364
  }
4355
4365
  function parseTscOutput(output, filterFile) {
4366
+ if (typeof output !== "string")
4367
+ return [];
4356
4368
  const diagnostics = [];
4357
4369
  const lines = output.split(`
4358
4370
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clikit-plugin",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "OpenCode plugin with 10 agents, 19 commands, 48 skills, 14 hooks",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",