GITHUB_REPO_URL := https://github.com/josedario87/planilla.git
GITEA_REPO_URL := ssh://<GITEA_USER>@<GITEA_HOST>:<GITEA_PORT>/nucleo000/planilla.git

.PHONY: sync-to-github sync-to-gitea

estructura:
	powershell -ExecutionPolicy Bypass -File ./dev/scripts/estructura.ps1

testdb:
	docker compose -f api/dev/docker-compose.yml up -d

build:
	docker compose build

up:
	docker compose up -d

down:
	docker compose down

todo: estructura build

sync-to-github:
	@echo Synchronizing to GitHub...
	@if not exist ".git\refs\remotes\github" ( \
		echo Adding GitHub remote... && \
		git remote add github $(GITHUB_REPO_URL) \
	)
	git push github --all
	git push github --tags
	@echo Synchronization to GitHub complete.


sync-to-gitea:
	@echo "Synchronizing to Gitea..."
	git fetch github
	git merge github/main

# Declaramos el target como PHONY ya que no corresponde a un archivo real (opcional pero recomendado)

.PHONY: UI agent mcp api
UI:
	cd ui && ( if not exist node_modules npm install ) && npm run dev

agent:
	cd agent && npm install && npm run dev

mcp:
	cd mcp && npm install && npm run dev

api:
	cd api && npm install && npm run dev

# Creates a new Prisma migration in development mode.
# Pass the migration name as an argument, e.g.:
# make prisma-migrate-dev name=my-migration-name
# If no name is provided, it defaults to "new_migration".
prisma-migrate-dev:
	cd api && npx prisma migrate deploy
