@ubercode/channelvault 0.3.0-rc.2 → 0.3.0-rc.3

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 CHANGED
@@ -2,6 +2,25 @@
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.3] — 2026-11-27
6
+
7
+ Release candidate, published under the npm `next` tag.
8
+
9
+ ### Changed
10
+
11
+ - **Backups default to `~/.channelvault/backups`** (or `$CHANNELVAULT_CONFIG_DIR/backups`), shared by every checkout and worktree, instead of `./.backup` in the current directory. A push run from a git worktree used to leave its undo file in that worktree, where it disappeared with the worktree, and one server's backups ended up scattered across checkouts. The manifest still keeps servers apart. `--backup-dir` still overrides the folder. When the new folder has no backup of the server and `./.backup` does, restore says so. The newest 10 backups per server are now kept across all checkouts together. CI, or anything else with a throwaway or read-only home folder, should pass `--backup-dir` or set `CHANNELVAULT_CONFIG_DIR`. Two pushes that back up the same folder at the same moment can race on its manifest.
12
+
13
+ ### Added
14
+
15
+ - `restore --export-broken`, for a server that cannot export its configuration (HTTP 500, as after a pushed template held U+FFFE on Mirth 4.5.0). It restores a backup taken from this installation without a preview, an undo backup or a version check, after you type the installation ID (or pass `--yes`). It verifies the result once the export works again, and refuses to run unless the export answers HTTP 500 (a working export, a proxy timeout or a dropped connection all refuse). A plain restore that cannot read the current configuration now names this flag, and so does the message after a push whose read-back failed. It has not yet been tried against a real server with a broken export.
16
+ - After a push, channelvault names the tree files to commit with the change (the refreshed revisions and `channelvault.json`).
17
+
18
+ ### Fixed
19
+
20
+ - `diff`'s note about newer revisions on the server names `adopt` as well as `pull`, since adopt refreshes the baseline when the content already matches.
21
+ - The client never follows an HTTP redirect. A server (or anything answering on its address) that redirected the login would get the username and password re-sent to wherever it pointed, even over plain http. A redirect is now an error naming only the target's origin.
22
+ - README: the promotion steps no longer say the destination's login comes from `--dotenv`. The env file only fills the tree's placeholders; the login comes from `MIRTH_*` or the connection flags.
23
+
5
24
  ## [0.3.0-rc.2] — 2026-11-27
6
25
 
7
26
  Release candidate, published under the npm `next` tag.
@@ -71,6 +90,7 @@ First release. Tested against Mirth Connect 4.5.2; the offline round trip is als
71
90
  - `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`.
72
91
  - `diff` exits 0 when the tree matches the server, 1 when it differs, 2 on error.
73
92
 
93
+ [0.3.0-rc.3]: https://github.com/MichaelLeeHobbs/channelvault/releases/tag/v0.3.0-rc.3
74
94
  [0.3.0-rc.2]: https://github.com/MichaelLeeHobbs/channelvault/releases/tag/v0.3.0-rc.2
75
95
  [0.3.0-rc.1]: https://github.com/MichaelLeeHobbs/channelvault/releases/tag/v0.3.0-rc.1
76
96
  [0.2.1]: https://github.com/MichaelLeeHobbs/channelvault/releases/tag/v0.2.1
package/README.md CHANGED
@@ -75,7 +75,7 @@ channelvault pull <dir> # live server -> tree
75
75
  channelvault push <dir> # changed channels/templates -> live server
76
76
  channelvault diff <dir> # tree vs live server
77
77
  channelvault status <dir> # summary of a tree
78
- channelvault backup # live server -> .backup/<server>-<UTC time>.xml
78
+ channelvault backup # live server -> ~/.channelvault/backups/<server>-<UTC time>.xml
79
79
  channelvault restore [file] # backup -> live server (default: newest of this server)
