skillwiki 0.2.4 → 0.2.5

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
@@ -2239,7 +2239,7 @@ function extractSourceEntries(rawFm) {
2239
2239
  }
2240
2240
  var ERROR_ORDER = ["broken_wikilinks", "invalid_frontmatter", "raw_dedup", "broken_sources", "tag_not_in_taxonomy"];
2241
2241
  var WARNING_ORDER = ["index_incomplete", "index_link_format", "stale_page", "page_too_large", "log_rotate_needed", "orphans", "compound_refs", "legacy_citation_style", "orphaned_citations", "duplicate_frontmatter", "work_item_health", "orphaned_project_pages", "missing_overview"];
2242
- var INFO_ORDER = ["bridges", "page_structure", "topic_map_recommended", "frontmatter_wikilink", "wikilink_citation"];
2242
+ var INFO_ORDER = ["bridges", "page_structure", "topic_map_recommended", "frontmatter_wikilink", "wikilink_citation", "missing_tldr", "missing_diagram"];
2243
2243
  async function runLint(input) {
2244
2244
  const buckets = {};
2245
2245
  const fixed = [];
@@ -2302,6 +2302,8 @@ async function runLint(input) {
2302
2302
  const fmWikilinkFlags = [];
2303
2303
  const wikilinkCitationFlags = [];
2304
2304
  const brokenSourceFlags = [];
2305
+ const missingTldrFlags = [];
2306
+ const missingDiagramFlags = [];
2305
2307
  for (const page of scan.data.typedKnowledge) {
2306
2308
  const text = await readPage(page);
2307
2309
  const split = splitFrontmatter(text);
@@ -2332,6 +2334,13 @@ async function runLint(input) {
2332
2334
  const bodyLines = body.split("\n").filter((l) => l.trim().length > 0).length;
2333
2335
  const hasOverview = /^## Overview/m.test(body);
2334
2336
  if (!hasOverview) noOverview.push(page.relPath);
2337
+ const bodyFirst15 = body.split("\n").slice(0, 15).join("\n");
2338
+ if (!/^##\s+TL;\s*DR/m.test(bodyFirst15)) missingTldrFlags.push(page.relPath);
2339
+ const fmData = extractFrontmatter(text);
2340
+ const pageTags = fmData.ok && Array.isArray(fmData.data.tags) ? fmData.data.tags : [];
2341
+ if (pageTags.includes("architecture") && !body.includes("```mermaid")) {
2342
+ missingDiagramFlags.push(page.relPath);
2343
+ }
2335
2344
  if (bodyLines < STRUCT_MIN_BODY_LINES) {
2336
2345
  const hasRelated = /^## (Related|Relationships)/m.test(body);
2337
2346
  const sectionCount = (body.match(/^## /gm) ?? []).length;
@@ -2351,6 +2360,8 @@ async function runLint(input) {
2351
2360
  if (fmWikilinkFlags.length > 0) buckets.frontmatter_wikilink = fmWikilinkFlags;
2352
2361
  if (wikilinkCitationFlags.length > 0) buckets.wikilink_citation = wikilinkCitationFlags;
2353
2362
  if (brokenSourceFlags.length > 0) buckets.broken_sources = brokenSourceFlags;
2363
+ if (missingTldrFlags.length > 0) buckets.missing_tldr = missingTldrFlags;
2364
+ if (missingDiagramFlags.length > 0) buckets.missing_diagram = missingDiagramFlags;
2354
2365
  const workItemHealth = [];
2355
2366
  const workItemDirs = /* @__PURE__ */ new Map();
2356
2367
  for (const page of scan.data.workItems) {
@@ -2540,6 +2551,39 @@ ${trimmedBody}`;
2540
2551
  if (remaining.length > 0) buckets.missing_overview = remaining;
2541
2552
  else delete buckets.missing_overview;
2542
2553
  }
2554
+ if (input.fix && missingTldrFlags.length > 0) {
2555
+ for (const relPath of missingTldrFlags) {
2556
+ try {
2557
+ const absPath = `${input.vault}/${relPath}`;
2558
+ const raw = await readFile13(absPath, "utf8");
2559
+ const split = splitFrontmatter(raw);
2560
+ if (!split.ok) {
2561
+ unresolved.push(relPath);
2562
+ continue;
2563
+ }
2564
+ const body = split.data.body;
2565
+ const rawFm = split.data.rawFrontmatter;
2566
+ const trimmedBody = body.replace(/^\n+/, "");
2567
+ const newContent = `---
2568
+ ${rawFm}
2569
+ ---
2570
+
2571
+ ## TL;DR
2572
+
2573
+ - Pending summary.
2574
+
2575
+ ${trimmedBody}`;
2576
+ await writeFile7(absPath, newContent, "utf8");
2577
+ fixed.push(relPath);
2578
+ } catch {
2579
+ unresolved.push(relPath);
2580
+ }
2581
+ }
2582
+ const fixedSet = new Set(fixed);
2583
+ const remaining = missingTldrFlags.filter((p) => !fixedSet.has(p));
2584
+ if (remaining.length > 0) buckets.missing_tldr = remaining;
2585
+ else delete buckets.missing_tldr;
2586
+ }
2543
2587
  if (input.fix && wikilinkCitationFlags.length > 0) {
2544
2588
  const WIKILINK_RE = /\[\[raw\/([^\]|]+)(?:\|[^\]]*)?\]\]/g;
2545
2589
  const FENCE_RE2 = /```[\s\S]*?```/g;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
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.2.4",
3
+ "version": "0.2.5",
4
4
  "skills": "./",
5
5
  "description": "Project-aware Karpathy-style knowledge base for Claude Code: 18 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/skills",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "private": true,
5
5
  "files": [
6
6
  "wiki-*",
@@ -22,7 +22,9 @@ Standard four reads. If cwd is inside `projects/{slug}/`, also read project READ
22
22
  0. **Resolve vault and language.** Run `skillwiki path` (fail if NO_VAULT_CONFIGURED) and `skillwiki lang`.
23
23
  1. Identify type: entity / concept / comparison / query / summary.
24
24
  2. Set `provenance:`. Default `research`. If in project context: `project` with `provenance_projects: ["[[slug]]"]`.
25
- 3. Compose the page with citations pre-attached. Reuse existing `raw/` sources where possible.
25
+ 3. Compose the page with citations pre-attached. Reuse existing `raw/` sources where possible. Every page MUST include:
26
+ - `## TL;DR` as the first section after frontmatter — a 1–3 bullet summary of the page's key takeaway.
27
+ - For pages tagged `architecture` or explaining workflows/systems: include a Mermaid diagram (`graph TB` or `sequenceDiagram`) in the body. Follow Obsidian-compatible Mermaid rules (see SCHEMA.md `## Mermaid Diagrams`).
26
28
  4. `skillwiki validate <page>`. If non-zero, STOP.
27
29
  5. Apply writes: page → `index.md` → `log.md`.
28
30
 
@@ -27,7 +27,9 @@ Run `skillwiki lang` at the start. Generate page-body prose, narrative sections,
27
27
  1. **Guard.** For each URL: run `skillwiki fetch-guard <url>`. If exit ≠ 0, STOP and surface the error. Do not retry.
28
28
  2. **Fetch.** Use `web_fetch` (or read local file) under Layer 2 controls (the CLI Layer 2 fetcher applies in tests; in skill runtime use `web_fetch` directly and treat any error as STOP).
29
29
  3. **Hash.** Write the raw file (frontmatter + body). Run `skillwiki hash <raw-file>` and embed the result in raw frontmatter `sha256:`.
30
- 4. **Generate page(s).** Compose typed-knowledge page(s) with citations pre-attached (`^[raw/...]` markers).
30
+ 4. **Generate page(s).** Compose typed-knowledge page(s) with citations pre-attached (`^[raw/...]` markers). Every page MUST include:
31
+ - `## TL;DR` as the first section after frontmatter — a 1–3 bullet summary of the page's key takeaway.
32
+ - For pages tagged `architecture` or explaining workflows/systems: include a Mermaid diagram (`graph TB` or `sequenceDiagram`) in the body. Follow Obsidian-compatible Mermaid rules (see SCHEMA.md `## Mermaid Diagrams`).
31
33
  5. **Validate.** For each generated page: run `skillwiki validate <page>`. If exit ≠ 0, STOP — do not write index/log.
32
34
  6. **Apply writes in order.** raw → page(s) → `index.md` → `log.md`.
33
35
  7. **Confidence flag.** If only one source is cited, set `confidence: low`.
@@ -52,6 +52,17 @@ Rule: every tag on every page MUST appear in this taxonomy. Add new tags here fi
52
52
  - Citations in body: `^[raw/...]` markers at paragraph-end; every entry in `sources:` MUST appear in body and in `## Sources` footer.
53
53
  - Legacy inline `^[raw/...]` markers remain valid; `migrate-citations` converts them.
54
54
  - sha256 in `raw/` frontmatter is computed by `skillwiki hash` over body bytes after closing `---`.
55
+ - Every typed-knowledge page SHOULD include a `## TL;DR` section near the top (after frontmatter, before `## Overview`). Lint flags pages missing it as `missing_tldr` (info).
56
+
57
+ ## Mermaid Diagrams
58
+
59
+ Pages explaining architectures, workflows, or complex concepts SHOULD include inline Mermaid diagrams. Lint flags architecture-tagged pages without a ` ```mermaid ` block as `missing_diagram` (info).
60
+
61
+ Obsidian-compatible Mermaid rules:
62
+ - Prefer `graph TB` / `sequenceDiagram`.
63
+ - Use `subgraph "Title"` (avoid `subgraph ID[Label]`).
64
+ - Avoid `\n` in labels; use `<br/>` or single-line labels.
65
+ - Keep node IDs ASCII and simple (`CMUX_DB`, `OC_GW`).
55
66
 
56
67
  ## Obsidian Integration
57
68