onionskin-cli 0.0.5 → 0.0.6

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 (48) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/README.md +4 -4
  3. package/package.json +1 -1
  4. package/scripts/checker/check.py +24 -5
  5. package/scripts/checker/requirements.txt +482 -5
  6. package/scripts/requirements.txt +482 -5
  7. package/scripts/rewriter/apple/main.swift +1 -1
  8. package/scripts/rewriter/apple/onionskin-fm +0 -0
  9. package/scripts/rewriter/apple/onionskin-fm.json +1 -1
  10. package/skills/onionskin/SKILL.md +4 -4
  11. package/skills/onionskin/reference/ops.md +1 -1
  12. package/src/agent-runner.js +94 -15
  13. package/src/checker.js +238 -33
  14. package/src/cli.js +173 -33
  15. package/src/doctor.js +12 -3
  16. package/src/docx.js +130 -63
  17. package/src/fsutil.js +13 -5
  18. package/src/history.js +11 -2
  19. package/src/html-render.js +74 -15
  20. package/src/html-utf8.js +1 -1
  21. package/src/html.js +3 -1
  22. package/src/merge-package.js +82 -26
  23. package/src/offload.js +25 -6
  24. package/src/ops/docx-table.js +5 -3
  25. package/src/ops/pptx.js +8 -2
  26. package/src/ops/xlsx.js +114 -8
  27. package/src/package.js +17 -2
  28. package/src/pptx.js +244 -8
  29. package/src/question.js +10 -3
  30. package/src/quick.js +1 -1
  31. package/src/redline-check.js +12 -2
  32. package/src/rewriter.js +38 -8
  33. package/src/server-entry.js +4 -3
  34. package/src/server.js +97 -28
  35. package/src/session.js +13 -2
  36. package/src/setup.js +20 -2
  37. package/src/update.js +248 -19
  38. package/src/voice-guide.js +12 -7
  39. package/src/voice-learn.js +11 -1
  40. package/src/voice-store.js +11 -4
  41. package/src/voice.js +2 -1
  42. package/src/xlsx.js +25 -5
  43. package/src/zip-write.js +8 -4
  44. package/src/zip.js +64 -13
  45. package/web/dist/assets/{index-DytKkMdi.js → index-CjsTf5gj.js} +108 -106
  46. package/web/dist/assets/index-DnbLtHhG.css +1 -0
  47. package/web/dist/index.html +2 -2
  48. package/web/dist/assets/index-DkNx0LSH.css +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,103 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.6 (2026-11-20)