80
80
  ```
81
81
 
@@ -124,7 +124,7 @@ channelvault push ./mirth --library Formatting --deploy # one library, then red
124
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.
125
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`.
126
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.
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, point the connection at the destination (`MIRTH_HOST`, `MIRTH_PORT`, `MIRTH_USER`, `MIRTH_PASS` or the connection flags; `--dotenv` supplies only the tree's placeholder values, never the login), 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
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
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.
130
130
  - After a push the tree's revision numbers are updated from the server, so `diff` and the next `push` stay clean.
@@ -139,13 +139,13 @@ channelvault push ./mirth --library Formatting --deploy # one library, then red
139
139
  `backup` saves the server's configuration exactly as the Administrator's *Backup Config* does, so the Administrator can restore it too. `restore` puts one back. They are for recovery, outside the git workflow: the tree is what you review and promote.
140
140
 
141
141
  ```
142
- channelvault backup # .backup/vns-gov-20260925T143012Z.xml
142
+ channelvault backup # ~/.channelvault/backups/vns-gov-20260925T143012Z.xml
143
143
  channelvault backup --out before-upgrade.xml # exactly this file
144
144
  channelvault restore # the newest backup of this server
145
- channelvault restore .backup/vns-gov-20260925T143012Z.xml --deploy
145
+ channelvault restore ~/.channelvault/backups/vns-gov-20260925T143012Z.xml --deploy
146
146
  ```
147
147
 
148
- - **Names.** The file is named after the server name in Server Settings, else the environment name, else the host and port, followed by the time in UTC. `.backup` is relative to the current directory; `--backup-dir` picks another.
148
+ - **Names.** The file is named after the server name in Server Settings, else the environment name, else the host and port, followed by the time in UTC. Backups go to `~/.channelvault/backups` (or `$CHANNELVAULT_CONFIG_DIR/backups`), shared by every checkout and worktree, so a push run from a worktree keeps its undo file after the worktree is removed; `--backup-dir` picks another folder. Before 0.3.0-rc.3 the default was `./.backup` in the current directory; restore names that folder when it holds backups of the server.
149
149
  - **Which server.** That name is part of the configuration, so a restore or `push --whole-server` carries it to another server. Which server a backup came from is therefore recorded by Mirth's server ID, which belongs to the installation, in the directory's `channelvault-backups.json`. Choosing, checking and rotating backups go by that ID.
150
150
  - **Plain-text credentials.** A backup holds every connector password and configuration-map value; channelvault's `{{env:…}}` placeholders don't apply. Files are readable by their owner only (on Windows they get the folder's permissions instead), and a backup directory channelvault creates contains a `.gitignore` that ignores everything in it. If git would still commit a backup, you get a warning. Keep backups off shared drives and out of CI artifacts.
151
151
  - **Rotation.** The newest 10 backups of each server are kept (`--keep` changes that); older ones are deleted. Files the manifest doesn't attribute to the server, such as ones copied in by hand, are never deleted.
@@ -157,6 +157,7 @@ channelvault restore .backup/vns-gov-20260925T143012Z.xml --deploy
157
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.
158
158
  - If the server changes while you confirm, nothing is restored; run it again to review the new state.
159
159
  - `--deploy` redeploys every channel afterwards; `--overwrite-config-map` also replaces the configuration map.
160
+ - **When the server cannot export its configuration** (HTTP 500, as after a resource holding a character XML 1.0 forbids was saved), a plain restore cannot read the current state and stops. `restore --export-broken` restores anyway: it checks the backup was taken from this installation (or needs `--force`), asks you to type the installation ID (or `--yes`), sends the backup, and verifies the result once the export works again. There is no preview, no undo backup and no version check, and it refuses to run while the export works.
160
161
 
161
162
  ## First production use
162
163
 
@@ -177,7 +178,7 @@ An agent can safely edit a tree and check its work. Pushing, restoring and anyth
177
178
 
178
179
  - Edit the `.js` and `.json` files; leave `id`, `revision`, `channelvault.json` and the `{"@file": …}` / `{"@ref": …}` markers alone. A new channel or template needs its own new UUID for `id`; a copied directory keeps the old one.
179
180
  - Mirth runs these scripts in Rhino, not Node: no `async`/`await`, optional chaining (`?.`), classes, `require`, `import` or shorthand object properties (`{ status }`; write `{ status: status }`). `let`, `const` and arrow functions work.
180
- - `{{env:NAME}}` is a placeholder for a secret kept outside git. Never replace one with a real value, and never read, print or copy `.env`, `.secrets/` or `.backup/`.
181
+ - `{{env:NAME}}` is a placeholder for a secret kept outside git. Never replace one with a real value, and never read, print or copy `.env`, `.secrets/`, `.backup/` or `~/.channelvault/backups/`.
181
182
  - Check your work with `channelvault diff mirth --json` (exit 0: matches the server, 1: differs) and `channelvault push mirth --plan-only --json`, which shows what a push would change and `wouldStop` reasons.
182
183
  - Do not run `channelvault push` (other than with `--plan-only`), `restore` or `pull`, and never pass `--force`, `--allow-deletes` or `--yes`. Summarise the plan and let a person push.
183
184
  ```