# Build the TypeScript source.
compile:
    npm run compile

# Build all syncjs-mcp binaries and copy them into the extension's bin/ directory.
# Requires the syncjs-mcp project to be at ../syncjs-mcp relative to this repo.
build-binaries:
    cd ../syncjs-mcp && just release
    mkdir -p bin/linux-x64 bin/linux-arm64 bin/win32-x64
    cp ../syncjs-mcp/_OUT/Linux_x86_64/syncjs-mcp  bin/linux-x64/syncjs-mcp
    cp ../syncjs-mcp/_OUT/Linux_arm_64/syncjs-mcp  bin/linux-arm64/syncjs-mcp
    cp ../syncjs-mcp/_OUT/Win64/syncjs-mcp.exe      bin/win32-x64/syncjs-mcp.exe
    chmod +x bin/linux-x64/syncjs-mcp bin/linux-arm64/syncjs-mcp

# Package a universal VSIX that bundles all platform binaries.
# Use this for local installs and testing.  The file size is larger but a single
# VSIX works on Linux x64, Linux arm64, and Windows x64.
package: compile
    npm run package

# Package separate platform-targeted VSIXes.  Use these for Marketplace publishing.
package-all: compile
    npm run package:linux-x64
    npm run package:linux-arm64
    npm run package:win32-x64

# Full release: compile TypeScript, copy binaries, build all platform VSIXes.
release: compile build-binaries package-all

# Quick local install for development and testing (current platform only).
install-local: package
    code --install-extension syncjs-*.vsix

# Regenerate the .d.ts files from APIManifest() and the product descriptors.
# Requires the syncjs-mcp project to be at ../syncjs-mcp relative to this repo.
# TODO: implement the generator Go program at syncjs-mcp/tools/dts when needed.
# generate-dts:
#     cd ../syncjs-mcp && go run ./tools/dts/main.go --out ../syncjs-vscode-ext/typings
