Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cursor/rules/template-sync.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ The script invocation in the workflow step above is authoritative. Adding or rem

## Not templated

`plugins/dev-tooling/shared/scope.sh` is owned by dev-tooling. Don't add it to the mapping.
`plugins/dev-tooling/shared/scope.sh`, `plugins/dev-tooling/shared/worktree.sh`, and `plugins/dev-tooling/shared/server_run.sh` are owned by dev-tooling. Don't add them to the mapping.
4 changes: 2 additions & 2 deletions .mcp-sdk.lock
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=v3.0.0
sha256=3fc8bc7a58fec1a7e9df1fff64d6f022fd14d9561b1faf82bf4e464e70637e46
version=v5.1.0
sha256=6a4d91bf16569555d988ceb3c2e32c45f519ac853c96fa225f387df367126fd6
7 changes: 7 additions & 0 deletions plugin-tests/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ assert_hook_blocks "script.sh" "command to test" "expected suggestion"
# Create temporary config file (dev-tooling)
setup_config "php-tooling" '{"environment": "native"}'
# Creates: $BATS_TEST_TMPDIR/.mcp-php-tooling.json

# Rewrite both gitdir pointers of a linked worktree to relative form
worktree_gitdir_relative "$worktree_root"

# Refuse a real container CLI; stub_worktree_probe pass|fail drives the existence probe
container_cli_refuse_real
stub_worktree_probe pass
```

### Path Calculation
Expand Down
8 changes: 8 additions & 0 deletions plugin-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ plugin-tests/
│ ├── scope_resolution.bats # Scope declaration, validation and refusal
│ ├── scope_session_start.bats # Scope reporting from the session-start hook
│ ├── session_start.bats # Session-start hook JSON output
│ ├── cursor_hooks.bats # Cursor beforeShellExecution payload shape
│ ├── tool_schema.bats # Undeclared-parameter refusal across all three servers
│ ├── worktree_resolution.bats # Worktree resolution, identity, linkage, charset, probe
│ ├── worktree_state.bats # Sticky project-root state file
│ ├── worktree_hook.bats # worktree-directives.sh Cursor envelope and git worktree payloads
│ ├── worktree_php_tools.bats # phpunit_coverage_gaps against a mapped worktree
│ ├── worktree_js_tools.bats # project_root reaching the JS package directory
│ ├── worktree_conformance.bats # Every tool_* runs in the named worktree
│ ├── fixtures/
│ │ └── coverage/ # XML fixtures for coverage gap tests
│ │ ├── two_files.xml # Two files with partial coverage
Expand Down
27 changes: 17 additions & 10 deletions plugin-tests/dev-tooling/mcp_tool_console.bats
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ setup() {
}

teardown() {
unset LINT_ENV LINT_WORKDIR LINT_CONFIG_FILE CONSOLE_FAKE_CMD
worktree_state_cleanup
unset LINT_ENV LINT_WORKDIR LINT_CONFIG_FILE CONSOLE_FAKE_CMD PROJECT_ROOT DEV_TOOLING_STATE_FILE
}

# Replace the wrapped invocation with a controlled shell snippet, so the
Expand Down Expand Up @@ -227,7 +228,7 @@ bats_test_function --description "console: option name containing a line break i
@test "console: malformed top-level JSON is refused rather than defaulting silently" {
run tool_console_run '{not valid json'
assert_failure
assert_output --partial "Refusing to run: could not parse arguments as JSON"
assert_output --partial 'Refusing to run: the tool call'"'"'s own arguments do not parse as a JSON object, so "project_root" could not be read from them.'
}

# --- output_file: stdout captured to a file ---
Expand Down Expand Up @@ -334,8 +335,13 @@ bats_test_function --description "console: option name containing a line break i
assert_output --partial "\"${target}\" exists as a directory"
}

@test "console: a relative output_file resolves against the working directory" {
cd "${BATS_TEST_TMPDIR}"
# Both tests below run from a directory that is NOT the project root, because
# that is the only arrangement that tells the documented contract ("a relative
# path resolves against the project root") from resolving against $PWD. With
# the two directories equal, either implementation passes.
@test "console: a relative output_file resolves against the project root" {
mkdir -p "${BATS_TEST_TMPDIR}/elsewhere"
cd "${BATS_TEST_TMPDIR}/elsewhere"
_stub_wrapped_command 'printf "ok\n"'
run tool_console_run '{"command":"debug:container","output_file":"nested/dump.txt"}'
assert_success
Expand All @@ -344,8 +350,9 @@ bats_test_function --description "console: option name containing a line break i
assert_output "ok"
}

@test "console: an output_file beginning with a dash is pinned to the working directory" {
cd "${BATS_TEST_TMPDIR}"
@test "console: an output_file beginning with a dash is pinned to the project root" {
mkdir -p "${BATS_TEST_TMPDIR}/elsewhere"
cd "${BATS_TEST_TMPDIR}/elsewhere"
_stub_wrapped_command 'printf "ok\n"'
run tool_console_run '{"command":"debug:container","output_file":"-dash.txt"}'
assert_success
Expand Down Expand Up @@ -374,7 +381,7 @@ bats_test_function --description "console: option name containing a line break i
@test "console: an empty output_file behaves as an absent parameter" {
run tool_console_run '{"command":"cache:clear","output_file":""}'
assert_success
assert_output 'bin/console "cache:clear"'
assert_line 'bin/console "cache:clear"'
}

@test "console: env and output_file compose in one call" {
Expand Down Expand Up @@ -409,7 +416,7 @@ _stub_compose_resolution() {
LINT_ENV="native"
run tool_console_run '{"command":"cache:clear","feature_all":"major"}'
assert_success
assert_output 'FEATURE_ALL=major bin/console "cache:clear"'
assert_line 'FEATURE_ALL=major bin/console "cache:clear"'
}

@test "console: feature_all opens the containerized command under docker-compose" {
Expand All @@ -426,7 +433,7 @@ _stub_compose_resolution() {
LINT_ENV="native"
run tool_console_run '{"command":"cache:clear"}'
assert_success
assert_output 'bin/console "cache:clear"'
assert_line 'bin/console "cache:clear"'
}

@test "console: feature_all value outside the enum is refused by the tool" {
Expand Down Expand Up @@ -480,5 +487,5 @@ _stub_compose_resolution() {
@test "console list: malformed top-level JSON is refused rather than defaulting silently" {
run tool_console_list '{not valid json'
assert_failure
assert_output --partial "Refusing to run: could not parse arguments as JSON"
assert_output --partial 'Refusing to run: the tool call'"'"'s own arguments do not parse as a JSON object, so "project_root" could not be read from them.'
}
5 changes: 3 additions & 2 deletions plugin-tests/dev-tooling/mcp_tool_ecs.bats
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ setup() {
}

teardown() {
unset LINT_ENV LINT_WORKDIR LINT_CONFIG_FILE
worktree_state_cleanup
unset LINT_ENV LINT_WORKDIR LINT_CONFIG_FILE PROJECT_ROOT DEV_TOOLING_STATE_FILE
}

@test "ecs: check uses composer ecs" {
Expand Down Expand Up @@ -138,7 +139,7 @@ ecs_refuses_malformed_json() {
local tool="$1"
run "${tool}" '{not valid json'
assert_failure
assert_output --partial "Refusing to run: could not parse arguments as JSON"
assert_output --partial 'Refusing to run: the tool call'"'"'s own arguments do not parse as a JSON object, so "project_root" could not be read from them.'
}

bats_test_function --description "ecs: check malformed top-level JSON is refused rather than defaulting silently" \
Expand Down
Loading
Loading