left-skills 0.5.0 → 0.6.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 +73 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -58,6 +58,7 @@ 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
60
  left-skills evolve <skill> # generate improvement prompt (for AI, human review)
61
+ left-skills inspire # find repeated commands → suggest new skill
61
62
  left-skills doctor # diagnose install (✓/✗ + fix)
62
63
  left-skills report --markdown > report.md # export report
63
64
  ```
package/dist/cli.js CHANGED
@@ -6991,10 +6991,77 @@ function evolvePrompt(skillName) {
6991
6991
  return lines.join("\n");
6992
6992
  }
6993
6993
 
6994
+ // src/inspire.ts
6995
+ var import_node_fs7 = require("fs");
6996
+ var import_node_path7 = require("path");
6997
+ var import_node_os7 = require("os");
6998
+ function scanSessions(sinceDays = 30) {
6999
+ const projectsDir = (0, import_node_path7.join)((0, import_node_os7.homedir)(), ".claude", "projects");
7000
+ const cmdCount = /* @__PURE__ */ new Map();
7001
+ if (!(0, import_node_fs7.existsSync)(projectsDir)) return cmdCount;
7002
+ const cutoff = Date.now() - sinceDays * 864e5;
7003
+ for (const project of (0, import_node_fs7.readdirSync)(projectsDir, { withFileTypes: true })) {
7004
+ if (!project.isDirectory()) continue;
7005
+ const projectDir = (0, import_node_path7.join)(projectsDir, project.name);
7006
+ for (const file of (0, import_node_fs7.readdirSync)(projectDir)) {
7007
+ if (!file.endsWith(".jsonl")) continue;
7008
+ const filePath = (0, import_node_path7.join)(projectDir, file);
7009
+ try {
7010
+ const content = (0, import_node_fs7.readFileSync)(filePath, "utf-8");
7011
+ for (const line of content.split("\n")) {
7012
+ if (!line.trim()) continue;
7013
+ try {
7014
+ const obj = JSON.parse(line);
7015
+ const ts = obj.timestamp;
7016
+ if (ts && new Date(ts).getTime() < cutoff) continue;
7017
+ const msg = obj.message;
7018
+ if (msg && msg.content && Array.isArray(msg.content)) {
7019
+ for (const block of msg.content) {
7020
+ if (block.type === "tool_use" && block.name === "Bash") {
7021
+ const cmd = block.input?.command;
7022
+ if (cmd && cmd.length >= 30) {
7023
+ cmdCount.set(cmd, (cmdCount.get(cmd) || 0) + 1);
7024
+ }
7025
+ }
7026
+ }
7027
+ }
7028
+ } catch {
7029
+ }
7030
+ }
7031
+ } catch {
7032
+ }
7033
+ }
7034
+ }
7035
+ return cmdCount;
7036
+ }
7037
+ function inspirePrompt(sinceDays = 30) {
7038
+ const cmdCount = scanSessions(sinceDays);
7039
+ const repeated = [...cmdCount.entries()].filter(([, count]) => count >= 3).sort((a, b) => b[1] - a[1]);
7040
+ if (repeated.length === 0) {
7041
+ return "\u65E0\u91CD\u590D\u6A21\u5F0F(\u957F\u547D\u4EE4 \u226530 \u5B57\u7B26,\u91CD\u590D \u22653 \u6B21),\u6682\u4E0D\u5EFA\u8BAE\u5199 skill\u3002\n(\u8BD5\u66F4\u591A\u5929?left-skills inspire --since 90)";
7042
+ }
7043
+ const lines = [];
7044
+ lines.push("# inspire:\u4F60\u53CD\u590D\u8DD1\u7684\u547D\u4EE4(\u5EFA\u8BAE\u5199 skill \u81EA\u52A8\u5316)");
7045
+ lines.push("");
7046
+ lines.push("## \u91CD\u590D\u547D\u4EE4(\u957F\u547D\u4EE4 \u226530 \u5B57\u7B26,\u91CD\u590D \u22653 \u6B21)");
7047
+ for (const [cmd, count] of repeated) {
7048
+ lines.push(`- \`${cmd}\`(${count} \u6B21)`);
7049
+ }
7050
+ lines.push("");
7051
+ lines.push("## \u6539\u8FDB\u6307\u4EE4(\u7ED9 AI)");
7052
+ lines.push("\u8BF7\u57FA\u4E8E\u4EE5\u4E0A\u91CD\u590D\u547D\u4EE4,\u751F\u6210 SKILL.md \u8349\u7A3F:");
7053
+ lines.push("- \u6311 1-2 \u4E2A\u6700\u9891\u7E41\u7684\u547D\u4EE4\u5E8F\u5217,\u8BBE\u8BA1 skill(name / description / body)");
7054
+ lines.push('- description \u8BF4\u660E"\u4F55\u65F6\u7528"(\u8BA9 AI \u81EA\u51B3\u89E6\u53D1)');
7055
+ lines.push("- body \u542B\u8BE5\u547D\u4EE4\u5E8F\u5217(\u81EA\u52A8\u5316)");
7056
+ lines.push("");
7057
+ lines.push("\u751F\u6210\u8349\u7A3F,\u6211\u5BA1\u8FC7\u540E\u4E22\u8FDB .claude/skills/(\u4E0D\u81EA\u52A8\u521B\u5EFA)\u3002");
7058
+ return lines.join("\n");
7059
+ }
7060
+
6994
7061
  // package.json