4
+
5
+ ### Added
6
+ - The page says more about what is still waiting to go out:
7
+ - The top bar says "1 comment unsent", "2 comments, 1 pin unsent" or "Overall note unsent". Before, it said "No unsent edits" while comments or a note were waiting.
8
+ - A comment or pin with no words shows "Empty draft", is not counted as unsent, and Send leaves it out. A pin with no words still goes when the overall note has words.
9
+ - In Comment and Pin modes a label at the top says "Comment mode · Esc for Edit" or "Pin mode · Esc for Edit", and Esc goes back to Edit mode.
10
+ - Pointing at a card in the review panel outlines its mark in the document, and the other way round. Clicking a mark opens the review panel if it is closed.
11
+ - If the page itself fails, it shows "Something went wrong" with Reload page and Copy unsent comments, and asks before you leave. Before, the page went blank.
12
+ - Close buttons where there were none: the Quick ask box (which also gets a Send button, and whose line now says "Esc discards." where it said "Esc closes."), What changed and the keyboard shortcuts list. Editing stamps has Cancel. "Expand all" and "Collapse all" fold or open every answered card and agent run.
13
+
14
+ ### Fixed
15
+ - Comments land on the words you chose more often:
16
+ - PowerPoint: a comment on text that appears more than once in a shape went to its first copy. It now goes to the copy you selected.
17
+ - Word and PowerPoint: a comment on words that run across a line break, a tab, a non-breaking space or two spaces, or on a letter written as a letter plus a separate accent, could not find those words again. It now marks them. See Known issues for repeated text with mixed accents.
18
+ - Text that Word and PowerPoint store twice (a shape or text box saved with a second copy for older programs) was read twice, by comments, the agent and the merge. In Word, text that a tracked change moved away was still read where it used to be. Both are now read once, where they are.
19
+ - Excel: cells saved without their own address (some programs leave it out) were skipped. A TRUE or FALSE cell saved as `true` read as FALSE, and an empty one read as FALSE. Such cells are now read, `true` reads as TRUE, and an empty one stays empty.
20
+ - Agent edits that could go wrong:
21
+ - Excel: a replace-all after an earlier change to the same cells, in the same set of edits, could write over that change. It now refuses if a cell changed.
22
+ - PowerPoint: a replace-all refused partway could leave the shapes before it changed. It now checks every shape before it changes any.
23
+ - Word tables: a new column in a table whose columns have no widths got invalid widths, and text holding half of an emoji's character pair could make Word call the file damaged. The widths are now left alone, and such text is refused.
24
+ - Each part of an Office file is checked against its stored size and checksum when Onionskin reads it. A damaged or encrypted part is refused with the reason instead of being read.
25
+ - On a disk that does not support one of the steps Onionskin takes to make a write safe (some network shares and external disks), a save could fail, and so could the copy of your version saved next to the file. Onionskin now goes on without that step, or makes the copy another way.
26
+ - On Node 22.0 and 22.1, an agent's added or deleted Word table rows and columns, and the tracked-changes copy, failed. Fixed.
27
+ - The background agent: pressing Stop, Open in Terminal or Close session while it was starting could still start it; when it ended but a program it started kept running, the page kept showing it as working; accented letters and emoji in its activity lines could show as broken characters; and a long check at the end of a run could hand the batch back as if the agent had stopped. All four are fixed.
28
+ - Deeper checks: a Python too old for them was reported as "there is no internet connection". It now names the version, for example "Deeper checks could not be turned on: Python 3.8.18 is not supported. Ask your agent to set up a supported Python, then try again."
29
+ - While a dialog was open, shortcuts such as Cmd+Option+M still acted on the document behind it, and with two dialogs open Esc closed both. Now shortcuts wait and Esc closes the top one.
30
+ - Messages about a file changed outside Onionskin said "open both in Word" for every kind of file. They now name Excel or PowerPoint, or "your editor" for an HTML page. HTML pages no longer offer "Download my edits" or "Download a copy", which did nothing for them.
31
+ - A Send whose answer was lost could show "Checking whether this was sent..." forever when Onionskin kept answering with an error. It now shows the error.
32
+ - Voice guide: a suggestion answered "Not now" never came back once Onionskin had kept its maximum number of your edits. Offering an open HTML page as a writing sample now says "HTML pages are not used as writing samples." instead of a general failure.
33
+ - Install, update and stop:
34
+ - When an `onionskin` command it did not make was already in place, the installer noticed only after the new copy was in place. It now checks before it stops or replaces anything.
35
+ - A home folder whose path holds a dollar sign, a backtick or a double quote got an `onionskin` command that did not run.
36
+ - When setting up the agent skill failed, the install still ended as if all went well. It now says "the app is installed. Run 'onionskin setup' to finish installing the skill.", and `onionskin update` ends with "UPDATED (with warning)".
37
+ - The installer refuses a download that holds a symbolic link.
38
+ - `onionskin stop` printed "stopped" even when the server was still running after 5 seconds. It now says "did not stop within 5s" and exits with an error. It also stops a server that answers but does not match this copy's version of the connection rules, and removes a record left by a server that is gone ("no running server (stale record removed)"). `onionskin update` stops with "Not updated: could not stop the running Onionskin server" when the server will not stop.
39
+ - An empty start lock left by a crash kept the server from starting. When the server cannot start, the message now gives its reason.
40
+ - Words you type are kept in more places:
41
+ - Stamps, the voice guide editor, "Load a voice guide" and "Build my voice guide": words typed after pressing Save or Ask the agent, while that request was still on its way, were not saved. The fields now wait until it finishes.
42
+ - Writing preferences: words typed before the preferences finished loading were cleared when they loaded. They now stay.
43
+ - Quick ask: reloading or closing the page with unsent words in the box lost them without asking. The page now asks first.
44
+ - Quick ask: tapping a stamp sent only the stamp's words and dropped what you had typed. Your words now follow the stamp's.
45
+ - Excel: an agent edit that would turn text into a number and lose part of it is refused, and the file is left as it was. Before, removing "ID-" from "ID-00123" saved the number 123. See Known issues.
46
+ - Two installs or updates running at the same moment could each remove the other's copy, and `onionskin` then did not start. The second one now says "Another Onionskin install or update is running. Try again when it finishes." and changes nothing.
47
+ - `onionskin stop` printed "stopped" when no server was running. It now says "no server was running".
48
+ - Voice guide drafts: a web address without "https://" whose name is written in letters from rare scripts slipped past the link rule. It is now refused.
49
+ - More places where words you type are kept: a suggestion card no longer lets you type words it would drop; "Load a voice guide" and "Build my voice guide" wait for a file that is still loading; a late answer no longer closes a different voice dialog; stamps and Writing preferences wait for their first load, so a save can no longer replace what was stored; and words typed after "Clear preferences" stay.
50
+ - The page asks before you leave with unsaved edits in the stamp editor or the voice guide editor.
51
+ - A stamp tapped with a long Quick ask that would pass the 5,000-character limit together is not sent; the box stays open with your words.
52
+ - If copying fails on the "Something went wrong" screen, your unsent comments are shown in a box to select and copy.
53
+ - Excel: a date that does not exist (such as "31/02/2026"), or one with a time that does not exist, written into a date cell is refused. Before, it was saved as a later date.
54
+ - Install and update:
55
+ - A download that is incomplete is no longer put in place: the new copy has to start and print its version first. The copy you had keeps working.
56
+ - A voice guide kept in the installed app folder is carried into the new version by an update. Before, the update deleted it.
57
+ - From this version on, `onionskin update` does not turn on the deeper checks when the copy it replaces had none. The update from 0.0.5 to 0.0.6 is still run by 0.0.5 and turns them on.
58
+ - Setting up the deeper checks, and the npm route of `onionskin update`, give up after 10 minutes instead of waiting forever. The install itself still succeeds.
59
+ - `onionskin stop` no longer removes the lock of a server that started less than two seconds ago.
60
+ - A stuck deeper check that is stopped by force no longer leaves LibreOffice running.
61
+ - An agent poll whose connection closed while its batch was being prepared no longer takes the batch with it.
62
+ - A lock file that cannot be read no longer holds the server forever; the write fails with the usual "busy" message after five seconds.
63
+
64
+ ### Changed
65
+ - An agent question that holds an email address or "mailto:", or a web address hidden behind look-alike dots or invisible characters, is refused. The comment shows "The agent asked a question that could not be shown." Voice guide drafts refuse the same hidden addresses.
66
+ - The deeper checks install exact versions of their Python libraries, each checked against a fixed SHA-256 hash, as ready-built packages only. They need Python 3.9 or newer.
67
+ - The install command is now `curl -fsSL --proto "=https" --proto-redir "=https" "$RELEASE/get.sh" | ONIONSKIN_BASE_URL="$RELEASE" sh`, so the download and any redirect use https only.
68
+ - `onionskin update` saves the release's `get.sh` to a private file before running it, and gives up after 6 minutes: "Not updated: the installer timed out after 6 minutes."
69
+ - The oldest macOS expected to work is now 13.1, with Safari 16.2 or newer for the editor. The installer says so below 13.1 and continues.
70
+ - On a phone, the button that opens the review panel says Review instead of Send.
71
+ - `onionskin update` refuses to go on while a server from another version of Onionskin is running, because it may hold unsent work. Run `onionskin stop` first, or `onionskin update --force`.
72
+ - Two options of an agent question that differ only by an invisible character count as the same option and the question is refused.
73
+
74
+ ### Known issues
75
+ - A comment on repeated text that mixes letters with built-in accents and letters followed by a separate accent mark can land one copy early.
76
+ - An Office file with extra bytes between its table of contents and its end record, plus extra bytes after the end, is refused (0.0.5 opened it). Two crafted file shapes can make Onionskin read a different table of contents than other tools do.
77
+ - A comment draft made or deleted at the moment a Send is on its way can be back in its old state after a reload, if the save that carried it was lost as well. The page asks before you leave in that case.
78
+ - An agent question with "mailto:" in its words, or a word, an at sign and a number with a dot in it (such as "Meet" followed by "@5.30"), is refused.
79
+ - `onionskin stop` can wait 5 seconds and exit with an error when a record left by a server that is gone points to a process number now used by another program with "onionskin" in its command line.
80
+ - During `onionskin update`, Ctrl-\ is not passed to the installer, and a character split across two pieces of its output can print garbled.
81
+ - When the Python on your Mac is too old for the deeper checks and its pip is old too, turning them on says only "Deeper checks could not be turned on. Try again, or ask your agent to look into it."
82
+ - Excel: an agent cannot yet write a value with leading zeros (such as "00123"), or a number too long to be stored exactly, into a cell as text. The edit is refused with the reason; before 0.0.6 it was saved as a number and the zeros were lost. Typing such a value into a plain cell yourself drops the zeros, as Excel does.
83
+ - If an install is cut off by a crash or a power loss, a later install or update can say "Another Onionskin install or update is running." The message names the folder to delete.
84
+ - Word: when the words you selected overlap an earlier copy of themselves in the same paragraph (the last "ana" in "banana"), an agent's replacement can land on the earlier copy.
85
+ - Excel: an agent cannot edit a sheet whose cells are saved without their own addresses. The edit is refused with the reason; before 0.0.6 clearing a cell there moved the rest of its row one place to the left.
86
+ - If a lock left by a crashed install is present and two installs then start at the same moment, both can run and `onionskin` may not start. Installing again repairs it.
87
+ - While a document is locked by another program, a write can hold the server for up to five seconds.
88
+ - A few rare file shapes are read differently than Word, PowerPoint or Excel read them: a paragraph's tab-stop setting counts as one character, both branches of an alternate-content block are read, shared text stored under an unusual part name is not read, and old-style encoded part names are shown wrong.
89
+ - HTML: when a page that is not UTF-8 is converted, a charset tag shown as example text inside a text box near the top of the page is rewritten as well.
90
+ - HTML: a `data-charset` attribute on a meta tag can be taken for the page's encoding. The UTF-8 copy Onionskin offers then shows wrong letters; the original file is not touched.
91
+ - A voice guide in the app folder that is a link to another file is not carried into a new version; the old app folder is left in place with a line saying so. With two tabs on one file, words in a Quick ask box that is open when the other tab takes over editing are not handed over.
92
+ - At the limit of 500 comments, words in a Quick ask box that was opened before the limit was reached are lost when you send them. A tab that has become read-only does not ask before you leave it.
93
+ - Not tried on real machines: Node 22.0 and 22.1 (the fix above was tested by running without the function they lack), macOS 13.0 and Safari 16.
94
+ - Still open from 0.0.5:
95
+ - With three or more windows open on one file and notes handed between them, a sentence can appear twice in the note box. Nothing is lost, and the repeat is visible in the box before you send.
96
+ - HTML files: a whole-file edit by an agent can move an existing script or event handler to the next element of the same kind in the same place; it cannot add or change one. On a very large element (more than 400 text parts), the first keystroke right after a click can be missed.
97
+ - HTML files, not in this version: sites of several files, pages built by scripts, inline SVG and MathML (shown as placeholders), and Review first, stamps, quick fixes and the tracked-changes copy. Chrome is the tested browser; Safari has not been tested with HTML files.
98
+ - On very long Word files that carry no paragraph ids (some exports from other editors), a comment whose paragraph moved and whose surrounding words were also edited can show as "moved or removed" more often than in 0.0.3. The comment is kept.
99
+ - HTML: if a page with unsent text fixes is changed outside Onionskin into an encoding Onionskin refuses, the unsent fixes are dropped when the refusal is shown.
100
+
3
101
  ## 0.0.5 (2026-11-17)
