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.
Files changed (132) hide show
  1. package/CONTRIBUTING.md +82 -54
  2. package/README.md +35 -22
  3. package/dist/app-template/.nvmrc +1 -1
  4. package/dist/app-template/example/files/README.md +20 -4
  5. package/dist/app-template/example/files/github/workflows/publish.yml +1 -1
  6. package/dist/app-template/example/files/src/default-role.ts +6 -4
  7. package/dist/app-template/yarn.lock +167 -104
  8. package/dist/app-worker.cjs +1 -1
  9. package/dist/chunks/{cli-version.constant-jomCqLLP.cjs → AssetDirectory-c_JEwMr2.cjs} +1 -1
  10. package/dist/chunks/{build-source-manifest-DcRIFlDb.cjs → build-source-manifest-Ddwa8ath.cjs} +1 -1
  11. package/dist/chunks/build-source-snapshot-CUsEVNsQ.cjs +898 -0
  12. package/dist/chunks/cli-version.constant-y_3mZ4gx.cjs +1 -0
  13. package/dist/chunks/compile-application-translations-C9UZQCAb.cjs +58 -0
  14. package/dist/chunks/create-metadata-client-FopHnDj0.cjs +6 -0
  15. package/dist/chunks/create-pull-base-write-CX8xZhMz.cjs +1 -0
  16. package/dist/chunks/{create-rest-client-CMUss3u-.cjs → create-rest-client-HbzXSfhZ.cjs} +1 -1
  17. package/dist/chunks/{extract-source-translations--J7rPcdh.cjs → extract-source-translations-B-XmoSt7.cjs} +1 -1
  18. package/dist/chunks/{fetch-metadata-inspection-LB3RA2cV.cjs → fetch-metadata-inspection-ooyNi2DN.cjs} +1 -1
  19. package/dist/chunks/{fetch-signed-in-identity-GVHuJKXy.cjs → fetch-signed-in-identity-nCzWXunB.cjs} +1 -1
  20. package/dist/chunks/fetch-workspace-or-throw-DHoa_BYF.cjs +1 -0
  21. package/dist/chunks/{get-client-generation-skip-reason-CkpxXdRw.cjs → get-client-generation-skip-reason-BZiAtHwa.cjs} +1 -1
  22. package/dist/chunks/global-flags.constant-DMHyA_PD.cjs +1 -0
  23. package/dist/chunks/{is-exported-manifest-DRPkDqYh.cjs → is-exported-manifest-C4lO285q.cjs} +1 -1
  24. package/dist/chunks/{is-valid-package-name-Bv-sKHlR.cjs → is-valid-package-name-Ds0DY5qP.cjs} +1 -1
  25. package/dist/chunks/isValidUuid-D3NV1xmO.cjs +1 -0
  26. package/dist/chunks/list-application-source-files-DcyU-HrX.cjs +1 -0
  27. package/dist/chunks/{metadata-page.constant-Bt8myt0X.cjs → metadata-page.constant-D4-pGQWp.cjs} +1 -1
  28. package/dist/chunks/parse-app-export-BC81wdmc.cjs +1 -0
  29. package/dist/chunks/{parse-graphql-response-D3WfxVAu.cjs → parse-graphql-response-Cl8_fBgo.cjs} +1 -1
  30. package/dist/chunks/proxy-header-environment-variable.constant-CJyhJMve.cjs +1 -0
  31. package/dist/chunks/pull-minimum-sdk-version.constant-DUMi_IUD.cjs +6 -0
  32. package/dist/chunks/pull-source-CXQQf8Lw.cjs +1 -0
  33. package/dist/chunks/{read-app-identity-DyMNXRhZ.cjs → read-app-identity-Cny6sAGs.cjs} +1 -1
  34. package/dist/chunks/{read-application-identifier-hrv6xLTN.cjs → read-application-identifier-C4U2JsfD.cjs} +1 -1
  35. package/dist/chunks/{read-application-identity-CyVawH0m.cjs → read-application-identity-5sO-Mqb1.cjs} +1 -1
  36. package/dist/chunks/read-command-values-l5T9Lba4.cjs +1 -0
  37. package/dist/chunks/read-infer-deletion-option-Hv5V-A47.cjs +8 -0
  38. package/dist/chunks/{read-local-container-DsjjrgOn.cjs → read-local-container-Cs3cWspd.cjs} +1 -1
  39. package/dist/chunks/read-snapshot-file-Dxla2ete.cjs +1 -0
  40. package/dist/chunks/{read-source-identity-CXzcnYKk.cjs → read-source-identity-CG9W0pSt.cjs} +1 -1
  41. package/dist/chunks/record-pull-base-8bIoAoiB.cjs +1 -0
  42. package/dist/chunks/request-oauth-tokens-_Xwy2q9c.cjs +1 -0
  43. package/dist/chunks/resolve-command-target-CLqjjxCT.cjs +1 -0
  44. package/dist/chunks/{resolve-metadata-object-CN7eAeDR.cjs → resolve-metadata-object-7DhvIcEm.cjs} +1 -1
  45. package/dist/chunks/resolve-proxy-headers-DipR9jft.cjs +1 -0
  46. package/dist/chunks/resolve-request-url-CfvGDGkw.cjs +1 -0
  47. package/dist/chunks/{run-api-graphql-command-x0ynMacW.cjs → run-api-graphql-command-ELrIPdM5.cjs} +1 -1
  48. package/dist/chunks/{run-api-rest-command-p5A2Fb05.cjs → run-api-rest-command-COVnszcN.cjs} +1 -1
  49. package/dist/chunks/{run-app-add-command-oHIkbKe1.cjs → run-app-add-command-b9sm20rn.cjs} +2 -2
  50. package/dist/chunks/{run-app-apply-command-Ww_5FeZf.cjs → run-app-apply-command-CD7NOdiR.cjs} +2 -2
  51. package/dist/chunks/{run-app-build-command-DpgKL1XF.cjs → run-app-build-command-C8ubC2GH.cjs} +1 -1
  52. package/dist/chunks/{run-app-dev-command-DVOvwZdx.cjs → run-app-dev-command-D1JOfJv6.cjs} +2 -2
  53. package/dist/chunks/{run-app-exec-command-Cly1JhuE.cjs → run-app-exec-command-cw4vPVHE.cjs} +2 -2
  54. package/dist/chunks/{run-app-generate-client-command-CVwOI5-n.cjs → run-app-generate-client-command-BVRFtPni.cjs} +1 -1
  55. package/dist/chunks/{run-app-init-command-DdSdOmo5.cjs → run-app-init-command-DuxE1JhM.cjs} +2 -2
  56. package/dist/chunks/{run-app-install-command-zs9OY8uz.cjs → run-app-install-command-DlcUupwk.cjs} +1 -1
  57. package/dist/chunks/run-app-logs-command-CaLIVesh.cjs +8 -0
  58. package/dist/chunks/{run-app-operation-CBy4X1VK.cjs → run-app-operation-DKPh4r7b.cjs} +1 -1
  59. package/dist/chunks/{run-app-plan-command-Cuz9v8Db.cjs → run-app-plan-command-BGQ7vJZT.cjs} +1 -1
  60. package/dist/chunks/run-app-publish-command-BGNJVIBl.cjs +1 -0
  61. package/dist/chunks/run-app-pull-command-NbZ8fjhE.cjs +6 -0
  62. package/dist/chunks/{run-app-translations-extract-command-BZEJppmw.cjs → run-app-translations-extract-command-CGIFvpC1.cjs} +1 -1
  63. package/dist/chunks/{run-app-typecheck-command-BHFWyv_1.cjs → run-app-typecheck-command-D0KV3hFS.cjs} +1 -1
  64. package/dist/chunks/{run-app-uninstall-command-DvBgm_4t.cjs → run-app-uninstall-command-CepQk4_4.cjs} +1 -1
  65. package/dist/chunks/run-auth-login-command-DpS1bUdL.cjs +1 -0
  66. package/dist/chunks/{run-auth-logout-command-BMpq04ml.cjs → run-auth-logout-command-hvi_HvpQ.cjs} +1 -1
  67. package/dist/chunks/{run-auth-status-command-2Xrg0AoZ.cjs → run-auth-status-command-Dr4YQuLn.cjs} +1 -1
  68. package/dist/chunks/{run-cli-BoGVmb1j.cjs → run-cli-oUabLHNz.cjs} +1 -1
  69. package/dist/chunks/{run-commands-command-DZkaWdQm.cjs → run-commands-command-DYm9TuAx.cjs} +1 -1
  70. package/dist/chunks/run-data-export-command-C4_7rc0v.cjs +3 -0
  71. package/dist/chunks/run-data-get-command-CcEYQ4xO.cjs +1 -0
  72. package/dist/chunks/{run-data-list-command-CVubWAFh.cjs → run-data-list-command-D0K7HFD-.cjs} +1 -1
  73. package/dist/chunks/run-doctor-command-fHf5vCGl.cjs +2 -0
  74. package/dist/chunks/{run-local-logs-command-CkZln0BN.cjs → run-local-logs-command-COsSRk3f.cjs} +1 -1
  75. package/dist/chunks/{run-local-reset-command-B5UrKkAf.cjs → run-local-reset-command-m0x-EiA6.cjs} +1 -1
  76. package/dist/chunks/{run-local-start-command-Cp8nzjc6.cjs → run-local-start-command-DsFS9_ew.cjs} +1 -1
  77. package/dist/chunks/{run-local-status-command-E3cpSfTu.cjs → run-local-status-command-BYxy0R9I.cjs} +1 -1
  78. package/dist/chunks/{run-local-stop-command-Cr3oAzQ9.cjs → run-local-stop-command-D66F73fW.cjs} +1 -1
  79. package/dist/chunks/{run-local-upgrade-command-Ch5AvQjt.cjs → run-local-upgrade-command-6P71bQw6.cjs} +1 -1
  80. package/dist/chunks/{run-metadata-field-describe-command-Bof9tzyG.cjs → run-metadata-field-describe-command-nfKhj-m_.cjs} +1 -1
  81. package/dist/chunks/{run-metadata-field-list-command-C2AxyLJH.cjs → run-metadata-field-list-command-CW2I6hmh.cjs} +1 -1
  82. package/dist/chunks/{run-metadata-object-describe-command-CEh8rVCs.cjs → run-metadata-object-describe-command-WLxcOe4T.cjs} +1 -1
  83. package/dist/chunks/{run-metadata-object-list-command-4qWTuJlm.cjs → run-metadata-object-list-command-Q4pwAEwO.cjs} +1 -1
  84. package/dist/chunks/{run-open-command-BWRHlLfS.cjs → run-open-command-DPrz3N1e.cjs} +1 -1
  85. package/dist/chunks/{run-remote-remove-command-Dc0XJydM.cjs → run-remote-remove-command-DgSQvjeN.cjs} +1 -1
  86. package/dist/chunks/{run-remote-rename-command-3AzuENYT.cjs → run-remote-rename-command--37-GTRY.cjs} +1 -1
  87. package/dist/chunks/{run-remote-use-command-BKVP65QI.cjs → run-remote-use-command-B6obKSPB.cjs} +1 -1
  88. package/dist/chunks/{run-version-command-BZ_R0Tss.cjs → run-version-command-BWTSv9_Y.cjs} +1 -1
  89. package/dist/chunks/{sign-in-to-remote-again-DN6ov5o2.cjs → sign-in-to-remote-again-DFQr-xvw.cjs} +1 -1
  90. package/dist/chunks/{sign-in-with-browser-DXd6hkJk.cjs → sign-in-with-browser-TQANmPyb.cjs} +2 -2
  91. package/dist/chunks/{standard-object-fields.constant-2yLND0Cg.cjs → standard-object-fields.constant-C4AVX0t2.cjs} +1 -1
  92. package/dist/chunks/subscribe-graphql-w-Ar4hCj.cjs +2 -0
  93. package/dist/chunks/to-worker-output-diagnostics-w1hZPfn0.cjs +2 -0
  94. package/dist/chunks/{wait-for-local-environment-BmOFeICJ.cjs → wait-for-local-environment-zNEJcWA1.cjs} +1 -1
  95. package/dist/cli.cjs +1 -1
  96. package/docs/commands.md +875 -233
  97. package/package.json +3 -2
  98. package/src/app/README.md +15 -10
  99. package/src/app/add/README.md +75 -51
  100. package/src/app/bundles/README.md +56 -33
  101. package/src/app/client/README.md +23 -21
  102. package/src/app/dev/README.md +30 -16
  103. package/src/app/exec/README.md +61 -41
  104. package/src/app/function-logs/README.md +49 -32
  105. package/src/app/manifest/README.md +31 -25
  106. package/src/app/pull/README.md +191 -21
  107. package/src/app/source/README.md +67 -14
  108. package/src/app/typecheck/README.md +29 -24
  109. package/dist/chunks/build-source-snapshot-C0UVzVTo.cjs +0 -897
  110. package/dist/chunks/compile-application-translations-Da3xWXl-.cjs +0 -58
  111. package/dist/chunks/create-metadata-client-oO0QvH6j.cjs +0 -6
  112. package/dist/chunks/create-pull-base-write-CQHTbtQP.cjs +0 -1
  113. package/dist/chunks/fetch-workspace-or-throw-CGlqJOIG.cjs +0 -1
  114. package/dist/chunks/global-flags.constant-DooTv_Uq.cjs +0 -1
  115. package/dist/chunks/list-application-source-files-jEau5Rie.cjs +0 -1
  116. package/dist/chunks/parse-app-export-CmFKsj2e.cjs +0 -1
  117. package/dist/chunks/pull-minimum-sdk-version.constant-0v8yv93F.cjs +0 -6
  118. package/dist/chunks/pull-source-C6LiDOqa.cjs +0 -1
  119. package/dist/chunks/read-command-values-rGaU2qHz.cjs +0 -1
  120. package/dist/chunks/read-infer-deletion-option-Br1FJCfZ.cjs +0 -8
  121. package/dist/chunks/read-snapshot-file-D-s1kuCP.cjs +0 -1
  122. package/dist/chunks/record-pull-base-BZ6YgdEp.cjs +0 -1
  123. package/dist/chunks/request-oauth-tokens-B4JHBmVU.cjs +0 -1
  124. package/dist/chunks/resolve-command-target-CwC9p_NB.cjs +0 -1
  125. package/dist/chunks/resolve-request-url-BzW185lE.cjs +0 -1
  126. package/dist/chunks/run-app-logs-command-CnW8I5a0.cjs +0 -9
  127. package/dist/chunks/run-app-publish-command-DACw_WFa.cjs +0 -1
  128. package/dist/chunks/run-app-pull-command-CNbC_iZs.cjs +0 -6
  129. package/dist/chunks/run-auth-login-command-DmnIxGG3.cjs +0 -1
  130. package/dist/chunks/run-data-get-command-BE6hUvWQ.cjs +0 -1
  131. package/dist/chunks/run-doctor-command-OCHUN5AA.cjs +0 -2
  132. 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.58.0",
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.58.0",
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
- is normally installed globally.
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` | Locate the app and resolve its installed SDK and Node requirements |
14
- | `deployment` | Preview metadata changes, approve them, upload snapshots and sync |
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
- is not a security sandbox. Configurations containing functions stay inside the
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) describes
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 bundle
43
- of the production worker; real-app tests exercise its compiler and bundler.
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.
@@ -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 use kebab-case.
5
- Object and field metadata names keep the entered spelling; display labels use
6
- the same helper as app init.
7
-
8
- ## Contract
9
-
10
- - `twenty app add [entity]` accepts `object`, `field`, `logic-function`,
11
- `front-component` and `validation-rule`. A human terminal can supply omitted values interactively.
12
- JSON, CI, redirected stdin and `--no-input` never prompt; missing required or
13
- inapplicable options exit 2. Labels default to the name; fields default to
14
- `TEXT`.
15
- - `--path` selects an app, like the other CLI app commands. Files go under the
16
- selected app's `src/objects`, `src/fields`, `src/logic-functions`,
17
- `src/front-components` or `src/validation-rules`. Custom output directories are not supported.
18
- - Parent and relation endpoint identifiers must be valid universal UUIDs. No
19
- workspace lookup verifies ownership or existence. Relations require reviewing
20
- both endpoints; this generator creates only the requested standalone field.
21
- - Objects accept `--create-view`, `--create-navigation-menu-item` and
22
- `--create-page-layout`. Each flag opts into that definition; page layouts also
23
- create the fields view used by their Fields widget. The list view and fields
24
- view reuse the object's name field. Fields views also include the SDK's
25
- generated audit fields, resolved using the application's universal identifier.
26
- With no creation flags, human interactive mode offers all three together,
27
- defaulting to No. Explicit creation flags bypass that question. Noninteractive
28
- modes never ask and create only explicitly selected companions. All prompts
29
- complete before any files are written, including on cancellation.
30
- - Node's `randomUUID` creates version 4 identifiers. The CLI TypeScript printer
31
- escapes authored strings, including quotes, backslashes and line breaks.
32
- - App discovery, SDK compatibility and application identity reuse the CLI's
33
- worker boundary. Identity loading evaluates trusted app code in a disposable
34
- worker; it is not a security sandbox. The command makes no workspace requests
35
- and does not require authentication.
36
- - Destination paths reuse pull's containment and symlink checks. All destinations
37
- are checked before writing and all files are staged beside their destinations
38
- before exclusive linking, including when source directories are mounted on
39
- different filesystems.
40
- Existing or concurrently created files are never replaced. Failure or
41
- cancellation before all links complete rolls back the links already created;
42
- files replaced by another process are preserved. Incomplete rollback reports
43
- remaining app-relative paths. Completion wins over late cancellation. Cleanup failure
44
- after success warns and reports the remaining temporary directory. Empty
45
- parent directories can remain after failure or cancellation. Exclusive atomic
46
- creation requires a filesystem supporting hard links; unsupported filesystems
47
- fail instead of falling back to a potentially partial destination write.
48
- - Path validation rejects existing symbolic links. It cannot prevent another
49
- local process from replacing a parent directory between validation and writing.
50
- - JSON reports app-relative `createdPaths`. There is no overwrite mode and no
51
- editing or registration of existing definitions. Standalone view, layout and
52
- navigation item generators are not supported.
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 type
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 the
6
- app's own TypeScript compiler. Build, plan, apply and uninstall use this pipeline.
7
- Worker requests are internal, not a public API or a way to bypass build checks.
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
- ## Contract
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. Snapshot copies
23
- dereference symlinks. Each upload artifact records its role, byte size and
24
- SHA-256 hash. README and source maps are included in the snapshot but are not
25
- upload artifacts. The content hash combines the sorted artifact paths, roles and
26
- hashes with the exact manifest bytes.
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. Factories
39
- become no-op validators, plain-data exports retain their values, including
40
- non-enumerable properties, and other exports use proxy stubs. Runtime
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
- parent or nested directory produces the same bundle paths, bytes and hashes.
49
- SDK parity references run from the app root as well.
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: dedicated tests verify preserved
71
- string literals, resolved CSS assets and live shared-dependency bindings. Every
72
- CLI artifact's size/checksum and the snapshot content hash are checked against
73
- the actual bytes. Tests also verify the manifest references for function, component
74
- and shared-dependency bundles, and compare the serialized manifest with the
75
- worker's manifest result. The invalid fixture fails in both
76
- pipelines. The fresh CLI template's test setup typechecks with an authoring-only SDK.
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 translations
82
- and CSS, README selection, immutable symlink copies, concurrent snapshots,
83
- release ownership, failed/cancelled builds and failed snapshot consumers. The
84
- build/apply contract runs CLI snapshots against a local HTTP fixture, including
85
- uploads, sync, pull-base recording, release and client generation. It does not contact
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.
@@ -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 expected-package
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 expected
15
- package name. Resolution does not search workspace ancestors, avoiding writes
16
- to a hoisted-only installation shared by other apps. Package-manager symlinks
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
- The output layout is `dist/core/generated`, `dist/core.mjs` and
25
- `dist/core.cjs` inside that installation. Source files and the metadata client
26
- remain unchanged. Neither apps nor SDK packages depend on the CLI. The client
27
- SDK's generator dependencies remain part of the app's installed client package.
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
- invalid schemas without replacing the installed bundles.
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
- the same schema and app path, comparing every generated source file and both
52
- compiled bundles byte for byte. Reusing the path keeps esbuild's source-path
53
- comments identical without normalizing file contents. The app has its own client
54
- SDK and no application SDK. The generated CommonJS client is loaded to verify
55
- its `CoreApiClient` export.
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
- generation, along with snapshot upload, synchronization, pull-base recording
62
- and release. No live workspace is contacted.
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.
@@ -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. Inputs have stamps captured before reads; after
19
- attaching the watcher, changed stamps invalidate the result. A successful graph
20
- replaces the previous graph; a failure watches the last successful graph plus
21
- only that attempt's inputs. External directory observation is shallow.
22
-
23
- `applyAppBuild` handles remote operations. Dev supplies a
24
- revision-specific approval signal and a check immediately before the first
25
- write. Once writes start, a newer build does not cancel those writes. Client
26
- generation pauses compilation and invalidates pending builds; its successful
27
- input key plus output stamps prevent generation loops. A failure after client
28
- writes start ends the session. Normal compilation failures keep watching;
29
- abnormal worker exits and watcher failures require restart.
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
- and SIGKILL recovery are outside this
34
- session's guarantees. See the [command reference](../../../docs/commands.md#develop-an-app) for
35
- user-visible limits.
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.
@@ -1,46 +1,66 @@
1
1
  # CLI app function execution
2
2
 
3
- The command selects one deployed function from the
4
- local app's identifiers, executes it once with a payload, and reports status,
5
- duration, data, error and logs. Name matching is exact. Hooks select their
6
- function identifier; executing an uninstall hook does not uninstall the app.
7
- A non-SUCCESS result exits with failure. It executes deployed code, so local
8
- edits must be synced with apply or dev first.
9
-
10
- ## Contract
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
- - The CLI keeps no saved build manifest. It uses the `buildManifest`
16
- worker to load definitions with the app's authoring SDK, without bundling or
17
- typechecking. Worker output becomes diagnostics; credentials are not passed to it.
18
- - Function selection checks both the local manifest identifiers and the remote
19
- installed application's ID. The `findOneApplication` lookup prevents
20
- copied or stale identifiers from selecting another installed app's function.
21
- This needs `APPLICATIONS` in addition to execution's `WORKFLOWS` permission.
22
- - The current server requires a user-bound token for execution. Browser-login
23
- OAuth remotes are supported; API-key targets fail before loading app source.
24
- The server still decides which functions that user can run: workspace custom
25
- app functions, functions exposed as workflow actions, or functions from an
26
- app registered by this workspace. The CLI does not bypass those checks.
27
- - Payloads use the JSON-object input reader: inline JSON, `@file` or
28
- `-` for stdin, default `{}`. Non-object values are rejected.
29
- - Human output escapes terminal controls. JSON success includes function/app
30
- identity, status, `durationMilliseconds`, data, logs, error and diagnostics.
31
- A completed non-SUCCESS result exits 1 with `EXECUTION_FAILED` and retains
32
- that information in `error.details`, with `outcome: "completed"`. A missing
33
- function exits 4; ambiguous selection exits 6; bad input exits 2.
34
- - The execution request deadline is the deployed function's `timeoutSeconds`
35
- plus the transport's 60-second allowance. Its HTTP dispatcher header/body
36
- deadlines use the same value, avoiding Node's default five-minute cutoff.
37
- Other commands use their own deadlines and lazy transport loading.
38
- Proxies and the server can still close a request earlier.
39
- - Execution is never retried. Acknowledged authentication, permission,
40
- not-found and input/validation rejections have `outcome: "not-started"`.
41
- Transport failure, cancellation, internal server error or an invalid response
42
- after submission have `outcome: "unknown"`: execution may still be running.
43
- Ctrl+C exits 130 and cannot stop the server-side function or undo its effects.
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,