6995
7062
  var package_default = {
6996
7063
  name: "left-skills",
6997
- version: "0.5.0",
7064
+ version: "0.6.0",
6998
7065
  description: "\u7ED9 AI \u7528\u7684 skill \u751F\u547D\u5468\u671F\u7BA1\u7406\u5DE5\u5177 \u2014 MVP: skill \u8C03\u7528\u4F7F\u7528\u7EDF\u8BA1",
6999
7066
  bin: {
7000
7067
  "left-skills": "./dist/cli.js"
@@ -7038,7 +7105,7 @@ var package_default = {
7038
7105
 
7039
7106
  // src/cli.ts
7040
7107
  var program2 = new Command();
7041
- program2.name("left-skills").description("\u7ED9 AI \u7528\u7684 skill \u751F\u547D\u5468\u671F\u7BA1\u7406\u5DE5\u5177 \u2014 MVP: skill \u8C03\u7528\u4F7F\u7528\u7EDF\u8BA1").version(package_default.version);
7108
+ program2.name("left-skills").description("\u7ED9 AI \u7528\u7684 skill \u751F\u547D\u5468\u671F\u7BA1\u7406\u5DE5\u5177 \u2014 skill \u8C03\u7528\u4F7F\u7528\u7EDF\u8BA1").version(package_default.version);
7042
7109
  program2.command("usage").description("skill \u8C03\u7528\u4F7F\u7528\u62A5\u544A").option("--json", "\u8F93\u51FA JSON(AI \u7528)").option("--since <days>", "\u65F6\u95F4\u7A97\u53E3(\u5929,\u9ED8\u8BA4 30)", "30").action((opts) => {
7043
7110
  const since = parseInt(opts.since, 10) || 30;
7044
7111
  const report = buildReport(since);
@@ -7055,6 +7122,10 @@ program2.command("lint").description("\u9759\u6001\u8D28\u91CF\u68C0\u67E5 SKILL
7055
7122
  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
7123
  console.log(evolvePrompt(skill));
7057
7124
  });
7125
+ program2.command("inspire").description("\u626B\u4F1A\u8BDD\u627E\u91CD\u590D\u547D\u4EE4,\u63D0\u8BAE\u5199 skill(\u7ED9 AI,\u4EBA\u5BA1,\u4E0D\u81EA\u52A8\u521B\u5EFA)").option("--since <days>", "\u65F6\u95F4\u7A97\u53E3(\u5929,\u9ED8\u8BA4 30)", "30").action((opts) => {
7126
+ const since = parseInt(opts.since, 10) || 30;
7127
+ console.log(inspirePrompt(since));
7128
+ });
7058
7129
  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) => {
7059
7130
  const since = parseInt(opts.since, 10) || 30;
7060
7131
  const report = buildReport(since);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "left-skills",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "给 AI 用的 skill 生命周期管理工具 — MVP: skill 调用使用统计",
5
5
  "bin": {
6
6
  "left-skills": "./dist/cli.js"