Skip to content

Quote a source range into an existing field - #76

Merged
peterbjohnson merged 2 commits into
devfrom
wb/t50
Sep 20, 2026
Merged

peterbjohnson merged 2 commits into
devfrom
wb/t50

Conversation

@peterbjohnson

Copy link
Copy Markdown
Member

A draft holds no command that writes an existing field from the source. question add, part add and question solution create a field from a range; field replace changes wording inside a field and takes its new text from the command line. So when validate reports q4.text (lines 32-33) is empty because the spec matched the label line Q4 alone, the only repair a caller has is field replace q4.text '^$' TEXT --regex, which types TEXT out at layer 4 with no range. The agent's fix loop did that on UCL_MechEng/Worksheet_2.pdf and typed a sentence the source does not hold.

Add in2lambda draft field set KEY --text RANGE [--by NAME] in in2lambda.draft: it quotes RANGE (block id, s5, s5:8, or 2/b3 for a second source) into the existing field KEY at layer 3 with ranges set and edited false, the same way part add --text quotes a range, and refuses a KEY that is not a field of the draft. It is logged and replayed like every other command, the overlap check counts its range, and --literal TEXT is not an option here: field replace is the command for typed text. Add it to the command table in docs/source/drafts.md and the CLI reference, and a test in tests/test_draft.py that sets an empty question text from a paragraph block and replays.

Done when in2lambda draft field set q4.text b12 fills an empty field with the block's text and the ranges of that block, the replay test passes, and the docs list the command.


Workbench ticket t50.

@peterbjohnson
peterbjohnson merged commit dd2dbe2 into dev Sep 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant