@supersdk/supercli 0.3.2 → 0.3.3-staging.45

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.
Files changed (93) hide show
  1. package/dist/build/artifactIntegrity.js +119 -0
  2. package/dist/build/artifactIntegrity.js.map +1 -0
  3. package/dist/cli.js +22 -11
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/add.js +79 -31
  6. package/dist/commands/add.js.map +1 -1
  7. package/dist/commands/analytics.js +15 -9
  8. package/dist/commands/analytics.js.map +1 -1
  9. package/dist/commands/build.js +231 -0
  10. package/dist/commands/build.js.map +1 -0
  11. package/dist/commands/config.js +170 -0
  12. package/dist/commands/config.js.map +1 -0
  13. package/dist/commands/db.js +24 -19
  14. package/dist/commands/db.js.map +1 -1
  15. package/dist/commands/deploy.js +434 -751
  16. package/dist/commands/deploy.js.map +1 -1
  17. package/dist/commands/env.js +8 -8
  18. package/dist/commands/env.js.map +1 -1
  19. package/dist/commands/image.js +31 -20
  20. package/dist/commands/image.js.map +1 -1
  21. package/dist/commands/init.js +68 -37
  22. package/dist/commands/init.js.map +1 -1
  23. package/dist/commands/logs.js +16 -7
  24. package/dist/commands/logs.js.map +1 -1
  25. package/dist/commands/publishSite.js +28 -943
  26. package/dist/commands/publishSite.js.map +1 -1
  27. package/dist/commands/register.js +51 -30
  28. package/dist/commands/register.js.map +1 -1
  29. package/dist/commands/settings.js +10 -6
  30. package/dist/commands/settings.js.map +1 -1
  31. package/dist/config/appConfig.js +40 -36
  32. package/dist/config/appConfig.js.map +1 -1
  33. package/dist/config/superConfig.js +429 -0
  34. package/dist/config/superConfig.js.map +1 -0
  35. package/dist/deploy/adapterTypes.js +3 -0
  36. package/dist/deploy/adapterTypes.js.map +1 -0
  37. package/dist/deploy/manifest.js +381 -0
  38. package/dist/deploy/manifest.js.map +1 -0
  39. package/dist/deploy/preflight.js +202 -0
  40. package/dist/deploy/preflight.js.map +1 -0
  41. package/dist/deploy/resultWriter.js +178 -0
  42. package/dist/deploy/resultWriter.js.map +1 -0
  43. package/dist/deploy/runAdapter.js +299 -0
  44. package/dist/deploy/runAdapter.js.map +1 -0
  45. package/dist/deploy/siteAdapter.js +182 -0
  46. package/dist/deploy/siteAdapter.js.map +1 -0
  47. package/dist/docker/dockerCli.js +63 -1
  48. package/dist/docker/dockerCli.js.map +1 -1
  49. package/dist/output/envelope.js +5 -1
  50. package/dist/output/envelope.js.map +1 -1
  51. package/dist/output/resultPrinter.js +3 -0
  52. package/dist/output/resultPrinter.js.map +1 -1
  53. package/dist/publish/responseClassifier.js +4 -4
  54. package/dist/publish/responseClassifier.js.map +1 -1
  55. package/dist/publish/runClient.js +11 -11
  56. package/dist/publish/runClient.js.map +1 -1
  57. package/dist/publish/siteZip.js +4 -5
  58. package/dist/publish/siteZip.js.map +1 -1
  59. package/dist/template/README.md +64 -227
  60. package/dist/template/android/app/src/main/java/com/supersdk/simple/EnvironmentStore.java +1 -1
  61. package/dist/template/android/app/src/main/java/com/supersdk/simple/SimpleApplication.java +2 -2
  62. package/dist/template/android/gradle/supersdk-config-reader.gradle +6 -5
  63. package/dist/template/android/supersdk-default.config.json +3 -2
  64. package/dist/template/ios/Sources/App/AppDelegate.swift +1 -1
  65. package/dist/template/ios/Sources/App/SimpleSDKBootstrap.swift +1 -1
  66. package/dist/template/scripts/build_android.sh +26 -10
  67. package/dist/template/scripts/build_ios.sh +41 -9
  68. package/dist/template/scripts/build_service.sh +89 -0
  69. package/dist/template/scripts/build_site.sh +40 -26
  70. package/dist/template/scripts/lib/workspace.sh +4 -4
  71. package/dist/template/scripts/serve_web.py +2 -4
  72. package/dist/template/scripts/super_build_orchestrator.py +278 -355
  73. package/dist/template/scripts/supersdk_template.py +414 -181
  74. package/dist/template/scripts/web_package.py +9 -8
  75. package/dist/template/service/Dockerfile +2 -0
  76. package/dist/template/{supersdk.json → super.json} +20 -1
  77. package/dist/template/super_build.sh +39 -113
  78. package/dist/template/template_manifest.json +5 -4
  79. package/dist/workspace/config.js +81 -119
  80. package/dist/workspace/config.js.map +1 -1
  81. package/dist/workspace/identity.js +15 -14
  82. package/dist/workspace/identity.js.map +1 -1
  83. package/dist/workspace/inspect.js +1 -0
  84. package/dist/workspace/inspect.js.map +1 -1
  85. package/dist/workspace/projectContext.js +93 -0
  86. package/dist/workspace/projectContext.js.map +1 -0
  87. package/dist/workspace/projectIdentity.js +53 -96
  88. package/dist/workspace/projectIdentity.js.map +1 -1
  89. package/dist/workspace/template.js +5 -8
  90. package/dist/workspace/template.js.map +1 -1
  91. package/package.json +2 -2
  92. package/dist/publish/siteConfig.js +0 -649
  93. package/dist/publish/siteConfig.js.map +0 -1
