SHELL := /usr/bin/env bash

.DEFAULT_GOAL := help

.PHONY: help install build build-core copy-resources test typecheck lint lint-fix native native-pkg clean sf

help:
	@printf "Available targets:\n"
	@printf "  install           Install workspace dependencies\n"
	@printf "  build             Full build (core + web)\n"
	@printf "  build-core        Core build including copy-resources\n"
	@printf "  copy-resources    Rebuild dist/resources/extensions (sf extension bundles)\n"
	@printf "  test              Run test suite\n"
	@printf "  typecheck         Typecheck extensions/project tsconfigs\n"
	@printf "  lint              Lint (alias for npm run lint)\n"
	@printf "  lint-fix          Lint with autofix\n"
	@printf "  native            Compile rust-engine (npm run build:native)\n"
	@printf "  native-pkg        Build @singularity-forge/native workspace (npm run build:native-pkg)\n"
	@printf "  clean             Remove dist/\n"
	@printf "  sf                Run SF from source (ARGS='status --help')\n"

install:
	npm install

build:
	npm run build

build-core:
	npm run build:core

copy-resources:
	npm run copy-resources

test:
	npm test

typecheck:
	npm run typecheck:extensions

lint:
	npm run lint

lint-fix:
	npm run lint:fix

native:
	npm run build:native

native-pkg:
	npm run build:native-pkg

clean:
	rm -rf dist dist-test

sf:
	./bin/sf-from-source $(ARGS)
