@getmagical/cli 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -114,18 +114,26 @@ MCP server. MCP callers must provide `idempotencyKey` and
114
114
  current branch. Omit it to target main; branch-aware responses include
115
115
  `branchId: null` and the selected main `headVersionId`.
116
116
 
117
- This release adds exactly five commands: branch list, create, get, and merge,
118
- plus workbench patch readiness.
117
+ Branch commands: list, create, get, merge-preview, discard-changes, and
118
+ merge, plus
119
+ workbench patch readiness.
119
120
 
120
121
  ```bash
121
122
  mgcl automations branches list --automation-id <automation-id> --json
122
123
  mgcl automations branches create --automation-id <automation-id> --name experiment --json
123
124
  mgcl --branch-id <branch-id> automations branches get --automation-id <automation-id> --json
124
125
  mgcl --branch-id <branch-id> automations update --id <automation-id> --input-json '{"baseVersionId":"<head-version-id>","name":"Experiment"}' --json
126
+ mgcl --branch-id <branch-id> automations branches merge-preview --automation-id <automation-id> --json
127
+ mgcl --branch-id <branch-id> automations branches discard-changes --automation-id <automation-id> --change-ids agent:update:<agent-id>:instructions --source-version-id <source-version-id> --target-version-id <target-version-id> --json
125
128
  mgcl --branch-id <branch-id> automations branches merge --automation-id <automation-id> --json
126
129
  mgcl --branch-id <branch-id> workbench patch readiness --target-draft-automation-id <automation-id> --operations-json '[{"setAutomationName":{"name":"Experiment readiness preview"}}]' --json
127
130
  ```
128
131
 
132
+ Merge previews report agent edits per field, and settings per config key:
133
+ `agent:update:<agent-id>:config.model`, `config.tools`, `config.plugins.memory`,
134
+ or `config.devOnly` for the developer-only keys, with the key in `configKey`.
135
+ Automation settings follow the same shape (`automation:config.systemPrompt`).
136
+
129
137
  Branch creation defaults to main. Use `--source-branch-id` and optionally
130
138
  `--source-version-id` to fork from another branch or an older version in that
131
139
  branch's history. Names must use lowercase letters or numbers separated by
@@ -135,7 +143,24 @@ leading or trailing dashes, repeated dashes, and over-length names are
135
143
  rejected before an API request. Branch IDs, not names, identify targets, and
136
144
  every automation or branch ID must be a UUID; malformed IDs are rejected
137
145
  before an API request.
138
- Merge previews the same change set as the web UI. A conflict returns
146
+ `merge-preview` explains the merge without writing anything. Each change carries a
147
+ stable `id`, a `kind`, and for agent edits the `agentId` and `field`
148
+ (`name`, `description`, `instructions`, `inputSchema`, `outputSchema`,
149
+ `config`, `agentLibraryEntity`, `type`), so a field main also changed
150
+ conflicts on its own while the agent's other fields stay mergeable.
151
+ Connections are keyed by `fromAgentId`/`toAgentId`, agent positions are one
152
+ grouped `layout:agents` change that never conflicts, and a connection to an
153
+ agent main deleted is a conflict. `conflictDescription` says why a change
154
+ conflicts; `discardable` marks changes that can be reverted.
155
+
156
+ `discard-changes` is the only conflict resolution: it reverts the named changes on
157
+ the branch as a new branch version so main keeps its values, and returns the
158
+ new head plus the refreshed preview. Pass `--source-version-id` and
159
+ `--target-version-id` from the preview you acted on; the command is rejected
160
+ when either head moved since. Discarding an added or removed agent also
161
+ reverts its added or removed connections.
162
+
163
+ `merge` previews the same change set as the web UI. A conflict returns
139
164
  `status: "conflict"`, does not change main or delete the branch, and exits
140
165
  nonzero so scripts gating on the exit code never mistake it for an applied
141
166
  merge. A conflict-free merge returns `status: "merged"`, the saved-main
@@ -145,7 +170,8 @@ are intentionally deferred.
145
170
  The global branch target is accepted by `automations update`, `automations
146
171
  run-draft`, `automations diff-from-published`, `workbench diagnostics`,
147
172
  `workbench schema-suggestions`, and `workbench patch preview`, `readiness`,
148
- and `apply`. It is required by `automations branches get` and `merge`. Other
173
+ and `apply`. It is required by `automations branches get`, `merge-preview`,
174
+ `discard-changes`, and `merge`. Other
149
175
  commands reject `--branch-id` before making an API request, and
150
176
  `mgcl --help` lists the branch-aware commands. Branch-aware responses identify the selected
151
177
  target with `branchId` and `headVersionId`. Merge returns `branchId`, its exact