@verentis/cli 1.0.6 → 1.0.8

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
@@ -469,6 +469,97 @@ headless apps.
469
469
  At runtime this is still an iframe launch: the SDK receives
470
470
  `context.surface === 'workspace'`, a resolved entry point, and no file context.
471
471
 
472
+ ## The local emulator
473
+
474
+ `verentis emulator` runs a small, docker-free Verentis on your machine over package folders, so you
475
+ can open Canvas documents, run scripts and load web apps without pack → publish → approve → install.
476
+ It serves the subset of the platform `/v1` API that the SDKs, Canvas and app iframes use (files,
477
+ resources and MIME resolution, settings, tokens, executions, app calls). Routes it does not implement
478
+ answer `501` and are logged; nothing is silently faked.
479
+
480
+ ```bash
481
+ cd wholesale-seeds
482
+ verentis emulator start apps/agworld apps/netsuite --data /data=./data # background; --foreground to stay attached
483
+ verentis emulator status # packages, registrations, mounts, engines, issues
484
+ verentis emulator run apps/netsuite/scripts/export-netsuite.py -- --max-records 10 # local file or workspace path
485
+ eval "$(verentis emulator env)" # VERENTIS_API_URL / _ACCESS_TOKEN / _WORKSPACE_ID for any SDK or tool
486
+ verentis emulator logs -f
487
+ verentis emulator pull /data/integrations/agworld --replace # copy live workspace data in (read-only on live)
488
+ verentis emulator reset # drop local edits, deletions, pulled files and runs (--all: also stored settings)
489
+ verentis emulator restart # same packages and flags; `restart apps/crm` or `restart --permissive` replaces just those
490
+ verentis emulator stop
491
+ ```
492
+
493
+ `start` and `restart` return once the emulator is up; it keeps running in the background. Every start
494
+ saves its packages and flags to `.verentis/emulator/last-start.json`:
495
+
496
+ - `restart [packages] [flags]` stops the emulator (if running) and starts it with the saved ones; the
497
+ packages or flags you pass replace only those.
498
+ - `start` while one is running restarts it: with exactly what you pass, or with the saved packages
499
+ and flags when you pass nothing.
500
+ - A Canvas harness attached with `--emulator` follows the restart: it shows the emulator as offline,
501
+ then reloads the new packages and keeps its tabs.
502
+
503
+ Options can live in `verentis.emulator.yaml` at the project root. The emulator keeps its state in
504
+ `.verentis/emulator/` next to it and writes a `.gitignore` there, so run logs and `context.json` files
505
+ (which hold resolved secrets) stay out of git:
506
+
507
+ ```yaml
508
+ packages: [apps/*] # manifest folders (default: the folder itself, else apps/*)
509
+ data: { /data: data } # read-only data mounts: <workspace path>: <folder>
510
+ env: [.env] # settings and secrets (default ./.env)
511
+ webApps: { smart-editor: http://localhost:3000 } # served at /emulator/apps/<app-id>
512
+ port: 4510
513
+ permissive: false # true logs access denials instead of answering 403
514
+ nice: 10 # runs start at this nice level; false = normal priority
515
+ ```
516
+
517
+ - **Files.** Packages install read-only at their `spec.install` paths; data folders mount read-only.
518
+ Writes, uploads and deletes go to an overlay that `reset` drops. MIME types come from the installed
519
+ manifests and the SDK's local MIME sidecar, the same way the platform resolves them.
520
+ - **Settings and secrets.** A declared setting takes the first of: a value saved through the API,
521
+ `settings:` in the config, the process environment (the declaration's `env` name), the package's
522
+ `.env`, the project env files, the declared default. Secret values are never returned, only whether
523
+ they are set.
524
+ - **Access.** View, app and run tokens are bound like on the platform: a Canvas document gets its own
525
+ path and `spec.access`, an app or engine run gets its manifest permissions. A denied call answers
526
+ `403` with the reason (`outside_boundary`, `missing_scope`…) and appears on `/emulator/v1/events`.
527
+ - **Scripts.** `emulator run` (or `POST /v1/executions`) runs a script with the platform engine
528
+ contract: `context.json` at `VERENTIS_CONTEXT_PATH`, the `VERENTIS_*` variables and a run token for
529
+ the emulator API; the run reports through `result.json` in `VERENTIS_OUTPUT_DIR`. Python and Node
530
+ engines are built in; another SDK plugs in through `engines:` (`command` placeholders `{script}`,
531
+ `{args}`, `{context}`, `{output}`, `{path}`).
532
+ - **Python dependencies.** Before a Python run starts, the emulator installs what it declares, collected as the
533
+ platform's Python engine does: the ScriptRun's `dependencies` (also passed as `VERENTIS_DEPENDENCIES`), a
534
+ PEP 723 block, and `requirements.txt` / `pyproject.toml` in the program folder. Each set installs once (with
535
+ the interpreter's pip, else `uv`) into `.verentis/emulator/runtime/python-deps/` and goes on `PYTHONPATH`;
536
+ later runs reuse it. A failed install fails the run before the script starts. A custom engine gets this with
537
+ `dependencies: python`.
538
+ - **Live data.** `emulator pull <path>` downloads a folder or file from the current live workspace (one
539
+ read of `/v1/files/raw`, as an archive) and writes it into the emulator with its MIME types. Use it
540
+ when local data is older than the views. `--to` puts it elsewhere; `--replace` first hides what the
541
+ emulator had there, so the folder mirrors the live one. Pulled files sit in the overlay: `reset`
542
+ drops them. It refuses to run when `VERENTIS_API_URL` points at the emulator itself.
543
+ - **Builtin apps.** Packages labelled `builtin: "true"` in `$VERENTIS_BUILTIN_APPS`, else in the nearest
544
+ `apps/packages` checkout above the project, are loaded too, so "View JSON" and other generic viewers open as
545
+ they do on the platform. `--no-builtins` leaves them out.
546
+ - **Dependencies.** Each package's `spec.dependencies` (optional ones too) that exist as package folders in
547
+ the project (`apps/*`, `packages/*`) or that apps checkout load with it, transitively; the summary marks
548
+ them "dependency of …". `verentis/canvas` and the engine packages need no folder: the emulator stands in
549
+ for them. Anything else not found is listed. `--no-deps` (or `dependencies: false` in the config) loads
550
+ only the listed packages. A `404` on a file that an unloaded project package installs names that package.
551
+ - **Failed runs.** When a script exits non-zero, the run's error carries the last Python traceback
552
+ (else the tail of stderr), so `emulator run` and the Canvas runner show why it failed.
553
+ - **Web apps.** `/emulator/apps/<app-id>` hosts an app's dev server in an iframe and answers the SDK
554
+ bridge handshake with the emulator's context and an app token, for `workspace` or file surfaces
555
+ (`?path=/data/…`).
556
+
557
+ Not reproduced: live consent, token-broker and installation-state failures. Manifest-level problems
558
+ (unbound MIME types, undeclared access, missing settings) are.
559
+
560
+ For Canvas documents, the Canvas harness (`canvas-harness --emulator`) renders every view of the
561
+ loaded packages against the running emulator and draws their navigation graph.
562
+
472
563
  ## Marketplace publishing
473
564
 
474
565
  ## Create projects from npm templates