@fenfill/mcp 0.2.2 → 0.2.3

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/README.md CHANGED
@@ -127,10 +127,14 @@ cancelling the call ends the wait. `too_many_active_jobs` counts every running a
127
127
  workspace, free native-field (AcroForm) ones included.
128
128
 
129
129
  `fill_form` and `fill_template` take `values`, `output_path` (a new `.pdf`) and optional
130
- `overwrite`. They never overwrite the input PDF. In `values` (here and in `preview_page`), an id
131
- may be shortened to an unambiguous prefix of 6+ characters, the length of the preview tags; that
132
- goes for a table's cell or column ids inside its value too. A key that matches nothing is listed
133
- in `skipped`.
130
+ `overwrite`. They never overwrite the input PDF. In `values` (here and in `preview_page`), any id
131
+ may be shortened to an unambiguous prefix of 4+ characters (the preview tags show 6); that goes
132
+ for a table's cell or column ids inside its value, and for option ids in a choice's value, too. A
133
+ table cell's id given at the top level goes into its table's value, and an option's id given
134
+ `true` selects it (a radio's value, or one more item of a multiselect's list; `false` leaves it
135
+ unselected). A key that matches nothing is listed in `skipped`; one that starts several ids is
136
+ listed with its candidates, and a nested id that can't stand alone (a comb's cell, a table_rows
137
+ column) names the entry it belongs to.
134
138
 
135
139
  ### Previews and corrections
136
140
 
@@ -146,7 +150,11 @@ when that follows the box height); a choice's options with their own boxes; a ta
146
150
  `(row, col)`, its `orientation` and headers (also printed on the image inside, or beside, the
147
151
  first cell of each line as `R: …` / `C: …`; a character the bundled fonts lack is shown as `?`
148
152
  there, with a warning, and the legend keeps the full text); a `table_rows` table's columns and printed cells
