Skip to content

## Prompt Ship include

Prompt

Ship include.lua with projio and add .projio/render.yml as the single render config source of truth.

Context

Study repos like pixecog have render settings scattered across 4 places: Makefile vars, pandoc-defaults.yaml, VSCode tasks.json, and manuscript.yml. They also copy a Lua transclusion filter (include.lua) per project. This task consolidates render config into .projio/render.yml and ships the Lua filter with projio.

Deliverables

1. Ship include.lua with projio

Copy the Lua filter from pixecog (code/utils/lua/include.lua) into projio at src/projio/data/filters/include.lua. Read the pixecog version with worklog_read_file(project_id="pixecog", path="code/utils/lua/include.lua").

The filter handles: - --8<-- "path.md" (mkdocs snippets syntax) - {% include-markdown "path.md" %} (mkdocs-include-markdown syntax) - Smart-quote normalization - [[wikilink]] stripping for Pandoc - 2-step path fallback (as-is, then docs/ prefix)

During projio init or projio sync, copy this filter to .projio/filters/include.lua in the target project. Add this to src/projio/sync.py — check if the method that syncs projio-managed files already exists, and add the filter copy there.

Use importlib.resources (or pkg_resources) to locate the bundled filter file from the installed package.

2. Create .projio/render.yml schema and loader

New file: src/projio/render.py

Schema (plain dataclass + YAML loading, like manuscripto):

# .projio/render.yml
pdf_engine: xelatex          # pdflatex | xelatex | tectonic
csl: bib/csl/nature.csl      # relative to project root
bibliography: bib/project.bib
lua_filter: .projio/filters/include.lua
conda_env: labpy              # env for pandoc invocation
resource_path:                # pandoc --resource-path
  - .
  - docs
  - docs/assets
  - bib

Functions: - load_render_config(root: Path) -> RenderConfig — load from .projio/render.yml, merge with defaults - generate_pandoc_defaults(config: RenderConfig, root: Path) -> dict — produce a pandoc-defaults.yaml-compatible dict - write_pandoc_defaults(config: RenderConfig, root: Path, output: Path) — write generated pandoc-defaults.yaml

3. projio render sync CLI command

Add a render subcommand to src/projio/cli.py: - projio render sync — reads .projio/render.yml, generates/overwrites bib/pandoc-defaults.yaml (or configurable output path) - projio render show — print the resolved render config (for debugging)

Read src/projio/cli.py to understand the existing subcommand pattern.

4. Scaffold render.yml during projio init

Update src/projio/init.py to create a default .projio/render.yml during workspace scaffolding. Only for study workspace type (not tool or generic). Use sensible defaults (xelatex, empty bib/csl paths).

5. Wire into projio sync

projio sync already auto-discovers libraries, utils, etc. Add: - Copy include.lua to .projio/filters/ if it doesn't exist or is outdated (compare content hash) - If .projio/render.yml exists, run generate_pandoc_defaults and write to the configured output path

Notes

  • The render.yml paths should be relative to project root, not absolute
  • Don't modify any existing test files — add new test for render config loading if time permits
  • The Lua filter should be byte-identical to pixecog's version (it's battle-tested)

Batch Result

  • status: done
  • batch queue_id: d4b9b2177a02
  • session: 29223ba5-627f-47d9-b1cc-78330eb97d21
  • batch duration: 691.0s