@quatronic/qore 0.3.1-rc.1 → 0.3.1-test.6181ba6

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 (3) hide show
  1. package/README.md +173 -8
  2. package/dist/cli.js +3233 -1731
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -141,6 +141,19 @@ qore env pull
141
141
  directory, then renamed over the target — it's never truncated in place.
142
142
  (On Windows, POSIX file modes don't apply — setting `0600` there is a
143
143
  no-op; there's no equivalent file-permission hardening on that platform.)
144
+ - When the repository has a `mobile/` directory (an Expo app), the pull also
145
+ writes `mobile/.env.local` with the app's **public** staging config:
146
+ `EXPO_PUBLIC_SERVER_URL`, `EXPO_PUBLIC_SENTRY_DSN` and
147
+ `EXPO_PUBLIC_QORE_ENV=staging`. qore owns those three keys and overwrites
148
+ them; every other line in the file is kept. A value the portal does not have
149
+ yet is left out rather than written empty, because an empty `EXPO_PUBLIC_*`
150
+ value would override the one baked into `app.config.ts`. Until staging is
151
+ deployed there is no server URL; the pull says so, and running it again
152
+ after the deploy fills it in. A portal too old to serve this config is
153
+ skipped with a note, and a failed fetch warns without failing the pull.
154
+ `--json` reports it as
155
+ `mobile: { target, environment, serverUrl, sentryDsn: <set?>, written }`
156
+ (`null` without a `mobile/` directory). `qore dev` does not write this file.
144
157
 
145
158
  **First use of a repository** requires confirmation — see "Trust on first
146
159
  use" below. **Values are never printed**: not in `qore env pull`'s output,
@@ -243,6 +256,24 @@ itself, or it fails with "Not inside a module repository"). `--app` is
243
256
  refused in a workspace root: an app is already implied by
244
257
  `qore.workspace.json`.
245
258
 
259
+ **Shared checkouts.** In the shared layout the modules start from
260
+ `modules/<slug>`. A module that another app's `qore dev` already runs from
261
+ the same checkout, with its port listening, is not started a second time:
262
+
263
+ - a **backend** is reused (`<module> running in qore dev for <app> (pid
264
+ <pid>)`) and listed with that app's URL in the summary. This needs the
265
+ portal capability `module.local-env-app-neutral`; without it the module is
266
+ listed under `! Not running:` as `running in qore dev for <app>`;
267
+ - a **frontend** is never reused, because its environment is per app: it is
268
+ listed as not running the same way.
269
+
270
+ A reused module is only watched. When its port is free for two checks in a
271
+ row, qore prints `<module> stopped with qore dev for <app> — restart qore
272
+ dev to run it here` (a `reused-stopped` event with `--json`) and does not
273
+ restart it. If every module is reused, nothing starts: `qore dev` just
274
+ watches, exits `0` once they have all stopped, and `130` (or 128 + signal)
275
+ on Ctrl+C or a signal.
276
+
246
277
  **Ports never move.** If `PORT` (or, for a workspace, a `db:up`'s
247
278
  `DB_PORT`) is already taken, `qore dev` fails with `QORE_PORT_IN_USE`
248
279
  naming the port and, when it can determine one, the process already
@@ -436,7 +467,9 @@ likely, suggests `qore login --portal staging`.
436
467
  With `--json`, stdout is one document: `{"projectsRoot": "<path>|null",
437
468
  "steps": {"root"|"login"|"tenant"|"clone": {"status", "detail?"}}}`.
438
469
 
439
- Apps clone into `<root>/<tenant>/<app>/<module>`. A checkout outside the
470
+ Apps clone into `<root>/<tenant>/apps/<app>/` and their modules into
471
+ `<root>/<tenant>/modules/<module>`, shared by every app of the tenant that
472
+ uses them (see "Shared module checkouts" below). A checkout outside the
440
473
  folder registers itself the first time you use it (`qore clone <app> <dir>`,
441
474
  `qore dev`, ...); a registered checkout that was deleted is dropped. With a
442
475
  projects folder set, `qore dev`, `qore env pull`, `qore run` and `qore status`
@@ -452,9 +485,12 @@ qore config root --unset # clear it; known projects stay findable
452
485
 
453
486
  ### Workspaces
454
487
 
