twenty 0.3.0 → 2.48.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 (198) hide show
  1. package/CONTRIBUTING.md +174 -0
  2. package/LICENSE +21 -0
  3. package/README.md +86 -3
  4. package/dist/app-template/.nvmrc +1 -0
  5. package/dist/app-template/.oxlintrc.json +37 -0
  6. package/dist/app-template/AGENTS.md +70 -0
  7. package/dist/app-template/CHANGELOG.md +7 -0
  8. package/dist/app-template/README.md +34 -0
  9. package/dist/app-template/SETUP.md +47 -0
  10. package/dist/app-template/github/workflows/cd.yml +42 -0
  11. package/dist/app-template/github/workflows/ci.yml +60 -0
  12. package/dist/app-template/github/workflows/publish.yml +52 -0
  13. package/dist/app-template/gitignore +43 -0
  14. package/dist/app-template/locales/en.json +1 -0
  15. package/dist/app-template/package.json +36 -0
  16. package/dist/app-template/public/logo.svg +7 -0
  17. package/dist/app-template/src/__tests__/application-config.test.ts +14 -0
  18. package/dist/app-template/src/__tests__/global-setup.ts +56 -0
  19. package/dist/app-template/src/__tests__/run-twenty.ts +66 -0
  20. package/dist/app-template/src/__tests__/schema.integration-test.ts +46 -0
  21. package/dist/app-template/src/application-config.ts +13 -0
  22. package/dist/app-template/src/constants/universal-identifiers.ts +12 -0
  23. package/dist/app-template/src/default-role.ts +16 -0
  24. package/dist/app-template/src/front-components/main-page.tsx +287 -0
  25. package/dist/app-template/src/logic-functions/health-check.ts +11 -0
  26. package/dist/app-template/src/navigation-menu-items/main-page.navigation-menu-item.ts +19 -0
  27. package/dist/app-template/src/page-layouts/main-page.page-layout.ts +42 -0
  28. package/dist/app-template/tsconfig.json +37 -0
  29. package/dist/app-template/tsconfig.spec.json +9 -0
  30. package/dist/app-template/vitest.config.ts +31 -0
  31. package/dist/app-template/vitest.unit.config.ts +14 -0
  32. package/dist/app-template/yarn.lock +3374 -0
  33. package/dist/app-template/yarnrc.yml +1 -0
  34. package/dist/app-worker.cjs +1 -0
  35. package/dist/chunks/application-VJqniwXy.cjs +5 -0
  36. package/dist/chunks/assert-pull-paths-BuQ1ZRvQ.cjs +1 -0
  37. package/dist/chunks/build-CX6FBrbu.cjs +1 -0
  38. package/dist/chunks/build-pull-entities-BBNc4zkt.cjs +5 -0
  39. package/dist/chunks/build-source-manifest-BMjw7BvT.cjs +2 -0
  40. package/dist/chunks/build-source-snapshot-BbQlyo_m.cjs +206 -0
  41. package/dist/chunks/check-node-requirement-CGBKvEqH.cjs +1 -0
  42. package/dist/chunks/cli-error-CSsayo0u.cjs +1 -0
  43. package/dist/chunks/cli-node-version-range.constant-D7fE8edk.cjs +1 -0
  44. package/dist/chunks/cli-version.constant-BJdY4dXs.cjs +1 -0
  45. package/dist/chunks/collect-translatable-strings-C3TWaO1V.cjs +1 -0
  46. package/dist/chunks/collect-watch-inputs-Cexr5YYZ.cjs +1 -0
  47. package/dist/chunks/compile-application-translations-Dhfvrs__.cjs +1 -0
  48. package/dist/chunks/config-file-mode.constant-DLBzKKUl.cjs +1 -0
  49. package/dist/chunks/confirm-in-terminal-BxEM5lxE.cjs +1 -0
  50. package/dist/chunks/constants-Cf5-CwMu.cjs +1 -0
  51. package/dist/chunks/constants-Du9J-8Ug-CD8GTrut.cjs +23 -0
  52. package/dist/chunks/convert-to-label-D24GvvpW.cjs +1 -0
  53. package/dist/chunks/create-app-not-installed-error-DY-iuPPx.cjs +1 -0
  54. package/dist/chunks/create-cancelled-error-DgrNfOv2.cjs +1 -0
  55. package/dist/chunks/create-http-status-error-Dd3336c8.cjs +1 -0
  56. package/dist/chunks/create-metadata-client-DEBMHFDo.cjs +6 -0
  57. package/dist/chunks/create-pull-base-write-Cl1jfQ6l.cjs +1 -0
  58. package/dist/chunks/create-rest-client-r3OA3fUu.cjs +60 -0
  59. package/dist/chunks/create-tooling-failure-B2FmNwR2.cjs +1 -0
  60. package/dist/chunks/credential-kind-labels.constant-CKdoQF8o.cjs +1 -0
  61. package/dist/chunks/extract-manifest-from-file-D3w7Ampa.cjs +1 -0
  62. package/dist/chunks/extract-source-translations-BLQ-XFuN.cjs +1 -0
  63. package/dist/chunks/fetch-metadata-inspection-BwJjaHCB.cjs +1 -0
  64. package/dist/chunks/fetch-signed-in-identity-CWFlsW7e.cjs +1 -0
  65. package/dist/chunks/fetch-workspace-id-DJFdCITG.cjs +1 -0
  66. package/dist/chunks/find-remote-D48r20g0.cjs +1 -0
  67. package/dist/chunks/format-app-duration-gu2oRLB4.cjs +1 -0
  68. package/dist/chunks/format-body-CJyi3Ukr.cjs +1 -0
  69. package/dist/chunks/format-data-value-C5itQm1i.cjs +1 -0
  70. package/dist/chunks/format-details-COEwKz_M.cjs +2 -0
  71. package/dist/chunks/format-display-path-gEepVJDg.cjs +1 -0
  72. package/dist/chunks/format-metadata-fields-BozY419E.cjs +2 -0
  73. package/dist/chunks/format-metadata-owner-C6CksDIK.cjs +1 -0
  74. package/dist/chunks/format-progress-line-C5nYDVHB.cjs +1 -0
  75. package/dist/chunks/format-table-4drtI5sP.cjs +2 -0
  76. package/dist/chunks/fs-utils-Bl1fQcaJ.cjs +2 -0
  77. package/dist/chunks/generate-application-client-BApuJWQO.cjs +1 -0
  78. package/dist/chunks/get-app-plan-summary-F_MjZOGe.cjs +8 -0
  79. package/dist/chunks/get-client-generation-skip-reason-B5f_gcok.cjs +1 -0
  80. package/dist/chunks/get-client-sdk-package-path-2U3kDCRq.cjs +1 -0
  81. package/dist/chunks/get-config-path-C-D-QHuX.cjs +1 -0
  82. package/dist/chunks/get-credential-kind-JI9heHe2.cjs +1 -0
  83. package/dist/chunks/get-function-input-schema-GNk3NRLJ-oQ5Evald.cjs +1 -0
  84. package/dist/chunks/get-tooling-error-context-C69TBSej.cjs +1 -0
  85. package/dist/chunks/global-flags.constant-BPHQAhn7.cjs +1 -0
  86. package/dist/chunks/has-yarn-plug-and-play-X3ay5Xl0.cjs +1 -0
  87. package/dist/chunks/is-access-token-expiring-DIimejBr.cjs +1 -0
  88. package/dist/chunks/is-application-not-found-error-D0BAcKyX.cjs +1 -0
  89. package/dist/chunks/is-exported-manifest-RF_O2ibz.cjs +1 -0
  90. package/dist/chunks/is-inside-directory-DHVCQE5C.cjs +1 -0
  91. package/dist/chunks/is-interaction-allowed-CF-ko1KI.cjs +1 -0
  92. package/dist/chunks/is-locale-catalog-Dzj6m_Xt.cjs +1 -0
  93. package/dist/chunks/is-same-universal-identifier-BCBib3RP.cjs +1 -0
  94. package/dist/chunks/is-supported-locale-C9iuFQ39.cjs +1 -0
  95. package/dist/chunks/kebab-case-D0usAzG-.cjs +1 -0
  96. package/dist/chunks/list-application-source-files-jEau5Rie.cjs +1 -0
  97. package/dist/chunks/locale-catalog-format-BT6ommA1.cjs +20 -0
  98. package/dist/chunks/metadata-BtOyR6x0.cjs +1 -0
  99. package/dist/chunks/metadata-page.constant-CnR03vnh.cjs +1 -0
  100. package/dist/chunks/oauth-timing.constant-BClMQcKn.cjs +1 -0
  101. package/dist/chunks/open-browser-LPuVspT7.cjs +1 -0
  102. package/dist/chunks/parse-api-url-C9MmGtLY.cjs +1 -0
  103. package/dist/chunks/parse-app-export-BT6nM7Ki.cjs +1 -0
  104. package/dist/chunks/parse-extraction-locale-CM7sARBo.cjs +1 -0
  105. package/dist/chunks/parse-graphql-response-DbYu3YlQ.cjs +1 -0
  106. package/dist/chunks/parse-json-input-DaXTn_6C.cjs +1 -0
  107. package/dist/chunks/print-typescript-value-BoxeFXca.cjs +3 -0
  108. package/dist/chunks/pull-source-DNswr_80.cjs +1 -0
  109. package/dist/chunks/read-app-identity-CtO3wiSx.cjs +1 -0
  110. package/dist/chunks/read-application-identifier-B51ax_Q6.cjs +1 -0
  111. package/dist/chunks/read-application-identity-Bx8B9Bel.cjs +1 -0
  112. package/dist/chunks/read-command-values-uSJqBG_E.cjs +1 -0
  113. package/dist/chunks/read-config-LKYhSPOb.cjs +1 -0
  114. package/dist/chunks/read-input-value-Cxgh_r2g.cjs +1 -0
  115. package/dist/chunks/read-json-object-BONMjSVo.cjs +1 -0
  116. package/dist/chunks/read-snapshot-file-ClIpemjz.cjs +1 -0
  117. package/dist/chunks/read-source-identity-C4eKC14c.cjs +1 -0
  118. package/dist/chunks/read-watch-input-stamp-BxeOb0vI.cjs +1 -0
  119. package/dist/chunks/record-pull-base-CdTOndSf.cjs +1 -0
  120. package/dist/chunks/record-typecheck-config-inputs-DcCY-_Z1.cjs +1 -0
  121. package/dist/chunks/request-oauth-tokens-CS79pVAp.cjs +1 -0
  122. package/dist/chunks/request-timeout-milliseconds.constant-DtyQHrll.cjs +1 -0
  123. package/dist/chunks/require-approval-D0FfoHhF.cjs +1 -0
  124. package/dist/chunks/resolve-app-project-BQnFOdLH.cjs +1 -0
  125. package/dist/chunks/resolve-command-target-CKYtQQPx.cjs +1 -0
  126. package/dist/chunks/resolve-inside-sdk-Cc_y-RWT.cjs +1 -0
  127. package/dist/chunks/resolve-metadata-object-CRWbF9Ce.cjs +1 -0
  128. package/dist/chunks/resolve-project-typescript-CZW_p97L.cjs +1 -0
  129. package/dist/chunks/resolve-request-url-BrqiqInn.cjs +1 -0
  130. package/dist/chunks/resolve-source-sdk-CGEJC-UH.cjs +1 -0
  131. package/dist/chunks/result-item-limit.constant-CDrOhiWD.cjs +1 -0
  132. package/dist/chunks/run-api-graphql-command-KlIMjpOY.cjs +1 -0
  133. package/dist/chunks/run-api-rest-command-W4gCU562.cjs +1 -0
  134. package/dist/chunks/run-app-add-command-C6rIt02R.cjs +163 -0
  135. package/dist/chunks/run-app-apply-command-BckNNni9.cjs +2 -0
  136. package/dist/chunks/run-app-build-command-DW0r-w2C.cjs +2 -0
  137. package/dist/chunks/run-app-dev-command-C3U-3OiV.cjs +2 -0
  138. package/dist/chunks/run-app-exec-command-DNeCk5qs.cjs +3 -0
  139. package/dist/chunks/run-app-generate-client-command-HAgBNVFU.cjs +2 -0
  140. package/dist/chunks/run-app-init-command-dTbY28oS.cjs +2 -0
  141. package/dist/chunks/run-app-install-command-BX30OsrQ.cjs +1 -0
  142. package/dist/chunks/run-app-logs-command-CdAXR-XY.cjs +9 -0
  143. package/dist/chunks/run-app-operation--X_q0SAn.cjs +1 -0
  144. package/dist/chunks/run-app-plan-command-Bm1eXl7V.cjs +1 -0
  145. package/dist/chunks/run-app-publish-command-Cdb3OlI2.cjs +3 -0
  146. package/dist/chunks/run-app-pull-command-DljZP4Ey.cjs +3 -0
  147. package/dist/chunks/run-app-translations-extract-command-Cc053lZ6.cjs +2 -0
  148. package/dist/chunks/run-app-typecheck-command-B7o20_BR.cjs +1 -0
  149. package/dist/chunks/run-app-uninstall-command-DJsWZtoI.cjs +2 -0
  150. package/dist/chunks/run-auth-login-command-21pHzpvT.cjs +1 -0
  151. package/dist/chunks/run-auth-logout-command-DWOafJmL.cjs +2 -0
  152. package/dist/chunks/run-auth-status-command-BBAcouvs.cjs +1 -0
  153. package/dist/chunks/run-auth-token-command-D4geJ-rx.cjs +1 -0
  154. package/dist/chunks/run-cli-D1VWVXar.cjs +23 -0
  155. package/dist/chunks/run-commands-command-6x3V48LL.cjs +2 -0
  156. package/dist/chunks/run-data-get-command-DrgvC-zi.cjs +1 -0
  157. package/dist/chunks/run-data-list-command-Cs8GAHbD.cjs +1 -0
  158. package/dist/chunks/run-doctor-command-BM4pkNY0.cjs +2 -0
  159. package/dist/chunks/run-metadata-field-describe-command-CrmzNFh8.cjs +3 -0
  160. package/dist/chunks/run-metadata-field-list-command-B2CbERvZ.cjs +3 -0
  161. package/dist/chunks/run-metadata-object-describe-command-PLt5ySLJ.cjs +3 -0
  162. package/dist/chunks/run-metadata-object-list-command-BcnWKmgh.cjs +2 -0
  163. package/dist/chunks/run-open-command-CzMO5wI4.cjs +1 -0
  164. package/dist/chunks/run-remote-list-command-37zf0rSp.cjs +1 -0
  165. package/dist/chunks/run-remote-remove-command-B-XUqYBY.cjs +2 -0
  166. package/dist/chunks/run-remote-rename-command-Bmg3nZfB.cjs +1 -0
  167. package/dist/chunks/run-remote-use-command-r2NUlgWw.cjs +1 -0
  168. package/dist/chunks/run-version-command-DfDcA927.cjs +1 -0
  169. package/dist/chunks/select-target-CEy96CC9.cjs +1 -0
  170. package/dist/chunks/sign-in-to-remote-again-9cHGpXda.cjs +1 -0
  171. package/dist/chunks/sign-in-with-browser-StQ_Fkku.cjs +1 -0
  172. package/dist/chunks/style-BR52fK4V.cjs +1 -0
  173. package/dist/chunks/target-environment-variable.constant-D7z8AihP.cjs +1 -0
  174. package/dist/chunks/to-cli-error-BBYf_wqo.cjs +1 -0
  175. package/dist/chunks/to-public-target-T4zHrdLQ.cjs +1 -0
  176. package/dist/chunks/to-worker-output-diagnostics-BeJKIsDG.cjs +2 -0
  177. package/dist/chunks/typecheck-application-DLdoLIDx.cjs +2 -0
  178. package/dist/chunks/undici-D3mKdfwl.cjs +95 -0
  179. package/dist/chunks/update-config-CNOHxgkF.cjs +1 -0
  180. package/dist/chunks/utils-BEfQWzTA-z2Y1wZJq.cjs +35 -0
  181. package/dist/chunks/validate-app-path-Dau-PC0a.cjs +1 -0
  182. package/dist/chunks/validate-remote-name-w-qnr43w.cjs +1 -0
  183. package/dist/chunks/with-phase-details-Dof8Ao9R.cjs +1 -0
  184. package/dist/chunks/write-config-atomically-gr2Ldzm8.cjs +1 -0
  185. package/dist/cli.cjs +2 -0
  186. package/docs/commands.md +652 -0
  187. package/package.json +39 -3
  188. package/src/app/README.md +43 -0
  189. package/src/app/add/README.md +69 -0
  190. package/src/app/bundles/README.md +85 -0
  191. package/src/app/client/README.md +62 -0
  192. package/src/app/dev/README.md +35 -0
  193. package/src/app/exec/README.md +48 -0
  194. package/src/app/function-logs/README.md +44 -0
  195. package/src/app/manifest/README.md +74 -0
  196. package/src/app/pull/README.md +28 -0
  197. package/src/app/source/README.md +33 -0
  198. package/src/app/typecheck/README.md +67 -0