4
102
 
5
103
  ### Added
package/README.md CHANGED
@@ -28,7 +28,7 @@ To open Terminal: press Command-Space, type `Terminal`, then press Return.
28
28
 
29
29
  ```sh
30
30
  RELEASE=https://github.com/abe238/onionskin/releases/latest/download
31
- curl -fsSL "$RELEASE/get.sh" | ONIONSKIN_BASE_URL="$RELEASE" sh
31
+ curl -fsSL --proto "=https" --proto-redir "=https" "$RELEASE/get.sh" | ONIONSKIN_BASE_URL="$RELEASE" sh
32
32
  ```
33
33
 
34
34
  **npm** (if you already use npm)
@@ -105,7 +105,7 @@ The simplest way: tell your agent "update Onionskin". Or run this in Terminal:
105
105
  onionskin update
106
106
  ```
107
107
 
108
- `onionskin update` is new in 0.0.4. On 0.0.3 or older (`onionskin --version` shows yours), paste the install sentence into your agent again, or with npm run the two npm commands in the table below. Either brings the latest release.
108
+ `onionskin update` is new in 0.0.5. On 0.0.3 or older (`onionskin --version` shows yours), paste the install sentence into your agent again, or with npm run the two npm commands in the table below. Either brings the latest release.
109
109
 
110
110
  `onionskin update` updates your copy the way it was installed, the app and the skill together, and keeps your snapshots. `onionskin update --check` only says whether a newer release exists. If Terminal says the command is not found, run `~/.local/bin/onionskin update`.
111
111
 
@@ -135,7 +135,7 @@ You were asked to install Onionskin. Run this as one shell command from any fold
135
135
 
136
136
  ```sh