455
- `qore clone` sets up a local directory holding one or more of an app's
456
- modules, each in its own repository; `qore sync` keeps that directory in
457
- step with the app afterwards.
488
+ `qore clone` sets up a local directory for an app and its modules, each in
489
+ its own repository; `qore sync` keeps them in step with the app afterwards.
490
+ With a projects folder set, modules are shared between apps (next section);
491
+ without one, or with an explicit `qore clone <app> <dir>`, the directory
492
+ holds the module repositories itself and the rest of this section applies
493
+ as written.
458
494
 
459
495
  ```sh
460
496
  qore clone <app> # clones every module of <app> into ./<app-slug>
@@ -466,11 +502,15 @@ qore env pull # no trust prompt — a clone made by qore is alre
466
502
  cd ..
467
503
  qore sync # clone any module that's new, fetch the rest
468
504
  qore sync --pull # ...and fast-forward every clean repository with an upstream
505
+ qore code [app] [-- <claude args>] # start Claude Code in the app's frontend, every module added (--add-dir)
469
506
  ```
470
507
 
471
508
  - **Where it clones.** Without `[dir]` and with a projects folder set, `qore
472
- clone` uses `<root>/<tenant>/<app>`. Without a projects folder it behaves as
473
- described above and prints a tip to run `qore init`.
509
+ clone` puts the app folder at `<root>/<tenant>/apps/<app>` and its modules
510
+ in `<root>/<tenant>/modules/`. Without a projects folder it behaves as
511
+ described above and prints a tip to run `qore init`; with an explicit `[dir]`
512
+ it clones into `<dir>` as before, and with a projects folder set the tip
513
+ says that `qore init` shares modules between apps.
474
514
  - **`--protocol https|ssh`** picks the clone URL (default `https`). `ssh`
475
515
  rewrites `https://github.com/o/r` to `git@github.com:o/r.git`; your own
476
516
  git `insteadOf` config still applies on top of either.
@@ -490,7 +530,8 @@ qore sync --pull # ...and fast-forward every clean repository with
490
530
  table only when run in the directory that holds `qore.workspace.json`
491
531
  itself (not inside one of its module repositories, which shows that
492
532
  module).
493
- - **Nothing is ever deleted, moved or overwritten.** A present module
533
+ - **Nothing is ever deleted, moved or overwritten** (in this layout; the
534
+ shared layout moves and removes only with your consent, below). A present module
494
535
  directory is left exactly as it is; `sync` only fetches into it, and
495
536
  only fast-forwards with `--pull`, and only when the tree is clean and has
496
537
  an upstream — a dirty tree, one with no upstream, or one that would need
@@ -621,6 +662,130 @@ the usual single `{"ok":...}` document. An `exit` event carries an optional
621
662
  as ` → ...`) when the module crashed early with a non-zero code and no
622
663
  signal — never on a signalled or graceful exit.
623
664
 
