Makefile•2.72 kB
SHELL := /bin/bash
.PHONY: help install build test test-watch lint lint-fix format format-check check run list rpc demo docker-build docker-run env-check push-all push-tags add-remote clean
# Resolve command: prefer compiled dist, fallback to tsx
CMD := $(shell [ -f dist/cli.js ] && echo bin/mcp-gitlab-jira || echo "npx tsx src/cli.ts")
help:
@echo "Targets:"
@echo " make install Install dependencies"
@echo " make build Compile TypeScript to dist/"
@echo " make test Run tests with coverage"
@echo " make test-watch Run tests in watch mode"
@echo " make lint|lint-fix Lint or fix lint issues"
@echo " make format|format-check Format or check formatting"
@echo " make check Lint + format-check + test"
@echo " make run Start server (stdio JSON-RPC)"
@echo " make list Send mcp.tools.list to server"
@echo " make rpc METHOD=... PARAMS='{}' Send arbitrary JSON-RPC to server"
@echo " make demo Build and run demo JSONL requests"
@echo " make docker-build Build Docker image (IMAGE?=mcp-gitlab-jira:local)"
@echo " make docker-run Run Docker container (requires env vars)"
@echo " make env-check Check required env vars are set"
@echo " make clean Remove dist/ and coverage/"
install:
npm ci
build:
npm run build
test:
npm test
test-watch:
npm run test:watch
lint:
npm run lint
lint-fix:
npm run lint:fix
format:
npm run format
format-check:
npm run format:check
check: lint format-check test
run:
$(CMD)
list:
@printf '{"jsonrpc":"2.0","id":1,"method":"mcp.tools.list"}\n' | $(CMD)
# Usage: make rpc METHOD="mcp.tools.call" PARAMS='{"name":"gitlab_list_projects","args":{}}'
rpc:
@: $${METHOD:?"METHOD is required"}
@: $${PARAMS:?"PARAMS is required"}
@printf '{"jsonrpc":"2.0","id":1,"method":"%s","params":%s}\n' "$(METHOD)" "$(PARAMS)" | $(CMD)
demo:
npm run build
scripts/run-demo.sh
IMAGE ?= mcp-gitlab-jira:local
docker-build:
docker build -t $(IMAGE) .
env-check:
@if [ -z "$$GITLAB_URL" ] || [ -z "$$GITLAB_TOKEN" ] || [ -z "$$JIRA_URL" ] || [ -z "$$JIRA_TOKEN" ]; then \
echo "Missing env. Set GITLAB_URL, GITLAB_TOKEN, JIRA_URL, JIRA_TOKEN"; \
exit 1; \
fi
docker-run: env-check
docker run --rm \
-e GITLAB_URL -e GITLAB_TOKEN -e JIRA_URL -e JIRA_TOKEN \
$(IMAGE)
# Git remotes and pushes
REMOTE ?= origin
NAME ?= gitlab
REMOTE_URL ?=
add-remote:
@: $${REMOTE_URL:?"REMOTE_URL is required, e.g., git@gitlab.com:group/repo.git"}
git remote add $(NAME) $(REMOTE_URL) || git remote set-url $(NAME) $(REMOTE_URL)
git remote -v
push-all:
git push $(REMOTE) --all
push-tags:
git push $(REMOTE) --tags
clean:
rm -rf dist coverage