left-skills 0.4.0 → 0.5.0

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.
Files changed (3) hide show
  1. package/README.md +1 -0
  2. package/dist/cli.js +77 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -57,6 +57,7 @@ left-skills usage # human-readable report
57
57
  left-skills usage --json # for AI (JSON)
58
58
  left-skills usage --since 7 # last 7 days
59
59
  left-skills lint # static quality check (0-100 score)
60
+ left-skills evolve <skill> # generate improvement prompt (for AI, human review)
60
61
  left-skills doctor # diagnose install (✓/✗ + fix)
61
62
  left-skills report --markdown > report.md # export report
62
63
  ```
package/dist/cli.js CHANGED
@@ -6918,10 +6918,83 @@ function formatLintHuman(results) {
6918
6918
  return lines.join("\n");
6919
6919
  }
6920
6920
 
6921
+ // src/evolve.ts
6922
+ var import_node_fs6 = require("fs");
6923
+ var import_node_path6 = require("path");
6924
+ var import_node_os6 = require("os");
6925
+ function findSkillDir(skillName) {
6926
+ const dirs = [
6927
+ (0, import_node_path6.join)(process.cwd(), ".claude/skills"),
6928
+ (0, import_node_path6.join)(process.cwd(), ".codex/skills"),
6929
+ (0, import_node_path6.join)((0, import_node_os6.homedir)(), ".claude/skills"),
6930
+ (0, import_node_path6.join)((0, import_node_os6.homedir)(), ".codex/skills")
6931
+ ];
6932
+ for (const d of dirs) {
6933
+ if (!(0, import_node_fs6.existsSync)(d)) continue;
6934
+ const skillDir = (0, import_node_path6.join)(d, skillName);
6935
+ if ((0, import_node_fs6.existsSync)(skillDir)) return skillDir;
6936
+ }
6937
+ return null;
6938
+ }
6939
+ function evolvePrompt(skillName) {
6940
+ const lines = [];
6941
+ lines.push(`# \u6539\u8FDB skill: ${skillName}`);
6942
+ lines.push("");
6943
+ const stats = aggregate(30);
6944
+ const stat = stats.find((s) => s.name === skillName);
6945
+ const total = stat ? stat.manual + stat.ai + stat.mention : 0;
6946
+ lines.push(`## usage \u4FE1\u53F7`);
6947
+ if (!stat || total === 0) {
6948
+ lines.push(`- \u26A0 \u8FD1 30 \u5929\u4ECE\u672A\u8C03\u7528(\u5199\u4E86\u6CA1\u7528?description \u6CA1\u8BF4\u6E05 trigger \u2192 AI \u4E0D\u89E6\u53D1)`);
6949
+ } else {
6950
+ lines.push(`- \u8C03\u7528 ${total} \u6B21(\u624B\u52A8 ${stat.manual} + AI ${stat.ai} + \u63D0\u53CA ${stat.mention})`);
6951
+ if (stat.ai === 0) lines.push(`- \u26A0 AI \u4ECE\u4E0D\u4E3B\u52A8\u8C03\u7528(\u53EA\u624B\u52A8,description \u53EF\u80FD\u6CA1\u8BA9 AI \u89E6\u53D1)`);
6952
+ }
6953
+ const skillDir = findSkillDir(skillName);
6954
+ lines.push("");
6955
+ lines.push(`## lint \u4FE1\u53F7`);
6956
+ let lint = null;
6957
+ if (!skillDir) {
6958
+ lines.push(`- \u26A0 skill \u76EE\u5F55\u627E\u4E0D\u5230(${skillName} \u672A\u88C5?)`);
6959
+ } else {
6960
+ lint = lintSkill(skillDir);
6961
+ if (lint.issues.length === 0) {
6962
+ lines.push(`- \u2713 \u9759\u6001\u8D28\u91CF\u5408\u89C4(0 issue)`);
6963
+ } else {
6964
+ for (const issue of lint.issues) {
6965
+ lines.push(`- ${issue.severity} ${issue.rule}: ${issue.message}`);
6966
+ }
6967
+ }
6968
+ }
6969
+ lines.push("");
6970
+ lines.push(`## \u6539\u8FDB\u6307\u4EE4(\u7ED9 AI)`);
6971
+ lines.push(`\u8BF7\u57FA\u4E8E\u4EE5\u4E0A\u4FE1\u53F7,\u6539\u8FDB skill \`${skillName}\` \u7684 SKILL.md:`);
6972
+ if (!stat || total === 0) {
6973
+ lines.push(`- description \u6CA1\u8BA9 AI \u89E6\u53D1 \u2192 \u6539 description,\u52A0 "Use when..." \u89E6\u53D1\u573A\u666F(\u8BF4\u660E\u80FD\u529B + \u4F55\u65F6\u7528)`);
6974
+ }
6975
+ if (stat && stat.ai === 0) {
6976
+ lines.push(`- AI \u4E0D\u4E3B\u52A8\u8C03\u7528 \u2192 description \u8865 trigger \u5173\u952E\u8BCD(\u8BA9 AI \u81EA\u51B3\u89E6\u53D1)`);
6977
+ }
6978
+ if (lint) {
6979
+ for (const issue of lint.issues) {
6980
+ if (issue.severity === "ERROR") {
6981
+ if (issue.rule === "name-kebab") lines.push(`- name \u4E0D\u5408\u89C4 \u2192 \u6539 name \u4E3A kebab-case(\u5C0F\u5199+\u8FDE\u5B57\u7B26)`);
6982
+ if (issue.rule === "name-dir-match") lines.push(`- name\u2260\u76EE\u5F55 \u2192 \u6539 name \u6216\u76EE\u5F55\u540D(\u4E00\u81F4)`);
6983
+ if (issue.rule === "description-present") lines.push(`- description \u7F3A \u2192 \u52A0 description(\u8BF4\u660E\u80FD\u529B+\u89E6\u53D1)`);
6984
+ }
6985
+ if (issue.severity === "WARN" && issue.rule === "description-len") lines.push(`- description \u957F\u5EA6 \u2192 \u8C03\u5230 20-300 \u5B57\u7B26`);
6986
+ if (issue.severity === "WARN" && issue.rule === "token-budget") lines.push(`- body \u592A\u957F \u2192 \u62C6 references/`);
6987
+ }
6988
+ }
6989
+ lines.push("");
6990
+ lines.push(`\u751F\u6210\u6539\u8FDB diff,\u6211\u5BA1\u8FC7\u540E\u5E94\u7528(\u4E0D\u81EA\u52A8\u6539)\u3002`);
6991
+ return lines.join("\n");
6992
+ }
6993
+
6921
6994
  // package.json
