From bdda44ef8affab43cc89764af41e3ccf45ade194 Mon Sep 17 00:00:00 2001 From: Michael Dieringer <65093775+MichaelDieringer@users.noreply.github.com> Date: Sun, 21 Jun 2026 11:00:06 +0200 Subject: [PATCH] Add BC MCP task lookup recipe and commit message task ID rule --- .../commit-message-must-include-bc-task-id.md | 63 +++++++++++++ .../mcp/bc-mcp-find-active-task-for-branch.md | 89 +++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 custom/knowledge/architecture/commit-message-must-include-bc-task-id.md create mode 100644 custom/knowledge/mcp/bc-mcp-find-active-task-for-branch.md diff --git a/custom/knowledge/architecture/commit-message-must-include-bc-task-id.md b/custom/knowledge/architecture/commit-message-must-include-bc-task-id.md new file mode 100644 index 0000000..a12aa09 --- /dev/null +++ b/custom/knowledge/architecture/commit-message-must-include-bc-task-id.md @@ -0,0 +1,63 @@ +--- +name: commit-message-must-include-bc-task-id +description: > + Every commit message must begin with the BC task ID in [#id] format, + where id is the global taskId from the CUR MCP Active Tasks page. +layer: 2 +category: architecture +--- + +# Commit Message Must Include BC Task ID + +## Description + +Every commit must reference the BC sub-task it belongs to by prefixing the +message with `[#taskId]`, where `taskId` is the globally unique, sequential +task identifier from the **CUR MCP Active Tasks** page (field `taskId`). + +This links code history directly to customer-facing work items in BC, enables +time registration traceability, and is consistent with the convention already +used across Curabis teams. + +## Anti Pattern + +``` +Add Price Lookup feature — FindPrice page, tier prices, currency conversion +``` + +No traceability. Impossible to find the BC task from git history. + +## Best Practice + +``` +[#8738] Add Price Lookup feature — FindPrice page, tier prices, currency conversion +[#8738] Add 22 UI tests for PRICING LOOKUP feature +[#8738] Add translations, shared project memory and cspell config +``` + +## The two task numbers — use taskId, not taskNo + +The sub-task has two numbers — do not confuse them: + +| Field | Description | Use for | +|---|---|---| +| `taskNo` | Sequential within the project (e.g. 42) | Referencing within a project | +| `taskId` | Globally unique across all projects (e.g. 8738) | **Commit messages** | + +Always use `taskId` in commit messages. It is unambiguous across all projects +and repos. + +## How to find the taskId before committing + +1. Get the current branch: `git branch --show-current` +2. Find the linked project via BC MCP (see `[[bc-mcp-find-active-task-for-branch]]`) +3. Read `taskId` from the matching active task +4. Prefix every commit on this branch with `[#taskId]` + +If no task exists for the branch, create one first (see bc-mcp.agent.md +create-task workflow) or ask the project manager to register the work. + +## Scope + +All commits that reach the main branch — feature, fix, test, chore, docs. +Merge commits and auto-generated commits (renovate, al-go) are exempt. diff --git a/custom/knowledge/mcp/bc-mcp-find-active-task-for-branch.md b/custom/knowledge/mcp/bc-mcp-find-active-task-for-branch.md new file mode 100644 index 0000000..33aead1 --- /dev/null +++ b/custom/knowledge/mcp/bc-mcp-find-active-task-for-branch.md @@ -0,0 +1,89 @@ +--- +name: bc-mcp-find-active-task-for-branch +description: > + Standard recipe for finding the BC sub-task linked to the current git branch, + including exact action names and field names for each BC MCP endpoint. +layer: 2 +category: mcp +--- + +# BC MCP: Find Active Task for Branch + +## Description + +When committing, closing a branch, or updating dev status, the agent must +look up the BC sub-task linked to the current branch. This recipe documents +the exact steps and action names to do it efficiently with minimal roundtrips. + +Do **not** start with `bc_actions_search` — it fetches and searches the full +action catalog and is slow. Use `bc_actions_describe` with the known action +name to get a schema, then `bc_actions_invoke` to call it. + +## Known action names + +Derived from the AL page source (EntityName property + PAG + page ID): + +| Page | EntityName (AL) | List action | Modify action | Create action | +|---|---|---|---|---| +| 6102900 CUR MCP Active Tasks | `activeTask` | `List_activeTask_PAG6102900` | `Modify_activeTask_PAG6102900` | — | +| 6102901 CUR MCP Projects | `project` | `List_project_PAG6102901` | — | — | +| 6102902 CUR MCP Task Comments | `taskComment` | `List_taskComment_PAG6102902` | `Modify_taskComment_PAG6102902` | `Create_TaskComment_PAG6102902` | +| 6102904 CUR MCP Project Repository | `projectRepository` | `List_projectRepository_PAG6102904` | `Modify_projectRepository_PAG6102904` | — | +| 6102905 CUR MCP Create Task | `newTask` | — | — | `Create_newTask_PAG6102905` | +| 50009 consultants | `consultant` | `List_consultant_PAG50009` | — | — | + +> **Note:** Verify action names after a fresh session with `bc_actions_search` +> if any of the above return an error. The naming convention is +> `{Verb}_{EntityNamePascalCase}_PAG{PageId}`. + +## Standard recipe: find task for current branch + +``` +1. git branch --show-current → e.g. "PriceLookup" +2. git remote get-url origin → e.g. "https://github.com/Curabis/Wareco.git" +3. bc_actions_invoke List_project_PAG6102901 + filter: "gitHubRepository eq 'https://github.com/Curabis/Wareco.git'" + → get projectNo (e.g. "W-2024-001") +4. bc_actions_invoke List_activeTask_PAG6102900 + filter: "projectNo eq 'W-2024-001' and gitHubBranch eq 'PriceLookup'" + → get taskId (global commit-message ID), taskNo, description, status +``` + +If step 3 returns no project, the repo is not linked — see `[[bc-mcp-link-repo-to-project]]`. +If step 4 returns no task, the branch has no registered task — create one or ask the PM. + +## Key fields on active tasks + +| Field | Description | +|---|---| +| `taskId` | **Global unique ID — use in commit messages** | +| `taskNo` | Sequential within project — use for customer portal links | +| `projectNo` | Parent project | +| `description` | Task description | +| `status` | BC-managed: Created → Accepted → In progress → Finished → Invoiced | +| `gitHubBranch` | Writable — set when starting work | +| `gitHubDevStatus` | Writable — Backlog / In Progress / Done / On Hold | +| `gitHubRepository` | **Obsolete** — always read repo from project, not from task | + +## Writable fields — and what is forbidden + +Only write `gitHubBranch` and `gitHubDevStatus` on active tasks. +Never write `status` — it controls time registration and invoicing in BC. +Never write `gitHubRepository` on the task (obsolete, will be removed in v29). + +## Developer identity under S2S auth + +The bridge runs as app identity `BC_DevelopmentMCP`. To attribute work: + +``` +1. git config user.email → developer's git email +2. bc_actions_invoke List_consultant_PAG50009 + filter: "email eq 'mic.dieringer@gmail.com'" + → get employeeCode (e.g. "MID") +3. Use employeeCode to filter "my tasks": + List_activeTask_PAG6102900 filter: "taskResponsible eq 'MID'" +4. Sign status comments: end with "— Michael" so attribution survives S2S +``` + +Some developers use personal email for git but have a Curabis email as secondary +on GitHub. If the git email doesn't match, try the `@curabis.dk` variant.