@ubercode/channelvault 0.2.1 → 0.3.0-rc.2
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 +38 -0
- package/README.md +26 -7
- package/dist/cli.js +836 -190
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +124 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@ubercode/channelvault` are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the version follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
4
4
|
|
|
5
|
+
## [0.3.0-rc.2] — 2026-11-27
|
|
6
|
+
|
|
7
|
+
Release candidate, published under the npm `next` tag.
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- `push` and `restore` refuse a configuration holding a character XML 1.0 forbids (C0 controls other than tab and line breaks, U+FFFE, U+FFFF, unpaired surrogates) before the backup and before any save, naming the resource, the line and column, and the tree file. Mirth saves such a character, but then cannot export its configuration (HTTP 500), so every later pull, diff, push and restore fails until the resource is fixed in the Administrator. `push --plan-only` lists it under what would stop the push, `diff` and `status` warn about it, and `status --json` lists it as `xmlForbiddenChars`.
|
|
12
|
+
- A scoped `push --deploy` redeploys the channels it saved even when refreshing the local sync baseline afterwards fails, then reports that failure. When the server cannot export its configuration, each saved channel and code template is read back on its own first, and one changed again on the server is not redeployed; saved libraries and global scripts cannot be read singly and are reported as unchecked. When it does not redeploy (a save failed, or a pushed resource changed again on the server), it names the channels it did not redeploy. When the server cannot export its configuration after a push, the message says that restore and the printed undo command fail too until the server is fixed.
|
|
13
|
+
|
|
14
|
+
## [0.3.0-rc.1] — 2026-11-27
|
|
15
|
+
|
|
16
|
+
Release candidate, published under the npm `next` tag.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **A tree is bound to the server installation it was pulled from.** `pull` records Mirth's installation ID, and `push` refuses a tree from a different or unknown installation, even with `--force`: revision numbers from another server say nothing about this one. A tree pulled with an earlier version has no installation ID, so it needs a fresh pull (with a merge) or `adopt` before its next push. The ID is taken as Mirth gives it: a generated UUID, or any one-line name an admin set in `appdata/server.id` (such as `mirth-gov`), up to 255 characters. A pull whose installation changes while it reads the server is refused.
|
|
21
|
+
- Configuration-map entries are addressed by key, not position (see Fixed). An entry in `channelvault.allow.json` that allowed a finding in a configuration-map field (such as an entry's comment) no longer matches and must be added again.
|
|
22
|
+
- A scoped push reports the channels it redeployed, skipped and failed to redeploy separately, and refuses a redeploy whose deployment status it cannot read.
|
|
23
|
+
- Tree commands hold a lock on the tree, so two commands cannot change it at once.
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- `adopt <dir>`: makes a reviewed tree the baseline for another server (promotion) without writing to that server. It keeps the tree's content and placeholders, takes the destination's revisions, leaves destination-only resources alone, and has `--plan-only` and a confirmation.
|
|
28
|
+
- `implode` and `push` pick up new channel, library and channel-group directories without a hand-edit to `server/configuration.json`, including renamed directories. Incomplete new resources and copied ids are refused.
|
|
29
|
+
- README: a short procedure for the first production use.
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- `pull` and `explode` keep the previous tree until its replacement is complete, and an interrupted run is recovered (from a journal) before the next command reads the tree.
|
|
34
|
+
- `push` and `restore` recheck each resource just before writing or deleting it, and recheck the whole server after taking the backup, so edits made on the server meanwhile are refused instead of overwritten. A scoped push rechecks each channel's deployment just before redeploying it, so a channel an operator undeployed stays undeployed.
|
|
35
|
+
- Saving the code template library list no longer unassigns templates created on the server since the pull; deleting a library that holds such templates is refused.
|
|
36
|
+
- A live configuration that is empty or not shaped like one (an HTTP 200 carrying an error) is refused instead of replacing a healthy tree or feeding a push plan.
|
|
37
|
+
- The printed undo command after a push or restore is complete: it keeps the connection and TLS options and the backup directory, repeats `--overwrite-config-map` when it was used, and quotes arguments for the shell. `--overwrite-config-map` is refused on a scoped push.
|
|
38
|
+
- `diff` and the push plan compare a code template's context types as a set (Mirth lists them in a different order on each server), and treat a channel's tags and dependency links as the same whether null or absent. A tree pulled from one server no longer shows every library and channel as modified against another.
|
|
39
|
+
- A re-pull no longer gives configuration-map entries each other's placeholders after an earlier entry is removed from the server. Entries were addressed by position, so each one after the removed entry inherited its neighbour's placeholder name (the values in the env file stayed with the right entry). Entries are now addressed by key. A tree pulled with an affected version keeps the wrong names on re-pull: pull it into a fresh directory to regenerate them.
|
|
40
|
+
|
|
5
41
|
## [0.2.1] — 2026-09-29
|
|
6
42
|
|
|
7
43
|
### Fixed
|
|
@@ -35,6 +71,8 @@ First release. Tested against Mirth Connect 4.5.2; the offline round trip is als
|
|
|
35
71
|
- `backup` / `restore`: the server's own configuration XML saved as `.backup/<server>-<UTC time>.xml`, identified by Mirth's server ID, restored with a preview, an undo backup and a version check. `push` backs up first unless `--no-backup`.
|
|
36
72
|
- `diff` exits 0 when the tree matches the server, 1 when it differs, 2 on error.
|
|
37
73
|
|
|
74
|
+
[0.3.0-rc.2]: https://github.com/MichaelLeeHobbs/channelvault/releases/tag/v0.3.0-rc.2
|
|
75
|
+
[0.3.0-rc.1]: https://github.com/MichaelLeeHobbs/channelvault/releases/tag/v0.3.0-rc.1
|
|
38
76
|
[0.2.1]: https://github.com/MichaelLeeHobbs/channelvault/releases/tag/v0.2.1
|
|
39
77
|
[0.2.0]: https://github.com/MichaelLeeHobbs/channelvault/releases/tag/v0.2.0
|
|
40
78
|
[0.1.0]: https://github.com/MichaelLeeHobbs/channelvault/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -15,6 +15,12 @@ npm install -g @ubercode/channelvault # then: channelvault --help
|
|
|
15
15
|
npx @ubercode/channelvault --help # or run it without installing
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
0.3.0 is in release candidates, published under the `next` tag; `latest` stays on 0.2.1 until 0.3.0 is final:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
npm install -D @ubercode/channelvault@next
|
|
22
|
+
```
|
|
23
|
+
|
|
18
24
|
## How it works
|
|
19
25
|
|
|
20
26
|
Everything centers on one in-memory representation, the **canonical config**: a plain JSON object mirroring Mirth's `serverConfiguration` document. Two adapters produce it:
|
|
@@ -85,6 +91,8 @@ For scripts, CI and AI agents, `status`, `diff` and `push --plan-only` take `--j
|
|
|
85
91
|
|
|
86
92
|
`pull` and `explode` replace `server/`, `channels/`, `codeTemplates/` and `channelGroups/` in `<dir>`, so they refuse a directory that has any of those but no `channelvault.json`, an unreadable `channelvault.json`, or a `--dotenv` file inside one of those directories. All of this is checked before anything is written.
|
|
87
93
|
|
|
94
|
+
Replacement is staged with its metadata, ignore rules, secret history and env updates. The previous generation is retained until every swap completes; a failed swap rolls back the whole generation. After an interrupted process, the next tree command recovers the journal before reading the tree (use the same `--dotenv` selection; `status` accepts it too). Commands hold a working-tree lock, including readers. A live lock refuses another command; abandoned locks belonging to a dead process on this host are recovered. An unreadable lock or a lock from another host requires inspection before removal. The env file may be on another volume and is replaced through files beside it.
|
|
95
|
+
|
|
88
96
|
## Secrets and per-environment values
|
|
89
97
|
|
|
90
98
|
`explode` and `pull` keep the credentials they detect out of the tree. Detection is heuristic (see below), so review a first pull of a real server before committing it. Fields named like credentials (passwords, passphrases, passcodes, tokens, secrets, API/access/private keys, and DICOM's `keyPW`, `keyStorePW` and `trustStorePW`), and every configuration-map value, become `{{env:NAME}}` placeholders, and their values go to `<dir>/.env`, which is added to the tree's `.gitignore`. `push` and `implode` fill the placeholders back in and refuse to run if any are missing, naming each one.
|
|
@@ -112,14 +120,17 @@ channelvault push ./mirth --channel "ADT Router" # just this channel (re
|
|
|
112
120
|
channelvault push ./mirth --library Formatting --deploy # one library, then redeploy the channels using it
|
|
113
121
|
```
|
|
114
122
|
|
|
115
|
-
- **Copies**:
|
|
116
|
-
- **Deletions** (a channel directory or template you removed) need `--allow-deletes`. Something created on the server since your last pull is never treated as a deletion; `push` leaves it alone and says so.
|
|
123
|
+
- **Copies**: `implode`, `diff`, and `push` discover new `channels/<folder>/channel.json`, `codeTemplates/<folder>/library.json`, and `channelGroups/<name>.json` files; no manual skeleton reference is needed. Code sidecars are still included through their `@file` markers. Every channel, library and code template is saved by its `id`, and a copied directory keeps its source's. Give each copy a new UUID and name, and give copied templates new IDs too. Duplicate IDs and resource paths outside the tree are refused. `push` also refuses a save under a name another channel holds (case-insensitive), even one a delete or rename in the same push frees: push that delete or rename first.
|
|
124
|
+
- **Deletions** (a channel directory or template you removed) need `--allow-deletes`. Something created on the server since your last pull is never treated as a deletion; `push` leaves it alone and says so. Library saves retain server-only templates and their membership, including with `--force`. Deleting a library containing unfamiliar templates is refused; pull and review them first.
|
|
117
125
|
- **Conflicts**: if the server's copy has a newer revision than your tree (someone saved it in the Administrator since your last pull), `push` refuses. Pull, merge in git, and push again, or pass `--force`.
|
|
118
|
-
|
|
126
|
+
Push rechecks its plan after the backup and checks each resource immediately before saving or deleting it. These checks include content changes and revision resets, and library-list saves check every library. Restore and whole-server push also recheck after their backup. The check and write are separate API requests: use a single-writer change window to exclude Administrator edits and other deployment clients during production writes.
|
|
127
|
+
- **Installation baseline**: `pull` records Mirth's installation ID. Push refuses a different or unknown installation even with `--force`; revision numbers from another server are unrelated. For promotion, copy the tree, select destination credentials with `--dotenv`, review `channelvault adopt ./mirth --dotenv .env.prod --plan-only`, then run the same command with `--yes` instead of `--plan-only`. Adoption writes no server resources: it preserves local content and placeholders, captures destination revisions and the global-script baseline, and leaves destination-only resources unfamiliar. It rechecks the target before committing the local baseline. Review `push --plan-only` again before pushing. Older trees without an installation ID require a fresh pull with a merge, or this explicit adoption.
|
|
128
|
+
- **Snapshots**: live reads require the configuration wrapper, an engine version, and a valid channels collection. Present library, template and group collections are checked too. Empty or malformed success responses are refused before tree replacement or push planning; valid empty collections and plugin fields are preserved.
|
|
129
|
+
- **`--deploy`** redeploys the channels that changed and the channels a changed code-template library is enabled for, but only those deployed when planning and still deployed immediately before their redeploy. Channels taken down during the push are skipped and reported. Status-read failures prevent that channel's redeploy and are reported per channel. Keep a single-writer change window: Mirth's status check and deployment are separate requests.
|
|
119
130
|
- After a push the tree's revision numbers are updated from the server, so `diff` and the next `push` stay clean.
|
|
120
131
|
- Server settings, the configuration map, channel groups and tags are **not** pushed; `push` names them if they differ. `--whole-server` replaces the entire server configuration instead. It shows the same change list and needs the same `--allow-deletes` / `--force`, and it can't be combined with `--channel` or `--library`.
|
|
121
132
|
- A tree exploded from an XML backup is refused (its shape differs from the live API's); `--ignore-origin` overrides that.
|
|
122
|
-
- Before it changes anything, `push` backs up the server (see below) and prints the `
|
|
133
|
+
- Before it changes anything, `push` backs up the server (see below) and prints a configuration undo command with the original target, TLS options, user and backup directory. It includes `--overwrite-config-map` when the push overwrites that map. Passwords are omitted; supply the server's credential through `MIRTH_PASS`. `--no-backup` skips the backup. Backups do not capture runtime deployment state; review targeted redeployment separately after a configuration undo.
|
|
123
134
|
- Without a terminal, `push` needs `--yes`.
|
|
124
135
|
- `--plan-only` shows the plan and what would stop it, and changes nothing: no prompt, no backup, no writes. It works without a terminal.
|
|
125
136
|
|
|
@@ -143,10 +154,18 @@ channelvault restore .backup/vns-gov-20260925T143012Z.xml --deploy
|
|
|
143
154
|
- The preview says when the restore changes the server's name. `push --whole-server` does too.
|
|
144
155
|
- A backup from a newer Mirth version is refused; an older one is converted by the server.
|
|
145
156
|
- It previews the channels and templates it creates, changes and deletes, and asks before continuing (`--yes` without a terminal).
|
|
146
|
-
- It saves the server's current configuration first, as a new backup, and prints the command that undoes the restore. That backup is the newest, so a second plain `restore` reverts the
|
|
157
|
+
- It saves the server's current configuration first, as a new backup, and prints the command that undoes the restore. That backup is the newest, so a second plain `restore` reverts the saved configuration except an overwritten configuration map: use the printed command, which repeats `--overwrite-config-map` when needed. Runtime deployment state is not captured in a configuration backup.
|
|
147
158
|
- If the server changes while you confirm, nothing is restored; run it again to review the new state.
|
|
148
159
|
- `--deploy` redeploys every channel afterwards; `--overwrite-config-map` also replaces the configuration map.
|
|
149
160
|
|
|
161
|
+
## First production use
|
|
162
|
+
|
|
163
|
+
1. Build and pin the reviewed revision. The integration suite exercises Mirth 4.5.2; rehearse on your own Mirth version and installed plugins in staging, with isolated connectors and destination credentials.
|
|
164
|
+
2. Start with `pull`, `status`, `diff` and `push --plan-only --json`. Pull into a fresh directory, or commit/stash local edits first: pull replaces configuration content and does not merge edits. Commit the resulting tree while keeping env files and backups private.
|
|
165
|
+
3. Rehearse a scoped edit and its printed configuration undo in staging. If a change overwrites the configuration map, verify that undo restores it too. Check deployed channels and message behavior separately, since configuration backups do not capture runtime state.
|
|
166
|
+
4. For the first production write, use a single-writer change window and one noncritical channel with `push --channel <name>`. Review the target and plan, keep the automatic backup, and use the normal conflict checks. Promotion to another installation requires reviewed `adopt` first.
|
|
167
|
+
5. After writing, inspect `diff` and the next push plan, and verify behavior in Mirth. Expand the scope after the pilot succeeds. A scoped push can stop after some resources are saved; inspect its applied count and failure before retrying or using the backup.
|
|
168
|
+
|
|
150
169
|
## Using channelvault with an AI agent
|
|
151
170
|
|
|
152
171
|
An agent can safely edit a tree and check its work. Pushing, restoring and anything that needs `--force` should stay with a person, who reads the plan first. Paste this into the agent instructions of your configuration repository (`AGENTS.md`, `CLAUDE.md` or similar) and adjust the paths:
|
|
@@ -171,9 +190,9 @@ MIRTH_HOST=localhost MIRTH_PORT=8443 MIRTH_USER=admin MIRTH_PASS=admin \
|
|
|
171
190
|
channelvault pull ./work --insecure
|
|
172
191
|
```
|
|
173
192
|
|
|
174
|
-
To try channelvault on a **real** configuration, use `docker compose -f docker-compose.isolated.yml up -d` instead: the same server with no outbound network (a deployed channel cannot reach anything), startup deploy off, and port 8443 on localhost only. `down` deletes it and everything in it.
|
|
193
|
+
To try channelvault on a **real** configuration, use `docker compose -f docker-compose.isolated.yml up -d` instead: the same server with no outbound network (a deployed channel cannot reach anything), startup deploy off, and port 8443 on localhost only. `down` deletes it and everything in it. It gives Mirth a 2 GB heap: with the image's default 256 MB, restoring a real configuration fails with out-of-memory errors that show only in `/opt/connect/logs/mirth.log`, not in the Administrator.
|
|
175
194
|
|
|
176
|
-
`pnpm test:integration` creates two disposable Mirth 4.5.2 servers on random localhost ports and runs two suites. The mesh suite loads the production-shaped mesh and checks that a pull converges (nothing to push, no diff) before and after scoped pushes, a redeploy and a restore. The promotion suite imports the synthetic fixture and drives the CLI through a promotion with different destination credentials and independent revision history. It verifies
|
|
195
|
+
`pnpm test:integration` creates two disposable Mirth 4.5.2 servers on random localhost ports and runs two suites. The mesh suite loads the production-shaped mesh and checks that a pull converges (nothing to push, no diff) before and after scoped pushes, a redeploy and a restore. The promotion suite imports the synthetic fixture and drives the CLI through a promotion with different destination credentials and independent revision history. It verifies installation refusal, reviewed target adoption, preserved tags and unrelated channels, and a clean repeat push. It removes its containers and network on success or failure. Docker is required; unavailable servers fail the command.
|
|
177
196
|
|
|
178
197
|
`test/integration/live.test.ts` is an optional additional suite for a disposable server you manage yourself. It runs when `MIRTH_HOST` is set; connection failures fail the suite. It writes the server configuration, so do not point it at a production or shared server.
|
|
179
198
|
|