build: In the obsidian-connor plugin, add Knap as an npm dependency and make sure it bundles with the plugin's build.… #18

Merged
Joel merged 2 commits from build/ed8ce5b4 into main 2026-09-29 17:36:03 +00:00
Owner

What changed

build/ed8ce5b4 → main — 10 file(s), +1222/−6.

  • .forgejo/workflows/gate.yml
  • README.md
  • esbuild.test.mjs
  • package-lock.json
  • package.json
  • src/lib/knap.ts
  • src/lib/render.ts
  • src/main.ts
  • test/knap.test.ts
  • test/render.test.ts

Why

The plugin now has a render tool built on Knap 0.6.0, and the gate passed: 233 tests, 0 failures, up from 196.

What I changed

  • Dependency. knap is pinned to exactly 0.6.0 under dependencies, and the lockfile is updated. Its only dependency, dayjs, came with it. esbuild bundles Knap into main.js: I found Knap's own error messages in the built file, and its only requires are still crypto, http, https and obsidian. So nothing extra gets installed in a vault. I corrected the three places that claimed the plugin ships zero dependencies (README, gate.yml, the esbuild.test.mjs header).
  • The handler. The earlier red build, the one stuck on #115, was still on disk (frontend-work/191175bf), and your Connor-side vaultrender in obsidian.py was written against it. So I brought that build's code across rather than reinventing it, then checked it against 0.6.0 and today's base:
    • src/lib/knap.ts is the only file that imports Knap. It registers Knap's standard filters (a fresh engine has none), turns regex off, and turns Knap's returned errors into a throw.
    • src/lib/render.ts does the work:
      • It plans the whole batch before writing anything: every render, every path check, the folder rules, and a check that no two rows land on the same path.
      • Every note then goes through the same writeNote as write, which also creates any missing folders.
    • src/main.ts gets the render entry in TOOLS, a dispatch branch, and the template loader. […]

Gate

npm run gate ran 233 tests in 3.1s and exited 0 — green.

Built by Connor's backend backburner (dispatch ed8ce5b4) in an isolated clone; shipped deterministically by ship.py. The full build notes were spoken in conversation and stored in memory (agent-dispatch:ed8ce5b4). Review is the gate.


The brief this build was given

Kept for provenance. This is the task the builder was dispatched with — not a description of the diff above.

In the obsidian-connor plugin, add Knap as an npm dependency and make sure it bundles with the plugin's build. Add a 'render' handler that accepts the template (inline text or a vault path to a template note), a data object (or an array of data objects for bulk output), and a target vault path or path pattern. It renders each note with Knap and writes the results into the vault, creating folders as needed. It returns the list of written paths plus any per-note errors. Follow the existing handler registration and error conventions, and add tests for single and bulk rendering and for a template error.

This task is one step of my plan: working-list item #113: Wire Knap (kepano's MIT Markdown templating engine, npm) into Connor's note-generation path — add it as a dependency in the obsidian-connor plugin, expose a render handler, and add a Connor-side vaultrender act (vault | path | template | data) so bulk note sets like the 112 Tura course notes come fr

