Skip to content

The open alternative to Salesforce, designed for AI.

fix(cli): simplify connection hints and planning messages (#27425)

Weikoa4c20d66305f
diff --git a/packages/twenty-cli/src/app/deployment/create-apply-failure.ts b/packages/twenty-cli/src/app/deployment/create-apply-failure.ts
index a3c8b64c0ef..680dad3d916 100644
--- a/packages/twenty-cli/src/app/deployment/create-apply-failure.ts
+++ b/packages/twenty-cli/src/app/deployment/create-apply-failure.ts
@@ -56,7 +56,7 @@ const getRecoveryHint = ({
outcome: AppApplyOutcome;
}) => {
if (outcome === 'not-started') {
- return 'Fix the problem, then run twenty app apply again. It builds and previews from scratch.';
+ return 'Fix the problem, then run twenty app apply again. It rebuilds the app and requests a fresh plan.';
}
return `The ${phase} step may have changed the workspace. Run twenty app plan to see where it stands before applying again.`;
diff --git a/packages/twenty-cli/src/app/deployment/create-post-sync-failure.ts b/packages/twenty-cli/src/app/deployment/create-post-sync-failure.ts
index 22de5d6af7d..7f22897b851 100644
--- a/packages/twenty-cli/src/app/deployment/create-post-sync-failure.ts
+++ b/packages/twenty-cli/src/app/deployment/create-post-sync-failure.ts
@@ -19,7 +19,7 @@ const POST_SYNC_STEPS: Record<
clientGeneration: {
cancelledMessage: 'generating its typed API client was cancelled',
failedMessage: 'its typed API client was not regenerated',
- hint: 'The workspace already has this version of the app, but the client files in node_modules/twenty-client-sdk may be incomplete. Fix the problem, then run twenty app apply again: it repeats the preview, upload and sync before regenerating the client. twenty app plan shows what that sync would change.',
+ hint: 'The workspace already has this version of the app, but the client files in node_modules/twenty-client-sdk may be incomplete. Fix the problem, then run twenty app apply again: it requests a fresh plan, uploads and syncs before regenerating the client. twenty app plan shows what that sync would change.',
},
};
diff --git a/packages/twenty-cli/src/app/deployment/fetch-app-plan.ts b/packages/twenty-cli/src/app/deployment/fetch-app-plan.ts
index 1bcde99a9e2..cfc1e6dad2a 100644
--- a/packages/twenty-cli/src/app/deployment/fetch-app-plan.ts
+++ b/packages/twenty-cli/src/app/deployment/fetch-app-plan.ts
@@ -26,7 +26,7 @@ export const fetchAppPlan = async ({
) {
throw new CliError({
code: 'TOOLING_UNSUPPORTED',
- message: 'This CLI cannot preview the manifest returned by the SDK.',
+ message: 'The app build produced a manifest that this CLI cannot plan.',
});
}
@@ -56,7 +56,7 @@ export const fetchAppPlan = async ({
throw new CliError({
code: 'PLAN_UNAVAILABLE',
message:
- 'This app needs an owned registration before the server can preview it. Nothing was registered, uploaded or synchronized.',
+ 'This app must be registered in this workspace before its changes can be planned. Nothing was registered, uploaded or synchronized.',
hint: 'Run twenty app apply --create to register it and install it in this workspace.',
details: {
...error.details,
diff --git a/packages/twenty-cli/src/app/deployment/parse-app-plan.ts b/packages/twenty-cli/src/app/deployment/parse-app-plan.ts
index cee994f1b04..57d8468d4e9 100644
--- a/packages/twenty-cli/src/app/deployment/parse-app-plan.ts
+++ b/packages/twenty-cli/src/app/deployment/parse-app-plan.ts
@@ -68,7 +68,7 @@ export const parseAppPlan = ({
throw new CliError({
code: 'RESPONSE_LIMIT_EXCEEDED',
message: `The application plan exceeds ${RESULT_ITEM_LIMIT} actions.`,
- hint: 'Reduce the app changes before requesting another preview.',
+ hint: 'Reduce the app changes before requesting another plan.',
});
}
diff --git a/packages/twenty-cli/src/app/get-app-init-next-steps.ts b/packages/twenty-cli/src/app/get-app-init-next-steps.ts
index 5e902cca247..92e1db2c376 100644
--- a/packages/twenty-cli/src/app/get-app-init-next-steps.ts
+++ b/packages/twenty-cli/src/app/get-app-init-next-steps.ts
@@ -38,7 +38,7 @@ export const getAppInitNextSteps = ({
? []
: [
{
- command: `twenty auth login --url <url> --name ${isDefined(remoteName) ? quoteForShell(remoteName) : '<name>'}`,
+ command: `twenty auth login --url <url>${isDefined(remoteName) ? ` --name ${quoteForShell(remoteName)}` : ''}`,
description: 'Connect a workspace',
},
]),
diff --git a/packages/twenty-cli/src/app/run-app-worker.ts b/packages/twenty-cli/src/app/run-app-worker.ts
index 78f13320007..87d63b7624d 100644
--- a/packages/twenty-cli/src/app/run-app-worker.ts
+++ b/packages/twenty-cli/src/app/run-app-worker.ts
@@ -196,7 +196,7 @@ export const runAppWorker = async ({
code: 'WORKER_FAILED',
message: isDefined(failureResponse)
? `The app worker failed: ${failureResponse.message}`
- : `The app worker stopped before finishing (${stopReason}). The app or the SDK may have exited the process.`,
+ : `The app worker stopped before finishing (${stopReason}). App code or a dependency may have exited the process.`,
hint: failureResponse?.hint,
details: {
...failureResponse?.details,
diff --git a/packages/twenty-cli/src/commands/app/__tests__/app-init.spec.ts b/packages/twenty-cli/src/commands/app/__tests__/app-init.spec.ts
index 606ff5ccc93..9149fa8dd47 100644
--- a/packages/twenty-cli/src/commands/app/__tests__/app-init.spec.ts
+++ b/packages/twenty-cli/src/commands/app/__tests__/app-init.spec.ts
@@ -53,7 +53,7 @@ const TEMPLATE_OVERLAY_DIRECTORY = fileURLToPath(
const UUID_PATTERN =
/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/g;
-const LOGIN_STEP = 'twenty auth login --url <url> --name <name>';
+const LOGIN_STEP = 'twenty auth login --url <url>';
describe('app init', () => {
let root: string;
diff --git a/packages/twenty-cli/src/commands/auth/login/read-api-key-from-standard-input.ts b/packages/twenty-cli/src/commands/auth/login/read-api-key-from-standard-input.ts
index 0e382b72575..dde6f2f5a9e 100644
--- a/packages/twenty-cli/src/commands/auth/login/read-api-key-from-standard-input.ts
+++ b/packages/twenty-cli/src/commands/auth/login/read-api-key-from-standard-input.ts
@@ -3,7 +3,7 @@ import { CliError } from '@/output/cli-error';
import { EXIT_CODE } from '@/output/constants/exit-code.constant';
const PIPE_HINT =
- 'Pipe it in, for example: printf \'%s\' "$TWENTY_API_KEY" | twenty auth login --with-token --url <url> --name <name>';
+ 'Pipe it in, for example: printf \'%s\' "$TWENTY_API_KEY" | twenty auth login --with-token --url <url>';
export const readApiKeyFromStandardInput = async (signal: AbortSignal) => {
if (process.stdin.isTTY === true) {
diff --git a/packages/twenty-cli/src/commands/auth/login/run-auth-login-command.ts b/packages/twenty-cli/src/commands/auth/login/run-auth-login-command.ts
index 47b6fff2609..4aa53d10d38 100644
--- a/packages/twenty-cli/src/commands/auth/login/run-auth-login-command.ts
+++ b/packages/twenty-cli/src/commands/auth/login/run-auth-login-command.ts
@@ -85,7 +85,7 @@ const obtainCredentials = async ({
exitCode: EXIT_CODE.USAGE,
message:
'Browser sign-in only runs in an interactive terminal, not with --no-input, JSON output, redirected stdin or in CI.',
- hint: `In scripts and CI, pipe an API key: printf '%s' "$TWENTY_API_KEY" | twenty auth login --with-token --url ${apiUrl} --name <name>`,
+ hint: 'In scripts and CI, retry this command with --with-token and pipe an API key on standard input.',
});
}
diff --git a/packages/twenty-cli/src/commands/remote/list/run-remote-list-command.ts b/packages/twenty-cli/src/commands/remote/list/run-remote-list-command.ts
index 001a5470aa1..1a06a1261f4 100644
--- a/packages/twenty-cli/src/commands/remote/list/run-remote-list-command.ts
+++ b/packages/twenty-cli/src/commands/remote/list/run-remote-list-command.ts
@@ -25,7 +25,7 @@ export const runRemoteListCommand: CommandRun = async () => {
if (remotes.length === 0) {
return {
data: { remotes, defaultRemote: null },
- human: `No saved remotes. ${dimText('Sign in with: ')}${commandText('twenty auth login --with-token --url <url> --name <name>')}`,
+ human: `No saved remotes. ${dimText('Sign in with: ')}${commandText('twenty auth login --url <url>')}`,
};
}
diff --git a/packages/twenty-cli/src/oauth/__tests__/browser-sign-in-and-refresh.spec.ts b/packages/twenty-cli/src/oauth/__tests__/browser-sign-in-and-refresh.spec.ts
index 68b46b97147..4964de16c3c 100644
--- a/packages/twenty-cli/src/oauth/__tests__/browser-sign-in-and-refresh.spec.ts
+++ b/packages/twenty-cli/src/oauth/__tests__/browser-sign-in-and-refresh.spec.ts
@@ -445,7 +445,10 @@ describe('browser sign-in and session refresh', () => {
const { envelope, exitCode } = await runJson(['auth', 'status']);
expect(exitCode).toBe(1);
- expect(envelope.error).toMatchObject({ code: 'OAUTH_UNAVAILABLE' });
+ expect(envelope.error).toMatchObject({
+ code: 'OAUTH_UNAVAILABLE',
+ hint: expect.stringContaining('twenty auth login --with-token'),
+ });
expect(state.refreshCalls).toBe(0);
expect(await readConfigFile()).toEqual(configBefore);
expect(openBrowser).not.toHaveBeenCalled();
diff --git a/packages/twenty-cli/src/oauth/discover-oauth-server.ts b/packages/twenty-cli/src/oauth/discover-oauth-server.ts
index 20101d8a1a1..d49ba23a0ce 100644
--- a/packages/twenty-cli/src/oauth/discover-oauth-server.ts
+++ b/packages/twenty-cli/src/oauth/discover-oauth-server.ts
@@ -16,7 +16,7 @@ const createUnavailableError = (apiUrl: string, reason: string) =>
new CliError({
code: 'OAUTH_UNAVAILABLE',
message: `Browser sign-in is not available on ${apiUrl}: ${reason}`,
- hint: `Use an API key instead: printf '%s' "$TWENTY_API_KEY" | twenty auth login --with-token --url ${apiUrl} --name <name>`,
+ hint: `Pipe an API key into twenty auth login --with-token. Use --remote <name> for a saved connection, or --url ${apiUrl} for a new one.`,
});
const parseHttpUrl = (value: unknown) => {
diff --git a/packages/twenty-cli/src/target/select-target.ts b/packages/twenty-cli/src/target/select-target.ts
index 7344f04bedf..445a89693d4 100644
--- a/packages/twenty-cli/src/target/select-target.ts
+++ b/packages/twenty-cli/src/target/select-target.ts
@@ -108,6 +108,6 @@ export const selectTarget = async ({
code: 'TARGET_REQUIRED',
exitCode: EXIT_CODE.USAGE,
message: 'No workspace selected.',
- hint: `Sign in with: twenty auth login --with-token --url <url> --name <name>. Or set ${TARGET_ENVIRONMENT_VARIABLE.API_URL} and ${TARGET_ENVIRONMENT_VARIABLE.API_KEY}.`,
+ hint: `Sign in with: twenty auth login --url <url>. Or set ${TARGET_ENVIRONMENT_VARIABLE.API_URL} and ${TARGET_ENVIRONMENT_VARIABLE.API_KEY}.`,
});
};