fix(tools): describe every supported shape (#448)
- Name every create_shape node type in the tool description - Direct arbitrary geometry requests to SVG-backed create_vector input - Keep the prose synchronized with the declared type enum Co-authored-by: Rob Coenen <753704+rcoenen@users.noreply.github.com>
This commit is contained in:
parent
f047b0bcb4
commit
bffd53d349
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Help AI agents discover every shape supported by `create_shape`. (#448)
|
||||||
- Keep `fill="none"` and `stroke="none"` SVG paths transparent when rendering inline artwork. (#446)
|
- Keep `fill="none"` and `stroke="none"` SVG paths transparent when rendering inline artwork. (#446)
|
||||||
- Match regional browser languages to supported locales without selecting a secondary language. (#417)
|
- Match regional browser languages to supported locales without selecting a secondary language. (#417)
|
||||||
- Save auto-layout frames that stretch their children to `.fig` without failing. (#427)
|
- Save auto-layout frames that stretch their children to `.fig` without failing. (#427)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ export const createShape = defineTool({
|
||||||
name: 'create_shape',
|
name: 'create_shape',
|
||||||
mutates: true,
|
mutates: true,
|
||||||
description:
|
description:
|
||||||
'Create a shape on the canvas. Use FRAME for containers/cards, RECTANGLE for solid blocks, ELLIPSE for circles, TEXT for labels, SECTION for page sections.',
|
'Create a shape on the canvas. Use FRAME for containers/cards, RECTANGLE for solid blocks, ELLIPSE for circles, TEXT for labels, LINE for rules and dividers, STAR for starbursts and badges, POLYGON for triangles and regular polygons, and SECTION for page sections. Use create_vector with an SVG path for arbitrary shapes.',
|
||||||
params: {
|
params: {
|
||||||
type: {
|
type: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,14 @@ describe('create_shape', () => {
|
||||||
expect(node.height).toBe(400)
|
expect(node.height).toBe(400)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('names every supported node type in the tool description', () => {
|
||||||
|
const tool = getTool('create_shape')
|
||||||
|
const supportedTypes = tool.params.type.enum ?? []
|
||||||
|
|
||||||
|
expect(supportedTypes.length).toBeGreaterThan(0)
|
||||||
|
expect(supportedTypes.filter((type) => !tool.description.includes(type))).toEqual([])
|
||||||
|
})
|
||||||
|
|
||||||
test('creates nested inside parent', () => {
|
test('creates nested inside parent', () => {
|
||||||
const { figma } = setupToolTest()
|
const { figma } = setupToolTest()
|
||||||
const tool = getTool('create_shape')
|
const tool = getTool('create_shape')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue