revise 3.0.0 → 3.1.0
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/CHANGELOG.md +66 -0
- package/README.md +56 -71
- package/chunks/{chunk-ZLQVPMBN.js → chunk-SCNG3PKR.js} +582 -61
- package/cli-output.schema.json +114 -6
- package/cli.js +313 -88
- package/document.d.ts +98 -18
- package/index.d.ts +2 -2
- package/index.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **`--blocks` on `changes`, `accept`, and `reject`.** Select tracked
|
|
8
|
+
changes by block: ids (`--blocks a1B2c3,d4E5f6`) or a range in document
|
|
9
|
+
order (`--blocks a1B2c3..d4E5f6`). Ids of list items, table cells, and
|
|
10
|
+
paragraphs inside them work. In the library: `{ blocks: [...] }`, with
|
|
11
|
+
ranges as `{ from, to }`.
|
|
12
|
+
- **`--view tracked|accepted|original`** on `read`, `grep`, `search`,
|
|
13
|
+
`export`, and `convert`. `read` now shows pending changes inline as
|
|
14
|
+
`<del>` and `<ins>` with their change ids and authors; `grep` and `search`
|
|
15
|
+
find text on both sides of a change and say which side it's on. `export`
|
|
16
|
+
and `convert` with `--view original` write the document as it was before
|
|
17
|
+
every pending change. `--final` still means `--view accepted`.
|
|
18
|
+
- **`replace-all --ignore-case` and `--exact`.**
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- **`replace-text` is now `replace-all`** (`replaceAll` in the library). It
|
|
23
|
+
replaces in page headers and footers and in footnotes and endnotes as well
|
|
24
|
+
as the body, and says where. Curly and straight quotes, no-break and plain
|
|
25
|
+
spaces, and no-break and plain hyphens match each other unless `--exact`,
|
|
26
|
+
and the replacement keeps the document's characters: `"net 30"` →
|
|
27
|
+
`"net 45"` keeps its no-break space. Matches it leaves alone, like other
|
|
28
|
+
capitalization, are reported as `nearMisses`. `replace-text` and
|
|
29
|
+
`replaceText` still work, and JSON output run under `replace-text` still
|
|
30
|
+
names it.
|
|
31
|
+
- **`--section` is a heading and everything under it.** `--section 8`
|
|
32
|
+
includes 8.1 and 8.2. Numbers match whether typed or Word's automatic
|
|
33
|
+
numbering. A title matches in full, or by text in only one heading; text in
|
|
34
|
+
several headings is an error (`section_ambiguous`), and a section that
|
|
35
|
+
doesn't exist is `section_not_found` instead of an empty result.
|
|
36
|
+
- **Clearer flag names:** `new --content` (was `--from`), `new --page-size`
|
|
37
|
+
(was `--page`), `search --results-page` (was `--page`), and `--blocks` for
|
|
38
|
+
block ids on `read` and `replace-all` (was `--ids`). The old names still
|
|
39
|
+
work.
|
|
40
|
+
- **`changes` lists header, footer, and note changes as such** ("Header",
|
|
41
|
+
"Footnote 1"), with their text.
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
|
|
45
|
+
- **Word-numbered headings.** Headings numbered by Word's heading styles, how
|
|
46
|
+
most contracts number clauses, are headings again: `outline` lists them
|
|
47
|
+
with their numbers ("8.1 Cap on liability") and `--section 8` finds them.
|
|
48
|
+
- **Comparing numbered documents.** Two copies of the same numbered document
|
|
49
|
+
compare as unchanged, instead of every numbered clause deleted and
|
|
50
|
+
reinserted.
|
|
51
|
+
- **Comparing against a file revise edited.** A one-word edit compares as a
|
|
52
|
+
one-word change, not a whole paragraph replaced: editing a paragraph no
|
|
53
|
+
longer adds fonts and sizes to it or its neighbors.
|
|
54
|
+
- **Tracked changes in headers and footers** are saved as Word revisions, and
|
|
55
|
+
ones made in Word open as pending changes.
|
|
56
|
+
- **Markdown export** numbers nested list items per level (8.1 was written
|
|
57
|
+
as "9."), and writes numbered headings as headings: `## 8.1 Cap on
|
|
58
|
+
liability`.
|
|
59
|
+
|
|
60
|
+
## 3.0.1
|
|
61
|
+
|
|
62
|
+
### Fixed
|
|
63
|
+
|
|
64
|
+
- **Windows-1252 text on Node 20.** Text that isn't UTF-8, like a .txt file
|
|
65
|
+
from a Windows editor piped to `convert`, and RTF files read € “ ” ‘ ’ – —
|
|
66
|
+
and the other characters Windows-1252 stores in bytes 0x80–0x9F as
|
|
67
|
+
invisible control characters. Node 22 and later were not affected.
|
|
68
|
+
|
|
3
69
|
## 3.0.0
|
|
4
70
|
|
|
5
71
|
The first release of `revise` as a command-line tool and TypeScript library
|
package/README.md
CHANGED
|
@@ -1,119 +1,104 @@
|
|
|
1
1
|
# revise
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
from the command line or from TypeScript. Edits land as tracked changes, with
|
|
5
|
-
comments, review, and undo, and untouched content is written back to the
|
|
6
|
-
.docx byte for byte. Built for AI agents and the programs that run them.
|
|
3
|
+
Read, edit, and redline Word documents from the command line or TypeScript.
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
```bash
|
|
6
|
+
npm i -g revise # or: npx revise <command>
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
AI agents using `revise` can edit documents several times faster. Paste this into your agent:
|
|
9
10
|
|
|
10
11
|
```text
|
|
11
12
|
Read https://revise.io/skills/cli.md and follow it.
|
|
12
13
|
```
|
|
13
14
|
|
|
14
|
-
##
|
|
15
|
+
## CLI
|
|
15
16
|
|
|
16
17
|
```bash
|
|
17
|
-
|
|
18
|
+
revise outline contract.docx # headings with block ranges
|
|
19
|
+
revise read contract.docx 0 # blocks as HTML, with ids
|
|
20
|
+
revise replace-all contract.docx "Provider" "Northstar" # a tracked change, saved in place
|
|
21
|
+
revise replace-all contract.docx "net 30" "net 45" --author "Legal bot" --out v2.docx
|
|
22
|
+
revise changes contract.docx # what's pending
|
|
23
|
+
revise accept contract.docx --all
|
|
24
|
+
revise reject contract.docx --section 8
|
|
25
|
+
revise undo contract.docx
|
|
26
|
+
revise compare v1.docx v2.docx --out redline.docx
|
|
27
|
+
revise export contract.docx contract.pdf # .docx .pdf .md .html .txt
|
|
28
|
+
cat notes.md | revise convert - notes.docx
|
|
18
29
|
```
|
|
19
30
|
|
|
20
|
-
Node 20 or newer. No account, API key, or telemetry, and documents never
|
|
21
|
-
leave your machine. Two things fetch over the network: PDF export downloads
|
|
22
|
-
its fonts from revise.io, and an image you insert by URL is downloaded.
|
|
23
|
-
|
|
24
|
-
## The CLI
|
|
25
|
-
|
|
26
|
-
Every command names its file. Edits save the file in place.
|
|
27
|
-
|
|
28
31
|
```bash
|
|
29
|
-
revise
|
|
30
|
-
revise
|
|
31
|
-
revise
|
|
32
|
-
revise
|
|
33
|
-
revise reject contract.docx --section 8 # review by section
|
|
34
|
-
revise export contract.docx contract.pdf # .docx .pdf .md .html .txt
|
|
35
|
-
revise compare v1.docx v2.docx --out redline.docx # redline two versions
|
|
36
|
-
revise undo contract.docx
|
|
32
|
+
revise tools # every editing tool
|
|
33
|
+
revise call contract.docx set_header_footer '{"side":"footer","center":"Page {PAGE} of {PAGES}"}'
|
|
34
|
+
revise status contract.docx --json # one versioned JSON object
|
|
35
|
+
revise examples # more
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
comments, footnotes, styles, headers and footers…) and `revise call` runs
|
|
41
|
-
one with JSON input. `--author "Legal bot"` signs tracked changes, `--out
|
|
42
|
-
copy.docx` saves an edit as a new file, and `-` reads or writes a pipe
|
|
43
|
-
(`cat notes.md | revise convert - notes.docx`). `--json` on any command prints
|
|
44
|
-
one versioned object ([contract](https://revise.io/developer/docs/revise/json)).
|
|
45
|
-
`revise examples` shows more.
|
|
38
|
+
[JSON output contract](https://revise.io/developer/docs/revise/json)
|
|
46
39
|
|
|
47
40
|
## Agent skills
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
| Codex, ChatGPT desktop | `codex plugin marketplace add reviseio/skills`, then `codex plugin add revise@revise` |
|
|
56
|
-
| Cursor, Copilot, Windsurf, Cline… | `npx skills add reviseio/skills --skill revise` |
|
|
57
|
-
| Anything else | `revise skill install` (into `.agents/skills` or `.claude/skills`), or `revise skill` to print it |
|
|
58
|
-
|
|
59
|
-
Building a browser editor instead? The `revise-editor` skill covers
|
|
60
|
-
[`@reviseio/editor`](https://www.npmjs.com/package/@reviseio/editor):
|
|
61
|
-
`npx skills add reviseio/skills --skill revise-editor`.
|
|
42
|
+
```bash
|
|
43
|
+
claude plugin marketplace add reviseio/skills && claude plugin install revise@revise # Claude Code
|
|
44
|
+
codex plugin marketplace add reviseio/skills && codex plugin add revise@revise # Codex
|
|
45
|
+
npx skills add reviseio/skills --skill revise # Cursor, Copilot, Windsurf…
|
|
46
|
+
revise skill install # anything else
|
|
47
|
+
```
|
|
62
48
|
|
|
63
|
-
##
|
|
49
|
+
## Library
|
|
64
50
|
|
|
65
51
|
```ts
|
|
66
52
|
import { ReviseDocument } from "revise";
|
|
67
53
|
|
|
68
54
|
const doc = await ReviseDocument.open("contract.docx", { author: "Legal bot" });
|
|
69
|
-
await doc.
|
|
55
|
+
await doc.replaceAll("Provider", "Northstar");
|
|
70
56
|
await doc.reject({ section: "8" });
|
|
71
|
-
const { bytes
|
|
57
|
+
const { bytes } = await doc.export({ format: "docx" });
|
|
72
58
|
doc.dispose();
|
|
73
59
|
```
|
|
74
60
|
|
|
75
|
-
|
|
61
|
+
Give the editing tools to a model:
|
|
76
62
|
|
|
77
63
|
```ts
|
|
78
64
|
import Anthropic from "@anthropic-ai/sdk";
|
|
79
65
|
import { ReviseDocument, agentTools } from "revise";
|
|
80
66
|
|
|
81
67
|
const doc = await ReviseDocument.open("brief.docx");
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
68
|
+
const agent = agentTools(doc, { provider: "anthropic" }); // or "openai"
|
|
69
|
+
const reply = await new Anthropic().messages.create({
|
|
70
|
+
model,
|
|
71
|
+
max_tokens,
|
|
72
|
+
messages,
|
|
73
|
+
tools: agent.tools,
|
|
74
|
+
});
|
|
75
|
+
const results = await Promise.all(
|
|
76
|
+
reply.content.filter((b) => b.type === "tool_use").map(agent.handle),
|
|
77
|
+
);
|
|
78
|
+
messages.push(
|
|
79
|
+
{ role: "assistant", content: reply.content },
|
|
80
|
+
{ role: "user", content: results },
|
|
81
|
+
);
|
|
86
82
|
```
|
|
87
83
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
Seed a sync server's room from a file, and edit or export the live room:
|
|
84
|
+
Edit a live collaboration room (Y.js):
|
|
91
85
|
|
|
92
86
|
```ts
|
|
93
87
|
import { ReviseDocument, seedYDoc } from "revise";
|
|
94
88
|
|
|
95
|
-
|
|
96
|
-
await seedYDoc(room, "contract.docx");
|
|
97
|
-
|
|
89
|
+
await seedYDoc(room, "contract.docx"); // safe on every connection
|
|
98
90
|
const doc = await ReviseDocument.fromYDoc(room, { author: "Review bot" });
|
|
99
|
-
await doc.
|
|
100
|
-
/* ... */
|
|
101
|
-
});
|
|
91
|
+
await doc.replaceAll("draft", "final");
|
|
102
92
|
const { bytes } = await doc.export({ format: "docx" });
|
|
103
93
|
```
|
|
104
94
|
|
|
105
|
-
|
|
106
|
-
[`@reviseio/editor`](https://www.npmjs.com/package/@reviseio/editor).
|
|
107
|
-
|
|
108
|
-
## Docs
|
|
95
|
+
## Links
|
|
109
96
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
- [Changelog](https://revise.io/developer/docs/revise/changelog)
|
|
97
|
+
[Docs](https://revise.io/developer/docs/revise/introduction) ·
|
|
98
|
+
[Changelog](https://revise.io/developer/docs/revise/changelog) ·
|
|
99
|
+
[Browser editor (`@reviseio/editor`)](https://www.npmjs.com/package/@reviseio/editor)
|
|
114
100
|
|
|
115
101
|
## License
|
|
116
102
|
|
|
117
|
-
MIT.
|
|
118
|
-
|
|
119
|
-
including commercial, under its own license.
|
|
103
|
+
MIT. Runs on [`@reviseio/engine`](https://www.npmjs.com/package/@reviseio/engine),
|
|
104
|
+
free for any use under its own license.
|