665
+ ### Shared module checkouts
666
+
667
+ With a projects folder (`qore init`), a tenant's apps share their modules.
668
+ A module is cloned once, however many apps use it:
669
+
670
+ ```
671
+ <root>/<tenant>/modules/<slug>/ one checkout per module (the real repository)
672
+ <root>/<tenant>/apps/<app>/ one folder per app, holding no code
673
+ <root>/@<portal>/<tenant>/... the same, for a non-production portal
674
+ ```
675
+
676
+ Without a projects folder, and for `qore clone <app> <dir>`, nothing
677
+ changes: the module repositories sit in the workspace directory as before.
678
+
679
+ **The app folder** holds `qore.workspace.json` and files that make the
680
+ app's modules open together in an editor or Claude Code. `qore clone` and
681
+ `qore sync` write them from the portal's module list:
682
+
683
+ | File | Purpose |
684
+ |---|---|
685
+ | `<app>.code-workspace` | VS Code / Cursor: the app folder plus every module in `../../modules/` |
686
+ | `.idea/` (`modules.xml`, `<app>.iml`, `vcs.xml`) | WebStorm: the same modules as content roots and Git roots |
687
+ | `CLAUDE.md` | which modules the app has, where they are, and which other apps share them |
688
+ | `.claude/settings.json` | `permissions.additionalDirectories` for the modules |
689
+
690
+ Only what qore owns is rewritten; the rest is yours. In `CLAUDE.md` that is
691
+ the block between `<!-- qore:app:start -->` and `<!-- qore:app:end -->` —
692
+ write anything you like outside it. In `.code-workspace` qore sets
693
+ `folders` and keeps every other key (settings, extensions). In
694
+ `.claude/settings.json` it keeps every other key, and any
695
+ `additionalDirectories` entry of your own as long as it is not under
696
+ `../../modules/`. Your indentation and line endings are kept. A file qore
697
+ merges into (`<app>.code-workspace`, `.claude/settings.json`, `CLAUDE.md`)
698
+ that is a symlink, or that cannot be parsed, is skipped and named in the
699
+ output, never overwritten. The three `.idea` files and `qore.workspace.json`
700
+ are qore's alone and are rewritten whole, edits included (qore still never
701
+ writes through a symlink). A sync that changes nothing rewrites nothing.
702
+
703
+ **Opening an app.**
704
+
705
+ - VS Code or Cursor: open `apps/<app>/<app>.code-workspace`.
706
+ - WebStorm: open `apps/<app>/` as the project.
707
+ - Claude Code: `qore code <app>` (see "`qore code`" below). Plain `claude`
708
+ in the app folder is not enough: the folder holds no code, and Claude's
709
+ search does not reach other directories unless they are added with
710
+ `--add-dir`, which `qore code` does for you.
711
+
712
+ **Commands inside `modules/<slug>`.** There is no `qore.workspace.json`
713
+ there, so qore asks which apps list the module. One app: it is used. Several:
714
+ an interactive run asks, otherwise pass `--app <slug>`. When the portal
715
+ puts the module in more apps than are cloned here and one of the cloned
716
+ ones is used, qore says so on stderr: `Using app <app> (the only app here
717
+ using <module>; also in <apps> — pass --app to choose).`
718
+
719
+ **`qore sync`** works for the whole tenant, not only the app you are in:
720
+ it reads every app folder of the tenant that it can access, clones what is
721
+ missing into `modules/`, fetches every checkout once, and rewrites every
722
+ readable app's view files. An app folder it cannot read or access is
723
+ reported and left alone, and its modules still count as used.
724
+
725
+ **Converting the old layout.** Apps cloned before this layout hold real
726
+ repositories at `<tenant>/<app>/<module>`. `qore sync` (or `qore clone` of
727
+ such an app) converts what it finds:
728
+
729
+ - a module checkout is moved to `modules/<slug>` (when several apps hold a
730
+ copy you choose which one moves);
731
+ - another app's copy of the same module is removed — only when it is clean;
732
+ - the old app folder is retired: `qore.workspace.json` moves to
733
+ `apps/<app>/` and a `README.md` stays behind saying where everything
734
+ went (an existing README is kept, and reported).
735
+
736
+ **Qore asks first**, once, listing every path it would change. Without
737
+ your yes nothing is moved or removed and sync reports the changes as kept;
738
+ it never asks with `--json`, `--no-input` or without a terminal, so run
739
+ `qore sync` interactively to convert. A duplicate is **clean** when it has
740
+ no uncommitted changes (untracked files that are not git-ignored count,
741
+ whatever your `status.showUntrackedFiles` says), no commits that are not
742
+ pushed (a detached HEAD counts), no stashes, and no linked worktrees (`git
743
+ worktree add`, inside the clone or elsewhere); when git cannot tell, it is
744
+ not clean. A clone with linked worktrees, or one that is itself a linked
745
+ worktree, is never removed or moved: move it by hand, then run `git worktree
746
+ repair`. A copy that is not clean is kept, with
747
+ the reason, and you decide what to do with it. If a move fails — an
748
+ editor or a running dev server can hold the folder, notably on Windows —
749
+ the error says to stop `qore dev` for the app and run `qore sync` again.
750
+ A checkout in `modules/` that no app uses any more is reported as `not used
751
+ by any app — left in place`; qore never deletes it.
752
+
753
+ Known limits:
754
+
755
+ - `qore clone` of an app whose shared module still sits in another app's
756
+ old-layout folder clones it a second time into `modules/`; the next
757
+ `qore sync` offers to remove the old copy.
758
+ - A module cloned by `qore dev` shows in an app's view files after the
759
+ next `qore sync`.
760
+
761
+ #### `qore code`
762
+
763
+ ```sh
764
+ qore code # the app you are in
765
+ qore code <app> # an app of the tenant you are in
766
+ qore code <app> -- --resume # arguments after -- go to claude
767
+ ```
768
+
769
+ Starts Claude Code in the app's frontend module, with every other module of
770
+ the app and the app folder added (`--add-dir`), and sets
771
+ `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` so Claude reads the added
772
+ modules' `CLAUDE.md` files. An app without a frontend starts in the app
773
+ folder. The module list comes from the portal.
774
+
775
+ - **Which app.** `<app>` is looked up in the tenant of the current
776
+ directory, else in the projects folder (a slug cloned in several places
777
+ asks you to run it from inside one). Without `<app>`: from an app folder,
778
+ that app; from `modules/<slug>`, the app that uses the module (a picker
779
+ when several do, otherwise `Pass an app: used by …`).
780
+ - It needs a projects folder and the shared layout. An old-layout
781
+ workspace asks you to run `qore sync` first (`qore code needs the shared
782
+ layout: run qore sync to convert this workspace.`); modules not cloned yet
783
+ are listed with `Run qore sync first.`
784
+ - `claude` not found: `QORE_TOOL_MISSING`, "Install Claude Code: npm i -g
785
+ @anthropic-ai/claude-code". Otherwise `claude`'s own exit code (or
786
+ 128 + signal) is `qore code`'s.
787
+ - No `--json`.
788
+
624
789
  ### `--json`