@@ -42,15 +42,14 @@ exports.buildSiteZip = buildSiteZip;
42
42
  //
43
43
  // Rules:
44
44
  // - REQUIRE a root index.html (else a local error, no upload).
45
- // - exclude the root supersdk.json (SITE_CONFIG_FILENAME — the retired
46
- // super-site.yml is no longer a thing) + dotfiles/dotdirs, but KEEP
45
+ // - exclude the root super.json (the workspace config) + dotfiles/dotdirs, but KEEP
47
46
  // .well-known/.
48
47
  // - reject symlinks + path traversal + case-insensitive duplicate paths.
49
48
  // - per-entry <= 25 MiB, file count <= 2000, compressed archive <= 50 MiB.
50
49
  const fs = __importStar(require("node:fs"));
51
50
  const path = __importStar(require("node:path"));
52
51
  const yazl = __importStar(require("yazl"));
53
- const siteConfig_1 = require("./siteConfig");
52
+ const appConfig_1 = require("../config/appConfig");
54
53
  const MiB = 1024 * 1024;
55
54
  exports.DEFAULT_ZIP_LIMITS = {
56
55
  maxFileBytes: 25 * MiB,
@@ -89,11 +88,11 @@ function collectEntries(root, limits) {
89
88
  if (name === '..' || name === '.' || name.includes('\\') || name.includes('/')) {
90
89
  throw new ZipBuildError('PATH_TRAVERSAL', `illegal path entry: ${rel}`);
91
90
  }
92
- // Exclusions: root supersdk.json + dotfiles/dotdirs (keep .well-known/).
91
+ // Exclusions: root super.json + dotfiles/dotdirs (keep .well-known/).
93
92
  // The root config carries spid/orgId — packaging it would publish the
94
93
  // project's identity to a public site whenever the publish dir IS the
95
94
  // repo root (single-page site repos).
96
- if (relPrefix === '' && name === siteConfig_1.SITE_CONFIG_FILENAME)
95
+ if (relPrefix === '' && name === appConfig_1.APP_CONFIG_FILENAME)
97
96
  continue;
98
97
  if (isExcludedSegment(name))
99
98
  continue;
@@ -1 +1 @@
1
- {"version":3,"file":"siteZip.js","sourceRoot":"","sources":["../../src/publish/siteZip.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0IA,oCA2DC;AArMD,iFAAiF;AACjF,+EAA+E;AAC/E,8EAA8E;AAC9E,uDAAuD;AACvD,EAAE;AACF,SAAS;AACT,iEAAiE;AACjE,yEAAyE;AACzE,wEAAwE;AACxE,oBAAoB;AACpB,2EAA2E;AAC3E,6EAA6E;AAC7E,4CAA8B;AAC9B,gDAAkC;AAClC,2CAA6B;AAC7B,6CAAoD;AAEpD,MAAM,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAUX,QAAA,kBAAkB,GAAc;IAC3C,YAAY,EAAE,EAAE,GAAG,GAAG;IACtB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,EAAE,GAAG,GAAG;IACzB,oBAAoB,EAAE,GAAG,GAAG,GAAG;CAChC,CAAC;AAYF,MAAa,aAAc,SAAQ,KAAK;IAE3B;IADX,YACW,IAAkB,EAC3B,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHN,SAAI,GAAJ,IAAI,CAAc;QAI3B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AARD,sCAQC;AAgBD,qFAAqF;AACrF,SAAS,iBAAiB,CAAC,OAAe;IACxC,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,KAAK,aAAa,CAAC;AAC9D,CAAC;AAED,SAAS,cAAc,CAAC,IAAY,EAAE,MAAiB;IACrD,MAAM,OAAO,GAAY,EAAE,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AAC,CAAC,GAAG,CAAC,EAAE,CAAC;AAC7F,CAAC"}
@@ -1,263 +1,100 @@
1
- # SuperSDK Workspace Template
1
+ # SuperSDK multi-project template
2
2
 
3
- This directory is the copy-ready `app_repo_example` template scaffold for a SuperSDK
4
- workspace. One workspace = one `spid`. The directory holding `supersdk.json` is the
5
- workspace root; every project listed in `projects[]` lives in a subdirectory of it.
3
+ This directory is a copy-and-go workspace template. `super.json` schema v4 is the
4
+ single source of truth for one platform project (`spid`) and any number of local
5
+ modules identified by stable `projectId` values.
6
6
 
7
- Edit one root `supersdk.json`, run plan or build from the workspace root, and use the
8
- root ordered summary to inspect project results.
7
+ ## Configuration
9
8
 
10
- Platform status: BL-002 provides the Android Maven host, BL-003 provides the iOS
11
- SPM/mock host, BL-004 provides the Web/JSSDK host, and BL-005 connects them
12
- through the root build orchestration described below.
9
+ The default authority is `<workspace>/super.json`. An alternative product config
10
+ must be selected explicitly with `--config`; helpers never fall back after an
11
+ explicit path fails. The retired `supersdk.json` is not read alongside v4.
13
12
 
14
- ## Layout
13
+ Each project has:
15
14
 
16
- Workspace-level (shared by every project, laid down once by `supercli init`):
15
+ - `projectId`: stable local selector used by `--project`;
16
+ - `type`: one of `android`, `ios`, `site`, or `service`;
17
+ - `dir`: relative project source directory;
18
+ - platform identity/build fields;
19
+ - for `site` and `service`, optional named `deploy[]` targets selected later by
20
+ SuperCLI using `envTarget`.
17
21
 
18
- - `supersdk.json` — the single source of truth for this workspace
19
- - `super_build.sh` — root orchestration entry point
20
- - `scripts/` — the config engine and the per-type build helpers
21
- - `output/` — offline packages, one subdirectory per site project
22
+ Configuration is strict JSON. Duplicate keys, `NaN`/`Infinity`, aliases, unknown
23
+ fields, absolute/traversing paths, overlapping project directories, duplicate
24
+ project IDs, and duplicate `(slug, env)` deployment identities fail closed.
22
25
 
23
- Per-project (copied by `supercli add <type> <dir>`):
26
+ Secrets and runtime values never belong in `super.json`. Service build arguments
27
+ and deployment variables store environment-variable names only. Docker build args
28
+ are not a secret channel because image history may retain them.
24
29
 
25
- - `android/` — Android host, type `android`
26
- - `ios/` — iOS host, type `ios`
27
- - `web/` — Web/site host, type `site`
30
+ ## Build
28
31
 
29
- The directory names above are only defaults. `projects[].dir` may be any relative
30
- path, at any depth (`apps/android`, `clients/mobile/ios`, …). Nothing in the build
31
- scripts assumes a fixed nesting level: they locate the workspace root by searching
32
- upwards for `supersdk.json`, exactly like the CLI does.
33
-
34
- ## Maintainer Flow
32
+ Plan all configured projects:
35
33
 
36
34
  ```bash
37
35
  ./super_build.sh --plan
38
- ./super_build.sh --build
39
- ./super_build.sh --platform site --build
40
- ./super_build.sh --project web --build
41
36
  ```
42
37
 
43
- No arguments are equivalent to `./super_build.sh --plan`. Plan mode validates
44
- `supersdk.json` and prints Android -> iOS -> Site helper order without invoking
45
- project build helpers or emitting `SUPERSDK_BUILD_SUMMARY_JSON=`.
46
-
47
- Build mode validates and injects managed config first, then runs the selected
48
- project helpers in order. The default `./super_build.sh --build` selects every
49
- project. `--platform android|ios|site` selects every project of that type;
50
- `--project <dir>` selects exactly one. Managed config for non-selected projects is
51
- not created or rewritten.
52
-
53
- ## Configuration Checklist
54
-
55
- - Edit `supersdk.json`. It is standard JSON: no comments, no trailing commas.
56
- - Keep `"schemaVersion": 3`.
57
- - Set `spid`: the real 8-character lowercase alphanumeric spid issued by the console.
58
- Replace the example `demo0001`.
59
- - The root `name` is a **description of the workspace**. It is never projected as an
60
- App label. Every android/ios project carries its own `name`, and that is the real
61
- identity (Android app label / iOS display name).
62
- - Set `package` on each android project and `bundleId` on each ios project. Identity
63
- is never derived and never inherited: a missing value fails the build instead of
64
- shipping under the SDK's own reverse-domain namespace.
65
- - `spmMode` defaults to `mock` and uses the bundled `MockSuperSDKPackage`.
66
- - For site projects, `offline.host` is optional and is filled in by the CLI after the
67
- first successful publish. Without it the site still builds `dist/`; only the offline
68
- zip is skipped, and the reason is printed.
69
- - `version` and `sdk` may be set at workspace level and overridden per project. An
70
- override **replaces the whole value** — it is not merged — so a project-level
71
- `version` must set both `name` and `code`.
72
- - Run `./super_build.sh --plan`, then `./super_build.sh --build`.
73
-
74
- ### There is no `environment` in this file
75
-
76
- `environment` is a **runtime** parameter of `SuperSDK.init`, not build configuration.
77
- It is not in `supersdk.json`, not in the managed config, and not in `BuildConfig`.
78
- Omitting it at init time means `prod`. All three demo apps switch environment at
79
- runtime instead:
80
-
81
- - Android: buttons in `MainActivity`, persisted by `EnvironmentStore` (SharedPreferences)
82
- - iOS: a segmented control in `SimpleViewController`, persisted by `EnvironmentStore` (UserDefaults)
83
- - Web: the `Switch environment` selector, persisted in `localStorage`
84
-
85
- The rule across the whole toolchain: **configuration says what this is, publishing says
86
- where it goes, runtime says which environment to talk to.**
87
-
88
- ### CLI-owned keys
89
-
90
- `orgId` and each site project's `deploy[]` are owned by `supercli`. The template
91
- type-checks them (`orgId` a string, `deploy` an array of objects) and otherwise ignores
92
- them, so a site-side schema change can never break an App build. Any other unrecognized
93
- root key is kept as-is.
94
-
95
- `supersdk.json` must be standard JSON in the strict sense. `NaN`, `Infinity`, and
96
- `-Infinity` are rejected even though Python's parser accepts them, because
97
- `supercli` reads the same file with `JSON.parse`, which does not.
98
-
99
- Generated files live under each project's `.supersdk/managed/` directory and
100
- are safe to overwrite only when they contain `managed_by: supersdk-template`.
101
- Use `--force` only when intentionally replacing unmanaged target files.
102
-
103
- ## Migrating From schemaVersion 2
104
-
105
- `schemaVersion: 3` is breaking and there is no backward compatibility. A v2 config
106
- fails closed with the exact command to run:
38
+ Build all projects to a new portable directory:
107
39
 
108
40
  ```bash
109
- python3 scripts/supersdk_template.py migrate --config supersdk.json
41
+ ./super_build.sh --build --output-dir ./output
110
42
  ```
111
43
 
112
- The migration is in-place and moves **no files**: the v2 template directories were
113
- already `android/`, `ios/`, and `web/`, so they become `projects[]` entries pointing at
114
- the same paths. `sites[]` moves verbatim into the site project's `deploy[]`, the v2
115
- `name` becomes each android/ios project's `name`, and the retired root `environment` is
116
- dropped with a printed note.
117
-
118
- The retired `supersdk.yaml` / `supersdk.yml` / `super-site.yml` files are rejected with
119
- a copy-pasteable migration command; there is no silent fallback. The command matches the
120
- situation: with no usable `supersdk.json` it writes the full skeleton first and deletes
121
- the legacy file last, and when `supersdk.json` is already valid it only offers
122
- `rm <legacy>` so pasting it cannot overwrite real values.
123
-
124
- ## Engine Version
125
-
126
- `scripts/supersdk_template.py` is vendored into every workspace and records its
127
- `engine_version` in each managed config. `./super_build.sh` compares that recorded
128
- value with the engine it is about to run and prints a warning when they differ; it
129
- never blocks. If you see that warning, re-run `./super_build.sh --build` to reproject.
130
-
131
- ## Site Output And Publishing
132
-
133
- `<site>/src` is authored input. The site build renders the single publishable
134
- package root at `<site>/dist`:
44
+ Build one stable module:
135
45
 
136
46
  ```bash
137
- ./super_build.sh --platform site --build
47
+ ./super_build.sh --build --project web --output-dir ./output-web
138
48
  ```
139
49
 
140
- That writes `<site>/dist/` (static assets plus the generated
141
- `supersdk-config.json` the browser fallback reads) and, when `offline.host` is set, the
142
- offline package `output/<site dir>/<host>@<version>@<md5>.zip`, both from the same tree.
143
- The zip is not a byte-identical copy of `dist`: it also carries the offline manifest
144
- `__super_meta.json`, which belongs to the offline package only. Offline packages are
145
- namespaced by project directory, so two site projects that share a host and version
146
- cannot overwrite each other's zip.
147
-
148
- `<site>/dist` is the directory to hand to the site publisher:
50
+ Use another config explicitly:
149
51
 
150
52
  ```bash
151
- supercli publish-site web/dist --spid <spid> --slug <slug> --env <env> --version <x.y.z>
152
- ```
153
-
154
- `dist` is a build output: it is gitignored and replaced wholesale on every
155
- build. Never edit it by hand, and never point the publisher at `<site>/src` — that
156
- tree has no runtime config and still carries `js/supersdk.provenance.json`.
157
-
158
- For local debugging, `python3 scripts/serve_web.py` serves the built `dist` when it
159
- exists and falls back to the unbuilt `src` with a warning.
160
-
161
- ## Ordered Summary
162
-
163
- Build mode writes exactly one root-owned machine-readable stdout line:
164
-
165
- ```text
166
- SUPERSDK_BUILD_SUMMARY_JSON={"schema_version":2,...}
53
+ ./super_build.sh --build --config ./super.other.json --output-dir ./output-other
167
54
  ```
168
55
 
169
- Consumers must parse only lines that start with `SUPERSDK_BUILD_SUMMARY_JSON=`.
170
- Helper output is forwarded with prefixes such as `[android stderr]`, so helper
171
- logs cannot create another root summary token. Do not assume the summary is the
172
- last stdout line: a helper process with a lingering output pipe may still emit a
173
- late prefixed line after the summary. Locate the summary by its line prefix.
174
-
175
- Summary fields are:
176
-
177
- - `schema_version`
178
- - `overall_status`
179
- - `overall_exit_code`
180
- - `platforms`
181
- - `platform`
182
- - `dir`
183
- - `status`
184
- - `exit_code`
185
- - `reason`
186
- - `command`
187
-
188
- `platform` is the project type and `dir` is the project directory. A workspace may
189
- hold several projects of the same type, so `dir` is what identifies a row.
56
+ The output directory must not already exist. A build always uses fixed bundled
57
+ helpers; config cannot provide commands or plugins. Android produces APK/AAB,
58
+ iOS produces its archive (or an explicit platform-tool skip), site produces a
59
+ publishable `dist` plus optional offline zip, and service runs local `docker build`
60
+ then `docker save` without logging in, pushing, or creating a registry resource.
190
61
 
191
- Project `status` is `success`, `skipped`, or `failed`. `status=success` means
192
- the helper exited successfully under the helper contract; artifact-level validation
193
- is performed by canonical smoke. Long failure reasons are capped and end with
194
- `...(truncated)` when shortened. Per-project `exit_code` mirrors the helper
195
- process return code; a negative value means the helper was killed by that signal
196
- number. Launch errors use synthesized `exit_code=127`; helper timeouts use
197
- synthesized `exit_code=124`. In both cases, `reason` identifies the sentinel.
62
+ Every completed output contains `super-build-manifest.json` with:
198
63
 
199
- ## Exit Codes
64
+ - actual builder `engineVersion`, optional calling `cliVersion`, and builder bundle
65
+ digest;
66
+ - canonical config digest and SPID;
67
+ - Git commit/dirty source metadata when available;
68
+ - single/all selection and real per-project status;
69
+ - evidence and artifact relative paths, sizes, counts, and SHA-256 values.
200
70
 
201
- - `0`: usage/config/injection succeeded and no selected project failed.
202
- - `1` with no summary: config validation or managed-config injection failed
203
- before project orchestration started.
204
- - `1` with a summary: at least one selected project had a hard failure after
205
- project orchestration started.
206
- - `2` with no summary: usage or argument error, such as an invalid platform.
71
+ Paths are relative to the build directory so it can move between machines. A
72
+ failed helper stays failed in both the manifest and the final
73
+ `SUPERSDK_BUILD_SUMMARY_JSON=...` line.
207
74
 
208
- This distinction lets downstream scripts tell a config error from a build
209
- result by checking for the root summary line. If stdout itself is closed or
210
- broken by the caller before the root summary can be written, summary emission is
211
- outside this contract.
75
+ ## Migration from schema v3
212
76
 
213
- ## Skip And Hard Failure
214
-
215
- Android and iOS helpers may report toolchain, simulator, or temporary network
216
- conditions as `skipped` when they exit 0 and a raw stdout/stderr line starts
217
- with `SKIP_` or `BUILD SKIPPED`. Matching is case-sensitive and does not trim
218
- leading whitespace. A nonzero helper exit code always wins and is a hard
219
- failure. Site projects have no skip mode: they are `success` or `failed`.
220
-
221
- The root build continues through all selected projects after a hard helper
222
- failure, then returns nonzero with every selected project represented in the
223
- ordered summary. An internal orchestrator error still emits a failed summary, but
224
- may stop at the affected project because the runner itself is no longer in a
225
- trustworthy state.
226
-
227
- ## Project Prerequisites
228
-
229
- - Android: executable `<android>/gradlew`, `<android>/gradle/wrapper/gradle-wrapper.jar`,
230
- JDK 17+, Android SDK, and reachable Maven metadata unless deterministic test
231
- mode or local metadata fixtures are used.
232
- - iOS: `<ios>/project.yml`, bundled `<ios>/MockSuperSDKPackage`, `xcodegen`,
233
- `xcodebuild`, and an available simulator for a full local build. Missing
234
- local toolchain is reported as an explicit skip unless a non-skippable CI gate
235
- is requested.
236
- - Site: bundled static assets `index.html`, `js/app.js`, `js/supersdk.js`,
237
- `css/style.css`, and `js/supersdk.provenance.json` under `<site>/src`. Site packaging
238
- uses the Python stdlib zip path and does not require Node/Vite.
239
-
240
- Maintainers can set `SUPERSDK_BUILD_HELPER_TIMEOUT_SECONDS` to adjust the
241
- per-helper timeout for CI or smoke troubleshooting. The default is 1800 seconds.
242
-
243
- ## Canonical Smoke
244
-
245
- From the repository root, run:
77
+ Use the installed SuperCLI entrypoint:
246
78
 
247
79
  ```bash
248
- python3 supersimples/tests/e2e/build_orchestration_smoke.py
80
+ supercli config migrate --from supersdk.json --to super.json
249
81
  ```
250
82
 
251
- The canonical smoke copies this template to a temporary directory outside the
252
- monorepo, edits `supersdk.json`, verifies project entry assets, pins Android
253
- SNAPSHOT metadata to a local fixture, forces Android deterministic test mode,
254
- forces deterministic iOS `SKIP_XCODEGEN_MISSING`, runs the root build, checks
255
- the ordered summary, checks all three managed configs, verifies a real site zip
256
- containing `index.html`, `js/app.js`, and `__super_meta.json`, and rejects
257
- monorepo-only path/module leaks in generated outputs and copied Android/iOS
258
- build config files. Android and iOS are deterministic non-real-build paths in
259
- this smoke; site packaging is the real project build. Use a separate toolchain
260
- CI lane when you need real Android Gradle or iOS simulator compilation.
83
+ The bundled Python authority only writes the target when every v3 field maps
84
+ without ambiguity and the generated document passes the strict v4 validator.
85
+ Source and target must have the same normalized parent directory. Migration adds
86
+ `projectId` from each directory basename and maps site targets to `envTarget`.
87
+ Unknown fields, conflicting IDs/targets/output directories, an existing target,
88
+ or a cross-directory destination fail before replacement. The source is never
89
+ deleted; inspect `super.json`, then explicitly move the retired `supersdk.json`.
90
+ While both names coexist, project commands fail closed.
91
+
92
+ ## Managed configuration
93
+
94
+ The authority projects the selected config into
95
+ `<project>/.supersdk/managed/config.json`. Managed readers validate the exact v4
96
+ shape and engine version. Re-run a build after updating bundled workspace scripts;
97
+ an older v3 engine rejects schema v4 instead of guessing new fields.
261
98
 
262
- Publishing this template to the public `supersdks/simple` repository is BL-006,
263
- not part of this feature.
99
+ Generated build state, `.super/deploy-results`, platform build directories, and
100
+ portable `output/` directories are ignored by the template `.gitignore`.
@@ -8,7 +8,7 @@ import android.content.SharedPreferences;
8
8
  *
9
9
  * 🔴 为什么不进 BuildConfig:environment 是 {@code SuperSDK.init} 的**运行时**参数,
10
10
  * 编译期根本不需要它。一旦编进产物,「换个环境看看」就变成「重新配置 + 重新打包」。
11
- * 所以它不在 supersdk.json 里,也不在 managed config 里,只存在于设备上的这份偏好里。
11
+ * 所以它不在 super.json 里,也不在 managed config 里,只存在于设备上的这份偏好里。
12
12
  * 省略环境时 SDK 默认 prod,这里的默认值与之一致。
13
13
  */
14
14
  public final class EnvironmentStore {
@@ -12,13 +12,13 @@ public class SimpleApplication extends Application {
12
12
  @Override
13
13
  public void onCreate() {
14
14
  super.onCreate();
15
- // spid 是编译期身份(来自 supersdk.json),environment 是运行时状态(来自设备偏好)。
15
+ // spid 是编译期身份(来自 super.json),environment 是运行时状态(来自设备偏好)。
16
16
  // 环境独立于 init:SDK 不持久化,进程默认 prod,启动后用 setAPIEnvironment 恢复偏好。
17
17
  try {
18
18
  SuperSDK.setAPIEnvironment(EnvironmentStore.get(this));
19
19
  SuperSDK.init(this, BuildConfig.SUPERSDK_SPID, new SuperSDKProvider() {});
20
20
  } catch (RuntimeException exception) {
21
- Log.e(TAG, "SuperSDK init failed; check supersdk.json and the resolved SDK dependency.", exception);
21
+ Log.e(TAG, "SuperSDK init failed; check super.json and the resolved SDK dependency.", exception);
22
22
  throw exception;
23
23
  }
24
24
  }
@@ -6,12 +6,12 @@ def defaultConfig = new File(androidRoot, "supersdk-default.config.json")
6
6
  def configFile = managedConfig.isFile() ? managedConfig : defaultConfig
7
7
 
8
8
  // 🔴 走 fallback 必须出声。managed config 是 `./super_build.sh --build` 从根目录
9
- // supersdk.json 投影出来的**当前**身份;supersdk-default.config.json 只是仓库里的一份
10
- // 快照,`--plan` 不会刷新它。静默使用快照意味着「改了 supersdk.json 却装出旧身份的包」,
9
+ // super.json 投影出来的**当前**身份;supersdk-default.config.json 只是仓库里的一份
10
+ // 快照,`--plan` 不会刷新它。静默使用快照意味着「改了 super.json 却装出旧身份的包」,
11
11
  // 而且构建照样 exit 0 —— 这类静默成功比直接失败危险得多。
12
12
  if (!managedConfig.isFile()) {
13
13
  logger.warn("SuperSDK: ${managedConfig} 不存在,回退使用 ${defaultConfig.name} 里的快照身份。" +
14
- "改过 supersdk.json 的话请先跑 ./super_build.sh --build 重新投影,否则产物身份可能是旧的。")
14
+ "改过 super.json 的话请先跑 ./super_build.sh --build 重新投影,否则产物身份可能是旧的。")
15
15
  }
16
16
 
17
17
  if (!configFile.isFile()) {
@@ -46,8 +46,8 @@ def sdk = config.sdk instanceof Map ? config.sdk : [:]
46
46
  if (config.managed_by != "supersdk-template") {
47
47
  throw new GradleException("SuperSDK Android config invalid at ${configFile}: managed_by must be supersdk-template")
48
48
  }
49
- if (config.schema_version != 3) {
50
- throw new GradleException("SuperSDK Android config invalid at ${configFile}: schema_version must be 3")
49
+ if (config.schema_version != 4) {
50
+ throw new GradleException("SuperSDK Android config invalid at ${configFile}: schema_version must be 4")
51
51
  }
52
52
  def versionCodeValue = version.code
53
53
  if (!(versionCodeValue instanceof Number)) {
@@ -59,6 +59,7 @@ if (versionCodeDecimal.scale() > 0 || versionCodeDecimal < BigDecimal.ONE || ver
59
59
  }
60
60
 
61
61
  ext.supersdkAndroidConfigPath = configFile.absolutePath
62
+ ext.supersdkProjectId = requireMatchingString(config.project_id, "project_id", /[a-z0-9][a-z0-9-]{0,62}/, 'must match ^[a-z0-9][a-z0-9-]{0,62}$')
62
63
  ext.supersdkSpid = requireMatchingString(config.spid, "spid", /[a-z0-9]{8}/, 'must match ^[a-z0-9]{8}$')
63
64
  // 🔴 这里**没有** environment。它是 SuperSDK.init 的运行时参数,编译期不需要,
64
65
  // 也就不该进 BuildConfig —— 一旦编进产物,换环境就等于重新打包。
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "dir": "android",
3
- "engine_version": "3.0.0",
3
+ "engine_version": "4.0.0",
4
4
  "managed_by": "supersdk-template",
5
5
  "name": "SuperSDK Simple",
6
6
  "platform": "android",
7
7
  "platform_config": {
8
8
  "package": "com.supersdk.simple.host"
9
9
  },
10
- "schema_version": 3,
10
+ "project_id": "android",
11
+ "schema_version": 4,
11
12
  "sdk": {
12
13
  "androidVersion": "1.0.0.57-SNAPSHOT"
13
14
  },
@@ -9,7 +9,7 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
9
9
  do {
10
10
  try SimpleSDKBootstrap.initialize()
11
11
  } catch {
12
- fatalError("SuperSDK init failed; check supersdk.json identity: \(error)")
12
+ fatalError("SuperSDK init failed; check super.json identity: \(error)")
13
13
  }
14
14
  return true
15
15
  }
@@ -2,7 +2,7 @@ import SuperSDK
2
2
 
3
3
  enum SimpleSDKBootstrap {
4
4
  static func initialize() throws {
5
- // spid 是编译期身份(投影自 supersdk.json),environment 是运行时选择。
5
+ // spid 是编译期身份(投影自 super.json),environment 是运行时选择。
6
6
  try SuperSDKManager.shared.initialize(
7
7
  spid: SimpleConfig.spid,
8
8
  environment: EnvironmentStore.current,
@@ -7,11 +7,14 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
7
7
  WORKSPACE_ROOT="$(supersdk_require_workspace_root "$SCRIPT_DIR")"
8
8
  PYTHON_BIN="${PYTHON_BIN:-python3}"
9
9
  HELPER="$WORKSPACE_ROOT/scripts/supersdk_template.py"
10
- CONFIG="$WORKSPACE_ROOT/supersdk.json"
10
+ CONFIG="$WORKSPACE_ROOT/super.json"
11
+ PROJECT_ID=""
11
12
  PROJECT_DIR=""
13
+ OUTPUT_DIR=""
14
+ EVIDENCE_PATH=""
12
15
 
13
16
  usage() {
14
- echo "Usage: scripts/build_android.sh --build [--project DIR] [--config path]" >&2
17
+ echo "Usage: scripts/build_android.sh --build --config PATH --project-id ID --output-dir DIR --evidence FILE" >&2
15
18
  }
16
19
 
17
20
  skip_toolchain() {
@@ -87,12 +90,12 @@ while [ "$#" -gt 0 ]; do
87
90
  build_seen=true
88
91
  shift
89
92
  ;;
90
- --project)
93
+ --project-id)
91
94
  if [ "$#" -lt 2 ]; then
92
95
  usage
93
96
  exit 2
94
97
  fi
95
- PROJECT_DIR="$2"
98
+ PROJECT_ID="$2"
96
99
  shift 2
97
100
  ;;
98
101
  --config)
@@ -103,6 +106,12 @@ while [ "$#" -gt 0 ]; do
103
106
  CONFIG="$2"
104
107
  shift 2
105
108
  ;;
109
+ --output-dir)
110
+ if [ "$#" -lt 2 ]; then usage; exit 2; fi
111
+ OUTPUT_DIR="$2"; shift 2 ;;
112
+ --evidence)
113
+ if [ "$#" -lt 2 ]; then usage; exit 2; fi
114
+ EVIDENCE_PATH="$2"; shift 2 ;;
106
115
  *)
107
116
  usage
108
117
  exit 2
@@ -115,15 +124,18 @@ fi
115
124
 
116
125
  # 项目目录来自配置,不是固定层级。省略 --project 时由引擎解析:唯一 android 项目才放行,
117
126
  # 多个就要求显式指定,绝不「挑第一个」。
118
- if [ -z "$PROJECT_DIR" ]; then
119
- PROJECT_DIR="$("$PYTHON_BIN" "$HELPER" resolve --config "$CONFIG" --platform android)"
120
- fi
127
+ if [ -z "$PROJECT_ID" ]; then PROJECT_ID="android"; fi
128
+ PROJECT_DIR="$("$PYTHON_BIN" "$HELPER" resolve --config "$CONFIG" --platform android --project "$PROJECT_ID")"
121
129
  ANDROID_ROOT="$WORKSPACE_ROOT/$PROJECT_DIR"
130
+ if [ -z "$OUTPUT_DIR" ]; then OUTPUT_DIR="$ANDROID_ROOT/.supersdk/artifacts"; fi
131
+ if [ -z "$EVIDENCE_PATH" ]; then EVIDENCE_PATH="$ANDROID_ROOT/.supersdk/evidence/android-helper-evidence.json"; fi
122
132
 
123
- "$PYTHON_BIN" "$HELPER" inject --root "$WORKSPACE_ROOT" --config "$CONFIG" --platform android --project "$PROJECT_DIR"
133
+ "$PYTHON_BIN" "$HELPER" inject --root "$WORKSPACE_ROOT" --config "$CONFIG" --platform android --project "$PROJECT_ID"
124
134
 
125
135
  if [ "${SUPERSDK_ANDROID_BUILD_TEST_MODE:-0}" = "1" ]; then
126
136
  run_snapshot_canary
137
+ mkdir -p "$OUTPUT_DIR"
138
+ printf 'SUPERSDK_ANDROID_BUILD_TEST_MODE\n' > "$OUTPUT_DIR/app-debug.apk"
127
139
  echo "SUPERSDK_ANDROID_BUILD_TEST_MODE: would run $ANDROID_ROOT/gradlew :app:assembleDebug"
128
140
  exit 0
129
141
  fi
@@ -324,7 +336,7 @@ Path(target).write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n", en
324
336
  if identity_mismatches:
325
337
  lines = [
326
338
  "",
327
- "SuperSDK identity check %s: the APK does not carry the identity declared in supersdk.json."
339
+ "SuperSDK identity check %s: the APK does not carry the identity declared in super.json."
328
340
  % ("FAILED" if identity_status == "mismatch" else "warning"),
329
341
  "",
330
342
  ]
@@ -354,7 +366,7 @@ if identity_mismatches:
354
366
  " * wire the project to the managed config -- `supercli register android %s` reprints the"
355
367
  % config["dir"],
356
368
  " exact steps (copy the reader, apply it, read the extra properties); or",
357
- " * correct projects[].package in supersdk.json so it states what this project really builds.",
369
+ " * correct projects[].package in super.json so it states what this project really builds.",
358
370
  ]
359
371
  sys.stderr.write("\n".join(lines) + "\n")
360
372
  raise SystemExit(1)
@@ -364,3 +376,7 @@ if identity_mismatches:
364
376
  ]
365
377
  sys.stderr.write("\n".join(lines) + "\n")
366
378
  PY
379
+
380
+ mkdir -p "$OUTPUT_DIR" "$(dirname "$EVIDENCE_PATH")"
381
+ cp "$apk_path" "$OUTPUT_DIR/$(basename "$apk_path")"
382
+ cp "$evidence_dir/android-build-evidence.json" "$EVIDENCE_PATH"