create-flowdular 0.5.1 → 0.6.1
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 +8 -5
- package/agent-template/.agents/skills/agent-tool-design/SKILL.md +1 -1
- package/agent-template/.agents/skills/auth-security-review/SKILL.md +1 -1
- package/agent-template/.agents/skills/database-adapter/SKILL.md +5 -5
- package/agent-template/.agents/skills/database-adapter/references/first-run-and-matrix.md +2 -2
- package/agent-template/.agents/skills/deploy-operate/SKILL.md +1 -1
- package/agent-template/.agents/skills/migration-authoring/SKILL.md +4 -4
- package/agent-template/.agents/skills/module-new/SKILL.md +1 -1
- package/agent-template/.agents/skills/spec-approval/SKILL.md +6 -2
- package/agent-template/.agents/skills/spec-interview/SKILL.md +2 -2
- package/agent-template/.agents/skills/test-hardening/SKILL.md +2 -2
- package/agent-template/.agents/skills/workflow-development/SKILL.md +95 -9
- package/agent-template/.ai/agents/sandbox/business-manager.md +2 -2
- package/agent-template/.ai/blueprints/add-migration/required-files.yaml +1 -1
- package/agent-template/.ai/blueprints/new-module/required-files.yaml +1 -1
- package/agent-template/.ai/platform-capabilities.md +10 -8
- package/agent-template/.ai/policies/capabilities.yaml +28 -12
- package/agent-template/.ai/skills/README.md +1 -1
- package/agent-template/.ai/skills/agent-tool-design/SKILL.md +1 -1
- package/agent-template/.ai/skills/auth-security-review/SKILL.md +1 -1
- package/agent-template/.ai/skills/database-adapter/SKILL.md +5 -5
- package/agent-template/.ai/skills/database-adapter/references/first-run-and-matrix.md +2 -2
- package/agent-template/.ai/skills/deploy-operate/SKILL.md +1 -1
- package/agent-template/.ai/skills/migration-authoring/SKILL.md +4 -4
- package/agent-template/.ai/skills/module-new/SKILL.md +1 -1
- package/agent-template/.ai/skills/spec-approval/SKILL.md +6 -2
- package/agent-template/.ai/skills/spec-interview/SKILL.md +2 -2
- package/agent-template/.ai/skills/test-hardening/SKILL.md +2 -2
- package/agent-template/.ai/skills/workflow-development/SKILL.md +96 -10
- package/agent-template/.claude/skills/agent-tool-design/SKILL.md +1 -1
- package/agent-template/.claude/skills/auth-security-review/SKILL.md +1 -1
- package/agent-template/.claude/skills/database-adapter/SKILL.md +5 -5
- package/agent-template/.claude/skills/database-adapter/references/first-run-and-matrix.md +2 -2
- package/agent-template/.claude/skills/deploy-operate/SKILL.md +1 -1
- package/agent-template/.claude/skills/migration-authoring/SKILL.md +4 -4
- package/agent-template/.claude/skills/module-new/SKILL.md +1 -1
- package/agent-template/.claude/skills/spec-approval/SKILL.md +6 -2
- package/agent-template/.claude/skills/spec-interview/SKILL.md +2 -2
- package/agent-template/.claude/skills/test-hardening/SKILL.md +2 -2
- package/agent-template/.claude/skills/workflow-development/SKILL.md +95 -9
- package/agent-template/docs/adr/0003-module-settings.md +2 -0
- package/agent-template/docs/adr/0007-module-owned-agents.md +35 -1
- package/agent-template/docs/agent-contract.md +3 -3
- package/agent-template/docs/cli-extensions.md +1 -0
- package/agent-template/docs/cli.md +40 -3
- package/agent-template/docs/configuration.md +64 -9
- package/agent-template/docs/database-adapters.md +30 -22
- package/agent-template/docs/design-system.md +7 -3
- package/agent-template/docs/getting-started.md +29 -32
- package/agent-template/docs/module-distribution.md +79 -86
- package/agent-template/docs/module-web-surfaces.md +9 -7
- package/agent-template/docs/modules.md +6 -2
- package/agent-template/docs/sandbox.md +23 -4
- package/agent-template/platform/scripts/build.mjs +7 -0
- package/dist/bin.js +3 -6
- package/package.json +1 -1
- package/template/default/.env.example +8 -3
- package/template/default/.vercelignore +8 -0
- package/template/default/README.md +20 -11
- package/template/default/_gitignore +3 -2
- package/template/default/infra/README.md +86 -65
- package/template/default/infra/docker/.env.example +71 -0
- package/template/default/infra/docker/Dockerfile +29 -11
- package/template/default/infra/docker/app-entrypoint.mjs +5 -0
- package/template/default/infra/docker/compose.yaml +109 -58
- package/template/default/infra/docker/database-urls.mjs +28 -0
- package/template/default/infra/docker/pitr.sh +177 -0
- package/template/default/infra/docker/postgres/10-roles.sh +16 -12
- package/template/default/infra/docker/start.mjs +402 -0
- package/template/default/infra/kubernetes/database-secret.example.yaml +3 -3
- package/template/default/infra/kubernetes/deployment.yaml +5 -0
- package/template/default/infra/sdk-module-manifests.mjs +118 -0
- package/template/default/infra/vercel/README.md +262 -0
- package/template/default/infra/vercel/build.mjs +223 -0
- package/template/default/infra/vercel/handler.mjs +100 -0
- package/template/default/modules/example/migrations/0001_example_core.up.sql +2 -2
- package/template/default/modules/example/module.json +1 -1
- package/template/default/modules/example/package.json +3 -3
- package/template/default/modules/example/spec/module.yaml +1 -1
- package/template/default/modules/example/src/services/migration.ts +2 -2
- package/template/default/modules/example/tests/module.test.ts +1 -1
- package/template/default/package.json +2 -3
- package/template/default/platform/octane.config.ts +290 -156
- package/template/default/platform/package.json +5 -5
- package/template/default/platform/scripts/build.mjs +56 -0
- package/template/default/platform/scripts/dev.mjs +101 -18
- package/template/default/platform/src/generated/modules.server.ts +1 -0
- package/template/default/platform/src/server/database.ts +24 -0
- package/template/default/platform/src/server/lifecycle.ts +325 -0
- package/template/default/platform/src/server/runtime-role.ts +33 -0
- package/template/default/platform/src/server/setup/access.ts +160 -0
- package/template/default/platform/src/server/setup/adapters.ts +554 -0
- package/template/default/platform/src/server/setup/environment.ts +154 -0
- package/template/default/platform/src/server/setup/gate.ts +84 -0
- package/template/default/platform/src/server/setup/index.ts +181 -0
- package/template/default/platform/src/server/setup/modules.ts +119 -0
- package/template/default/platform/src/server/setup/page.ts +548 -0
- package/template/default/platform/src/server/setup/routes.ts +788 -0
- package/template/default/platform/src/server/setup/sanitize.ts +111 -0
- package/template/default/platform/src/server/setup/seed.ts +192 -0
- package/template/default/platform/src/server/setup/token.ts +79 -0
- package/template/default/platform/src/server/worker-tick.ts +193 -0
- package/template/default/platform/src/server/workspace-root.ts +16 -0
- package/template/default/render.yaml +70 -0
- package/template/default/vercel.json +5 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Getting started
|
|
2
2
|
|
|
3
|
-
Run Flowdular on your machine,
|
|
3
|
+
Run Flowdular on your machine, create a workspace, and sign in.
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
@@ -19,48 +19,44 @@ pnpm flowdular doctor
|
|
|
19
19
|
`doctor` reports workspace health (configuration, enabled modules, generated
|
|
20
20
|
composition, guardrail files). Add `--json` for a machine-readable envelope.
|
|
21
21
|
|
|
22
|
-
##
|
|
23
|
-
|
|
24
|
-
`pnpm flowdular setup` opens an interactive wizard. Choose a local demo, configure PostgreSQL, or check the existing configuration. Local initialization requires confirmation and a stopped application.
|
|
25
|
-
|
|
26
|
-
For scripts and CI, `setup quick` is a destructive local reset. It prints its full plan first and
|
|
27
|
-
writes only after a typed confirmation:
|
|
22
|
+
## Run the platform
|
|
28
23
|
|
|
29
24
|
```bash
|
|
30
|
-
pnpm
|
|
31
|
-
pnpm flowdular setup quick --apply --confirm reset-local-auth # resets and seeds
|
|
25
|
+
pnpm dev
|
|
32
26
|
```
|
|
33
27
|
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
On the first run, open [localhost:4310/setup](http://localhost:4310/setup).
|
|
29
|
+
Enter the one-time token from the terminal, then create your
|
|
30
|
+
workspace and owner account. Embedded PostgreSQL is already configured. Restart
|
|
31
|
+
`pnpm dev` after setup and sign in with that account.
|
|
32
|
+
|
|
33
|
+
Vite HMR covers TSRX, TypeScript and styles. The launcher keeps tool warnings
|
|
34
|
+
quiet; use `pnpm dev -- --verbose` for full diagnostics. `pnpm dev` runs
|
|
35
|
+
`module sync` first, so a composition change is picked up without a manual
|
|
36
|
+
step. Ctrl+C, SIGTERM or a closed terminal stops the server after open requests
|
|
37
|
+
finish and background work drains, within six seconds. A second Ctrl+C does not
|
|
38
|
+
cut that short, because pnpm already delivers every Ctrl+C more than once;
|
|
39
|
+
Ctrl+\ stops it at once.
|
|
40
|
+
The session lives in an HttpOnly cookie and carries the scopes of the
|
|
41
|
+
selected tenant membership. A bookmark pointing at another workspace you
|
|
42
|
+
belong to switches the session on load.
|
|
36
43
|
|
|
37
|
-
|
|
44
|
+
`Development` navigation is visible only to tenant owners; server permissions
|
|
45
|
+
stay authoritative either way.
|
|
38
46
|
|
|
39
|
-
|
|
40
|
-
| ------------------- | ---------------- | -------------------------- |
|
|
41
|
-
| `admin@example.com` | `Owner!23456789` | Owner of both demo tenants |
|
|
42
|
-
| `user@example.com` | `Member!2345678` | Reduced scope member |
|
|
47
|
+
## Optional local demo reset
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
`pnpm flowdular setup quick` resets local authentication data and seeds two
|
|
50
|
+
demo workspaces. It is for development or test databases only. Stop `pnpm dev`
|
|
51
|
+
and review the dry-run plan before applying it:
|
|
45
52
|
|
|
46
53
|
```bash
|
|
47
|
-
pnpm
|
|
54
|
+
pnpm flowdular setup quick # dry run, prints the plan
|
|
55
|
+
pnpm flowdular setup quick --apply --confirm reset-local-auth # resets and seeds
|
|
48
56
|
```
|
|
49
57
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
diagnostics. `pnpm dev` runs `module sync` first, so a composition change is
|
|
53
|
-
picked up without a manual step.
|
|
54
|
-
|
|
55
|
-
The first visit opens the `auth.core` sign-in flow. The session lives in an
|
|
56
|
-
HttpOnly cookie and carries the scopes of the selected tenant membership. On a
|
|
57
|
-
clean database the sign-up wizard is available: workspace name plus a unique
|
|
58
|
-
workspace id (the first URL segment, `/{workspace}/{view}`), then the
|
|
59
|
-
administrator account, then an optional email confirmation step. A bookmark
|
|
60
|
-
pointing at another workspace you belong to switches the session on load.
|
|
61
|
-
|
|
62
|
-
`Development` navigation is visible only to tenant owners; server permissions
|
|
63
|
-
stay authoritative either way.
|
|
58
|
+
The demo logins are `admin@example.com` / `Owner!23456789` (owner) and
|
|
59
|
+
`user@example.com` / `Member!2345678` (member).
|
|
64
60
|
|
|
65
61
|
## Where local state lives
|
|
66
62
|
|
|
@@ -69,6 +65,7 @@ module shares one embedded PostgreSQL in `.flowdular/data/pglite`, which
|
|
|
69
65
|
`FD_DATABASE_PGLITE_DIRECTORY` can redirect. Point `FD_DATABASE_ADAPTER` at
|
|
70
66
|
`postgresql` and give it `FD_DATABASE_URL` to run against a real server instead.
|
|
71
67
|
See [configuration.md](configuration.md).
|
|
68
|
+
Workspaces from Flowdular 0.5 or earlier: see [flowdular-rename.md](https://github.com/flowdular/flowdular/blob/main/docs/flowdular-rename.md).
|
|
72
69
|
|
|
73
70
|
## Migrating preserved state from `.octane-erp`
|
|
74
71
|
|
|
@@ -1,103 +1,96 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Module Studio
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
Module Studio uses one reviewable plan for a module source change. A platform
|
|
4
|
+
checkout owns its sources in `flowdular.module-sources.json`, its exact plans in
|
|
5
|
+
`module-plans/<sha256>.json`, and installed source hashes in
|
|
6
|
+
`flowdular.modules.lock.json`. Commit these files with the application when
|
|
7
|
+
they change. A catalog can be a local JSON file or an HTTPS URL. A Git source
|
|
8
|
+
names a repository and a full commit, and may itself be local or HTTPS. No
|
|
9
|
+
publisher or repository name is built into the installer.
|
|
7
10
|
|
|
8
11
|
```sh
|
|
9
|
-
pnpm flowdular module
|
|
10
|
-
pnpm flowdular module
|
|
11
|
-
|
|
12
|
-
pnpm flowdular module
|
|
12
|
+
pnpm flowdular module source add community https://modules.example/registry/index.json --apply
|
|
13
|
+
pnpm flowdular module source add team https://github.com/acme/modules.git \
|
|
14
|
+
--git-commit <40-character-commit> --catalog-path registry/index.json --apply
|
|
15
|
+
pnpm flowdular module source add local ./registry/index.json --apply
|
|
16
|
+
pnpm flowdular module source list
|
|
17
|
+
pnpm flowdular module search expenses --source community
|
|
18
|
+
pnpm flowdular module plan expenses.core@1.2.0 --source community --apply
|
|
19
|
+
pnpm flowdular module plan show <plan-id>
|
|
20
|
+
pnpm flowdular module apply <plan-id> --apply
|
|
13
21
|
pnpm flowdular module enable expenses.core --apply
|
|
14
|
-
pnpm
|
|
22
|
+
pnpm build
|
|
15
23
|
```
|
|
16
24
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
`
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
`source add`, `plan`, and `apply` preview their work unless `--apply` is present.
|
|
26
|
+
With exactly one configured source, `--source` may be omitted. `module plan
|
|
27
|
+
list` shows saved plans; `module plan remove <plan-id> --apply` deletes an
|
|
28
|
+
obsolete plan. At most 32 plans may exist at once, with 4 MiB per plan and
|
|
29
|
+
8 MiB in total. A plan records the selected
|
|
30
|
+
releases, artifact SHA-256, Git commit where applicable, dependency closure,
|
|
31
|
+
requested permissions, migration file hashes, and server/client build impact.
|
|
32
|
+
Its ID hashes the plan content. Applying it refuses changed workspace module
|
|
33
|
+
manifests or a changed install lock and verifies every artifact again. If the
|
|
34
|
+
source is no longer available, regenerate or provide it again; the plan does
|
|
35
|
+
not contain executable source bytes.
|
|
36
|
+
|
|
37
|
+
Installation copies reviewed source into a configured module root and writes
|
|
38
|
+
the install lock. It does not run downloaded scripts, npm install, migrations,
|
|
39
|
+
or permission grants. `module enable --apply` links the package, regenerates
|
|
40
|
+
composition and follows the platform's scope grant process. Rebuild and
|
|
41
|
+
restart the application to serve new code. A deployed container shows plans
|
|
42
|
+
and module state in Administration, Module Studio; it never writes its own code.
|
|
43
|
+
For creating or changing your own module, the same view links to Sandbox when
|
|
44
|
+
`sandbox.core` is active. Sandbox keeps the approved spec hash, gate and PR
|
|
45
|
+
checks, and delivers to the workspace or its configured Git repository.
|
|
37
46
|
|
|
38
47
|
## Trust and recovery
|
|
39
48
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
Only a configured host CLI resolves sources. Sandbox specialists do not gain
|
|
50
|
+
network, Git, database or filesystem permissions from a source entry. HTTPS
|
|
51
|
+
downloads reject redirects and have time and size limits. HTTPS artifacts must
|
|
52
|
+
use the catalog origin and a path containing their declared source commit.
|
|
53
|
+
The artifact digest is verified after download. Git checkouts verify their full
|
|
54
|
+
commit. Catalogs and artifacts are bounded; paths, manifests, package scripts,
|
|
55
|
+
review evidence and approved specs are checked before a plan is saved. A
|
|
56
|
+
checksum identifies bytes but does not certify a publisher, so review the
|
|
57
|
+
source and permissions before `module apply` and `module enable`.
|
|
58
|
+
|
|
59
|
+
Updates use `module plan <id[@version]> --source <name> --update --apply`.
|
|
60
|
+
The installer refuses local changes, changed historical migrations and
|
|
61
|
+
downgrades. `module validate --locked` checks installed file hashes. Installs
|
|
62
|
+
use an exclusive transaction directory; after a process crash, run `module
|
|
63
|
+
recover` and then `module recover --apply`. Recovery restores source and lock
|
|
64
|
+
state, not database migrations. Source-list edits use a separate
|
|
65
|
+
`flowdular.module-sources.json.lock` directory. If a host process crashes
|
|
66
|
+
during that short write, confirm no other source command is running and remove
|
|
67
|
+
that stale directory before retrying.
|
|
68
|
+
Plan writes use the same atomic pattern and a `module-plans.lock` directory.
|
|
69
|
+
After a crash, confirm the writer has stopped and remove a stale plan lock
|
|
70
|
+
before retrying; no partial plan is published.
|
|
71
|
+
|
|
72
|
+
Scripts that called `module install` or `module update` with `--registry` must
|
|
73
|
+
add that catalog as a named source, save a plan, and apply its ID. An existing
|
|
74
|
+
`flowdular.modules.lock.json` remains the installed-source record, so an
|
|
75
|
+
already managed module can use `module plan <id> --update --apply` for its next
|
|
76
|
+
release. No direct registry installation path remains.
|
|
77
|
+
Automation that imported `installModule` from `flowdular/distribution` must use
|
|
78
|
+
the host CLI plan and apply commands; that direct install export was removed.
|
|
79
|
+
|
|
80
|
+
The old `official-modules` Sandbox delivery target was removed. Change
|
|
81
|
+
`sandbox.delivery.targets` to `workspace` or `git-pr`; `git-pr` points to the
|
|
82
|
+
platform repository configured in `flowdular.json`. A catalog publisher can
|
|
83
|
+
use any Git repository and publish immutable artifacts independently. Historical
|
|
84
|
+
review and RFC documents retain the old project name as provenance.
|
|
61
85
|
|
|
62
86
|
## SDK publication and consumer checks
|
|
63
87
|
|
|
64
88
|
```sh
|
|
65
89
|
pnpm release:pack
|
|
66
90
|
pnpm release:smoke
|
|
67
|
-
# Also install and test actual source artifacts from the official repo:
|
|
68
|
-
node scripts/smoke-sdk.mjs release-artifacts/sdk /path/to/official-modules/registry/local-index.json
|
|
69
91
|
```
|
|
70
92
|
|
|
71
|
-
`release-artifacts/sdk/sdk.json` lists
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
artifacts outside runtime state directories; creating both `.flowdular` and legacy
|
|
76
|
-
`.coreloom` state would correctly stop the application.
|
|
77
|
-
|
|
78
|
-
The smoke test creates a separate project and resolves SDK dependencies from
|
|
79
|
-
packed artifacts, without aliases or symlinks into core sources. With a module
|
|
80
|
-
catalog it installs all module source artifacts, enables their source composition,
|
|
81
|
-
checks the lock, typechecks and executes the consumer's tests. Its composition
|
|
82
|
-
check does not grant tenant scopes; auth CLI tests cover that separate boundary.
|
|
83
|
-
|
|
84
|
-
Sandbox examples use `.ai/references/catalog`, generated from a reviewed official
|
|
85
|
-
artifact. `pnpm reference:check` verifies every file against the pinned provenance
|
|
86
|
-
record. Do not edit the generated reference. To update it, build the CLI and run
|
|
87
|
-
`scripts/module-reference.mjs` with `--artifact`, `--sha256`, `--source-commit` and
|
|
88
|
-
`--apply`. Skills and sandbox preparation refer to that offline snapshot.
|
|
89
|
-
|
|
90
|
-
`pnpm release:publish` previews the exact publication set after validating every
|
|
91
|
-
artifact digest. The operator can then use `pnpm release:publish --apply` after npm
|
|
92
|
-
authentication. It skips already-published identical tarballs and stops if a
|
|
93
|
-
version exists with different bytes. No npm publication is performed by packing,
|
|
94
|
-
smoke testing or the default publication preview.
|
|
95
|
-
|
|
96
|
-
The `SDK consumer smoke` workflow (`.github/workflows/sdk-release.yml`, job
|
|
97
|
-
`consumer`) runs the pack and the smoke on every pull request and push to main
|
|
98
|
-
that touches `packages`, `modules` or `scripts`. It never publishes: its token
|
|
99
|
-
can only read the repository, and the packed tarballs are kept as an Actions
|
|
100
|
-
artifact only after a merge to main. `pnpm verify` is not repeated there, the
|
|
101
|
-
CI workflow owns it.
|
|
102
|
-
|
|
103
|
-
The SDK is assembled from private internal workspaces. Import UI from `@flowdular/sdk/ui` and styles from `@flowdular/sdk/ui/styles`; use `@flowdular/sdk/server`, `client`, `contracts` or `modules/<name>` for other surfaces. There is no root SDK barrel, so browser imports do not load server entrypoints. See [npm publication](https://github.com/flowdular/flowdular/blob/main/docs/npm-publication.md).
|
|
93
|
+
`release-artifacts/sdk/sdk.json` lists the SDK, CLI, project generator and
|
|
94
|
+
Sandbox tarballs with SHA-256 digests. Publication is separate from packing
|
|
95
|
+
and smoke tests. The project generator and SDK must be released together so a
|
|
96
|
+
new application's module tooling sees the same contracts.
|
|
@@ -140,13 +140,15 @@ in front of it, as the bundled Node server does.
|
|
|
140
140
|
### Backoffice address
|
|
141
141
|
|
|
142
142
|
The first-run setup includes **Backoffice address**, defaulting to `/app` (or the
|
|
143
|
-
installation's configured default).
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
143
|
+
installation's configured default). When choosing a database in the wizard, an
|
|
144
|
+
operator can choose `/backoffice` to leave `/` available for a storefront. Setup
|
|
145
|
+
validates the address, includes it in the review, and writes
|
|
146
|
+
`FD_APPLICATION_PATH=/backoffice` alongside the database settings. Restart after
|
|
147
|
+
setup; no client rebuild is needed. When the database is already configured by
|
|
148
|
+
the deployment, the wizard skips that step and the deployment's
|
|
149
|
+
`FD_APPLICATION_PATH` controls the address. A read-only deployment must store
|
|
150
|
+
new settings in its environment before restart. Setup never echoes connection
|
|
151
|
+
secrets back to the browser.
|
|
150
152
|
|
|
151
153
|
For configuration managed in source control, add:
|
|
152
154
|
|
|
@@ -181,7 +181,9 @@ package is not linked yet, and regenerates
|
|
|
181
181
|
grants the scopes declared by each newly enabled module to every workspace owner
|
|
182
182
|
through `auth sync-scopes`; a failed grant is reported as
|
|
183
183
|
`MODULE_SCOPES_SYNC_FAILED`, and when `auth.core` is unavailable the grant is
|
|
184
|
-
skipped with a warning.
|
|
184
|
+
skipped with a warning. That grant reaches only workspaces that already exist,
|
|
185
|
+
so first-run setup grants the permissions of every enabled module to the owner
|
|
186
|
+
it creates.
|
|
185
187
|
|
|
186
188
|
`disable` refuses while another enabled module depends on the target, then
|
|
187
189
|
removes it and regenerates. `system.core` and `auth.core` are protected.
|
|
@@ -222,7 +224,9 @@ dependents, which the bump command does. `module validate` reports
|
|
|
222
224
|
`PLATFORM_API_MISSING` when a manifest lacks `platformApi`.
|
|
223
225
|
|
|
224
226
|
`platformApi` is the range of the platform contract the module compiles against
|
|
225
|
-
(`^0.
|
|
227
|
+
(`^0.2.0`). Module sync and install refuse a manifest without one, and a range
|
|
228
|
+
that also admits a version before the platform's current minor line, such as
|
|
229
|
+
`*` or `>=0.1.0`. The contract surface is pinned in
|
|
226
230
|
`packages/kernel/platform-api.snapshot.d.ts`; a change to it without a
|
|
227
231
|
`PLATFORM_API_VERSION` bump fails `pnpm verify`. `module search --compatible`
|
|
228
232
|
lists only releases whose range accepts the running platform.
|
|
@@ -57,7 +57,18 @@ written.
|
|
|
57
57
|
|
|
58
58
|
An application already serving on the platform port is left alone, and no
|
|
59
59
|
credential is prepared for it. `--platform` and `--platform-port` say otherwise
|
|
60
|
-
explicitly; `--no-platform` never starts one.
|
|
60
|
+
explicitly; `--no-platform` never starts one. An application the launcher
|
|
61
|
+
started stops with it, including when the terminal closes or the launcher is
|
|
62
|
+
killed. It gets eight seconds to drain before it is killed, two more than the
|
|
63
|
+
six the development server gives itself; both figures live in
|
|
64
|
+
`@flowdular/sdk/dev-console/shutdown`. The installs, gates and Git commands the
|
|
65
|
+
sandbox runs stop with it the same way.
|
|
66
|
+
|
|
67
|
+
One sandbox runs per workspace. A second launcher, or `pnpm eval`, on a
|
|
68
|
+
workspace whose sandbox is running exits with the PID of the process that holds
|
|
69
|
+
it. The hold is the directory `.flowdular/sandbox/workspace.lock`; it goes away
|
|
70
|
+
when that process ends, and one left by a process that was killed outright is
|
|
71
|
+
taken over by the next start.
|
|
61
72
|
|
|
62
73
|
## The credential is prepared, not pasted
|
|
63
74
|
|
|
@@ -349,9 +360,17 @@ of 1 to 120 characters, and a recommendation that must be one of those options.
|
|
|
349
360
|
`allowFreeText` defaults to false, and a question with neither an option nor
|
|
350
361
|
free text cannot be answered, so it is refused. The block has to be the last
|
|
351
362
|
thing in the reply apart from the mandatory handoff line, and a reply carries at
|
|
352
|
-
most one. A block the sandbox cannot read is a
|
|
353
|
-
|
|
354
|
-
|
|
363
|
+
most one. A block the sandbox cannot read is never a failed turn and never
|
|
364
|
+
dropped in silence: the transcript says why it was refused, and the specialist
|
|
365
|
+
gets the reason and these limits for one repair turn. A second refusal in a row
|
|
366
|
+
stops for the operator, who answers in words. A turn that asks stops for the
|
|
367
|
+
answers, never for approval, and the approval route refuses a module with open
|
|
368
|
+
questions (`409 QUESTIONS_PENDING`). A gate that failed in the same turn waits
|
|
369
|
+
too: the handoff names it, the gates run again after the answering turn, and a
|
|
370
|
+
failure that remains then goes back to the specialist. Such a session is in the
|
|
371
|
+
`awaiting-answers` state, so `awaiting-approval` only ever means an approval.
|
|
372
|
+
`sandbox.core` has no state for open questions, so the platform record keeps
|
|
373
|
+
`awaiting-approval` for it.
|
|
355
374
|
|
|
356
375
|
A readable block is stored on the session as `pendingQuestions`, with the
|
|
357
376
|
transcript sequence of the message that asked, the role that asked and the
|
|
@@ -7,6 +7,13 @@ import { join } from 'node:path';
|
|
|
7
7
|
const stateDirectory = mkdtempSync(join(tmpdir(), 'flowdular-build-'));
|
|
8
8
|
const buildSecret = () => randomBytes(32).toString('base64');
|
|
9
9
|
|
|
10
|
+
/* Vite clears its output trees, but can leave hidden runtime state at the
|
|
11
|
+
dist root. A prior preview must never become part of the next bundle. */
|
|
12
|
+
rmSync(join(import.meta.dirname, '..', 'dist'), {
|
|
13
|
+
recursive: true,
|
|
14
|
+
force: true,
|
|
15
|
+
});
|
|
16
|
+
|
|
10
17
|
/* The Octane plugin evaluates the server composition while bundling it. Give
|
|
11
18
|
that build-time process isolated state and ephemeral keys, without using deployment database settings or encryption keys. The emitted server still reads its real
|
|
12
19
|
production environment when it starts. */
|
package/dist/bin.js
CHANGED
|
@@ -294,7 +294,6 @@ function nextSteps(input) {
|
|
|
294
294
|
return [
|
|
295
295
|
`cd ${input.directory}`,
|
|
296
296
|
...input.installed ? [] : [`${input.packageManager} install`],
|
|
297
|
-
runScript(input.packageManager, "flowdular", "setup"),
|
|
298
297
|
runScript(input.packageManager, "dev")
|
|
299
298
|
];
|
|
300
299
|
}
|
|
@@ -303,8 +302,7 @@ function renderNextSteps(input, color = false) {
|
|
|
303
302
|
const labels = [
|
|
304
303
|
"Open your project",
|
|
305
304
|
...input.installed ? [] : ["Install dependencies"],
|
|
306
|
-
"
|
|
307
|
-
"Start your app"
|
|
305
|
+
"Start your app and first-run setup"
|
|
308
306
|
];
|
|
309
307
|
return [
|
|
310
308
|
"",
|
|
@@ -322,9 +320,8 @@ function renderNextSteps(input, color = false) {
|
|
|
322
320
|
` ${paint("Build a module by chat", "dim")} ${paint(runScript(input.packageManager, "sandbox"), "bold")}`,
|
|
323
321
|
` ${paint("Agent guidance", "dim")} AGENTS.md, CLAUDE.md, .ai/skills`,
|
|
324
322
|
"",
|
|
325
|
-
` ${paint("
|
|
326
|
-
` ${paint("
|
|
327
|
-
` ${paint("Demo account is created only with local demo setup.", "dim")}`,
|
|
323
|
+
` ${paint("Setup URL", "dim")} ${paint(`${DEV_URL}/setup`, "cyan")}`,
|
|
324
|
+
` ${paint("Setup opens in a browser when available. Use the printed token, then choose your workspace owner.", "dim")}`,
|
|
328
325
|
""
|
|
329
326
|
].join("\n");
|
|
330
327
|
}
|
package/package.json
CHANGED
|
@@ -13,9 +13,9 @@ FD_PORT=3000
|
|
|
13
13
|
# every tenant table forces actually binds the app, and the background role
|
|
14
14
|
# serves the cross-tenant scheduler poll. pglite is refused in production.
|
|
15
15
|
FD_DATABASE_ADAPTER=postgresql
|
|
16
|
-
FD_DATABASE_URL=postgresql://
|
|
17
|
-
FD_DATABASE_MIGRATOR_URL=postgresql://
|
|
18
|
-
FD_DATABASE_BACKGROUND_URL=postgresql://
|
|
16
|
+
FD_DATABASE_URL=postgresql://flowdular_runtime:REPLACE_ME@postgres:5432/flowdular
|
|
17
|
+
FD_DATABASE_MIGRATOR_URL=postgresql://flowdular_migrator:REPLACE_ME@postgres:5432/flowdular
|
|
18
|
+
FD_DATABASE_BACKGROUND_URL=postgresql://flowdular_background:REPLACE_ME@postgres:5432/flowdular
|
|
19
19
|
FD_DATABASE_TLS=verify-full
|
|
20
20
|
FD_DATABASE_TLS_CA_FILE=/tls/server.crt
|
|
21
21
|
|
|
@@ -84,6 +84,11 @@ FD_AUTH_MAIL_TRANSPORT=none
|
|
|
84
84
|
FD_AUTH_SMTP_URL=
|
|
85
85
|
FD_AUTH_MAIL_FROM=
|
|
86
86
|
|
|
87
|
+
# Tenant id that overrides the operator workspace, the one that changes platform
|
|
88
|
+
# settings such as the branding and the mail relay. Empty, the workspace auth.core
|
|
89
|
+
# recorded at first-run setup decides (pnpm flowdular auth operator shows it).
|
|
90
|
+
FD_OPERATOR_TENANT=
|
|
91
|
+
|
|
87
92
|
# Read by infra/docker/compose.yaml only. It builds the three URLs above from
|
|
88
93
|
# these passwords and publishes the container port on FD_PORT.
|
|
89
94
|
FD_POSTGRES_SUPERUSER_PASSWORD=
|
|
@@ -7,13 +7,15 @@ example module, and nothing else you have to configure.
|
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
9
|
pnpm install
|
|
10
|
-
pnpm flowdular setup
|
|
11
10
|
pnpm dev
|
|
12
11
|
```
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
On the first run, the server starts the setup page and `pnpm dev` opens it in
|
|
14
|
+
your browser. Enter the one-time token printed in the terminal, then choose
|
|
15
|
+
your workspace and owner account. The embedded database is already selected.
|
|
16
|
+
If a browser cannot open automatically, visit <http://localhost:4310/setup>.
|
|
17
|
+
Restart `pnpm dev` after setup, then sign in with the account you chose. Use
|
|
18
|
+
`pnpm dev -- --no-open` to leave the browser alone.
|
|
17
19
|
|
|
18
20
|
Local development runs on embedded PostgreSQL, so there is no database server to
|
|
19
21
|
install. Data lives under `.flowdular/data`.
|
|
@@ -25,7 +27,7 @@ install. Data lives under `.flowdular/data`.
|
|
|
25
27
|
| `platform` | The deployable composition root and the application shell |
|
|
26
28
|
| `modules/example` | A tenant-scoped record module: API, migration, screen, tests |
|
|
27
29
|
| `specs` | The platform spec of this application |
|
|
28
|
-
| `infra` |
|
|
30
|
+
| `infra` | Docker, Kubernetes and Vercel deployment assets |
|
|
29
31
|
| `flowdular.json` | Enabled modules and locales, owned by the CLI |
|
|
30
32
|
| `.env` | The keys generated for this app. Never commit it |
|
|
31
33
|
| `.env.example` | Every key a production deployment reads |
|
|
@@ -79,19 +81,26 @@ account access, then paste the token and the application address into the
|
|
|
79
81
|
connect screen.
|
|
80
82
|
|
|
81
83
|
```bash
|
|
82
|
-
pnpm flowdular sandbox grant --email
|
|
84
|
+
pnpm flowdular sandbox grant --email <your-owner-email> --tenant <your-workspace-slug> --apply
|
|
83
85
|
```
|
|
84
86
|
|
|
85
87
|
## Deploy
|
|
86
88
|
|
|
87
89
|
```bash
|
|
88
|
-
|
|
89
|
-
docker compose -f infra/docker/compose.yaml up --build
|
|
90
|
+
node infra/docker/start.mjs
|
|
90
91
|
```
|
|
91
92
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
The launcher creates `infra/docker/.env` with private database passwords and
|
|
94
|
+
keys, starts PostgreSQL and MinIO, then opens the setup page. Enter the token
|
|
95
|
+
shown in the terminal. The database step is already complete, so you start with
|
|
96
|
+
the workspace owner. `infra/README.md` covers the stack and deployments.
|
|
97
|
+
|
|
98
|
+
To deploy on Vercel, run `vercel login` and then
|
|
99
|
+
`pnpm flowdular deploy start vercel --apply`. It provisions Neon PostgreSQL, a
|
|
100
|
+
private Blob store and the stable keys, deploys, and prints a one-time token for
|
|
101
|
+
creating the first workspace at `/setup`; `infra/vercel/README.md` walks through
|
|
102
|
+
it and the manual path. Module workers run in a worker Function that Vercel Cron
|
|
103
|
+
and state-changing requests tick.
|
|
95
104
|
|
|
96
105
|
## Commands
|
|
97
106
|
|