Improve readme (#14858)
This commit is contained in:
+61
-102
@@ -1,127 +1,86 @@
|
||||
# Twenty CLI (WIP WIP WIP - DO NOT USE)
|
||||
# Why Twenty CLI?
|
||||
|
||||
A command-line interface for Twenty application development. Build, deploy, and manage Twenty applications with ease.
|
||||
A command-line interface to easily scaffold, develop, and publish applications that extend Twenty CRM
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
# Install globally
|
||||
npm install -g twenty-cli
|
||||
|
||||
# Or use npx
|
||||
npx twenty-cli --help
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
## Requirements
|
||||
- yarn >= 4.9.2
|
||||
- an `apiKey`. Go to `https://twenty.com/settings/api-webhooks` to generate one
|
||||
|
||||
## Quick example project
|
||||
|
||||
```bash
|
||||
# Authenticate with Twenty
|
||||
# Authenticate using your apiKey (CLI will prompt for your <apiKey>)
|
||||
twenty auth login
|
||||
|
||||
# Create a new application
|
||||
twenty app init my-app
|
||||
cd my-app
|
||||
# Init a new application called hello-world
|
||||
twenty app init hello-world
|
||||
|
||||
# Start development mode (watches for changes and syncs automatically)
|
||||
# Go to your app
|
||||
cd hello-world
|
||||
|
||||
# Add a serverless function to your application
|
||||
twenty app add serverlessFunction
|
||||
|
||||
# Add a trigger to your serverless function
|
||||
twenty app add trigger
|
||||
|
||||
# Add axios to your application
|
||||
yarn add axios
|
||||
|
||||
# Start dev mode: automatically syncs changes to your Twenty workspace, so you can test new functions/objects instantly.
|
||||
twenty app dev
|
||||
|
||||
# Or use one time sync
|
||||
twenty app sync
|
||||
|
||||
# List all available commands
|
||||
twenty help
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
### Authentication
|
||||
|
||||
```bash
|
||||
# Login to Twenty
|
||||
twenty auth login
|
||||
|
||||
# Check authentication status
|
||||
twenty auth status
|
||||
|
||||
# Logout
|
||||
twenty auth logout
|
||||
```
|
||||
|
||||
### Application Development
|
||||
|
||||
```bash
|
||||
# Initialize a new application
|
||||
twenty app init [name]
|
||||
|
||||
# Add a new core entity to your application
|
||||
twenty app add [options]
|
||||
-p, --path <path> Application directory path (default: current directory)
|
||||
|
||||
# Start development mode with file watching
|
||||
twenty app dev [options]
|
||||
-p, --path <path> Application directory path (default: current directory)
|
||||
-w, --workspace-id <id> Workspace ID
|
||||
-d, --debounce <ms> Debounce delay in milliseconds (default: 1000)
|
||||
|
||||
# Deploy application
|
||||
twenty app deploy [options]
|
||||
-p, --path <path> Application directory path (default: current directory)
|
||||
-w, --workspace-id <id> Workspace ID
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
```bash
|
||||
# Get configuration value
|
||||
twenty config get [key]
|
||||
--global Show global configuration
|
||||
--project Show project configuration
|
||||
|
||||
# Set configuration value
|
||||
twenty config set <key> <value>
|
||||
--global Set in global configuration
|
||||
--project Set in project configuration
|
||||
|
||||
# Remove configuration value
|
||||
twenty config unset <key>
|
||||
--global Remove from global configuration
|
||||
--project Remove from project configuration
|
||||
|
||||
# List all configuration
|
||||
twenty config list
|
||||
--global Show only global configuration
|
||||
--project Show only project configuration
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The CLI supports both global and project-level configuration:
|
||||
|
||||
- **Global config**: `~/.twenty/config.json`
|
||||
- **Project config**: `.twenty.json` in your project directory
|
||||
|
||||
Project configuration takes precedence over global configuration.
|
||||
|
||||
### Configuration Keys
|
||||
|
||||
- `apiUrl`: Twenty API URL (default: http://localhost:3000)
|
||||
- `apiKey`: Your Twenty API key
|
||||
- `workspaceId`: Default workspace ID for operations
|
||||
|
||||
## Application Structure
|
||||
|
||||
Each application in this package follows the standard Twenty application structure:
|
||||
Each application in this package follows the standard application structure:
|
||||
|
||||
```
|
||||
app-name/
|
||||
├── twenty-app.json # Application manifest
|
||||
├── README.md # Application documentation
|
||||
├── DEVELOPMENT.md # Development guide (optional)
|
||||
├── functions/ # Serverless functions (optional)
|
||||
│ ├── function1.ts
|
||||
│ └── function2.ts
|
||||
└── assets/ # Static assets (optional)
|
||||
├── icons/
|
||||
└── screenshots/
|
||||
├── package.json
|
||||
├── README.md
|
||||
├── serverlessFunctions # Custom backend logic (runs on demand)
|
||||
└── ...
|
||||
```
|
||||
|
||||
## Development Workflow
|
||||
## Publish your application
|
||||
|
||||
1. **Initialize**: Create a new application with `twenty app init`
|
||||
2. **Develop**: Use `twenty app dev` to watch for changes and auto-sync
|
||||
Applications are currently stored in twenty/packages/twenty-apps.
|
||||
|
||||
The development mode watches your application directory and automatically syncs changes to your Twenty workspace, providing a smooth development experience similar to Vercel or Heroku CLI.
|
||||
You can share your application with all twenty users.
|
||||
|
||||
```bash
|
||||
# pull twenty project
|
||||
git clone https://github.com/twentyhq/twenty.git
|
||||
cd twenty
|
||||
|
||||
# create a new branch
|
||||
git checkout -b feature/my-awesome-app
|
||||
```
|
||||
|
||||
- copy your app folder into twenty/packages/twenty-apps
|
||||
- commit your changes and open a pull request on https://github.com/twentyhq/twenty
|
||||
|
||||
```bash
|
||||
git commit -m "Add new application"
|
||||
git push
|
||||
```
|
||||
|
||||
Our team reviews contributions for quality, security, and reusability before merging.
|
||||
|
||||
## Contributing
|
||||
|
||||
- see our [Hacktoberfest 2025 notion page](https://twentycrm.notion.site/Hacktoberfest-27711d8417038037a149d4638a9cc510)
|
||||
- our [Discord](https://discord.gg/cx5n4Jzs57)
|
||||
|
||||
Reference in New Issue
Block a user