3a9f405e6c
Part 4 of the app-docs audit series (after #22688, #22689, #22690). Focus: values that exist in the SDK but never made it into the docs. All value lists were extracted from `twenty-shared` / `twenty-sdk` source. ## What this adds/fixes **data/objects.mdx** - New "Field types" section with the complete `FieldType` value set (24 values, grouped by category, with the composite/`SELECT` caveats and the lowercase `universalSettings.dataType` values for `NUMBER`). Previously no page listed the available field types — readers had to reverse-engineer them from scattered examples. **layout/views.mdx** - `ViewFilterOperand` was imported from `twenty-shared/types` in the example; it's re-exported from `twenty-sdk/define`, which is the supported import surface for apps. - New "Optional properties" table covering what the page omitted: `type` (`ViewType.TABLE`/`KANBAN`/`CALENDAR`), `visibility`, `openRecordIn`, `sorts`, kanban aggregate settings, and calendar settings. **getting-started/scaffolding.mdx** - The `dev:add` table listed 10 of 14 entity types; added `pageLayoutTab`, `commandMenuItem`, `viewField`, and `connectionProvider` (paths follow the CLI's kebab-case convention). **layout/navigation-menu-items.mdx** - Note about `NavigationMenuItemType.RECORD`: it exists in the enum but is internal (user favorites) and has no manifest field to reference a record, so apps can't use it — documented to prevent confusion about the "missing" value. Only English sources were touched; `l/<locale>` copies come from Crowdin. --- _Generated by [Claude Code](https://claude.ai/code/session_01ExboyDAT19khDuKXaYXETT)_ <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/22691?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. --> Co-authored-by: Martin <martin@twenty.com>
63 lines
2.9 KiB
Plaintext
63 lines
2.9 KiB
Plaintext
---
|
|
title: Scaffolding
|
|
description: Generate entity files interactively with yarn twenty dev:add — objects, fields, views, logic functions, and more.
|
|
icon: "wand-magic-sparkles"
|
|
---
|
|
|
|
Instead of creating entity files by hand, use the interactive scaffolder:
|
|
|
|
```bash filename="Terminal"
|
|
yarn twenty dev:add
|
|
```
|
|
|
|
It prompts you to pick an entity type and walks you through the required fields, then writes a ready-to-use file with a stable `universalIdentifier` and the correct `defineEntity()` call.
|
|
|
|
You can also pass the entity type directly to skip the first prompt:
|
|
|
|
```bash filename="Terminal"
|
|
yarn twenty dev:add object
|
|
yarn twenty dev:add logicFunction
|
|
yarn twenty dev:add frontComponent
|
|
```
|
|
|
|
## Available entity types
|
|
|
|
| Entity type | Command | Generated file |
|
|
|-------------|---------|----------------|
|
|
| Object | `yarn twenty dev:add object` | `src/objects/<name>.ts` |
|
|
| Field | `yarn twenty dev:add field` | `src/fields/<name>.ts` |
|
|
| Logic function | `yarn twenty dev:add logicFunction` | `src/logic-functions/<name>.ts` |
|
|
| Front component | `yarn twenty dev:add frontComponent` | `src/front-components/<name>.tsx` |
|
|
| Role | `yarn twenty dev:add role` | `src/roles/<name>.ts` |
|
|
| Skill | `yarn twenty dev:add skill` | `src/skills/<name>.ts` |
|
|
| Agent | `yarn twenty dev:add agent` | `src/agents/<name>.ts` |
|
|
| View | `yarn twenty dev:add view` | `src/views/<name>.ts` |
|
|
| Navigation menu item | `yarn twenty dev:add navigationMenuItem` | `src/navigation-menu-items/<name>.ts` |
|
|
| Page layout | `yarn twenty dev:add pageLayout` | `src/page-layouts/<name>.ts` |
|
|
| Page layout tab | `yarn twenty dev:add pageLayoutTab` | `src/page-layout-tabs/<name>.ts` |
|
|
| Command menu item | `yarn twenty dev:add commandMenuItem` | `src/command-menu-items/<name>.ts` |
|
|
| View field | `yarn twenty dev:add viewField` | `src/view-fields/<name>.ts` |
|
|
| Connection provider | `yarn twenty dev:add connectionProvider` | `src/connection-providers/<name>.ts` |
|
|
|
|
## What the scaffolder generates
|
|
|
|
Each entity type has its own template. For example, `yarn twenty dev:add object` asks for:
|
|
|
|
1. **Name (singular)** — e.g., `invoice`
|
|
2. **Name (plural)** — e.g., `invoices`
|
|
3. **Label (singular)** — auto-populated from the name (e.g., `Invoice`)
|
|
4. **Label (plural)** — auto-populated (e.g., `Invoices`)
|
|
5. **Create a view and navigation item?** — if you answer yes, the scaffolder also generates a matching view and sidebar link for the new object.
|
|
|
|
Other entity types have simpler prompts — most only ask for a name.
|
|
|
|
The `field` entity type is more detailed: it asks for the field name, label, type (from a list of all available field types like `TEXT`, `NUMBER`, `SELECT`, `RELATION`, etc.), and the target object's `universalIdentifier`.
|
|
|
|
## Custom output path
|
|
|
|
Use the `--path` flag to place the generated file in a custom location:
|
|
|
|
```bash filename="Terminal"
|
|
yarn twenty dev:add logicFunction --path src/custom-folder
|
|
```
|