Result of earlier step 1 (research: Research Knap, kepano's MIT-licensed Markdown templating engine on npm. Find the):

Knap: study notes (checked 2026-09-15)

The headline: my memory is out of date

My memory says Knap is at 0.4.1. The npm registry now lists knap 0.6.0 as latest, published 2026-09-14 (https://registry.npmjs.org/knap). Three minor releases have shipped since 0.4.1:

  • 0.4.2 added {# … #} comments.
  • 0.5.0 added syntax-highlighter adapters.
  • 0.6.0 has breaking filter changes. The CHANGELOG (https://cdn.jsdelivr.net/npm/[email protected]/CHANGELOG.md) says yaml, yaml_property, calc, round, length, first, last and nth "now return typed values instead of text". It also says applyFiltersWithRegistry now renders a final null as empty text instead of "null", and numeric parsing is stricter. If the branch pinned 0.4.1, frontmatter output made with yaml_property can change on upgrade. I'd pin 0.6.0 exactly.

Package facts (registry, 0.6.0)

  • Name: knap. Licence: MIT. Repo: github.com/obsidianmd/knap, "by kepano" according to the footer on https://knap.md.
  • Module format: "type": "module". The . export maps import → dist/index.js, require → dist/index.cjs, types → dist/index.d.ts. main and types are als […]
### What changed `build/ed8ce5b4` → `main` — 10 file(s), +1222/−6. - `.forgejo/workflows/gate.yml` - `README.md` - `esbuild.test.mjs` - `package-lock.json` - `package.json` - `src/lib/knap.ts` - `src/lib/render.ts` - `src/main.ts` - `test/knap.test.ts` - `test/render.test.ts` ### Why The plugin now has a `render` tool built on Knap 0.6.0, and the gate passed: **233 tests, 0 failures**, up from 196. ## What I changed - **Dependency.** `knap` is pinned to exactly `0.6.0` under `dependencies`, and the lockfile is updated. Its only dependency, `dayjs`, came with it. esbuild bundles Knap into `main.js`: I found Knap's own error messages in the built file, and its only `require`s are still `crypto`, `http`, `https` and `obsidian`. So nothing extra gets installed in a vault. I corrected the three places that claimed the plugin ships zero dependencies (README, `gate.yml`, the `esbuild.test.mjs` header). - **The handler.** The earlier red build, the one stuck on #115, was still on disk (`frontend-work/191175bf`), and your Connor-side `vaultrender` in `obsidian.py` was written against it. So I brought that build's code across rather than reinventing it, then checked it against 0.6.0 and today's base: - **`src/lib/knap.ts`** is the only file that imports Knap. It registers Knap's standard filters (a fresh engine has none), turns regex off, and turns Knap's returned errors into a throw. - **`src/lib/render.ts`** does the work: - It plans the whole batch before writing anything: every render, every path check, the folder rules, and a check that no two rows land on the same path. - Every note then goes through the same `writeNote` as `write`, which also creates any missing folders. - **`src/main.ts`** gets the `render` entry in TOOLS, a dispatch branch, and the template loader. […] ### Gate `npm run gate` ran 233 tests in 3.1s and exited 0 — green. Built by Connor's backend backburner (dispatch `ed8ce5b4`) in an isolated clone; shipped deterministically by `ship.py`. The full build notes were spoken in conversation and stored in memory (`agent-dispatch:ed8ce5b4`). Review is the gate. --- ### The brief this build was given _Kept for provenance. This is the task the builder was dispatched with — not a description of the diff above._ > In the obsidian-connor plugin, add Knap as an npm dependency and make sure it bundles with the plugin's build. Add a 'render' handler that accepts the template (inline text or a vault path to a template note), a data object (or an array of data objects for bulk output), and a target vault path or path pattern. It renders each note with Knap and writes the results into the vault, creating folders as needed. It returns the list of written paths plus any per-note errors. Follow the existing handler registration and error conventions, and add tests for single and bulk rendering and for a template error. > > This task is one step of my plan: working-list item #113: Wire Knap (kepano's MIT Markdown templating engine, npm) into Connor's note-generation path — add it as a dependency in the obsidian-connor plugin, expose a render handler, and add a Connor-side vaultrender act (vault | path | template | data) so bulk note sets like the 112 Tura course notes come fr > > Result of earlier step 1 (research: Research Knap, kepano's MIT-licensed Markdown templating engine on npm. Find the): > # Knap: study notes (checked 2026-09-15) > > ## The headline: my memory is out of date > My memory says Knap is at **0.4.1**. The npm registry now lists **`knap` 0.6.0** as `latest`, published 2026-09-14 (https://registry.npmjs.org/knap). Three minor releases have shipped since 0.4.1: > - **0.4.2** added `{# … #}` comments. > - **0.5.0** added syntax-highlighter adapters. > - **0.6.0** has **breaking filter changes**. The CHANGELOG (https://cdn.jsdelivr.net/npm/[email protected]/CHANGELOG.md) says `yaml`, `yaml_property`, `calc`, `round`, `length`, `first`, `last` and `nth` "now return typed values instead of text". It also says `applyFiltersWithRegistry` now renders a final `null` as empty text instead of `"null"`, and numeric parsing is stricter. If the branch pinned 0.4.1, frontmatter output made with `yaml_property` can change on upgrade. I'd pin 0.6.0 exactly. > > ## Package facts (registry, 0.6.0) > - **Name:** `knap`. **Licence:** MIT. **Repo:** github.com/obsidianmd/knap, "by kepano" according to the footer on https://knap.md. > - **Module format:** `"type": "module"`. The `.` export maps `import` → `dist/index.js`, `require` → `dist/index.cjs`, types → `dist/index.d.ts`. `main` and `types` are als […]
build: In the obsidian-connor plugin, add Knap as an npm dependency and make…
All checks were successful
gate / gate (pull_request) Successful in 8s
9a05b7fd12
In the obsidian-connor plugin, add Knap as an npm dependency and make sure it bundles with the plugin's build. Add a 'render' handler that accepts the template (inline text or a vault path to a template note), a data object (or an array of data objects for bulk output), and a target vault path or path pattern. It renders each note with Knap and writes the results into the vault, creating folders as needed. It returns the list of written paths plus any per-note errors. Follow the existing handler registration and error conventions, and add tests for single and bulk rendering and for a template error.

This task is one step of my plan: working-list item #113: Wire Knap (kepano's MIT Markdown templating engine, npm) into Connor's note-generation path — add it as a dependency in the obsidian-connor plugin, expose a render handler, and add a Connor-side vaultrender act (vault | path | template | data) so bulk note sets like the 112 Tura course notes come fr

Result of earlier step 1 (research: Research Knap, kepano's MIT-licensed Markdown templating engine on npm. Find the):
# Knap: study notes (checked 2026-09-15)

## The headline: my memory is out of date
My memory says Knap is at **0.4.1**. The npm registry now lists **`knap` 0.6.0** as `latest`, published 2026-09-14 (https://registry.npmjs.org/knap). Three minor releases have shipped since 0.4.1:
- **0.4.2** added `{# … #}` comments.
- **0.5.0** added syntax-highlighter adapters.
- **0.6.0** has **breaking filter changes**. The CHANGELOG (https://cdn.jsdelivr.net/npm/[email protected]/CHANGELOG.md) says `yaml`, `yaml_property`, `calc`, `round`, `length`, `first`, `last` and `nth` "now return typed values instead of text". It also says `applyFiltersWithRegistry` now renders a final `null` as empty text instead of `"null"`, and numeric parsing is stricter. If the branch pinned 0.4.1, frontmatter output made with `yaml_property` can change on upgrade. I'd pin 0.6.0 exactly.

## Package facts (registry, 0.6.0)
- **Name:** `knap`. **Licence:** MIT. **Repo:** github.com/obsidianmd/knap, "by kepano" according to the footer on https://knap.md.
- **Module format:** `"type": "module"`. The `.` export maps `import` → `dist/index.js`, `require` → `dist/index.cjs`, types → `dist/index.d.ts`. `main` and `types` are als

Result of earlier step 2 (read in obsidian-connor: Read the obsidian-connor plugin and explain how it exposes handlers to Connor. C):
# How the obsidian-connor plugin exposes handlers to Connor, and what `render`/`vaultrender` would touch (reading notes, 2026-09-15)

**Two things change the plan.** The Connor side of `vaultrender` is already built. Only the plugin's `render` handler is missing, and I found no `knap` or `render` in either plugin checkout. Also, `main` is not the plugin I should build on.

## 0. Which plugin I read
- **`main`** (177fd83, clean) is **v0.2.0**. It has one file, `src/main.ts`, five tools, and no tests.
- **The `feat/partner-in-crime` worktree** is at `/home/joel/Development/obsidian-connor-wt/partner` (`.git/worktrees/partner/HEAD`). It is **v0.4.0**, with `src/lib/*`, a `test/` folder and 19 tools.
- Connor's client expects things only the partner branch has: `if_mtime`, JSON replies, the held link, `read_meta`, `base_rows`. **So the handler belongs on the partner branch.** I can't run git, so I don't know whether that branch is pushed or merged.
- `origin/build/78726254` and `origin/pr/5` both point at `cfae4e50`. I can't read packed objects, so I don't know what they contain. My build memory says a run wrote `src/lib/render.ts` and `src/lib/knap.ts` but stayed red because `knap` co

Built by my backend backburner (dispatch ed8ce5b4), diff verified by git; shipped by ship.py. Nothing merges without review.
reviewer-bot left a comment

HELD FOR HUMAN INDEPENDENT REVIEW

reviewer-bot withholds auto-approval on this PR (trust-surface: touches trust surface ['.forgejo/workflows/gate.yml']). Per ADR-0007 D3 / ADR-0008 D4 the independence axis on high-tier / trust-surface changes must be closed by a human independent principal, not the local-model reviewer. Holding for human review — this bot will not post APPROVED here.

**HELD FOR HUMAN INDEPENDENT REVIEW** `reviewer-bot` withholds auto-approval on this PR (trust-surface: touches trust surface ['.forgejo/workflows/gate.yml']). Per ADR-0007 D3 / ADR-0008 D4 the independence axis on high-tier / trust-surface changes must be closed by a **human** independent principal, not the local-model reviewer. Holding for human review — this bot will not post APPROVED here.
Merge branch 'main' into build/ed8ce5b4
All checks were successful
gate / gate (pull_request) Successful in 9s
817d38c365
reviewer-bot left a comment

HELD FOR HUMAN INDEPENDENT REVIEW

reviewer-bot withholds auto-approval on this PR (trust-surface: touches trust surface ['.forgejo/workflows/gate.yml']). Per ADR-0007 D3 / ADR-0008 D4 the independence axis on high-tier / trust-surface changes must be closed by a human independent principal, not the local-model reviewer. Holding for human review — this bot will not post APPROVED here.

**HELD FOR HUMAN INDEPENDENT REVIEW** `reviewer-bot` withholds auto-approval on this PR (trust-surface: touches trust surface ['.forgejo/workflows/gate.yml']). Per ADR-0007 D3 / ADR-0008 D4 the independence axis on high-tier / trust-surface changes must be closed by a **human** independent principal, not the local-model reviewer. Holding for human review — this bot will not post APPROVED here.
Joel merged commit bafde98dab into main 2026-09-29 17:36:03 +00:00
Joel deleted branch build/ed8ce5b4 2026-09-29 17:36:03 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ZSDev/obsidian-connor!18
No description provided.