Tilfoej Microsoft Learn MCP til udviklere + goer add_repo konkret

To ting fra QualityHub-sporet:

1. Udviklere faar nu samme Microsoft Learn MCP som Mode C-supportbrugere
   allerede havde (https://learn.microsoft.com/api/mcp, HTTP, ingen auth) -
   registreret maskin-globalt via sync-bcquality-knowledge.ps1, samme
   moenster som al/businesscentral. Lukker hullet hvor udviklere kun havde
   den statiske microsoft/-videnfil-snapshot og ingen live dokumentationssoegning.

2. add_repo-mekanismen i curabis-app-sources-must-be-checked-first.md var
   kun naevnt, aldrig defineret - intet vaerktoej med det navn findes i
   Claude Code CLI. Erstattet med en konkret, testet mekanisme: en
   vedvarende, opdateret klon i ~/.claude/reference-repos/<org>/<repo>/,
   samme moenster som BCQualitys egen kanal-klon. Testet live mod det
   faktiske microsoft/BCApps-repo (shallow clone ~52s, ~36.000 .al-filer,
   git pull --depth 1 til opdatering).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Michael Dieringer 2026-07-31 20:03:10 +02:00
parent 2d0f1c1eec
commit 85b2acc372
3 changed files with 82 additions and 25 deletions

View file

@ -1,7 +1,7 @@
--- ---
bc-version: [all] bc-version: [all]
domain: architecture domain: architecture
keywords: [dependency, source, add-repo, github, curabis, closed-source, test, symbol, black-box] keywords: [dependency, source, reference-repos, clone, github, curabis, closed-source, test, symbol, black-box]
technologies: [al] technologies: [al]
countries: [w1] countries: [w1]
application-area: [all] application-area: [all]
@ -17,10 +17,31 @@ customer project imports one of these apps, it typically arrives as a compiled
This makes the app look like a closed external dependency. It is not. This makes the app look like a closed external dependency. It is not.
Before treating any CURABIS-owned dependency app as a black box, the agent Before treating any CURABIS-owned dependency app as a black box, the agent
must check whether its source is available via `add_repo` (GitHub). Reverse- must check whether its source is available on GitHub and read it directly.
engineering compiled symbol packages (`SymbolReference.json`, `.app` manifest Reverse-engineering compiled symbol packages (`SymbolReference.json`, `.app`
inspection) is always an inferior substitute for reading the actual production manifest inspection) is always an inferior substitute for reading the actual
source, and produces lower-confidence tests and code reviews. production source, and produces lower-confidence tests and code reviews.
**How to actually get the source (2026-07-30 — was previously the underspecified
`add_repo <repo>`, which is not a real tool in most Claude Code sessions):**
- **Claude Code CLI** (this is the common case): maintain a persistent,
periodically-refreshed clone at `~/.claude/reference-repos/<org>/<repo>/` —
same pattern as BCQuality's own channel clone. Before reading, check if it
exists:
- Missing: `git clone --depth 1 <url> "$env:USERPROFILE\.claude\reference-repos\<org>\<repo>"`
(shallow — you need current source, not history)
- Exists: `git -C "$env:USERPROFILE\.claude\reference-repos\<org>\<repo>" pull --depth 1`
(refresh before trusting it — a stale clone from a prior session is a
silent source of wrong answers)
- Then `Read`/`Grep`/`Glob` it like any other local path.
- **Claude Code on web** (claude.ai/code): use the session's repo picker /
"add repository" action instead, if the UI offers one — there is no shell
to clone into in that environment.
Verify which of these your actual session supports before assuming either
works — do not silently fall back to symbol inspection if neither succeeds;
flag the limitation explicitly instead (see "When cloning fails" below).
## Known CURABIS app repos ## Known CURABIS app repos
@ -29,7 +50,7 @@ source, and produces lower-confidence tests and code reviews.
| Contract Management 365 app | https://github.com/Curabis/ContractMgmt365app.git | Main contract engine; depended on by most CURABIS customer projects | | Contract Management 365 app | https://github.com/Curabis/ContractMgmt365app.git | Main contract engine; depended on by most CURABIS customer projects |
| Project Management 365 app | https://github.com/Curabis/ProjectMgmt365app.git | | | Project Management 365 app | https://github.com/Curabis/ProjectMgmt365app.git | |
| Cross Channel Management 365 app | https://github.com/Curabis/WebStore.git | | | Cross Channel Management 365 app | https://github.com/Curabis/WebStore.git | |
| Summatim | https://github.com/MichaelDieringer/-summatim.git | Currently restricted — only mid has access; add_repo will fail for other team members | | Summatim | https://github.com/MichaelDieringer/-summatim.git | Currently restricted — only mid has access; the clone will fail for other team members |
*Expand this table when new CURABIS apps are created. If an app is not listed here, *Expand this table when new CURABIS apps are created. If an app is not listed here,
ask `mid` whether source is available before reverting to symbol inspection.* ask `mid` whether source is available before reverting to symbol inspection.*
@ -42,10 +63,12 @@ available at:
- https://github.com/microsoft/BCApps - https://github.com/microsoft/BCApps
Use `add_repo microsoft/BCApps` when you need to understand internals of Clone it to `~/.claude/reference-repos/microsoft/BCApps/` (see the mechanism
Microsoft standard codeunits (e.g. Sales-Post, Gen. Jnl.-Post Line, Copy Document above) when you need to understand internals of Microsoft standard codeunits
Mgt.) that are referenced by event subscribers but whose source is not visible in (e.g. Sales-Post, Gen. Jnl.-Post Line, Copy Document Mgt.) that are referenced
the current project. by event subscribers but whose source is not visible in the current project.
It is a large public monorepo — a shallow clone is still the right call, and
worth refreshing rather than re-cloning once it exists.
## Anti Pattern ## Anti Pattern
@ -56,8 +79,9 @@ the current project.
## Best Practice ## Best Practice
// CORRECT: add the source repo and read it directly // CORRECT: clone the source repo and read it directly
add_repo Curabis/ContractMgmt365app git clone --depth 1 https://github.com/Curabis/ContractMgmt365app.git `
"$env:USERPROFILE\.claude\reference-repos\Curabis\ContractMgmt365app"
// Then read the actual table definitions, codeunits, and any Test Library // Then read the actual table definitions, codeunits, and any Test Library
// codeunits that may already exist in the repo's own test app. // codeunits that may already exist in the repo's own test app.
@ -75,5 +99,8 @@ Apply at the start of any task involving:
- Building GIVEN helpers for a CURABIS-owned app's tables - Building GIVEN helpers for a CURABIS-owned app's tables
- Code-reviewing changes to codeunits that extend CURABIS-owned apps - Code-reviewing changes to codeunits that extend CURABIS-owned apps
If `add_repo` fails due to access restrictions (see table above), flag the ## When cloning fails
limitation explicitly rather than silently falling back to symbol inspection.
If the clone fails due to access restrictions (see table above) or your
session has no shell to clone into, flag the limitation explicitly rather
than silently falling back to symbol inspection.

View file

@ -212,13 +212,14 @@ If it does NOT exist:
Everything machine-global beyond the bridge and BC secret — the knowledge Everything machine-global beyond the bridge and BC secret — the knowledge
mirror, the 19 roster agent files (18 to `~/.claude/curabis-agents/` + mirror, the 19 roster agent files (18 to `~/.claude/curabis-agents/` +
Florence to `~/.claude/agents/florence.md`), `~/.claude/find-altool.ps1`, and Florence to `~/.claude/agents/florence.md`), `~/.claude/find-altool.ps1`, and
the `al`/`businesscentral` MCP registrations — is deployed by ONE script, the `al`/`businesscentral`/`microsoft-learn` MCP registrations — is deployed
`sync-bcquality-knowledge.ps1`. None of it is ever committed to a project by ONE script, `sync-bcquality-knowledge.ps1`. None of it is ever committed
repository (BCQuality rule `bcquality-knowledge-must-mirror-to-machine-not-repo`, to a project repository (BCQuality rule
extended in v24 to `roster-agents-live-on-machine-not-in-repo`). Rationale: `bcquality-knowledge-must-mirror-to-machine-not-repo`, extended in v24 to
developers switch between many repos daily — N per-repo copies are `roster-agents-live-on-machine-not-in-repo`). Rationale: developers switch
permanently out of sync with each other, while one machine copy needs between many repos daily — N per-repo copies are permanently out of sync
exactly one sync per upstream change. with each other, while one machine copy needs exactly one sync per upstream
change.
1. Fetch `{BASE}/sync-bcquality-knowledge.ps1` → write AS RAW BYTES 1. Fetch `{BASE}/sync-bcquality-knowledge.ps1` → write AS RAW BYTES
(`Invoke-WebRequest -OutFile`, never via string content — re-encoding (`Invoke-WebRequest -OutFile`, never via string content — re-encoding
@ -234,15 +235,20 @@ exactly one sync per upstream change.
- `~/.claude/curabis-agents/*.agent.md` (18 files) - `~/.claude/curabis-agents/*.agent.md` (18 files)
- `~/.claude/agents/florence.md` (Florence, as a real subagent) - `~/.claude/agents/florence.md` (Florence, as a real subagent)
- `~/.claude/find-altool.ps1` - `~/.claude/find-altool.ps1`
- `al` + `businesscentral` registered at user MCP scope (idempotent — a - `al` + `businesscentral` + `microsoft-learn` registered at user MCP scope
server that already exists is reported, not re-added or overwritten) (idempotent — a server that already exists is reported, not re-added or
overwritten). `microsoft-learn` is `https://learn.microsoft.com/api/mcp`,
HTTP transport, no auth — the same official documentation search Mode C
already gives support users; v24 closes the gap where developers had
only the static `microsoft/` knowledge-file snapshot and no live search
of Microsoft's own docs.
3. If a v6-era `.github/.agents/bcquality-knowledge/` exists in THIS repo, 3. If a v6-era `.github/.agents/bcquality-knowledge/` exists in THIS repo,
add it to `.gitignore` so no future session can accidentally commit it add it to `.gitignore` so no future session can accidentally commit it
(see the v6-cleanup step in Mode B for full removal — this step just (see the v6-cleanup step in Mode B for full removal — this step just
prevents new commits). prevents new commits).
4. Confirm: "Maskine-opsætning synkroniseret — bcquality-knowledge [antal] 4. Confirm: "Maskine-opsætning synkroniseret — bcquality-knowledge [antal]
filer, curabis-agents 18 filer, Florence, find-altool.ps1, MCP (al, filer, curabis-agents 18 filer, Florence, find-altool.ps1, MCP (al,
businesscentral)." businesscentral, microsoft-learn)."
This machine setup is what the global `~/.claude/CLAUDE.md` roster section This machine setup is what the global `~/.claude/CLAUDE.md` roster section
and the project CLAUDE.md's session-start line both depend on. Without this and the project CLAUDE.md's session-start line both depend on. Without this
@ -543,7 +549,7 @@ these are shared across every CURABIS repo on the machine:
| `~/.claude/curabis-agents/*.agent.md` (18 files) | Re-run the sync script | | `~/.claude/curabis-agents/*.agent.md` (18 files) | Re-run the sync script |
| `~/.claude/agents/florence.md` | Re-run the sync script | | `~/.claude/agents/florence.md` | Re-run the sync script |
| `~/.claude/find-altool.ps1` | Re-run the sync script | | `~/.claude/find-altool.ps1` | Re-run the sync script |
| `al` + `businesscentral` MCP servers (user scope) | Re-run the sync script — idempotent: registers if missing, does NOT touch an existing registration (a developer's personal-scope config is not policed the way repo-shared `.mcp.json` used to be) | | `al` + `businesscentral` + `microsoft-learn` MCP servers (user scope) | Re-run the sync script — idempotent: registers if missing, does NOT touch an existing registration (a developer's personal-scope config is not policed the way repo-shared `.mcp.json` used to be) |
| `.github/.agents/bcquality-knowledge/` + `.github/.agents/sync-bcquality-knowledge.ps1` | v6-era repo-local mirror: propose removal (see below) | | `.github/.agents/bcquality-knowledge/` + `.github/.agents/sync-bcquality-knowledge.ps1` | v6-era repo-local mirror: propose removal (see below) |
### bcquality-knowledge — machine re-sync (Mode B) ### bcquality-knowledge — machine re-sync (Mode B)

View file

@ -198,3 +198,27 @@ Ensure-UserMcpServer -Name 'al' -CommandAndArgs @(
'-File', '${USERPROFILE}\.claude\find-altool.ps1', '-File', '${USERPROFILE}\.claude\find-altool.ps1',
'launchmcpserver', 'auto', '--transport', 'stdio' 'launchmcpserver', 'auto', '--transport', 'stdio'
) )
# --- 9. Microsoft Learn MCP (HTTP, ingen auth) - samme adgang udviklere faar som
# Mode C support-brugere allerede har. Verificeret 2026-07-30: offentlig, ingen
# nogen creds noedvendige, stdio-mekanismen ovenfor gaelder ikke - HTTP-transport
# bruger et andet flag-sæt (--transport http, ingen '--' kommando-adskiller).
function Ensure-UserMcpHttpServer {
param([string]$Name, [string]$Url)
$prevEap = $ErrorActionPreference
$ErrorActionPreference = 'Continue'
$output = & claude mcp add --scope user --transport http $Name $Url 2>&1
$exitCode = $LASTEXITCODE
$ErrorActionPreference = $prevEap
if ($exitCode -ne 0) {
if ($output -match 'already exists') {
Write-Host "MCP-server '$Name' er allerede registreret paa user scope."
} else {
throw "claude mcp add fejlede for '$Name': $output"
}
} else {
Write-Host "MCP-server '$Name' registreret paa user scope."
}
}
Ensure-UserMcpHttpServer -Name 'microsoft-learn' -Url 'https://learn.microsoft.com/api/mcp'