create-flowdular 0.2.6 → 0.3.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.
Files changed (103) hide show
  1. package/agent-template/.agents/skills/agent-tool-design/SKILL.md +1 -1
  2. package/agent-template/.agents/skills/auth-security-review/SKILL.md +1 -1
  3. package/agent-template/.agents/skills/cli-extension/SKILL.md +1 -1
  4. package/agent-template/.agents/skills/deploy-operate/SKILL.md +114 -0
  5. package/agent-template/.agents/skills/module-new/SKILL.md +29 -0
  6. package/agent-template/.agents/skills/module-update/SKILL.md +9 -1
  7. package/agent-template/.agents/skills/spec-interview/SKILL.md +114 -0
  8. package/agent-template/.agents/skills/ux-design/SKILL.md +34 -3
  9. package/agent-template/.ai/README.md +2 -1
  10. package/agent-template/.ai/agents/sandbox/business-manager.md +5 -1
  11. package/agent-template/.ai/blueprints/author-spec/README.md +1 -1
  12. package/agent-template/.ai/blueprints/author-spec/spec-requirements.yaml +44 -0
  13. package/agent-template/.ai/blueprints/author-spec/steps.yaml +5 -5
  14. package/agent-template/.ai/blueprints/author-spec/templates/module.yaml +99 -3
  15. package/agent-template/.ai/blueprints/edit-module/gates.yaml +4 -0
  16. package/agent-template/.ai/blueprints/edit-module/required-files.yaml +9 -0
  17. package/agent-template/.ai/blueprints/new-module/gates.yaml +4 -0
  18. package/agent-template/.ai/blueprints/new-module/spec-requirements.yaml +2 -2
  19. package/agent-template/.ai/blueprints/release/gates.yaml +4 -0
  20. package/agent-template/.ai/platform-capabilities.md +128 -0
  21. package/agent-template/.ai/policies/capabilities.yaml +130 -3
  22. package/agent-template/.ai/policies/path-ownership.yaml +5 -2
  23. package/agent-template/.ai/policies/task-budgets.yaml +5 -3
  24. package/agent-template/.ai/references/catalog/module.json +4 -4
  25. package/agent-template/.ai/references/catalog/package.json +2 -2
  26. package/agent-template/.ai/references/catalog/spec/module.yaml +5 -3
  27. package/agent-template/.ai/references/catalog/src/platform.ts +2 -0
  28. package/agent-template/.ai/references/catalog/src/services/catalog-service.ts +89 -1
  29. package/agent-template/.ai/references/catalog/src/services/data-classes.ts +47 -0
  30. package/agent-template/.ai/references/catalog/src/services/database-repository.ts +98 -1
  31. package/agent-template/.ai/references/catalog/src/services/repository.ts +22 -1
  32. package/agent-template/.ai/references/catalog/tests/data-classes.test.ts +157 -0
  33. package/agent-template/.ai/references/catalog.provenance.json +12 -10
  34. package/agent-template/.ai/rules/flowdular.md +4 -0
  35. package/agent-template/.ai/skills/README.md +10 -0
  36. package/agent-template/.ai/skills/agent-tool-design/SKILL.md +1 -2
  37. package/agent-template/.ai/skills/auth-security-review/SKILL.md +1 -1
  38. package/agent-template/.ai/skills/business-agent-design/SKILL.md +0 -1
  39. package/agent-template/.ai/skills/cli-extension/SKILL.md +1 -1
  40. package/agent-template/.ai/skills/deploy-operate/SKILL.md +119 -0
  41. package/agent-template/.ai/skills/module-new/SKILL.md +29 -3
  42. package/agent-template/.ai/skills/module-update/SKILL.md +9 -3
  43. package/agent-template/.ai/skills/perf-audit/SKILL.md +0 -1
  44. package/agent-template/.ai/skills/release-eject-pr/SKILL.md +0 -1
  45. package/agent-template/.ai/skills/spec-interview/SKILL.md +120 -0
  46. package/agent-template/.ai/skills/test-hardening/SKILL.md +1 -0
  47. package/agent-template/.ai/skills/ux-design/SKILL.md +34 -3
  48. package/agent-template/.ai/skills/variables/SKILL.md +0 -2
  49. package/agent-template/.ai/skills/workflow-development/SKILL.md +0 -1
  50. package/agent-template/.claude/skills/agent-tool-design/SKILL.md +1 -1
  51. package/agent-template/.claude/skills/auth-security-review/SKILL.md +1 -1
  52. package/agent-template/.claude/skills/cli-extension/SKILL.md +1 -1
  53. package/agent-template/.claude/skills/deploy-operate/SKILL.md +114 -0
  54. package/agent-template/.claude/skills/module-new/SKILL.md +29 -0
  55. package/agent-template/.claude/skills/module-update/SKILL.md +9 -1
  56. package/agent-template/.claude/skills/spec-interview/SKILL.md +114 -0
  57. package/agent-template/.claude/skills/ux-design/SKILL.md +34 -3
  58. package/agent-template/AGENTS.md +4 -0
  59. package/agent-template/CLAUDE.md +4 -0
  60. package/agent-template/docs/adr/0003-module-settings.md +1 -1
  61. package/agent-template/docs/adr/0006-agentic-workflows.md +24 -21
  62. package/agent-template/docs/agent-contract.md +2 -2
  63. package/agent-template/docs/cli-extensions.md +82 -0
  64. package/agent-template/docs/cli.md +195 -0
  65. package/agent-template/docs/configuration.md +593 -36
  66. package/agent-template/docs/design-system.md +185 -31
  67. package/agent-template/docs/getting-started.md +118 -0
  68. package/agent-template/docs/module-distribution.md +96 -0
  69. package/agent-template/docs/module-web-surfaces.md +221 -0
  70. package/agent-template/docs/modules.md +216 -0
  71. package/agent-template/docs/operations.md +545 -0
  72. package/agent-template/docs/sandbox.md +212 -0
  73. package/agent-template/platform/scripts/build.mjs +11 -0
  74. package/dist/bin.js +29 -0
  75. package/package.json +1 -1
  76. package/template/default/.dockerignore +14 -0
  77. package/template/default/.env.example +96 -0
  78. package/template/default/README.md +37 -1
  79. package/template/default/flowdular.json +15 -4
  80. package/template/default/infra/README.md +116 -0
  81. package/template/default/infra/docker/Dockerfile +37 -0
  82. package/template/default/infra/docker/compose.yaml +158 -0
  83. package/template/default/infra/docker/postgres/10-roles.sh +31 -0
  84. package/template/default/infra/docker/postgres/tls-init.sh +28 -0
  85. package/template/default/infra/kubernetes/database-secret.example.yaml +15 -0
  86. package/template/default/infra/kubernetes/deployment.yaml +211 -0
  87. package/template/default/infra/kubernetes/kustomization.yaml +9 -0
  88. package/template/default/infra/kubernetes/secrets.example.yaml +52 -0
  89. package/template/default/infra/kubernetes/service.yaml +13 -0
  90. package/template/default/modules/example/module.json +2 -1
  91. package/template/default/modules/example/package.json +1 -1
  92. package/template/default/modules/example/spec/module.yaml +1 -1
  93. package/template/default/modules/example/src/services/database-repository.ts +2 -12
  94. package/template/default/package.json +3 -2
  95. package/template/default/platform/octane.config.ts +99 -9
  96. package/template/default/platform/package.json +1 -1
  97. package/template/default/platform/src/generated/modules.client.ts +26 -2
  98. package/template/default/platform/src/generated/modules.server.ts +241 -10
  99. package/template/default/platform/src/server/health.ts +47 -0
  100. package/template/default/platform/src/server/metrics.ts +100 -0
  101. package/template/default/platform/src/server/storage.ts +172 -0
  102. package/template/default/platform/src/server/tracing.ts +85 -0
  103. package/template/default/specs/application.yaml +15 -0