@@ -0,0 +1,174 @@
1
+ # Contributing to Twenty CLI
2
+
3
+ This package is the `twenty` executable in the Twenty monorepo. Its Nx project
4
+ is named `twenty-cli`; its Yarn workspace and npm package are named `twenty`.
5
+ Follow the repository's development instructions and nearby code conventions.
6
+
7
+ ## Build and verify
8
+
9
+ Run these from the repository root after installing its dependencies:
10
+
11
+ ```bash
12
+ yarn nx build twenty-cli
13
+ node packages/twenty-cli/dist/cli.cjs --help
14
+ yarn nx lint twenty-cli
15
+ yarn exec tsgo -p packages/twenty-cli/tsconfig.json --noEmit
16
+ ```
17
+
18
+ Tests that use real applications or SDK parity references require the repository
19
+ SDK to be built. Its Nx target builds its dependencies:
20
+
21
+ ```bash
22
+ yarn nx build twenty-sdk
23
+ cd packages/twenty-cli
24
+ yarn exec vitest run --maxWorkers=2
25
+ ```
26
+
27
+ For a focused change, pass its test file or directory to `vitest run`. Command
28
+ tests execute the public command runner with local HTTP fixtures. Worker tests
29
+ exercise subprocess output, cancellation and snapshot lifetime. Parity suites
30
+ compare generated source and artifacts against the SDK implementation;
31
+ the SDK is a test reference, not a runtime tooling dependency.
32
+
33
+ Rebuild `twenty-shared` with `--skip-nx-cache` after switching branches or changing
34
+ shared exports. Generated `dist` directories are not tracked, and stale outputs
35
+ can invalidate dependent test and typecheck results. Use the direct TypeScript
36
+ command above when checking a fix rather than relying on an Nx cache hit.
37
+
38
+ No live workspace is required for the unit suite. Passing it does not establish
39
+ live authorization, remote upload or server-version compatibility. Exercise
40
+ changed server workflows against a disposable workspace when appropriate.
41
+
42
+ ## Package map
43
+
44
+ | Location | Responsibility |
45
+ | --- | --- |
46
+ | `src/catalog` | Command definitions, topics and lazy handler loading |
47
+ | `src/commands` | Command orchestration and user-visible results |
48
+ | `src/program` | Argument parsing, target setup, interaction and command lifecycle |
49
+ | `src/config`, `src/target`, `src/oauth` | Saved connections, target selection and authentication |
50
+ | `src/transport` | HTTP/GraphQL requests, proxy routing, limits and cancellation |
51
+ | `src/metadata`, `src/data` | Workspace metadata inspection and record reads |
52
+ | `src/doctor` | Read-only setup and connection diagnostics |
53
+ | `src/app` | Project tooling and application lifecycle, see its [module map](src/app/README.md) |
54
+ | `src/input`, `src/output` | Input parsing, human/JSON/NDJSON output and error contracts |
55
+ | `app-template` | App source, configuration and CLI-based integration-test harness copied by `app init` |
56
+
57
+ Command definitions are the source for help and `twenty commands`. Keep handlers
58
+ lazy so discovery does not load compiler or app code. Put a workflow's rules in
59
+ its owning module; a command handler should connect parsed input, that module
60
+ and output. Preserve meaningful behavior tests when moving implementation files.
61
+
62
+ ## Application tooling guarantees
63
+
64
+ The [application module documentation](src/app/README.md) describes each stage.
65
+ Changes must preserve these contracts:
66
+
67
+ - App definitions execute as trusted code in a disposable worker. The worker
68
+ contains process exits, filters CLI credentials and captures bounded output;
69
+ it is not a filesystem or network sandbox. Executable configs stay in the
70
+ worker, and only serializable requests and results cross IPC.
71
+ - A build's immutable snapshot stays alive until its consumers finish. Uploads
72
+ verify containment, size and checksums. Failed or cancelled work must release
73
+ the snapshots it owns without removing another build's files.
74
+ - Apply reports which remote phases completed and whether the outcome is known.
75
+ Do not retry writes or claim rollback when the server's result is unknown.
76
+ Each apply uses a fresh plan; approval does not carry across dev revisions.
77
+ - Pull stages source writes and its target-bound baseline together. Ordinary
78
+ failures restore originals; interrupted workers and failed rollback report
79
+ uncertainty and retain recovery information. Unsupported definitions remain
80
+ visible in coverage reports.
81
+ - JSON emits one result envelope. Streaming commands honor backpressure, bound
82
+ buffering and emit a terminal result or error. Cancellation exits 130 unless
83
+ the operation has already acknowledged its completed result.
84
+
85
+ ## Packaging
86
+
87
+ Vite builds the CLI, its worker and lazy chunks into `dist`. It also copies the
88
+ CLI-owned `app-template` there. Chokidar,
89
+ esbuild, tinyglobby and the CLI's TypeScript parser are runtime dependencies;
90
+ other imported libraries are bundled. The parser is separate from the app's
91
+ compiler used for typechecking.
92
+
93
+ The archive includes the command reference, contributor guide and application
94
+ module READMEs so their relative links also work outside a repository checkout.
95
+ It does not include the CLI's TypeScript implementation or tests.
96
+
97
+ For packaging changes, run the build and installation checks:
98
+
99
+ ```bash
100
+ yarn nx run twenty-cli:test:package
101
+ ```
102
+
103
+ This runs the binary declared in the workspace's `package.json` directly, packs
104
+ the CLI, and installs the archive with only its production dependencies in a
105
+ temporary directory outside the monorepo. It checks help, offline doctor, app initialization including the
106
+ integration-test harness, and a compiler diagnostic from the installed worker. npm
107
+ registry access is required for installation; the commands do not contact a
108
+ Twenty workspace. Temporary files are removed afterward, and nothing is
109
+ published. CI runs the same target for CLI and dependency changes.
110
+
111
+ The CLI CI job also runs `scripts/test-app-publish.mjs` after building the CLI
112
+ and SDK. It starts a disposable Verdaccio registry with no upstream registries,
113
+ publishes a fixture with real npm, downloads and inspects the tarball, and checks
114
+ version rejection, incomplete packages and cleanup. On Linux CI the test runs
115
+ inside a network namespace with only loopback enabled, so it cannot reach public
116
+ npm. It uses temporary npm configuration and a local test token.
117
+
118
+ ## Releases
119
+
120
+ Publish the CLI when its changes warrant a release. A server release does not
121
+ require a CLI release; skip versions when the CLI has no changes worth shipping.
122
+ When publishing, aim to align the CLI version with the corresponding Twenty
123
+ server, SDK and UI version.
124
+
125
+ Publishing is independent through the `cli/` tag family: `cli/v2.46.0` publishes
126
+ only `twenty@2.46.0`. The tag version must match
127
+ `packages/twenty-cli/package.json`. Bumping the package version alone does not
128
+ publish the CLI.
129
+
130
+ `app init` pins `twenty-client-sdk`, `twenty-sdk` and `twenty-ui` to the
131
+ `twenty-sdk` version of the commit the CLI was built from. `main` moves
132
+ to the next, unpublished SDK version right after each SDK release:
133
+
134
+ 1. Start from the matching `sdk/vA.B.C` release commit. If a CLI version bump
135
+ is still needed, make it on a branch from that commit.
136
+ 2. Once the SDK, client SDK and UI packages at `A.B.C` are on npm, tag the
137
+ prepared commit `cli/vA.B.C`.
138
+ 3. Run the `Publish npm packages` workflow in `twenty-infra` with that tag as
139
+ its `ref`. Creating the tag alone does not publish the package.
140
+
141
+ `yarn npm publish` first runs `scripts/prepublish.mjs`, which needs a fresh
142
+ build and npm registry access. It checks the build first, and fails when the
143
+ executable, worker, lazy chunks or templates are missing, when `dist` was built
144
+ for another version, when one of its CLI runs fails or times out, or when
145
+ `app init` would pin versions that are not on npm. An unreachable registry is
146
+ reported separately from a missing version. The check does not read tags: it
147
+ confirms that the pinned versions are published. Selecting the matching SDK
148
+ release remains a release step.
149
+
150
+ Once the check passes, the script resolves the built app template's
151
+ dependencies, with the versions that `app init` pinned during the check, using
152
+ the repository's Yarn against the public registry, under a 3-day minimum
153
+ release age that exempts the pinned Twenty packages. It then writes
154
+ `dist/app-template/yarn.lock`. Apps created with `app init` then install exact,
155
+ integrity-checked versions, including for people who enforce a minimum release
156
+ age. The lockfile keeps the template's placeholder name, and the first
157
+ `yarn install` renames that root entry.
158
+
159
+ The tests of both steps run with `twenty-cli:test:package`. To run the script
160
+ before tagging:
161
+
162
+ ```bash
163
+ yarn nx build twenty-cli
164
+ node packages/twenty-cli/scripts/prepublish.mjs
165
+ ```
166
+
167
+ ## App integration tests
168
+
169
+ `app-template/src/__tests__` supplies the integration-test setup for CLI-created apps.
170
+ It deploys the app before tests and uninstalls it afterward by invoking the
171
+ installed CLI with `--json`. Apps invoke the executable rather than import the
172
+ CLI as a library or add it as a dependency. See the
173
+ [template contract](docs/commands.md#create-an-app) for executable selection and
174
+ the [compiler requirements](src/app/typecheck/README.md) for project setup.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-present Twenty.com, PBC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,6 +1,89 @@
1
1
  # Twenty CLI
2
2
 
3
- The new command-line interface for [Twenty](https://twenty.com) is coming soon.
3
+ Work with [Twenty](https://twenty.com) from your terminal: connect to workspaces,
4
+ inspect metadata and records, send API requests, and develop applications.
4
5
 
5
- This package does not provide an executable yet. For the currently available CLI,
6
- use [twenty-sdk](https://www.npmjs.com/package/twenty-sdk).
6
+ ## Install
7
+
8
+ The CLI needs Node.js 24.5 or later.
9
+
10
+ ```bash
11
+ npm install -g twenty
12
+ twenty --version
13
+ ```
14
+
15
+ ## Get started
16
+
17
+ ```bash
18
+ twenty doctor --offline
19
+ twenty auth login --url https://acme.twenty.com --use
20
+ twenty metadata object list
21
+ twenty data list companies --limit 5
22
+ twenty open
23
+ ```
24
+
25
+ Replace the example URL with your workspace's address. `--use` makes this
26
+ connection the default, even when another saved connection already is one. Use
27
+ `--remote <name>` to select another saved connection and `--json` for a
28
+ structured result. Saved connections live in `~/.twenty/config.json`.
29
+
30
+ Browser sign-in is supported on Twenty 2.42 and later. On older servers, sign in
31
+ with an [API key](docs/commands.md#connections-and-authentication) instead.
32
+
33
+ ## Develop an application
34
+
35
+ App projects pin Yarn 4 in `packageManager`. Run `corepack enable` once so
36
+ `yarn` uses that version; if `corepack` is missing, install it with
37
+ `npm install -g corepack`. These steps use the default connection;
38
+ `twenty auth status` shows which one that is:
39
+
40
+ ```bash
41
+ twenty app init my-app
42
+ cd my-app
43
+ yarn install
44
+ twenty app build
45
+ twenty app apply --create
46
+ twenty app dev
47
+ ```
48
+
49
+ `app init` writes files without installing dependencies. `app build` checks the
50
+ project locally. `app apply --create` registers and installs a new development
51
+ app, uploads its build and synchronizes its metadata. Once registered, inspect
52
+ changes with `twenty app plan` before applying them. `app dev` watches inputs and
53
+ syncs successful builds.
54
+
55
+ Missing definitions imply remote deletions by default. Pass `--no-delete` to
56
+ preserve them. Object and field deletions require confirmation because they
57
+ also delete stored data. Pull can overwrite local edits; read its
58
+ [reconciliation rules](docs/commands.md#pull-an-app) before using it.
59
+
60
+ Apps created with `app init` declare the oldest Twenty version they support in
61
+ `engines.twenty`. `app exec` runs functions as the signed-in user, so it needs a
62
+ browser sign-in and Twenty 2.46 or later. With a browser sign-in, `app uninstall`
63
+ also needs Twenty 2.46 or later; on earlier versions, use an API key for it.
64
+
65
+ ## CLI and app dependencies
66
+
67
+ The CLI is installed globally, separately from each app. Apps keep `twenty-sdk`
68
+ as a development dependency for authoring and build-time APIs, `typescript` for
69
+ checks, and `twenty-client-sdk` when they use a generated API client. Neither
70
+ apps nor SDK packages need `twenty` in their dependencies or devDependencies. In
71
+ CI, install a pinned version with `npm install -g twenty@<version>`.
72
+
73
+ The CLI owns builds and filesystem operations. It uses the app's installed
74
+ SDK authoring exports and TypeScript compiler. Configuration and project-reference
75
+ errors fail builds. See [build requirements](docs/commands.md#build-and-check-an-app)
76
+ for supported SDK exports and compiler configuration.
77
+
78
+ ## Documentation
79
+
80
+ - [Command reference](docs/commands.md), authentication, flags, output, permissions
81
+ and recovery for each workflow.
82
+ - [Contributing](CONTRIBUTING.md), building from source, package structure, tests
83
+ and releases.
84
+ - [Application tooling](src/app/README.md), module responsibilities and invariants.
85
+
86
+ Run `twenty commands` for the command inventory or `twenty <command> --help` for
87
+ its arguments and options.
88
+
89
+ Generated next-step commands use PowerShell on Windows and POSIX shell syntax on macOS/Linux.
@@ -0,0 +1 @@
1
+ 24.5.0
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
3
+ "plugins": ["typescript"],
4
+ "categories": {
5
+ "correctness": "off"
6
+ },
7
+ "ignorePatterns": ["node_modules", "dist"],
8
+ "rules": {
9
+ "no-unused-vars": "off",
10
+
11
+ "typescript/no-unused-vars": [
12
+ "warn",
13
+ {
14
+ "argsIgnorePattern": "^_"
15
+ }
16
+ ],
17
+ "typescript/no-explicit-any": "off"
18
+ },
19
+ "overrides": [
20
+ {
21
+ "files": ["**/*.logic-function.ts", "**/logic-functions/**/*.ts"],
22
+ "rules": {
23
+ "no-restricted-imports": [
24
+ "error",
25
+ {
26
+ "patterns": [
27
+ {
28
+ "group": ["twenty-shared", "twenty-shared/*"],
29
+ "message": "Logic functions must not import from twenty-shared directly. Import runtime types and helpers from `twenty-sdk/logic-function` instead so the logic-function bundle stays minimal."
30
+ }
31
+ ]
32
+ }
33
+ ]
34
+ }
35
+ }
36
+ ]
37
+ }
@@ -0,0 +1,70 @@
1
+ ## Base documentation
2
+
3
+ - Getting started:
4
+ - https://docs.twenty.com/developers/extend/apps/getting-started/quick-start.md
5
+ - https://docs.twenty.com/developers/extend/apps/getting-started/concepts.md
6
+ - https://docs.twenty.com/developers/extend/apps/getting-started/project-structure.md
7
+ - https://docs.twenty.com/developers/extend/apps/getting-started/local-server.md
8
+ - https://docs.twenty.com/developers/extend/apps/getting-started/scaffolding.md
9
+ - https://docs.twenty.com/developers/extend/apps/getting-started/troubleshooting.md
10
+ - Config:
11
+ - https://docs.twenty.com/developers/extend/apps/config/overview.md
12
+ - https://docs.twenty.com/developers/extend/apps/config/application.md
13
+ - https://docs.twenty.com/developers/extend/apps/config/roles.md
14
+ - https://docs.twenty.com/developers/extend/apps/config/install-hooks.md
15
+ - https://docs.twenty.com/developers/extend/apps/config/public-assets.md
16
+ - Data:
17
+ - https://docs.twenty.com/developers/extend/apps/data/overview.md
18
+ - https://docs.twenty.com/developers/extend/apps/data/objects.md
19
+ - https://docs.twenty.com/developers/extend/apps/data/extending-objects.md
20
+ - https://docs.twenty.com/developers/extend/apps/data/relations.md
21
+ - Logic:
22
+ - https://docs.twenty.com/developers/extend/apps/logic/overview.md
23
+ - https://docs.twenty.com/developers/extend/apps/logic/logic-functions.md
24
+ - https://docs.twenty.com/developers/extend/apps/logic/skills-and-agents.md
25
+ - https://docs.twenty.com/developers/extend/apps/logic/connections.md
26
+ - Layout:
27
+ - https://docs.twenty.com/developers/extend/apps/layout/overview.md
28
+ - https://docs.twenty.com/developers/extend/apps/layout/views.md
29
+ - https://docs.twenty.com/developers/extend/apps/layout/navigation-menu-items.md
30
+ - https://docs.twenty.com/developers/extend/apps/layout/page-layouts.md
31
+ - https://docs.twenty.com/developers/extend/apps/layout/front-components.md
32
+ - https://docs.twenty.com/developers/extend/apps/layout/command-menu-items.md
33
+ - Operations:
34
+ - https://docs.twenty.com/developers/extend/apps/operations/overview.md
35
+ - https://docs.twenty.com/developers/extend/apps/operations/cli.md
36
+ - https://docs.twenty.com/developers/extend/apps/operations/testing.md
37
+ - https://docs.twenty.com/developers/extend/apps/operations/publishing.md
38
+ - Rich app example: https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/examples/postcard
39
+
40
+ ## UUID requirement
41
+
42
+ - All generated UUIDs must be valid UUID v4.
43
+
44
+ ## Common Pitfalls
45
+
46
+ - Creating a view without a navigationMenuItem associated. This will make the view available on the left sidebar.
47
+ - Creating a front-end component that has a scroll instead of being responsive to its fixed widget height and width, unless it is specifically meant to be used in a canvas tab.
48
+
49
+ ## Best practice
50
+
51
+ It's highly recommended to create new app entities using `yarn twenty dev:add`. These are the options:
52
+
53
+ | Entity type | Command | Generated file |
54
+ | -------------------- | ---------------------------------------- | ------------------------------------- |
55
+ | Object | `yarn twenty dev:add object` | `src/objects/<name>.ts` |
56
+ | Field | `yarn twenty dev:add field` | `src/fields/<name>.ts` |
57
+ | Logic function | `yarn twenty dev:add logicFunction` | `src/logic-functions/<name>.ts` |
58
+ | Front component | `yarn twenty dev:add frontComponent` | `src/front-components/<name>.tsx` |
59
+ | Role | `yarn twenty dev:add role` | `src/roles/<name>.ts` |
60
+ | Skill | `yarn twenty dev:add skill` | `src/skills/<name>.ts` |
61
+ | Agent | `yarn twenty dev:add agent` | `src/agents/<name>.ts` |
62
+ | View | `yarn twenty dev:add view` | `src/views/<name>.ts` |
63
+ | Navigation menu item | `yarn twenty dev:add navigationMenuItem` | `src/navigation-menu-items/<name>.ts` |
64
+ | Page layout | `yarn twenty dev:add pageLayout` | `src/page-layouts/<name>.ts` |
65
+ | Page layout tab | `yarn twenty dev:add pageLayoutTab` | `src/page-layout-tabs/<name>.ts` |
66
+ | Command menu item | `yarn twenty dev:add commandMenuItem` | `src/command-menu-items/<name>.ts` |
67
+ | View field | `yarn twenty dev:add viewField` | `src/view-fields/<name>.ts` |
68
+ | Connection provider | `yarn twenty dev:add connectionProvider` | `src/connection-providers/<name>.ts` |
69
+
70
+ This helps automatically generate required IDs etc.
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ All notable changes to this application are documented in this file.
4
+
5
+ ## 0.1.0
6
+
7
+ - Initial application scaffolded with `twenty app init`
@@ -0,0 +1,34 @@
1
+ # My Twenty App
2
+
3
+ Describe your app in one or two sentences.
4
+
5
+ ## Features
6
+
7
+ List the top things your app does, for example:
8
+
9
+ - Feature one
10
+ - Feature two
11
+ - Feature three
12
+
13
+ ## Getting started
14
+
15
+ Setup instructions live in [SETUP.md](SETUP.md).
16
+
17
+ ## Publishing
18
+
19
+ The `Publish` workflow (`.github/workflows/publish.yml`) publishes the app to npm with provenance using [npm trusted publishing](https://docs.npmjs.com/trusted-publishers). To publish:
20
+
21
+ 1. On npmjs.com register this repository as a trusted publisher of your package, pointing at the `publish.yml` workflow.
22
+ 2. Bump the version in `package.json`, then push a version tag (e.g. `git tag v1.0.0 && git push --tags`) or run the workflow manually from the Actions tab.
23
+
24
+ Publishing with provenance is also how you prove ownership when claiming your app in a Twenty marketplace.
25
+
26
+ ## Changelog
27
+
28
+ Notable changes are documented in [CHANGELOG.md](CHANGELOG.md).
29
+
30
+ ## Learn more
31
+
32
+ - [Twenty Apps documentation](https://docs.twenty.com/developers/extend/apps/getting-started/quick-start)
33
+ - [twenty-sdk CLI reference](https://www.npmjs.com/package/twenty-sdk)
34
+ - [Discord](https://discord.gg/cx5n4Jzs57)
@@ -0,0 +1,47 @@
1
+ # Setup
2
+
3
+ Follow these steps to get your app running locally.
4
+
5
+ ## Prerequisites
6
+
7
+ - Node.js (version specified in `.nvmrc`)
8
+ - Yarn 4
9
+ - Docker (to run the local Twenty server)
10
+
11
+ ## Steps
12
+
13
+ 1. Install dependencies:
14
+
15
+ ```bash
16
+ yarn install
17
+ ```
18
+
19
+ The committed `yarn.lock` pins exact, integrity-checked versions, so this
20
+ resolves nothing from the registry.
21
+
22
+ 2. Start the local Twenty server:
23
+
24
+ ```bash
25
+ yarn twenty docker:start
26
+ ```
27
+
28
+ Check the server status at any time with `yarn twenty docker:status`.
29
+
30
+ 3. Start the development server and sync your app:
31
+
32
+ ```bash
33
+ yarn twenty dev
34
+ ```
35
+
36
+ 4. Open [http://localhost:2020](http://localhost:2020) and log in with the default development credentials: `tim@apple.dev` / `tim@apple.dev`.
37
+
38
+ ## Verifying your setup
39
+
40
+ - `yarn lint` - Lint the project with oxlint
41
+ - `yarn typecheck` - Type-check the project
42
+ - `yarn test:unit` - Run unit tests
43
+ - `yarn test` - Run integration tests
44
+
45
+ ## Troubleshooting
46
+
47
+ See the [troubleshooting guide](https://docs.twenty.com/developers/extend/apps/getting-started/troubleshooting) or ask on [Discord](https://discord.gg/cx5n4Jzs57).
@@ -0,0 +1,42 @@
1
+ name: CD
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ types: [labeled]
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ env:
14
+ TWENTY_DEPLOY_URL: http://localhost:2020
15
+
16
+ concurrency:
17
+ group: cd-${{ github.ref }}
18
+ cancel-in-progress: true
19
+
20
+ jobs:
21
+ deploy-and-install:
22
+ if: >-
23
+ github.event_name == 'push' ||
24
+ (github.event_name == 'pull_request' && github.event.label.name == 'deploy')
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - name: Checkout
28
+ uses: actions/checkout@v4
29
+ with:
30
+ ref: ${{ github.event.pull_request.head.sha || github.sha }}
31
+
32
+ - name: Deploy
33
+ uses: twentyhq/twenty/.github/actions/deploy-twenty-app@main
34
+ with:
35
+ api-url: ${{ env.TWENTY_DEPLOY_URL }}
36
+ api-key: ${{ secrets.TWENTY_DEPLOY_API_KEY }}
37
+
38
+ - name: Install
39
+ uses: twentyhq/twenty/.github/actions/install-twenty-app@main
40
+ with:
41
+ api-url: ${{ env.TWENTY_DEPLOY_URL }}
42
+ api-key: ${{ secrets.TWENTY_DEPLOY_API_KEY }}
@@ -0,0 +1,60 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request: {}
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ env:
13
+ TWENTY_VERSION: latest
14
+
15
+ concurrency:
16
+ group: ci-${{ github.ref }}
17
+ cancel-in-progress: true
18
+
19
+ jobs:
20
+ test:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - name: Checkout
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Spawn Twenty test instance
27
+ id: twenty
28
+ uses: twentyhq/twenty/.github/actions/spawn-twenty-app-dev-test@main
29
+ with:
30
+ twenty-version: ${{ env.TWENTY_VERSION }}
31
+
32
+ - name: Enable Corepack
33
+ run: corepack enable
34
+
35
+ - name: Setup Node.js
36
+ uses: actions/setup-node@v4
37
+ with:
38
+ node-version-file: '.nvmrc'
39
+ cache: yarn
40
+
41
+ - name: Install Twenty CLI
42
+ run: npm install -g twenty@CLI-VERSION-TO-BE-GENERATED
43
+
44
+ - name: Install dependencies
45
+ run: yarn install --immutable
46
+
47
+ - name: Lint
48
+ run: yarn lint
49
+
50
+ - name: Typecheck
51
+ run: yarn typecheck
52
+
53
+ - name: Unit tests
54
+ run: yarn test:unit
55
+
56
+ - name: Run integration tests
57
+ run: yarn test
58
+ env:
59
+ TWENTY_API_URL: ${{ steps.twenty.outputs.server-url }}
60
+ TWENTY_API_KEY: ${{ steps.twenty.outputs.api-key }}
@@ -0,0 +1,52 @@
1
+ # Publishes the app to npm with provenance (npm trusted publishing).
2
+ #
3
+ # One-time setup:
4
+ # 1. On npmjs.com open your package > Settings > Trusted Publisher and register
5
+ # this repository and this workflow file (publish.yml).
6
+ # See https://docs.npmjs.com/trusted-publishers
7
+ # 2. Push a version tag (e.g. `git tag v1.0.0 && git push --tags`) or run the
8
+ # workflow manually from the Actions tab.
9
+ #
10
+ # Publishing with provenance certifies which GitHub repository the package is
11
+ # built from. This is also how you claim ownership of your app in a Twenty
12
+ # marketplace: the claim flow verifies you own the GitHub account or
13
+ # organization the provenance points to.
14
+ name: Publish
15
+
16
+ on:
17
+ push:
18
+ tags:
19
+ - 'v*'
20
+ workflow_dispatch:
21
+
22
+ permissions:
23
+ contents: read
24
+ # Required for npm trusted publishing (OIDC provenance).
25
+ id-token: write
26
+
27
+ jobs:
28
+ publish:
29
+ runs-on: ubuntu-latest
30
+ steps:
31
+ - name: Checkout
32
+ uses: actions/checkout@v4
33
+
34
+ - name: Setup Node.js
35
+ uses: actions/setup-node@v4
36
+ with:
37
+ node-version: 24
38
+ registry-url: https://registry.npmjs.org
39
+
40
+ - name: Update npm
41
+ # Trusted publishing requires npm 11.5.1 or later.
42
+ run: npm install -g npm@latest
43
+
44
+ - name: Install dependencies
45
+ run: yarn install --immutable
46
+
47
+ - name: Publish to npm
48
+ # Uncomment if publishing from a private source repo: npm rejects
49
+ # OIDC provenance for private repos
50
+ # env:
51
+ # TWENTY_APP_PUBLISH_DISABLE_PROVENANCE: 'true'
52
+ run: yarn twenty app:publish