625
790
 
626
791
  Every command accepts `--json`, which prints exactly one JSON document on
@@ -637,7 +802,7 @@ qore whoami --json
637
802
  | Code | Meaning |
638
803
  |------|---------|
639
804
  | 0 | Success |
640
- | 1 | Internal error, `git` is not installed or not on `PATH`, the OS keychain is unavailable/access was denied, or qore itself needs a newer Node (`QORE_NODE_VERSION`, checked by `qore doctor`'s own `node` check against qore's own `process.version`); `qore dev`: its package manager isn't installed (`QORE_PACKAGE_MANAGER`), its install failed (`QORE_INSTALL_FAILED`), Docker is missing (`QORE_DOCKER_MISSING`), not running (`QORE_DOCKER_NOT_RUNNING`) or its compose v2 plugin is missing (`QORE_DOCKER_COMPOSE_MISSING`), a `db:up`/service failed, never became healthy (`QORE_SERVICE_UNHEALTHY`) or its data is incompatible (`QORE_SERVICE_DATA_INCOMPATIBLE`), or the repository's own `engines.node` doesn't match the `node` on `PATH` (`QORE_NODE_VERSION`, a different check from qore's own — `qore doctor`'s `node:<module>` check, run only in a trusted repository); or the projects folder isn't writable (`QORE_ROOT_NOT_WRITABLE`, fix its permissions or choose another folder) |
805
+ | 1 | Internal error, `git` is not installed or not on `PATH`, the OS keychain is unavailable/access was denied, or qore itself needs a newer Node (`QORE_NODE_VERSION`, checked by `qore doctor`'s own `node` check against qore's own `process.version`); `qore dev`: its package manager isn't installed (`QORE_PACKAGE_MANAGER`), its install failed (`QORE_INSTALL_FAILED`), Docker is missing (`QORE_DOCKER_MISSING`), not running (`QORE_DOCKER_NOT_RUNNING`) or its compose v2 plugin is missing (`QORE_DOCKER_COMPOSE_MISSING`), a `db:up`/service failed, never became healthy (`QORE_SERVICE_UNHEALTHY`) or its data is incompatible (`QORE_SERVICE_DATA_INCOMPATIBLE`), or the repository's own `engines.node` doesn't match the `node` on `PATH` (`QORE_NODE_VERSION`, a different check from qore's own — `qore doctor`'s `node:<module>` check, run only in a trusted repository); `qore code`: `claude` is not on `PATH` (`QORE_TOOL_MISSING`); or the projects folder isn't writable (`QORE_ROOT_NOT_WRITABLE`, fix its permissions or choose another folder) |
641
806
  | 2 | Missing or invalid context (e.g. a bad `--portal` value, or no module selected), or the module is part of several apps and no `--app` was given; `qore dev`: a port is already in use (`QORE_PORT_IN_USE`) or the repository's dev setup isn't supported (`QORE_DEV_UNSUPPORTED`); projects folder: not set and not inside a project, for a logged-in user (`QORE_ROOT_NOT_SET`, run `qore init`; logged out with no folder you get the login error, exit 4, and logged out with a folder the local lookup runs first, so an empty folder still gives `QORE_PROJECT_NOT_FOUND`), not usable as a folder (`QORE_ROOT_INVALID`, pick another with `qore init --root <path>`), or no local project matches the reference or the folder holds none (`QORE_PROJECT_NOT_FOUND`, run `qore clone <app>`) |
642
807
  | 4 | Not logged in, session/login expired, login denied, or clock skew |
643
808
  | 5 | Access denied — lost tenant access, resource not found, no developer access |