@supersdk/supercli 0.1.0-dev.1
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/dist/api/consoleClient.js +132 -0
- package/dist/api/consoleClient.js.map +1 -0
- package/dist/auth/browserAuth.js +163 -0
- package/dist/auth/browserAuth.js.map +1 -0
- package/dist/auth/refresh.js +32 -0
- package/dist/auth/refresh.js.map +1 -0
- package/dist/cli.js +46 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/accounts.js +46 -0
- package/dist/commands/accounts.js.map +1 -0
- package/dist/commands/createApp.js +225 -0
- package/dist/commands/createApp.js.map +1 -0
- package/dist/commands/login.js +54 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.js +99 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/publishSite.js +361 -0
- package/dist/commands/publishSite.js.map +1 -0
- package/dist/commands/switchaccount.js +35 -0
- package/dist/commands/switchaccount.js.map +1 -0
- package/dist/commands/update.js +95 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/config/environments.js +53 -0
- package/dist/config/environments.js.map +1 -0
- package/dist/createApp/copyTemplate.js +237 -0
- package/dist/createApp/copyTemplate.js.map +1 -0
- package/dist/publish/orgResolve.js +30 -0
- package/dist/publish/orgResolve.js.map +1 -0
- package/dist/publish/responseClassifier.js +111 -0
- package/dist/publish/responseClassifier.js.map +1 -0
- package/dist/publish/siteClient.js +113 -0
- package/dist/publish/siteClient.js.map +1 -0
- package/dist/publish/siteConfig.js +190 -0
- package/dist/publish/siteConfig.js.map +1 -0
- package/dist/publish/siteZip.js +172 -0
- package/dist/publish/siteZip.js.map +1 -0
- package/dist/store/accountStore.js +236 -0
- package/dist/store/accountStore.js.map +1 -0
- package/dist/store/backends/encryptedFile.js +162 -0
- package/dist/store/backends/encryptedFile.js.map +1 -0
- package/dist/store/backends/osKeyring.js +283 -0
- package/dist/store/backends/osKeyring.js.map +1 -0
- package/dist/store/credentialStore.js +65 -0
- package/dist/store/credentialStore.js.map +1 -0
- package/dist/template/README.md +144 -0
- package/dist/template/android/.gitkeep +1 -0
- package/dist/template/android/app/build.gradle.kts +122 -0
- package/dist/template/android/app/src/main/AndroidManifest.xml +19 -0
- package/dist/template/android/app/src/main/java/com/supersdk/simple/MainActivity.java +17 -0
- package/dist/template/android/app/src/main/java/com/supersdk/simple/SimpleApplication.java +22 -0
- package/dist/template/android/app/src/test/java/com/supersdk/simple/AppNameResourceTest.java +19 -0
- package/dist/template/android/build.gradle.kts +3 -0
- package/dist/template/android/gradle/supersdk-config-reader.gradle +61 -0
- package/dist/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/dist/template/android/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/dist/template/android/gradle.properties +3 -0
- package/dist/template/android/gradlew +251 -0
- package/dist/template/android/settings.gradle.kts +25 -0
- package/dist/template/android/supersdk-default.config.json +17 -0
- package/dist/template/ios/MockSuperSDKPackage/Package.swift +15 -0
- package/dist/template/ios/MockSuperSDKPackage/Sources/SuperSDK/SuperSDK.swift +25 -0
- package/dist/template/ios/Resources/Info.plist +43 -0
- package/dist/template/ios/Sources/App/AppDelegate.swift +20 -0
- package/dist/template/ios/Sources/App/SceneDelegate.swift +14 -0
- package/dist/template/ios/Sources/App/SimpleSDKBootstrap.swift +7 -0
- package/dist/template/ios/Sources/App/SimpleSDKProbe.swift +26 -0
- package/dist/template/ios/Sources/App/SimpleSDKProvider.swift +4 -0
- package/dist/template/ios/Sources/App/SimpleViewController.swift +20 -0
- package/dist/template/ios/Tests/SimpleAppTests/SimpleSDKInitializationTests.swift +17 -0
- package/dist/template/ios/project.yml +67 -0
- package/dist/template/scripts/android_snapshot_canary.py +136 -0
- package/dist/template/scripts/build_android.sh +240 -0
- package/dist/template/scripts/build_ios.sh +261 -0
- package/dist/template/scripts/build_web.sh +12 -0
- package/dist/template/scripts/serve_web.py +51 -0
- package/dist/template/scripts/super_build_orchestrator.py +400 -0
- package/dist/template/scripts/supersdk_template.py +611 -0
- package/dist/template/scripts/web_host_validator.py +103 -0
- package/dist/template/scripts/web_package.py +202 -0
- package/dist/template/scripts/ws03_shared_schema_merge_guard.py +73 -0
- package/dist/template/super_build.sh +116 -0
- package/dist/template/supersdk.yaml +15 -0
- package/dist/template/web/src/css/style.css +83 -0
- package/dist/template/web/src/index.html +37 -0
- package/dist/template/web/src/js/app.js +99 -0
- package/dist/template/web/src/js/supersdk.js +1848 -0
- package/dist/template/web/src/js/supersdk.provenance.json +6 -0
- package/dist/update/channelResolver.js +183 -0
- package/dist/update/channelResolver.js.map +1 -0
- package/dist/update/installSafety.js +135 -0
- package/dist/update/installSafety.js.map +1 -0
- package/dist/util/fsAtomic.js +294 -0
- package/dist/util/fsAtomic.js.map +1 -0
- package/dist/util/log.js +55 -0
- package/dist/util/log.js.map +1 -0
- package/dist/util/origin.js +66 -0
- package/dist/util/origin.js.map +1 -0
- package/dist/util/prompt.js +113 -0
- package/dist/util/prompt.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import argparse
|
|
3
|
+
import ipaddress
|
|
4
|
+
import re
|
|
5
|
+
import sys
|
|
6
|
+
from urllib.parse import urlparse
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
HOST_DIAGNOSTIC = (
|
|
10
|
+
"offline package host must be a deployable bare domain; "
|
|
11
|
+
"localhost, IP literals, single-label hosts, whitespace, trailing dots, "
|
|
12
|
+
"numeric TLDs, and non-ASCII/IDN input are not supported"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class HostValidationError(ValueError):
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _fail():
|
|
21
|
+
raise HostValidationError(HOST_DIAGNOSTIC)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _contains_whitespace(value):
|
|
25
|
+
return any(ch.isspace() for ch in value)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _is_ip_literal(value):
|
|
29
|
+
try:
|
|
30
|
+
ipaddress.ip_address(value)
|
|
31
|
+
return True
|
|
32
|
+
except ValueError:
|
|
33
|
+
return False
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _validate_bare_host(host):
|
|
37
|
+
if not host or _contains_whitespace(host):
|
|
38
|
+
_fail()
|
|
39
|
+
try:
|
|
40
|
+
host.encode("ascii")
|
|
41
|
+
except UnicodeEncodeError:
|
|
42
|
+
_fail()
|
|
43
|
+
if host != host.lower():
|
|
44
|
+
host = host.lower()
|
|
45
|
+
if host == "localhost" or _is_ip_literal(host):
|
|
46
|
+
_fail()
|
|
47
|
+
if host.startswith(".") or host.endswith(".") or ".." in host:
|
|
48
|
+
_fail()
|
|
49
|
+
if len(host) > 253:
|
|
50
|
+
_fail()
|
|
51
|
+
|
|
52
|
+
labels = host.split(".")
|
|
53
|
+
if len(labels) < 2:
|
|
54
|
+
_fail()
|
|
55
|
+
label_re = re.compile(r"^[a-z0-9]([a-z0-9-]*[a-z0-9])?$")
|
|
56
|
+
for label in labels:
|
|
57
|
+
if len(label) < 1 or len(label) > 63 or not label_re.fullmatch(label):
|
|
58
|
+
_fail()
|
|
59
|
+
if labels[-1].isdigit():
|
|
60
|
+
_fail()
|
|
61
|
+
if len(labels) == 4 and all(label.isdigit() for label in labels):
|
|
62
|
+
_fail()
|
|
63
|
+
return host
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def normalize_host(raw):
|
|
67
|
+
if raw is None:
|
|
68
|
+
_fail()
|
|
69
|
+
if not isinstance(raw, str):
|
|
70
|
+
_fail()
|
|
71
|
+
if raw == "" or raw != raw.strip() or _contains_whitespace(raw):
|
|
72
|
+
_fail()
|
|
73
|
+
try:
|
|
74
|
+
raw.encode("ascii")
|
|
75
|
+
except UnicodeEncodeError:
|
|
76
|
+
_fail()
|
|
77
|
+
|
|
78
|
+
if "://" in raw:
|
|
79
|
+
parsed = urlparse(raw)
|
|
80
|
+
if parsed.scheme.lower() not in ("http", "https") or not parsed.hostname:
|
|
81
|
+
_fail()
|
|
82
|
+
host = parsed.hostname.lower()
|
|
83
|
+
else:
|
|
84
|
+
if ":" in raw:
|
|
85
|
+
_fail()
|
|
86
|
+
host = raw.lower()
|
|
87
|
+
return _validate_bare_host(host)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def main(argv=None):
|
|
91
|
+
parser = argparse.ArgumentParser(description="Normalize a Web offline-package host")
|
|
92
|
+
parser.add_argument("--host", required=True)
|
|
93
|
+
args = parser.parse_args(argv)
|
|
94
|
+
try:
|
|
95
|
+
print(normalize_host(args.host))
|
|
96
|
+
except HostValidationError as exc:
|
|
97
|
+
print(f"web.host: {exc}", file=sys.stderr)
|
|
98
|
+
return 1
|
|
99
|
+
return 0
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
if __name__ == "__main__":
|
|
103
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import argparse
|
|
3
|
+
import hashlib
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
import re
|
|
7
|
+
import shutil
|
|
8
|
+
import sys
|
|
9
|
+
import tempfile
|
|
10
|
+
import time
|
|
11
|
+
import zipfile
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
from web_host_validator import HostValidationError, normalize_host
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
REQUIRED_ASSETS = ("index.html", "js/app.js", "js/supersdk.js", "css/style.css")
|
|
18
|
+
EXCLUDED_ASSETS = {"__super_meta.json", ".DS_Store", "js/supersdk.provenance.json"}
|
|
19
|
+
HEX64 = set("0123456789abcdef")
|
|
20
|
+
VERSION_PATTERN = re.compile(r"^[0-9]+\.[0-9]+\.[0-9]+$")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class WebPackageError(Exception):
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def validate_version(value):
|
|
28
|
+
if not isinstance(value, str) or not VERSION_PATTERN.fullmatch(value):
|
|
29
|
+
raise WebPackageError("version.name: must match x.y.z")
|
|
30
|
+
parts = value.split(".")
|
|
31
|
+
for part in parts:
|
|
32
|
+
if len(part) > 1 and part.startswith("0"):
|
|
33
|
+
raise WebPackageError("version.name: must match x.y.z")
|
|
34
|
+
minor = int(parts[1])
|
|
35
|
+
patch = int(parts[2])
|
|
36
|
+
if minor > 99 or patch > 99:
|
|
37
|
+
raise WebPackageError("version.name: must match x.y.z with minor and patch <= 99")
|
|
38
|
+
return value
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def validate_source(src):
|
|
42
|
+
root = Path(src)
|
|
43
|
+
if not root.is_dir():
|
|
44
|
+
raise WebPackageError(f"web package source missing: {root}")
|
|
45
|
+
for asset in REQUIRED_ASSETS:
|
|
46
|
+
if not (root / asset).is_file():
|
|
47
|
+
raise WebPackageError(f"web package asset missing: {asset}")
|
|
48
|
+
validate_provenance(root)
|
|
49
|
+
return root
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def validate_provenance(root):
|
|
53
|
+
provenance_path = root / "js" / "supersdk.provenance.json"
|
|
54
|
+
vendored_path = root / "js" / "supersdk.js"
|
|
55
|
+
if not provenance_path.is_file():
|
|
56
|
+
raise WebPackageError("supersdk.provenance.json: missing")
|
|
57
|
+
try:
|
|
58
|
+
provenance = json.loads(provenance_path.read_text(encoding="utf-8"))
|
|
59
|
+
except (OSError, json.JSONDecodeError, UnicodeDecodeError) as exc:
|
|
60
|
+
raise WebPackageError("supersdk.provenance.json: invalid JSON") from exc
|
|
61
|
+
vendored_hash = provenance.get("vendored_sha256") if isinstance(provenance, dict) else None
|
|
62
|
+
if not isinstance(vendored_hash, str) or len(vendored_hash) != 64 or any(ch not in HEX64 for ch in vendored_hash):
|
|
63
|
+
raise WebPackageError("supersdk.provenance.json: vendored_sha256 must be 64 hex")
|
|
64
|
+
actual = hashlib.sha256(vendored_path.read_bytes()).hexdigest()
|
|
65
|
+
if actual != vendored_hash:
|
|
66
|
+
raise WebPackageError("supersdk.provenance.json: vendored_sha256 mismatch")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def validate_inputs(src, host, version):
|
|
70
|
+
try:
|
|
71
|
+
normalized_host = normalize_host(host)
|
|
72
|
+
except HostValidationError as exc:
|
|
73
|
+
raise WebPackageError(f"web.host: {exc}") from exc
|
|
74
|
+
normalized_version = validate_version(version)
|
|
75
|
+
source_root = validate_source(src)
|
|
76
|
+
return source_root, normalized_host, normalized_version
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def iter_package_files(root):
|
|
80
|
+
for path in sorted(root.rglob("*")):
|
|
81
|
+
if not path.is_file():
|
|
82
|
+
continue
|
|
83
|
+
rel = path.relative_to(root).as_posix()
|
|
84
|
+
if rel in EXCLUDED_ASSETS or path.name == ".DS_Store":
|
|
85
|
+
continue
|
|
86
|
+
yield rel, path
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def copy_package_root(src):
|
|
90
|
+
staging_parent = Path(tempfile.mkdtemp(prefix="supersdk-web-package-"))
|
|
91
|
+
staging = staging_parent / "package"
|
|
92
|
+
shutil.copytree(src, staging)
|
|
93
|
+
return staging_parent, staging
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def write_meta(staging, version):
|
|
97
|
+
file_map = {}
|
|
98
|
+
for rel, path in iter_package_files(staging):
|
|
99
|
+
file_map[rel] = {"length": path.stat().st_size}
|
|
100
|
+
meta = {
|
|
101
|
+
"__ver": 1,
|
|
102
|
+
"app_version": version,
|
|
103
|
+
"build_time": int(time.time()),
|
|
104
|
+
"file_map": file_map,
|
|
105
|
+
}
|
|
106
|
+
(staging / "__super_meta.json").write_text(json.dumps(meta, separators=(",", ":")) + "\n", encoding="utf-8")
|
|
107
|
+
return meta
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def zip_staging(staging, output_dir, host, version):
|
|
111
|
+
output = Path(output_dir)
|
|
112
|
+
output.mkdir(parents=True, exist_ok=True)
|
|
113
|
+
temp_zip = output / f"_temp_package_{os.getpid()}_{time.time_ns()}.zip"
|
|
114
|
+
try:
|
|
115
|
+
with zipfile.ZipFile(temp_zip, "w", compression=zipfile.ZIP_DEFLATED) as archive:
|
|
116
|
+
for rel, path in iter_package_files(staging):
|
|
117
|
+
archive.write(path, rel)
|
|
118
|
+
archive.write(staging / "__super_meta.json", "__super_meta.json")
|
|
119
|
+
digest = hashlib.md5(temp_zip.read_bytes()).hexdigest()
|
|
120
|
+
final_zip = output / f"{host}@{version}@{digest}.zip"
|
|
121
|
+
if final_zip.exists():
|
|
122
|
+
final_zip.unlink()
|
|
123
|
+
temp_zip.replace(final_zip)
|
|
124
|
+
return final_zip, digest
|
|
125
|
+
finally:
|
|
126
|
+
if temp_zip.exists():
|
|
127
|
+
temp_zip.unlink()
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def package(src, host, version, output_dir):
|
|
131
|
+
source_root, normalized_host, normalized_version = validate_inputs(src, host, version)
|
|
132
|
+
staging_parent, staging = copy_package_root(source_root)
|
|
133
|
+
try:
|
|
134
|
+
meta = write_meta(staging, normalized_version)
|
|
135
|
+
final_zip, digest = zip_staging(staging, output_dir, normalized_host, normalized_version)
|
|
136
|
+
finally:
|
|
137
|
+
shutil.rmtree(staging_parent, ignore_errors=True)
|
|
138
|
+
return {
|
|
139
|
+
"host": normalized_host,
|
|
140
|
+
"version": normalized_version,
|
|
141
|
+
"md5": digest,
|
|
142
|
+
"zip": str(final_zip),
|
|
143
|
+
"file_map": meta["file_map"],
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def package_managed(root):
|
|
148
|
+
app_root = Path(root)
|
|
149
|
+
config_path = app_root / "web" / ".supersdk" / "managed" / "config.json"
|
|
150
|
+
if not config_path.is_file():
|
|
151
|
+
raise WebPackageError(
|
|
152
|
+
"web managed config missing; run scripts/supersdk_template.py inject --platform web or ./super_build.sh --platform web --build"
|
|
153
|
+
)
|
|
154
|
+
try:
|
|
155
|
+
config = json.loads(config_path.read_text(encoding="utf-8"))
|
|
156
|
+
except (OSError, json.JSONDecodeError, UnicodeDecodeError) as exc:
|
|
157
|
+
raise WebPackageError("web managed config invalid") from exc
|
|
158
|
+
if config.get("platform") != "web":
|
|
159
|
+
raise WebPackageError("web managed config invalid")
|
|
160
|
+
platform_config = config.get("platform_config")
|
|
161
|
+
version = config.get("version")
|
|
162
|
+
if not isinstance(platform_config, dict) or not isinstance(version, dict):
|
|
163
|
+
raise WebPackageError("web managed config invalid")
|
|
164
|
+
try:
|
|
165
|
+
return package(app_root / "web" / "src", platform_config.get("host"), version.get("name"), app_root / "output")
|
|
166
|
+
except WebPackageError as exc:
|
|
167
|
+
message = str(exc)
|
|
168
|
+
if message.startswith("web.host:"):
|
|
169
|
+
raise WebPackageError(f"web.host (from supersdk.yaml):{message[len('web.host:'):]}") from exc
|
|
170
|
+
raise
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def main(argv=None):
|
|
174
|
+
parser = argparse.ArgumentParser(description="Validate and package the SuperSDK Web template")
|
|
175
|
+
sub = parser.add_subparsers(dest="command", required=True)
|
|
176
|
+
for name in ("validate", "package"):
|
|
177
|
+
cmd = sub.add_parser(name)
|
|
178
|
+
cmd.add_argument("--src", required=True)
|
|
179
|
+
cmd.add_argument("--host", required=True)
|
|
180
|
+
cmd.add_argument("--version", required=True)
|
|
181
|
+
if name == "package":
|
|
182
|
+
cmd.add_argument("--output-dir", required=True)
|
|
183
|
+
managed = sub.add_parser("package-managed")
|
|
184
|
+
managed.add_argument("--root", required=True)
|
|
185
|
+
args = parser.parse_args(argv)
|
|
186
|
+
try:
|
|
187
|
+
if args.command == "package-managed":
|
|
188
|
+
print(json.dumps(package_managed(args.root), sort_keys=True))
|
|
189
|
+
else:
|
|
190
|
+
source_root, host, version = validate_inputs(args.src, args.host, args.version)
|
|
191
|
+
if args.command == "validate":
|
|
192
|
+
print(json.dumps({"src": str(source_root), "host": host, "version": version}, sort_keys=True))
|
|
193
|
+
else:
|
|
194
|
+
print(json.dumps(package(source_root, host, version, args.output_dir), sort_keys=True))
|
|
195
|
+
except WebPackageError as exc:
|
|
196
|
+
print(str(exc), file=sys.stderr)
|
|
197
|
+
return 1
|
|
198
|
+
return 0
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
if __name__ == "__main__":
|
|
202
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import argparse
|
|
3
|
+
import json
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
REQUIRED_FEATURE_IDS = {
|
|
8
|
+
"SIMP-F260619163809-Android-Maven-Template",
|
|
9
|
+
"SIMP-F260619163821-iOS-SPM-Template",
|
|
10
|
+
"SIMP-F260619163833-Web-JSSDK-Template",
|
|
11
|
+
}
|
|
12
|
+
REQUIRED_GATE = "ws03-shared-managed-config-schema"
|
|
13
|
+
SHARED_PATHS = {
|
|
14
|
+
"supersimples/app_repo_example/scripts/supersdk_template.py",
|
|
15
|
+
"supersimples/tests/test_template_injection.py",
|
|
16
|
+
"supersimples/tests/test_template_config.py",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _normalize_diff_path(path):
|
|
21
|
+
value = str(path).strip().replace("\\", "/")
|
|
22
|
+
while value.startswith("./"):
|
|
23
|
+
value = value[2:]
|
|
24
|
+
marker = "/supersimples/"
|
|
25
|
+
if marker in value:
|
|
26
|
+
value = "supersimples/" + value.rsplit(marker, 1)[1]
|
|
27
|
+
return value
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _touches_shared_schema(diff_paths):
|
|
31
|
+
return any(_normalize_diff_path(path) in SHARED_PATHS for path in diff_paths)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _manifest_ok(target_branch, manifest):
|
|
35
|
+
if not isinstance(manifest, dict):
|
|
36
|
+
return False, "active_gates_manifest must be an object"
|
|
37
|
+
if target_branch != "yolo/su-ws03":
|
|
38
|
+
return False, "target_branch must be yolo/su-ws03 for shared schema changes"
|
|
39
|
+
if manifest.get("target_branch") != "yolo/su-ws03":
|
|
40
|
+
return False, "manifest target_branch must be yolo/su-ws03"
|
|
41
|
+
if not REQUIRED_FEATURE_IDS.issubset(set(manifest.get("feature_ids") or [])):
|
|
42
|
+
return False, "manifest must include all WS-03 feature ids"
|
|
43
|
+
if REQUIRED_GATE not in set(manifest.get("gates") or []):
|
|
44
|
+
return False, f"manifest must include {REQUIRED_GATE}"
|
|
45
|
+
return True, "shared schema batch accepted"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def evaluate_guard(diff_paths, target_branch, active_gates_manifest):
|
|
49
|
+
paths = [_normalize_diff_path(path) for path in diff_paths]
|
|
50
|
+
if not _touches_shared_schema(paths):
|
|
51
|
+
return {"verdict": "accept", "reason": "no shared schema paths touched"}
|
|
52
|
+
ok, reason = _manifest_ok(target_branch, active_gates_manifest)
|
|
53
|
+
return {"verdict": "accept" if ok else "reject", "reason": reason}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def main(argv=None):
|
|
57
|
+
parser = argparse.ArgumentParser(description="Evaluate WS-03 shared schema merge guard inputs")
|
|
58
|
+
parser.add_argument("--target-branch", required=True)
|
|
59
|
+
parser.add_argument("--manifest-json", required=True)
|
|
60
|
+
parser.add_argument("paths", nargs="*")
|
|
61
|
+
args = parser.parse_args(argv)
|
|
62
|
+
try:
|
|
63
|
+
manifest = json.loads(args.manifest_json)
|
|
64
|
+
except json.JSONDecodeError as exc:
|
|
65
|
+
print(f"active_gates_manifest invalid JSON: {exc}", file=sys.stderr)
|
|
66
|
+
return 1
|
|
67
|
+
result = evaluate_guard(args.paths, args.target_branch, manifest)
|
|
68
|
+
print(json.dumps(result, sort_keys=True))
|
|
69
|
+
return 0 if result["verdict"] == "accept" else 1
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
if __name__ == "__main__":
|
|
73
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
APP_ROOT="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
PYTHON_BIN="${PYTHON_BIN:-python3}"
|
|
6
|
+
HELPER="$APP_ROOT/scripts/supersdk_template.py"
|
|
7
|
+
ORCHESTRATOR="$APP_ROOT/scripts/super_build_orchestrator.py"
|
|
8
|
+
|
|
9
|
+
usage() {
|
|
10
|
+
cat <<'EOF'
|
|
11
|
+
Usage: ./super_build.sh [--platform all|android|ios|web] [--plan|--build] [--force] [--config path]
|
|
12
|
+
|
|
13
|
+
Options:
|
|
14
|
+
--platform VALUE Platform to plan/build. Default: all.
|
|
15
|
+
--plan Validate and print the build plan. Default when no mode is set.
|
|
16
|
+
--build Validate, inject managed config, then call platform build stubs.
|
|
17
|
+
--force Allow replacing unmanaged target files during injection.
|
|
18
|
+
--config PATH Config file. Default: ./supersdk.yaml.
|
|
19
|
+
--help Show this help.
|
|
20
|
+
EOF
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
platform="all"
|
|
24
|
+
config="$APP_ROOT/supersdk.yaml"
|
|
25
|
+
mode="plan"
|
|
26
|
+
mode_set=false
|
|
27
|
+
platform_set=false
|
|
28
|
+
config_set=false
|
|
29
|
+
force_set=false
|
|
30
|
+
force=false
|
|
31
|
+
|
|
32
|
+
while [ "$#" -gt 0 ]; do
|
|
33
|
+
case "$1" in
|
|
34
|
+
--help|-h)
|
|
35
|
+
usage
|
|
36
|
+
exit 0
|
|
37
|
+
;;
|
|
38
|
+
--platform)
|
|
39
|
+
if [ "$platform_set" = true ]; then
|
|
40
|
+
echo "error: --platform specified more than once" >&2
|
|
41
|
+
exit 2
|
|
42
|
+
fi
|
|
43
|
+
if [ "$#" -lt 2 ]; then
|
|
44
|
+
echo "error: --platform requires a value" >&2
|
|
45
|
+
exit 2
|
|
46
|
+
fi
|
|
47
|
+
platform="$2"
|
|
48
|
+
platform_set=true
|
|
49
|
+
shift 2
|
|
50
|
+
;;
|
|
51
|
+
--config)
|
|
52
|
+
if [ "$config_set" = true ]; then
|
|
53
|
+
echo "error: --config specified more than once" >&2
|
|
54
|
+
exit 2
|
|
55
|
+
fi
|
|
56
|
+
if [ "$#" -lt 2 ]; then
|
|
57
|
+
echo "error: --config requires a value" >&2
|
|
58
|
+
exit 2
|
|
59
|
+
fi
|
|
60
|
+
config="$2"
|
|
61
|
+
config_set=true
|
|
62
|
+
shift 2
|
|
63
|
+
;;
|
|
64
|
+
--plan)
|
|
65
|
+
if [ "$mode_set" = true ]; then
|
|
66
|
+
echo "error: mode specified more than once" >&2
|
|
67
|
+
exit 2
|
|
68
|
+
fi
|
|
69
|
+
mode="plan"
|
|
70
|
+
mode_set=true
|
|
71
|
+
shift
|
|
72
|
+
;;
|
|
73
|
+
--build)
|
|
74
|
+
if [ "$mode_set" = true ]; then
|
|
75
|
+
echo "error: mode specified more than once" >&2
|
|
76
|
+
exit 2
|
|
77
|
+
fi
|
|
78
|
+
mode="build"
|
|
79
|
+
mode_set=true
|
|
80
|
+
shift
|
|
81
|
+
;;
|
|
82
|
+
--force)
|
|
83
|
+
if [ "$force_set" = true ]; then
|
|
84
|
+
echo "error: --force specified more than once" >&2
|
|
85
|
+
exit 2
|
|
86
|
+
fi
|
|
87
|
+
force=true
|
|
88
|
+
force_set=true
|
|
89
|
+
shift
|
|
90
|
+
;;
|
|
91
|
+
*)
|
|
92
|
+
echo "error: unknown option $1" >&2
|
|
93
|
+
exit 2
|
|
94
|
+
;;
|
|
95
|
+
esac
|
|
96
|
+
done
|
|
97
|
+
|
|
98
|
+
case "$platform" in
|
|
99
|
+
all|android|ios|web) ;;
|
|
100
|
+
*)
|
|
101
|
+
echo "error: invalid platform $platform" >&2
|
|
102
|
+
exit 2
|
|
103
|
+
;;
|
|
104
|
+
esac
|
|
105
|
+
|
|
106
|
+
if [ "$mode" = "plan" ]; then
|
|
107
|
+
exec "$PYTHON_BIN" "$HELPER" plan --root "$APP_ROOT" --config "$config" --platform "$platform"
|
|
108
|
+
fi
|
|
109
|
+
|
|
110
|
+
inject_args=(inject --root "$APP_ROOT" --config "$config" --platform "$platform")
|
|
111
|
+
if [ "$force" = true ]; then
|
|
112
|
+
inject_args+=(--force)
|
|
113
|
+
fi
|
|
114
|
+
"$PYTHON_BIN" "$HELPER" "${inject_args[@]}"
|
|
115
|
+
|
|
116
|
+
exec "$PYTHON_BIN" "$ORCHESTRATOR" --root "$APP_ROOT" --platform "$platform" --config "$config"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
schema_version: 1
|
|
2
|
+
app_id: Demo_App-01
|
|
3
|
+
name: SuperSDK Simple
|
|
4
|
+
android:
|
|
5
|
+
package: com.supersdk.simple.host
|
|
6
|
+
ios:
|
|
7
|
+
bundleId: com.supersdk.simple
|
|
8
|
+
spmMode: mock
|
|
9
|
+
web:
|
|
10
|
+
host: simple.supersdk.com
|
|
11
|
+
version:
|
|
12
|
+
name: "1.0.0"
|
|
13
|
+
code: 1
|
|
14
|
+
sdk:
|
|
15
|
+
androidVersion: 1.0.0.43-SNAPSHOT
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
color-scheme: light;
|
|
3
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
4
|
+
background: #f5f7fb;
|
|
5
|
+
color: #182235;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
* {
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
body {
|
|
13
|
+
margin: 0;
|
|
14
|
+
min-height: 100vh;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.shell {
|
|
18
|
+
display: grid;
|
|
19
|
+
min-height: 100vh;
|
|
20
|
+
place-items: center;
|
|
21
|
+
padding: 32px 16px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.status {
|
|
25
|
+
width: min(720px, 100%);
|
|
26
|
+
border: 1px solid #d9e1ef;
|
|
27
|
+
border-radius: 8px;
|
|
28
|
+
background: #ffffff;
|
|
29
|
+
padding: 28px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
h1 {
|
|
33
|
+
margin: 0 0 24px;
|
|
34
|
+
font-size: 28px;
|
|
35
|
+
font-weight: 700;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.summary {
|
|
39
|
+
display: grid;
|
|
40
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
41
|
+
gap: 16px;
|
|
42
|
+
margin: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.summary div {
|
|
46
|
+
min-width: 0;
|
|
47
|
+
border: 1px solid #e6ebf4;
|
|
48
|
+
border-radius: 8px;
|
|
49
|
+
padding: 14px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
dt {
|
|
53
|
+
margin: 0 0 8px;
|
|
54
|
+
color: #637083;
|
|
55
|
+
font-size: 12px;
|
|
56
|
+
font-weight: 700;
|
|
57
|
+
text-transform: uppercase;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
dd {
|
|
61
|
+
margin: 0;
|
|
62
|
+
overflow-wrap: anywhere;
|
|
63
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
64
|
+
font-size: 15px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.diagnostic {
|
|
68
|
+
margin: 20px 0 0;
|
|
69
|
+
border-left: 4px solid #c2410c;
|
|
70
|
+
background: #fff7ed;
|
|
71
|
+
padding: 12px 14px;
|
|
72
|
+
color: #7c2d12;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@media (max-width: 560px) {
|
|
76
|
+
.summary {
|
|
77
|
+
grid-template-columns: 1fr;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.status {
|
|
81
|
+
padding: 20px;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>SuperSDK Web Template</title>
|
|
7
|
+
<link rel="stylesheet" href="css/style.css">
|
|
8
|
+
<script src="js/supersdk.js" defer></script>
|
|
9
|
+
<script src="js/app.js" defer></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<main class="shell">
|
|
13
|
+
<section class="status">
|
|
14
|
+
<h1>SuperSDK Web</h1>
|
|
15
|
+
<dl class="summary">
|
|
16
|
+
<div>
|
|
17
|
+
<dt>App ID</dt>
|
|
18
|
+
<dd id="appId">-</dd>
|
|
19
|
+
</div>
|
|
20
|
+
<div>
|
|
21
|
+
<dt>App Name</dt>
|
|
22
|
+
<dd id="appName">-</dd>
|
|
23
|
+
</div>
|
|
24
|
+
<div>
|
|
25
|
+
<dt>Host</dt>
|
|
26
|
+
<dd id="host">-</dd>
|
|
27
|
+
</div>
|
|
28
|
+
<div>
|
|
29
|
+
<dt>Version</dt>
|
|
30
|
+
<dd id="version">-</dd>
|
|
31
|
+
</div>
|
|
32
|
+
</dl>
|
|
33
|
+
<p id="diagnostic" class="diagnostic" hidden></p>
|
|
34
|
+
</section>
|
|
35
|
+
</main>
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|