Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
819605c
Update .gitignore
SoundBlaster Feb 9, 2026
c4ed630
Implement P10-T1: Web UI Control & Audit Dashboard
SoundBlaster Feb 9, 2026
0c9e94e
Archive task P10-T1: Web UI Control & Audit Dashboard (PASS)
SoundBlaster Feb 9, 2026
1d0e1b2
Review P10-T1: Web UI Implementation
SoundBlaster Feb 9, 2026
2e438f6
Archive REVIEW_P10-T1_Web_UI_Implementation report
SoundBlaster Feb 9, 2026
fe0ef07
Update INDEX.md with P10-T1 review report reference
SoundBlaster Feb 9, 2026
3370023
Fix quality gate issues for P10-T1
SoundBlaster Feb 9, 2026
05d869e
Add Web UI commands to Makefile
SoundBlaster Feb 9, 2026
8393421
Update CONTRIBUTING.md with Makefile rules for new features
SoundBlaster Feb 9, 2026
515bcf0
Add make webui and make webui-health commands
SoundBlaster Feb 9, 2026
09e462f
Update documentation for Web UI feature
SoundBlaster Feb 9, 2026
4fda434
Sync README.md Web UI section to DocC catalog
SoundBlaster Feb 9, 2026
97c511a
Add docs/webui-setup.md to out-of-scope docs in sync check script
SoundBlaster Feb 9, 2026
4f72afc
Fix Web UI metrics collection bug
SoundBlaster Feb 9, 2026
8dc50e9
Update .gitignore
SoundBlaster Feb 9, 2026
9657659
Add JSON Schema validation for MCP messages using Pydantic
SoundBlaster Feb 9, 2026
470196d
fix(metrics): track requests by ID to correctly record response metrics
SoundBlaster Feb 9, 2026
6ba6e56
Select task P10-T2: Fix Web UI timeseries charts showing no data
SoundBlaster Feb 9, 2026
533e594
Implement P10-T2: Fix Web UI timeseries charts showing no data
SoundBlaster Feb 9, 2026
b95f6b7
Archive task P10-T2: Fix Web UI timeseries charts (COMPLETED)
SoundBlaster Feb 9, 2026
2adde50
Fix connections. The API is returning timeseries data correctly.
SoundBlaster Feb 9, 2026
78fe947
Fix `make check`
SoundBlaster Feb 9, 2026
aea2461
Implemented fixes so CI’s `mypy src/` passes, and verified with the
SoundBlaster Feb 9, 2026
c1f62ca
Fix Code Review issue
SoundBlaster Feb 9, 2026
cf2904e
Updated the CI lint job to install your project (with dev deps) before
SoundBlaster Feb 9, 2026
dae1fc9
CI still failed because **even after installing `-e ".[dev]"`, your
SoundBlaster Feb 9, 2026
490248a
I added **one new unit test** (tests only; no production code changes)
SoundBlaster Feb 9, 2026
dbac390
ran the formatting quality gate locally per `CONTRIBUTING.md`:
SoundBlaster Feb 10, 2026
15ed84e
Expand main tests for diagnostics and metrics
SoundBlaster Feb 10, 2026
3e6b1e7
Fix webui import for optional deps
SoundBlaster Feb 10, 2026
96f5284
Ruff: modernize webui type hints
SoundBlaster Feb 10, 2026
4a401f7
Fix mypy for optional webui deps
SoundBlaster Feb 10, 2026
ab994b5
Format webui server with ruff
SoundBlaster Feb 10, 2026
6c8dc6b
Align Makefile with CI checks
SoundBlaster Feb 10, 2026
a44b27f
Branch for REBUILD-P10-T1: Web UI spec-driven rebuild
SoundBlaster Feb 10, 2026
0543896
Select task REBUILD-P10-T1: Spec-Driven Rebuild of Web UI Dashboard
SoundBlaster Feb 10, 2026
15a60bb
Plan task REBUILD-P10-T1: Spec-Driven Rebuild of Web UI Dashboard
SoundBlaster Feb 10, 2026
5385e5f
Implement REBUILD-P10-T1: Produce REBUILD step package and validation…
SoundBlaster Feb 10, 2026
1570306
Archive task REBUILD-P10-T1: Spec-Driven Rebuild of Web UI Dashboard …
SoundBlaster Feb 10, 2026
02b76fe
Review REBUILD-P10-T1: Web UI rebuild package
SoundBlaster Feb 10, 2026
b7cfdbe
Follow-up REBUILD-P10-T1: Web UI rebuild package
SoundBlaster Feb 10, 2026
6ff5f64
Archive REVIEW_REBUILD-P10-T1_Web_UI_Rebuild report
SoundBlaster Feb 10, 2026
e6e2643
Branch for FU-REBUILD-P10-T1-1: align websocket auth flow
SoundBlaster Feb 10, 2026
89b0e3d
Select task FU-REBUILD-P10-T1-1: Align websocket auth flow
SoundBlaster Feb 10, 2026
aa0aef8
Plan task FU-REBUILD-P10-T1-1: Align websocket auth flow
SoundBlaster Feb 10, 2026
201fc24
Implement FU-REBUILD-P10-T1-1: align websocket auth flow
SoundBlaster Feb 10, 2026
1df9ed4
Archive task FU-REBUILD-P10-T1-1: Align websocket auth flow (PASS)
SoundBlaster Feb 10, 2026
ece0382
Review FU-REBUILD-P10-T1-1: websocket auth alignment
SoundBlaster Feb 10, 2026
78a7e79
Archive REVIEW_FU-REBUILD-P10-T1-1_WebSocket_Auth report
SoundBlaster Feb 10, 2026
c07b701
Branch for FU-REBUILD-P10-T1-2: validate web-ui-port input
SoundBlaster Feb 10, 2026
c87d6ae
Select task FU-REBUILD-P10-T1-2: validate web-ui-port input
SoundBlaster Feb 10, 2026
001b4ac
Plan task FU-REBUILD-P10-T1-2: validate web-ui-port input
SoundBlaster Feb 10, 2026
093bfde
Implement FU-REBUILD-P10-T1-2: validate web-ui-port input
SoundBlaster Feb 10, 2026
0294180
Archive task FU-REBUILD-P10-T1-2: validate web-ui-port input (PASS)
SoundBlaster Feb 10, 2026
1a729a0
Review FU-REBUILD-P10-T1-2: web-ui-port validation
SoundBlaster Feb 10, 2026
34c362b
Archive REVIEW_FU-REBUILD-P10-T1-2_WebUI_Port_Validation report
SoundBlaster Feb 10, 2026
cc33c2b
Branch for FU-REBUILD-P10-T1-3: reconcile webui env docs
SoundBlaster Feb 10, 2026
2a2e5e1
Select task FU-REBUILD-P10-T1-3: reconcile webui env docs
SoundBlaster Feb 10, 2026
cb1829b
Plan task FU-REBUILD-P10-T1-3: reconcile webui env docs
SoundBlaster Feb 10, 2026
cbca0dc
Implement FU-REBUILD-P10-T1-3: reconcile webui env docs
SoundBlaster Feb 10, 2026
d67292f
Archive task FU-REBUILD-P10-T1-3: reconcile webui env docs (PASS)
SoundBlaster Feb 10, 2026
26bc74a
Review FU-REBUILD-P10-T1-3: webui env docs reconciliation
SoundBlaster Feb 10, 2026
37a23a5
Archive REVIEW_FU-REBUILD-P10-T1-3_WebUI_Env_Docs report
SoundBlaster Feb 10, 2026
3eeeaff
Add web UI args examples follow-up subtask
SoundBlaster Feb 11, 2026
6f91771
Document Python environment setup and sync DocC
SoundBlaster Feb 11, 2026
1353193
Archive P5-T2 artifacts and add archive primitive script
SoundBlaster Feb 11, 2026
1862977
Archive P4-T9 and move historical artifact
SoundBlaster Feb 11, 2026
a321068
Fix task picker parsing and unify next task file
SoundBlaster Feb 11, 2026
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
13 changes: 6 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fetch-depth: 0 # Need full history for branch comparison