6922
6995
  var package_default = {
6923
6996
  name: "left-skills",
6924
- version: "0.4.0",
6997
+ version: "0.5.0",
6925
6998
  description: "\u7ED9 AI \u7528\u7684 skill \u751F\u547D\u5468\u671F\u7BA1\u7406\u5DE5\u5177 \u2014 MVP: skill \u8C03\u7528\u4F7F\u7528\u7EDF\u8BA1",
6926
6999
  bin: {
6927
7000
  "left-skills": "./dist/cli.js"
@@ -6979,6 +7052,9 @@ program2.command("lint").description("\u9759\u6001\u8D28\u91CF\u68C0\u67E5 SKILL
6979
7052
  const results = lintAll();
6980
7053
  console.log(formatLintHuman(results));
6981
7054
  });
7055
+ program2.command("evolve <skill>").description("\u6536\u96C6 usage+lint \u4FE1\u53F7,\u8F93\u51FA\u6539\u8FDB prompt(\u7ED9 AI,\u4EBA\u5BA1,\u4E0D\u81EA\u52A8\u6539)").action((skill) => {
7056
+ console.log(evolvePrompt(skill));
7057
+ });
6982
7058
  program2.command("report").description("\u5BFC\u51FA usage \u62A5\u544A markdown(\u53EF > report.md \u5206\u4EAB)").option("--markdown", "\u8F93\u51FA markdown(\u9ED8\u8BA4\u5373 markdown)").option("--since <days>", "\u65F6\u95F4\u7A97\u53E3(\u5929,\u9ED8\u8BA4 30)", "30").action((opts) => {
6983
7059
  const since = parseInt(opts.since, 10) || 30;
6984
7060
  const report = buildReport(since);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "left-skills",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "给 AI 用的 skill 生命周期管理工具 — MVP: skill 调用使用统计",
5
5
  "bin": {
6
6
  "left-skills": "./dist/cli.js"