149
- with their boxes (fill values still go by column id). `warnings` and `placement_warnings` are
153
+ with their boxes (fill values still go by column id); every date field, table date cell and date
154
+ column's `date_format` (the default `DD/MM/YYYY` when none is stored); and a comb's `cell_type`,
155
+ `max_length`, `date_format`, and in a `crop` its `comb_cells`: each printed cell in reading order with its tag
156
+ (the cell's own field; `index` for one cell of a field drawn over several) and box, plus the
157
+ `date_part` (`D`, `M` or `Y`) each cell of a date comb holds. `warnings` and `placement_warnings` are
150
158
  always present (`[]` = checked and clean): placement covers every box shown, so a plain preview
151
159
  is a read-only placement audit (see the checks under `edit_template`). `crop`
152
160
  (`{x, y, w, h}`, fractions) with `zoom` (default 2, max 8) renders just a region, magnified, and
@@ -157,8 +165,12 @@ options/cells/columns (`members_changed` counts them, so a header edit doesn't l
157
165
  grid), plus `removed` ids and `moved_into` (ids that now sit inside a table or group), and
158
166
  `legend: "none"` omits the legend. `overlay` says what is drawn over the page: `"full"` (the
159
167
  default), `"outline"` (the boxes without id tags and table header texts) or `"none"` (nothing:
160
- the page as a fill stamps it). Use the last two when a tag covers a caption, a tick box or a
161
- stamped value; `"none"` needs no outlined copy, so it also renders after `check_copy_failed`.
168
+ the page as a fill stamps it). Since 0.2.3 the `"full"` tags keep off the printed text (read from
169
+ the PDF's text layer) and the stamped values: an option's tag goes below, above or on the side
170
+ away from its caption, and a tag with no room beside its box is moved off and joined to it by a
171
+ thin line. On a scan there is no text layer, so a tag may still cover print there. Use the last
172
+ two when an outline covers what you must read; `"none"` needs no outlined copy, so it also
173
+ renders after `check_copy_failed`.
162
174
  The legend and `placement_warnings` are the same in all three. It renders the local working copy (`edit_template`) when there is one, otherwise the saved
163
175
  template or analyzed version; `edited: true` / `false` in the result says which. The page is rendered on your machine by
164
176
  PDFium (WebAssembly, shipped in the package; nothing native is installed), nothing is written to
@@ -176,6 +188,19 @@ disk, and the image goes only to the calling client.
176
188
  `cell_type` (`char`, `integer` or `date`) and `date_format` (one `D`, `M` or `Y` per cell, e.g.
177
189
  `DDMMYYYY`). Giving a `date_format` makes it a date comb, and `diff_summary.ops` echoes the
178
190
  comb's `cell_type`, `date_format` and `max_length` as a fill will read them;
191
+ - combs in one op (0.2.3): `add {type: "comb", page, label, cells, box?, cell_type?,
192
+ date_format?, section_id?, required?, description?}` makes a comb, either `box` cut into
193
+ `cells` equal cells, or `cells` as a list of the printed cells' own boxes (cells split by
194
+ printed separators, as in DD / MM / YYYY). `retype {id, type: "comb", cells, cell_type?,
195
+ date_format?}` turns a text or date field into a comb over its box, keeping its label,
196
+ section, order, `required` and description (a date field's `DD/MM/YYYY` gives `DDMMYYYY` when
197
+ the counts agree). `comb_add_cell {id: comb, box, date_format?}` and `comb_remove_cell {id:
198
+ cell, date_format?}` keep the comb's id; a date comb needs its new `date_format` with them (one
199
+ letter per cell). `group {kind: "comb"}` also takes `cell_type` and `date_format`, and
200
+ `set_format` on a comb's cell applies to its comb. A comb's cells have no label of their own;
201
+ - refs within a batch: give an op that adds something a `ref` (`"dob"`), and later ops of the
202
+ same call name what it added as `"$dob"` wherever an id goes (`set_format {id: "$dob", …}`,
203
+ `group {ids: ["$a", "$b"]}`). A ref of a rejected op names nothing;
179
204
  - tables: `group` with `kind: "table"` (a `cells` grid of field ids, rows × columns with `null`
180
205
  for a gap, or `ids` laid out from their boxes; `header_cols`, `header_rows`, `orientation`,
181
206
  `format`), `table_insert` / `table_delete` (a row or column; a new line's geometry is
@@ -184,7 +209,10 @@ disk, and the image goes only to the calling client.
184
209
  and `set_header` / `set_headers` (`{id, axis, texts: [...], start?}`, several in one op). Every cell of one column (or row, for `orientation: "row"`) has one type,
185
210
  as in the web editor; `set_format` on a table cell applies to its whole column or row;
186
211
  - order: `reorder {page, ids}` moves those top-level entries together, in that order, to where
187
- the first of them sat, and stamps an explicit `order` on every entry of the page (the web
212
+ whichever of them is listed first now stands (not necessarily `ids[0]`'s place); every other
213
+ entry keeps its relative order. A partial list moves only what it names: to put B right after
214
+ A, list both, and chained partial reorders are simplest replaced by one with the page's whole
215
+ list. It stamps an explicit `order` on every entry of the page (the web
188
216
  editor's layer-panel convention), so a later sub-pixel move no longer reshuffles questions.
189
217
  `diff_summary.ops` shows the `order` the page is now listed in. fenfill lists each section as
190
218
  one run, standing where its first entry stands, so entries of different sections never stand
@@ -193,7 +221,10 @@ disk, and the image goes only to the calling client.
193
221
  - sections: `set_section {ids, section_id}` moves fields or groups of one page to another of
194
222
  that page's sections (`null`: out of every section; a group moves with all its members), and
195
223
  `set_section_title {page, section_id, title}` renames one. `get_template` and `analyze_form`
196
- show each section's `section_id`.
224
+ show each section's `section_id`. `add` without `section_id` lands in the section of the
225
+ nearest field at or above it, a new `group` in its earliest member's section and at that
226
+ member's place in the order; `diff_summary.ops` gives each one's `section`, and a `group` its
227
+ `members` (ids unchanged) in reading order.
197
228
 
198
229
  Any id can be shortened to an unambiguous prefix of 6+ characters (the length of the preview
199
230
  tags); an ambiguous prefix is rejected with the candidates. `add`, `move` and `set_box` take an
@@ -206,10 +237,22 @@ scan can be missed, and an underline box is one line of handwriting tall (as tal
206
237
  space above the rule, within about 11–16 pt). `diff_summary.ops` lists every applied op with
207
238
  `snapped: true/false` (when it asked for a snap) and `noop: true` when it changed nothing; a
208
239
  batch that leaves the form as it was writes no working copy (`has_edits` stays `false`). After
209
- each edit, the boxes you touched are checked for three placement problems: a value that would
240
+ each edit, the boxes you touched are checked for four placement problems: a value that would
210
241
  print much larger than the page's other fields (an Auto box's text size follows its height), a
211
- box over printed text (text layer only, so not on scans), and a box that runs a little past the
212
- ruled cell it sits in (from the page render, so scans too). `set_format` merges into the stored
242
+ box over printed text (text layer only, so not on scans; the covered text is quoted), and a box
243
+ that runs a little past the ruled cell it sits in (from the page render, so scans too). Pale text
244
+ printed at the left edge of a blank's row or cell is a hint and is written over ("Name",
245
+ "Address"); a caption printed part-way along the row is not. So a box over a pale hint at its
246
+ left edge (or its ruled cell's) is no misplacement: it is listed under `notes` here and
247
+ `placement_notes` in `preview_page`, never as a warning. Invisible text (an OCR layer over a
248
+ scan) counts as the print it stands for. Signature boxes get the printed-text check too. And a choice's option box is checked
249
+ against its caption in reading order: it warns when the box is on the other side of its caption
250
+ from the question's other boxes (one question never mixes sides), or when the first printed text
251
+ after the box (before it, for boxes printed after their captions) is another option's caption. An
252
+ option the form prints no box for has its box on the same side as the printed ones; when that
253
+ side has no room on its caption's line (its caption starts the line), the box goes in the slot
254
+ just before the caption in reading order, at the end of the line above, and that passes. Not on
255
+ scans (no text layer). `set_format` merges into the stored
213
256
  format (a date field keeps its date format when you only set `font_size`).
214
257
  Coordinates are fractions of the page (0–1) with a top-left origin, the same as the legend's
215
258
  `box`. Each op is checked against the rules fenfill applies when saving and is rejected with a
@@ -228,8 +271,10 @@ page shows it: a date in its field's printed format (`1990-05-17` as `17.05.1990
228
271
  characters without the separators typed between them, an answer of several lines also line by
229
272
  line. A date written a third way (`17/05/1990`) is not recognised. The values of a fill or
230
273
  preview that failed before the form was read (an output file that already exists, a failed
231
- download) count as answers too. The reason names the entry and the property (a section with
232
- its page), never the text. A printed caption can share a word with a test value (`Middle name` after
274
+ download) count as answers too. A comb cell's own label is never shown (the comb is listed under the
275
+ group's label), so a placeholder label on a cell that equals an answer of under 4 characters
276
+ (`D1`) passes without a warning; one equal to a longer answer, or holding one, is refused. The
277
+ reason names the entry and the property (a section with its page), never the text. A printed caption can share a word with a test value (`Middle name` after
233
278
  previewing `Middle`): when the rejected wording is the form's own, send the op again with
234
279
  `confirm_wording: true`. That lets through only wording a rejection has already named (that
235
280
  text in that property), and what you confirmed is the wording: it is not asked about again in
@@ -257,8 +302,10 @@ unsaved analysis can be edited for filling but not saved: to keep corrections,
257
302
  analyze with `save_as_template: true` and edit that template. With nothing to save, it succeeds
258
303
  with `saved: false, nothing_to_save: true`. `get_template` lists the fields in `sections`, in fenfill's order: one
259
304
  block per section (with its `section_id` and `title`), and fields in no section as blocks of
260
- their own where they stand. It says `has_local_edits` (its fields
261
- are fenfill's saved version; `preview_page` shows the working copy) and gives `field_count`
305
+ their own where they stand. With local edits it lists the working copy, as `fill_template` and
306
+ `preview_page` use it (`edited: true`, `has_local_edits: true`): new option ids, deleted rows,
307
+ sections and order show before you save; `version: "saved"` lists fenfill's saved version
308
+ instead (`edited: false`). It gives `field_count`
262
309
  (entries listed) and `field_count_total` (the whole form); `save_template`'s `field_count` is
263
310
  the whole saved template.
264
311
 
@@ -295,7 +342,7 @@ same run at no extra charge.
295
342
  | Field type | Value |
296
343
  | ------------------- | --------------------------------------------------------------------------- |
297
344
  | `text`, `multiline` | string, stamped exactly as given |
298
- | `comb` | string, one character per cell |
345
+ | `comb` | string, one character per cell (a date comb: below) |
299
346
  | `date` | `"YYYY-MM-DD"`, printed in the field's `date_format` (e.g. `DD/MM/YYYY`) |
300
347
  | `checkbox` | `true` / `false` |
301
348
  | `radio` | option id, option label, or the bare option text (`"No"` for `"Smoke? No"`) |
@@ -304,6 +351,11 @@ same run at no extra charge.
304
351
  | `table_rows` | `[{ "<columnId>": value, … }, …]` |
305
352
  | `signature` | `{ "image_path": "/abs/path/signature.png" }` (PNG or JPG) |
306
353
 
354
+ A date comb (`cell_type: "date"`) takes the whole date as one string, never cell by cell:
355
+ `"YYYY-MM-DD"`, laid out by its `date_format` (`DDMMYYYY` writes `17052024`), or exactly its
356
+ `max_length` digits in the printed order. The preview legend lists a comb's `cell_type`,
357
+ `max_length`, `date_format` and cells.
358
+
307
359
  A date the form asks for in a plain `text` field is not reformatted: write it the way the field's
308
360
  label or placeholder asks (for example `10042026` for "mmddyyyy"). A `signature` whose
309
361
  `signing_requirement` is `"external"` is signed outside fenfill (on paper, or with an e-signature
@@ -1,4 +1,4 @@
1
- @fenfill/mcp 0.2.2 bundles the following third-party software.
1
+ @fenfill/mcp 0.2.3 bundles the following third-party software.
2
2
 
3
3
  @cantoo/pdf-lib@2.11.1 (MIT)
4
4
  ------------------------------------------------------------------------