The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix(cli): remove legacy CLI config migration (#27085)
Sameer66a8cdcde05e
diff --git a/.github/actions/deploy-twenty-app/action.yml b/.github/actions/deploy-twenty-app/action.ymlindex 81ad23fe336..ba2fc54602c 100644--- a/.github/actions/deploy-twenty-app/action.yml+++ b/.github/actions/deploy-twenty-app/action.yml@@ -40,7 +40,7 @@ runs:const fs = require('fs'), path = require('path'), os = require('os');fs.writeFileSync(path.join(os.homedir(), '.twenty', 'config.json'), JSON.stringify({version: 1,- remotes: { target: { apiUrl: process.env.API_URL, apiKey: process.env.API_KEY, accessToken: process.env.API_KEY } }+ remotes: { target: { apiUrl: process.env.API_URL, apiKey: process.env.API_KEY, twentyCLIAccessToken: process.env.API_KEY } }}, null, 2));"env:diff --git a/.github/actions/install-twenty-app/action.yml b/.github/actions/install-twenty-app/action.ymlindex a7f3479f550..44b284a3e38 100644--- a/.github/actions/install-twenty-app/action.yml+++ b/.github/actions/install-twenty-app/action.yml@@ -40,7 +40,7 @@ runs:const fs = require('fs'), path = require('path'), os = require('os');fs.writeFileSync(path.join(os.homedir(), '.twenty', 'config.json'), JSON.stringify({version: 1,- remotes: { target: { apiUrl: process.env.API_URL, apiKey: process.env.API_KEY, accessToken: process.env.API_KEY } }+ remotes: { target: { apiUrl: process.env.API_URL, apiKey: process.env.API_KEY, twentyCLIAccessToken: process.env.API_KEY } }}, null, 2));"env:diff --git a/.github/workflows/ci-example-app-postcard.yaml b/.github/workflows/ci-example-app-postcard.yamlindex 9c79c9290a5..26f2434e9be 100644--- a/.github/workflows/ci-example-app-postcard.yaml+++ b/.github/workflows/ci-example-app-postcard.yaml@@ -95,7 +95,7 @@ jobs:"target": {"apiUrl": "${TWENTY_API_URL}","apiKey": "${TWENTY_API_KEY}",- "accessToken": "${TWENTY_API_KEY}"+ "twentyCLIAccessToken": "${TWENTY_API_KEY}"}},"defaultRemote": "target"diff --git a/packages/create-twenty-app/src/constants/template/src/__tests__/global-setup.ts b/packages/create-twenty-app/src/constants/template/src/__tests__/global-setup.tsindex e0f8c23b054..c7f4d000cb4 100644--- a/packages/create-twenty-app/src/constants/template/src/__tests__/global-setup.ts+++ b/packages/create-twenty-app/src/constants/template/src/__tests__/global-setup.ts@@ -42,8 +42,9 @@ async function checkServer(apiUrl: string) {function writeConfig(apiUrl: string, apiKey: string) {const payload = JSON.stringify({+ version: 1,remotes: {- local: { apiUrl, apiKey, accessToken: apiKey },+ local: { apiUrl, apiKey, twentyCLIAccessToken: apiKey },},defaultRemote: 'local',},diff --git a/packages/twenty-apps/examples/document-generator/src/__tests__/global-setup.ts b/packages/twenty-apps/examples/document-generator/src/__tests__/global-setup.tsindex e0f8c23b054..c7f4d000cb4 100644--- a/packages/twenty-apps/examples/document-generator/src/__tests__/global-setup.ts+++ b/packages/twenty-apps/examples/document-generator/src/__tests__/global-setup.ts@@ -42,8 +42,9 @@ async function checkServer(apiUrl: string) {function writeConfig(apiUrl: string, apiKey: string) {const payload = JSON.stringify({+ version: 1,remotes: {- local: { apiUrl, apiKey, accessToken: apiKey },+ local: { apiUrl, apiKey, twentyCLIAccessToken: apiKey },},defaultRemote: 'local',},diff --git a/packages/twenty-apps/examples/postcard/src/__tests__/global-setup.ts b/packages/twenty-apps/examples/postcard/src/__tests__/global-setup.tsindex 98bd5539eb7..fba2a3f3bba 100644--- a/packages/twenty-apps/examples/postcard/src/__tests__/global-setup.ts+++ b/packages/twenty-apps/examples/postcard/src/__tests__/global-setup.ts@@ -42,8 +42,9 @@ async function checkServer(apiUrl: string) {function writeConfig(apiUrl: string, apiKey: string) {const payload = JSON.stringify({+ version: 1,remotes: {- local: { apiUrl, apiKey, accessToken: apiKey },+ local: { apiUrl, apiKey, twentyCLIAccessToken: apiKey },},defaultRemote: 'local',},diff --git a/packages/twenty-apps/public/call-recorder/src/__tests__/global-setup.ts b/packages/twenty-apps/public/call-recorder/src/__tests__/global-setup.tsindex 5d6782a1ce9..baa6b0ae2e9 100644--- a/packages/twenty-apps/public/call-recorder/src/__tests__/global-setup.ts+++ b/packages/twenty-apps/public/call-recorder/src/__tests__/global-setup.ts@@ -43,8 +43,9 @@ async function checkServer(apiUrl: string) {function writeConfig(apiUrl: string, apiKey: string) {const payload = JSON.stringify({+ version: 1,remotes: {- local: { apiUrl, apiKey, accessToken: apiKey },+ local: { apiUrl, apiKey, twentyCLIAccessToken: apiKey },},defaultRemote: 'local',},diff --git a/packages/twenty-apps/public/discord/src/__tests__/global-setup.ts b/packages/twenty-apps/public/discord/src/__tests__/global-setup.tsindex e0f8c23b054..c7f4d000cb4 100644--- a/packages/twenty-apps/public/discord/src/__tests__/global-setup.ts+++ b/packages/twenty-apps/public/discord/src/__tests__/global-setup.ts@@ -42,8 +42,9 @@ async function checkServer(apiUrl: string) {function writeConfig(apiUrl: string, apiKey: string) {const payload = JSON.stringify({+ version: 1,remotes: {- local: { apiUrl, apiKey, accessToken: apiKey },+ local: { apiUrl, apiKey, twentyCLIAccessToken: apiKey },},defaultRemote: 'local',},diff --git a/packages/twenty-apps/public/exa/src/__tests__/global-setup.ts b/packages/twenty-apps/public/exa/src/__tests__/global-setup.tsindex e0f8c23b054..c7f4d000cb4 100644--- a/packages/twenty-apps/public/exa/src/__tests__/global-setup.ts+++ b/packages/twenty-apps/public/exa/src/__tests__/global-setup.ts@@ -42,8 +42,9 @@ async function checkServer(apiUrl: string) {function writeConfig(apiUrl: string, apiKey: string) {const payload = JSON.stringify({+ version: 1,remotes: {- local: { apiUrl, apiKey, accessToken: apiKey },+ local: { apiUrl, apiKey, twentyCLIAccessToken: apiKey },},defaultRemote: 'local',},diff --git a/packages/twenty-apps/public/fathom/src/__tests__/global-setup.ts b/packages/twenty-apps/public/fathom/src/__tests__/global-setup.tsindex e0f8c23b054..c7f4d000cb4 100644--- a/packages/twenty-apps/public/fathom/src/__tests__/global-setup.ts+++ b/packages/twenty-apps/public/fathom/src/__tests__/global-setup.ts@@ -42,8 +42,9 @@ async function checkServer(apiUrl: string) {function writeConfig(apiUrl: string, apiKey: string) {const payload = JSON.stringify({+ version: 1,remotes: {- local: { apiUrl, apiKey, accessToken: apiKey },+ local: { apiUrl, apiKey, twentyCLIAccessToken: apiKey },},defaultRemote: 'local',},diff --git a/packages/twenty-apps/public/fireflies/src/__tests__/global-setup.ts b/packages/twenty-apps/public/fireflies/src/__tests__/global-setup.tsindex e0f8c23b054..c7f4d000cb4 100644--- a/packages/twenty-apps/public/fireflies/src/__tests__/global-setup.ts+++ b/packages/twenty-apps/public/fireflies/src/__tests__/global-setup.ts@@ -42,8 +42,9 @@ async function checkServer(apiUrl: string) {function writeConfig(apiUrl: string, apiKey: string) {const payload = JSON.stringify({+ version: 1,remotes: {- local: { apiUrl, apiKey, accessToken: apiKey },+ local: { apiUrl, apiKey, twentyCLIAccessToken: apiKey },},defaultRemote: 'local',},diff --git a/packages/twenty-apps/public/last-contact/src/__tests__/global-setup.ts b/packages/twenty-apps/public/last-contact/src/__tests__/global-setup.tsindex e0f8c23b054..c7f4d000cb4 100644--- a/packages/twenty-apps/public/last-contact/src/__tests__/global-setup.ts+++ b/packages/twenty-apps/public/last-contact/src/__tests__/global-setup.ts@@ -42,8 +42,9 @@ async function checkServer(apiUrl: string) {function writeConfig(apiUrl: string, apiKey: string) {const payload = JSON.stringify({+ version: 1,remotes: {- local: { apiUrl, apiKey, accessToken: apiKey },+ local: { apiUrl, apiKey, twentyCLIAccessToken: apiKey },},defaultRemote: 'local',},diff --git a/packages/twenty-apps/public/linear/src/__tests__/global-setup.ts b/packages/twenty-apps/public/linear/src/__tests__/global-setup.tsindex e0f8c23b054..c7f4d000cb4 100644--- a/packages/twenty-apps/public/linear/src/__tests__/global-setup.ts+++ b/packages/twenty-apps/public/linear/src/__tests__/global-setup.ts@@ -42,8 +42,9 @@ async function checkServer(apiUrl: string) {function writeConfig(apiUrl: string, apiKey: string) {const payload = JSON.stringify({+ version: 1,remotes: {- local: { apiUrl, apiKey, accessToken: apiKey },+ local: { apiUrl, apiKey, twentyCLIAccessToken: apiKey },},defaultRemote: 'local',},diff --git a/packages/twenty-apps/public/people-data-labs/src/__tests__/global-setup.ts b/packages/twenty-apps/public/people-data-labs/src/__tests__/global-setup.tsindex e0f8c23b054..c7f4d000cb4 100644--- a/packages/twenty-apps/public/people-data-labs/src/__tests__/global-setup.ts+++ b/packages/twenty-apps/public/people-data-labs/src/__tests__/global-setup.ts@@ -42,8 +42,9 @@ async function checkServer(apiUrl: string) {function writeConfig(apiUrl: string, apiKey: string) {const payload = JSON.stringify({+ version: 1,remotes: {- local: { apiUrl, apiKey, accessToken: apiKey },+ local: { apiUrl, apiKey, twentyCLIAccessToken: apiKey },},defaultRemote: 'local',},diff --git a/packages/twenty-apps/public/slack/src/__tests__/global-setup.ts b/packages/twenty-apps/public/slack/src/__tests__/global-setup.tsindex e0f8c23b054..c7f4d000cb4 100644--- a/packages/twenty-apps/public/slack/src/__tests__/global-setup.ts+++ b/packages/twenty-apps/public/slack/src/__tests__/global-setup.ts@@ -42,8 +42,9 @@ async function checkServer(apiUrl: string) {function writeConfig(apiUrl: string, apiKey: string) {const payload = JSON.stringify({+ version: 1,remotes: {- local: { apiUrl, apiKey, accessToken: apiKey },+ local: { apiUrl, apiKey, twentyCLIAccessToken: apiKey },},defaultRemote: 'local',},diff --git a/packages/twenty-apps/public/teams/src/__tests__/global-setup.ts b/packages/twenty-apps/public/teams/src/__tests__/global-setup.tsindex e0f8c23b054..c7f4d000cb4 100644--- a/packages/twenty-apps/public/teams/src/__tests__/global-setup.ts+++ b/packages/twenty-apps/public/teams/src/__tests__/global-setup.ts@@ -42,8 +42,9 @@ async function checkServer(apiUrl: string) {function writeConfig(apiUrl: string, apiKey: string) {const payload = JSON.stringify({+ version: 1,remotes: {- local: { apiUrl, apiKey, accessToken: apiKey },+ local: { apiUrl, apiKey, twentyCLIAccessToken: apiKey },},defaultRemote: 'local',},diff --git a/packages/twenty-sdk/src/cli/utilities/config/config-service.ts b/packages/twenty-sdk/src/cli/utilities/config/config-service.tsindex c493333f551..9301a921061 100644--- a/packages/twenty-sdk/src/cli/utilities/config/config-service.ts+++ b/packages/twenty-sdk/src/cli/utilities/config/config-service.ts@@ -55,88 +55,7 @@ export class ConfigService {const content = await readFile(this.configPath, 'utf8');const raw = JSON.parse(content || '{}');- return this.migrateConfigIfNeeded(raw);- }-- // TODO: Remove after 2026-04-30 — migrates legacy config format- // (profiles, top-level keys, applicationAccessToken/applicationRefreshToken)- // to the current format (remotes, twentyCLIAccessToken/twentyCLIRefreshToken)- private async migrateConfigIfNeeded(- raw: Record<string, unknown>,- ): Promise<PersistedConfig> {- if ((raw as PersistedConfig).version === CONFIG_VERSION) {- return raw as PersistedConfig;- }-- const hasLegacyProfiles = 'profiles' in raw;- const hasTopLevelApiUrl = 'apiUrl' in raw && !('remotes' in raw);-- if (!hasLegacyProfiles && !hasTopLevelApiUrl) {- return raw as PersistedConfig;- }-- const migrated: PersistedConfig = { version: CONFIG_VERSION };-- const str = (value: unknown): string | undefined =>- typeof value === 'string' ? value : undefined;-- const migrateRemoteFields = (- source: Record<string, unknown>,- ): RemoteConfig => ({- apiUrl: str(source.apiUrl) ?? '',- apiKey: str(source.apiKey),- twentyCLIRegistrationClientId:- str(source.twentyCLIRegistrationClientId) ?? str(source.oauthClientId),- twentyCLIAccessToken:- str(source.twentyCLIAccessToken) ??- str(source.accessToken) ??- str(source.applicationAccessToken),- twentyCLIRefreshToken:- str(source.twentyCLIRefreshToken) ??- str(source.refreshToken) ??- str(source.applicationRefreshToken),- appRegistrationId: str(source.appRegistrationId),- appRegistrationClientId: str(source.appRegistrationClientId),- });-- const profiles =- (raw.profiles as Record<string, Record<string, unknown>> | undefined) ??- {};-- migrated.remotes = {};-- for (const [name, profile] of Object.entries(profiles)) {- const remoteName = name === 'default' ? DEFAULT_REMOTE_NAME : name;-- migrated.remotes[remoteName] = migrateRemoteFields(profile);- }-- // Current-format remotes override legacy profiles — they're newer.- const existingRemotes =- (raw.remotes as Record<string, RemoteConfig> | undefined) ?? {};-- for (const [name, remote] of Object.entries(existingRemotes)) {- const remoteName = name === 'default' ? DEFAULT_REMOTE_NAME : name;-- migrated.remotes[remoteName] = remote;- }-- if (hasTopLevelApiUrl && !migrated.remotes[DEFAULT_REMOTE_NAME]) {- migrated.remotes[DEFAULT_REMOTE_NAME] = migrateRemoteFields(- raw as Record<string, unknown>,- );- }-- const legacyDefault = raw.defaultWorkspace as string | undefined;-- if (legacyDefault) {- migrated.defaultRemote =- legacyDefault === 'default' ? DEFAULT_REMOTE_NAME : legacyDefault;- }-- await writePrivateFile(this.configPath, JSON.stringify(migrated, null, 2));-- return migrated;+ return raw as PersistedConfig;}async getConfig(): Promise<RemoteConfig> {