skillwiki 0.10.36 → 0.10.37

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.
package/dist/cli.js CHANGED
@@ -181,11 +181,19 @@ import { Command } from "commander";
181
181
  function printJson(r) {
182
182
  process.stdout.write(JSON.stringify(r) + "\n");
183
183
  }
184
- function printHuman(r) {
184
+ function printHuman(r, opts = {}) {
185
185
  if (r.ok) {
186
186
  if (typeof r.data === "object" && r.data !== null && "humanHint" in r.data) {
187
- process.stdout.write(`${r.data.humanHint}
187
+ const humanHint = r.data.humanHint;
188
+ if (!opts.detailHints?.length) {
189
+ process.stdout.write(`${humanHint}
188
190
  `);
191
+ } else {
192
+ const existingLines = new Set(humanHint.split("\n"));
193
+ const detailLines2 = opts.detailHints.filter((line) => !existingLines.has(line));
194
+ process.stdout.write(`${[humanHint, ...detailLines2].join("\n")}
195
+ `);
196
+ }
189
197
  } else {
190
198
  process.stdout.write(`OK
191
199
  ${formatData(r.data)}
@@ -202,6 +210,45 @@ function formatData(d) {
202
210
  return JSON.stringify(d, null, 2);
203
211
  }
204
212
 
213
+ // src/utils/lint-detail-hints.ts
214
+ function lintDetailHints(data) {
215
+ const record = asRecord(data);
216
+ if (!record) return [];
217
+ const bySeverity = asRecord(record.by_severity);
218
+ if (bySeverity && Array.isArray(bySeverity.error)) {
219
+ return detailLines(bySeverity.error, false);
220
+ }
221
+ return Array.isArray(record.buckets) ? detailLines(record.buckets, true) : [];
222
+ }
223
+ function healthLintDetailHints(data) {
224
+ const record = asRecord(data);
225
+ const components = asRecord(record?.components);
226
+ const lint = asRecord(components?.lint);
227
+ return Array.isArray(lint?.buckets) ? detailLines(lint.buckets, true) : [];
228
+ }
229
+ function detailLines(buckets, requireErrorSeverity) {
230
+ const seen = /* @__PURE__ */ new Set();
231
+ const lines = [];
232
+ for (const bucket of buckets) {
233
+ const record = asRecord(bucket);
234
+ if (!record || requireErrorSeverity && record.severity !== "error") continue;
235
+ const name = nonEmptyBucketName(record);
236
+ if (!name || seen.has(name)) continue;
237
+ seen.add(name);
238
+ lines.push(`detail: skillwiki lint --only ${name} --examples 3`);
239
+ }
240
+ return lines;
241
+ }
242
+ function nonEmptyBucketName(bucket) {
243
+ if (typeof bucket.kind !== "string" || !/^[a-z0-9_]+$/.test(bucket.kind)) return null;
244
+ if (typeof bucket.count === "number") return bucket.count > 0 ? bucket.kind : null;
245
+ if (Array.isArray(bucket.items)) return bucket.items.length > 0 ? bucket.kind : null;
246
+ return null;
247
+ }
248
+ function asRecord(value) {
249
+ return typeof value === "object" && value !== null ? value : null;
250
+ }
251
+
205
252
  // src/utils/deprecation.ts
206
253
  import { readFileSync } from "fs";
207
254
  import { join } from "path";
@@ -9354,9 +9401,16 @@ var program = new Command();
9354
9401
  program.name("skillwiki").description("Deterministic helpers for CodeWiki skills").version(pkg.version);
9355
9402
  program.option("--human", "render terminal-readable output instead of JSON");
9356
9403
  async function emit(r, vault, opts) {
9357
- if (program.opts().human) printHuman(r.result);
9358
- else printJson(r.result);
9404
+ if (program.opts().human) {
9405
+ const detailHints = r.result.ok ? opts?.humanDetailHints?.(r.result.data) : void 0;
9406
+ printHuman(r.result, { detailHints });
9407
+ } else {
9408
+ printJson(r.result);
9409
+ }
9359
9410
  if (vault && opts?.postCommit !== false) await postCommit(vault, r.exitCode);
9411
+ await new Promise((resolve6, reject) => {
9412
+ process.stdout.write("", (error) => error ? reject(error) : resolve6());
9413
+ });
9360
9414
  process.exit(r.exitCode);
9361
9415
  }
9362
9416
  function dirtyVolumeBlock(vault, command) {
@@ -9835,6 +9889,7 @@ projectionsCmd.command("repair-legacy [vault]").description("repair one supporte
9835
9889
  });
9836
9890
  program.command("lint [vault]").description("run all vault health checks").option("--days <n>", "stale threshold", (s) => parseInt(s, 10), 90).option("--lines <n>", "pagesize threshold", (s) => parseInt(s, 10), 200).option("--log-threshold <n>", "log rotation threshold", (s) => parseInt(s, 10), 500).option("--fix", "auto-fix supported lint violations").option("--only <bucket>", "run only the specified lint bucket").option("--summary", "emit bounded bucket counts instead of full item arrays", false).option("--examples <n>", "example count per bucket in summary mode", (s) => parseInt(s, 10), 3).option("--wiki <name>", "wiki profile name").action(async (vault, opts) => {
9837
9891
  const v = await resolveVaultArg(vault, opts.wiki);
9892
+ const humanDetailHints = opts.only ? void 0 : lintDetailHints;
9838
9893
  if (!v.ok) emit({ exitCode: v.exitCode, result: v.payload });
9839
9894
  else if (opts.fix && opts.summary) return emitGuardedVaultWrite(
9840
9895
  v.vault,
@@ -9849,7 +9904,8 @@ program.command("lint [vault]").description("run all vault health checks").optio
9849
9904
  only: opts.only,
9850
9905
  summary: true,
9851
9906
  examplesLimit: opts.examples
9852
- })
9907
+ }),
9908
+ { humanDetailHints }
9853
9909
  );
9854
9910
  else if (opts.fix) return emitGuardedVaultWrite(
9855
9911
  v.vault,
@@ -9863,7 +9919,8 @@ program.command("lint [vault]").description("run all vault health checks").optio
9863
9919
  fix: true,
9864
9920
  only: opts.only,
9865
9921
  summary: false
9866
- })
9922
+ }),
9923
+ { humanDetailHints }
9867
9924
  );