@@ -0,0 +1,195 @@
1
+ # CLI
2
+
3
+ `flowdular` is the primary CLI name; `fd` is the short alias and resolves to the
4
+ same command. From the repository both run through pnpm:
5
+
6
+ ```bash
7
+ pnpm flowdular <group> <action> [target] [options]
8
+ pnpm fd <group> <action> [target] [options]
9
+ ```
10
+
11
+ ## Conventions
12
+
13
+ - **Dry run by default.** Every write command prints its plan and changes
14
+ nothing until `--apply`. Destructive capabilities additionally require
15
+ `--confirm <phrase>`.
16
+ - **`--json`** prints the machine-readable envelope. Use it from scripts and
17
+ agents; a failed command exits non-zero with a stable error code.
18
+ - **`--root <dir>`** runs against another workspace. Without it the CLI walks up
19
+ from the current directory to the nearest `flowdular.json`.
20
+ - **Capabilities are the policy.** `capability list` and `capability describe
21
+ <id>` show what a command may do, its risk, and the confirmation it demands.
22
+
23
+ ## Core commands
24
+
25
+ ```bash
26
+ flowdular doctor # workspace health checks
27
+ flowdular capability list|describe <id>|run <id> # capability catalog
28
+ flowdular spec validate [--all] # module specs, --all adds specs/
29
+ flowdular blueprint list|validate --all # blueprint manifests and guardrail files
30
+ flowdular module list|validate # manifests, composition entries, translations
31
+ flowdular module sync [--apply] # regenerate the composition
32
+ flowdular module version <id> # version, platformApi range, dependents
33
+ flowdular module version bump <id> <level> [--apply] # patch|minor|major across module.json, package.json, specVersion and dependent ranges
34
+ flowdular module new <id> --spec <path> [--apply] # scaffold from an approved spec
35
+ flowdular module enable|disable <id> [--apply] # composition and scope grants
36
+ flowdular migration status [--module <id>] # migration ledger
37
+ flowdular migration apply --module <id> [--apply]
38
+ flowdular migration verify # checksum drift, row security, file and constant parity
39
+ flowdular migration new <name> --module <id> [--apply] # scaffold the up and down pair
40
+ flowdular database reset # plan a destructive reset of the configured database
41
+ flowdular database reset --apply --confirm reset-database
42
+ flowdular database backup --output <dir> [--apply] # dump plus a key fingerprint manifest
43
+ flowdular database restore --input <dir> --apply --confirm restore-database
44
+ flowdular setup check # alias of doctor
45
+ flowdular setup quick [--apply --confirm reset-local-auth]
46
+ flowdular setup migrate-state [--apply --confirm migrate-legacy-state]
47
+ ```
48
+
49
+ ### Authoring a migration
50
+
51
+ `migration new` writes exactly two files,
52
+ `migrations/<NNNN>_<stem>_<name>.up.sql` and `.down.sql`, in PostgreSQL, with
53
+ the tenant table, its index, forced row-level security and a tenant policy
54
+ already filled in. Replace the placeholder columns with the real schema.
55
+
56
+ `migration verify` then checks that every applied ledger checksum still matches,
57
+ that every tenant table a migration leaves behind has `ENABLE ROW LEVEL
58
+ SECURITY`, `FORCE ROW LEVEL SECURITY` and a tenant policy declared after the
59
+ last statement that puts the table in place, that a `coreloom_background` policy
60
+ grants no more than `FOR SELECT`, and that every `migrations/*.up.sql` file has
61
+ a matching id in `databaseMigrations` and the other way round.
62
+
63
+ ### Resetting a database
64
+
65
+ `database reset` works through the configured provider, so the same command
66
+ resets a local embedded database and a PostgreSQL deployment. Without `--apply`
67
+ it prints the tables it would drop and changes nothing.
68
+
69
+ Every table goes, including the migration ledger, so the next start migrates
70
+ from zero. The command takes a `migration` lease, which is the only lease that
71
+ may run a reset. Every module shares one database, so `--module` is refused
72
+ rather than silently dropping other modules' tables.
73
+
74
+ Like every destructive capability it runs only when `FD_ENV` or `NODE_ENV` is
75
+ `development` or `test`.
76
+
77
+ ### Backing a database up and restoring it
78
+
79
+ `database backup` writes the configured database into a directory together with
80
+ a `backup.json` manifest: timestamp, adapter, platform version, enabled modules
81
+ and a SHA-256 fingerprint of each of the six encryption keys, never the key
82
+ material. PostgreSQL is dumped with `pg_dump --format=custom` through the
83
+ migrator connection, with the credentials passed as `PG*` variables instead of
84
+ arguments; the embedded adapter is copied file by file and wants the application
85
+ stopped. A missing client tool fails with `BACKUP_TOOL_MISSING`.
86
+
87
+ `database restore` reads such a directory, refuses a backup from another
88
+ adapter, and warns with `BACKUP_KEY_MISMATCH` when the running environment holds
89
+ different keys, because the rows would come back unreadable. It runs
90
+ `pg_restore --clean --if-exists`, or replaces the embedded data directory only
91
+ once the restored copy is staged. Being destructive, it needs
92
+ `--apply --confirm restore-database` and, like `database reset`, runs only when
93
+ `FD_ENV` or `NODE_ENV` is `development` or `test`.
94
+
95
+ `database restore-production` is the same restore without the local gate: it runs only under an approval grant (`--grant <token> --tenant <id>`) bound to the exact flags, needs `--target` equal to the database the migrator DSN names, a separate migrator DSN, and either a health probe that finds the platform down (`--platform-url` or `FD_PORT`) or `--platform-stopped`; a key mismatch is refused unless the approved invocation carried `--allow-key-mismatch`. See docs/operations.md, "Restore in production".
96
+
97
+ The full procedure, the key trap and the rotation status are in
98
+ [operations.md](operations.md).
99
+
100
+ ## Commands provided by modules
101
+
102
+ Enabled modules add namespaced commands. Discovery reads a declarative JSON
103
+ catalog (`src/cli/commands.json`) and never executes module code, so a disabled
104
+ module contributes nothing. See [cli-extensions.md](cli-extensions.md) for the
105
+ contract.
106
+
107
+ ```bash
108
+ flowdular auth scopes # scopes granted to new tenant owners
109
+ flowdular auth sync-scopes --module <id> [--apply] # re-grant a module's scopes to owners
110
+ flowdular auth workspaces [--limit <n>] # workspaces of this deployment and their owners
111
+ flowdular auth workspace-create --name <name> --owner-email <email> --owner-name <name> [--slug <id>] [--password-env <VAR>] [--actor <label>] [--apply]
112
+ flowdular auth member-add --workspace <slug|id> --email <email> [--role <key>] [--actor <label>] [--apply]
113
+ flowdular auth secrets-rotate [--apply] # re-seal enrolled TOTP secrets with the current MFA key
114
+ flowdular auth greenfield # destructive local auth reset (setup quick)
115
+
116
+ flowdular agents status # agents.core runtime status
117
+ flowdular agents audit-verify # verify the tenant-scoped audit hash chain
118
+ flowdular agents secrets-rotate [--apply] # re-seal stored provider credentials
119
+ flowdular automations secrets-rotate [--apply] # re-seal stored trigger secrets
120
+ flowdular workflows secrets-rotate [--apply] # re-seal stored run payloads
121
+ flowdular notifications secrets-rotate [--apply] # re-seal stored webhook signing secrets
122
+ flowdular connectors secrets-rotate [--apply] # re-seal stored connector credentials
123
+ flowdular documents secrets-rotate [--apply] # re-seal stored document objects with the storage key
124
+ flowdular exports secrets-rotate [--apply] # re-seal stored export files with the storage key
125
+
126
+ flowdular sandbox access --tenant <tenant> # grants and eligible members
127
+ flowdular sandbox grant --email <email> --tenant <tenant> [--apply]
128
+ flowdular sandbox revoke --email <email> --tenant <tenant> [--apply]
129
+ flowdular sandbox sessions|session-archive|session-delete --tenant <tenant>
130
+ flowdular sandbox audit-verify
131
+ ```
132
+
133
+ ### Standing up a deployment without public sign-up
134
+
135
+ A deployment sets `FD_AUTH_ALLOW_SIGN_UP=false`, so the first workspace and its
136
+ owner are created from the operator shell instead. The commands run against the
137
+ configured deployment database through the platform provider, PostgreSQL server
138
+ included, and reset nothing.
139
+
140
+ ```bash
141
+ flowdular auth workspace-create --name "Northwind" --owner-email ada@northwind.example --owner-name "Ada Lovelace"
142
+ flowdular auth workspace-create --name "Northwind" --owner-email ada@northwind.example --owner-name "Ada Lovelace" --apply
143
+ ```
144
+
145
+ Without `--slug` the workspace id is derived from the name. Without `--apply`
146
+ the command validates the input, refuses a taken workspace id or a registered
147
+ address, and prints the workspace, the owner and the scopes it would grant.
148
+
149
+ The owner's first credential is a one-time password setup link, printed once
150
+ and not recoverable, valid for 24 hours and usable once. Deliver it over a
151
+ channel you trust and set `FD_AUTH_PUBLIC_ORIGIN` first so the link points at
152
+ the deployment. To choose the password yourself, export it and name the
153
+ variable; a password is never accepted as a flag value, because flags land in
154
+ shell history and in the host's process list:
155
+
156
+ ```bash
157
+ read -rs FD_OWNER_PASSWORD && export FD_OWNER_PASSWORD
158
+ flowdular auth workspace-create --name "Northwind" --owner-email ada@northwind.example \
159
+ --owner-name "Ada Lovelace" --password-env FD_OWNER_PASSWORD --apply
160
+ ```
161
+
162
+ `auth member-add` onboards colleagues into an existing workspace. An address
163
+ that already has an account joins immediately with the role's scopes; an
164
+ unknown address receives a single-use invitation link, shown once, that the
165
+ person opens to create their own account.
166
+
167
+ ```bash
168
+ flowdular auth member-add --workspace northwind --email grace@northwind.example --role member --apply
169
+ ```
170
+
171
+ Both commands append an audit row to the workspace trail whose actor is
172
+ `cli:<user>`, or `cli:<label>` with `--actor <label>`. `auth workspaces` lists
173
+ what exists, with each workspace's owners, so the slug or id for the other
174
+ commands is at hand.
175
+
176
+ ## Workspace scripts
177
+
178
+ ```bash
179
+ pnpm dev # platform on http://localhost:4310 (runs module sync first)
180
+ pnpm build # CLI build and smoke, module sync, platform production build
181
+ pnpm preview # serve the production build
182
+ pnpm sandbox # sandbox launcher
183
+ pnpm typecheck # every workspace package
184
+ pnpm test # every workspace package
185
+ pnpm validate # spec, blueprint and module validation
186
+ pnpm format:check # Prettier
187
+ pnpm verify # typecheck + test + validate + format:check
188
+ ```
189
+
190
+ `pnpm verify` is the gate CI runs and the gate a pull request is expected to
191
+ pass.
192
+
193
+ ## Official module distribution
194
+
195
+ `module search`, `module info`, `module install`, `module update`, `module recover`, and `module validate --locked` manage reviewed external source. See [the distribution contract](module-distribution.md) for flags, trust, activation and recovery.