@trajectonomics/cli 0.8.0-alpha.3 → 0.8.0-alpha.31

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.
Files changed (2) hide show
  1. package/README.md +88 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -87,6 +87,30 @@ date and never reads the clock, so the same command always answers the same ques
87
87
  `traj help` lists every command, `traj help <command>` lists one command's flags, and
88
88
  `traj schema --json` prints the whole contract: every command's input, output and error codes.
89
89
 
90
+ ## Importing a statement
91
+
92
+ To load a bank statement, fill the one CSV template instead of adding each transaction by
93
+ hand. `traj tx import` has been in every release since 0.1.0.
94
+
95
+ ```bash
96
+ traj tx import --template # print the template header and nothing else
97
+ traj tx import statement.csv --dry-run
98
+ traj tx import statement.csv
99
+ ```
100
+
101
+ `--template` prints the header the importer reads, and it opens no data directory:
102
+
103
+ ```csv
104
+ date,from,to,amount,memo,external_ref,project
105
+ ```
106
+
107
+ Start your file with that header and write one row per transaction. `--dry-run` reports every
108
+ row and rolls every write back, so run it first. A file name of `-` reads the CSV from stdin, as in
109
+ `traj tx import - --dry-run`. The import is all or nothing, and `external_ref` is the duplicate
110
+ key, so importing the same statement twice adds nothing the second time. Each command's flags and
111
+ the rest of the columns are in
112
+ [the `tx` page of the docs](https://docs.trajectonomics.com/cli/commands/tx/).
113
+
90
114
  ## Development
91
115
 
92
116
  The sources are Bun-only; a released binary needs nothing.
@@ -197,6 +221,48 @@ Currency's major unit, such as `"1000.00"` for 100000 satang, and
197
221
  same either way: saving what `show --decimal` printed leaves it unchanged. A value with more places
198
222
  than the Currency has is refused, never rounded.
199
223
 
224
+ ## A what-if, applied to the plan it came from
225
+
226
+ > **Ships in 0.8.0.**
227
+
228
+ `traj projection run --set` projects a change without saving it. `traj scenario apply` saves the same
229
+ change to the stored plan, so the plan you keep is the one you projected. It takes the `--set`,
230
+ `--without` and `--decimal` that `projection run` takes, and refuses what they would be refused for:
231
+
232
+ ```bash
233
+ traj scenario apply base --set flows.salary.amount=9000000 --dry-run
234
+ traj scenario apply base --set flows.salary.amount=9000000 --without flows.gym
235
+ ```
236
+
237
+ The result names the Overrides it wrote. A change that leaves the plan as it is writes nothing and
238
+ exits 0. `--if-hash <contentHash>` writes only when the stored plan still has that hash, as
239
+ `traj scenario show` printed it, and refuses the write otherwise. Without `--file`, `--set` and
240
+ `--without` never take a document, so the what-if cannot replace a plan you did not read.
241
+
242
+ ## Milestones: points in the plan that a Flow waits for
243
+
244
+ > **Ships in 0.8.0.**
245
+
246
+ A Scenario may name points in the plan a Flow can wait for: a date, a number of months after another
247
+ point, a net-worth or spending figure, or a multiple of spending. They are the `milestones` of the
248
+ Scenario document, and `traj schema scenario apply` lists every key. A Flow's `startAt` lands it on
249
+ or after a point's date, and its `endAt` before it. `traj projection run` reports each point's date,
250
+ or that it was not reached, in a `milestones` table, and `traj projection compare` reports them under
251
+ each side.
252
+
253
+ ```json
254
+ "milestones": [
255
+ {
256
+ "id": "retire",
257
+ "combine": "all",
258
+ "criteria": [
259
+ { "id": "wealth", "kind": "metric", "metric": "accessibleNetWorth", "op": "atLeast", "amount": 50000000, "terms": "real" },
260
+ { "id": "age", "kind": "date", "on": "2045-01-01" }
261
+ ]
262
+ }
263
+ ]
264
+ ```
265
+
200
266
  ## Seeing it in a browser
201
267
 
202
268
  `traj dashboard --as-of 2026-11-30 --horizon 2056-11-30` reads your ledger once and serves the Dashboard (net worth, the ledger, projections, the FI date, a Scenario compare, tax and health) on `http://127.0.0.1:4321/` until you press Ctrl-C. It only reads, it listens on this machine only, and it takes the same Scenario flags as the projection reads (`--scenario`, `--compare` twice, `--monthly`, `--carry-in`); `--port 0` picks a free port. Run it again to see new figures.
@@ -226,6 +292,28 @@ traj backup --out ~/traj-backup-2026-11-30
226
292
  traj data remove --confirm ~/.traj --backup ~/traj-backup-2026-11-30
227
293
  ```
228
294
 
295
+ ### Going back after an upgrade
296
+
297
+ > **Ships in 0.8.0.**
298
+
299
+ When a newer `traj` has to migrate your database to a newer schema, it first copies it beside the
300
+ original as `traj.db.pre-v<N>.bak`, where `N` is the schema version the copy holds, and says so once
301
+ on stderr. Each copy is about the size of the database, so the upgrade needs that much free space;
302
+ if the copy cannot be written (a full disk, a directory that is not writable) the database is not
303
+ migrated and nothing changes. A new, empty ledger is not copied.
304
+
305
+ An older `traj` refuses a database a newer one has migrated, so to go back: stop every `traj`,
306
+ install the release you used before (the
307
+ [releases page](https://github.com/trajectonomics/trajectonomics/releases) lists them; `traj doctor`
308
+ on it reports the schema version it writes as `head`, which must equal `N`), delete `traj.db`,
309
+ `traj.db-wal` and `traj.db-shm` in the data directory, and copy the `.bak` file to `traj.db`.
310
+ Changes made after the upgrade are lost: the copy is the database as it was.
311
+
312
+ `traj doctor` lists the copies as `database.preMigrationCopies`, and any half-written one a crash
313
+ left as `database.unfinishedCopies`. `traj data remove` leaves the copies, because they are separate
314
+ files you can delete when you no longer need them, and its refusal names them: they hold your
315
+ data in plain text.
316
+
229
317
  ## Telemetry
230
318
 
231
319
  `traj` counts its own use, so the project can see how many people run it each week. After a command finishes, a detached process sends one anonymous event to PostHog (EU), so the command never waits for the network. The event holds:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trajectonomics/cli",
3
- "version": "0.8.0-alpha.3",
3
+ "version": "0.8.0-alpha.31",
4
4
  "description": "trajectonomics command line",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -34,6 +34,6 @@
34
34
  "lint": "biome ci --error-on-warnings .",
35
35
  "format": "biome check --write .",
36
36
  "build": "bun build src/index.ts --compile --no-compile-autoload-bunfig --no-compile-autoload-dotenv --outfile dist/traj",
37
- "check": "bun run lint && bun run typecheck && bun test && bun run build"
37
+ "check": "bun run lint && bun run typecheck && bun test && bun ../../tooling/scripts/build-unless-turbo.ts"
38
38
  }
39
39
  }