dorico-bridge 0.3.1__tar.gz
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.
- dorico_bridge-0.3.1/LICENSE +21 -0
- dorico_bridge-0.3.1/PKG-INFO +323 -0
- dorico_bridge-0.3.1/README.md +311 -0
- dorico_bridge-0.3.1/dorico_bridge/__init__.py +4 -0
- dorico_bridge-0.3.1/dorico_bridge/catalog.py +157 -0
- dorico_bridge-0.3.1/dorico_bridge/cli.py +527 -0
- dorico_bridge-0.3.1/dorico_bridge/contribute.py +419 -0
- dorico_bridge-0.3.1/dorico_bridge/diff.py +95 -0
- dorico_bridge-0.3.1/dorico_bridge/dtn.py +268 -0
- dorico_bridge-0.3.1/dorico_bridge/edit.py +426 -0
- dorico_bridge-0.3.1/dorico_bridge/knowledge.py +130 -0
- dorico_bridge-0.3.1/dorico_bridge/layout.py +272 -0
- dorico_bridge-0.3.1/dorico_bridge/live.py +610 -0
- dorico_bridge-0.3.1/dorico_bridge/lyrics.py +491 -0
- dorico_bridge-0.3.1/dorico_bridge/mcp_server.py +706 -0
- dorico_bridge-0.3.1/dorico_bridge/model.py +299 -0
- dorico_bridge-0.3.1/dorico_bridge/privacy.py +211 -0
- dorico_bridge-0.3.1/dorico_bridge/ranges.py +164 -0
- dorico_bridge-0.3.1/dorico_bridge/rc_runner.py +46 -0
- dorico_bridge-0.3.1/dorico_bridge/setup.py +208 -0
- dorico_bridge-0.3.1/dorico_bridge/workflows.py +333 -0
- dorico_bridge-0.3.1/dorico_bridge.egg-info/PKG-INFO +323 -0
- dorico_bridge-0.3.1/dorico_bridge.egg-info/SOURCES.txt +35 -0
- dorico_bridge-0.3.1/dorico_bridge.egg-info/dependency_links.txt +1 -0
- dorico_bridge-0.3.1/dorico_bridge.egg-info/entry_points.txt +3 -0
- dorico_bridge-0.3.1/dorico_bridge.egg-info/requires.txt +3 -0
- dorico_bridge-0.3.1/dorico_bridge.egg-info/top_level.txt +1 -0
- dorico_bridge-0.3.1/pyproject.toml +22 -0
- dorico_bridge-0.3.1/setup.cfg +4 -0
- dorico_bridge-0.3.1/tests/test_contribute.py +85 -0
- dorico_bridge-0.3.1/tests/test_layout_tokens.py +24 -0
- dorico_bridge-0.3.1/tests/test_lyrics_rules.py +49 -0
- dorico_bridge-0.3.1/tests/test_mcp_tools.py +44 -0
- dorico_bridge-0.3.1/tests/test_reservation.py +65 -0
- dorico_bridge-0.3.1/tests/test_setup.py +36 -0
- dorico_bridge-0.3.1/tests/test_system_layout.py +66 -0
- dorico_bridge-0.3.1/tests/test_velocity.py +74 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kamil Barański
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dorico-bridge
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Read, analyse and edit Dorico projects, drive a running Dorico, and learn new Dorico features (CLI, library, MCP server).
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Provides-Extra: mcp
|
|
10
|
+
Requires-Dist: mcp; extra == "mcp"
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
|
|
13
|
+
# dorico-bridge
|
|
14
|
+
|
|
15
|
+
Tools that let scripts and AI agents work with Steinberg Dorico projects: read and analyse them, edit
|
|
16
|
+
them safely, drive a running Dorico, and learn new parts of Dorico as they go.
|
|
17
|
+
|
|
18
|
+
The file-format knowledge comes from the separate specification
|
|
19
|
+
[**dorico-file-format**](https://github.com/kamilbaranskicom/dorico-file-format) (SPEC.md). Capabilities here cite its property ids.
|
|
20
|
+
|
|
21
|
+
## Who it is for
|
|
22
|
+
|
|
23
|
+
- **Arrangers, copyists and engravers** who want checks Dorico does not do for them: every note outside an
|
|
24
|
+
instrument's range with a ranked fix, lyrics that differ between voices that sing together, broken or
|
|
25
|
+
wrong word division, syllables that print under no note, what each layout's headers will actually print.
|
|
26
|
+
- **Anyone with repetitive Dorico chores**: export the PDFs of every layout of a project in one command,
|
|
27
|
+
change one Layout Options value in all part layouts, transpose a whole project and verify every note.
|
|
28
|
+
- **People who work with an AI assistant** (Claude, Gemini, local models): the bridge is an MCP server, so the
|
|
29
|
+
assistant can read your project, change a copy and check the result instead of guessing.
|
|
30
|
+
- **Developers** who need to read or write `.dorico` files: a dependency-free Python reader and writer that
|
|
31
|
+
round-trips projects byte for byte.
|
|
32
|
+
|
|
33
|
+
## Try it in five minutes (Dorico does not need to be running)
|
|
34
|
+
|
|
35
|
+
The file layer needs only Python 3.10 or newer: no Hammerspoon, no Remote Control, any operating system.
|
|
36
|
+
It never changes the project you give it.
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
pipx install git+https://github.com/kamilbaranskicom/dorico-bridge
|
|
40
|
+
dorico-bridge info MyProject.dorico # bars, time signature, players, instrument ranges
|
|
41
|
+
dorico-bridge ranges MyProject.dorico # notes out of range, grouped into phrases, with fixes
|
|
42
|
+
dorico-bridge lyrics MyProject.dorico hyphenation # broken word division (add --language pl for Polish rules)
|
|
43
|
+
dorico-bridge layout MyProject.dorico list # every layout: page size, bar numbers, page template set
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For example, on a small test project from the specification:
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
$ dorico-bridge notes F02-flute.dorico
|
|
50
|
+
Flute 1:1 C5 dur 1
|
|
51
|
+
Flute 1:2 D5 dur 1/2
|
|
52
|
+
Flute 1:2.50 E5 dur 1/2
|
|
53
|
+
Flute 1:3 F#5 dur 2
|
|
54
|
+
Flute 2:1 G5 dur 4
|
|
55
|
+
$ dorico-bridge layout F08-chords.dorico list
|
|
56
|
+
Full score kFullScoreLayout A4 594x841 bars kEverySystem pageset.fullscore
|
|
57
|
+
Piano kPartLayout A4 594x841 bars kEveryBar pageset.part
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
On macOS the system `python3` may be older than 3.10; install a current Python from
|
|
61
|
+
[python.org](https://www.python.org/downloads/) or with Homebrew (`brew install python pipx`).
|
|
62
|
+
|
|
63
|
+
### What works where
|
|
64
|
+
|
|
65
|
+
| | macOS | Windows | Linux |
|
|
66
|
+
|---|---|---|---|
|
|
67
|
+
| File layer (read, check, edit copies) | yes | yes | yes |
|
|
68
|
+
| Remote Control API (commands, status) | yes | should work, not yet tested | (no Dorico) |
|
|
69
|
+
| Menus and dialogs, PDF export, transposition, learning | yes (Hammerspoon) | not yet: [help wanted](https://github.com/kamilbaranskicom/dorico-bridge/issues?q=is%3Aissue+is%3Aopen+label%3Awindows) | (no Dorico) |
|
|
70
|
+
|
|
71
|
+
Questions, ideas and "can it do X?" go to
|
|
72
|
+
[Discussions](https://github.com/kamilbaranskicom/dorico-bridge/discussions); bugs to
|
|
73
|
+
[Issues](https://github.com/kamilbaranskicom/dorico-bridge/issues).
|
|
74
|
+
|
|
75
|
+
## How it works
|
|
76
|
+
|
|
77
|
+
Three layers, from safest to most powerful:
|
|
78
|
+
|
|
79
|
+
1. **File layer** (Python only, any OS): reads and edits `.dorico` files directly, using the published
|
|
80
|
+
format specification. Edits always go to a new file; you open it in Dorico and check the result.
|
|
81
|
+
2. **Live layer**: drives a running Dorico through its Remote Control API (a local WebSocket, any OS) and,
|
|
82
|
+
on macOS, through menus and dialogs with Hammerspoon. Every step is confirmed in Dorico's log.
|
|
83
|
+
3. **Learning**: when the bridge cannot do something, you show it once in Dorico; it records the commands
|
|
84
|
+
and the file changes and drafts a new capability. Sharing what it learned is optional.
|
|
85
|
+
|
|
86
|
+
The same functions are available as a command line (`dorico-bridge ...`), a Python library and an MCP
|
|
87
|
+
server, so AI agents (Claude, other assistants, local models) can use them.
|
|
88
|
+
|
|
89
|
+
## What it can do
|
|
90
|
+
|
|
91
|
+
`dorico-bridge caps` (CLI) or the `capabilities` MCP tool lists everything, with status and the Dorico
|
|
92
|
+
version it was tested in:
|
|
93
|
+
|
|
94
|
+
| Layer | Examples |
|
|
95
|
+
|---|---|
|
|
96
|
+
| **file** (no Dorico needed) | project summary; Layout Options (bar numbers, page size, ...) and Project Info, read and change; what headers print (tokens resolved); notes with displayed bar:beat; range check with ranked fixes (octave, swap within section, reassign); compare transpositions; system/frame breaks; rehearsal-mark suffixes; chord-symbol visibility; simplified chord symbols for chosen players; octave shifts; lyrics (compare voices, broken hyphenation, typos, syllables without a note, language-dependent division of sung words, fix/move/delete a syllable); tree dump and diff |
|
|
97
|
+
| **live** (Dorico running) | open / close / save / export PDF; any Dorico command; switch layout; drive any dialog by control id; Write › Transpose by interval; **transpose a whole project, verify every note and check ranges** in one call |
|
|
98
|
+
| **learn** | menu tree; dialog inspection (every control and option); recording what the user does (commands from Dorico's log); command names from the application files; tree diff of before/after files; guided learning sessions; notes; sharing what was learned as a pull request (optional) |
|
|
99
|
+
|
|
100
|
+
Status: `verified` (tested end to end), `implemented` (parts tested), `recipe` (done before by hand or by
|
|
101
|
+
project scripts, spec ids given, not yet a function), `learned` (discovered at run time).
|
|
102
|
+
|
|
103
|
+
## Example: the agent task "transpose down a minor third, check ranges, propose fixes"
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
dorico-bridge transpose-score Song.dorico m3 down --base ~/dorico-bridge-hs
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
1. copies `Song.dorico` to `Song_TR-m3.dorico` (the original is never touched);
|
|
110
|
+
2. opens the copy in Dorico and switches to the full score (projects can open in a part);
|
|
111
|
+
3. switches to Galley View, where every instrument has its own staff (Dorico does not edit condensed
|
|
112
|
+
staves; `--editable condensing` switches condensing off instead), and back to Page View afterwards;
|
|
113
|
+
4. Write › Transpose, interval set through the dialog's "Calculate interval" fields;
|
|
114
|
+
5. saves (confirmed by `File.Save` in Dorico's log), reads the file and checks that every pitched note moved by exactly −3 semitones;
|
|
115
|
+
6. runs the range check: every note outside an instrument's range, grouped into phrases, with fixes.
|
|
116
|
+
|
|
117
|
+
Output: JSON report + text report, e.g.
|
|
118
|
+
`[ERROR] Bassoon 2 bars 42-50 in REF1: 9 note(s) out of range Bb1-A4 … Move Bassoon 2 bars 42-51 an octave up`.
|
|
119
|
+
|
|
120
|
+
## Layouts, headers and Project Info
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
dorico-bridge layout Song.dorico list # page size, bar numbers, page template set
|
|
124
|
+
dorico-bridge layout Song.dorico get "Violin I" barNumberLayoutOptions
|
|
125
|
+
dorico-bridge layout Song.dorico set kPartLayout barNumberLayoutOptions/barNumberFrequency kEveryBar --out Song_v2.dorico
|
|
126
|
+
dorico-bridge layout Song.dorico page-size "Full score" A3 --landscape --out Song_v2.dorico
|
|
127
|
+
dorico-bridge layout Song.dorico headers "Full score" # text frames, tokens resolved from Project Info
|
|
128
|
+
dorico-bridge project-info Song.dorico --set "composer=..." --out Song_v2.dorico
|
|
129
|
+
dorico-bridge export-pdfs Song_v2.dorico ~/check --base ~/dorico-bridge-hs # PDFs of a copy into ~/check
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Any Layout Options value can be read and changed by its path (names as stored, close to the dialog's).
|
|
133
|
+
Tokens (`{@flowComposer@}`, `{@projectTitle@}`, `{@layoutName@}`, ...) are resolved the way Dorico does it
|
|
134
|
+
for Project Info, layout and player tokens; others (date and time, page count) are listed as unresolved.
|
|
135
|
+
|
|
136
|
+
## Lyrics
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
dorico-bridge lyrics Song.dorico compare --players Soprano,Alto,Tenor # where voices that sing together differ
|
|
140
|
+
dorico-bridge lyrics Song.dorico orphans # syllables that print but belong to no note
|
|
141
|
+
dorico-bridge lyrics Song.dorico move --event 32488 --to-next-note --out Song_v2.dorico
|
|
142
|
+
dorico-bridge lyrics Song.dorico delete --event 28297 --out Song_v2.dorico
|
|
143
|
+
dorico-bridge lyrics Song.dorico hyphenation --language pl --ignore excelsis
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`hyphenation` always reports words whose syllable types are broken. With `--language` it also lists
|
|
147
|
+
divisions that are wrong in that language under any convention: in Polish (`pl`) a split letter pair
|
|
148
|
+
(*c-z*, *s-z*, *r-z*, *c-h*, *d-z* except after a prefix such as *od-*) or a part with no vowel. Sung text
|
|
149
|
+
often follows a stricter convention than dictionary hyphenation; in Polish choral practice, dividing after a
|
|
150
|
+
vowel (*prę-dko*, *wię-kszy*, where dictionaries also allow *pręd-ko*, *więk-szy*). `--strict` lists those
|
|
151
|
+
differences too, as suggestions. Change both syllables with `lyrics set`; skip words in another language
|
|
152
|
+
with `--ignore`. Rules live in `lyrics.HYPHENATION_RULES`: add a language there, with a test in `tests/`.
|
|
153
|
+
|
|
154
|
+
## Install
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
pipx install git+https://github.com/kamilbaranskicom/dorico-bridge # or: git clone ... && pip install -e ".[mcp]"
|
|
158
|
+
pipx inject dorico-bridge mcp # only for AI assistants (MCP server)
|
|
159
|
+
dorico-bridge setup --check # what is ready and what is missing (changes nothing)
|
|
160
|
+
dorico-bridge setup # folders, Hammerspoon hook on macOS (backup of init.lua), Dorico script file
|
|
161
|
+
dorico-bridge setup --mcp . # also .mcp.json for MCP clients in this folder
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Then, once: turn on Remote Control in Dorico's Preferences and click "Allow" when the bridge first connects;
|
|
165
|
+
on macOS install [Hammerspoon](https://www.hammerspoon.org/) and allow it Accessibility. The file layer
|
|
166
|
+
needs none of this.
|
|
167
|
+
|
|
168
|
+
**Updates:** `dorico-bridge update --check` lists new changes; `dorico-bridge update` installs them (a git
|
|
169
|
+
checkout is fast-forwarded, together with a dorico-file-format checkout next to it; a pip install is
|
|
170
|
+
upgraded). Nothing updates by itself.
|
|
171
|
+
|
|
172
|
+
**Windows:** the file layer and the Remote Control API work; menus and dialogs (Hammerspoon on macOS) are
|
|
173
|
+
not available yet. The likely route is Windows UI Automation (e.g. pywinauto, or AutoHotkey). Help welcome.
|
|
174
|
+
|
|
175
|
+
### Manual setup (macOS)
|
|
176
|
+
|
|
177
|
+
**Live control** uses [Hammerspoon](https://www.hammerspoon.org/) on the Mac that runs Dorico:
|
|
178
|
+
|
|
179
|
+
1. Create a private bridge folder (e.g. `~/dorico-bridge-hs`). In `~/.hammerspoon/init.lua`:
|
|
180
|
+
```lua
|
|
181
|
+
DORICO_BRIDGE_BASE = "/Users/you/dorico-bridge-hs"
|
|
182
|
+
dofile("/path/to/dorico-bridge/hammerspoon/runner.lua")
|
|
183
|
+
```
|
|
184
|
+
The runner executes every `jobs/*.lua` file once; **anyone who can write to that folder can run code
|
|
185
|
+
on your Mac**, so keep it private.
|
|
186
|
+
2. A menu-bar icon shows what the bridge is doing: 🎼 waiting, 🎼● working in Dorico (hands off the
|
|
187
|
+
keyboard and mouse), 🎼⏸ paused. Its menu pauses the bridge (queued work waits, nothing new is sent to
|
|
188
|
+
Dorico) and chooses the screen on which the bridge places the Dorico windows it opens.
|
|
189
|
+
3. In Dorico, run a small Lua file once with *Script › Run Script…*; the bridge then uses
|
|
190
|
+
*Run Last Script* to execute commands (pass that file as `--dorico-script`).
|
|
191
|
+
4. Grant Hammerspoon Accessibility permission.
|
|
192
|
+
|
|
193
|
+
Dorico's Remote Control API is used for status, flows, layouts, the official command list (with parameter
|
|
194
|
+
names) and commands. It listens on 127.0.0.1 only, so the bridge runs its client on the Mac through
|
|
195
|
+
Hammerspoon (`dorico-bridge live remote getstatus`, MCP `dorico_remote`). Turn it on in Dorico's
|
|
196
|
+
Preferences and click "Allow" once; the session token is kept in `~/.dorico-bridge/session.json`.
|
|
197
|
+
|
|
198
|
+
## MCP server
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
DORICO_BRIDGE_HS_BASE=/path/to/bridge dorico-bridge-mcp # or: python3 -m dorico_bridge.mcp_server
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The server needs the `mcp` package (`pipx inject dorico-bridge mcp`). `dorico-bridge setup --mcp DIR` writes a
|
|
205
|
+
ready `.mcp.json`; other MCP clients (Claude Desktop, Gemini CLI, Cursor, ...) take the same `mcpServers`
|
|
206
|
+
entry in their own settings file, see [`.mcp.json.example`](.mcp.json.example).
|
|
207
|
+
|
|
208
|
+
Optional: `DORICO_BRIDGE_HS_MAC_BASE`, `DORICO_BRIDGE_HS_MODULE`, `DORICO_BRIDGE_DORICO_SCRIPT` (when the
|
|
209
|
+
agent runs in a VM that sees the folder under another path), `DORICO_BRIDGE_PATH_MAP=<local>=<mac>`,
|
|
210
|
+
`DORICO_BRIDGE_KNOWLEDGE` (knowledge folder, default `~/.dorico-bridge/knowledge`).
|
|
211
|
+
|
|
212
|
+
Tools: `capabilities`, file tools (`project_summary`, `list_notes`, `check_ranges`, `compare_transpositions`,
|
|
213
|
+
`dump_tree`, `shift_notes`, `add_breaks`, `set_chord_symbols`, `diff_projects`), live tools
|
|
214
|
+
(`dorico_open`, `dorico_close_all`, `dorico_save`, `dorico_export_pdf`, `dorico_command`,
|
|
215
|
+
`dorico_switch_layout`, `dorico_dialog`, `dorico_transpose`, `transpose_score`), learning tools
|
|
216
|
+
(`learn_menu_tree`, `find_menu`, `learn_dialog`, `learn_command_names`, `find_commands`, `record_start`,
|
|
217
|
+
`record_stop`, `learn_begin`, `learn_end`, `add_note`, `contribute`), lyrics tools (`lyrics_check`,
|
|
218
|
+
`lyrics_compare_reference`, `lyrics_set_syllable`, `lyrics_move_syllable`, `lyrics_delete_syllable`).
|
|
219
|
+
|
|
220
|
+
## Using it with AI agents
|
|
221
|
+
|
|
222
|
+
Any MCP client can use the bridge (`dorico-bridge setup --mcp DIR` writes the configuration). Agent
|
|
223
|
+
instructions are in [AGENTS.md](AGENTS.md); step-by-step procedures in `.claude/skills/*/SKILL.md` are plain
|
|
224
|
+
Markdown. Without an MCP client, `examples/ollama_agent.py` lets a local model (Ollama) call the same tools;
|
|
225
|
+
qwen3:30b answered layout questions and changed a layout option correctly with all 46 tools offered.
|
|
226
|
+
|
|
227
|
+
### Claude Code
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
Both repositories carry a `CLAUDE.md` (principles, map, common tasks) and project skills in
|
|
231
|
+
`.claude/skills/`: `dorico-task` (do a task safely and verify it), `learn-dorico-feature` (teach the
|
|
232
|
+
bridge something new) and `contribute` (share it as a pull request, optional); in dorico-file-format `add-format-property` and `check-dorico-version`. Copy
|
|
233
|
+
`.mcp.json.example` to `.mcp.json`, fill in your paths, and Claude Code gets the MCP tools in this folder.
|
|
234
|
+
A typical request: *"Teach the bridge to hide empty staves in the full score"* - Claude runs
|
|
235
|
+
`learn_begin`, asks you to do it once in Dorico, reads the finding, and turns it into a property, a
|
|
236
|
+
check and a capability.
|
|
237
|
+
|
|
238
|
+
## Learning something new
|
|
239
|
+
|
|
240
|
+
The bridge is built to be extended by the agent that uses it:
|
|
241
|
+
|
|
242
|
+
0. **Guided**: `dorico-bridge learn begin PROJECT NAME` → do the one thing in Dorico → `learn end NAME`
|
|
243
|
+
writes `_learning/NAME/FINDING.md` (commands with parameters, tree diff, draft spec entry, checklist).
|
|
244
|
+
1. **Find the UI**: `find_menu("condens")`, `learn_dialog(["Library","Layout Options..."], "Layout Options")`.
|
|
245
|
+
2. **Find the command**: `record_start` → the user does it once by hand → `record_stop` gives the
|
|
246
|
+
command with its parameters; `find_commands("Layout")` searches known names.
|
|
247
|
+
3. **Find the data**: save before and after, `diff_projects` shows the changed tree paths. Write the finding
|
|
248
|
+
into dorico-file-format as a new property (status Hypothesis), with a check.
|
|
249
|
+
4. **Make it repeatable**: `dorico_dialog(...)` / `dorico_command(...)` for live steps, or a file edit;
|
|
250
|
+
once it works, add a function and a catalog entry (status verified, Dorico version).
|
|
251
|
+
|
|
252
|
+
## Sharing what you taught the bridge (optional)
|
|
253
|
+
|
|
254
|
+
Whatever the bridge learns works on your computer at once; nothing is sent anywhere. If you want others to
|
|
255
|
+
have it too, open a pull request:
|
|
256
|
+
|
|
257
|
+
```sh
|
|
258
|
+
dorico-bridge contribute hide-empty-staves # checks only, shows what would be sent
|
|
259
|
+
dorico-bridge contribute hide-empty-staves --yes # branch learn/hide-empty-staves, commit, push, PR
|
|
260
|
+
dorico-bridge contribute NAME --repo ../dorico-file-format # spec changes live in the other repository
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Before anything is sent the changes must pass: the tests (`tests/`, and `experiments/run.py --fixtures`
|
|
264
|
+
in dorico-file-format), English-only messages and documentation, no Dorico projects except new fixtures,
|
|
265
|
+
no tokens, session files or personal paths, at most 3 MB per file and 10 MB in total. The title and the
|
|
266
|
+
description come from the session's FINDING.md (the score.dtn diff only with `--include-diff`, because it
|
|
267
|
+
can contain the music of the project you used). Without write access the bridge forks the repository
|
|
268
|
+
with the GitHub CLI (`gh auth login` once). Pull requests run the same checks on GitHub
|
|
269
|
+
(`.github/workflows/checks.yml`). Claude Code: skill `/contribute`.
|
|
270
|
+
|
|
271
|
+
## Contributing
|
|
272
|
+
|
|
273
|
+
The bridge and the format specification grow with every Dorico user who teaches them something. See
|
|
274
|
+
[CONTRIBUTING.md](CONTRIBUTING.md). In short: `learn begin` / `learn end`, turn the finding into a function
|
|
275
|
+
and a test, `dorico-bridge contribute NAME --yes`. Shared changes describe Dorico and its format, never
|
|
276
|
+
your music: `contribute` refuses titles, names, lyrics and projects (see `dorico-bridge private-terms`).
|
|
277
|
+
|
|
278
|
+
**No code needed** to help: run the bridge on your Dorico version and operating system and report what works,
|
|
279
|
+
or check the format specification on your version (dorico-file-format, `experiments/run.py`). Issues marked
|
|
280
|
+
[good first issue](https://github.com/kamilbaranskicom/dorico-bridge/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
|
|
281
|
+
and [help wanted](https://github.com/kamilbaranskicom/dorico-bridge/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
|
|
282
|
+
are good places to start; Windows support is the biggest open piece. Changes are listed in
|
|
283
|
+
[CHANGELOG.md](CHANGELOG.md).
|
|
284
|
+
|
|
285
|
+
## Several agents at once
|
|
286
|
+
|
|
287
|
+
One agent can review pull requests while another edits a score. Live work in Dorico is reserved by one agent
|
|
288
|
+
at a time; the file layer needs no reservation.
|
|
289
|
+
|
|
290
|
+
```sh
|
|
291
|
+
export DORICO_BRIDGE_AGENT="Gemini CLI" # who you are (MCP: also via the environment)
|
|
292
|
+
dorico-bridge live --base ~/dorico-bridge-hs reserve "fix notes in Song"
|
|
293
|
+
dorico-bridge live --base ~/dorico-bridge-hs lease # who has reserved Dorico, for what
|
|
294
|
+
dorico-bridge live --base ~/dorico-bridge-hs finish # save and close what you opened, release
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Another agent then gets, at once and without queuing: *BUSY: Gemini CLI is working in Dorico (fix notes in
|
|
298
|
+
Song) since 20:50 CET; try again in about 110 s, or use the file tools meanwhile*. The reservation is renewed
|
|
299
|
+
by every live call and expires 2 minutes after the last one; multi-step workflows (PDF export, transposition,
|
|
300
|
+
learning sessions, fixtures) reserve by themselves. The Hammerspoon runner refuses other agents' jobs too, and
|
|
301
|
+
its menu shows who works on what and can release a forgotten reservation. MCP tools: `dorico_reserve`,
|
|
302
|
+
`dorico_status`, `dorico_finish`.
|
|
303
|
+
|
|
304
|
+
## Safety rules (built in)
|
|
305
|
+
|
|
306
|
+
- File edits always write a new file; tools refuse `out_path == input`.
|
|
307
|
+
- Live workflows work on copies and refuse to run while another project is open (they never close the
|
|
308
|
+
user's work).
|
|
309
|
+
- No free typing into Dorico: keystrokes in a score are shortcuts (space = play, letters = notes). The
|
|
310
|
+
bridge types only into a dialog field after confirming the focus is there, and stops playback if an
|
|
311
|
+
action started it.
|
|
312
|
+
- Every live step is checked against Dorico's `application.log`; results are checked by reading the saved file.
|
|
313
|
+
|
|
314
|
+
See [KNOWLEDGE.md](KNOWLEDGE.md) for what was learned about driving Dorico.
|
|
315
|
+
|
|
316
|
+
## Principles
|
|
317
|
+
|
|
318
|
+
The bridge observes and drives Dorico through what any user has: its files, its menus and dialogs (macOS
|
|
319
|
+
accessibility), its scripting and Remote Control features, its log, and text that ships in the
|
|
320
|
+
application files (it reads command names from them on the user's own Mac; the list stays local). It does
|
|
321
|
+
not decompile, disassemble, debug or patch Dorico; contributions must follow the same rule. The file-format side follows the principles of dorico-file-format.
|
|
322
|
+
|
|
323
|
+
Not affiliated with Steinberg. Dorico is a trademark of Steinberg Media Technologies GmbH.
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
# dorico-bridge
|
|
2
|
+
|
|
3
|
+
Tools that let scripts and AI agents work with Steinberg Dorico projects: read and analyse them, edit
|
|
4
|
+
them safely, drive a running Dorico, and learn new parts of Dorico as they go.
|
|
5
|
+
|
|
6
|
+
The file-format knowledge comes from the separate specification
|
|
7
|
+
[**dorico-file-format**](https://github.com/kamilbaranskicom/dorico-file-format) (SPEC.md). Capabilities here cite its property ids.
|
|
8
|
+
|
|
9
|
+
## Who it is for
|
|
10
|
+
|
|
11
|
+
- **Arrangers, copyists and engravers** who want checks Dorico does not do for them: every note outside an
|
|
12
|
+
instrument's range with a ranked fix, lyrics that differ between voices that sing together, broken or
|
|
13
|
+
wrong word division, syllables that print under no note, what each layout's headers will actually print.
|
|
14
|
+
- **Anyone with repetitive Dorico chores**: export the PDFs of every layout of a project in one command,
|
|
15
|
+
change one Layout Options value in all part layouts, transpose a whole project and verify every note.
|
|
16
|
+
- **People who work with an AI assistant** (Claude, Gemini, local models): the bridge is an MCP server, so the
|
|
17
|
+
assistant can read your project, change a copy and check the result instead of guessing.
|
|
18
|
+
- **Developers** who need to read or write `.dorico` files: a dependency-free Python reader and writer that
|
|
19
|
+
round-trips projects byte for byte.
|
|
20
|
+
|
|
21
|
+
## Try it in five minutes (Dorico does not need to be running)
|
|
22
|
+
|
|
23
|
+
The file layer needs only Python 3.10 or newer: no Hammerspoon, no Remote Control, any operating system.
|
|
24
|
+
It never changes the project you give it.
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
pipx install git+https://github.com/kamilbaranskicom/dorico-bridge
|
|
28
|
+
dorico-bridge info MyProject.dorico # bars, time signature, players, instrument ranges
|
|
29
|
+
dorico-bridge ranges MyProject.dorico # notes out of range, grouped into phrases, with fixes
|
|
30
|
+
dorico-bridge lyrics MyProject.dorico hyphenation # broken word division (add --language pl for Polish rules)
|
|
31
|
+
dorico-bridge layout MyProject.dorico list # every layout: page size, bar numbers, page template set
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
For example, on a small test project from the specification:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
$ dorico-bridge notes F02-flute.dorico
|
|
38
|
+
Flute 1:1 C5 dur 1
|
|
39
|
+
Flute 1:2 D5 dur 1/2
|
|
40
|
+
Flute 1:2.50 E5 dur 1/2
|
|
41
|
+
Flute 1:3 F#5 dur 2
|
|
42
|
+
Flute 2:1 G5 dur 4
|
|
43
|
+
$ dorico-bridge layout F08-chords.dorico list
|
|
44
|
+
Full score kFullScoreLayout A4 594x841 bars kEverySystem pageset.fullscore
|
|
45
|
+
Piano kPartLayout A4 594x841 bars kEveryBar pageset.part
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
On macOS the system `python3` may be older than 3.10; install a current Python from
|
|
49
|
+
[python.org](https://www.python.org/downloads/) or with Homebrew (`brew install python pipx`).
|
|
50
|
+
|
|
51
|
+
### What works where
|
|
52
|
+
|
|
53
|
+
| | macOS | Windows | Linux |
|
|
54
|
+
|---|---|---|---|
|
|
55
|
+
| File layer (read, check, edit copies) | yes | yes | yes |
|
|
56
|
+
| Remote Control API (commands, status) | yes | should work, not yet tested | (no Dorico) |
|
|
57
|
+
| Menus and dialogs, PDF export, transposition, learning | yes (Hammerspoon) | not yet: [help wanted](https://github.com/kamilbaranskicom/dorico-bridge/issues?q=is%3Aissue+is%3Aopen+label%3Awindows) | (no Dorico) |
|
|
58
|
+
|
|
59
|
+
Questions, ideas and "can it do X?" go to
|
|
60
|
+
[Discussions](https://github.com/kamilbaranskicom/dorico-bridge/discussions); bugs to
|
|
61
|
+
[Issues](https://github.com/kamilbaranskicom/dorico-bridge/issues).
|
|
62
|
+
|
|
63
|
+
## How it works
|
|
64
|
+
|
|
65
|
+
Three layers, from safest to most powerful:
|
|
66
|
+
|
|
67
|
+
1. **File layer** (Python only, any OS): reads and edits `.dorico` files directly, using the published
|
|
68
|
+
format specification. Edits always go to a new file; you open it in Dorico and check the result.
|
|
69
|
+
2. **Live layer**: drives a running Dorico through its Remote Control API (a local WebSocket, any OS) and,
|
|
70
|
+
on macOS, through menus and dialogs with Hammerspoon. Every step is confirmed in Dorico's log.
|
|
71
|
+
3. **Learning**: when the bridge cannot do something, you show it once in Dorico; it records the commands
|
|
72
|
+
and the file changes and drafts a new capability. Sharing what it learned is optional.
|
|
73
|
+
|
|
74
|
+
The same functions are available as a command line (`dorico-bridge ...`), a Python library and an MCP
|
|
75
|
+
server, so AI agents (Claude, other assistants, local models) can use them.
|
|
76
|
+
|
|
77
|
+
## What it can do
|
|
78
|
+
|
|
79
|
+
`dorico-bridge caps` (CLI) or the `capabilities` MCP tool lists everything, with status and the Dorico
|
|
80
|
+
version it was tested in:
|
|
81
|
+
|
|
82
|
+
| Layer | Examples |
|
|
83
|
+
|---|---|
|
|
84
|
+
| **file** (no Dorico needed) | project summary; Layout Options (bar numbers, page size, ...) and Project Info, read and change; what headers print (tokens resolved); notes with displayed bar:beat; range check with ranked fixes (octave, swap within section, reassign); compare transpositions; system/frame breaks; rehearsal-mark suffixes; chord-symbol visibility; simplified chord symbols for chosen players; octave shifts; lyrics (compare voices, broken hyphenation, typos, syllables without a note, language-dependent division of sung words, fix/move/delete a syllable); tree dump and diff |
|
|
85
|
+
| **live** (Dorico running) | open / close / save / export PDF; any Dorico command; switch layout; drive any dialog by control id; Write › Transpose by interval; **transpose a whole project, verify every note and check ranges** in one call |
|
|
86
|
+
| **learn** | menu tree; dialog inspection (every control and option); recording what the user does (commands from Dorico's log); command names from the application files; tree diff of before/after files; guided learning sessions; notes; sharing what was learned as a pull request (optional) |
|
|
87
|
+
|
|
88
|
+
Status: `verified` (tested end to end), `implemented` (parts tested), `recipe` (done before by hand or by
|
|
89
|
+
project scripts, spec ids given, not yet a function), `learned` (discovered at run time).
|
|
90
|
+
|
|
91
|
+
## Example: the agent task "transpose down a minor third, check ranges, propose fixes"
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
dorico-bridge transpose-score Song.dorico m3 down --base ~/dorico-bridge-hs
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
1. copies `Song.dorico` to `Song_TR-m3.dorico` (the original is never touched);
|
|
98
|
+
2. opens the copy in Dorico and switches to the full score (projects can open in a part);
|
|
99
|
+
3. switches to Galley View, where every instrument has its own staff (Dorico does not edit condensed
|
|
100
|
+
staves; `--editable condensing` switches condensing off instead), and back to Page View afterwards;
|
|
101
|
+
4. Write › Transpose, interval set through the dialog's "Calculate interval" fields;
|
|
102
|
+
5. saves (confirmed by `File.Save` in Dorico's log), reads the file and checks that every pitched note moved by exactly −3 semitones;
|
|
103
|
+
6. runs the range check: every note outside an instrument's range, grouped into phrases, with fixes.
|
|
104
|
+
|
|
105
|
+
Output: JSON report + text report, e.g.
|
|
106
|
+
`[ERROR] Bassoon 2 bars 42-50 in REF1: 9 note(s) out of range Bb1-A4 … Move Bassoon 2 bars 42-51 an octave up`.
|
|
107
|
+
|
|
108
|
+
## Layouts, headers and Project Info
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
dorico-bridge layout Song.dorico list # page size, bar numbers, page template set
|
|
112
|
+
dorico-bridge layout Song.dorico get "Violin I" barNumberLayoutOptions
|
|
113
|
+
dorico-bridge layout Song.dorico set kPartLayout barNumberLayoutOptions/barNumberFrequency kEveryBar --out Song_v2.dorico
|
|
114
|
+
dorico-bridge layout Song.dorico page-size "Full score" A3 --landscape --out Song_v2.dorico
|
|
115
|
+
dorico-bridge layout Song.dorico headers "Full score" # text frames, tokens resolved from Project Info
|
|
116
|
+
dorico-bridge project-info Song.dorico --set "composer=..." --out Song_v2.dorico
|
|
117
|
+
dorico-bridge export-pdfs Song_v2.dorico ~/check --base ~/dorico-bridge-hs # PDFs of a copy into ~/check
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Any Layout Options value can be read and changed by its path (names as stored, close to the dialog's).
|
|
121
|
+
Tokens (`{@flowComposer@}`, `{@projectTitle@}`, `{@layoutName@}`, ...) are resolved the way Dorico does it
|
|
122
|
+
for Project Info, layout and player tokens; others (date and time, page count) are listed as unresolved.
|
|
123
|
+
|
|
124
|
+
## Lyrics
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
dorico-bridge lyrics Song.dorico compare --players Soprano,Alto,Tenor # where voices that sing together differ
|
|
128
|
+
dorico-bridge lyrics Song.dorico orphans # syllables that print but belong to no note
|
|
129
|
+
dorico-bridge lyrics Song.dorico move --event 32488 --to-next-note --out Song_v2.dorico
|
|
130
|
+
dorico-bridge lyrics Song.dorico delete --event 28297 --out Song_v2.dorico
|
|
131
|
+
dorico-bridge lyrics Song.dorico hyphenation --language pl --ignore excelsis
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
`hyphenation` always reports words whose syllable types are broken. With `--language` it also lists
|
|
135
|
+
divisions that are wrong in that language under any convention: in Polish (`pl`) a split letter pair
|
|
136
|
+
(*c-z*, *s-z*, *r-z*, *c-h*, *d-z* except after a prefix such as *od-*) or a part with no vowel. Sung text
|
|
137
|
+
often follows a stricter convention than dictionary hyphenation; in Polish choral practice, dividing after a
|
|
138
|
+
vowel (*prę-dko*, *wię-kszy*, where dictionaries also allow *pręd-ko*, *więk-szy*). `--strict` lists those
|
|
139
|
+
differences too, as suggestions. Change both syllables with `lyrics set`; skip words in another language
|
|
140
|
+
with `--ignore`. Rules live in `lyrics.HYPHENATION_RULES`: add a language there, with a test in `tests/`.
|
|
141
|
+
|
|
142
|
+
## Install
|
|
143
|
+
|
|
144
|
+
```sh
|
|
145
|
+
pipx install git+https://github.com/kamilbaranskicom/dorico-bridge # or: git clone ... && pip install -e ".[mcp]"
|
|
146
|
+
pipx inject dorico-bridge mcp # only for AI assistants (MCP server)
|
|
147
|
+
dorico-bridge setup --check # what is ready and what is missing (changes nothing)
|
|
148
|
+
dorico-bridge setup # folders, Hammerspoon hook on macOS (backup of init.lua), Dorico script file
|
|
149
|
+
dorico-bridge setup --mcp . # also .mcp.json for MCP clients in this folder
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Then, once: turn on Remote Control in Dorico's Preferences and click "Allow" when the bridge first connects;
|
|
153
|
+
on macOS install [Hammerspoon](https://www.hammerspoon.org/) and allow it Accessibility. The file layer
|
|
154
|
+
needs none of this.
|
|
155
|
+
|
|
156
|
+
**Updates:** `dorico-bridge update --check` lists new changes; `dorico-bridge update` installs them (a git
|
|
157
|
+
checkout is fast-forwarded, together with a dorico-file-format checkout next to it; a pip install is
|
|
158
|
+
upgraded). Nothing updates by itself.
|
|
159
|
+
|
|
160
|
+
**Windows:** the file layer and the Remote Control API work; menus and dialogs (Hammerspoon on macOS) are
|
|
161
|
+
not available yet. The likely route is Windows UI Automation (e.g. pywinauto, or AutoHotkey). Help welcome.
|
|
162
|
+
|
|
163
|
+
### Manual setup (macOS)
|
|
164
|
+
|
|
165
|
+
**Live control** uses [Hammerspoon](https://www.hammerspoon.org/) on the Mac that runs Dorico:
|
|
166
|
+
|
|
167
|
+
1. Create a private bridge folder (e.g. `~/dorico-bridge-hs`). In `~/.hammerspoon/init.lua`:
|
|
168
|
+
```lua
|
|
169
|
+
DORICO_BRIDGE_BASE = "/Users/you/dorico-bridge-hs"
|
|
170
|
+
dofile("/path/to/dorico-bridge/hammerspoon/runner.lua")
|
|
171
|
+
```
|
|
172
|
+
The runner executes every `jobs/*.lua` file once; **anyone who can write to that folder can run code
|
|
173
|
+
on your Mac**, so keep it private.
|
|
174
|
+
2. A menu-bar icon shows what the bridge is doing: 🎼 waiting, 🎼● working in Dorico (hands off the
|
|
175
|
+
keyboard and mouse), 🎼⏸ paused. Its menu pauses the bridge (queued work waits, nothing new is sent to
|
|
176
|
+
Dorico) and chooses the screen on which the bridge places the Dorico windows it opens.
|
|
177
|
+
3. In Dorico, run a small Lua file once with *Script › Run Script…*; the bridge then uses
|
|
178
|
+
*Run Last Script* to execute commands (pass that file as `--dorico-script`).
|
|
179
|
+
4. Grant Hammerspoon Accessibility permission.
|
|
180
|
+
|
|
181
|
+
Dorico's Remote Control API is used for status, flows, layouts, the official command list (with parameter
|
|
182
|
+
names) and commands. It listens on 127.0.0.1 only, so the bridge runs its client on the Mac through
|
|
183
|
+
Hammerspoon (`dorico-bridge live remote getstatus`, MCP `dorico_remote`). Turn it on in Dorico's
|
|
184
|
+
Preferences and click "Allow" once; the session token is kept in `~/.dorico-bridge/session.json`.
|
|
185
|
+
|
|
186
|
+
## MCP server
|
|
187
|
+
|
|
188
|
+
```sh
|
|
189
|
+
DORICO_BRIDGE_HS_BASE=/path/to/bridge dorico-bridge-mcp # or: python3 -m dorico_bridge.mcp_server
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
The server needs the `mcp` package (`pipx inject dorico-bridge mcp`). `dorico-bridge setup --mcp DIR` writes a
|
|
193
|
+
ready `.mcp.json`; other MCP clients (Claude Desktop, Gemini CLI, Cursor, ...) take the same `mcpServers`
|
|
194
|
+
entry in their own settings file, see [`.mcp.json.example`](.mcp.json.example).
|
|
195
|
+
|
|
196
|
+
Optional: `DORICO_BRIDGE_HS_MAC_BASE`, `DORICO_BRIDGE_HS_MODULE`, `DORICO_BRIDGE_DORICO_SCRIPT` (when the
|
|
197
|
+
agent runs in a VM that sees the folder under another path), `DORICO_BRIDGE_PATH_MAP=<local>=<mac>`,
|
|
198
|
+
`DORICO_BRIDGE_KNOWLEDGE` (knowledge folder, default `~/.dorico-bridge/knowledge`).
|
|
199
|
+
|
|
200
|
+
Tools: `capabilities`, file tools (`project_summary`, `list_notes`, `check_ranges`, `compare_transpositions`,
|
|
201
|
+
`dump_tree`, `shift_notes`, `add_breaks`, `set_chord_symbols`, `diff_projects`), live tools
|
|
202
|
+
(`dorico_open`, `dorico_close_all`, `dorico_save`, `dorico_export_pdf`, `dorico_command`,
|
|
203
|
+
`dorico_switch_layout`, `dorico_dialog`, `dorico_transpose`, `transpose_score`), learning tools
|
|
204
|
+
(`learn_menu_tree`, `find_menu`, `learn_dialog`, `learn_command_names`, `find_commands`, `record_start`,
|
|
205
|
+
`record_stop`, `learn_begin`, `learn_end`, `add_note`, `contribute`), lyrics tools (`lyrics_check`,
|
|
206
|
+
`lyrics_compare_reference`, `lyrics_set_syllable`, `lyrics_move_syllable`, `lyrics_delete_syllable`).
|
|
207
|
+
|
|
208
|
+
## Using it with AI agents
|
|
209
|
+
|
|
210
|
+
Any MCP client can use the bridge (`dorico-bridge setup --mcp DIR` writes the configuration). Agent
|
|
211
|
+
instructions are in [AGENTS.md](AGENTS.md); step-by-step procedures in `.claude/skills/*/SKILL.md` are plain
|
|
212
|
+
Markdown. Without an MCP client, `examples/ollama_agent.py` lets a local model (Ollama) call the same tools;
|
|
213
|
+
qwen3:30b answered layout questions and changed a layout option correctly with all 46 tools offered.
|
|
214
|
+
|
|
215
|
+
### Claude Code
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
Both repositories carry a `CLAUDE.md` (principles, map, common tasks) and project skills in
|
|
219
|
+
`.claude/skills/`: `dorico-task` (do a task safely and verify it), `learn-dorico-feature` (teach the
|
|
220
|
+
bridge something new) and `contribute` (share it as a pull request, optional); in dorico-file-format `add-format-property` and `check-dorico-version`. Copy
|
|
221
|
+
`.mcp.json.example` to `.mcp.json`, fill in your paths, and Claude Code gets the MCP tools in this folder.
|
|
222
|
+
A typical request: *"Teach the bridge to hide empty staves in the full score"* - Claude runs
|
|
223
|
+
`learn_begin`, asks you to do it once in Dorico, reads the finding, and turns it into a property, a
|
|
224
|
+
check and a capability.
|
|
225
|
+
|
|
226
|
+
## Learning something new
|
|
227
|
+
|
|
228
|
+
The bridge is built to be extended by the agent that uses it:
|
|
229
|
+
|
|
230
|
+
0. **Guided**: `dorico-bridge learn begin PROJECT NAME` → do the one thing in Dorico → `learn end NAME`
|
|
231
|
+
writes `_learning/NAME/FINDING.md` (commands with parameters, tree diff, draft spec entry, checklist).
|
|
232
|
+
1. **Find the UI**: `find_menu("condens")`, `learn_dialog(["Library","Layout Options..."], "Layout Options")`.
|
|
233
|
+
2. **Find the command**: `record_start` → the user does it once by hand → `record_stop` gives the
|
|
234
|
+
command with its parameters; `find_commands("Layout")` searches known names.
|
|
235
|
+
3. **Find the data**: save before and after, `diff_projects` shows the changed tree paths. Write the finding
|
|
236
|
+
into dorico-file-format as a new property (status Hypothesis), with a check.
|
|
237
|
+
4. **Make it repeatable**: `dorico_dialog(...)` / `dorico_command(...)` for live steps, or a file edit;
|
|
238
|
+
once it works, add a function and a catalog entry (status verified, Dorico version).
|
|
239
|
+
|
|
240
|
+
## Sharing what you taught the bridge (optional)
|
|
241
|
+
|
|
242
|
+
Whatever the bridge learns works on your computer at once; nothing is sent anywhere. If you want others to
|
|
243
|
+
have it too, open a pull request:
|
|
244
|
+
|
|
245
|
+
```sh
|
|
246
|
+
dorico-bridge contribute hide-empty-staves # checks only, shows what would be sent
|
|
247
|
+
dorico-bridge contribute hide-empty-staves --yes # branch learn/hide-empty-staves, commit, push, PR
|
|
248
|
+
dorico-bridge contribute NAME --repo ../dorico-file-format # spec changes live in the other repository
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Before anything is sent the changes must pass: the tests (`tests/`, and `experiments/run.py --fixtures`
|
|
252
|
+
in dorico-file-format), English-only messages and documentation, no Dorico projects except new fixtures,
|
|
253
|
+
no tokens, session files or personal paths, at most 3 MB per file and 10 MB in total. The title and the
|
|
254
|
+
description come from the session's FINDING.md (the score.dtn diff only with `--include-diff`, because it
|
|
255
|
+
can contain the music of the project you used). Without write access the bridge forks the repository
|
|
256
|
+
with the GitHub CLI (`gh auth login` once). Pull requests run the same checks on GitHub
|
|
257
|
+
(`.github/workflows/checks.yml`). Claude Code: skill `/contribute`.
|
|
258
|
+
|
|
259
|
+
## Contributing
|
|
260
|
+
|
|
261
|
+
The bridge and the format specification grow with every Dorico user who teaches them something. See
|
|
262
|
+
[CONTRIBUTING.md](CONTRIBUTING.md). In short: `learn begin` / `learn end`, turn the finding into a function
|
|
263
|
+
and a test, `dorico-bridge contribute NAME --yes`. Shared changes describe Dorico and its format, never
|
|
264
|
+
your music: `contribute` refuses titles, names, lyrics and projects (see `dorico-bridge private-terms`).
|
|
265
|
+
|
|
266
|
+
**No code needed** to help: run the bridge on your Dorico version and operating system and report what works,
|
|
267
|
+
or check the format specification on your version (dorico-file-format, `experiments/run.py`). Issues marked
|
|
268
|
+
[good first issue](https://github.com/kamilbaranskicom/dorico-bridge/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
|
|
269
|
+
and [help wanted](https://github.com/kamilbaranskicom/dorico-bridge/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
|
|
270
|
+
are good places to start; Windows support is the biggest open piece. Changes are listed in
|
|
271
|
+
[CHANGELOG.md](CHANGELOG.md).
|
|
272
|
+
|
|
273
|
+
## Several agents at once
|
|
274
|
+
|
|
275
|
+
One agent can review pull requests while another edits a score. Live work in Dorico is reserved by one agent
|
|
276
|
+
at a time; the file layer needs no reservation.
|
|
277
|
+
|
|
278
|
+
```sh
|
|
279
|
+
export DORICO_BRIDGE_AGENT="Gemini CLI" # who you are (MCP: also via the environment)
|
|
280
|
+
dorico-bridge live --base ~/dorico-bridge-hs reserve "fix notes in Song"
|
|
281
|
+
dorico-bridge live --base ~/dorico-bridge-hs lease # who has reserved Dorico, for what
|
|
282
|
+
dorico-bridge live --base ~/dorico-bridge-hs finish # save and close what you opened, release
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Another agent then gets, at once and without queuing: *BUSY: Gemini CLI is working in Dorico (fix notes in
|
|
286
|
+
Song) since 20:50 CET; try again in about 110 s, or use the file tools meanwhile*. The reservation is renewed
|
|
287
|
+
by every live call and expires 2 minutes after the last one; multi-step workflows (PDF export, transposition,
|
|
288
|
+
learning sessions, fixtures) reserve by themselves. The Hammerspoon runner refuses other agents' jobs too, and
|
|
289
|
+
its menu shows who works on what and can release a forgotten reservation. MCP tools: `dorico_reserve`,
|
|
290
|
+
`dorico_status`, `dorico_finish`.
|
|
291
|
+
|
|
292
|
+
## Safety rules (built in)
|
|
293
|
+
|
|
294
|
+
- File edits always write a new file; tools refuse `out_path == input`.
|
|
295
|
+
- Live workflows work on copies and refuse to run while another project is open (they never close the
|
|
296
|
+
user's work).
|
|
297
|
+
- No free typing into Dorico: keystrokes in a score are shortcuts (space = play, letters = notes). The
|
|
298
|
+
bridge types only into a dialog field after confirming the focus is there, and stops playback if an
|
|
299
|
+
action started it.
|
|
300
|
+
- Every live step is checked against Dorico's `application.log`; results are checked by reading the saved file.
|
|
301
|
+
|
|
302
|
+
See [KNOWLEDGE.md](KNOWLEDGE.md) for what was learned about driving Dorico.
|
|
303
|
+
|
|
304
|
+
## Principles
|
|
305
|
+
|
|
306
|
+
The bridge observes and drives Dorico through what any user has: its files, its menus and dialogs (macOS
|
|
307
|
+
accessibility), its scripting and Remote Control features, its log, and text that ships in the
|
|
308
|
+
application files (it reads command names from them on the user's own Mac; the list stays local). It does
|
|
309
|
+
not decompile, disassemble, debug or patch Dorico; contributions must follow the same rule. The file-format side follows the principles of dorico-file-format.
|
|
310
|
+
|
|
311
|
+
Not affiliated with Steinberg. Dorico is a trademark of Steinberg Media Technologies GmbH.
|