9868
9925
  else if (opts.summary) emit(await runLint({
9869
9926
  vault: v.vault,
@@ -9875,7 +9932,7 @@ program.command("lint [vault]").description("run all vault health checks").optio
9875
9932
  only: opts.only,
9876
9933
  summary: true,
9877
9934
  examplesLimit: opts.examples
9878
- }), v.vault);
9935
+ }), v.vault, { humanDetailHints });
9879
9936
  else emit(await runLint({
9880
9937
  vault: v.vault,
9881
9938
  source: vault ? "flag" : void 0,
@@ -9884,7 +9941,7 @@ program.command("lint [vault]").description("run all vault health checks").optio
9884
9941
  logThreshold: opts.logThreshold,
9885
9942
  fix: false,
9886
9943
  only: opts.only
9887
- }), v.vault);
9944
+ }), v.vault, { humanDetailHints });
9888
9945
  });
9889
9946
  program.command("health [vault]").description("bounded whole-system wiki health report").option("--wiki <name>", "wiki profile name").option("--sync <mode>", "vault-sync policy: optional|required|off", "optional").option("--no-fail", "always exit 0 while reporting status in JSON").option("--out <path>", "write JSON result envelope to this path").option("--examples <n>", "example count per lint bucket", (s) => parseInt(s, 10), 3).action(async (vault, opts) => {
9890
9947
  const sync = String(opts.sync ?? "optional");
@@ -9905,7 +9962,7 @@ program.command("health [vault]").description("bounded whole-system wiki health
9905
9962
  noFail: opts.fail === false,
9906
9963
  out: opts.out,
9907
9964
  examplesLimit: opts.examples
9908
- }), void 0, { postCommit: false });
9965
+ }), void 0, { postCommit: false, humanDetailHints: healthLintDetailHints });
9909
9966
  });
9910
9967
  var configCmd = program.command("config").description("manage skillwiki configuration");
9911
9968
  configCmd.command("get <key>").description("print the value of a config key").action(async (key) => emit(await runConfigGet({ key, home: process.env.HOME ?? "" })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.10.36",
3
+ "version": "0.10.37",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "skillwiki": "dist/cli.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.10.36",
3
+ "version": "0.10.37",
4
4
  "skills": "./",
5
5
  "description": "Project-aware Karpathy-style knowledge base for Claude Code: 19 prompt-only skills (wiki-*, proj-*, using-skillwiki) backed by the deterministic `skillwiki` CLI.",
6
6
  "author": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.10.36",
3
+ "version": "0.10.37",
4
4
  "description": "Project-aware Karpathy-style knowledge base for Codex with 19 prompt-only skills backed by the deterministic skillwiki CLI.",
5
5
  "author": {
6
6
  "name": "karlorz",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillwiki/skills",
3
- "version": "0.10.36",
3
+ "version": "0.10.37",
4
4
  "private": true,
5
5
  "files": [
6
6
  "wiki-*",