- A GUI-subsystem host has no console code page, so .NET decoded the probes' UTF-8 output with code page 0 and Claude's /usage separators never matched: Claude showed as unavailable in the app but not in the CLI. Probe output is now decoded as UTF-8 and every probe gets valid standard handles, with stdin closed unless it is the Codex RPC. A GUI-subsystem test host reproduces it. - The /usage parser stops at the contributing section and only reports lines that start like a limit line. - snapshot.json no longer defaults appPath to the reader's own path. The app passes its path to the engine and a CLI refresh keeps it, so a Stream Deck key always starts the app (D9, D10). - The CLI is finaltoken-cli on every platform: FinalToken.exe and finaltoken.exe cannot share a folder on Windows. - Day series follow the local calendar day, as Today does. - The dev-only migration from the first store format is gone. - README.md is a short user guide. Refs #1
64 lines
2.8 KiB
Python
Executable File
64 lines
2.8 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""D1/D11: publish the three NativeAOT programs and bundle the plugin assets."""
|
|
import argparse
|
|
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import tempfile
|
|
import zipfile
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('rid', choices=['win-x64', 'linux-x64'])
|
|
parser.add_argument('--out', type=Path)
|
|
parser.add_argument('--skip-app', action='store_true')
|
|
args = parser.parse_args()
|
|
root = Path(__file__).resolve().parent.parent
|
|
output = (args.out or root / 'artifacts' / 'publish' / args.rid).resolve()
|
|
output.mkdir(parents=True, exist_ok=True)
|
|
if any(output.iterdir()):
|
|
parser.error('Output directory must be empty; existing files are never deleted.')
|
|
plugin = output / 'streamdeck' / 'de.finalfactory.finaltoken.sdPlugin'
|
|
with tempfile.TemporaryDirectory(prefix='finaltoken-publish-') as temporary:
|
|
for name in ['App', 'Cli', 'StreamDeck']:
|
|
if name == 'App' and args.skip_app:
|
|
continue
|
|
stage = Path(temporary) / name
|
|
subprocess.run(['dotnet', 'publish', str(root / 'src' / ('FinalToken.' + name)),
|
|
'-c', 'Release', '-r', args.rid, '-p:PublishAot=true',
|
|
'-o', str(stage)], cwd=root, check=True)
|
|
destination = plugin if name == 'StreamDeck' else output
|
|
destination.mkdir(parents=True, exist_ok=True)
|
|
for file in stage.iterdir():
|
|
if file.suffix in ['.pdb', '.dbg']:
|
|
continue
|
|
target = destination / file.name
|
|
if target.exists():
|
|
if file.is_file() and target.is_file() and file.read_bytes() == target.read_bytes():
|
|
continue
|
|
raise RuntimeError('Publish outputs collide: ' + str(target))
|
|
if file.is_dir():
|
|
shutil.copytree(file, target)
|
|
else:
|
|
shutil.copy2(file, target)
|
|
shutil.copytree(root / 'src' / 'FinalToken.StreamDeck' / 'plugin', plugin, dirs_exist_ok=True)
|
|
archive = output.parent / (output.name + '.zip')
|
|
if archive.exists():
|
|
raise RuntimeError('Archive already exists: ' + str(archive))
|
|
temporary_zip = archive.with_suffix('.zip.tmp')
|
|
with zipfile.ZipFile(temporary_zip, 'w', zipfile.ZIP_DEFLATED) as bundle:
|
|
for file in sorted(output.rglob('*')):
|
|
if file.is_file():
|
|
bundle.write(file, file.relative_to(output))
|
|
os.replace(temporary_zip, archive)
|
|
for file in sorted(output.rglob('*')):
|
|
if file.is_file():
|
|
print(str(file.relative_to(output)) + ' (' + str(file.stat().st_size) + ' bytes)')
|
|
print('Archive: ' + str(archive))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|