repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

Iteration 18: Improved pandoc-doctor.lua accuracy for PDF diagnostics. Doctor no longer misleadingly reports pdf as normal reader/writer; it now labels PDF as writer via engine and runs real smoke tests for available PDF engines. This catches cases where engine binaries exist but PDF generation fails (verified: typst/wkhtmltopdf version OK but smoke FAIL in current env). Updated SKILL.md helper script note. 9/9 filters pass.

1fa481e976d1100055645942c5b1aa7edf2b87e2

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Result: {"status":"keep","skill_quality":37}

Changed files (7)

.pi/autoresearch/session.jsonl

Modified
5 5 {"run":14,"commit":"f3839c9","metric":33,"metrics":{},"status":"keep","description":"Iteration 14: Fixed admonitions.lua quality/portability bug. Previous HTML path stringified content and lost formatting; LaTeX path crashed by returning nested block list and required undeclared tcolorbox. New filter preserves inner Markdown via pandoc.write for HTML and uses portable [NOTE]/[WARNING] labels for non-HTML. Verified HTML preserves bold/link/list, LaTeX/Markdown do not crash, and 9/9 filters pass.","timestamp":1780158116622,"segment":0,"confidence":null,"asi":{"hypothesis":"Fix broken/low-quality existing filter instead of adding content; admonitions are common and must preserve formatting across outputs","bugs_fixed":"HTML lost formatting; LaTeX crashed; tcolorbox dependency removed","validation":"HTML bold/list preserved, LaTeX and Markdown output stable, 9/9 filters pass","format_support":"styled HTML, portable fallback for other writers"}}
6 6 {"run":15,"commit":"44eb971","metric":34,"metrics":{},"status":"keep","description":"Iteration 15: Improved autolink.lua URL boundary handling. Previous filter included trailing prose punctuation in hrefs (e.g. https://example.com. linked with the period). Added trailing punctuation splitting for . , ; : ! ? ) ]. Verified period/comma/paren/question punctuation stay outside links, multiple URLs still work, 9/9 filters pass.","timestamp":1780158167127,"segment":0,"confidence":null,"asi":{"hypothesis":"Fix subtle but common URL autolinking bug; generated hrefs must not include sentence punctuation","bug_fixed":"trailing punctuation included in link target","validation":"period/comma/paren/question stripped; multiple URLs OK; 9/9 filters pass","changed_file":"references/filters/autolink.lua"}}
7 7 {"run":16,"commit":"bf8645a","metric":35,"metrics":{},"status":"keep","description":"Iteration 16: Fixed extract-headings.lua to emit a real nested BulletList AST instead of escaped literal Markdown paragraphs. The filter now preserves heading hierarchy, creates actual internal links, handles skipped heading levels, and returns empty output for documents without headings. Verified Markdown list output, HTML nested ul/li output, link hrefs, and 9/9 filters pass.","timestamp":1780158253729,"segment":0,"confidence":null,"asi":{"hypothesis":"Fix existing filter correctness: escaped Markdown output is misleading; agents need real outline links/lists","bug_fixed":"extract-headings produced literal escaped '- [Heading](#id)' paragraphs instead of list/link AST","validation":"nested markdown list, HTML ul/li, internal hrefs, skipped levels, no-heading input, 9/9 filters","changed_file":"references/filters/extract-headings.lua"}}
8 +{"run":17,"commit":"1d7d3c1","metric":36,"metrics":{},"status":"keep","description":"Iteration 17: Fixed center-images.lua LaTeX corruption bug. The prior Image/Plain approach double-wrapped images inside Figure, producing malformed minipage/center LaTeX. Rewrote filter to return explicit filter tables, use topdown traversal, skip Figure children for LaTeX/Beamer, center only image-only paragraphs, and leave inline images unchanged. Verified clean LaTeX figures, centered no-alt image paragraphs, unchanged inline images, HTML styling, and 9/9 filters pass.","timestamp":1780158416994,"segment":0,"confidence":null,"asi":{"hypothesis":"Continue fixing existing filters for real correctness; center-images had subtle LaTeX corruption for captioned figures","bug_fixed":"LaTeX Figure children were being centered, corrupting figure output","validation":"captioned figure clean, image-only paragraph centered, inline image unchanged, HTML style present, 9/9 filters","changed_file":"references/filters/center-images.lua"}}

README.md

Modified
61 61 | Extension slug | Short explanation | README |
62 62 | ------------------- | ------------------------------------------------------------------------ | ------------------------------------------------ |
63 63 | `angel` | Structured advisor and command guardrail for configured Pi model pairs. | [README](extensions/angel/README.md) |
64 +| `autoresearch` | Benchmark-guided experiment loop with a live browser dashboard. | [README](extensions/autoresearch/README.md) |
64 65 | `builtin-tools` | Toggle Pi builtin file-search tools. | [README](extensions/builtin-tools/README.md) |
65 66 | `context-size` | Context-window usage telemetry for Pi. | [README](extensions/context-size/README.md) |
66 67 | `cost` | Pi token and spend telemetry. | [README](extensions/cost/README.md) |

package.json

