twenty 2.58.0 → 2.59.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/CONTRIBUTING.md +82 -54
- package/README.md +35 -22
- package/dist/app-template/.nvmrc +1 -1
- package/dist/app-template/example/files/README.md +20 -4
- package/dist/app-template/example/files/github/workflows/publish.yml +1 -1
- package/dist/app-template/example/files/src/default-role.ts +6 -4
- package/dist/app-template/yarn.lock +167 -104
- package/dist/app-worker.cjs +1 -1
- package/dist/chunks/{cli-version.constant-jomCqLLP.cjs → AssetDirectory-c_JEwMr2.cjs} +1 -1
- package/dist/chunks/{build-source-manifest-DcRIFlDb.cjs → build-source-manifest-Ddwa8ath.cjs} +1 -1
- package/dist/chunks/build-source-snapshot-CUsEVNsQ.cjs +898 -0
- package/dist/chunks/cli-version.constant-y_3mZ4gx.cjs +1 -0
- package/dist/chunks/compile-application-translations-C9UZQCAb.cjs +58 -0
- package/dist/chunks/create-metadata-client-FopHnDj0.cjs +6 -0
- package/dist/chunks/create-pull-base-write-CX8xZhMz.cjs +1 -0
- package/dist/chunks/{create-rest-client-CMUss3u-.cjs → create-rest-client-HbzXSfhZ.cjs} +1 -1
- package/dist/chunks/{extract-source-translations--J7rPcdh.cjs → extract-source-translations-B-XmoSt7.cjs} +1 -1
- package/dist/chunks/{fetch-metadata-inspection-LB3RA2cV.cjs → fetch-metadata-inspection-ooyNi2DN.cjs} +1 -1
- package/dist/chunks/{fetch-signed-in-identity-GVHuJKXy.cjs → fetch-signed-in-identity-nCzWXunB.cjs} +1 -1
- package/dist/chunks/fetch-workspace-or-throw-DHoa_BYF.cjs +1 -0
- package/dist/chunks/{get-client-generation-skip-reason-CkpxXdRw.cjs → get-client-generation-skip-reason-BZiAtHwa.cjs} +1 -1
- package/dist/chunks/global-flags.constant-DMHyA_PD.cjs +1 -0
- package/dist/chunks/{is-exported-manifest-DRPkDqYh.cjs → is-exported-manifest-C4lO285q.cjs} +1 -1
- package/dist/chunks/{is-valid-package-name-Bv-sKHlR.cjs → is-valid-package-name-Ds0DY5qP.cjs} +1 -1
- package/dist/chunks/isValidUuid-D3NV1xmO.cjs +1 -0
- package/dist/chunks/list-application-source-files-DcyU-HrX.cjs +1 -0
- package/dist/chunks/{metadata-page.constant-Bt8myt0X.cjs → metadata-page.constant-D4-pGQWp.cjs} +1 -1
- package/dist/chunks/parse-app-export-BC81wdmc.cjs +1 -0
- package/dist/chunks/{parse-graphql-response-D3WfxVAu.cjs → parse-graphql-response-Cl8_fBgo.cjs} +1 -1
- package/dist/chunks/proxy-header-environment-variable.constant-CJyhJMve.cjs +1 -0
- package/dist/chunks/pull-minimum-sdk-version.constant-DUMi_IUD.cjs +6 -0
- package/dist/chunks/pull-source-CXQQf8Lw.cjs +1 -0
- package/dist/chunks/{read-app-identity-DyMNXRhZ.cjs → read-app-identity-Cny6sAGs.cjs} +1 -1
- package/dist/chunks/{read-application-identifier-hrv6xLTN.cjs → read-application-identifier-C4U2JsfD.cjs} +1 -1
- package/dist/chunks/{read-application-identity-CyVawH0m.cjs → read-application-identity-5sO-Mqb1.cjs} +1 -1
- package/dist/chunks/read-command-values-l5T9Lba4.cjs +1 -0
- package/dist/chunks/read-infer-deletion-option-Hv5V-A47.cjs +8 -0
- package/dist/chunks/{read-local-container-DsjjrgOn.cjs → read-local-container-Cs3cWspd.cjs} +1 -1
- package/dist/chunks/read-snapshot-file-Dxla2ete.cjs +1 -0
- package/dist/chunks/{read-source-identity-CXzcnYKk.cjs → read-source-identity-CG9W0pSt.cjs} +1 -1
- package/dist/chunks/record-pull-base-8bIoAoiB.cjs +1 -0
- package/dist/chunks/request-oauth-tokens-_Xwy2q9c.cjs +1 -0
- package/dist/chunks/resolve-command-target-CLqjjxCT.cjs +1 -0
- package/dist/chunks/{resolve-metadata-object-CN7eAeDR.cjs → resolve-metadata-object-7DhvIcEm.cjs} +1 -1
- package/dist/chunks/resolve-proxy-headers-DipR9jft.cjs +1 -0
- package/dist/chunks/resolve-request-url-CfvGDGkw.cjs +1 -0
- package/dist/chunks/{run-api-graphql-command-x0ynMacW.cjs → run-api-graphql-command-ELrIPdM5.cjs} +1 -1
- package/dist/chunks/{run-api-rest-command-p5A2Fb05.cjs → run-api-rest-command-COVnszcN.cjs} +1 -1
- package/dist/chunks/{run-app-add-command-oHIkbKe1.cjs → run-app-add-command-b9sm20rn.cjs} +2 -2
- package/dist/chunks/{run-app-apply-command-Ww_5FeZf.cjs → run-app-apply-command-CD7NOdiR.cjs} +2 -2
- package/dist/chunks/{run-app-build-command-DpgKL1XF.cjs → run-app-build-command-C8ubC2GH.cjs} +1 -1
- package/dist/chunks/{run-app-dev-command-DVOvwZdx.cjs → run-app-dev-command-D1JOfJv6.cjs} +2 -2
- package/dist/chunks/{run-app-exec-command-Cly1JhuE.cjs → run-app-exec-command-cw4vPVHE.cjs} +2 -2
- package/dist/chunks/{run-app-generate-client-command-CVwOI5-n.cjs → run-app-generate-client-command-BVRFtPni.cjs} +1 -1
- package/dist/chunks/{run-app-init-command-DdSdOmo5.cjs → run-app-init-command-DuxE1JhM.cjs} +2 -2
- package/dist/chunks/{run-app-install-command-zs9OY8uz.cjs → run-app-install-command-DlcUupwk.cjs} +1 -1
- package/dist/chunks/run-app-logs-command-CaLIVesh.cjs +8 -0
- package/dist/chunks/{run-app-operation-CBy4X1VK.cjs → run-app-operation-DKPh4r7b.cjs} +1 -1
- package/dist/chunks/{run-app-plan-command-Cuz9v8Db.cjs → run-app-plan-command-BGQ7vJZT.cjs} +1 -1
- package/dist/chunks/run-app-publish-command-BGNJVIBl.cjs +1 -0
- package/dist/chunks/run-app-pull-command-NbZ8fjhE.cjs +6 -0
- package/dist/chunks/{run-app-translations-extract-command-BZEJppmw.cjs → run-app-translations-extract-command-CGIFvpC1.cjs} +1 -1
- package/dist/chunks/{run-app-typecheck-command-BHFWyv_1.cjs → run-app-typecheck-command-D0KV3hFS.cjs} +1 -1
- package/dist/chunks/{run-app-uninstall-command-DvBgm_4t.cjs → run-app-uninstall-command-CepQk4_4.cjs} +1 -1
- package/dist/chunks/run-auth-login-command-DpS1bUdL.cjs +1 -0
- package/dist/chunks/{run-auth-logout-command-BMpq04ml.cjs → run-auth-logout-command-hvi_HvpQ.cjs} +1 -1
- package/dist/chunks/{run-auth-status-command-2Xrg0AoZ.cjs → run-auth-status-command-Dr4YQuLn.cjs} +1 -1
- package/dist/chunks/{run-cli-BoGVmb1j.cjs → run-cli-oUabLHNz.cjs} +1 -1
- package/dist/chunks/{run-commands-command-DZkaWdQm.cjs → run-commands-command-DYm9TuAx.cjs} +1 -1
- package/dist/chunks/run-data-export-command-C4_7rc0v.cjs +3 -0
- package/dist/chunks/run-data-get-command-CcEYQ4xO.cjs +1 -0
- package/dist/chunks/{run-data-list-command-CVubWAFh.cjs → run-data-list-command-D0K7HFD-.cjs} +1 -1
- package/dist/chunks/run-doctor-command-fHf5vCGl.cjs +2 -0
- package/dist/chunks/{run-local-logs-command-CkZln0BN.cjs → run-local-logs-command-COsSRk3f.cjs} +1 -1
- package/dist/chunks/{run-local-reset-command-B5UrKkAf.cjs → run-local-reset-command-m0x-EiA6.cjs} +1 -1
- package/dist/chunks/{run-local-start-command-Cp8nzjc6.cjs → run-local-start-command-DsFS9_ew.cjs} +1 -1
- package/dist/chunks/{run-local-status-command-E3cpSfTu.cjs → run-local-status-command-BYxy0R9I.cjs} +1 -1
- package/dist/chunks/{run-local-stop-command-Cr3oAzQ9.cjs → run-local-stop-command-D66F73fW.cjs} +1 -1
- package/dist/chunks/{run-local-upgrade-command-Ch5AvQjt.cjs → run-local-upgrade-command-6P71bQw6.cjs} +1 -1
- package/dist/chunks/{run-metadata-field-describe-command-Bof9tzyG.cjs → run-metadata-field-describe-command-nfKhj-m_.cjs} +1 -1
- package/dist/chunks/{run-metadata-field-list-command-C2AxyLJH.cjs → run-metadata-field-list-command-CW2I6hmh.cjs} +1 -1
- package/dist/chunks/{run-metadata-object-describe-command-CEh8rVCs.cjs → run-metadata-object-describe-command-WLxcOe4T.cjs} +1 -1
- package/dist/chunks/{run-metadata-object-list-command-4qWTuJlm.cjs → run-metadata-object-list-command-Q4pwAEwO.cjs} +1 -1
- package/dist/chunks/{run-open-command-BWRHlLfS.cjs → run-open-command-DPrz3N1e.cjs} +1 -1
- package/dist/chunks/{run-remote-remove-command-Dc0XJydM.cjs → run-remote-remove-command-DgSQvjeN.cjs} +1 -1
- package/dist/chunks/{run-remote-rename-command-3AzuENYT.cjs → run-remote-rename-command--37-GTRY.cjs} +1 -1
- package/dist/chunks/{run-remote-use-command-BKVP65QI.cjs → run-remote-use-command-B6obKSPB.cjs} +1 -1
- package/dist/chunks/{run-version-command-BZ_R0Tss.cjs → run-version-command-BWTSv9_Y.cjs} +1 -1
- package/dist/chunks/{sign-in-to-remote-again-DN6ov5o2.cjs → sign-in-to-remote-again-DFQr-xvw.cjs} +1 -1
- package/dist/chunks/{sign-in-with-browser-DXd6hkJk.cjs → sign-in-with-browser-TQANmPyb.cjs} +2 -2
- package/dist/chunks/{standard-object-fields.constant-2yLND0Cg.cjs → standard-object-fields.constant-C4AVX0t2.cjs} +1 -1
- package/dist/chunks/subscribe-graphql-w-Ar4hCj.cjs +2 -0
- package/dist/chunks/to-worker-output-diagnostics-w1hZPfn0.cjs +2 -0
- package/dist/chunks/{wait-for-local-environment-BmOFeICJ.cjs → wait-for-local-environment-zNEJcWA1.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/docs/commands.md +875 -233
- package/package.json +3 -2
- package/src/app/README.md +15 -10
- package/src/app/add/README.md +75 -51
- package/src/app/bundles/README.md +56 -33
- package/src/app/client/README.md +23 -21
- package/src/app/dev/README.md +30 -16
- package/src/app/exec/README.md +61 -41
- package/src/app/function-logs/README.md +49 -32
- package/src/app/manifest/README.md +31 -25
- package/src/app/pull/README.md +191 -21
- package/src/app/source/README.md +67 -14
- package/src/app/typecheck/README.md +29 -24
- package/dist/chunks/build-source-snapshot-C0UVzVTo.cjs +0 -897
- package/dist/chunks/compile-application-translations-Da3xWXl-.cjs +0 -58
- package/dist/chunks/create-metadata-client-oO0QvH6j.cjs +0 -6
- package/dist/chunks/create-pull-base-write-CQHTbtQP.cjs +0 -1
- package/dist/chunks/fetch-workspace-or-throw-CGlqJOIG.cjs +0 -1
- package/dist/chunks/global-flags.constant-DooTv_Uq.cjs +0 -1
- package/dist/chunks/list-application-source-files-jEau5Rie.cjs +0 -1
- package/dist/chunks/parse-app-export-CmFKsj2e.cjs +0 -1
- package/dist/chunks/pull-minimum-sdk-version.constant-0v8yv93F.cjs +0 -6
- package/dist/chunks/pull-source-C6LiDOqa.cjs +0 -1
- package/dist/chunks/read-command-values-rGaU2qHz.cjs +0 -1
- package/dist/chunks/read-infer-deletion-option-Br1FJCfZ.cjs +0 -8
- package/dist/chunks/read-snapshot-file-D-s1kuCP.cjs +0 -1
- package/dist/chunks/record-pull-base-BZ6YgdEp.cjs +0 -1
- package/dist/chunks/request-oauth-tokens-B4JHBmVU.cjs +0 -1
- package/dist/chunks/resolve-command-target-CwC9p_NB.cjs +0 -1
- package/dist/chunks/resolve-request-url-BzW185lE.cjs +0 -1
- package/dist/chunks/run-app-logs-command-CnW8I5a0.cjs +0 -9
- package/dist/chunks/run-app-publish-command-DACw_WFa.cjs +0 -1
- package/dist/chunks/run-app-pull-command-CNbC_iZs.cjs +0 -6
- package/dist/chunks/run-auth-login-command-DmnIxGG3.cjs +0 -1
- package/dist/chunks/run-data-get-command-BE6hUvWQ.cjs +0 -1
- package/dist/chunks/run-doctor-command-OCHUN5AA.cjs +0 -2
- package/dist/chunks/to-worker-output-diagnostics-DlISjOqp.cjs +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "twenty",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.59.0",
|
|
4
4
|
"description": "The Twenty command line.",
|
|
5
5
|
"homepage": "https://twenty.com",
|
|
6
6
|
"repository": {
|
|
@@ -33,8 +33,9 @@
|
|
|
33
33
|
"lodash.startcase": "^4.4.0",
|
|
34
34
|
"npm-pick-manifest": "^11.0.1",
|
|
35
35
|
"semver": "7.6.3",
|
|
36
|
+
"signal-exit": "^4.1.0",
|
|
36
37
|
"string-width": "^8.2.0",
|
|
37
|
-
"twenty-client-sdk": "2.
|
|
38
|
+
"twenty-client-sdk": "2.59.0",
|
|
38
39
|
"twenty-shared": "0.0.0",
|
|
39
40
|
"undici": "^7.30.1",
|
|
40
41
|
"uuid": "^13.0.2",
|
package/src/app/README.md
CHANGED
|
@@ -5,13 +5,15 @@ See [Contributing](../../CONTRIBUTING.md) for package setup and tests, and the
|
|
|
5
5
|
|
|
6
6
|
The `twenty` CLI owns filesystem operations, source loading, build, typecheck,
|
|
7
7
|
watching, pull and deployment. Apps use `twenty-sdk` to define application
|
|
8
|
-
metadata and runtime behavior. They do not import or depend on the CLI, which
|
|
9
|
-
|
|
8
|
+
metadata and runtime behavior. They do not import or depend on the CLI, which is
|
|
9
|
+
normally installed globally.
|
|
10
|
+
|
|
11
|
+
## Module map
|
|
10
12
|
|
|
11
13
|
| Module | Responsibility |
|
|
12
14
|
| ---------------------------------------- | -------------------------------------------------------------------- |
|
|
13
|
-
| `project`
|
|
14
|
-
| `deployment`
|
|
15
|
+
| `project` | Locate the app and resolve its installed SDK and Node requirements |
|
|
16
|
+
| `deployment` | Preview metadata changes, approve them, upload snapshots and sync |
|
|
15
17
|
| [source](source/README.md) | Discover and evaluate trusted app definitions in a disposable worker |
|
|
16
18
|
| [manifest](manifest/README.md) | Construct and validate metadata, compile translations |
|
|
17
19
|
| [bundles](bundles/README.md) | Build artifacts and hold immutable snapshots for consumers |
|
|
@@ -23,9 +25,11 @@ is normally installed globally.
|
|
|
23
25
|
| [exec](exec/README.md) | Execute an installed logic function |
|
|
24
26
|
| [function-logs](function-logs/README.md) | Stream application function logs |
|
|
25
27
|
|
|
28
|
+
## Worker and snapshot guarantees
|
|
29
|
+
|
|
26
30
|
The worker isolates process exits, captures bounded output, filters inherited
|
|
27
|
-
CLI credentials and supports cancellation. It runs trusted developer code and
|
|
28
|
-
|
|
31
|
+
CLI credentials and supports cancellation. It runs trusted developer code and is
|
|
32
|
+
not a security sandbox. Configurations containing functions stay inside the
|
|
29
33
|
worker; only serializable requests, results and diagnostics cross IPC.
|
|
30
34
|
|
|
31
35
|
Snapshots retain files until their consumers finish. Uploads verify containment,
|
|
@@ -35,9 +39,10 @@ file watchers. Keep these guarantees when simplifying implementation details.
|
|
|
35
39
|
## Package boundaries
|
|
36
40
|
|
|
37
41
|
The CLI imports the app's public SDK authoring exports and invokes its installed
|
|
38
|
-
client SDK generator. The [typecheck documentation](typecheck/README.md)
|
|
39
|
-
compiler resolution and project requirements.
|
|
42
|
+
client SDK generator. The [typecheck documentation](typecheck/README.md)
|
|
43
|
+
describes compiler resolution and project requirements.
|
|
40
44
|
|
|
41
45
|
Parity tests compare generated source, manifests and bundles with the repository
|
|
42
|
-
SDK. Command failure and cancellation tests inject tooling fixtures into a
|
|
43
|
-
of the production worker; real-app tests exercise its compiler and
|
|
46
|
+
SDK. Command failure and cancellation tests inject tooling fixtures into a
|
|
47
|
+
bundle of the production worker; real-app tests exercise its compiler and
|
|
48
|
+
bundler.
|
package/src/app/add/README.md
CHANGED
|
@@ -1,55 +1,79 @@
|
|
|
1
1
|
# App definition scaffolding
|
|
2
2
|
|
|
3
3
|
The templates create object, field, logic-function, front-component and
|
|
4
|
-
validation-rule definitions. Filenames and logic-function/front-component names
|
|
5
|
-
Object and field metadata names keep the entered spelling;
|
|
6
|
-
the same helper as app init.
|
|
7
|
-
|
|
8
|
-
##
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
4
|
+
validation-rule definitions. Filenames and logic-function/front-component names
|
|
5
|
+
use kebab-case. Object and field metadata names keep the entered spelling;
|
|
6
|
+
display labels use the same helper as app init.
|
|
7
|
+
|
|
8
|
+
## Inputs and destinations
|
|
9
|
+
|
|
10
|
+
`twenty app add [entity]` accepts `object`, `field`, `logic-function`,
|
|
11
|
+
`front-component` and `validation-rule`. A human terminal can supply omitted
|
|
12
|
+
values interactively. JSON, CI, redirected stdin and `--no-input` never prompt;
|
|
13
|
+
missing required or inapplicable options exit 2. Labels default to the name;
|
|
14
|
+
fields default to `TEXT`.
|
|
15
|
+
|
|
16
|
+
`--path` selects an app, like the other CLI app commands. Files go under the
|
|
17
|
+
selected app's `src/objects`, `src/fields`, `src/logic-functions`,
|
|
18
|
+
`src/front-components` or `src/validation-rules`. Custom output directories are
|
|
19
|
+
not supported.
|
|
20
|
+
|
|
21
|
+
Parent and relation endpoint identifiers must be valid universal UUIDs. No
|
|
22
|
+
workspace lookup verifies ownership or existence. Relations require reviewing
|
|
23
|
+
both endpoints; this generator creates only the requested standalone field.
|
|
24
|
+
|
|
25
|
+
## Object companions
|
|
26
|
+
|
|
27
|
+
Objects accept `--create-view`, `--create-navigation-menu-item` and
|
|
28
|
+
`--create-page-layout`. Each flag opts into that definition; page layouts also
|
|
29
|
+
create the fields view used by their Fields widget. The list view and fields
|
|
30
|
+
view reuse the object's name field.
|
|
31
|
+
|
|
32
|
+
Fields views also include the SDK's generated audit fields, resolved using the
|
|
33
|
+
application's universal identifier. With no creation flags, human interactive
|
|
34
|
+
mode offers all three together, defaulting to No. Explicit creation flags bypass
|
|
35
|
+
that question. Noninteractive modes never ask and create only explicitly
|
|
36
|
+
selected companions.
|
|
37
|
+
|
|
38
|
+
All prompts complete before any files are written, including on cancellation.
|
|
39
|
+
|
|
40
|
+
## Identifiers and source loading
|
|
41
|
+
|
|
42
|
+
Node's `randomUUID` creates version 4 identifiers. The CLI TypeScript printer
|
|
43
|
+
escapes authored strings, including quotes, backslashes and line breaks.
|
|
44
|
+
|
|
45
|
+
App discovery, SDK compatibility and application identity reuse the CLI's worker
|
|
46
|
+
boundary. Identity loading evaluates trusted app code in a disposable worker; it
|
|
47
|
+
is not a security sandbox. The command makes no workspace requests and does not
|
|
48
|
+
require authentication.
|
|
49
|
+
|
|
50
|
+
## Safe file creation
|
|
51
|
+
|
|
52
|
+
Destination paths reuse pull's containment and symlink checks. All destinations
|
|
53
|
+
are checked before writing and all files are staged beside their destinations
|
|
54
|
+
before exclusive linking, including when source directories are mounted on
|
|
55
|
+
different filesystems. Existing or concurrently created files are never
|
|
56
|
+
replaced.
|
|
57
|
+
|
|
58
|
+
Failure or cancellation before all links complete rolls back the links already
|
|
59
|
+
created; files replaced by another process are preserved. Incomplete rollback
|
|
60
|
+
reports remaining app-relative paths. Completion wins over late cancellation.
|
|
61
|
+
Cleanup failure after success warns and reports the remaining temporary
|
|
62
|
+
directory.
|
|
63
|
+
|
|
64
|
+
Empty parent directories can remain after failure or cancellation. Exclusive
|
|
65
|
+
atomic creation requires a filesystem supporting hard links; unsupported
|
|
66
|
+
filesystems fail instead of falling back to a potentially partial destination
|
|
67
|
+
write.
|
|
68
|
+
|
|
69
|
+
Path validation rejects existing symbolic links. It cannot prevent another local
|
|
70
|
+
process from replacing a parent directory between validation and writing.
|
|
71
|
+
|
|
72
|
+
## Results and limitations
|
|
73
|
+
|
|
74
|
+
JSON reports app-relative `createdPaths`. There is no overwrite mode and no
|
|
75
|
+
editing or registration of existing definitions. Standalone view, layout and
|
|
76
|
+
navigation item generators are not supported.
|
|
53
77
|
|
|
54
78
|
These are starter definitions, not a deployment validator. Review type-specific
|
|
55
79
|
settings, relation endpoints, handlers and components, then build and plan the
|
|
@@ -58,8 +82,8 @@ app. Successful generation does not imply the server will accept the metadata.
|
|
|
58
82
|
## Verification
|
|
59
83
|
|
|
60
84
|
`add-template-parity.spec.ts` compares generated source with the repository SDK,
|
|
61
|
-
normalizing random UUIDs while preserving their reuse. It covers every field
|
|
62
|
-
and both runtime templates. Additional tests cover escaped strings, invalid
|
|
85
|
+
normalizing random UUIDs while preserving their reuse. It covers every field
|
|
86
|
+
type and both runtime templates. Additional tests cover escaped strings, invalid
|
|
63
87
|
identifiers, destination conflicts and cancellation.
|
|
64
88
|
|
|
65
89
|
View and navigation templates are deliberately limited to object companions:
|
|
@@ -2,28 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
The CLI owns application bundling and immutable snapshot lifecycle. The internal
|
|
4
4
|
`bundleSnapshot` worker request builds and holds or releases a snapshot under
|
|
5
|
-
`.twenty/cli/snapshots/build-*`. The [typechecker](../typecheck/README.md) uses
|
|
6
|
-
app's own TypeScript compiler. Build, plan
|
|
7
|
-
|
|
5
|
+
`.twenty/cli/snapshots/build-*`. The [typechecker](../typecheck/README.md) uses
|
|
6
|
+
the app's own TypeScript compiler. Build, plan and apply use this pipeline.
|
|
7
|
+
|
|
8
|
+
Uninstall reads app identity without bundling or typechecking. Worker requests
|
|
9
|
+
are internal, not a public API or a way to bypass build checks.
|
|
8
10
|
|
|
9
11
|
See the [app tooling overview](../README.md) for package ownership.
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## Bundling
|
|
14
|
+
|
|
15
|
+
Logic functions use an ESM/CJS banner, external modules and define stubs. Front
|
|
16
|
+
components use JSX wrappers, remote-DOM transformation, optional preact aliases,
|
|
17
|
+
bundled CSS injection, static shared-dependency export discovery and
|
|
18
|
+
live-binding shims. The app's translation catalogs are embedded in the bundles.
|
|
12
19
|
|
|
13
|
-
Logic functions use an ESM/CJS banner, external modules and define stubs.
|
|
14
|
-
Front components use JSX wrappers, remote-DOM transformation, optional
|
|
15
|
-
preact aliases, bundled CSS injection, static shared-dependency export discovery
|
|
16
|
-
and live-binding shims. The app's translation catalogs are embedded in the bundles.
|
|
17
20
|
Dependency discovery does not execute package initialization code. CommonJS
|
|
18
21
|
named exports must be statically detectable; packages that compute export names
|
|
19
22
|
at runtime can be consumed through their default export.
|
|
20
23
|
|
|
24
|
+
## Source inventory and upload artifacts
|
|
25
|
+
|
|
21
26
|
The bundler collects source and dependency files, public and generated assets,
|
|
22
|
-
and the README, and updates the manifest's artifact checksums.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
and the README, and updates the manifest's artifact checksums.
|
|
28
|
+
`manifest.sourceFiles` records each retained source path and checksum, including
|
|
29
|
+
local runtime imports, type-only imports, local TypeScript configuration, nested
|
|
30
|
+
CSS and imported assets.
|
|
31
|
+
|
|
32
|
+
Node modules, unrelated files and imports outside the app (including symlink
|
|
33
|
+
targets) are excluded from the inventory without rejecting existing builds.
|
|
34
|
+
Retained paths and file bytes are preserved. A fresh build replaces the
|
|
35
|
+
inventory.
|
|
36
|
+
|
|
37
|
+
Direct apply uploads these artifacts, and package installs require all
|
|
38
|
+
inventoried sources while accepting older packages without an inventory.
|
|
39
|
+
Snapshot copies dereference symlinks. Each upload artifact records its role,
|
|
40
|
+
byte size and SHA-256 hash. README and source maps are included in the snapshot
|
|
41
|
+
but are not upload artifacts.
|
|
42
|
+
|
|
43
|
+
The content hash combines the sorted artifact paths, roles and hashes with the
|
|
44
|
+
exact manifest bytes.
|
|
45
|
+
|
|
46
|
+
## Snapshot lifetime
|
|
27
47
|
|
|
28
48
|
Each build has its own directory and lease. Release removes only a snapshot held
|
|
29
49
|
by that worker. Failed and cooperatively cancelled builds remove their temporary
|
|
@@ -35,18 +55,18 @@ removes snapshots owned by the current build.
|
|
|
35
55
|
- Source loading, manifest generation, translations and filesystem helpers are
|
|
36
56
|
shared with the other CLI app operations. The [dev session](../dev/README.md)
|
|
37
57
|
observes the build's inputs and retains immutable copies for remote apply.
|
|
38
|
-
- The define stub reads `twenty-sdk/define` from the app's installed SDK.
|
|
39
|
-
become no-op validators, plain-data exports retain their values,
|
|
40
|
-
non-enumerable properties, and other exports use proxy stubs.
|
|
41
|
-
constants match the SDK the app uses.
|
|
58
|
+
- The define stub reads `twenty-sdk/define` from the app's installed SDK.
|
|
59
|
+
Factories become no-op validators, plain-data exports retain their values,
|
|
60
|
+
including non-enumerable properties, and other exports use proxy stubs.
|
|
61
|
+
Runtime constants match the SDK the app uses.
|
|
42
62
|
- `sharp` is optional and resolved from the app. It is not a CLI dependency.
|
|
43
63
|
When unavailable, cover generation warns and the build continues. Vite embeds
|
|
44
64
|
the backdrop PNG as a data URI so it works in the standalone package.
|
|
45
65
|
- `compileApplication` runs the CLI typecheck after bundling, using the compiler
|
|
46
66
|
resolved from the app.
|
|
47
|
-
- Workers run from the selected app directory, so invoking the CLI from a
|
|
48
|
-
|
|
49
|
-
|
|
67
|
+
- Workers run from the selected app directory, so invoking the CLI from a parent
|
|
68
|
+
or nested directory produces the same bundle paths, bytes and hashes. SDK
|
|
69
|
+
parity references run from the app root as well.
|
|
50
70
|
- Upload validation accepts only snapshots inside the selected app's
|
|
51
71
|
`.twenty/cli/snapshots`, with path containment and per-file hash checks.
|
|
52
72
|
- The internal worker reuses the source SDK gate, credential filtering, output
|
|
@@ -66,21 +86,24 @@ The parity suite builds all five repository fixtures and a fresh CLI-created app
|
|
|
66
86
|
through the SDK reference and the production CLI worker. The app has a copy of
|
|
67
87
|
the real authoring SDK without its build/CLI exports or implementation files.
|
|
68
88
|
Successful builds preserve manifest configuration and artifact paths/roles.
|
|
89
|
+
|
|
69
90
|
Non-frontend files are compared byte for byte, except for `manifest.json` and
|
|
70
|
-
source maps. Frontend bundle bytes and checksums are allowed to differ:
|
|
71
|
-
string literals, resolved CSS assets and live
|
|
72
|
-
CLI artifact's size/checksum and the snapshot
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
91
|
+
source maps. Frontend bundle bytes and checksums are allowed to differ:
|
|
92
|
+
dedicated tests verify preserved string literals, resolved CSS assets and live
|
|
93
|
+
shared-dependency bindings. Every CLI artifact's size/checksum and the snapshot
|
|
94
|
+
content hash are checked against the actual bytes.
|
|
95
|
+
|
|
96
|
+
Tests also verify the manifest references for function, component and
|
|
97
|
+
shared-dependency bundles, and compare the serialized manifest with the worker's
|
|
98
|
+
manifest result. The invalid fixture fails in both pipelines. The fresh CLI
|
|
99
|
+
template's test setup typechecks with an authoring-only SDK.
|
|
77
100
|
|
|
78
101
|
Source-map comparisons for unchanged bundles resolve paths against each map's
|
|
79
102
|
directory and exclude the define stub's generator banner from `sourcesContent`.
|
|
80
103
|
|
|
81
|
-
Additional tests cover optional covers, project SDK constants, baked
|
|
82
|
-
and CSS, README selection, immutable symlink copies, concurrent
|
|
83
|
-
release ownership, failed/cancelled builds and failed snapshot
|
|
84
|
-
build/apply contract runs CLI snapshots against a local HTTP
|
|
85
|
-
uploads, sync, pull-base recording, release and client
|
|
86
|
-
a live Twenty workspace.
|
|
104
|
+
Additional tests cover optional covers, project SDK constants, baked
|
|
105
|
+
translations and CSS, README selection, immutable symlink copies, concurrent
|
|
106
|
+
snapshots, release ownership, failed/cancelled builds and failed snapshot
|
|
107
|
+
consumers. The build/apply contract runs CLI snapshots against a local HTTP
|
|
108
|
+
fixture, including uploads, sync, pull-base recording, release and client
|
|
109
|
+
generation. It does not contact a live Twenty workspace.
|
package/src/app/client/README.md
CHANGED
|
@@ -3,35 +3,37 @@
|
|
|
3
3
|
The CLI calls `replaceCoreClient` from the app's installed
|
|
4
4
|
`twenty-client-sdk/generate`. See the [app tooling overview](../README.md) for
|
|
5
5
|
package boundaries. The package manifest is read through `readJsonObject`;
|
|
6
|
-
missing or malformed JSON and incorrect package names produce an
|
|
7
|
-
`CLIENT_GENERATION_FAILED` error.
|
|
6
|
+
missing or malformed JSON and incorrect package names produce an
|
|
7
|
+
expected-package `CLIENT_GENERATION_FAILED` error.
|
|
8
8
|
|
|
9
9
|
Public `app apply` invokes the generator through the internal
|
|
10
10
|
`generateSourceClient` worker request.
|
|
11
11
|
|
|
12
12
|
## Package and output ownership
|
|
13
13
|
|
|
14
|
-
The app must have `node_modules/twenty-client-sdk/package.json` with the
|
|
15
|
-
package name. Resolution does not search workspace ancestors, avoiding
|
|
16
|
-
to a hoisted-only installation shared by other apps. Package-manager
|
|
17
|
-
are followed, so a linked installation can still be shared.
|
|
14
|
+
The app must have `node_modules/twenty-client-sdk/package.json` with the
|
|
15
|
+
expected package name. Resolution does not search workspace ancestors, avoiding
|
|
16
|
+
writes to a hoisted-only installation shared by other apps. Package-manager
|
|
17
|
+
symlinks are followed, so a linked installation can still be shared.
|
|
18
18
|
|
|
19
19
|
Resolve `twenty-client-sdk/generate` from this package and require the entry to
|
|
20
20
|
belong to the same real package directory. It must export a callable
|
|
21
21
|
`replaceCoreClient`. This keeps the generator and the client it writes into on
|
|
22
22
|
the same installed version, with no fallback to the CLI's own client SDK.
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
## Generated files
|
|
25
|
+
|
|
26
|
+
The output layout is `dist/core/generated`, `dist/core.mjs` and `dist/core.cjs`
|
|
27
|
+
inside that installation. Source files and the metadata client remain unchanged.
|
|
28
|
+
Neither apps nor SDK packages depend on the CLI. The client SDK's generator
|
|
29
|
+
dependencies remain part of the app's installed client package.
|
|
28
30
|
|
|
29
31
|
## Failure and cancellation
|
|
30
32
|
|
|
31
33
|
The worker requires a non-empty schema and an absolute app path. Failures use
|
|
32
34
|
`CLIENT_GENERATION_FAILED` / `CANCELLED` results. Missing or incompatible local
|
|
33
|
-
packages fail before invoking the generator. The generator rejects
|
|
34
|
-
|
|
35
|
+
packages fail before invoking the generator. The generator rejects invalid
|
|
36
|
+
schemas without replacing the installed bundles.
|
|
35
37
|
|
|
36
38
|
Generation is not transactional. A generator failure can leave partial changes;
|
|
37
39
|
the wrapper reports that failure even if cancellation was requested meanwhile.
|
|
@@ -47,16 +49,16 @@ From `packages/twenty-cli`, after building the shared, SDK and client SDK:
|
|
|
47
49
|
node ../../node_modules/vitest/vitest.mjs run --config vitest.config.ts src/app/client src/commands/app/__tests__/app-real-sdk.spec.ts --maxWorkers=1
|
|
48
50
|
```
|
|
49
51
|
|
|
50
|
-
Parity runs the SDK reference and the production CLI worker against
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
Parity runs the SDK reference and the production CLI worker against the same
|
|
53
|
+
schema and app path, comparing every generated source file and both compiled
|
|
54
|
+
bundles byte for byte. Reusing the path keeps esbuild's source-path comments
|
|
55
|
+
identical without normalizing file contents. The app has its own client SDK and
|
|
56
|
+
no application SDK. The generated CommonJS client is loaded to verify its
|
|
57
|
+
`CoreApiClient` export.
|
|
56
58
|
|
|
57
59
|
Other cases cover a missing or hoisted-only package, invalid manifests and
|
|
58
60
|
schemas, missing exports, a non-callable API, selection of the app's generator,
|
|
59
61
|
pre-cancellation, in-flight cancellation and preserved failures/partial writes.
|
|
60
|
-
The local HTTP apply contract exercises CLI client
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
The local HTTP apply contract exercises CLI client generation, along with
|
|
63
|
+
snapshot upload, synchronization, pull-base recording and release. No live
|
|
64
|
+
workspace is contacted.
|
package/src/app/dev/README.md
CHANGED
|
@@ -1,35 +1,49 @@
|
|
|
1
1
|
# App development session
|
|
2
2
|
|
|
3
|
+
## Scheduling
|
|
4
|
+
|
|
3
5
|
The parent owns observation and two bounded scheduling lanes: one build worker
|
|
4
6
|
and one remote apply. `runDevLoop` keeps only the latest pending snapshot. Every
|
|
5
7
|
snapshot is released once, including superseded builds and cancellation; the
|
|
6
8
|
active apply retains its files until its reads settle. The skip key is the last
|
|
7
9
|
acknowledged remote content hash, cleared after a failed apply.
|
|
8
10
|
|
|
11
|
+
## Snapshot ownership
|
|
12
|
+
|
|
9
13
|
`buildDevSnapshot` copies declared, size/SHA-256-verified artifacts into a fresh
|
|
10
14
|
`dev-*` directory while the compiler's snapshot lease is held. The worker then
|
|
11
15
|
releases its own snapshot and exits, so retained builds do not retain compiler
|
|
12
16
|
heaps. At most three snapshot directories exist for an active session: in-flight
|
|
13
17
|
apply, compiler source, and its copy. No hard links or mutable output tree.
|
|
14
18
|
|
|
19
|
+
## Watched inputs
|
|
20
|
+
|
|
15
21
|
Input collection is private worker metadata, absent on ordinary build requests.
|
|
16
22
|
It observes esbuild loads/resolution parents, static-file copies and TypeScript
|
|
17
23
|
reads. Missing TypeScript package-scope probes cannot expand watching into
|
|
18
|
-
unrelated ancestor directories.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
unrelated ancestor directories.
|
|
25
|
+
|
|
26
|
+
Inputs have stamps captured before reads; after attaching the watcher, changed
|
|
27
|
+
stamps invalidate the result. A successful graph replaces the previous graph; a
|
|
28
|
+
failure watches the last successful graph plus only that attempt's inputs.
|
|
29
|
+
External directory observation is shallow.
|
|
30
|
+
|
|
31
|
+
## Apply and client generation
|
|
32
|
+
|
|
33
|
+
`applyAppBuild` handles remote operations. Dev supplies a revision-specific
|
|
34
|
+
approval signal and a check immediately before the first write. Once writes
|
|
35
|
+
start, a newer build does not cancel those writes. Client generation pauses
|
|
36
|
+
compilation and invalidates pending builds; its successful input key plus output
|
|
37
|
+
stamps prevent generation loops.
|
|
38
|
+
|
|
39
|
+
A failure after client writes start ends the session. Normal compilation
|
|
40
|
+
failures keep watching; abnormal worker exits and watcher failures require
|
|
41
|
+
restart.
|
|
42
|
+
|
|
43
|
+
## Limits
|
|
30
44
|
|
|
31
45
|
There is no incremental compiler cache or package-manager dependency watcher.
|
|
32
|
-
Arbitrary app-code filesystem reads, concurrent independent dev processes,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
Arbitrary app-code filesystem reads, concurrent independent dev processes, and
|
|
47
|
+
SIGKILL recovery are outside this session's guarantees. See the
|
|
48
|
+
[command reference](../../../docs/commands.md#develop-an-app) for user-visible
|
|
49
|
+
limits.
|
package/src/app/exec/README.md
CHANGED
|
@@ -1,46 +1,66 @@
|
|
|
1
1
|
# CLI app function execution
|
|
2
2
|
|
|
3
|
-
The command selects one deployed function from the
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
3
|
+
The command selects one deployed function from the local app's identifiers,
|
|
4
|
+
executes it once with a payload, and reports status, duration, data, error and
|
|
5
|
+
logs. Name matching is exact. Hooks select their function identifier; executing
|
|
6
|
+
an uninstall hook does not uninstall the app. A non-SUCCESS result exits with
|
|
7
|
+
failure. It executes deployed code, so local edits must be synced with apply or
|
|
8
|
+
dev first.
|
|
9
|
+
|
|
10
|
+
## Function selection
|
|
11
|
+
|
|
12
|
+
Flags follow the space-separated command surface and kebab-case convention:
|
|
13
|
+
`app exec --name`, `--universal-identifier`, `--post-install`, `--pre-install`
|
|
14
|
+
or `--uninstall-hook`. Exactly one selector is required.
|
|
15
|
+
|
|
16
|
+
The CLI keeps no saved build manifest. It uses the `buildManifest` worker to
|
|
17
|
+
load definitions with the app's authoring SDK, without bundling or typechecking.
|
|
18
|
+
Worker output becomes diagnostics; credentials are not passed to it.
|
|
19
|
+
|
|
20
|
+
Function selection checks both the local manifest identifiers and the remote
|
|
21
|
+
installed application's ID. The `findOneApplication` lookup prevents copied or
|
|
22
|
+
stale identifiers from selecting another installed app's function. This needs
|
|
23
|
+
`APPLICATIONS` in addition to execution's `WORKFLOWS` permission.
|
|
24
|
+
|
|
25
|
+
## Authorization
|
|
26
|
+
|
|
27
|
+
The current server requires a user-bound token for execution. Browser-login
|
|
28
|
+
OAuth remotes are supported; API-key targets fail before loading app source. The
|
|
29
|
+
server still decides which functions that user can run: workspace custom app
|
|
30
|
+
functions, functions exposed as workflow actions, or functions from an app
|
|
31
|
+
registered by this workspace.
|
|
32
|
+
|
|
33
|
+
The CLI does not bypass those checks.
|
|
34
|
+
|
|
35
|
+
## Payload and output
|
|
36
|
+
|
|
37
|
+
Payloads use the JSON-object input reader: inline JSON, `@file` or `-` for
|
|
38
|
+
stdin, default `{}`. Non-object values are rejected.
|
|
39
|
+
|
|
40
|
+
Human output escapes terminal controls. JSON success includes function/app
|
|
41
|
+
identity, status, `durationMilliseconds`, data, logs, error and diagnostics. A
|
|
42
|
+
completed non-SUCCESS result exits 1 with `EXECUTION_FAILED` and retains that
|
|
43
|
+
information in `error.details`, with `outcome: "completed"`.
|
|
44
|
+
|
|
45
|
+
A missing function exits 4; ambiguous selection exits 6; bad input exits 2.
|
|
46
|
+
|
|
47
|
+
## Deadlines and unknown outcomes
|
|
48
|
+
|
|
49
|
+
The execution request deadline is the deployed function's `timeoutSeconds` plus
|
|
50
|
+
the transport's 60-second allowance. Its HTTP dispatcher header/body deadlines
|
|
51
|
+
use the same value, avoiding Node's default five-minute cutoff. Other commands
|
|
52
|
+
use their own deadlines and lazy transport loading. Proxies and the server can
|
|
53
|
+
still close a request earlier.
|
|
54
|
+
|
|
55
|
+
Execution is never retried.
|
|
56
|
+
|
|
57
|
+
Acknowledged authentication, permission, not-found and input/validation
|
|
58
|
+
rejections have `outcome: "not-started"`. Transport failure, cancellation,
|
|
59
|
+
internal server error or an invalid response after submission have
|
|
60
|
+
`outcome: "unknown"`: execution may still be running. Ctrl+C exits 130 and
|
|
61
|
+
cannot stop the server-side function or undo its effects.
|
|
62
|
+
|
|
63
|
+
## Verification
|
|
44
64
|
|
|
45
65
|
Command tests use the public command runner and real HTTP metadata transport,
|
|
46
66
|
with controlled worker results. They cover selection, application binding,
|