Fix setup script to follow mcp-config-must-not-hardcode-developer-paths

Mode A generated .mcp.json with a literal C:\Users\<USERNAME>\... bridge
path and an absolute find-altool.ps1 path; Mode B validated against that
same hardcoded form, so it would have "corrected" a compliant env-var
path back to a broken one. Both now use ${USERPROFILE} and
${CLAUDE_PROJECT_DIR:-.} per the rule merged in #37.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Michael Dieringer 2026-07-01 09:54:41 +02:00
parent fed213fab1
commit 50e60a6513

View file

@ -1,7 +1,7 @@
--- ---
kind: action-skill kind: action-skill
id: curabis-standard-setup id: curabis-standard-setup
version: 3 version: 4
title: CURABIS Standard — Project Setup title: CURABIS Standard — Project Setup
description: > description: >
Configures a new or existing repository to the CURABIS Standard development Configures a new or existing repository to the CURABIS Standard development
@ -290,13 +290,13 @@ If `.vscode/find-altool.ps1` exists:
"command": "powershell", "command": "powershell",
"args": [ "args": [
"-ExecutionPolicy", "Bypass", "-ExecutionPolicy", "Bypass",
"-File", "<ABS_PATH_TO_VSCODE>/find-altool.ps1", "-File", "${CLAUDE_PROJECT_DIR:-.}\\.vscode\\find-altool.ps1",
"launchmcpserver", "--transport", "stdio" "launchmcpserver", "--transport", "stdio"
] ]
}, },
"businesscentral": { "businesscentral": {
"command": "node", "command": "node",
"args": ["C:\\Users\\<USERNAME>\\.claude\\bc-mcp-bridge.js"] "args": ["${USERPROFILE}\\.claude\\bc-mcp-bridge.js"]
} }
} }
} }
@ -308,13 +308,17 @@ If `.vscode/find-altool.ps1` does NOT exist:
"mcpServers": { "mcpServers": {
"businesscentral": { "businesscentral": {
"command": "node", "command": "node",
"args": ["C:\\Users\\<USERNAME>\\.claude\\bc-mcp-bridge.js"] "args": ["${USERPROFILE}\\.claude\\bc-mcp-bridge.js"]
} }
} }
} }
``` ```
Substitute `<ABS_PATH_TO_VSCODE>` and `<USERNAME>` from detected values. Use Claude Code's built-in environment-variable expansion — `${CLAUDE_PROJECT_DIR:-.}`
and `${USERPROFILE}` — instead of substituting literal detected paths. `.mcp.json` is
git-committed and shared; a path baked in for one developer's machine or username
breaks every other developer's clone (see BCQuality rule
`mcp-config-must-not-hardcode-developer-paths`).
If `find-altool.ps1` is missing, note after writing .mcp.json: If `find-altool.ps1` is missing, note after writing .mcp.json:
> " AL MCP er ikke konfigureret endnu. Kør `Ctrl+Shift+P → AL: Configure MCP Server` > " AL MCP er ikke konfigureret endnu. Kør `Ctrl+Shift+P → AL: Configure MCP Server`
@ -435,27 +439,39 @@ Never touches `CLAUDE.md`, `projectmemory/`, `docs/`, or `~/.bc-mcp.config.json`
| `cspell.json` — words from template | Merge new words, keep project words | | `cspell.json` — words from template | Merge new words, keep project words |
| `.mcp.json``al` entry | Add if `find-altool.ps1` now exists and entry is missing | | `.mcp.json``al` entry | Add if `find-altool.ps1` now exists and entry is missing |
| `.mcp.json``businesscentral` path | Validate and correct if wrong (see below) | | `.mcp.json``businesscentral` path | Validate and correct if wrong (see below) |
| `.mcp.json``al` `-File` path | Validate and correct if wrong (see below) |
| `HEARTBEAT.md` | Create from template if missing (substitute tokens), never overwrite | | `HEARTBEAT.md` | Create from template if missing (substitute tokens), never overwrite |
| `docs/specs/`, `docs/decisions/`, `docs/cleanup/` | Create if missing, never overwrite content | | `docs/specs/`, `docs/decisions/`, `docs/cleanup/` | Create if missing, never overwrite content |
### .mcp.json — businesscentral path validation (Mode B) ### .mcp.json — hardcoded developer-path validation (Mode B)
The `businesscentral` MCP server entry must point to the global bridge file, `.mcp.json` is git-committed and shared — it must not contain a path baked in for
not a project-local path. After any update, validate `.mcp.json`: one developer's machine or username (BCQuality rule
`mcp-config-must-not-hardcode-developer-paths`). After any update, validate both
entries:
**`businesscentral` entry** — the bridge path must use env-var expansion, not a
literal username or drive path:
1. Read `.mcp.json` and locate the `businesscentral` entry 1. Read `.mcp.json` and locate the `businesscentral` entry
2. Check the `args` array — the bridge path must be: 2. Check the `args` array — the bridge path must be `${USERPROFILE}\.claude\bc-mcp-bridge.js`
`C:\Users\<USERNAME>\.claude\bc-mcp-bridge.js` 3. If it is anything else (e.g. `Scripts/bc-mcp-bridge.js`, a project subfolder,
where `<USERNAME>` is the current Windows username (`$env:USERNAME`) `C:\Users\<literal-name>\.claude\bc-mcp-bridge.js`, or any path not built from
3. If the path points anywhere else (e.g. `Scripts/bc-mcp-bridge.js`, `${USERPROFILE}`): **correct it silently** to `${USERPROFILE}\.claude\bc-mcp-bridge.js`
a project subfolder, or any path not under `~/.claude/`): **correct it silently** 4. If the `businesscentral` entry is missing entirely: add it with the correct path
4. If `businesscentral` entry is missing entirely: add it with the correct path
5. Report any correction made: **`al` entry** — the `-File` path to `find-altool.ps1` must use
``` `${CLAUDE_PROJECT_DIR:-.}`, not a literal absolute path to the repo clone:
⚠️ .mcp.json: businesscentral-stien var forkert og er rettet. 1. Read the `al` entry's `args` array
Gammel: <old path> 2. Check the `-File` value is `${CLAUDE_PROJECT_DIR:-.}\.vscode\find-altool.ps1`
Ny: C:\Users\<USERNAME>\.claude\bc-mcp-bridge.js 3. If it is a literal absolute path (e.g. `C:\Curabis\ProjectX\.vscode\find-altool.ps1`
``` or any drive-letter path): **correct it silently** to use `${CLAUDE_PROJECT_DIR:-.}`
Report any correction made:
```
⚠️ .mcp.json: <entry>-stien indeholdt en hardcodet udvikler-sti og er rettet.
Gammel: <old path>
Ny: <new path with env-var expansion>
```
This is the most common setup error on projects configured before CURABIS Standard. This is the most common setup error on projects configured before CURABIS Standard.