Modified
2 2 "scripts": {
3 - "typecheck": "bash scripts/typecheck.sh"
3 + "typecheck": "tsc --noEmit"
5 5 "name": "pi-ext",
6 6 "version": "0.0.3",

scripts/typecheck.sh

Deleted
deleted file mode 100755
1 -#!/usr/bin/env bash
2 -set -eo pipefail
3 -tsc --noEmit

skills/pandoc/SKILL.md

Modified
1120 1120 # Word count
1121 1121 pandoc --lua-filter=scripts/pandoc-wordcount.lua doc.md
1123 -# Environment diagnostics
1123 +# Environment diagnostics (versions, formats, PDF engine smoke tests)
1124 1124 pandoc lua scripts/pandoc-doctor.lua

skills/pandoc/ideas.md

Modified
11 11 - Extract headings filter emits real nested BulletList links, not escaped Markdown text
12 12 - Center images filter skips LaTeX Figure children to avoid corrupting generated figure output
13 13 - pdf-report.yaml and html-report.yaml defaults
14 -- Cross-platform Lua scripts (batch-convert, md-to-pdf, docx-to-md, web-to-md, wordcount, doctor)
14 +- Cross-platform Lua scripts (batch-convert, md-to-pdf, docx-to-md, web-to-md, wordcount, doctor with real PDF smoke tests)
15 15 - pandoc.system.list_directory for portable dir listing
16 16 - Multi-file documents & Jupyter notebook section
17 17 - Decision Guide with 18 agent task entries

skills/pandoc/scripts/pandoc-doctor.lua

Modified
1 1 -- pandoc-doctor.lua — Cross-platform pandoc environment diagnostics
2 2 -- Usage: pandoc lua scripts/pandoc-doctor.lua
3 --- Checks pandoc version, Lua API, supported formats, and common PDF engines.
3 +-- Checks pandoc version, Lua API, supported formats, and PDF engine smoke tests.
5 -local function ok_pipe(cmd, args)
6 - local ok, out = pcall(pandoc.pipe, cmd, args or {"--version"}, "")
5 +local system = require 'pandoc.system'
6 +local path = require 'pandoc.path'
8 +local function ok_pipe(cmd, args, input)
9 + local ok, out = pcall(pandoc.pipe, cmd, args or {"--version"}, input or "")
7 10 if ok then
8 11 local first = tostring(out):match("([^\r\n]+)") or "ok"
9 12 return true, first
21 24 return t[k] ~= nil
27 +local function pdf_smoke(engine)
28 + local ok = false
29 + local msg = "not run"
30 + system.with_temporary_directory('pandoc-doctor', function(tmpdir)
31 + local out = path.join({tmpdir, 'smoke.pdf'})
32 + ok, msg = ok_pipe(
33 + 'pandoc',
34 + {'-f', 'markdown', '--pdf-engine=' .. engine, '-o', out},
35 + '---\ntitle: Smoke\n---\n\n# Smoke\n\nHello.\n'
36 + )
37 + end)
38 + return ok, msg
39 +end
24 41 print("Pandoc Doctor")
25 42 print("=============")
26 43 print("Pandoc version: " .. tostring(PANDOC_VERSION))
31 48 print("Lua available: yes")
33 50 print("\nImportant formats:")
34 -for _, fmt in ipairs({"markdown", "gfm", "html", "docx", "pdf", "epub", "ipynb", "typst", "revealjs", "beamer"}) do
51 +for _, fmt in ipairs({"markdown", "gfm", "html", "docx", "epub", "ipynb", "typst", "revealjs", "beamer"}) do
35 52 local r = has_key(pandoc.readers, fmt) and "R" or "-"
36 53 local w = has_key(pandoc.writers, fmt) and "W" or "-"
37 54 print(string.format(" %-9s %s%s", fmt, r, w))
56 +print(" pdf -W via PDF engine (see smoke tests below)")
40 58 print("\nPDF engines:")
41 -local any_pdf_engine = false
42 -for _, engine in ipairs({"pdflatex", "xelatex", "lualatex", "typst", "weasyprint", "wkhtmltopdf"}) do
59 +local engines = {"pdflatex", "xelatex", "lualatex", "typst", "weasyprint", "wkhtmltopdf"}
60 +local available = {}
61 +for _, engine in ipairs(engines) do
43 62 local ok, msg = ok_pipe(engine, {"--version"})
44 - if ok then any_pdf_engine = true end
63 + if ok then available[#available + 1] = engine end
45 64 print(string.format(" %-12s %s %s", engine, ok and "OK " or "MISS", msg))
47 -if not any_pdf_engine then
66 +if #available == 0 then
48 67 print(" NOTE: no common PDF engine found. Install TeX/Typst or use HTML/docx output.")
70 +print("\nPDF smoke tests:")
71 +local pdf_ok = false
72 +if #available == 0 then
73 + print(" SKIP: no PDF engines available")
74 +else
75 + for _, engine in ipairs(available) do
76 + local ok, msg = pdf_smoke(engine)
77 + if ok then pdf_ok = true end
78 + print(string.format(" %-12s %s %s", engine, ok and "OK " or "FAIL", msg))
79 + end
80 +end
81 +if not pdf_ok then
82 + print(" NOTE: engine binaries may exist but still fail due missing fonts, blocked local files, or config.")
83 +end
51 85 print("\nPandoc executable:")
52 86 local ok, version = ok_pipe("pandoc", {"--version"})
53 87 print(" " .. (ok and version or "pandoc executable not found from PATH"))