clikit-plugin 0.2.12 → 0.2.14

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.
@@ -15,5 +15,5 @@ export interface TodoCheckResult {
15
15
  inProgress: TodoItem[];
16
16
  }
17
17
  export declare function checkTodoCompletion(todos: unknown): TodoCheckResult;
18
- export declare function formatIncompleteWarning(result: TodoCheckResult, sessionId?: string): string;
18
+ export declare function formatIncompleteWarning(result: TodoCheckResult | unknown, sessionId?: string): string;
19
19
  //# sourceMappingURL=todo-enforcer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"todo-enforcer.d.ts","sourceRoot":"","sources":["../../src/hooks/todo-enforcer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,WAAW,CAAC;CAC9C;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,QAAQ,EAAE,CAAC;IACvB,UAAU,EAAE,QAAQ,EAAE,CAAC;CACxB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAYnE;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,eAAe,EACvB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAuBR"}
1
+ {"version":3,"file":"todo-enforcer.d.ts","sourceRoot":"","sources":["../../src/hooks/todo-enforcer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,WAAW,CAAC;CAC9C;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,QAAQ,EAAE,CAAC;IACvB,UAAU,EAAE,QAAQ,EAAE,CAAC;CACxB;AA8CD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAgBnE;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,eAAe,GAAG,OAAO,EACjC,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAwBR"}
package/dist/index.js CHANGED
@@ -3765,12 +3765,46 @@ function filterCommands(commands, config) {
3765
3765
  }
3766
3766
 
3767
3767
  // src/hooks/todo-enforcer.ts
3768
+ var EMPTY_RESULT = {
3769
+ complete: true,
3770
+ incomplete: [],
3771
+ inProgress: []
3772
+ };
3773
+ function normalizeTodoItem(value) {
3774
+ if (!value || typeof value !== "object") {
3775
+ return null;
3776
+ }
3777
+ const raw = value;
3778
+ const status = raw.status;
3779
+ if (status !== "todo" && status !== "in-progress" && status !== "in_progress" && status !== "completed") {
3780
+ return null;
3781
+ }
3782
+ return {
3783
+ id: typeof raw.id === "string" ? raw.id : "unknown",
3784
+ content: typeof raw.content === "string" ? raw.content : "(no content)",
3785
+ status: status === "in_progress" ? "in-progress" : status
3786
+ };
3787
+ }
3788
+ function normalizeTodoResult(result) {
3789
+ if (!result || typeof result !== "object") {
3790
+ return EMPTY_RESULT;
3791
+ }
3792
+ const raw = result;
3793
+ const incomplete = Array.isArray(raw.incomplete) ? raw.incomplete.map(normalizeTodoItem).filter((item) => !!item) : [];
3794
+ const inProgress = Array.isArray(raw.inProgress) ? raw.inProgress.map(normalizeTodoItem).filter((item) => !!item) : [];
3795
+ return {
3796
+ complete: incomplete.length === 0 && inProgress.length === 0,
3797
+ incomplete,
3798
+ inProgress
3799
+ };
3800
+ }
3768
3801
  function checkTodoCompletion(todos) {
3769
3802
  if (!Array.isArray(todos)) {
3770
- return { complete: true, incomplete: [], inProgress: [] };
3803
+ return EMPTY_RESULT;
3771
3804
  }
3772
- const incomplete = todos.filter((t) => t.status === "todo");
3773
- const inProgress = todos.filter((t) => t.status === "in-progress");
3805
+ const normalized = todos.map(normalizeTodoItem).filter((item) => !!item);
3806
+ const incomplete = normalized.filter((t) => t.status === "todo");
3807
+ const inProgress = normalized.filter((t) => t.status === "in-progress");
3774
3808
  return {
3775
3809
  complete: incomplete.length === 0 && inProgress.length === 0,
3776
3810
  incomplete,
@@ -3778,19 +3812,20 @@ function checkTodoCompletion(todos) {
3778
3812
  };
3779
3813
  }
3780
3814
  function formatIncompleteWarning(result, sessionId) {
3815
+ const safeResult = normalizeTodoResult(result);
3781
3816
  const lines = [];
3782
3817
  if (sessionId) {
3783
3818
  lines.push(`[CliKit] Incomplete todos in session ${sessionId}:`);
3784
3819
  } else {
3785
3820
  lines.push("[CliKit] Incomplete todos detected:");
3786
3821
  }
3787
- if (result.inProgress.length > 0) {
3822
+ if (safeResult.inProgress.length > 0) {
3788
3823
  lines.push(" In Progress:");
3789
- result.inProgress.forEach((t) => lines.push(` - [${t.id}] ${t.content}`));
3824
+ safeResult.inProgress.forEach((t) => lines.push(` - [${t.id}] ${t.content}`));
3790
3825
  }
3791
- if (result.incomplete.length > 0) {
3826
+ if (safeResult.incomplete.length > 0) {
3792
3827
  lines.push(" Not Started:");
3793
- result.incomplete.forEach((t) => lines.push(` - [${t.id}] ${t.content}`));
3828
+ safeResult.incomplete.forEach((t) => lines.push(` - [${t.id}] ${t.content}`));
3794
3829
  }
3795
3830
  lines.push("");
3796
3831
  lines.push(" Complete all todos before finishing.");
@@ -4829,17 +4864,25 @@ function getBuiltinSkills() {
4829
4864
  return skills;
4830
4865
  }
4831
4866
  function findSkill(skills, query) {
4832
- const lowerQuery = query.toLowerCase();
4867
+ if (typeof query !== "string") {
4868
+ return null;
4869
+ }
4870
+ const lowerQuery = query.trim().toLowerCase();
4871
+ if (!lowerQuery) {
4872
+ return null;
4873
+ }
4833
4874
  if (skills[lowerQuery]) {
4834
4875
  return skills[lowerQuery];
4835
4876
  }
4836
4877
  for (const [name, skill] of Object.entries(skills)) {
4837
- if (name.toLowerCase().includes(lowerQuery) || skill.name.toLowerCase().includes(lowerQuery)) {
4878
+ const skillName = (skill.name || "").toLowerCase();
4879
+ if (name.toLowerCase().includes(lowerQuery) || skillName.includes(lowerQuery)) {
4838
4880
  return skill;
4839
4881
  }
4840
4882
  }
4841
4883
  for (const skill of Object.values(skills)) {
4842
- if (skill.description.toLowerCase().includes(lowerQuery)) {
4884
+ const description = (skill.description || "").toLowerCase();
4885
+ if (description.includes(lowerQuery)) {
4843
4886
  return skill;
4844
4887
  }
4845
4888
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAsC9D;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAuBhG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAsC9D;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAgChG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clikit-plugin",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "OpenCode plugin with 10 agents, 19 commands, 48 skills, 14 hooks",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",