@naseej/blox 1.13.0 → 1.15.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/dist/run.js +3220 -1530
- package/dist/sdk.js +9 -1
- package/package.json +1 -1
- package/readme.md +34 -3
package/dist/sdk.js
CHANGED
|
@@ -141,7 +141,15 @@ var exitCodes = {
|
|
|
141
141
|
NOT_FOUND: 3,
|
|
142
142
|
AUTH: 4,
|
|
143
143
|
CONFLICT: 5,
|
|
144
|
-
APPROVAL_REQUIRED: 6
|
|
144
|
+
APPROVAL_REQUIRED: 6,
|
|
145
|
+
/** An update/lifecycle hook failed. */
|
|
146
|
+
HOOK_FAILED: 7,
|
|
147
|
+
/** Network failure reaching a repository (after retries). */
|
|
148
|
+
NETWORK: 8,
|
|
149
|
+
/** A unit is missing from the registries (`update --strict`). */
|
|
150
|
+
MISSING: 9,
|
|
151
|
+
/** Updated versions are not compatible with each other. */
|
|
152
|
+
INCOMPATIBLE: 10
|
|
145
153
|
};
|
|
146
154
|
var CliError = class extends Error {
|
|
147
155
|
constructor(message, code, exitCode = exitCodes.GENERAL, suggestion, details) {
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -240,14 +240,39 @@ Important options:
|
|
|
240
240
|
- `--ignore <list...>`: ignore patterns scoped by repo name, for example `repo:file`
|
|
241
241
|
- `--hard`: overwrite local changes during update
|
|
242
242
|
- `--allow-breaking`: authorize applying updates that contain breaking changes (required in non-interactive mode)
|
|
243
|
+
- `--on-conflict <mode>`: `rollback`, `keep`, or `prompt` (default: `rollback` when non-interactive, `prompt` otherwise)
|
|
244
|
+
- `--to <unit=ref...>`: update a unit to an exact commit or released version, e.g. `--to auth=4f2c9e1`. In an application, prefix the unit with the app key, e.g. `web/auth=…`
|
|
245
|
+
- `--release <file>`: JSON release manifest `{"<unit>": "<commit|version>"}`, for example the checkpoints of a tested project. `--to` entries take precedence
|
|
246
|
+
- `--strict`: never update to a branch head; with `--release`, only listed units are updated
|
|
247
|
+
- `--deleted <policy>`: files deleted locally but changed upstream. `keep` leaves them deleted and `restore` recreates them. The default is `keep` when non-interactive and `restore` otherwise. Each unit reports them as `keptDeletedFiles` or `restoredFiles`
|
|
248
|
+
- `--dry-run`: show the update plan without changing anything: current and target versions, breaking changes, and blockers such as uncommitted changes, a paused update, or invalid targets. With `--json`, it prints the same plan as MCP `update_project` with `dryRun: true`
|
|
249
|
+
- `--continue`: finish an update paused by `--on-conflict keep` once its conflicts are resolved
|
|
250
|
+
- `--abort`: discard an update paused by `--on-conflict keep`; add `--force` to also discard commits made since the pause
|
|
243
251
|
- `--non-interactive`: run without prompts; missing inputs fail instead of prompting
|
|
244
252
|
- `--json`: emit a structured JSON result on stdout
|
|
245
253
|
|
|
246
254
|
Important notes:
|
|
247
255
|
|
|
248
|
-
- You may need to resolve merge conflicts.
|
|
256
|
+
- You may need to resolve merge conflicts. Interactively, BLOX waits while you resolve them. With `--on-conflict rollback` (the non-interactive default), BLOX still merges every template, base, and block so it can report all conflicts, then restores every file the run changed in the root project and every application, and exits with code `5`. The JSON error lists each conflicting unit and file in `error.details.conflicts`.
|
|
257
|
+
- With `--on-conflict keep`, the conflict markers stay in place and the update is paused (exit code `5`). Units without conflicts are already applied, but the conflicting ones keep their old checkpoints. Resolve the markers, then run `blox update --continue`. It refuses while markers remain, then advances the conflicting units' checkpoints, runs the update hooks that were skipped, and runs the compatibility check. `blox update --abort` instead restores the root project and every application to where the update started. While an update is paused, no other update can start. `--continue` never commits.
|
|
258
|
+
- The paused state is stored in `.git/blox/pending-update.json` in the workspace root repository. Git never commits or pushes it, so it stays with the uncommitted conflict markers it describes. `--continue` and `--abort` refuse to run if the branch changed or history was rewritten since the pause. If the changes were discarded by hand (for example with `git reset --hard`), `--continue` reports that and clears the paused state.
|
|
259
|
+
- Without targets, a unit updates to the registry version selected for it. For the current major version, which has no fixed commit in the registry, that is the head of its branch. Use `--to` or `--release` to update to exact commits, and add `--strict` to forbid the branch head. A version label counts as a target only if the registry records a fixed commit for it. Every target is checked before any file changes. The run fails with `INVALID_UPDATE_TARGETS` (exit code `2`), listing every problem, if a target names a unit that isn't installed, doesn't exist in the unit's repository, is older than the current checkpoint (downgrade), or doesn't descend from it. When a template update moves a base's checkpoint, the base then updates from there to the release target.
|
|
260
|
+
- In non-interactive mode, when several registry versions qualify, BLOX picks the newest one by version order. Labels such as `v2` are read as versions, rather than taking the last key in the versions file.
|
|
261
|
+
- Update hooks run after every merge: blocks in dependency order (a block after the blocks it depends on), then the template. If a hook fails, or the updated versions turn out to be incompatible, the run is handled like a conflict. With `--on-conflict rollback` (the non-interactive default), every scope is restored and the run exits with code `7` (hook) or `10` (incompatible). With `--on-conflict keep`, a hook failure pauses the update: fix the cause and run `blox update --continue`, which reruns the remaining hooks. Interactive runs (`prompt`) keep their previous behaviour, where only the failing scope is restored.
|
|
262
|
+
- `blox update` fetches each unit into a temporary remote named `blox-update-<unit>`, without tags, and removes those remotes when the run ends. The project repository keeps only its own remotes, and tags from different block repositories cannot collide. Only one update, `--continue`, or `--abort` can run in a workspace at a time; another run fails with `UPDATE_LOCKED`.
|
|
263
|
+
- App and base updates never touch `blocks/<dir>/` or `apps/<dir>/` folders that have their own `.blox`, including blocks installed under another folder name and blocks the project removed. Blocks are updated only from their own repositories, so a block's checkpoint changes only when that block itself is updated.
|
|
249
264
|
- If a template, base, or block is missing from the registry, BLOX prompts you to continue or stop.
|
|
250
|
-
- When an update contains breaking changes, BLOX lists them with their migration instructions and asks for confirmation. Non-interactive runs require `--allow-breaking
|
|
265
|
+
- When an update contains breaking changes, BLOX lists them with their migration instructions and asks for confirmation. Non-interactive runs require `--allow-breaking`. Without it, every unit is still checked, then nothing is applied: the run is rolled back and fails with exit code `6`, listing every unit that needs approval.
|
|
266
|
+
- `--json` reports one result per template, base, and block in `units` (in `data` on success, in `error.details` on failure), alongside the previous `updated`, `stoppedEarly`, `failedBlocks`, and `scopes`. Each unit has:
|
|
267
|
+
- `scope`, `kind`, `name`;
|
|
268
|
+
- `from` and `to` (`{ commit, version }`);
|
|
269
|
+
- `status`: `updated`, `up-to-date`, `skipped-breaking`, `conflict`, `missing`, `hook-failed`, `error`, `not-in-release`, `no-release`, or `no-checkpoint`;
|
|
270
|
+
- `conflictFiles`, `restoredFiles` (deleted locally but recreated from upstream), `keptLocalFiles` (deleted upstream but modified locally), and `overwrittenBinaries`;
|
|
271
|
+
- `breaking`: `{ commit, subject, summary, migration }` for each breaking commit;
|
|
272
|
+
- `hook`: `{ status, exitCode, output }` for its update hook, where `deferred` means the hook runs on `--continue`;
|
|
273
|
+
- `rolledBack: true` when the unit's changes were undone.
|
|
274
|
+
|
|
275
|
+
Hook output goes to stderr in `--json` mode, so stdout carries only the JSON.
|
|
251
276
|
- BLOX runs non-interactively automatically when stdin is not a terminal (CI, agents, piped input).
|
|
252
277
|
|
|
253
278
|
### contribute
|
|
@@ -548,8 +573,14 @@ Exit code conventions:
|
|
|
548
573
|
| `2` | Missing or invalid arguments |
|
|
549
574
|
| `3` | Resource not found |
|
|
550
575
|
| `4` | Permission or authorization failure |
|
|
551
|
-
| `5` |
|
|
576
|
+
| `5` | Merge conflicts (contribute and update), or an update is already paused |
|
|
552
577
|
| `6` | Required approval missing (e.g. breaking changes without `--allow-breaking`) |
|
|
578
|
+
| `7` | An update hook failed |
|
|
579
|
+
| `8` | Network failure reaching a repository (every failure was a network error) |
|
|
580
|
+
| `9` | Units missing from the registries (`blox update --strict` only) |
|
|
581
|
+
| `10` | Updated versions are not compatible with each other |
|
|
582
|
+
|
|
583
|
+
When an update run has several outcomes, the first applies in this order: invalid targets (`2`), incompatible versions (`10`), conflicts (`5`), a failed hook (`7`), approval required (`6`), then per-unit failures (`8`, otherwise `1`), then missing units (`9`, with `--strict`).
|
|
553
584
|
|
|
554
585
|
### Ignore Policy
|
|
555
586
|
|