bun-docx 0.20.0 → 0.20.1

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +17 -12
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -18,7 +18,7 @@ We measured it — a controlled A/B bake-off: **six real document tasks** (fill
18
18
  | :------------------------ | ------------------: | --------------------: | --------------: | --------------------: |
19
19
  | | **docx-cli** | default skill | **docx-cli** | default skill |
20
20
  | Tasks solved (of 6) | **4.3** (4–5) | 0.7 (0–1) | **6.0** (6–6) | 4.0 (4–4) |
21
- | Rendered correctly (of 6) | 5.7 | 3.7 | 6.0 | 4.7 |
21
+ | Rendered correctly (of 6) | 6 | 3.7 | 6.0 | 4.7 |
22
22
  | Outright-broken documents | **0** | ~1/run (up to 2) | **0** | 0 |
23
23
  | Input tokens | **2.4M** | 6.1M (2.6×) | **1.6M** | 3.6M (2.2×) |
24
24
  | Wall-clock | **924 s** | 1,882 s (2.0× slower) | **1,175 s** | 2,029 s (1.7× slower) |
package/dist/index.js CHANGED
@@ -82676,7 +82676,7 @@ async function resolveBlockOrFail(document4, locator) {
82676
82676
  return document4.body.resolveBlock(locator);
82677
82677
  } catch (err) {
82678
82678
  if (err instanceof LocatorResolveError) {
82679
- return await fail("BLOCK_NOT_FOUND", err.message);
82679
+ return await fail("BLOCK_NOT_FOUND", err.message, STALE_LOCATOR_HINT);
82680
82680
  }
82681
82681
  throw err;
82682
82682
  }
@@ -82726,7 +82726,7 @@ async function resolveBlockRangeOrFail(document4, locator) {
82726
82726
  return await fail("INVALID_LOCATOR", err.message);
82727
82727
  }
82728
82728
  if (err instanceof LocatorResolveError) {
82729
- return await fail("BLOCK_NOT_FOUND", err.message);
82729
+ return await fail("BLOCK_NOT_FOUND", err.message, STALE_LOCATOR_HINT);
82730
82730
  }
82731
82731
  throw err;
82732
82732
  }
@@ -82735,7 +82735,7 @@ var EXIT2, stdout = async (text6) => {
82735
82735
  await Bun.stdout.write(text6);
82736
82736
  }, stderr = async (text6) => {
82737
82737
  await Bun.stderr.write(text6);
82738
- }, sinks, verboseAck = false, SAVE_FLAGS;
82738
+ }, sinks, verboseAck = false, STALE_LOCATOR_HINT = "Locator ids are positional and shift after structural edits (insert/delete/section changes) \u2014 an id from an earlier read may now point elsewhere or be gone. Re-read the file to get current ids, then retry. Applying several changes? Do them from ONE read with --batch (edit/insert/delete/replace/comments) so ids never go stale mid-run.", SAVE_FLAGS;
82739
82739
  var init_respond = __esm(() => {
82740
82740
  init_core2();
82741
82741
  EXIT2 = {
@@ -86241,9 +86241,12 @@ General options:
86241
86241
  -h, --help Show this help
86242
86242
 
86243
86243
  Output:
86244
- Prints a one-line confirmation on success (exit 0) \u2014 the edited locator is unchanged, so there's
86245
- nothing to mint. --verbose prints {ok:true, operation, path, locator}.
86246
- Errors print {code, error, hint?} with a nonzero exit. Discover ids with
86244
+ Prints a one-line confirmation on success (exit 0) \u2014 an in-place edit shifts nothing, so the
86245
+ edited locator is unchanged and there's nothing to mint. --verbose prints {ok:true, operation,
86246
+ path, locator}. Errors print {code, error, hint?} with a nonzero exit.
86247
+ Heads up: a locator you hold from BEFORE a structural edit (an insert/delete elsewhere renumbers
86248
+ ids) is stale \u2014 it lands on the wrong block or errors BLOCK_NOT_FOUND. Re-read after any
86249
+ insert/delete, or apply the whole set from one read with --batch (above). Discover ids with
86247
86250
  \`docx read FILE --ast\` (equation ids appear on EquationRun nodes).
86248
86251
 
86249
86252
  Examples:
@@ -98014,7 +98017,7 @@ Examples:
98014
98017
  // package.json
98015
98018
  var package_default = {
98016
98019
  name: "bun-docx",
98017
- version: "0.20.0",
98020
+ version: "0.20.1",
98018
98021
  description: "Read, edit, redline, and comment on Microsoft Word .docx files from the command line \u2014 built for AI agents.",
98019
98022
  keywords: [
98020
98023
  "docx",
@@ -98137,11 +98140,13 @@ Commands (each one-liner names capabilities you'd otherwise miss; see <command>
98137
98140
  It is highly recommended to run "docx info locators" and "docx info schema" (neither needs a FILE) to understand the addressing model and AST.
98138
98141
  Run "docx <command> --help" for command-specific help.
98139
98142
 
98140
- BATCH MANY CHANGES IN ONE READ: filling a form or applying many edits? Don't go
98141
- one-at-a-time \u2014 edit / insert / replace / delete and comments (add/resolve/delete)
98142
- all take --batch FILE.jsonl (one JSON change per line; "-" reads stdin). Every locator
98143
- addresses the document AS READ, so ids stay valid across the whole batch \u2014 one
98144
- read, one write, no re-reading between changes. See "<command> --help".
98143
+ BATCH MANY CHANGES IN ONE READ: locator ids are positional and shift after structural
98144
+ edits (insert/delete/section changes), so going one-at-a-time forces a re-read to refresh
98145
+ ids after each. Miss the change and the next command lands on the wrong block or errors
98146
+ BLOCK_NOT_FOUND. Skip all that: edit / insert / replace / delete and comments
98147
+ (add/resolve/delete) all take --batch FILE.jsonl (one JSON change per line; "-" reads
98148
+ stdin). Every locator addresses the document AS READ, so ids stay valid across the whole
98149
+ batch \u2014 one read, one write, no re-reading between changes. See "<command> --help".
98145
98150
 
98146
98151
  FILL FORMATTED / TABBED LINES WITHOUT REBUILDING RUNS: to fill a template line that
98147
98152
  carries formatting (bold/font) or tab stops \u2014 e.g. "**Org Name**\u21E5Date" \u2014 replace just
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bun-docx",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "Read, edit, redline, and comment on Microsoft Word .docx files from the command line — built for AI agents.",
5
5
  "keywords": [
6
6
  "docx",