Skip to content

The open alternative to Salesforce, designed for AI.

Move fixture apps from twenty-sdk to twenty-apps/fixtures (#18531)

Félix Malfait621962e04998
diff --git a/packages/twenty-apps/.gitignore b/packages/twenty-apps/.gitignore
index 1614068bd92..b52530263b1 100644
--- a/packages/twenty-apps/.gitignore
+++ b/packages/twenty-apps/.gitignore
@@ -1,2 +1,3 @@
generated
+.twenty
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/application.config.ts b/packages/twenty-apps/fixtures/function-execute-app/application.config.ts
similarity index 88%
rename from packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/application.config.ts
rename to packages/twenty-apps/fixtures/function-execute-app/application.config.ts
index 5ec44ef59d4..091e5bd5845 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/application.config.ts
+++ b/packages/twenty-apps/fixtures/function-execute-app/application.config.ts
@@ -1,4 +1,4 @@
-import { defineApplication } from '@/sdk';
+import { defineApplication } from 'twenty-sdk';
import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from './my.role';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/my.role.ts b/packages/twenty-apps/fixtures/function-execute-app/my.role.ts
similarity index 92%
rename from packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/my.role.ts
rename to packages/twenty-apps/fixtures/function-execute-app/my.role.ts
index cf02d00129c..a418c6dca21 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/my.role.ts
+++ b/packages/twenty-apps/fixtures/function-execute-app/my.role.ts
@@ -1,4 +1,4 @@
-import { defineRole } from '@/sdk';
+import { defineRole } from 'twenty-sdk';
export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =
'9f992b6c-17e9-4381-bab5-b6150b574304';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/package.json b/packages/twenty-apps/fixtures/function-execute-app/package.json
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/package.json
rename to packages/twenty-apps/fixtures/function-execute-app/package.json
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/src/logic-functions/add-numbers.function.ts b/packages/twenty-apps/fixtures/function-execute-app/src/logic-functions/add-numbers.function.ts
similarity index 91%
rename from packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/src/logic-functions/add-numbers.function.ts
rename to packages/twenty-apps/fixtures/function-execute-app/src/logic-functions/add-numbers.function.ts
index e3ee6b30220..4939c3df009 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/src/logic-functions/add-numbers.function.ts
+++ b/packages/twenty-apps/fixtures/function-execute-app/src/logic-functions/add-numbers.function.ts
@@ -1,4 +1,4 @@
-import { defineLogicFunction } from '@/sdk';
+import { defineLogicFunction } from 'twenty-sdk';
export const ADD_NUMBERS_UNIVERSAL_IDENTIFIER =
'f9e5589c-e951-4d99-85db-0a305ab53502';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/tsconfig.json b/packages/twenty-apps/fixtures/function-execute-app/tsconfig.json
similarity index 89%
rename from packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/tsconfig.json
rename to packages/twenty-apps/fixtures/function-execute-app/tsconfig.json
index a86682adf15..97050faf758 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/tsconfig.json
+++ b/packages/twenty-apps/fixtures/function-execute-app/tsconfig.json
@@ -3,13 +3,13 @@
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "bundler",
- "esModuleInterop": true,
"strict": true,
+ "esModuleInterop": true,
"skipLibCheck": true,
"jsx": "react-jsx",
"baseUrl": ".",
"paths": {
- "@/*": ["../../../../../src/*"]
+ "src/*": ["./src/*"]
}
},
"include": ["**/*"],
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/application.config.ts b/packages/twenty-apps/fixtures/invalid-app/application.config.ts
similarity index 86%
rename from packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/application.config.ts
rename to packages/twenty-apps/fixtures/invalid-app/application.config.ts
index c6d5c7e8fd4..aafbe380640 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/application.config.ts
+++ b/packages/twenty-apps/fixtures/invalid-app/application.config.ts
@@ -1,4 +1,4 @@
-import { defineApplication } from '@/sdk';
+import { defineApplication } from 'twenty-sdk';
export default defineApplication({
universalIdentifier: 'invalid-app-0000-0000-0000-000000000001',
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/package.json b/packages/twenty-apps/fixtures/invalid-app/package.json
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/package.json
rename to packages/twenty-apps/fixtures/invalid-app/package.json
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/src/first.object.ts b/packages/twenty-apps/fixtures/invalid-app/src/first.object.ts
similarity index 91%
rename from packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/src/first.object.ts
rename to packages/twenty-apps/fixtures/invalid-app/src/first.object.ts
index f5e67153bc6..03a167d45dd 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/src/first.object.ts
+++ b/packages/twenty-apps/fixtures/invalid-app/src/first.object.ts
@@ -1,4 +1,4 @@
-import { defineObject, FieldType } from '@/sdk';
+import { defineObject, FieldType } from 'twenty-sdk';
const DUPLICATE_ID = 'duplicate-id-0000-0000-000000000001';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/src/second.object.ts b/packages/twenty-apps/fixtures/invalid-app/src/second.object.ts
similarity index 91%
rename from packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/src/second.object.ts
rename to packages/twenty-apps/fixtures/invalid-app/src/second.object.ts
index 2e77292758c..61f0dd3a2ae 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/src/second.object.ts
+++ b/packages/twenty-apps/fixtures/invalid-app/src/second.object.ts
@@ -1,4 +1,4 @@
-import { defineObject, FieldType } from '@/sdk';
+import { defineObject, FieldType } from 'twenty-sdk';
const DUPLICATE_ID = 'duplicate-id-0000-0000-000000000001';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/tsconfig.json b/packages/twenty-apps/fixtures/invalid-app/tsconfig.json
similarity index 89%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/tsconfig.json
rename to packages/twenty-apps/fixtures/invalid-app/tsconfig.json
index 37e7e2155a7..97050faf758 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/tsconfig.json
+++ b/packages/twenty-apps/fixtures/invalid-app/tsconfig.json
@@ -9,7 +9,7 @@
"jsx": "react-jsx",
"baseUrl": ".",
"paths": {
- "@/*": ["../../../../../src/*"]
+ "src/*": ["./src/*"]
}
},
"include": ["**/*"],
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/yarn.lock b/packages/twenty-apps/fixtures/invalid-app/yarn.lock
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/yarn.lock
rename to packages/twenty-apps/fixtures/invalid-app/yarn.lock
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/application.config.ts b/packages/twenty-apps/fixtures/minimal-app/application.config.ts
similarity index 85%
rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/application.config.ts
rename to packages/twenty-apps/fixtures/minimal-app/application.config.ts
index cede064231c..5647809e322 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/application.config.ts
+++ b/packages/twenty-apps/fixtures/minimal-app/application.config.ts
@@ -1,4 +1,4 @@
-import { defineApplication } from '@/sdk';
+import { defineApplication } from 'twenty-sdk';
export default defineApplication({
universalIdentifier: 'e1e2e3e4-e5e6-4000-8000-000000000001',
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.front-component.tsx b/packages/twenty-apps/fixtures/minimal-app/my.front-component.tsx
similarity index 86%
rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.front-component.tsx
rename to packages/twenty-apps/fixtures/minimal-app/my.front-component.tsx
index 6806684e8b4..6906a7b13f8 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.front-component.tsx
+++ b/packages/twenty-apps/fixtures/minimal-app/my.front-component.tsx
@@ -1,4 +1,4 @@
-import { defineFrontComponent } from '@/sdk';
+import { defineFrontComponent } from 'twenty-sdk';
export const MyComponent = () => {
return (
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.function.ts b/packages/twenty-apps/fixtures/minimal-app/my.function.ts
similarity index 87%
rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.function.ts
rename to packages/twenty-apps/fixtures/minimal-app/my.function.ts
index 824c1eac33f..62507949304 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.function.ts
+++ b/packages/twenty-apps/fixtures/minimal-app/my.function.ts
@@ -1,4 +1,4 @@
-import { defineLogicFunction } from '@/sdk';
+import { defineLogicFunction } from 'twenty-sdk';
const myHandler = () => {
return 'my-function-result';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.object.ts b/packages/twenty-apps/fixtures/minimal-app/my.object.ts
similarity index 90%
rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.object.ts
rename to packages/twenty-apps/fixtures/minimal-app/my.object.ts
index 8adbc4719ce..74eba6cdad9 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.object.ts
+++ b/packages/twenty-apps/fixtures/minimal-app/my.object.ts
@@ -1,4 +1,4 @@
-import { FieldType, defineObject } from '@/sdk';
+import { FieldType, defineObject } from 'twenty-sdk';
export default defineObject({
universalIdentifier: 'e1e2e3e4-e5e6-4000-8000-000000000030',
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.role.ts b/packages/twenty-apps/fixtures/minimal-app/my.role.ts
similarity index 91%
rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.role.ts
rename to packages/twenty-apps/fixtures/minimal-app/my.role.ts
index 2a7634e3b58..935a5b12cf1 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.role.ts
+++ b/packages/twenty-apps/fixtures/minimal-app/my.role.ts
@@ -1,4 +1,4 @@
-import { defineRole } from '@/sdk';
+import { defineRole } from 'twenty-sdk';
export default defineRole({
universalIdentifier: 'e1e2e3e4-e5e6-4000-8000-000000000040',
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/package.json b/packages/twenty-apps/fixtures/minimal-app/package.json
similarity index 97%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/package.json
rename to packages/twenty-apps/fixtures/minimal-app/package.json
index f296649e523..d03347ef85d 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/package.json
+++ b/packages/twenty-apps/fixtures/minimal-app/package.json
@@ -1,5 +1,5 @@
{
- "name": "rich-app",
+ "name": "minimal-app",
"version": "0.1.0",
"license": "MIT",
"engines": {
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/tsconfig.json b/packages/twenty-apps/fixtures/minimal-app/tsconfig.json
similarity index 72%
rename from packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/tsconfig.json
rename to packages/twenty-apps/fixtures/minimal-app/tsconfig.json
index b6520539e57..97050faf758 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/tsconfig.json
+++ b/packages/twenty-apps/fixtures/minimal-app/tsconfig.json
@@ -9,8 +9,9 @@
"jsx": "react-jsx",
"baseUrl": ".",
"paths": {
- "@/*": ["../../../../../src/*"]
+ "src/*": ["./src/*"]
}
},
- "include": ["**/*"]
+ "include": ["**/*"],
+ "exclude": ["node_modules", "dist", ".twenty"]
}
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/yarn.lock b/packages/twenty-apps/fixtures/minimal-app/yarn.lock
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/yarn.lock
rename to packages/twenty-apps/fixtures/minimal-app/yarn.lock
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/.gitignore b/packages/twenty-apps/fixtures/postcard-app/.gitignore
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/.gitignore
rename to packages/twenty-apps/fixtures/postcard-app/.gitignore
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/application.config.ts b/packages/twenty-apps/fixtures/postcard-app/application.config.ts
similarity index 94%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/application.config.ts
rename to packages/twenty-apps/fixtures/postcard-app/application.config.ts
index 4fba0dfdef2..03f615d2f47 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/application.config.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/application.config.ts
@@ -1,4 +1,4 @@
-import { defineApplication } from '@/sdk';
+import { defineApplication } from 'twenty-sdk';
import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from './src/roles/default-function.role';
export default defineApplication({
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/package.json b/packages/twenty-apps/fixtures/postcard-app/package.json
similarity index 97%
rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/package.json
rename to packages/twenty-apps/fixtures/postcard-app/package.json
index bc5f9c2339f..f441dc81dfb 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/package.json
+++ b/packages/twenty-apps/fixtures/postcard-app/package.json
@@ -1,5 +1,5 @@
{
- "name": "root-app",
+ "name": "postcard-app",
"version": "0.1.0",
"license": "MIT",
"engines": {
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/public/favicon.png b/packages/twenty-apps/fixtures/postcard-app/public/favicon.png
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/public/favicon.png
rename to packages/twenty-apps/fixtures/postcard-app/public/favicon.png
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/card.front-component.tsx b/packages/twenty-apps/fixtures/postcard-app/src/components/card.front-component.tsx
similarity index 84%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/card.front-component.tsx
rename to packages/twenty-apps/fixtures/postcard-app/src/components/card.front-component.tsx
index 6e3d8df8668..9b4ba078d9a 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/card.front-component.tsx
+++ b/packages/twenty-apps/fixtures/postcard-app/src/components/card.front-component.tsx
@@ -1,4 +1,4 @@
-import { defineFrontComponent } from '@/sdk';
+import { defineFrontComponent } from 'twenty-sdk';
import { CardDisplay } from '../utils/card-display.component';
export default defineFrontComponent({
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/greeting.front-component.tsx b/packages/twenty-apps/fixtures/postcard-app/src/components/greeting.front-component.tsx
similarity index 90%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/greeting.front-component.tsx
rename to packages/twenty-apps/fixtures/postcard-app/src/components/greeting.front-component.tsx
index 641485f9601..28632d82c0e 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/greeting.front-component.tsx
+++ b/packages/twenty-apps/fixtures/postcard-app/src/components/greeting.front-component.tsx
@@ -1,4 +1,4 @@
-import { defineFrontComponent } from '@/sdk';
+import { defineFrontComponent } from 'twenty-sdk';
import { DEFAULT_NAME, formatGreeting } from '../utils/greeting.util';
const GreetingComponent = () => {
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/test.front-component.tsx b/packages/twenty-apps/fixtures/postcard-app/src/components/test.front-component.tsx
similarity index 86%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/test.front-component.tsx
rename to packages/twenty-apps/fixtures/postcard-app/src/components/test.front-component.tsx
index 5bef8ed3817..6acb4eebf78 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/test.front-component.tsx
+++ b/packages/twenty-apps/fixtures/postcard-app/src/components/test.front-component.tsx
@@ -1,4 +1,4 @@
-import { defineFrontComponent } from '@/sdk';
+import { defineFrontComponent } from 'twenty-sdk';
export const TestComponent = () => {
return (
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-on-post-card-recipient.field.ts b/packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-on-post-card-recipient.field.ts
similarity index 67%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-on-post-card-recipient.field.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-on-post-card-recipient.field.ts
index 1898ba206da..c8d24dbad3b 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-on-post-card-recipient.field.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-on-post-card-recipient.field.ts
@@ -1,10 +1,10 @@
import {
POST_CARD_ON_POST_CARD_RECIPIENT_ID,
POST_CARD_RECIPIENTS_ON_POST_CARD_ID,
-} from '@/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-post-card.field';
-import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object';
-import { defineField, FieldType, OnDeleteAction, RelationType } from '@/sdk';
-import { POST_CARD_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object';
+} from './post-card-recipients-on-post-card.field';
+import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '../objects/post-card-recipient.object';
+import { defineField, FieldType, OnDeleteAction, RelationType } from 'twenty-sdk';
+import { POST_CARD_UNIVERSAL_IDENTIFIER } from '../objects/post-card.object';
export default defineField({
universalIdentifier: POST_CARD_ON_POST_CARD_RECIPIENT_ID,
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-post-card.field.ts b/packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-recipients-on-post-card.field.ts
similarity index 69%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-post-card.field.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-recipients-on-post-card.field.ts
index ae35ad1e4f8..fd4f8ab2fbc 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-post-card.field.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-recipients-on-post-card.field.ts
@@ -1,6 +1,6 @@
-import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object';
-import { defineField, FieldType, RelationType } from '@/sdk';
-import { POST_CARD_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object';
+import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '../objects/post-card-recipient.object';
+import { defineField, FieldType, RelationType } from 'twenty-sdk';
+import { POST_CARD_UNIVERSAL_IDENTIFIER } from '../objects/post-card.object';
export const POST_CARD_RECIPIENTS_ON_POST_CARD_ID =
'a1a2b3c4-0001-4a7b-8c9d-0e1f2a3b4c5d';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-recipient.field.ts b/packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-recipients-on-recipient.field.ts
similarity index 69%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-recipient.field.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-recipients-on-recipient.field.ts
index c7bbe21a54f..1c447ece0f1 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-recipient.field.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-recipients-on-recipient.field.ts
@@ -1,6 +1,6 @@
-import { defineField, FieldType, RelationType } from '@/sdk';
-import { RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/recipient.object';
-import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object';
+import { defineField, FieldType, RelationType } from 'twenty-sdk';
+import { RECIPIENT_UNIVERSAL_IDENTIFIER } from '../objects/recipient.object';
+import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '../objects/post-card-recipient.object';
export const POST_CARD_RECIPIENTS_ON_RECIPIENT_ID =
'a1a2b3c4-0003-4a7b-8c9d-0e1f2a3b4c5d';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardCategoryField.ts b/packages/twenty-apps/fixtures/postcard-app/src/fields/postCardCategoryField.ts
similarity index 82%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardCategoryField.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/fields/postCardCategoryField.ts
index 2d02b2955c8..6a21a9efdf9 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardCategoryField.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/fields/postCardCategoryField.ts
@@ -1,5 +1,5 @@
-import { defineField, FieldType } from '@/sdk';
-import { POST_CARD_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object';
+import { defineField, FieldType } from 'twenty-sdk';
+import { POST_CARD_UNIVERSAL_IDENTIFIER } from '../objects/post-card.object';
export default defineField({
objectUniversalIdentifier: POST_CARD_UNIVERSAL_IDENTIFIER,
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardNumber.field.ts b/packages/twenty-apps/fixtures/postcard-app/src/fields/postCardNumber.field.ts
similarity index 64%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardNumber.field.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/fields/postCardNumber.field.ts
index 0aa42d9884f..94d924865aa 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardNumber.field.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/fields/postCardNumber.field.ts
@@ -1,5 +1,5 @@
-import { defineField, FieldType } from '@/sdk';
-import { POST_CARD_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object';
+import { defineField, FieldType } from 'twenty-sdk';
+import { POST_CARD_UNIVERSAL_IDENTIFIER } from '../objects/post-card.object';
export default defineField({
objectUniversalIdentifier: POST_CARD_UNIVERSAL_IDENTIFIER,
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/recipient-on-post-card-recipient.field.ts b/packages/twenty-apps/fixtures/postcard-app/src/fields/recipient-on-post-card-recipient.field.ts
similarity index 67%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/recipient-on-post-card-recipient.field.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/fields/recipient-on-post-card-recipient.field.ts
index 04295115ebd..fc5bab92b91 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/recipient-on-post-card-recipient.field.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/fields/recipient-on-post-card-recipient.field.ts
@@ -1,10 +1,10 @@
-import { defineField, FieldType, RelationType, OnDeleteAction } from '@/sdk';
-import { RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/recipient.object';
-import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object';
+import { defineField, FieldType, RelationType, OnDeleteAction } from 'twenty-sdk';
+import { RECIPIENT_UNIVERSAL_IDENTIFIER } from '../objects/recipient.object';
+import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '../objects/post-card-recipient.object';
import {
POST_CARD_RECIPIENTS_ON_RECIPIENT_ID,
RECIPIENT_ON_POST_CARD_RECIPIENT_ID,
-} from '@/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-recipient.field';
+} from './post-card-recipients-on-recipient.field';
export default defineField({
universalIdentifier: RECIPIENT_ON_POST_CARD_RECIPIENT_ID,
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/greeting.function.ts b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/greeting.function.ts
similarity index 89%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/greeting.function.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/logic-functions/greeting.function.ts
index a02f5193b32..6b55f8356b5 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/greeting.function.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/greeting.function.ts
@@ -1,4 +1,4 @@
-import { defineLogicFunction } from '@/sdk';
+import { defineLogicFunction } from 'twenty-sdk';
import { DEFAULT_NAME, formatGreeting } from '../utils/greeting.util';
const greetingHandler = () => {
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/lookup-recipient.function.ts b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/lookup-recipient.function.ts
similarity index 88%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/lookup-recipient.function.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/logic-functions/lookup-recipient.function.ts
index 859cb00b42c..997ffd0b53f 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/lookup-recipient.function.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/lookup-recipient.function.ts
@@ -1,4 +1,4 @@
-import { defineLogicFunction } from '@/sdk';
+import { defineLogicFunction } from 'twenty-sdk';
const handler = async (params: { recipientName: string }) => {
return { found: true, name: params.recipientName };
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/on-post-card-created.function.ts b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/on-post-card-created.function.ts
similarity index 88%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/on-post-card-created.function.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/logic-functions/on-post-card-created.function.ts
index 09a8bdb02f4..b30c24f9d09 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/on-post-card-created.function.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/on-post-card-created.function.ts
@@ -1,4 +1,4 @@
-import { defineLogicFunction } from '@/sdk';
+import { defineLogicFunction } from 'twenty-sdk';
const handler = async () => {
return { processed: true };
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/test-function-2.function.ts b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/test-function-2.function.ts
similarity index 85%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/test-function-2.function.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/logic-functions/test-function-2.function.ts
index f3746c9590c..dd80779a6a7 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/test-function-2.function.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/test-function-2.function.ts
@@ -1,4 +1,4 @@
-import { defineLogicFunction } from '@/sdk';
+import { defineLogicFunction } from 'twenty-sdk';
import { testFunction2 } from '../utils/test-function-2.util';
export default defineLogicFunction({
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/test-function.function.ts b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/test-function.function.ts
similarity index 89%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/test-function.function.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/logic-functions/test-function.function.ts
index 11db08e00f7..110ccb351eb 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/test-function.function.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/test-function.function.ts
@@ -1,4 +1,4 @@
-import { defineLogicFunction } from '@/sdk';
+import { defineLogicFunction } from 'twenty-sdk';
import { formatFarewell } from '../utils/greeting.util';
const handler = () => {
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts b/packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts
similarity index 51%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts
index 5735595cdb0..34e1124a9c7 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts
@@ -1,5 +1,5 @@
-import { defineNavigationMenuItem } from '@/sdk';
-import { ALL_POST_CARD_RECIPIENTS_VIEW_ID } from '@/cli/__tests__/apps/rich-app/src/views/all-post-card-recipients.view';
+import { defineNavigationMenuItem } from 'twenty-sdk';
+import { ALL_POST_CARD_RECIPIENTS_VIEW_ID } from '../views/all-post-card-recipients.view';
export default defineNavigationMenuItem({
universalIdentifier: 'c1a2b3c4-0003-4a7b-8c9d-0e1f2a3b4c5d',
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-cards.navigation-menu-item.ts b/packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/post-cards.navigation-menu-item.ts
similarity index 53%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-cards.navigation-menu-item.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/post-cards.navigation-menu-item.ts
index d10c4ac1f98..a4d4f6c181f 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-cards.navigation-menu-item.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/post-cards.navigation-menu-item.ts
@@ -1,5 +1,5 @@
-import { defineNavigationMenuItem } from '@/sdk';
-import { ALL_POST_CARDS_VIEW_ID } from '@/cli/__tests__/apps/rich-app/src/views/all-post-cards.view';
+import { defineNavigationMenuItem } from 'twenty-sdk';
+import { ALL_POST_CARDS_VIEW_ID } from '../views/all-post-cards.view';
export default defineNavigationMenuItem({
universalIdentifier: 'c1a2b3c4-0001-4a7b-8c9d-0e1f2a3b4c5d',
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/recipients.navigation-menu-item.ts b/packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/recipients.navigation-menu-item.ts
similarity index 53%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/recipients.navigation-menu-item.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/recipients.navigation-menu-item.ts
index 290311fe6bb..c0b1b9a3972 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/recipients.navigation-menu-item.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/recipients.navigation-menu-item.ts
@@ -1,5 +1,5 @@
-import { defineNavigationMenuItem } from '@/sdk';
-import { ALL_RECIPIENTS_VIEW_ID } from '@/cli/__tests__/apps/rich-app/src/views/all-recipients.view';
+import { defineNavigationMenuItem } from 'twenty-sdk';
+import { ALL_RECIPIENTS_VIEW_ID } from '../views/all-recipients.view';
export default defineNavigationMenuItem({
universalIdentifier: 'c1a2b3c4-0002-4a7b-8c9d-0e1f2a3b4c5d',
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object.ts b/packages/twenty-apps/fixtures/postcard-app/src/objects/post-card-recipient.object.ts
similarity index 93%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/objects/post-card-recipient.object.ts
index 62deafc4aeb..128de418476 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/objects/post-card-recipient.object.ts
@@ -1,4 +1,4 @@
-import { defineObject, FieldType } from '@/sdk';
+import { defineObject, FieldType } from 'twenty-sdk';
export const POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER =
'e1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5e';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card.object.ts b/packages/twenty-apps/fixtures/postcard-app/src/objects/post-card.object.ts
similarity index 97%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card.object.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/objects/post-card.object.ts
index 8bd7a6790a5..d779ae29c8e 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card.object.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/objects/post-card.object.ts
@@ -1,4 +1,4 @@
-import { defineObject, FieldType } from '@/sdk';
+import { defineObject, FieldType } from 'twenty-sdk';
enum PostCardStatus {
DRAFT = 'DRAFT',
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/recipient.object.ts b/packages/twenty-apps/fixtures/postcard-app/src/objects/recipient.object.ts
similarity index 94%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/recipient.object.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/objects/recipient.object.ts
index e6abb7ff9c7..e636f782a0f 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/recipient.object.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/objects/recipient.object.ts
@@ -1,4 +1,4 @@
-import { defineObject, FieldType } from '@/sdk';
+import { defineObject, FieldType } from 'twenty-sdk';
export const RECIPIENT_UNIVERSAL_IDENTIFIER =
'd1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5d';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/roles/default-function.role.ts b/packages/twenty-apps/fixtures/postcard-app/src/roles/default-function.role.ts
similarity index 90%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/roles/default-function.role.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/roles/default-function.role.ts
index 4852725a843..dc68a1db492 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/roles/default-function.role.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/roles/default-function.role.ts
@@ -1,8 +1,8 @@
-import { PermissionFlag, defineRole } from '@/sdk';
+import { PermissionFlag, defineRole } from 'twenty-sdk';
import {
CONTENT_FIELD_UNIVERSAL_IDENTIFIER,
POST_CARD_UNIVERSAL_IDENTIFIER,
-} from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object';
+} from '../objects/post-card.object';
export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =
'b648f87b-1d26-4961-b974-0908fd991061';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.front-component.tsx b/packages/twenty-apps/fixtures/postcard-app/src/root.front-component.tsx
similarity index 87%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.front-component.tsx
rename to packages/twenty-apps/fixtures/postcard-app/src/root.front-component.tsx
index da55710ec0f..3f2c6548895 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.front-component.tsx
+++ b/packages/twenty-apps/fixtures/postcard-app/src/root.front-component.tsx
@@ -1,4 +1,4 @@
-import { defineFrontComponent } from '@/sdk';
+import { defineFrontComponent } from 'twenty-sdk';
export const RootComponent = () => {
return (
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.function.ts b/packages/twenty-apps/fixtures/postcard-app/src/root.function.ts
similarity index 87%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.function.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/root.function.ts
index 340fbe10b88..44b8a8dc831 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.function.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/root.function.ts
@@ -1,4 +1,4 @@
-import { defineLogicFunction } from '@/sdk';
+import { defineLogicFunction } from 'twenty-sdk';
const rootHandler = () => {
return 'root-function-result';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.object.ts b/packages/twenty-apps/fixtures/postcard-app/src/root.object.ts
similarity index 92%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.object.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/root.object.ts
index 5382ead3fac..a93d823a2bb 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.object.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/root.object.ts
@@ -1,4 +1,4 @@
-import { defineObject, FieldType } from '@/sdk';
+import { defineObject, FieldType } from 'twenty-sdk';
export default defineObject({
universalIdentifier: 'b0b1b2b3-b4b5-4000-8000-000000000001',
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.role.ts b/packages/twenty-apps/fixtures/postcard-app/src/root.role.ts
similarity index 91%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.role.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/root.role.ts
index 70a83fe0c4c..9864a73ef38 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.role.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/root.role.ts
@@ -1,4 +1,4 @@
-import { defineRole } from '@/sdk';
+import { defineRole } from 'twenty-sdk';
export default defineRole({
universalIdentifier: 'c0c1c2c3-c4c5-4000-8000-000000000001',
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/utils/card-display.component.tsx b/packages/twenty-apps/fixtures/postcard-app/src/utils/card-display.component.tsx
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/utils/card-display.component.tsx
rename to packages/twenty-apps/fixtures/postcard-app/src/utils/card-display.component.tsx
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/utils/greeting.util.ts b/packages/twenty-apps/fixtures/postcard-app/src/utils/greeting.util.ts
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/utils/greeting.util.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/utils/greeting.util.ts
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/utils/test-function-2.util.ts b/packages/twenty-apps/fixtures/postcard-app/src/utils/test-function-2.util.ts
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/utils/test-function-2.util.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/utils/test-function-2.util.ts
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-card-recipients.view.ts b/packages/twenty-apps/fixtures/postcard-app/src/views/all-post-card-recipients.view.ts
similarity index 86%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-card-recipients.view.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/views/all-post-card-recipients.view.ts
index 8dac15d3a56..944789b9fba 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-card-recipients.view.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/views/all-post-card-recipients.view.ts
@@ -1,8 +1,8 @@
import {
POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER,
SENT_AT_FIELD_UNIVERSAL_IDENTIFIER,
-} from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object';
-import { defineView } from '@/sdk';
+} from '../objects/post-card-recipient.object';
+import { defineView } from 'twenty-sdk';
import { ViewType } from 'twenty-shared/types';
export const ALL_POST_CARD_RECIPIENTS_VIEW_ID =
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-cards.view.ts b/packages/twenty-apps/fixtures/postcard-app/src/views/all-post-cards.view.ts
similarity index 89%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-cards.view.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/views/all-post-cards.view.ts
index 21e1288df6d..1f2520c1137 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-cards.view.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/views/all-post-cards.view.ts
@@ -1,8 +1,8 @@
-import { defineView } from '@/sdk';
+import { defineView } from 'twenty-sdk';
import {
CONTENT_FIELD_UNIVERSAL_IDENTIFIER,
POST_CARD_UNIVERSAL_IDENTIFIER,
-} from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object';
+} from '../objects/post-card.object';
import { ViewType } from 'twenty-shared/types';
export const ALL_POST_CARDS_VIEW_ID = 'b1a2b3c4-0001-4a7b-8c9d-0e1f2a3b4c5d';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-recipients.view.ts b/packages/twenty-apps/fixtures/postcard-app/src/views/all-recipients.view.ts
similarity index 86%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-recipients.view.ts
rename to packages/twenty-apps/fixtures/postcard-app/src/views/all-recipients.view.ts
index 7fd86807c24..1d8a7f88166 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-recipients.view.ts
+++ b/packages/twenty-apps/fixtures/postcard-app/src/views/all-recipients.view.ts
@@ -1,8 +1,8 @@
import {
RECIPIENT_EMAIL_FIELD_UNIVERSAL_IDENTIFIER,
RECIPIENT_UNIVERSAL_IDENTIFIER,
-} from '@/cli/__tests__/apps/rich-app/src/objects/recipient.object';
-import { defineView } from '@/sdk';
+} from '../objects/recipient.object';
+import { defineView } from 'twenty-sdk';
import { ViewType } from 'twenty-shared/types';
export const ALL_RECIPIENTS_VIEW_ID = 'b1a2b3c4-0002-4a7b-8c9d-0e1f2a3b4c5d';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/tsconfig.json b/packages/twenty-apps/fixtures/postcard-app/tsconfig.json
similarity index 72%
rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/tsconfig.json
rename to packages/twenty-apps/fixtures/postcard-app/tsconfig.json
index b6520539e57..97050faf758 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/tsconfig.json
+++ b/packages/twenty-apps/fixtures/postcard-app/tsconfig.json
@@ -9,8 +9,9 @@
"jsx": "react-jsx",
"baseUrl": ".",
"paths": {
- "@/*": ["../../../../../src/*"]
+ "src/*": ["./src/*"]
}
},
- "include": ["**/*"]
+ "include": ["**/*"],
+ "exclude": ["node_modules", "dist", ".twenty"]
}
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/yarn.lock b/packages/twenty-apps/fixtures/postcard-app/yarn.lock
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/yarn.lock
rename to packages/twenty-apps/fixtures/postcard-app/yarn.lock
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/fixture-paths.ts b/packages/twenty-sdk/src/cli/__tests__/apps/fixture-paths.ts
new file mode 100644
index 00000000000..677edd575bd
--- /dev/null
+++ b/packages/twenty-sdk/src/cli/__tests__/apps/fixture-paths.ts
@@ -0,0 +1,11 @@
+import { resolve } from 'path';
+
+const FIXTURES_ROOT = resolve(__dirname, '../../../../../twenty-apps/fixtures');
+
+export const POSTCARD_APP_PATH = resolve(FIXTURES_ROOT, 'postcard-app');
+export const MINIMAL_APP_PATH = resolve(FIXTURES_ROOT, 'minimal-app');
+export const INVALID_APP_PATH = resolve(FIXTURES_ROOT, 'invalid-app');
+export const FUNCTION_EXECUTE_APP_PATH = resolve(
+ FIXTURES_ROOT,
+ 'function-execute-app',
+);
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/__e2e__/function-execute.e2e-spec.ts b/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/__e2e__/function-execute.e2e-spec.ts
index 7b1d8e90ba1..b9b4bef5e3d 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/__e2e__/function-execute.e2e-spec.ts
+++ b/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/__e2e__/function-execute.e2e-spec.ts
@@ -1,12 +1,13 @@
-import { resolve } from 'path';
import { vi } from 'vitest';
import { appBuild } from '@/cli/public-operations/app-build';
import { appUninstall } from '@/cli/public-operations/app-uninstall';
import { functionExecute } from '@/cli/public-operations/function-execute';
-import { ADD_NUMBERS_UNIVERSAL_IDENTIFIER } from '../src/logic-functions/add-numbers.function';
+import { FUNCTION_EXECUTE_APP_PATH } from '@/cli/__tests__/apps/fixture-paths';
-const APP_PATH = resolve(__dirname, '../');
+const ADD_NUMBERS_UNIVERSAL_IDENTIFIER = 'f9e5589c-e951-4d99-85db-0a305ab53502';
+
+const APP_PATH = FUNCTION_EXECUTE_APP_PATH;
describe('functionExecute E2E', () => {
beforeAll(async () => {
@@ -18,8 +19,6 @@ describe('functionExecute E2E', () => {
);
}
- // The server may need a moment to make uploaded files readable
- // by the execution engine. Retry until the handler becomes available.
await vi.waitFor(
async () => {
const result = await functionExecute({
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/__integration__/manifest.integration.spec.ts b/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/__integration__/manifest.integration.spec.ts
index 18ab3e7f50a..96b5e0c2ee8 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/__integration__/manifest.integration.spec.ts
+++ b/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/__integration__/manifest.integration.spec.ts
@@ -3,14 +3,18 @@ import { OUTPUT_DIR } from 'twenty-shared/application';
import { runAppDevInProcess } from '@/cli/__tests__/integration/utils/run-app-dev-in-process.util';
import { pathExists } from '@/cli/utilities/file/fs-utils';
+import { INVALID_APP_PATH } from '@/cli/__tests__/apps/fixture-paths';
-const APP_PATH = join(__dirname, '..');
-const MANIFEST_OUTPUT_PATH = join(APP_PATH, OUTPUT_DIR, 'manifest.json');
+const MANIFEST_OUTPUT_PATH = join(
+ INVALID_APP_PATH,
+ OUTPUT_DIR,
+ 'manifest.json',
+);
describe('invalid-app manifest', () => {
it('should fail to build manifest due to duplicate universalIdentifier', async () => {
const result = await runAppDevInProcess({
- appPath: APP_PATH,
+ appPath: INVALID_APP_PATH,
timeout: 10000,
});
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/app-dev.integration.spec.ts b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/app-dev.integration.spec.ts
similarity index 66%
rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/app-dev.integration.spec.ts
rename to packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/app-dev.integration.spec.ts
index 310e029b347..33ef13e9a4f 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/app-dev.integration.spec.ts
+++ b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/app-dev.integration.spec.ts
@@ -1,15 +1,13 @@
-import { join } from 'path';
-
import { runAppDevInProcess } from '@/cli/__tests__/integration/utils/run-app-dev-in-process.util';
+import { MINIMAL_APP_PATH } from '@/cli/__tests__/apps/fixture-paths';
+
import { defineFrontComponentsTests } from './tests/front-components.tests';
import { defineLogicFunctionsTests } from './tests/logic-functions.tests';
import { defineManifestTests } from './tests/manifest.tests';
-const APP_PATH = join(__dirname, '../..');
-
-describe('root-app app:dev', () => {
+describe('minimal-app app:dev', () => {
beforeAll(async () => {
- const result = await runAppDevInProcess({ appPath: APP_PATH });
+ const result = await runAppDevInProcess({ appPath: MINIMAL_APP_PATH });
if (!result.success) {
const diagnostics = JSON.stringify(
@@ -24,7 +22,7 @@ describe('root-app app:dev', () => {
}
}, 60000);
- defineManifestTests(APP_PATH);
- defineLogicFunctionsTests(APP_PATH);
- defineFrontComponentsTests(APP_PATH);
+ defineManifestTests(MINIMAL_APP_PATH);
+ defineLogicFunctionsTests(MINIMAL_APP_PATH);
+ defineFrontComponentsTests(MINIMAL_APP_PATH);
});
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/expected-manifest.ts b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/expected-manifest.ts
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/expected-manifest.ts
rename to packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/expected-manifest.ts
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/console-output.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/console-output.tests.ts
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/console-output.tests.ts
rename to packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/console-output.tests.ts
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/front-components.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/front-components.tests.ts
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/front-components.tests.ts
rename to packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/front-components.tests.ts
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/logic-functions.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/logic-functions.tests.ts
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/logic-functions.tests.ts
rename to packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/logic-functions.tests.ts
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/manifest.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/manifest.tests.ts
similarity index 89%
rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/manifest.tests.ts
rename to packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/manifest.tests.ts
index bc86510a416..c7075b5ffb3 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/manifest.tests.ts
+++ b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/manifest.tests.ts
@@ -1,7 +1,7 @@
import { join } from 'path';
import { type Manifest } from 'twenty-shared/application';
-import { EXPECTED_MANIFEST } from '@/cli/__tests__/apps/root-app/__integration__/app-dev/expected-manifest';
+import { EXPECTED_MANIFEST } from '@/cli/__tests__/apps/minimal-app/__integration__/app-dev/expected-manifest';
import { normalizeManifestForComparison } from '@/cli/__tests__/integration/utils/normalize-manifest.util';
import { pathExists, readJson } from '@/cli/utilities/file/fs-utils';
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__e2e__/applications-install-delete-reinstall.e2e-spec.ts b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__e2e__/applications-install-delete-reinstall.e2e-spec.ts
similarity index 84%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__e2e__/applications-install-delete-reinstall.e2e-spec.ts
rename to packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__e2e__/applications-install-delete-reinstall.e2e-spec.ts
index 69926ef5fa3..7bfb84568f6 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__e2e__/applications-install-delete-reinstall.e2e-spec.ts
+++ b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__e2e__/applications-install-delete-reinstall.e2e-spec.ts
@@ -1,14 +1,15 @@
import { OUTPUT_DIR } from 'twenty-shared/application';
import { existsSync } from 'fs';
-import { join, resolve } from 'path';
+import { join } from 'path';
import { inspect } from 'util';
import { runCliCommand } from '@/cli/__tests__/integration/utils/run-cli-command.util';
+import { POSTCARD_APP_PATH } from '@/cli/__tests__/apps/fixture-paths';
inspect.defaultOptions.depth = 10;
-describe('Application: install delete and reinstall rich-app', () => {
- const applicationName = 'rich-app';
- const appPath = resolve(__dirname, '../');
+describe('Application: install delete and reinstall postcard-app', () => {
+ const applicationName = 'postcard-app';
+ const appPath = POSTCARD_APP_PATH;
beforeAll(async () => {
expect(existsSync(appPath)).toBe(true);
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__e2e__/health.e2e-spec.ts b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__e2e__/health.e2e-spec.ts
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__e2e__/health.e2e-spec.ts
rename to packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__e2e__/health.e2e-spec.ts
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/app-dev.integration.spec.ts b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/app-dev.integration.spec.ts
similarity index 67%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/app-dev.integration.spec.ts
rename to packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/app-dev.integration.spec.ts
index 58e986655fd..b8c3835f4dc 100644
--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/app-dev.integration.spec.ts
+++ b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/app-dev.integration.spec.ts
@@ -1,14 +1,12 @@
import { runAppDevInProcess } from '@/cli/__tests__/integration/utils/run-app-dev-in-process.util';
-import { join } from 'path';
+import { POSTCARD_APP_PATH } from '@/cli/__tests__/apps/fixture-paths';
import { defineEntitiesTests } from './tests/entities.tests';
import { defineManifestTests } from './tests/manifest.tests';
-const APP_PATH = join(__dirname, '../..');
-
-describe('rich-app app:dev', () => {
+describe('postcard-app app:dev', () => {
beforeAll(async () => {
- const result = await runAppDevInProcess({ appPath: APP_PATH });
+ const result = await runAppDevInProcess({ appPath: POSTCARD_APP_PATH });
if (!result.success) {
const diagnostics = JSON.stringify(
@@ -23,6 +21,6 @@ describe('rich-app app:dev', () => {
}
}, 60000);
- defineManifestTests(APP_PATH);
- defineEntitiesTests(APP_PATH);
+ defineManifestTests(POSTCARD_APP_PATH);
+ defineEntitiesTests(POSTCARD_APP_PATH);
});
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/expected-manifest.ts b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/expected-manifest.ts
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/expected-manifest.ts
rename to packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/expected-manifest.ts
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/console-output.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/tests/console-output.tests.ts
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/console-output.tests.ts
rename to packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/tests/console-output.tests.ts
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/entities.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/tests/entities.tests.ts
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/entities.tests.ts
rename to packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/tests/entities.tests.ts
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/manifest.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/tests/manifest.tests.ts
similarity index 100%
rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/manifest.tests.ts
rename to packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/tests/manifest.tests.ts
diff --git a/packages/twenty-sdk/src/cli/commands/app/app-build.ts b/packages/twenty-sdk/src/cli/commands/app/app-build.ts
index 5dd3b98b15a..a874a8631ca 100644
--- a/packages/twenty-sdk/src/cli/commands/app/app-build.ts
+++ b/packages/twenty-sdk/src/cli/commands/app/app-build.ts
@@ -1,5 +1,6 @@
import { appBuild } from '@/cli/public-operations/app-build';
import { CURRENT_EXECUTION_DIRECTORY } from '@/cli/utilities/config/current-execution-directory';
+import { checkSdkVersionCompatibility } from '@/cli/utilities/version/check-sdk-version-compatibility';
import chalk from 'chalk';
export type AppBuildCommandOptions = {
@@ -11,6 +12,8 @@ export class AppBuildCommand {
async execute(options: AppBuildCommandOptions): Promise<void> {
const appPath = options.appPath ?? CURRENT_EXECUTION_DIRECTORY;
+ await checkSdkVersionCompatibility(appPath);
+
console.log(chalk.blue('Building application...'));
console.log(chalk.gray(`App path: ${appPath}`));
console.log('');
diff --git a/packages/twenty-sdk/src/cli/commands/app/app-dev.ts b/packages/twenty-sdk/src/cli/commands/app/app-dev.ts
index 5072feb60c6..cb2c65c7651 100644
--- a/packages/twenty-sdk/src/cli/commands/app/app-dev.ts
+++ b/packages/twenty-sdk/src/cli/commands/app/app-dev.ts
@@ -1,8 +1,9 @@
import { CURRENT_EXECUTION_DIRECTORY } from '@/cli/utilities/config/current-execution-directory';
-import { renderDevUI } from '@/cli/utilities/dev/ui/components/dev-ui';
-import { DevUiStateManager } from '@/cli/utilities/dev/ui/dev-ui-state-manager';
import { DevModeOrchestrator } from '@/cli/utilities/dev/orchestrator/dev-mode-orchestrator';
import { OrchestratorState } from '@/cli/utilities/dev/orchestrator/dev-mode-orchestrator-state';
+import { renderDevUI } from '@/cli/utilities/dev/ui/components/dev-ui';
+import { DevUiStateManager } from '@/cli/utilities/dev/ui/dev-ui-state-manager';
+import { checkSdkVersionCompatibility } from '@/cli/utilities/version/check-sdk-version-compatibility';
export type AppDevOptions = {
appPath?: string;
@@ -25,6 +26,8 @@ export class AppDevCommand {
async execute(options: AppDevOptions): Promise<void> {
const appPath = options.appPath ?? CURRENT_EXECUTION_DIRECTORY;
+ await checkSdkVersionCompatibility(appPath);
+
const orchestratorState = new OrchestratorState({
appPath,
frontendUrl: process.env.FRONTEND_URL,
diff --git a/packages/twenty-sdk/src/cli/commands/app/app-publish.ts b/packages/twenty-sdk/src/cli/commands/app/app-publish.ts
index 25ed83abb3a..b0943ddc324 100644
--- a/packages/twenty-sdk/src/cli/commands/app/app-publish.ts
+++ b/packages/twenty-sdk/src/cli/commands/app/app-publish.ts
@@ -1,5 +1,6 @@
import { appPublish } from '@/cli/public-operations/app-publish';
import { CURRENT_EXECUTION_DIRECTORY } from '@/cli/utilities/config/current-execution-directory';
+import { checkSdkVersionCompatibility } from '@/cli/utilities/version/check-sdk-version-compatibility';
import chalk from 'chalk';
export type AppPublishCommandOptions = {
@@ -12,6 +13,9 @@ export type AppPublishCommandOptions = {
export class AppPublishCommand {
async execute(options: AppPublishCommandOptions): Promise<void> {
const appPath = options.appPath ?? CURRENT_EXECUTION_DIRECTORY;
+
+ await checkSdkVersionCompatibility(appPath);
+
const isServerPublish = !!options.server;
console.log(
diff --git a/packages/twenty-sdk/src/cli/utilities/version/check-sdk-version-compatibility.ts b/packages/twenty-sdk/src/cli/utilities/version/check-sdk-version-compatibility.ts
new file mode 100644
index 00000000000..420959c1f4e
--- /dev/null
+++ b/packages/twenty-sdk/src/cli/utilities/version/check-sdk-version-compatibility.ts
@@ -0,0 +1,81 @@
+import { readFile } from 'node:fs/promises';
+import { join } from 'path';
+
+import { pathExists } from '@/cli/utilities/file/fs-utils';
+import chalk from 'chalk';
+import sdkPackageJson from '../../../../package.json';
+
+const getAppDeclaredSdkVersion = async (
+ appPath: string,
+): Promise<string | undefined> => {
+ const pkgPath = join(appPath, 'package.json');
+
+ if (!(await pathExists(pkgPath))) {
+ return undefined;
+ }
+
+ try {
+ const content = await readFile(pkgPath, 'utf-8');
+ const pkg = JSON.parse(content) as {
+ dependencies?: Record<string, string>;
+ devDependencies?: Record<string, string>;
+ };
+
+ return (
+ pkg.dependencies?.['twenty-sdk'] ??
+ pkg.devDependencies?.['twenty-sdk'] ??
+ undefined
+ );
+ } catch {
+ return undefined;
+ }
+};
+
+// Extracts the major version number from a semver string or range.
+// Handles: "4.2.0", "^4.2.0", "~4.2.0", ">=4.0.0", "4.x", "4"
+// Returns null for unparseable values like "latest", "*", "workspace:*"
+const parseMajorVersion = (versionOrRange: string): number | null => {
+ const match = versionOrRange.match(/(\d+)\./);
+
+ if (match) {
+ return parseInt(match[1], 10);
+ }
+
+ const exactMatch = versionOrRange.match(/^[~^>=<]*(\d+)$/);
+
+ if (exactMatch) {
+ return parseInt(exactMatch[1], 10);
+ }
+
+ return null;
+};
+
+export const checkSdkVersionCompatibility = async (
+ appPath: string,
+): Promise<void> => {
+ const cliVersion = sdkPackageJson.version;
+ const appDeclaredVersion = await getAppDeclaredSdkVersion(appPath);
+
+ if (!cliVersion || !appDeclaredVersion) {
+ return;
+ }
+
+ const cliMajor = parseMajorVersion(cliVersion);
+ const appMajor = parseMajorVersion(appDeclaredVersion);
+
+ if (cliMajor === null || appMajor === null) {
+ return;
+ }
+
+ if (cliMajor !== appMajor) {
+ console.warn(
+ chalk.yellow(
+ `⚠ Version mismatch: your app requires twenty-sdk@${appMajor}.x ` +
+ `but the CLI running is v${cliVersion}. ` +
+ `Major version mismatches may cause unexpected behavior.\n` +
+ ` Update with: npm install -g twenty-sdk@${appMajor}`,
+ ),
+ );
+ console.warn('');
+ }
+};