@lotics/cli 0.188.0 → 0.190.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/AGENTS.md CHANGED
@@ -8,6 +8,7 @@ conventions are, and where the traps are.
8
8
  | `lotics --help` | The verb inventory (§ COMMANDS) and global flags. The verb LIST is generated and never stale; the prose beside each verb is hand-written, so where it disagrees with `docs/cli_reference.md`, the reference wins. |
9
9
  | `lotics tools` · `lotics tools <name>` | The agent tool registry and one tool's full JSON Schema. |
10
10
  | `lotics docs` · `lotics docs <area>` | Every reference the packages installed beside the project actually ship — `@lotics/app-sdk`, `@lotics/ui` and the document engines each carry their own, and this index only covers THIS package. Discovered by looking, not by a list, so it reports the installed VERSION of each: a doc always describes the code that is really there. |
11
+ | `lotics scaffold docs` | How to write a `model.json` — the file a workspace is built from. Two forms: `{"from": "<preset-slug>", "variants", "rename", "entities", "rows", "apply"}`, which names a preset by slug and carries only what this business differs by, and the full one, spelled out, for when no preset is the trade: every top-level key, every field type with the config it needs, the row format, the rules, and a worked example. Offline, and not part of `lotics docs`. It also covers the `apply` list — published packages copied in after the model's own tables, each with an optional `bind` onto them — and the `preset` block a published model carries. `lotics scaffold check` then proves the file — offline, except for the one read a `from` file's preset needs — including every branch of a preset merged onto its base; `lotics setup` applies it and refuses a table name the workspace already has, `lotics scaffold apply` adopts that table and adds what is missing. `lotics scaffold export` goes the other way — a workspace printed as one of these files, to edit into another business's model; a starting point, never a source of truth. |
11
12
  | [docs/building_an_app.md](./docs/building_an_app.md) | The SEQUENCE — scaffold, model, types, queries, workflows, screens, ship — and the deploy-free inner loop. The other references describe contracts; this one is the order they go in and why. Read it once before starting an app. |
12
13
  | [docs/cli_reference.md](./docs/cli_reference.md) | Per-command contracts, flags, exit codes, and gotchas — the detail `--help` compresses. Read it before hand-building a `set_app_*` payload: several tools REPLACE rather than patch, and a CLI verb already owns the safe assembly. |
13
14
  | [docs/data_model.md](./docs/data_model.md) | How tables RELATE — one entity per table and the NAME-OVERLAP probe that says when a split has broken, one vocabulary wherever values are copied between tables, a copy boundary that accounts for every source field, provenance as a link rather than a flag, a declared natural key so find-or-create never compares rendered text, and why derived DEPTH costs more than row count. Separate from building_an_app because every workspace starts with tables and many never get an app. The within-table half (one fact, one column) is stated at `create_table` / `update_table`, where you meet it while deciding. |
@@ -41,6 +42,16 @@ whether something exists, read `lotics --help` § COMMANDS — the whole section
41
42
  from a shell serving many. Every command that resolves a workspace echoes its target to **stderr**
42
43
  (`lotics → <org> / <workspace>`); read it back before trusting a write. `file preview <fil_…>` is
43
44
  the one credentialed command with no echo. Resolution precedence is in README § Organizations.
45
+ - **A machine with no key can still sign in, and the sign-in never blocks you.** `lotics auth
46
+ login <email>` prints the page a person opens (also mailed) and the code that page must show,
47
+ records the request, and EXITS. They press Confirm whenever they get to it; the next command that
48
+ NEEDS a credential collects the key before doing its own work, so "sign in" costs you one command
49
+ and then re-running what you wanted. Never wrap it in a timeout waiting for a human — `--wait`
50
+ exists if you really want one blocking command, and killing that one is safe too (the request
51
+ survives and the next command claims it). A command run before Confirm exits 1 naming the page and
52
+ code again; once the 15 minutes are up it says to ask again. `lotics setup` falls into the same
53
+ flow by itself when the email it was given already has an account: it stops having created
54
+ nothing, and the SAME command run again carries on.
44
55
  - **Large payloads bypass `ARG_MAX`** — `lotics run <tool> @args.json` or piped stdin. A leading `@` is
45
56
  unambiguously a file path (JSON args start with `{`).
46
57
  - **stdout is the payload, stderr is the narration.** Progress, status lines, and the target echo go to
package/README.md CHANGED
@@ -36,7 +36,7 @@ package (reachable at `node_modules/@lotics/cli/docs/*.md` once installed):
36
36
  workspace facts an agent can't guess, the access-vs-activation model, and the
37
37
  catalog-then-stage retrieval model agents use to pull only the lines they need.
38
38
 
39
- ## Start from a starter, in one command
39
+ ## Start from the library, in one command
40
40
 
41
41
  Install the CLI, then copy a starter — it creates the account, copies the starter into its
42
42
  workspace, deploys its apps, and prints a one-time sign-in link:
