@trajectonomics/cli 0.8.0-alpha.52 → 0.8.0-alpha.54
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 +26 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -257,6 +257,32 @@ exits 0. `--if-hash <contentHash>` writes only when the stored plan still has th
|
|
|
257
257
|
`traj scenario show` printed it, and refuses the write otherwise. Without `--file`, `--set` and
|
|
258
258
|
`--without` never take a document, so the what-if cannot replace a plan you did not read.
|
|
259
259
|
|
|
260
|
+
### Adding an item to a what-if
|
|
261
|
+
|
|
262
|
+
> **Ships in 0.8.0.**
|
|
263
|
+
|
|
264
|
+
`--add <list>=<json>` puts one new item on the end of `accounts`, `flows` or `milestones`, so a new
|
|
265
|
+
loan, an extra payment or a new Flow can be tried before it is saved. The item carries its own `id`,
|
|
266
|
+
and an `id` the list already holds is refused (`--set` is the flag that changes an item that exists).
|
|
267
|
+
Every read that takes `--set` takes `--add` (`projection run`, `projection compare`, `fi`,
|
|
268
|
+
`projection chance` and `projection allowances`), and `scenario fork` and `scenario apply` save it:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
traj projection run --scenario base --as-of 2026-03-31 --horizon 2027-03-30 \
|
|
272
|
+
--add 'flows={"id":"extra","kind":"expense","amount":"1000.00","frequency":"monthly","start":"2026-04-01","growth":{"bps":0}}' --decimal
|
|
273
|
+
traj scenario apply base --add 'flows={...}' --decimal --if-hash <contentHash>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
The flags apply in a fixed order whatever order they are typed in: every `--without`, then every
|
|
277
|
+
`--add`, then every `--set`. So a `--set` can reach an item the same command adds
|
|
278
|
+
(`--add` then `--set flows.extra.amount=...`). An `--add` never replaces: one whose `list.id` the same
|
|
279
|
+
call's `--without` took out is refused, and `--set <path>.<key>=<value>` changes an item field by field,
|
|
280
|
+
so no field is dropped by accident and the plan saved is the plan projected. The result lists the items it added under `additions` (absent when none were), and
|
|
281
|
+
`effectiveContentHash` covers them. The engine checks the document with the item in it, so a refusal names
|
|
282
|
+
`--add` and the item's path (`flows.extra`) with the document path inside it. Under `--decimal` the
|
|
283
|
+
item's money is a decimal string of the Currency's major unit. Nothing is written until
|
|
284
|
+
`scenario apply` or `scenario fork` is run with the same flags.
|
|
285
|
+
|
|
260
286
|
## Milestones: points in the plan that a Flow waits for
|
|
261
287
|
|
|
262
288
|
> **Ships in 0.8.0.**
|