Skip to content

Commit 5ca4225

Browse files
committed
fix(plane): keep the project identifier in its own field
Sharing the identifier subblock between Get Work Item by Identifier and Create Project carried a value typed for one operation into the other. Create Project now has its own projectIdentifier field, applied only when it is non-empty so an agent-supplied identifier is never cleared.
1 parent 19644f6 commit 5ca4225

2 files changed

Lines changed: 25 additions & 6 deletions

File tree

‎apps/sim/blocks/blocks/plane.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ describe('PlaneBlock params', () => {
1414
expect(params({ operation: 'plane_create_project', identifier: 'ENG' })).toMatchObject({
1515
identifier: 'ENG',
1616
})
17+
expect(
18+
params({ operation: 'plane_create_project', projectIdentifier: 'OPS', identifier: 'ENG' })
19+
).toMatchObject({ identifier: 'OPS' })
20+
expect(
21+
params({ operation: 'plane_create_project', projectIdentifier: '', identifier: 'ENG' })
22+
).toMatchObject({ identifier: 'ENG' })
23+
expect(
24+
params({
25+
operation: 'plane_get_work_item_by_identifier',
26+
identifier: 'ENG-1',
27+
projectIdentifier: 'OPS',
28+
})
29+
).toMatchObject({ identifier: 'ENG-1' })
1730
expect(
1831
params({ operation: 'plane_create_link', url: 'https://x.dev', title: 'X' })
1932
).toMatchObject({ url: 'https://x.dev', title: 'X' })

‎apps/sim/blocks/blocks/plane.ts‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export const PlaneBlock: BlockConfig = {
127127
plane_get_project: [{ text: 'Read project', field: 'projectId', core: true }],
128128
plane_create_project: [
129129
{ text: 'Create project', field: 'name', core: true },
130-
{ text: ', with identifier', field: 'identifier' },
130+
{ text: ', with identifier', field: 'projectIdentifier' },
131131
],
132132
plane_list_states: [{ text: 'List states in project', field: 'projectId', core: true }],
133133
plane_list_labels: [{ text: 'List labels in project', field: 'projectId', core: true }],
@@ -252,7 +252,7 @@ export const PlaneBlock: BlockConfig = {
252252
},
253253
},
254254
{
255-
id: 'identifier',
255+
id: 'projectIdentifier',
256256
title: 'Project Identifier',
257257
type: 'short-input',
258258
placeholder: 'e.g., ENG (work items become ENG-1, ENG-2, ...)',
@@ -638,6 +638,7 @@ export const PlaneBlock: BlockConfig = {
638638
labelIds,
639639
workItemIds,
640640
clearFields,
641+
projectIdentifier,
641642
...rest
642643
} = params
643644
const result: Record<string, unknown> = { ...rest }
@@ -657,6 +658,13 @@ export const PlaneBlock: BlockConfig = {
657658
const fieldsToClear = parsePlaneIdList(clearFields)
658659
if (fieldsToClear) result.clearFields = fieldsToClear
659660

661+
if (
662+
operation === 'plane_create_project' &&
663+
typeof projectIdentifier === 'string' &&
664+
projectIdentifier.trim()
665+
) {
666+
result.identifier = projectIdentifier
667+
}
660668
if (operation === 'plane_upload_attachment') {
661669
const normalizedFile = normalizeFileInput(file, { single: true })
662670
if (!normalizedFile) throw new Error('A file is required to upload an attachment.')
@@ -674,10 +682,8 @@ export const PlaneBlock: BlockConfig = {
674682
baseUrl: { type: 'string', description: 'Self-hosted Plane URL (defaults to Plane Cloud)' },
675683
projectId: { type: 'string', description: 'Project ID' },
676684
workItemId: { type: 'string', description: 'Work item ID' },
677-
identifier: {
678-
type: 'string',
679-
description: 'Work item identifier (e.g., PROJ-123) or new project identifier (e.g., ENG)',
680-
},
685+
identifier: { type: 'string', description: 'Work item identifier (e.g., PROJ-123)' },
686+
projectIdentifier: { type: 'string', description: 'New project identifier (e.g., ENG)' },
681687
name: { type: 'string', description: 'Work item, project, or label name' },
682688
description: { type: 'string', description: 'Description (HTML for work items)' },
683689
stateId: { type: 'string', description: 'State ID' },

0 commit comments

Comments
 (0)