.PHONY: install
install: 
	cd $(CURDIR)/mcp_server_dart && make setup

.PHONY: build
build:
	cd $(CURDIR)/mcp_server_dart && make compile

.PHONY: inspect
inspect:
	cd $(CURDIR)/mcp_server_dart && make inspect 

.PHONY: check-contracts
check-contracts:
	cd $(CURDIR) && \
	bash tool/contracts/check_sdk_parity.sh && \
	bash tool/contracts/check_cli_alias_surface.sh && \
	bash tool/contracts/check_docs_drift.sh && \
	bash tool/contracts/check_plugin_surfaces.sh && \
	bash tool/contracts/check_version_sync.sh && \
	bash tool/contracts/check_skill_assets_drift.sh && \
	bash tool/contracts/check_no_personal_paths.sh && \
	bash tool/contracts/check_changelog_markdown.sh && \
	bash tool/contracts/check_tool_prefix.sh && \
	bash tool/contracts/check_repo_split_paths.sh && \
	bash tool/contracts/check_intentcall_hosted_consumer.sh && \
	steward validate skills/

.PHONY: release-artifacts
release-artifacts:
	cd $(CURDIR) && bash tool/release/build_release_artifacts.sh

.PHONY: sync-version
sync-version:
	cd $(CURDIR) && bash tool/release/sync_version.sh

.PHONY: publish-pub-dry-run publish-pub
publish-pub-dry-run:
	cd $(CURDIR) && bash tool/release/publish_pub_packages.sh

publish-pub:
	cd $(CURDIR) && bash tool/release/publish_pub_packages.sh --execute --skip-existing

# Run the flutter_test_app showcase on macOS and print the canonical VM URI
# once the app is ready. Blocks the terminal so the agent can copy the URI
# into subsequent CLI calls (`--args '{"connection":{"targetId":"<uri>"}}'`).
.PHONY: web-showcase webmcp-chrome-args
web-showcase:
	@bash $(CURDIR)/scripts/run_web_showcase.sh

webmcp-chrome-args:
	dart run mcp_server_dart/bin/flutter_mcp_toolkit.dart webmcp chrome-args

.PHONY: showcase showcase-stop
showcase:
	@bash $(CURDIR)/scripts/run_showcase.sh

showcase-stop:
	@bash $(CURDIR)/scripts/stop_showcase.sh

.PHONY: exec-sweep exec-sweep-web
exec-sweep:
	@test -n "$$WS_URI" || (echo "Set WS_URI from: grep ws .showcase/flutter_app.log" && exit 1)
	PLATFORM=macos bash $(CURDIR)/scripts/run_exec_sweep.sh

exec-sweep-web:
	@test -n "$$WS_URI" || (echo "Set WS_URI from: grep ws .showcase/web_app.log" && exit 1)
	PLATFORM=web bash $(CURDIR)/scripts/run_exec_sweep.sh

.PHONY: web-showcase-tests
web-showcase-tests:
	@bash $(CURDIR)/scripts/run_web_showcase_tests.sh

.PHONY: sync-skills
sync-skills:
	dart run mcp_server_dart/tool/build_skill_assets.dart
	@echo "OK: skill assets regenerated"

.PHONY: check-intentcall-hosted-consumer check-intentcall-sibling-matrix check-intentcall-integration macos-validate-runtime
check-intentcall-hosted-consumer:
	bash $(CURDIR)/tool/contracts/check_intentcall_hosted_consumer.sh

check-intentcall-sibling-matrix:
	bash $(CURDIR)/tool/contracts/check_intentcall_integration.sh

check-intentcall-integration: check-intentcall-sibling-matrix
	@echo "OK: check-intentcall-integration compatibility alias ran check-intentcall-sibling-matrix"

macos-validate-runtime:
	bash $(CURDIR)/tool/evals/run_macos_validate_runtime.sh

.PHONY: dogfood-eval dogfood-eval-static
dogfood-eval:
	bash $(CURDIR)/tool/evals/run_dogfood_eval.sh --merge --run-intentcall-tests

dogfood-eval-static:
	bash $(CURDIR)/tool/evals/run_dogfood_eval.sh --skip-runtime --merge

.PHONY: check-harness
check-harness:
	@test -d ../flutter_harness || (echo "Clone flutter_harness next to mcp_flutter" && exit 1)
	FLUTTER_MCP_TOOLKIT_ROOT="$(CURDIR)" bash ../flutter_harness/tool/harness/check_hs_fixtures.sh

.PHONY: test-harness
test-harness:
	@test -d ../flutter_harness || (echo "Clone flutter_harness next to mcp_flutter" && exit 1)
	cd ../flutter_harness && dart test
