benscode-StitcherApi/mise.toml

49 lines
1.2 KiB
TOML
Raw Normal View History

2025-11-17 13:44:50 +07:00
[env]
ASSET_PATH_RO = "{{ [xdg_cache_home, 'stitch-a-ton', 'asset'] | join_path }}"
CONTEST_HOST = "http://localhost:7007"
CONTEST_ENDPOINT = "/api/image/generate"
CONTEST_OUTPUT = "{{ [cwd, '.contest'] | join_path }}"
DOTNET_ENVIRONMENT = 'Production'
[tools]
dotnet = "8"
xh = "latest"
uv = "latest"
[tasks.arrange]
run = '''
{% if env.ASSET_PATH_RO is not exists %}
mkdir {{ env.ASSET_PATH_RO }}
{% endif %}
{% if env.CONTEST_OUTPUT is not exists %}
mkdir {{ env.CONTEST_OUTPUT }}
{% endif %}
{% set py = [env.CONTEST_OUTPUT, 'generate.py'] | join_path %}
{% if py is not exists %}
xh get https://null.formulatrix.dev/Contest/stitch-a-ton-answer/raw/branch/main/generate.py -o {{ [env.CONTEST_OUTPUT, 'generate.py'] | join_path }}
{% endif %}
'''
[tasks.serve]
run = "dotnet run -c Release --no-launch-profile --urls {{env.CONTEST_HOST}}"
[tasks.quick]
depends = ['arrange']
run = '''
xh post {{env.CONTEST_HOST}}{{env.CONTEST_ENDPOINT}} canvas_rect=A1:H12 crop_offset:=[0,0] crop_size:=[1,1] output_scale:=0.25 -o {{ [env.CONTEST_OUTPUT, 'quick.png'] | join_path }}
'''
[tasks.action]
depends = ['arrange']
run = '''
uv run --script {{ [env.CONTEST_OUTPUT, 'generate.py'] | join_path }}
'''
[tasks.assert]
depends = ['action']
run = '''
echo not_implemented
'''