diff --git a/content/docs/getting-started/build-with-claude-code.mdx b/content/docs/getting-started/build-with-claude-code.mdx index 037499486b3..061957318f5 100644 --- a/content/docs/getting-started/build-with-claude-code.mdx +++ b/content/docs/getting-started/build-with-claude-code.mdx @@ -158,6 +158,13 @@ export const Ticket = ObjectSchema.create({ }), }, + // The create and edit forms lay a ticket out by these groups: one section, + // its fields in the order its `fields` list gives. No field is marked + // `showOnCreate: false`, so the create form asks for all four. + fieldGroups: [ + { key: 'ticket', label: 'Ticket', fields: ['subject', 'description', 'priority', 'status'] }, + ], + sharingModel: 'private', // org-wide default (OWD) — required by the security gate enable: { apiEnabled: true, searchable: true }, }); @@ -212,17 +219,6 @@ export const TicketViews = defineView({ sort: [{ field: 'priority', order: 'desc' }], }, }, - form: { - type: 'simple', - data, - sections: [ - { - name: 'ticket', - label: 'Ticket', - fields: [{ field: 'subject' }, { field: 'description' }, { field: 'priority' }, { field: 'status' }], - }, - ], - }, }); ``` @@ -306,11 +302,17 @@ passes an unregistered one, the `os dev` boot log warns fails when clicked (the [two paths](/docs/ui/actions#give-it-server-behavior--two-paths) a handler takes). -The view file also declares the create and edit **form**, and the form is where the -long-text `description` is entered and shown. The list columns leave it out, so the -form is the only metadata that names it. A field that no consumer names (a view, a form, a -flow, a formula or an action, among the others the rule counts) gets an advisory -`field-no-consumers` warning from `os validate`. +The view file declares lists only: no file declares a create or edit **form**. +Both forms lay a ticket out by the object's `fieldGroups`: the one **Ticket** +group's `fields` list places the four fields in that section, in the order it +lists them. No field is marked `showOnCreate: false`, so the create form asks +for all four, the long-text `description` among them. The list columns leave +`description` out, so its entry in the group's `fields` list is the only +metadata that names it, and that placement counts as a consumer: a field that +no consumer names (a view column, a field group, a flow, a formula or an +action, among the others the rule counts) gets an advisory +`field-no-consumers` warning from `os validate`, and the run below prints none +for `description`. The agent also **exports each new file from its directory's barrel**: one line at the end of each of the three `index.ts` files, beside the lines the starter diff --git a/packages/cli/test/getting-started-build-with-claude-code.e2e.test.ts b/packages/cli/test/getting-started-build-with-claude-code.e2e.test.ts index d12fe33dbae..51be08a893b 100644 --- a/packages/cli/test/getting-started-build-with-claude-code.e2e.test.ts +++ b/packages/cli/test/getting-started-build-with-claude-code.e2e.test.ts @@ -33,7 +33,11 @@ * Asserted beside the run: every new file is exported by a barrel line the page * shows, in its own directory's `index.ts` (the page's rule that metadata * exists only if its barrel exports it). Exit statuses and count lines are - * asserted; prose is not pinned. + * asserted; prose is not pinned. Two advisories are asserted absent, by rule + * id: `form-view-internal-not-loaded` (the page's files declare no internal + * create/edit form, which the platform does not load) and `field-no-consumers` + * on the ticket's `description` (the page says its field group is the + * consumer that names it). * * The `Runtime:` line is not compared. The project here is not installed (it * lives under this package's `node_modules`, so its imports resolve to @@ -221,4 +225,15 @@ describe('the page, followed verbatim in a fresh `blank` scaffold', () => { const printed = validate.stdout.split('\n').filter((l) => COUNT_LINE.test(l)).map(fold); for (const line of countLines) expect(printed, out(validate)).toContain(line); }); + + it('prints no `form-view-internal-not-loaded`: the page declares no internal create/edit form', () => { + expect(out(validate)).not.toContain('form-view-internal-not-loaded'); + }); + + it("prints no `field-no-consumers` for the ticket's `description`: its field group names it", () => { + const advisories = out(validate) + .split('\n') + .filter((l) => l.includes('field "description"') && l.includes('support_desk_ticket')); + expect(advisories, out(validate)).toEqual([]); + }); });