@@ -52,7 +52,48 @@ you pull an app's source to change it (`lotics app pull <app_id>`) and build it
52
52
 
53
53
  Add `--json` for one machine-readable object instead of progress — the organization, the
54
54
  workspace, the app ids, what was created, the sign-in link, and any warnings. Already signed in?
55
- Drop `--email` and `lotics setup <starter_id>` copies into the account you have.
55
+ Drop `--email` and `lotics setup <apg_id>` copies into the account you have.
56
+
57
+ `lotics library list` reads both shelves with no account at all. **Presets** are a trade's model,
58
+ named by a slug: read one and write a `model.json` from it — nothing is copied. **Packages** are
59
+ apps and the tables they stand on, named `apg_…`, copied in whole; each row names how many tables
60
+ and which apps a copy creates, so what you actually manage can be matched against them.
61
+ `lotics library show <slug|apg_id>` reads one, with no account either — each table as
62
+ `alias · label`, each field as `alias:type`, and a preset's variants beside the sentence that
63
+ selects each.
64
+
65
+ ## Or describe your own workspace
66
+
67
+ A `model.json` names the tables, fields, options, links, views, roles and first rows, and
68
+ `lotics setup` builds them. **Start from a preset when one is your trade** — name it instead of
69
+ restating it:
70
+
71
+ ```json
72
+ {
73
+ "from": "field_service",
74
+ "variants": ["crews"],
75
+ "rename": { "job": { "label": "Jobs", "fields": { "code": "Job no." } } },
76
+ "rows": { "job": [{ "ref": "j1", "fields": { "code": "J-1" } }] }
77
+ }
78
+ ```
79
+
80
+ No preset is your trade? Write the full form instead, spelling the tables out. Either way:
81
+
82
+ ```bash
83
+ lotics scaffold docs # how to write one, both forms, with a worked example. Offline
84
+ lotics scaffold check model.json # prove it — every problem at once, offline unless it names a preset
85
+ lotics setup model.json --email you@company.com
86
+ ```
87
+
88
+ It creates no apps of its own: build one in the workspace afterwards
89
+ (`lotics docs building_an_app`), or name a published package in the file's `apply` list and it is
90
+ copied in — bound onto the tables the model just made — as part of the same run.
91
+ `setup` refuses a table name your workspace already has; `lotics scaffold apply model.json` is the
92
+ additive verb — it adopts that table, adds what the model declares beyond it, and deletes nothing.
93
+
94
+ The other direction, once a workspace works: `lotics scaffold export > model.json` prints its
95
+ tables (or only `--tables tbl_a,tbl_b`) as that same file, findings on stderr. It is a starting
96
+ point for the next business, never a source of truth — the labels are this one's.
56
97
 
57
98
  ## Install
58
99
 
@@ -81,6 +122,19 @@ lotics auth signup # interactive prompts
81
122
  lotics auth signup a@b.com --name "Agent" # non-interactive
82
123
  ```
83
124
 
125
+ **`lotics auth login`** — Signs in an account that already exists, on a machine that holds no key. **It does not wait for you.** It prints the page to open (also mailed to you) and the code that page must show, then exits. Sign in there if asked, check the code, press Confirm — and run whatever you wanted to run: the next command that needs a credential collects the key before doing its own work.
126
+
127
+ ```bash
128
+ lotics auth login a@b.com # prints the page + code, exits — nothing to keep open
129
+ # …press Confirm in the browser…
130
+ lotics auth whoami # picks up the key, then answers
131
+
132
+ lotics auth login a@b.com --wait # one command instead: holds the terminal until Confirm
133
+ lotics auth login a@b.com --local # pins this directory to that org (implies --wait)
134
+ ```
135
+
136
+ A command run before you press Confirm names the page and the code again and exits 1; the request is good for 15 minutes, after which the next command says to ask again. Re-running `auth login` is always safe — it replaces the request, so only the newest code is the live one.
137
+
84
138
  **`lotics auth web`** — Send a magic link email to access the web app (requires prior signup or setup).
85
139
 
86
140
  ```bash
@@ -289,6 +343,13 @@ lotics app deploy -m "Add quote drawer" # typecheck + build + upload a new ve
289
343
  lotics app versions # deploy history: version, when, who, -m message (* = live)
290
344
  lotics app versions app_... # ...for any app, without pulling it first
291
345
 
346
+ # Apply the latest version of the package this app was COPIED from. Additive on
347
+ # the schema; a workflow or agent you have edited here is kept and named, and so
348
+ # is a field the new version stopped declaring. Redeploys from the published
349
+ # dist, so nothing local is sent — pull afterwards to edit the new code.
350
+ lotics app upgrade # the app this directory's manifest names
351
+ lotics app upgrade app_... # ...for any app, without pulling it first
352
+
292
353
  # Regenerate .lotics/* WITHOUT a deploy: the .d.ts type companions (always) +
293
354
  # the runtime app_fields.ts (when authenticated) — F/OPT maps that address
294
355
  # fields + select options by stable display-name aliases instead of opaque ids.