- name: Check DocC sync
run: python scripts/check_doc_sync.py --branch
run: make doccheck-branch
lint:
name: Lint & Type Check
runs-on: ubuntu-latest
Expand All @@ -37,16 +37,16 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff mypy
pip install -e ".[dev]"

- name: Run ruff linter
run: ruff check src/
run: make lint

- name: Run ruff formatter check
run: ruff format --check src/ tests/
run: make format-check

- name: Run mypy type checker
run: mypy src/
run: make typecheck

test:
name: Test (Python ${{ matrix.python-version }})
Expand All @@ -71,8 +71,7 @@ jobs:
pip install -e ".[dev]"

- name: Run tests with coverage
run: |
pytest tests/ -v --cov=src --cov-report=xml --cov-report=term
run: make test

- name: Upload coverage to Codecov
if: matrix.python-version == '3.11'
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,9 @@ Package.resolved
# Task tracker state files
.task_state.json
.current_task

# Specifications
/SPECS/tmp/*

# Web UI
/logs/*
50 changes: 48 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ A Python wrapper (`xcodemcpwrapper`) that intercepts responses from `xcrun mcpbr
| Phase 6: Packaging & Distribution | 8/8 | ✅ Complete |
| Phase 7: Documentation | 11/11 | ✅ Complete |
| Phase 8: Documentation Publishing | 2/2 | ✅ Complete |
| **Total** | **67/67** | **✅ 100%** |
| Phase 10: Web UI Dashboard | 1/1 | ✅ Complete |
| **Total** | **68/68** | **✅ 100%** |

### Metrics

Expand All @@ -62,7 +63,13 @@ A Python wrapper (`xcodemcpwrapper`) that intercepts responses from `xcrun mcpbr
│ ├── __main__.py # Main entry point
│ ├── bridge.py # Subprocess bridge management
│ ├── transform.py # Response transformation engine
│ └── cli.py # CLI entry point
│ ├── cli.py # CLI entry point
│ └── webui/ # Optional Web UI dashboard
│ ├── server.py # FastAPI server
│ ├── metrics.py # Metrics collection
│ ├── audit.py # Audit logging
│ ├── config.py # Web UI configuration
│ └── static/ # Dashboard frontend
├── tests/
│ ├── unit/ # Unit tests (181+ tests)
│ │ ├── test_bridge.py
Expand All @@ -78,6 +85,7 @@ A Python wrapper (`xcodemcpwrapper`) that intercepts responses from `xcrun mcpbr
│ └── codex-cli.txt
├── docs/ # Documentation
│ ├── installation.md
│ ├── webui-setup.md # Web UI dashboard guide
│ ├── cursor-setup.md
│ ├── claude-setup.md
│ ├── codex-setup.md
Expand Down Expand Up @@ -182,6 +190,28 @@ codex mcp add xcode -- uvx --from mcpbridge-wrapper mcpbridge-wrapper
codex mcp add xcode -- /Users/YOUR_USERNAME/bin/xcodemcpwrapper
```

### Web UI Dashboard (Optional)

Enable the Web UI for real-time monitoring and audit logging:

```bash
# Start with Web UI
xcodemcpwrapper --web-ui --web-ui-port 8080

# Or use make
make webui
```

Access the dashboard at http://localhost:8080

Features:
- Real-time metrics (RPS, latency, error rates)
- Tool usage analytics with charts
- Audit logging with export (JSON/CSV)
- Request/response inspector

See [docs/webui-setup.md](docs/webui-setup.md) for detailed configuration.

## Available Xcode MCP Tools

When properly configured, the following 20 tools become available to AI agents:
Expand Down Expand Up @@ -263,13 +293,29 @@ pytest --cov
pytest tests/unit/test_transform.py
pytest tests/integration/test_performance.py

# Run Web UI tests
pytest tests/unit/webui/ tests/integration/webui/ -v

# Run linting
ruff check src/

# Run type checking
mypy src/
```

### Makefile Commands

```bash
make test # Run all tests with coverage
make test-webui # Run Web UI specific tests
make lint # Run linter
make format # Format code
make typecheck # Run type checker
make check # Run all quality gates
make webui # Start wrapper with Web UI
make webui-health # Check Web UI status
```

### Verified with Real Xcode

Tested successfully with real `xcrun mcpbridge`:
Expand Down
39 changes: 38 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ Thank you for your interest in contributing! This document outlines the developm
git clone https://github.com/SoundBlaster/XcodeMCPWrapper.git
cd XcodeMCPWrapper

# Create and activate a virtual environment (recommended on macOS/Homebrew Python)
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --upgrade pip

# Install in editable mode with dev dependencies
pip install -e ".[dev]"
python3 -m pip install -e ".[dev]"
```

## Quality Gates
Expand Down Expand Up @@ -128,6 +133,38 @@ chmod +x check.sh
./check.sh
```

## Adding New Features

When adding new features that require specific commands or dependencies:

### Update the Makefile

Add relevant `make` targets for the new feature. For example:

```makefile
# For optional features with extra dependencies
install-feature:
python3 -m pip install -e ".[feature]"

# For feature-specific tests
test-feature:
pytest tests/unit/feature/ tests/integration/feature/ -v
```

Then update the `.PHONY` line and `help` target to include the new commands.

### Update pyproject.toml

If the feature has optional dependencies, add them to `[project.optional-dependencies]`:

```toml
[project.optional-dependencies]
feature = [
"dependency1>=1.0",
"dependency2>=2.0",
]
```

## Workflow

We follow the [FLOW.md](SPECS/COMMANDS/FLOW.md) workflow:
Expand Down
107 changes: 107 additions & 0 deletions FEATURE_REBUILD/Architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Web UI Dashboard Rebuild Architecture

## Current Pain Points (with evidence)

1. P-001: Weak abstraction between metrics implementations.
- Evidence: `create_app()` is typed for `MetricsCollector`, but runtime passes `SharedMetricsStore` with `# type: ignore[arg-type]` in `src/mcpbridge_wrapper/__main__.py`.
- Impact: Hidden interface drift risk and reduced static safety.

2. P-002: Shared metrics summary semantics are lossy.
- Evidence: `SharedMetricsStore.get_summary()` computes per-tool latency percentiles with simplified approximations and derives `uptime_seconds` from the query window, not process/service lifetime in `src/mcpbridge_wrapper/webui/shared_metrics.py`.
- Impact: Dashboard metrics can be misleading under non-trivial traffic.

3. P-003: Auth flow inconsistency for WebSocket path.
- Evidence: server expects query token for websocket auth while dashboard websocket connection is opened without token in `src/mcpbridge_wrapper/webui/server.py` and `src/mcpbridge_wrapper/webui/static/dashboard.js`.
- Impact: Auth-enabled deployments can lose real-time updates.

4. P-004: CLI parsing lacks resilient validation.
- Evidence: direct `int()` casts on `--web-ui-port` values in `src/mcpbridge_wrapper/__main__.py`.
- Impact: invalid input can terminate process with uncaught `ValueError`.

5. P-005: Operator documentation mismatch.
- Evidence: `docs/webui-setup.md` references `MCP_WRAPPER_WEB_UI*` while code consumes `WEBUI_*` and `--web-ui`.
- Impact: misconfiguration and support churn.

## Target Principles

- Contract-first: define shared protocols for metrics/audit/config interfaces used by server and runtime.
- Deterministic behavior: explicit validation and error boundaries at CLI/API edges.
- Compatibility-first: preserve externally visible API routes and payload schema.
- Replace type-ignore coupling with static interface compliance.
- Keep observability consistent across single-process and multi-process modes.

## Layering & Dependency Rules

- Domain Layer
- Contains data contracts and invariants (`MetricsSummary`, `TimeseriesPoint`, `AuditEntry`).
- No filesystem, network, or subprocess dependencies.

- Application Layer
- Orchestrates request tracking, metrics updates, and audit recording.
- Depends on Domain contracts and storage/transport protocols.

- Adapters Layer
- Implements storage and transport: SQLite metrics store, in-memory metrics store, JSONL audit store, FastAPI endpoints, WebSocket stream.
- Depends on Application and Domain.

- Interface Layer
- CLI argument handling and entrypoint wiring.
- Depends on Application and Adapters.

Dependency rule: higher layers must not import lower-layer concrete implementations directly; dependency inversion via protocols.

## Module Breakdown

- `webui/contracts.py`
- Shared Protocol/TypedDict/Pydantic contracts for metrics, audit, and config snapshots.
- `webui/application/telemetry_service.py`
- Request/response lifecycle orchestration and normalized summary/timeseries generation.
- `webui/adapters/metrics_sqlite.py`
- Process-safe metrics persistence and query implementation.
- `webui/adapters/metrics_memory.py`
- In-memory metrics implementation for tests and single-process tooling.
- `webui/adapters/audit_jsonl.py`
- Rotated audit logging and exports.
- `webui/http/server.py`
- Route definitions, auth checks, serialization.
- `__main__.py`
- CLI parsing, bridge wiring, and service bootstrap.

## Key Data Flows (sequence bullets)

- Flow A: Startup
- CLI parses flags -> loads config -> creates telemetry service -> starts server adapter.
- Flow B: MCP request/response tracking
- stdin request callback -> track request id/tool/start time -> stdout response match -> record latency/error -> append audit entry.
- Flow C: Dashboard read path
- HTTP/WS request -> auth guard -> telemetry service snapshot -> serialize stable response contract.
- Flow D: Reset path
- POST reset -> telemetry service clear -> storage adapter reset -> acknowledgment response.

## State Management Approach

- Canonical telemetry state resides in metrics store adapter.
- Pending in-flight map remains in application layer and is bounded by active request IDs.
- Audit history uses append-only persistence plus bounded in-memory recent cache.

## Error Handling Strategy

- CLI validation errors return explicit user-facing messages and non-zero exit codes.
- Adapter failures map to bounded API errors without exposing sensitive internals.
- WebSocket auth failures return deterministic unauthorized close codes.
- Non-fatal telemetry capture failures must not break MCP forwarding path.

## Testing Strategy

- Domain/contracts: unit tests for schema stability and invariant checks.
- Application: deterministic lifecycle tests (tracked, matched, unmatched, error paths).
- Adapters: integration tests for SQLite bucketing, audit rotation, export format.
- HTTP/WS: endpoint contract tests and auth-mode tests (including websocket auth path).
- End-to-end: wrapper + web UI behavior in multi-process simulation.

## Risks

- Refactor can accidentally change payload formats if contracts are not centralized.
- Multi-process timing variability can make timeseries tests flaky if too strict.
- Auth flow changes can break existing local setups if rollout is not backward-compatible.
- Performance regressions are possible if telemetry queries become heavier without indexes.
66 changes: 66 additions & 0 deletions FEATURE_REBUILD/CompatibilityHarness.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Web UI Rebuild Compatibility Harness

## What Must Match (MUST list)

1. `/api/metrics` key set and value types used by dashboard remain unchanged.
2. `/api/metrics/timeseries` returns `{requests, errors, latencies}` arrays of `{t, v}`.
3. `/api/audit` pagination/filter behavior remains stable.
4. `/api/audit/export/json` and `/api/audit/export/csv` remain downloadable with valid payloads.
5. Non-auth mode dashboard continues to show live metrics via websocket or polling fallback.
6. Wrapper behavior without `--web-ui` remains unchanged.

## What May Change (MAY list)

1. Internal module boundaries and abstractions.
2. Internal storage query implementation details.
3. Error message wording, provided status codes and actionable guidance remain equivalent.

## Golden Sources (tests/fixtures/snapshots/logs)

- Test suites:
- `tests/unit/webui/test_server.py`
- `tests/unit/webui/test_shared_metrics.py`
- `tests/integration/webui/test_e2e.py`
- `tests/unit/test_main.py`
- Planned fixtures:
- `tests/fixtures/webui/metrics_summary.json`
- `tests/fixtures/webui/metrics_timeseries.json`
- `tests/fixtures/webui/audit_page.json`
- Historical evidence:
- `SPECS/INPROGRESS/Web_UI_Debugging_Summary.md`
- `SPECS/ARCHIVE/P10-T2_Fix_Web_UI_Timeseries_Charts/P10-T2_Validation_Report.md`

## Parity Check Plan (how we compare)

1. API schema parity
- Compare runtime responses against fixture schemas for required keys/types.
2. Behavior parity
- Replay request/response tracking scenario; assert summary counters and in-flight transitions.
3. Timeseries parity
- Assert chart payload format and bounded `t` range.
4. Audit parity
- Assert filter/pagination/export output shape and ordering.
5. Auth parity
- Assert protected endpoints return `401` without credentials and success with valid credentials.
6. Non-WebUI parity
- Run core wrapper tests without `--web-ui`; assert no behavior deltas.

## CI Integration

- Add compatibility harness to CI quality gate for Web UI touching changes:
- `pytest tests/integration/webui/test_compat_harness.py -v`
- `pytest tests/unit/webui/ tests/integration/webui/ -v`
- Keep existing global checks:
- `pytest`
- `ruff check src/ tests/`
- `mypy src/`

## Rollback Strategy

- Deployment model: single PR rollout with immediate revert path.
- Rollback trigger:
- API contract mismatch, auth regression, or chart data regression in harness.
- Rollback action:
1. Revert rebuild commit set.
2. Re-run baseline Web UI test suites.
3. Restore last known good release notes and docs references.
Loading
Loading