137
137
  RELEASE=https://github.com/abe238/onionskin/releases/latest/download
138
- curl -fsSL "$RELEASE/get.sh" | ONIONSKIN_BASE_URL="$RELEASE" sh
138
+ curl -fsSL --proto "=https" --proto-redir "=https" "$RELEASE/get.sh" | ONIONSKIN_BASE_URL="$RELEASE" sh
139
139
  onionskin doctor # if "command not found", run ~/.local/bin/onionskin doctor
140
140
  ```
141
141
 
@@ -193,7 +193,7 @@ Limits: 10 MB and 200,000 elements, UTF-8 only. Chrome is the tested browser. De
193
193
  - Claude Code or Codex, already installed and signed in. The terminal start needs Claude Code; with Codex, you start from inside it.
194
194
  - For quick fixes only: macOS 26 or later, Apple silicon and Apple Intelligence turned on. Without it, grammar fixes go to your agent.
195
195
 
196
- Limits: macOS only so far. This is a pre-release (0.0.5) and has been tested by one person. No Windows, no Linux, no real-time collaboration. Files up to about 1,600 Word pages, 1,000,000 Excel cells, 50,000 PowerPoint shapes or 10 MB of HTML: the full list is in [Size limits](docs/GUIDE.md#size-limits).
196
+ Limits: macOS only so far. This is a pre-release (0.0.6) and has been tested by one person. No Windows, no Linux, no real-time collaboration. Files up to about 1,600 Word pages, 1,000,000 Excel cells, 50,000 PowerPoint shapes or 10 MB of HTML: the full list is in [Size limits](docs/GUIDE.md#size-limits).
197
197
 
198
198
  ## Privacy
199
199
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onionskin-cli",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Edit Word, Excel, PowerPoint and HTML files in the browser and send the batch to a coding agent.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,7 +11,7 @@ Environment: ONIONSKIN_SOFFICE (path to soffice), ONIONSKIN_NO_SOFFICE=1, ONIONS
11
11
  Run it with `python -I` so nothing from the current directory is imported. Parts are read with lxml, entity resolution and
12
12
  network access off, DTD and ENTITY declarations refused (defusedxml's rule).
13
13
  """
14
- import collections, json, os, re, shutil, signal, subprocess, sys, tempfile, time, zipfile
14
+ import collections, json, os, pathlib, re, shutil, signal, subprocess, sys, tempfile, time, zipfile
15
15
 
16
16
  try:
17
17
  from lxml import etree
@@ -48,10 +48,16 @@ def read_part(z, name):
48
48
  info = z.getinfo(name)
49
49
  if info.file_size > MAX_PART:
50
50
  raise ValueError(f'{name} is larger than {MAX_PART} bytes')
51
- data = z.read(name)
51
+ with z.open(name) as f:
52
+ data = f.read(MAX_PART + 1)
53
+ if len(data) > MAX_PART:
54
+ raise ValueError(f'{name} is larger than {MAX_PART} bytes')
52
55
  if re.search(rb'<!(DOCTYPE|ENTITY)', data[:65536]):
53
56
  raise ValueError(f'{name} declares a DTD or entity')
54
- return etree.fromstring(data, parser())
57
+ root = etree.fromstring(data, parser())
58
+ if root.getroottree().docinfo.doctype:
59
+ raise ValueError(f'{name} declares a DTD or entity')
60
+ return root
55
61
 
56
62
 
57
63
  def short(qn):
@@ -222,10 +228,18 @@ def soffice_convert(soffice, path, timeout, to='pdf'):
222
228
  tmp = tempfile.mkdtemp(prefix='onionskin-soffice-')
223
229
  try:
224
230
  # private profile so a LibreOffice the user has open is never touched; own process group so a hang can be killed whole
225
- cmd = [soffice, f'-env:UserInstallation=file://{tmp}/profile', '--headless', '--norestore', '--convert-to', to, '--outdir', tmp, path]
226
- p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, start_new_session=True)
231
+ cmd = [soffice, f'-env:UserInstallation={pathlib.Path(os.path.abspath(tmp)).as_uri()}/profile', '--headless', '--norestore', '--convert-to', to, '--outdir', tmp, path]
232
+ pid_file = os.environ.get('ONIONSKIN_SOFFICE_PID_FILE') if os.name == 'posix' else None
233
+ if pid_file:
234
+ # Wait for registration before exec. If the checker dies first, EOF ends the new group.
235
+ cmd = ['/bin/sh', '-c', 'IFS= read -r ready || exit 1; exec "$@"', 'soffice', *cmd]
236
+ p = subprocess.Popen(cmd, stdin=subprocess.PIPE if pid_file else None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, start_new_session=True)
227
237
  CURRENT.append(p)
228
238
  try:
239
+ if pid_file:
240
+ pathlib.Path(pid_file).write_text(f'{p.pid}\n', encoding='ascii')
241
+ p.stdin.write(b'\n')
242
+ p.stdin.flush()
229
243
  deadline = time.monotonic() + timeout
230
244
  while True:
231
245
  try:
@@ -240,6 +254,11 @@ def soffice_convert(soffice, path, timeout, to='pdf'):
240
254
  p.communicate()
241
255
  return {'ok': False, 'timeout': True, 'error': f'timeout after {timeout}s'}
242
256
  finally:
257
+ if p.poll() is None:
258
+ kill_current()
259
+ p.wait()
260
+ if pid_file:
261
+ pathlib.Path(pid_file).unlink(missing_ok=True)
243
262
  CURRENT.clear()
244
263
  pdf = os.path.join(tmp, os.path.splitext(os.path.basename(path))[0] + '.' + to)
245
264
  size = os.path.getsize(pdf) if os.path.exists(pdf) else 0