@ubercode/channelvault 0.3.0-rc.4 → 0.3.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +9 -6
- package/dist/cli.js +536 -179
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,41 @@
|
|
|
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.6] — 2026-11-27
|
|
6
|
+
|
|
7
|
+
Release candidate, published under the npm `next` tag.
|
|
8
|
+
|
|
9
|
+
### Security
|
|
10
|
+
|
|
11
|
+
- **Configuration-map values that Mirth returns as booleans or numbers are now secrets too** ([#30](https://github.com/MichaelLeeHobbs/channelvault/issues/30)). Mirth's JSON answers a stored value such as `true` or `1234` as a JSON boolean or number, and `pull` used to write those into `server/configuration.json` as literals, so a numeric PIN or password landed in git. A key Mirth answers as a number or boolean (`8443`) had the same problem for its value, whatever that value's type, and could not be named in `push --config-map-key`. They now become `{{env:CONFIG_MAP__…}}` placeholders with the value in the env file, `diff` redacts them, and a key push followed by `diff` is clean without a re-pull. Re-pull a tree pulled before this change to move such values out of it, and check your git history for any that were committed.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **`profile set <name>`** changes a saved profile's `--dotenv`, `--user` or `--port` without hand-editing `profiles.json` ([#29](https://github.com/MichaelLeeHobbs/channelvault/issues/29)). It runs only at a terminal, checks the env file as `profile add` does, logs in before saving a new user (asking for its password) or port, and never changes `serverId` or the TLS pin.
|
|
16
|
+
- **`profile remove <name>`** removes a profile and its line in the credentials file after you confirm, at a terminal. The profile's env file is kept.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- `profile add` and `profile set` refuse a `--dotenv` that git would commit (inside a repository and not ignored, including in a folder that doesn't exist yet) or that is a folder; `[profile-invalid]`.
|
|
21
|
+
- The `[profile-exists]` hint names `profile set` and `profile remove` instead of editing `profiles.json`. `diff`'s `[env-missing]`/`[env-incomplete]` hint names `profile set <name> --dotenv`, and a `pull` with a profile that has no `dotenv` into a tree with no `.env` says so and names the same command.
|
|
22
|
+
|
|
23
|
+
## [0.3.0-rc.5] — 2026-11-27
|
|
24
|
+
|
|
25
|
+
Release candidate, published under the npm `next` tag.
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- **`push --config-map-key <name>`** (repeatable) pushes named configuration-map keys without `--whole-server` ([#24](https://github.com/MichaelLeeHobbs/channelvault/issues/24)). Alone it pushes only those keys; with `--channel`, `--library` or `--global-scripts` it pushes them too. The plan lists each key, never its value. The push backs up first (the undo includes `--overwrite-config-map`), reads the server's map again right before the save, keeps every other key as the server holds it, saves the keys before any channel, and checks the map afterwards. A named key edited, created or deleted on the server since the last pull is refused unless `--force`; removing a key needs `--allow-deletes`.
|
|
30
|
+
- `pull`, `adopt` and `push --whole-server --overwrite-config-map` record a hash of each configuration-map key per installation in `~/.channelvault/config-map-baselines/` (owner-only, outside the tree; never the value). Without one on this machine a key push is refused until a pull or adopt (or `--force`).
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- `diff` and a plain scoped `push` compare the configuration map by key: Mirth returns it in its own order, so a key added anywhere but last no longer reads as a difference after it is pushed.
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- **`diff` no longer reports every secret as drifted when the checkout has no env file.** When a placeholder compared with the server can't be filled from the env file or the environment, `diff` exits 2 (was 1): `[env-missing]` names the env file it looked for, `[env-incomplete]` names the variables an existing env file lacks, and both suggest `--dotenv` or a profile `dotenv`. Placeholders used only by resources the server doesn't have yet are named in a note and don't stop the diff. A scheduled drift check now reads "can't compare secrets" instead of "differences found" ([#26](https://github.com/MichaelLeeHobbs/channelvault/issues/26)).
|
|
39
|
+
|
|
5
40
|
## [0.3.0-rc.4] — 2026-11-27
|
|
6
41
|
|
|
7
42
|
Release candidate, published under the npm `next` tag.
|
|
@@ -121,6 +156,8 @@ First release. Tested against Mirth Connect 4.5.2; the offline round trip is als
|
|
|
121
156
|
- `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`.
|
|
122
157
|
- `diff` exits 0 when the tree matches the server, 1 when it differs, 2 on error.
|
|
123
158
|
|
|
159
|
+
[0.3.0-rc.6]: https://github.com/MichaelLeeHobbs/channelvault/releases/tag/v0.3.0-rc.6
|
|
160
|
+
[0.3.0-rc.5]: https://github.com/MichaelLeeHobbs/channelvault/releases/tag/v0.3.0-rc.5
|
|
124
161
|
[0.3.0-rc.4]: https://github.com/MichaelLeeHobbs/channelvault/releases/tag/v0.3.0-rc.4
|
|
125
162
|
[0.3.0-rc.3]: https://github.com/MichaelLeeHobbs/channelvault/releases/tag/v0.3.0-rc.3
|
|
126
163
|
[0.3.0-rc.2]: https://github.com/MichaelLeeHobbs/channelvault/releases/tag/v0.3.0-rc.2
|
package/README.md
CHANGED
|
@@ -77,12 +77,12 @@ channelvault diff <dir> # tree vs live server
|
|
|
77
77
|
channelvault status <dir> # summary of a tree
|
|
78
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
|
-
channelvault profile list|add|set-password|check|repin # saved connections (see Connection profiles)
|
|
80
|
+
channelvault profile list|add|set|set-password|remove|check|repin # saved connections (see Connection profiles)
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
`channelvault <command> --help` lists the flags. The server connection comes from a saved profile (`--profile`, `MIRTH_PROFILE`, or the profile matching the tree), or from the login flags and `MIRTH_HOST`, `MIRTH_PORT`, `MIRTH_USER`, `MIRTH_PASS`; see [Connection profiles](#connection-profiles). Errors start with a reason code in brackets, such as `error: [profile-not-typed] …`, for scripts and agents to route on.
|
|
84
84
|
|
|
85
|
-
`diff` exits 0 when the tree matches the server, 1 when they differ, and 2 on any error (including a bad flag), so a scheduled drift check can tell drift from an outage. It compares content: Mirth bumps revision numbers and timestamps on any save (even an unchanged one in the Administrator) and on a restore, so those are reported as a note ("pull to update the tree's baseline") and don't count as differences.
|
|
85
|
+
`diff` exits 0 when the tree matches the server, 1 when they differ, and 2 on any error (including a bad flag), so a scheduled drift check can tell drift from an outage. It compares content: Mirth bumps revision numbers and timestamps on any save (even an unchanged one in the Administrator) and on a restore, so those are reported as a note ("pull to update the tree's baseline") and don't count as differences. When a `{{env:NAME}}` placeholder at a value the server also holds can't be filled, from the env file or the environment, `diff` exits 2 rather than reporting every secret as drift: `[env-missing]` when the env file it looked for doesn't exist (the message names it), `[env-incomplete]` naming the variables an existing env file lacks. Pass `--dotenv`, or set the profile's `dotenv`. A placeholder used only by a resource the server doesn't have yet (a new channel) is named in a note instead.
|
|
86
86
|
|
|
87
87
|
For scripts, CI and AI agents, `status`, `diff` and `push --plan-only` take `--json` and print one JSON document on stdout; errors still go to stderr with the usual exit code.
|
|
88
88
|
|
|
@@ -107,7 +107,8 @@ channelvault push ./mirth --profile gov # writes: the profile must be typ
|
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
- **Files.** `~/.channelvault/profiles.json` holds `host`, `port`, `user`, `https`, `insecure`, `tlsFingerprint`, `serverId` and `dotenv` (an absolute path) for each named profile, and no secrets. `~/.channelvault/credentials` holds one `name=password` line per profile, readable by its owner only; nothing in the process environment can override it. `CHANNELVAULT_CONFIG_DIR` moves the folder, but is refused inside a git work tree. Unknown fields are refused by name, and a `password` field is refused with a pointer to `profile set-password`.
|
|
110
|
-
- **Adding one.** `profile add` runs only at a terminal. It shows the host and the certificate's SHA-256 fingerprint, asks you to confirm them, asks for the password (8 characters at least, never echoed), logs in, and records the server's installation ID as `serverId`. `profile set-password <name>` changes the password after logging in with it, `profile list [--json]` shows the profiles without passwords, and `profile check [name] [--json]` logs in with each one and verifies its certificate and installation (exit 1 if any fails).
|
|
110
|
+
- **Adding one.** `profile add` runs only at a terminal. It shows the host and the certificate's SHA-256 fingerprint, asks you to confirm them, asks for the password (8 characters at least, never echoed), logs in, and records the server's installation ID as `serverId`. A `--dotenv` must be absolute after resolving, not shared with another profile, and ignored by git if it is inside a repository. `profile set-password <name>` changes the password after logging in with it, `profile list [--json]` shows the profiles without passwords, and `profile check [name] [--json]` logs in with each one and verifies its certificate and installation (exit 1 if any fails).
|
|
111
|
+
- **Changing or removing one.** Don't edit `profiles.json` by hand: it also holds the pin and the installation. `profile set <name> --dotenv <path>` gives a profile an env file, with the same checks as `profile add`; it doesn't move values from another env file, so move them yourself. `--user` or `--port` log in before saving, so the profile must still reach the same installation and certificate: `--user` asks for that user's password, and so does `--port` on a profile that doesn't check certificates (plain http or `insecure`), so a different local server never receives the stored one. `profile set` never changes `serverId` or the pin: `profile repin` and a new `profile add` do. `profile remove <name>` asks for confirmation, then removes the profile and its line in the credentials file; its env file is kept. `profile set` and `profile remove` run only at a terminal, and save nothing if another process changed the profile meanwhile (`[profile-changed]`). A pull with a profile that has no `dotenv` into a tree with no `.env` names `profile set <name> --dotenv`, because the values then live only in that checkout.
|
|
111
112
|
- **Which connection a command uses.** Exactly one source, never fields mixed from several, in this order:
|
|
112
113
|
1. `--profile <name>`. Login or TLS flags beside it are refused.
|
|
113
114
|
2. The login flags, starting with `--host`, with `MIRTH_*` filling what is not typed. A typed `--host` never borrows `MIRTH_PORT`, `MIRTH_USER`, `MIRTH_PASS` or `MIRTH_TLS_FINGERPRINT` exported for a different `MIRTH_HOST` (`[env-conflict]`). `--port`, `--user` or `--pass` without `--host` still reach `MIRTH_HOST`'s server, so they count as step 4.
|
|
@@ -147,6 +148,7 @@ Secrets inside values are caught too: credentials in URLs and connection strings
|
|
|
147
148
|
channelvault push ./mirth # everything that changed
|
|
148
149
|
channelvault push ./mirth --channel "ADT Router" # just this channel (repeat --channel for more)
|
|
149
150
|
channelvault push ./mirth --library Formatting --deploy # one library, then redeploy the channels using it
|
|
151
|
+
channelvault push ./mirth --config-map-key HL7_TEXT_LEGACY # just this configuration-map key (repeatable)
|
|
150
152
|
```
|
|
151
153
|
|
|
152
154
|
- **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.
|
|
@@ -157,7 +159,8 @@ channelvault push ./mirth --library Formatting --deploy # one library, then red
|
|
|
157
159
|
- **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.
|
|
158
160
|
- **`--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.
|
|
159
161
|
- After a push the tree's revision numbers are updated from the server, so `diff` and the next `push` stay clean.
|
|
160
|
-
-
|
|
162
|
+
- **Configuration-map keys**: `--config-map-key <name>` (repeatable) pushes those keys of the tree's configuration map. Alone it pushes only the keys; with `--channel`, `--library` or `--global-scripts` it pushes those too. The plan lists each key as a `configuration-map key` change (`changes[].kind` is `configMapKey` in `--json`), never its value. Mirth saves the map only as a whole, so push reads the server's map again right before the save, replaces the named entries, keeps every other key as the server holds it, and checks the map after saving. The keys are saved before any channel, so a channel this push saves or redeploys can read them. Conflicts work like revisions: `pull` and `adopt` record a hash of each key per installation in `~/.channelvault/config-map-baselines/` (owner-only, outside the tree, so every checkout and worktree on the machine shares it; never the value), and push refuses a named key that was edited, created or deleted on the server since then, unless `--force`. Without a baseline on this machine (the tree was pulled elsewhere, or by an older version) every key push is refused: pull or adopt first, or pass `--force`. `diff` and a plain `push` compare the map by key, since Mirth returns it in its own order. Removing a key from the tree deletes it only with `--allow-deletes`. The undo command includes `--overwrite-config-map`.
|
|
163
|
+
- Server settings, the rest of 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`, `--library` or `--config-map-key`.
|
|
161
164
|
- A tree exploded from an XML backup is refused (its shape differs from the live API's); `--ignore-origin` overrides that.
|
|
162
165
|
- Before it changes anything, `push` backs up the server (see below) and prints a configuration undo command with the original target (`--profile <name>`, or the host, port, user and TLS options), and the backup directory. It includes `--overwrite-config-map` when the push overwrites that map. Passwords are omitted; without a profile, 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.
|
|
163
166
|
- Without a terminal, `push` needs `--yes`.
|
|
@@ -208,7 +211,7 @@ An agent can safely edit a tree and check its work. Pushing, restoring and anyth
|
|
|
208
211
|
- 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.
|
|
209
212
|
- 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.
|
|
210
213
|
- `{{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/`, `~/.channelvault/credentials`, a profile's env file or `~/.channelvault/backups/`.
|
|
211
|
-
- channelvault finds the server itself: the tree's `channelvault.json` names its installation, and the matching connection profile supplies the login. Don't pass `--host`, `--pass` or `--insecure`, and don't set `MIRTH_*` variables. If a command fails with a reason code such as `[no-connection]`, `[no-password]` or `[tls-pin-mismatch]`, stop and tell a person; only they can add a profile, set its password or repin its certificate.
|
|
214
|
+
- channelvault finds the server itself: the tree's `channelvault.json` names its installation, and the matching connection profile supplies the login. Don't pass `--host`, `--pass` or `--insecure`, and don't set `MIRTH_*` variables. If a command fails with a reason code such as `[no-connection]`, `[no-password]`, `[env-missing]`, `[env-incomplete]` or `[tls-pin-mismatch]`, stop and tell a person; only they can add a profile, set its password or repin its certificate.
|
|
212
215
|
- 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.
|
|
213
216
|
- 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.
|
|
214
217
|
```
|
|
@@ -259,7 +262,7 @@ channelvault diff ./destination --profile destination --dotenv .env.destination
|
|
|
259
262
|
channelvault push ./destination --profile destination --dotenv .env.destination --channel "Report Distributor"
|
|
260
263
|
```
|
|
261
264
|
|
|
262
|
-
Review the destination differences before overriding an independent revision history with `--force`. The initial source baseline cannot establish whether an independently managed destination changed since its last review. After the first successful push, keep the destination working copy and its refreshed baseline for subsequent changes. `--force` permits overwriting concurrent edits, while deletions still require `--allow-deletes`. A scoped push
|
|
265
|
+
Review the destination differences before overriding an independent revision history with `--force`. The initial source baseline cannot establish whether an independently managed destination changed since its last review. After the first successful push, keep the destination working copy and its refreshed baseline for subsequent changes. `--force` permits overwriting concurrent edits, while deletions still require `--allow-deletes`. A scoped push promotes the configuration map only key by key, with `--config-map-key`, and no other server settings; manage those separately.
|
|
263
266
|
|
|
264
267
|
### Checks
|
|
265
268
|
|