@music-league-eras/local-runner 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@music-league-eras/local-runner",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Music League Eras local runner (npx wrapper around the Python scraper runner).",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -31,6 +31,9 @@ const files = [
31
31
  { src: "services/scraper/app/browser/__init__.py", dst: "vendor/python/app/browser/__init__.py" },
32
32
  { src: "services/scraper/app/services/__init__.py", dst: "vendor/python/app/services/__init__.py" },
33
33
 
34
+ // token resolution (prompt/env/flag)
35
+ { src: "services/scraper/app/sync_token.py", dst: "vendor/python/app/sync_token.py" },
36
+
34
37
  // entrypoint + runner
35
38
  { src: "services/scraper/app/local_runner_cli.py", dst: "vendor/python/app/local_runner_cli.py" },
36
39
  { src: "services/scraper/app/local_sync_runner.py", dst: "vendor/python/app/local_sync_runner.py" },
@@ -51,4 +54,3 @@ for (const file of files) {
51
54
  }
52
55
 
53
56
  console.log(`Vendored ${files.length} Python files into ${path.relative(repoRoot, path.join(pkg, "vendor", "python"))}`);
54
-
@@ -0,0 +1,32 @@
1
+ from __future__ import annotations
2
+
3
+ import getpass
4
+ import os
5
+ import sys
6
+
7
+
8
+ def resolve_sync_token(*, flag_token: str | None) -> str:
9
+ token = (flag_token or "").strip()
10
+ if token:
11
+ return token
12
+
13
+ env_token = (os.getenv("ML_ERAS_SYNC_TOKEN") or "").strip()
14
+ if env_token:
15
+ return env_token
16
+
17
+ if not sys.stdin.isatty():
18
+ raise RuntimeError(
19
+ "Missing sync token. Re-run with ML_ERAS_SYNC_TOKEN set, or pass --sync-token."
20
+ )
21
+
22
+ print(
23
+ "Paste the sync token from the web app (input hidden), then press Enter:",
24
+ file=sys.stderr,
25
+ )
26
+ prompted = (getpass.getpass("Sync token: ") or "").strip()
27
+ if not prompted:
28
+ raise RuntimeError(
29
+ "Sync token was empty. Re-run and paste the token from the web app."
30
+ )
31
+ return prompted
32
+