Repository navigation
feat(dev-tooling)!: port worktree targeting from upstream - #2
Merged
Merged
Conversation
…hopwareLabs#186) The three MCP servers captured their project root once at launch, so a session working in a linked git worktree ran PHPStan, PHPUnit, ESLint and the builds against the main checkout while editing the worktree. The results parsed as valid and described the wrong tree. Every tool now takes an optional `project_root`. `set_project_root` sticks a default per server process and `cwd` reports the resolution state. Precedence is per-call argument, then sticky value, then launch root, and most results begin with a `Project root: <path> (launch|sticky|call)` banner so the tree a result describes is visible in the transcript. Targeting works under `native`, `docker`, `docker-compose`, `vagrant` and `ddev`. The environment layer maps a host root onto the environment-side path: the configured workdir plus the worktree's position below the launch root, under `docker-compose` a configured workdir or the destination of the longest matching bind mount, with both sides of every containment and mapping comparison canonicalized so a symlinked spelling cannot refuse a reachable root. Under the container environments the worktree has to sit inside the launch root, the only tree the container mounts. The `.git` file has to carry a relative `gitdir` pointer in every environment (an absolute pointer names a host path no container holds), and the refusal quotes the repair command (`git -c worktree.useRelativePaths=true worktree repair`, git 2.48+). A back-pointer written relative resolves against the per-worktree directory that holds it. An environment name outside the known set is refused rather than run as native, with the container set in one `_env_is_container_environment` predicate read by containment, charset and probe alike. Roots the wrappers cannot embed are refused per environment, an existence probe through the call's own wrapper confirms the environment reaches the mapped path (cached per environment, root and mapped path), a worktree's own config is re-derived per call while the launch binding stays inert until restart, `docker compose` invocations stay anchored to the launch root because compose discovers its project from the working directory, and `ddev` names the resolved workdir with `exec -d` for worktree targets. `worktree_prepare` on each server provisions what a fresh worktree lacks: `composer install --no-interaction` on `php-tooling` at the effective root (the directory the dependency gate checks, so scope deliberately does not redirect it) and `npm ci` in the scope-aware package directory on the JS servers, run through the environment wrappers so a container install happens inside the container at the mapped path. The dependency refusals name it as the remedy, a successful install returns a short summary instead of the per-package output, and the `dev-tooling-runner` agent's `disallowedTools` blocks it so a check-only dispatch cannot be steered into a `node_modules`-rewriting install. Symlinking `vendor/` from the launch tree is ruled out in the descriptions because composer's autoloaders resolve `__DIR__` through the symlink and load the launch tree's classes. A `PostToolUse` hook on `EnterWorktree`/`ExitWorktree` reminds the session to repoint all three servers, names the repair command up front when the created worktree carries an absolute pointer, and warns that a native worktree branches from the default remote branch unless `worktree.baseRef` is `head`. Fixes riding along: six tools declared a `scope` parameter and never resolved it; `console_run` resolved a relative `output_file` against `$PWD` instead of the project root; a relative path carrying `..` reached a worktree-targeted call while its absolute spelling was refused; `docker-compose` workdir resolution accepts an ancestor bind mount via longest-prefix matching instead of demanding an exact source; jest's `install_if_missing` measured an environment-side path with a host `[[ -d ]]` and paid a full `npm ci` on every scoped container run; and the native wrappers no longer embed a `cd` in the command text because `exec_command`/`exec_npm_command` enter the working directory themselves, which also fixes the unscoped native branch that ran in the server process's own directory. The vendored protocol handler moves to bash-mcp-sdk v5.1.0, which re-runs the `EXIT` trap its own signal handling displaces. Temp files no longer survive a signalled shutdown, and the servers drop the subshell isolation that worked around it. The three server entry points share `shared/server_run.sh`, `config.sh`'s cleanup is the documented `config_cleanup`, and `get_environment_info` is removed (no callers). test-writing's rule catalog is corrected alongside: remediations Shopware's static gates reject are rescoped or removed (CONV-007 and MIGRATION-007 fall to mechanically enforced php-cs-fixer and phpstan-phpunit rules), and a remediation invariant lands in the reviewing skills and team-review prompts. A suggested fix never changes what an existing assertion pins. BREAKING CHANGE: most tool results begin with the `Project root:` banner line ahead of the tool's own output, which changes the shape consumers parse (`set_project_root` and `cwd` carry no banner). A call carrying a parameter the tool does not declare is refused instead of ignored. A worktree whose `.git` file carries an absolute `gitdir` pointer is refused in every environment; relink with `git -c worktree.useRelativePaths=true worktree repair <worktree-path>` (git 2.48+) or create worktrees with `--relative-paths`, and `git config worktree.useRelativePaths true` makes every later worktree relative-linked from the start. The vendored handler enforces a startup floor of bash 4.1 and jq 1.7. Co-Authored-By: Claude <noreply@anthropic.com>
Merge origin/upstream (df8444d) into the Cursor-only main line. The three MCP servers now take an optional project_root, stick a default with set_project_root, and report resolution state via cwd. Targeting works under native, docker, docker-compose, vagrant, and ddev. A worktree with an absolute gitdir pointer is refused in every environment; relink with git -c worktree.useRelativePaths=true worktree repair (git 2.48+). worktree_prepare installs composer or npm dependencies in the target tree. The vendored protocol handler moves to bash-mcp-sdk v5.1.0. Cursor adaptations: keep .cursor-plugin packaging and camelCase hooks; fire worktree-directives on git worktree add/remove and emit additional_context; document the runner's worktree_prepare and set_project_root exclusions in the agent body rather than Claude frontmatter. shopware-env 2.1.0 and test-writing 6.0.1 pick up the shared environment and SDK updates. BREAKING CHANGE: most tool results begin with a Project root banner. A call carrying an undeclared parameter is refused. The handler requires bash 4.1 and jq 1.7. Co-authored-by: ROBJkE <ROBJkE@users.noreply.github.com>
Agent Skills ExportBuilt 7 skill packages: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Merges upstream
df8444d(feat(dev-tooling)!: target linked git worktrees in every environment) into the Cursor-onlymainline and keeps Cursor packaging intact.The three MCP servers captured their project root once at launch, so a session working in a linked git worktree ran PHPStan, PHPUnit, ESLint and the builds against the main checkout. Every tool now takes an optional
project_root.set_project_rootsticks a default per server process andcwdreports the resolution state. Targeting works undernative,docker,docker-compose,vagrantandddev. A worktree whose.gitfile carries an absolutegitdirpointer is refused; relink withgit -c worktree.useRelativePaths=true worktree repair(git 2.48+).worktree_prepareinstalls composer or npm dependencies in the target tree. The vendored protocol handler moves to bash-mcp-sdk v5.1.0.Cursor adaptations
.cursor-plugin/metadata,mcp.jsonwith${CURSOR_PLUGIN_ROOT}, and camelCase hook events. Did not restore.claude-plugin/,.lsp.json, or PascalCase hooks.worktree-directives.shfires ongit worktree add/git worktree remove(beforeShellExecution and postToolUse) and emitsadditional_contextinstead of Claude'shookSpecificOutputenvelope.dev-tooling-runnerstill documents theworktree_prepare/set_project_rootexclusions in the agent body. No Claudetools/disallowedTools/model/colorfrontmatter.Version bumps
dev-toolingshopware-envtest-writingBreaking change
Most tool results begin with
Project root: <path> (launch|sticky|call). A call carrying a parameter the tool does not declare is refused. The handler requires bash 4.1 and jq 1.7.Validation
.github/scripts/validate-cursor-plugins.sh.github/scripts/validate-versions.sh.github/scripts/validate-issue-templates.sh.github/scripts/vendor-mcp-sdk.sh --check.github/workflows/validate.yml