Skip to content

Merge twenty-cli into twenty-sdk#16150

Merged
martmull merged 29 commits intomainfrom
fix-twenty-cli-and-twenty-sdk-2
Dec 1, 2025
Merged

Merge twenty-cli into twenty-sdk#16150
martmull merged 29 commits intomainfrom
fix-twenty-cli-and-twenty-sdk-2

Conversation

@martmull
Copy link
Copy Markdown
Contributor

@martmull martmull commented Nov 27, 2025

  • Moves twenty-cli content into twenty-sdk
  • add a new twenty-sdk:0.1.0 version
  • this new twenty-sdk exports a cli command called 'twenty' (like twenty-cli before)
  • deprecates twenty-cli
  • simplify app init command base-project
  • use twenty-sdk:0.1.0 in base project
  • move the "twenty-sdk/application" barrel to "twenty-sdk"
  • add create-twenty-app package
image image

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Nov 27, 2025

Greptile Overview

Greptile Summary

This PR successfully consolidates twenty-cli into twenty-sdk, creating a unified package that provides both SDK and CLI functionality. The migration is well-executed with proper deprecation handling for the old package.

Key Changes:

  • Moved all CLI code from packages/twenty-cli/src to packages/twenty-sdk/src/cli
  • Updated twenty-sdk package.json to version 0.1.0 with bin entry pointing to CLI
  • Deprecated twenty-cli package with clear migration instructions
  • Modified build process: Vite builds SDK library, separate TypeScript compilation for CLI
  • Updated barrel generation script to exclude CLI directory and simplify exports structure
  • Changed exports: removed /application subpath, now everything exports from root
  • Migrated all E2E tests and Jest configuration
  • Updated documentation and README files

Migration Impact:

  • Users of twenty-cli will see deprecation message pointing to twenty-sdk
  • Projects using twenty-sdk will now get CLI commands included
  • Simplified import path: import { X } from 'twenty-sdk' instead of 'twenty-sdk/application'

Confidence Score: 5/5

  • This PR is safe to merge with very minimal risk
  • This is a well-structured refactoring with clear migration path. All CLI code is moved cleanly, build configuration is properly separated, and the old package is correctly deprecated. Only one minor style issue found (Jest displayName).
  • No files require special attention - this is a clean consolidation with proper deprecation strategy

Important Files Changed

File Analysis

Filename Score Overview
packages/twenty-cli/package.json 5/5 Correctly deprecated twenty-cli package, redirecting users to twenty-sdk
packages/twenty-cli/deprecate.js 5/5 Simple deprecation script that properly notifies users to migrate to twenty-sdk
packages/twenty-sdk/package.json 5/5 Added CLI bin entry, merged dependencies from twenty-cli, version bumped to 0.1.0, simplified exports
packages/twenty-sdk/src/cli/cli.ts 5/5 Main CLI entry point migrated from twenty-cli, properly handles commands and workspace configuration
packages/twenty-sdk/src/index.ts 5/5 Auto-generated barrel export file re-exports from application module
packages/twenty-sdk/scripts/generateBarrels.ts 5/5 Updated to exclude CLI directory from barrel exports and handle root directories for simplified exports
packages/twenty-sdk/vite.config.ts 5/5 Vite config properly builds library bundles but excludes CLI (built separately via tsconfig.cli.json)
packages/twenty-sdk/tsconfig.cli.json 5/5 Separate TypeScript config for CLI with CommonJS output to support Node.js bin execution

Sequence Diagram

sequenceDiagram
    participant User
    participant NPM
    participant TwentyCLI as twenty-cli (deprecated)
    participant TwentySDK as twenty-sdk
    participant Build as Build System
    participant Vite
    participant TSC as TypeScript Compiler

    Note over User,TwentySDK: Migration Flow
    User->>NPM: npm install -g twenty-sdk
    NPM->>TwentySDK: Install package with CLI bin
    
    Note over TwentyCLI: Old Package (Deprecated)
    User->>TwentyCLI: twenty command (if old CLI installed)
    TwentyCLI->>User: Display deprecation message & exit

    Note over User,TwentySDK: New CLI Usage Flow
    User->>TwentySDK: twenty auth login
    TwentySDK->>TwentySDK: ConfigService stores API key
    
    User->>TwentySDK: twenty app init my-app
    TwentySDK->>TwentySDK: Create app structure
    TwentySDK->>TwentySDK: Generate package.json with twenty-sdk:0.1.0
    TwentySDK->>User: New app scaffolded
    
    User->>TwentySDK: twenty app dev
    TwentySDK->>TwentySDK: Watch files & sync to Twenty server
    
    Note over Build,TSC: Build Process
    Build->>Build: Run generateBarrels script
    Build->>Build: Exclude cli/** from barrel exports
    Build->>Build: Generate src/index.ts from application/
    Build->>Vite: Build library (ESM/CJS)
    Vite->>Vite: Bundle SDK exports
    Build->>TSC: Build CLI separately (CommonJS)
    TSC->>TSC: Compile cli/** to dist/cli/cli.js
    
    Note over TwentySDK: Unified Package
    TwentySDK->>User: Provides both SDK and CLI functionality
Loading

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

52 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@martmull martmull force-pushed the fix-twenty-cli-and-twenty-sdk-2 branch from 79fde92 to ef3b337 Compare November 27, 2025 20:22
@Weiko Weiko self-requested a review November 28, 2025 13:43
@socket-security
Copy link
Copy Markdown

socket-security bot commented Nov 28, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​apollo/​client@​3.13.8971009198100
Added@​aws-sdk/​client-sts@​3.825.09810010097100
Added@​aws-sdk/​client-sesv2@​3.888.09810010097100
Added@​aws-sdk/​client-lambda@​3.825.09810010097100
Added@​aws-sdk/​client-s3@​3.825.09810010097100

View full report

@martmull martmull force-pushed the fix-twenty-cli-and-twenty-sdk-2 branch 2 times, most recently from 857f689 to 3169c56 Compare November 28, 2025 14:38
@martmull martmull force-pushed the fix-twenty-cli-and-twenty-sdk-2 branch from 4e3a4c3 to c4a2355 Compare November 29, 2025 05:54
@martmull martmull merged commit e498367 into main Dec 1, 2025
73 checks passed
@martmull martmull deleted the fix-twenty-cli-and-twenty-sdk-2 branch December 1, 2025 10:44
@twenty-eng-sync
Copy link
Copy Markdown

Hey @martmull! After you've done the QA of your Pull Request, you can mark it as done here. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants