diff --git a/ProcessMaker/Mcp/McpSystemSkills.php b/ProcessMaker/Mcp/McpSystemSkills.php deleted file mode 100644 index d170d07a06..0000000000 --- a/ProcessMaker/Mcp/McpSystemSkills.php +++ /dev/null @@ -1,351 +0,0 @@ - - */ - private const LEGACY_SCREEN_CREATION_KEYS = [ - 'skill-1793976475109-l6si55', - ]; - - /** - * @return list - */ - private static function catalog(): array - { - return [ - [ - 'id' => self::SCREEN_CREATION_RULES_ID, - 'name' => 'Screen creation rules', - 'slug' => self::SCREEN_CREATION_RULES_SLUG, - 'when' => 'Before create-screen, update-screen, or validate-screen', - 'file' => 'screen-creation-rules.md', - 'scope' => McpGuidance::SCOPE_SCREENS, - ], - [ - 'id' => 'mcp-system-screen-vue-fields', - 'name' => 'Screen Vue domain fields', - 'slug' => 'screen-vue-fields', - 'when' => 'When implementing uploads, catalog selects, signatures, or other domain UX inside a Vue Component Editor SFC — and during screen refactors with those fields', - 'file' => 'screen-vue-fields.md', - 'scope' => McpGuidance::SCOPE_SCREENS, - ], - [ - 'id' => self::PROCESS_CREATION_RULES_ID, - 'name' => 'Process creation rules', - 'slug' => self::PROCESS_CREATION_RULES_SLUG, - 'when' => 'Before create-process, update-process, or authoring BPMN', - 'file' => 'process-creation-rules.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-planner', - 'name' => 'Process planner', - 'slug' => 'process-planner', - 'when' => 'When designing a new process from a vague request — before create-process; interview tasks, decisions, assignees', - 'file' => 'process-planner.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-node-start-event', - 'name' => 'Process node: Start Event', - 'slug' => 'process-node-start-event', - 'when' => 'When adding or configuring a Start Event (blank, timer, message, signal, conditional)', - 'file' => 'process-node-start-event.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-node-end-event', - 'name' => 'Process node: End Event', - 'slug' => 'process-node-end-event', - 'when' => 'When adding or configuring an End, Terminate, Message, Signal, or Error End Event', - 'file' => 'process-node-end-event.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-node-form-task', - 'name' => 'Process node: Form Task', - 'slug' => 'process-node-form-task', - 'when' => 'When adding or configuring a Form Task (bpmn:Task)', - 'file' => 'process-node-form-task.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-node-manual-task', - 'name' => 'Process node: Manual Task', - 'slug' => 'process-node-manual-task', - 'when' => 'When adding or configuring a Manual Task (bpmn:ManualTask)', - 'file' => 'process-node-manual-task.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-node-script-task', - 'name' => 'Process node: Script Task', - 'slug' => 'process-node-script-task', - 'when' => 'When adding or configuring a Script Task (bpmn:ScriptTask)', - 'file' => 'process-node-script-task.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-node-call-activity', - 'name' => 'Process node: Call Activity', - 'slug' => 'process-node-call-activity', - 'when' => 'When adding or configuring a Call Activity / Sub Process', - 'file' => 'process-node-call-activity.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-node-gateways', - 'name' => 'Process node: Gateways', - 'slug' => 'process-node-gateways', - 'when' => 'When adding or configuring Exclusive, Inclusive, Parallel, or Event-based gateways', - 'file' => 'process-node-gateways.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-node-sequence-flow', - 'name' => 'Process node: Sequence Flow', - 'slug' => 'process-node-sequence-flow', - 'when' => 'When connecting nodes or configuring gateway conditions on sequence flows', - 'file' => 'process-node-sequence-flow.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-node-intermediate-events', - 'name' => 'Process node: Intermediate Events', - 'slug' => 'process-node-intermediate-events', - 'when' => 'When adding intermediate timer, message, signal, or conditional catch/throw events', - 'file' => 'process-node-intermediate-events.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-node-boundary-events', - 'name' => 'Process node: Boundary Events', - 'slug' => 'process-node-boundary-events', - 'when' => 'When attaching boundary timer, message, error, signal, conditional, or escalation events', - 'file' => 'process-node-boundary-events.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-node-service-task', - 'name' => 'Process node: Service Task', - 'slug' => 'process-node-service-task', - 'when' => 'When adding a Service Task or choosing which package connector skill to load (email, PDF, Slack, FlowGenie, …)', - 'file' => 'process-node-service-task.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-connector-email', - 'name' => 'Process connector: Send Email', - 'slug' => 'process-connector-email', - 'when' => 'When adding a Send Email Service Task, or Form Task email_notifications / Actions-by-Email toggles', - 'file' => 'process-connector-email.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-connector-pdf', - 'name' => 'Process connector: PDF Generator', - 'slug' => 'process-connector-pdf', - 'when' => 'When adding a PDF Generator Service Task', - 'file' => 'process-connector-pdf.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-connector-slack', - 'name' => 'Process connector: Slack Notification', - 'slug' => 'process-connector-slack', - 'when' => 'When adding a Slack Notification Service Task', - 'file' => 'process-connector-slack.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-connector-decision-task', - 'name' => 'Process connector: Decision Task', - 'slug' => 'process-connector-decision-task', - 'when' => 'When adding a Decision Task / decision table Service Task', - 'file' => 'process-connector-decision-task.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-connector-flowgenie', - 'name' => 'Process connector: FlowGenie', - 'slug' => 'process-connector-flowgenie', - 'when' => 'When adding a FlowGenie Service Task (package-ai)', - 'file' => 'process-connector-flowgenie.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-connector-uipath', - 'name' => 'Process connector: UiPath', - 'slug' => 'process-connector-uipath', - 'when' => 'When adding a UiPath / RPA Service Task (package-rpa)', - 'file' => 'process-connector-uipath.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-connector-actions-by-email', - 'name' => 'Process connector: Actions By Email', - 'slug' => 'process-connector-actions-by-email', - 'when' => 'When adding an Actions By Email Call Activity (interactive email options)', - 'file' => 'process-connector-actions-by-email.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-connector-docusign', - 'name' => 'Process connector: DocuSign', - 'slug' => 'process-connector-docusign', - 'when' => 'When adding a DocuSign Call Activity / envelope template node', - 'file' => 'process-connector-docusign.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-node-pools', - 'name' => 'Process node: Pools and Lanes', - 'slug' => 'process-node-pools', - 'when' => 'When modeling pools, lanes, collaborations, or message flows between participants', - 'file' => 'process-node-pools.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-web-entry', - 'name' => 'Process Web Entry', - 'slug' => 'process-web-entry', - 'when' => 'When configuring Web Entry on a Start Event or Form Task', - 'file' => 'process-web-entry.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-process-validation', - 'name' => 'Process validation', - 'slug' => 'process-validation', - 'when' => 'Before deploy/create/update of a process, or when validating BPMN', - 'file' => 'process-validation.md', - 'scope' => McpGuidance::SCOPE_PROCESSES, - ], - [ - 'id' => 'mcp-system-screen-refactor-parity', - 'name' => 'Screen refactor parity', - 'slug' => 'screen-refactor-parity', - 'when' => 'When refactoring an existing traditional Screen Builder screen into a Vue Component Editor SFC — preserve all fields, instructional help (images/how-to), calcs and watchers in the Vue SFC', - 'file' => 'screen-refactor-parity.md', - 'scope' => McpGuidance::SCOPE_SCREENS, - ], - [ - 'id' => self::DATA_CONNECTOR_CREATION_RULES_ID, - 'name' => 'Data Connector creation rules', - 'slug' => self::DATA_CONNECTOR_CREATION_RULES_SLUG, - 'when' => 'Before create-data-connector or update-data-connector', - 'file' => 'data-connector-creation-rules.md', - 'scope' => McpGuidance::SCOPE_DATA_CONNECTORS, - ], - [ - 'id' => 'mcp-system-data-connector-in-process', - 'name' => 'Data Connector in a process', - 'slug' => 'data-connector-in-process', - 'when' => 'When wiring a Data Connector into BPMN Service Task or callback Call Activity pm:config, or configuring process API calls', - 'file' => 'data-connector-in-process.md', - 'scope' => McpGuidance::SCOPE_DATA_CONNECTORS, - ], - [ - 'id' => self::COLLECTION_CREATION_RULES_ID, - 'name' => 'Collection creation rules', - 'slug' => self::COLLECTION_CREATION_RULES_SLUG, - 'when' => 'Before create-collection or update-collection', - 'file' => 'collection-creation-rules.md', - 'scope' => McpGuidance::SCOPE_DATA_CONNECTORS, - ], - [ - 'id' => 'mcp-system-collection-test-data', - 'name' => 'Collection test data', - 'slug' => 'collection-test-data', - 'when' => 'When adding sample/demo records with create-collection-records', - 'file' => 'collection-test-data.md', - 'scope' => McpGuidance::SCOPE_DATA_CONNECTORS, - ], - [ - 'id' => self::FLOWGENIE_CREATION_RULES_ID, - 'name' => 'FlowGenie creation rules', - 'slug' => self::FLOWGENIE_CREATION_RULES_SLUG, - 'when' => 'Before create-flow-genie, update-flow-genie, or validate-flow-genie', - 'file' => 'flowgenie-creation-rules.md', - 'scope' => McpGuidance::SCOPE_FLOW_GENIES, - ], - ]; - } - - /** - * @return list - */ - public static function definitions(): array - { - $definitions = []; - foreach (self::catalog() as $skill) { - $definitions[] = [ - 'id' => $skill['id'], - 'name' => $skill['name'], - 'slug' => $skill['slug'], - 'when' => $skill['when'], - 'content' => self::loadMarkdown($skill['file']), - 'system' => true, - 'scope' => $skill['scope'], - ]; - } - - return $definitions; - } - - /** - * @return list - */ - public static function reservedKeys(): array - { - $keys = self::LEGACY_SCREEN_CREATION_KEYS; - foreach (self::catalog() as $skill) { - $keys[] = $skill['id']; - $keys[] = $skill['slug']; - } - - return array_values(array_unique($keys)); - } - - private static function loadMarkdown(string $filename): string - { - $path = __DIR__ . '/skills/' . $filename; - if (!is_file($path)) { - return ''; - } - - return trim((string) file_get_contents($path)); - } -} diff --git a/ProcessMaker/Mcp/Processes/ProcessPlanner.php b/ProcessMaker/Mcp/Processes/ProcessPlanner.php index 4083745538..36c27cc70a 100644 --- a/ProcessMaker/Mcp/Processes/ProcessPlanner.php +++ b/ProcessMaker/Mcp/Processes/ProcessPlanner.php @@ -78,7 +78,7 @@ public function plan(User $user, array $input): array 'ready' => $ready, 'goal' => $goal, 'agent_instructions' => $ready - ? 'Blueprint is complete enough to design screens (if needed), then author BPMN and call validate-process before create-process. Load process-creation-rules and only the node skills you need. Use list-users / list-groups if any assignment id is still unclear.' + ? 'Blueprint is complete enough to design screens (if needed), then author BPMN and call validate-process before create-process. Follow the pm4-process skill (and the connector skills you need). Use list-users / list-groups if any assignment id is still unclear.' : 'Do not call create-process yet. Ask the human the open_questions (batch a few related ones). After they answer, call plan-process again with the same goal and filled answer fields. Use list-users and list-groups when discussing assignees so the human can pick real people/groups.', 'open_questions' => $open, 'answered' => $answers, diff --git a/ProcessMaker/Mcp/Screens/ScreenConfigValidator.php b/ProcessMaker/Mcp/Screens/ScreenConfigValidator.php index a972781fd4..867f835206 100644 --- a/ProcessMaker/Mcp/Screens/ScreenConfigValidator.php +++ b/ProcessMaker/Mcp/Screens/ScreenConfigValidator.php @@ -63,7 +63,7 @@ public function validate(?array $config, ?string $type = null): array $warnings[] = $this->issue( null, 'prefer_vue_component_editor', - 'FORM screens should use VueComponentRenderTemplate as the main UI (see screen-creation-rules). Native FormSelectList/FormInput layouts are fragile and often miss required options.', + 'FORM screens should use VueComponentRenderTemplate as the main UI (see the pm4-screen skill). Native FormSelectList/FormInput layouts are fragile and often miss required options.', ); } diff --git a/ProcessMaker/Mcp/Servers/DataConnectorsServer.php b/ProcessMaker/Mcp/Servers/DataConnectorsServer.php index 4c9587c09a..3c7fd418b7 100644 --- a/ProcessMaker/Mcp/Servers/DataConnectorsServer.php +++ b/ProcessMaker/Mcp/Servers/DataConnectorsServer.php @@ -39,15 +39,15 @@ create-data-connector requires name, type, authtype, and data_source_category_id. endpoints is a map keyed by purpose; each endpoint needs purpose, method, and url. Credentials are write-only (not returned by get/list). -Load skill `data-connector-creation-rules`. For BPMN Service Task wiring load `data-connector-in-process` -(implementation `package-data-sources/data-source-task-service`, pm:config dataSource + endpoint). +Follow the `pm4-data-connector` skill from the ProcessMaker Skills repository (`npx skills add processmaker/skills`), +including BPMN Service Task wiring (implementation `package-data-sources/data-source-task-service`, pm:config dataSource + endpoint). ## Collections Use list-collections before creating one. create-collection requires name, description, create_screen_id, read_screen_id, update_screen_id (create those screens via Screens MCP first when missing). Creating a collection may auto-create a matching Data Connector for `/collections/{id}/records`. -Add demo rows with create-collection-records (skill `collection-test-data`). +Add demo rows with create-collection-records (see the `pm4-collection` skill). MARKDOWN)] class DataConnectorsServer extends Server { diff --git a/ProcessMaker/Mcp/Servers/FlowGenieServer.php b/ProcessMaker/Mcp/Servers/FlowGenieServer.php index 9db3968fd2..5fe0f99ad6 100644 --- a/ProcessMaker/Mcp/Servers/FlowGenieServer.php +++ b/ProcessMaker/Mcp/Servers/FlowGenieServer.php @@ -36,9 +36,8 @@ create-flow-genie requires name, description, and flow_genie_category_id. config is the agent JSON (instructions, model, provider, output_type, tools, mcp_servers, …). Secrets (provider_api_key, MCP tokens) are write-only — get/list redact them. -After creating a FlowGenie, wire it into BPMN with Processes MCP skill `process-connector-flowgenie` -(`implementation` `package-ai/processmaker-ai-task`, pm:config `flow_genie_id` + `output_variable`). -Load skill `flowgenie-creation-rules`. +After creating a FlowGenie, wire it into BPMN as described in the `pm4-flow-genie` skill from the ProcessMaker Skills repository +(`npx skills add processmaker/skills`): `implementation` `package-ai/processmaker-ai-task`, pm:config `flow_genie_id` + `output_variable`. MARKDOWN)] class FlowGenieServer extends Server { diff --git a/ProcessMaker/Mcp/Servers/ProcessServer.php b/ProcessMaker/Mcp/Servers/ProcessServer.php index b0f2681c53..e98021343b 100644 --- a/ProcessMaker/Mcp/Servers/ProcessServer.php +++ b/ProcessMaker/Mcp/Servers/ProcessServer.php @@ -32,15 +32,15 @@ 3. Do not load every skill by default. Follow the system prompt and any skills you loaded. ## Designing a new process -When the request is vague or incomplete, call `plan-process` first (load skill `process-planner`). +When the request is vague or incomplete, call `plan-process` first. Ask the human the returned `open_questions`. Use `list-users` and `list-groups` so they can pick real assignees / process manager. Re-call `plan-process` with answers until `ready` is true, then build screens/BPMN. Use list-processes to search before creating one. create-process requires name and description; bpmn is optional (empty template if omitted — add a start event before running). For MCP create-process/update-process use numeric pm:screenRef / pm:scriptRef (list-screens after create-screen). Portable ${screen:title} only resolves via package-plg deploy-process. -For package connectors (email, PDF, Slack, FlowGenie, Decision Task, UiPath, DocuSign, Actions By Email, Data Connector) load `process-node-service-task` then the matching `process-connector-*` / `data-connector-in-process` skill — do not invent `implementation` strings. -For FlowGenie Service Tasks: create/configure the asset via FlowGenies MCP (`create-flow-genie`) first, then set numeric `flow_genie_id` in pm:config (skill `process-connector-flowgenie`). +For BPMN structure, node settings, and package connectors (email, PDF, Slack, FlowGenie, Decision Task, UiPath, DocuSign, IDP, Actions By Email, Data Connector), follow the matching `pm4-*` skill from the ProcessMaker Skills repository (`npx skills add processmaker/skills`, start with `pm4-process`). Do not invent `implementation` strings. +For FlowGenie Service Tasks: create/configure the asset via FlowGenies MCP (`create-flow-genie`) first, then set numeric `flow_genie_id` in pm:config. Call validate-process before create/update when unsure. update-process changes only the fields you send. MARKDOWN)] diff --git a/ProcessMaker/Mcp/Servers/ScreenServer.php b/ProcessMaker/Mcp/Servers/ScreenServer.php index f5793a1f5f..f02cc26915 100644 --- a/ProcessMaker/Mcp/Servers/ScreenServer.php +++ b/ProcessMaker/Mcp/Servers/ScreenServer.php @@ -35,8 +35,8 @@ type is usually FORM or DISPLAY. config is the screen builder page array; every control in page.items must include `"inspector": []` (or a real inspector list) or the designer crashes. create/update reject configs with empty FormSelectList options (missing optionsList). -Build coherent Vue SFCs only (VueComponentRenderTemplate). Implement file upload, catalog selects (Collections via apiClient), and signature pads inside the Vue component — do not add native FileUpload / FormSelectList / SignaturePad siblings. Load skills screen-creation-rules and screen-vue-fields. -When refactoring an existing traditional screen into Vue, also load skill screen-refactor-parity: preserve every field/variable on request data; keep instructional help (FormImage diagrams, how-to HTML, tip alerts, helper links) restyled/condensed as needed but not omitted; review each native SB control config and reimplement the same behavior in the Vue SFC (validation, visibility, options, events — UI-only keys like colors/CSS may change for redesign); inventory nested screens and recreate them as shared Vue child SFCs reused by every parent that nested them; reimplement calcs and invoke backend scripts / Data Connectors from the Vue SFC (Vue-only screens do not fire SB computed/watchers — leave those arrays empty). Respect original conditionalHide/readonly — do not show always-hidden data-only fields as editable controls. +New FORM/DISPLAY screens are built as a Vue Component Editor mount (VueComponentRenderTemplate with a thin contentVue); do not add native FileUpload / FormSelectList / SignaturePad siblings. +For the full rules (control shape, component registration, domain fields, refactor parity), follow the `pm4-screen` skill from the ProcessMaker Skills repository (`npx skills add processmaker/skills`). update-screen changes only the fields you send. delete-screen cannot remove a default screen. MARKDOWN)] diff --git a/ProcessMaker/Mcp/Tools/Collections/CreateCollectionRecordsTool.php b/ProcessMaker/Mcp/Tools/Collections/CreateCollectionRecordsTool.php index 4bf1a40c5e..b111384f92 100644 --- a/ProcessMaker/Mcp/Tools/Collections/CreateCollectionRecordsTool.php +++ b/ProcessMaker/Mcp/Tools/Collections/CreateCollectionRecordsTool.php @@ -16,7 +16,7 @@ #[Name('create-collection-records')] #[Title('Create Collection Records')] -#[Description('Adds one or more test/demo records to a collection. Pass records (array of data objects) or data (single object). Load skill collection-test-data.')] +#[Description('Adds one or more test/demo records to a collection. Pass records (array of data objects) or data (single object). See the pm4-collection skill.')] class CreateCollectionRecordsTool extends RespondingTool { public function handle(Request $request, CollectionCatalog $catalog): Response|ResponseFactory diff --git a/ProcessMaker/Mcp/Tools/Collections/CreateCollectionTool.php b/ProcessMaker/Mcp/Tools/Collections/CreateCollectionTool.php index 1adb2c4fd4..98e28d79ab 100644 --- a/ProcessMaker/Mcp/Tools/Collections/CreateCollectionTool.php +++ b/ProcessMaker/Mcp/Tools/Collections/CreateCollectionTool.php @@ -16,7 +16,7 @@ #[Name('create-collection')] #[Title('Create Collection')] -#[Description('Creates a collection. Requires name, description, and create/read/update screen ids. May auto-create a Data Connector for records. Load skill collection-creation-rules first.')] +#[Description('Creates a collection. Requires name, description, and create/read/update screen ids. May auto-create a Data Connector for records. See the pm4-collection skill.')] class CreateCollectionTool extends RespondingTool { public function handle(Request $request, CollectionCatalog $catalog): Response|ResponseFactory diff --git a/ProcessMaker/Mcp/Tools/DataConnectors/CreateDataConnectorTool.php b/ProcessMaker/Mcp/Tools/DataConnectors/CreateDataConnectorTool.php index 419132a531..88c72acdb8 100644 --- a/ProcessMaker/Mcp/Tools/DataConnectors/CreateDataConnectorTool.php +++ b/ProcessMaker/Mcp/Tools/DataConnectors/CreateDataConnectorTool.php @@ -16,7 +16,7 @@ #[Name('create-data-connector')] #[Title('Create Data Connector')] -#[Description('Creates a REST/SOAP Data Connector. Requires name, type, authtype, data_source_category_id. Load skill data-connector-creation-rules first.')] +#[Description('Creates a REST/SOAP Data Connector. Requires name, type, authtype, data_source_category_id. See the pm4-data-connector skill.')] class CreateDataConnectorTool extends RespondingTool { public function handle(Request $request, DataConnectorCatalog $catalog): Response|ResponseFactory diff --git a/ProcessMaker/Mcp/Tools/FlowGenies/CreateFlowGenieTool.php b/ProcessMaker/Mcp/Tools/FlowGenies/CreateFlowGenieTool.php index 4ce37aa382..3499e9df7c 100644 --- a/ProcessMaker/Mcp/Tools/FlowGenies/CreateFlowGenieTool.php +++ b/ProcessMaker/Mcp/Tools/FlowGenies/CreateFlowGenieTool.php @@ -16,7 +16,7 @@ #[Name('create-flow-genie')] #[Title('Create FlowGenie')] -#[Description('Creates a FlowGenie asset. Requires name, description, flow_genie_category_id. Prefer validate-flow-genie then set config.instructions. Load skill flowgenie-creation-rules.')] +#[Description('Creates a FlowGenie asset. Requires name, description, flow_genie_category_id. Prefer validate-flow-genie then set config.instructions. See the pm4-flow-genie skill.')] class CreateFlowGenieTool extends RespondingTool { public function handle(Request $request, FlowGenieCatalog $catalog): Response|ResponseFactory diff --git a/ProcessMaker/Mcp/Tools/Processes/ValidateProcessTool.php b/ProcessMaker/Mcp/Tools/Processes/ValidateProcessTool.php index fe058153df..bec615f01a 100644 --- a/ProcessMaker/Mcp/Tools/Processes/ValidateProcessTool.php +++ b/ProcessMaker/Mcp/Tools/Processes/ValidateProcessTool.php @@ -17,7 +17,7 @@ #[Name('validate-process')] #[Title('Validate Process')] -#[Description('Validates BPMN without saving. Pass bpmn XML and/or an existing process id. Returns ok, errors, and warnings (schema + semantic checks). Load process-validation skill for the full checklist.')] +#[Description('Validates BPMN without saving. Pass bpmn XML and/or an existing process id. Returns ok, errors, and warnings (schema + semantic checks). See the pm4-process skill (verify.md) for the full checklist.')] #[IsReadOnly] #[IsIdempotent] class ValidateProcessTool extends ProcessTool diff --git a/ProcessMaker/Mcp/Tools/Screens/ValidateScreenTool.php b/ProcessMaker/Mcp/Tools/Screens/ValidateScreenTool.php index 38e2aa3be2..f0d993d900 100644 --- a/ProcessMaker/Mcp/Tools/Screens/ValidateScreenTool.php +++ b/ProcessMaker/Mcp/Tools/Screens/ValidateScreenTool.php @@ -17,7 +17,7 @@ #[Name('validate-screen')] #[Title('Validate Screen')] -#[Description('Validates a Screen Builder config without saving. Pass config and optional type, and/or an existing screen id. Returns ok, errors, and warnings (select options, Vue component wiring). Load screen-creation-rules for the checklist.')] +#[Description('Validates a Screen Builder config without saving. Pass config and optional type, and/or an existing screen id. Returns ok, errors, and warnings (select options, Vue component wiring). See the pm4-screen skill for the checklist.')] #[IsReadOnly] #[IsIdempotent] class ValidateScreenTool extends ScreenTool diff --git a/ProcessMaker/Mcp/skills/collection-creation-rules.md b/ProcessMaker/Mcp/skills/collection-creation-rules.md deleted file mode 100644 index fa17b99fb6..0000000000 --- a/ProcessMaker/Mcp/skills/collection-creation-rules.md +++ /dev/null @@ -1,55 +0,0 @@ -# Skill: Collection creation rules - -Use before `create-collection` / `update-collection`. - -## Required fields - -| Field | Notes | -|-------|--------| -| `name` | Unique; `alpha_spaces` | -| `description` | Required | -| `create_screen_id` | FORM screen for create | -| `read_screen_id` | DISPLAY (or FORM) screen for view | -| `update_screen_id` | FORM screen for edit | - -Optional: `custom_title` (Mustache for record title), `obfuscate`, `signal_create` / `signal_update` / `signal_delete`, `type` (`NORMAL` default; `RAG` uses seeded RAG screens). - -## When to create a Collection (select-list catalogs) — **always for multi-option selects** - -**Mandatory** whenever a process/screen select, radio, or checkbox group has **more than two** options. Do this **before** authoring the consumer Vue SFC / process screen: - -| Examples | Create Collection? | -|----------|--------------------| -| Leave types, approval decisions (3+), departments, countries, document types, channels, risk bands, product types | **Yes — always** | -| Yes/No, True/False only | No (hard-code in Vue OK) | - -Then load those records **inside the process Vue SFC** (`ProcessMaker.apiClient.get('collections/{id}/records')` or the auto Data Connector) and bind a Vue ` - - - -``` - -If you catch yourself writing more than a short component tag (plus optional trivial wrapper) in `contentVue`, stop and move that markup into a Vue component instead. - -## Where the Vue component comes from - -Keys look like: - -| Kind | Key shape | When to use | -|------|-----------|-------------| -| Catalog / package | `@/…/ComponentName.vue` | Official PLG / package-plg components already registered for Screen Builder | -| DB-only custom | `custom://slug` | Admin Custom Vue Components with no official fallback | - -Rules: - -1. Prefer **reusing** an existing component. Discover with `list-screens` / `get-screen` and copy its `contentVue`, `handlerVue`, and especially each `{ "name", "key" }` from `config.components`. -2. Never invent or guess a `key`. Copy it from a working reference screen or from the Custom Vue Components / package catalog. -3. If the UI does not exist yet, **create the Vue component first** (package catalog SFC + **catalog registration** + build/publish, or a `custom://` Custom Vue Component), then publish the screen that mounts it. Do not ship the UI as inline `contentVue` while waiting for a component. -4. Screens MCP creates/updates **screens** only. Component source lives outside screen JSON (`template` / `script` / `.vue` files). Do not pretend a giant `contentVue` string is a component. - -`componentName` is documentation / inspector only; runtime resolution uses the tag in `contentVue` plus `components` / globals. - -## Register official package-plg components (mandatory for new `@/…` SFCs) - -Screen Builder resolves official tags via `registerPublicScreenCatalog()`, which loads **only** entries listed in: - -`package-plg/resources/js/designer/public-screen-components.json` - -A Vite glob of `examples/**/*.vue` bundles the SFC, but **without a catalog row the preview stays blank** (siblings already in the JSON, e.g. `PaymentStepForm`, still render). - -When you add a new official component (typical path: `resources/js/components/screen-builder/examples/YourForm.vue`): - -1. **Catalog** — append `{ "name": "YourForm", "key": "@/components/screen-builder/examples/YourForm.vue" }` to `public-screen-components.json`. If the parent uses child components, list them in the parent's nested `components` array **and** as their own top-level `{ name, key }` rows. -2. **Build** — from `Sites/packages/package-plg`: `npm run prod` (rebuilds form + display screen-builder bundles). -3. **Publish** — from `Sites/processmaker`: `php artisan vendor:publish --tag=package-plg --force` (PM serves `public/vendor/processmaker/packages/package-plg/js/`, not the package repo `public/` tree). -4. **Hard-refresh** Screen Builder in the browser after publish. - -Do this **before claiming the screen is done**. Skipping catalog/build/publish is a incomplete delivery even if `create-screen` succeeded. - -`custom://` components are registered in Admin → Custom Vue Components (DB); they do **not** use `public-screen-components.json`, but still need a real `{name,key}` on the screen. - -## Validate before save (mandatory) - -Call **`validate-screen`** with the draft `config` (and `type`) before `create-screen` / `update-screen`. create/update also run the same checks and **reject** hard errors. - -| Code | Severity | Meaning | -|------|----------|---------| -| `select_options_empty` | error | `FormSelectList` + `provideData` has no options | -| `select_options_list_missing` | error | Has `jsonData` but missing/empty `optionsList` — dropdown renders **empty** and required selects block submit | -| `vue_content_missing` / `vue_components_missing` / `vue_component_entry_invalid` | error | `VueComponentRenderTemplate` wiring incomplete | -| `prefer_vue_component_editor` | warning | FORM built only with native SB controls | -| `vue_handler_missing_return` / `vue_ignore_mustache` | warning | Vue editor hygiene | - -### FormSelectList (if you must use native selects) - -`jsonData` alone is **not enough**. Screen Builder needs a non-empty `optionsList`: - -```json -"options": { - "dataSource": "provideData", - "key": "value", - "value": "content", - "jsonData": "[{\"value\":\"Travel\",\"content\":\"Travel\"}]", - "optionsList": [ - { "value": "Travel", "content": "Travel" } - ] -} -``` - -Prefer putting selects inside a registered Vue component (see PTO / Expense Registration examples) instead of native `FormSelectList`. - -## Workflow (follow in order) - -1. **Discover** — `list-screens` / `get-screen` so you do not duplicate an existing screen. Prefer copying a similar screen’s Vue Component Editor block when reusing a catalog/custom tag. -2. **Ensure the Vue component exists and is registered** — reuse a real `{name,key}` already in the catalog, or create the SFC + add `public-screen-components.json` + `npm run prod` + `vendor:publish --tag=package-plg --force` (or create/register a `custom://` component) **before** the screen depends on it. -3. **Validate** — `validate-screen` with `config` + `type`; fix every `errors[]` entry. -4. **Create or update** — `create-screen` / `update-screen` with `type` `FORM` or `DISPLAY`, title, description, `screen_category_id`, and a page whose `items` contain a `VueComponentRenderTemplate` control whose `contentVue` only mounts that component. -5. **Verify** — `get-screen` and confirm: - - `component` is `VueComponentRenderTemplate` - - `ignoreMustache` is true - - `contentVue` is a thin mount of a named tag (not a full page of markup) - - `handlerVue` starts with `return` - - every non-global tag in `contentVue` has a matching `{name,key}` in `components` - - for new `@/…` keys: the name appears in `public-screen-components.json` and the published vendor JS includes the component (Screen Builder preview actually renders) - -## Required control shape - -```json -{ - "component": "VueComponentRenderTemplate", - "editor-component": "VueComponentEditor", - "editor-control": "VueComponentEditor", - "label": "Vue component Editor", - "inspector": [], - "config": { - "icon": "fas fa-pencil-ruler", - "interactive": true, - "componentName": "PetRegistrationForm", - "contentVue": "", - "handlerVue": "return {\n data() {\n return {\n data: this.data || {},\n configuration: (defaultConfiguration) => ({ ...defaultConfiguration }),\n };\n },\n};", - "components": [ - { - "name": "PetRegistrationForm", - "key": "@/screens/pets/PetRegistrationForm.vue" - } - ], - "renderVarHtml": null, - "ignoreMustache": true - } -} -``` - -The `key` above is an **example shape**. Replace it only with a key taken from `get-screen` on a working reference or from the real component catalog / Custom Vue Components admin. Never invent paths. - -### Typical page config - -```json -{ - "name": "Page 1", - "items": [ - { - "component": "VueComponentRenderTemplate", - "editor-component": "VueComponentEditor", - "editor-control": "VueComponentEditor", - "label": "Vue component Editor", - "inspector": [], - "config": { - "componentName": "PetRegistrationForm", - "contentVue": "", - "handlerVue": "return {\n created() {\n if (this.data && this.data.petName === undefined) {\n this.$set(this.data, 'petName', '');\n }\n },\n};", - "components": [ - { - "name": "PetRegistrationForm", - "key": "@/screens/pets/PetRegistrationForm.vue" - } - ], - "ignoreMustache": true, - "interactive": true, - "icon": "fas fa-pencil-ruler" - } - } - ] -} -``` - -Add a `FormButton` with `event: "submit"` only when the FORM needs an external submit control. Prefer calling `this.submit()` / `:submit="submit"` from the Vue component when the UI owns the action. - -Useful full-height CSS many screens share: - -```css -[data-cy="screen-renderer"] { height: 100%; } -[data-cy="screen-renderer"] > div, -[data-cy="screen-renderer"] > div > div, -[data-cy="screen-renderer"] > div > div > div { height: 100%; } -``` - -## Field meanings - -| Field | Purpose | -|-------|---------| -| `componentName` | Inspector / docs label for the primary mounted component. | -| `contentVue` | Thin Vue 2 **template** that mounts registered component tag(s). Prefer one root component tag. | -| `handlerVue` | Trusted mixin body. Must `return { ... }`. Init reactive `$data` keys with `created()` + `this.$set(this.data, …)`. Keep thin — no UI markup here. | -| `components` | Explicit `{ "name", "key" }` list for every catalog (`@/…vue`) or custom (`custom://slug`) tag used in `contentVue`. | -| `ignoreMustache` | Keep `true` for Vue templates. | -| `interactive` | Keep `true`. | - -`data` in `contentVue` / `handlerVue` is Screen Builder request `$data`. Bind into the child with `v-model` / props; write back with emits or `$set`. Request user (when needed) is `this.data._user` or `ProcessMaker.user`, not `this._user`. - -## Authoring rules - -- Vue 2 Options API only inside `handlerVue` and custom component scripts (no `