@nimiplatform/app-tools 0.6.3 → 0.11.4
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/README.md +153 -12
- package/bin/nimi-app.mjs +16 -14
- package/lib/app-access-declaration.mjs +1 -0
- package/lib/app-dependency-combinations.mjs +49 -0
- package/lib/app-doctor-update.mjs +84 -23
- package/lib/app-info.mjs +33 -3
- package/lib/app-lifecycle-guidance.mjs +4 -2
- package/lib/app-pack.mjs +5 -2
- package/lib/app-project-lifecycle.mjs +284 -53
- package/lib/app-safety-profile.mjs +204 -0
- package/lib/app-scaffold-capabilities.mjs +11 -3
- package/lib/app-scaffold-profiles.mjs +136 -27
- package/lib/app-scaffold.mjs +55 -7
- package/lib/canonical-capability-ids.generated.mjs +25 -0
- package/lib/index.mjs +0 -4
- package/package.json +27 -31
- package/scripts/dev-shell.mjs +80 -18
- package/skills/nimi-app-lifecycle/SKILL.md +7 -3
- package/skills/nimi-app-lifecycle/references/acceptance.md +7 -1
- package/skills/nimi-app-lifecycle/references/adapt.md +46 -1
- package/skills/nimi-app-lifecycle/references/audit.md +55 -0
- package/skills/nimi-app-lifecycle/references/platform-gaps.md +15 -0
- package/skills/nimi-app-lifecycle/references/release.md +2 -2
- package/skills/nimi-app-lifecycle/references/safety-declaration.md +37 -0
- package/skills/nimi-app-lifecycle/references/upgrade-platform.md +16 -2
- package/templates/app-source/src/ai-studio-core/ai-config.ts +17 -3
- package/templates/app-source/src/ai-studio-core/ai-studio-core.css +40 -3
- package/templates/app-source/src/ai-studio-core/audio-separation-request.ts +24 -0
- package/templates/app-source/src/ai-studio-core/contexts.tsx +4 -0
- package/templates/app-source/src/ai-studio-core/history-policy.ts +395 -41
- package/templates/app-source/src/ai-studio-core/history.ts +262 -10
- package/templates/app-source/src/ai-studio-core/host-context.tsx +15 -2
- package/templates/app-source/src/ai-studio-core/index.ts +15 -4
- package/templates/app-source/src/ai-studio-core/job-recovery-panel.tsx +105 -0
- package/templates/app-source/src/ai-studio-core/job-recovery.ts +224 -0
- package/templates/app-source/src/ai-studio-core/managed-result-references.ts +79 -0
- package/templates/app-source/src/ai-studio-core/messages/en.json +185 -10
- package/templates/app-source/src/ai-studio-core/messages/zh.json +185 -10
- package/templates/app-source/src/ai-studio-core/module-registration.ts +9 -1
- package/templates/app-source/src/ai-studio-core/non-success-presentation.ts +81 -2
- package/templates/app-source/src/ai-studio-core/parameters.ts +34 -1
- package/templates/app-source/src/ai-studio-core/runtime-types.ts +124 -8
- package/templates/app-source/src/ai-studio-core/runtime.ts +218 -20
- package/templates/app-source/src/ai-studio-core/section-ai-testing-annotation-result.tsx +123 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-artifact-preview.ts +3 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-audio-separation-result.tsx +26 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-composer.tsx +14 -7
- package/templates/app-source/src/ai-studio-core/section-ai-testing-decision-result.tsx +76 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-exchange-result.tsx +71 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-history.tsx +20 -4
- package/templates/app-source/src/ai-studio-core/section-ai-testing-input.ts +29 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-music-result.tsx +45 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-output.tsx +132 -10
- package/templates/app-source/src/ai-studio-core/section-ai-testing-result.tsx +122 -38
- package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +4 -3
- package/templates/app-source/src/ai-studio-core/section-ai-testing-session-result.tsx +66 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-studio-result.tsx +100 -22
- package/templates/app-source/src/ai-studio-core/section-ai-testing-surface.tsx +6 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-transcript-result.tsx +45 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-transcription-result.tsx +106 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-vision-result.tsx +23 -4
- package/templates/app-source/src/ai-studio-core/section-ai-testing-voice-asset-actions.tsx +40 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-voice-conversion-result.tsx +20 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing.tsx +219 -35
- package/templates/app-source/src/ai-studio-core/text-annotation-document.ts +50 -0
- package/templates/app-source/src/ai-studio-core/text-media-replay.ts +51 -0
- package/templates/app-source/src/ai-studio-core/voice-assets.ts +17 -0
- package/templates/app-source/src/ai-studio-core/workspace.tsx +48 -6
- package/templates/app-source/src/studio-modules/studio-create/descriptors.ts +1 -1
- package/templates/app-source/src/studio-modules/studio-create/messages/en.json +13 -1
- package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +13 -1
- package/templates/app-source/src/studio-modules/studio-create/parameter-panel.tsx +11 -2
- package/templates/app-source/src/studio-modules/studio-create/parameters.ts +2 -2
- package/templates/app-source/src/studio-modules/studio-create/registration.ts +2 -2
- package/templates/app-source/src/studio-modules/studio-create/runtime.ts +121 -3
- package/templates/app-source/src/studio-modules/studio-media/audio-separate-parameters.tsx +72 -0
- package/templates/app-source/src/studio-modules/studio-media/audio-separate-runtime.ts +90 -0
- package/templates/app-source/src/studio-modules/studio-media/descriptors.ts +16 -1
- package/templates/app-source/src/studio-modules/studio-media/index.ts +2 -0
- package/templates/app-source/src/studio-modules/studio-media/messages/en.json +225 -7
- package/templates/app-source/src/studio-modules/studio-media/messages/zh.json +225 -7
- package/templates/app-source/src/studio-modules/studio-media/music-parameters.tsx +85 -0
- package/templates/app-source/src/studio-modules/studio-media/music-transcription-parameters.tsx +85 -0
- package/templates/app-source/src/studio-modules/studio-media/music-transcription-runtime.ts +64 -0
- package/templates/app-source/src/studio-modules/studio-media/parameter-panel.tsx +9 -26
- package/templates/app-source/src/studio-modules/studio-media/parameters.ts +170 -6
- package/templates/app-source/src/studio-modules/studio-media/registration.ts +29 -1
- package/templates/app-source/src/studio-modules/studio-media/runtime.ts +90 -6
- package/templates/app-source/src/studio-modules/studio-media/vision-parameters.tsx +1 -0
- package/templates/app-source/src/studio-modules/studio-media/vision-runtime.ts +23 -5
- package/templates/app-source/src/studio-modules/studio-media/voice-convert-parameters.tsx +132 -0
- package/templates/app-source/src/studio-modules/studio-media/voice-convert-runtime.ts +120 -0
- package/templates/app-source/src/studio-modules/studio-voice/audio-url.ts +25 -0
- package/templates/app-source/src/studio-modules/studio-voice/messages/en.json +4 -4
- package/templates/app-source/src/studio-modules/studio-voice/messages/zh.json +4 -4
- package/templates/app-source/src/studio-modules/studio-voice/parameters.ts +36 -10
- package/templates/app-source/src/studio-modules/studio-voice/runtime.ts +66 -30
- package/templates/app-source/src/workbench-core/index.ts +2 -0
- package/templates/app-source/src/workbench-core/runtime-gate.tsx +102 -6
- package/templates/app-source/src/workbench-core/workbench-core.css +42 -0
- package/templates/app-source/src/workbench-core/workbench-core.tsx +69 -18
- package/templates/app-source.manifest.json +100 -0
- package/templates/default-starter/AGENTS.md +4 -2
- package/templates/default-starter/README.md +2 -1
- package/templates/default-starter/src/shell/workbench-target-adapter.ts +102 -12
- package/templates/default-starter.manifest.json +0 -4
- package/lib/simulator-conformance-ast.mjs +0 -498
- package/lib/simulator-conformance-css.mjs +0 -116
- package/lib/simulator-conformance-graph.mjs +0 -757
- package/lib/simulator-conformance.d.mts +0 -14
- package/lib/simulator-conformance.mjs +0 -203
- package/lib/simulator-css-profile.d.mts +0 -27
- package/lib/simulator-css-profile.mjs +0 -531
- package/lib/simulator-kit-export-resolution.mjs +0 -70
- package/lib/simulator-manifest.mjs +0 -334
package/README.md
CHANGED
|
@@ -2,23 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
`app-tools` is the public full-stack developer toolkit for third-party Nimi Apps. It owns repository scaffolding, dependency and managed-file synchronization, local validation, Desktop-supervised development, App-declared test/build orchestration, deterministic packaging, and managed GitHub workflow setup.
|
|
4
4
|
|
|
5
|
+
App Tools 0.11.4 defaults to SDK 0.21.0 and Kit/native 0.18.1, with Nimi Coding
|
|
6
|
+
0.6.5. Existing Apps select this SDK/Kit combination explicitly before syncing;
|
|
7
|
+
the tool update alone preserves their supported business dependencies. The
|
|
8
|
+
matching Electron carrier requires Electron 44.
|
|
9
|
+
|
|
5
10
|
It does not own GitHub publisher or repository truth, registry review/main, Runtime installed state, Desktop process state, or Nimi Access. Nimi Account and the private Nimi backend are not publisher credentials or App-release infrastructure.
|
|
6
11
|
|
|
7
12
|
For your first public release, start with [Publishing on GitHub](#publishing-on-github), including the read-only repository-settings credential.
|
|
8
13
|
|
|
14
|
+
Simulator integration is retired. Remove `nimi-app check --conformance simulator`
|
|
15
|
+
and imports of `@nimiplatform/app-tools/simulator-conformance` or
|
|
16
|
+
`@nimiplatform/app-tools/simulator-css-profile` from active projects. Use the
|
|
17
|
+
normal App lifecycle checks and Desktop-supervised development for current
|
|
18
|
+
Apps; the archived preview implementation is no longer a release prerequisite.
|
|
19
|
+
|
|
9
20
|
## AI development and existing projects
|
|
10
21
|
|
|
11
22
|
The package includes one `skills/nimi-app-lifecycle/SKILL.md` with on-demand
|
|
12
|
-
guides for creating, adapting, platform upgrades, upstream sync, releases and
|
|
23
|
+
guides for adaptation audits, creating, adapting, platform gaps and upgrades, upstream sync, releases and
|
|
13
24
|
acceptance. Read it inside the installed package before initializing an existing
|
|
14
25
|
repository. `nimi-app --help` prints its resolved location. Installation does
|
|
15
26
|
not activate instructions; explicit init/sync maintains the project skill under
|
|
16
27
|
`.agents/skills/nimi-app-lifecycle/` and an independent AGENTS.md block.
|
|
17
28
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
For a feasibility, capability-fit or cost decision, start with [Audit](skills/nimi-app-lifecycle/references/audit.md). It uses existing public consumption paths and the target's actual workflows without requiring adoption or a running reference App. When implementation follows a report, preserve its evidence and uncertainty boundaries through the guide's handoff.
|
|
30
|
+
|
|
31
|
+
Install the selected app-tools and the exact nimi-coding version declared in
|
|
32
|
+
its `nimiScaffoldVersions`. For first integration, generate a minimal reference
|
|
33
|
+
App under `.nimi/local/` with its own identity and the needed admitted features,
|
|
34
|
+
using this same SDK/Kit/native package combination. Run its generated foundation
|
|
35
|
+
and reuse or align its Host, preload, renderer bridge, session, App Access,
|
|
36
|
+
AIConfig and AI call wiring in the existing App. SDK/Kit documentation explains
|
|
37
|
+
the contracts; it does not replace working generated code.
|
|
38
|
+
|
|
39
|
+
When the task includes installation, establish the reference's local installed
|
|
40
|
+
Access baseline as described in the packaged acceptance guide. Compare under
|
|
41
|
+
the same conditions to separate toolchain failures from App wiring differences.
|
|
42
|
+
Reuse passing results for ordinary business changes; no extra evidence ledger
|
|
43
|
+
or repeated full reference run is needed.
|
|
44
|
+
|
|
45
|
+
Preserve the original product's workflows and business settings while preparing
|
|
46
|
+
its actual renderer and build/test scripts. A reference workbench or passing
|
|
47
|
+
sample is not the complete App. Init does not convert a server framework,
|
|
48
|
+
invent tests or replace product UI. Preview adoption after this preparation:
|
|
22
49
|
|
|
23
50
|
```bash
|
|
24
51
|
pnpm exec nimi-app init --adopt --dry-run --json
|
|
@@ -78,9 +105,107 @@ commands; older Desktop versions enforcing Vite reject this project even after
|
|
|
78
105
|
app-tools validation passes. Do not introduce a Vite placeholder to bypass it.
|
|
79
106
|
|
|
80
107
|
Use the selected package's `nimiScaffoldVersions` declarations in `package.json`
|
|
81
|
-
and commit the matching lockfile to pin resolved versions.
|
|
82
|
-
|
|
83
|
-
|
|
108
|
+
and commit the matching lockfile to pin resolved versions. Fresh `create` uses
|
|
109
|
+
the tool default SDK/Kit combination. An existing App keeps its current SDK/Kit
|
|
110
|
+
combination when it is one of the supported combinations app-tools declares:
|
|
111
|
+
`sync` preserves it, `check` verifies the same combination in the manifest,
|
|
112
|
+
lockfile and Cargo inputs, and only the app-tools and nimi-coding tool
|
|
113
|
+
dependencies follow the selected tool version. An unlisted SDK x Kit pairing is
|
|
114
|
+
rejected rather than normalized. A matrix range in the manifest does not
|
|
115
|
+
require an automatic upgrade; install with the frozen lockfile until
|
|
116
|
+
deliberately selecting and synchronizing a new component combination.
|
|
117
|
+
|
|
118
|
+
The current source guide uses App Tools 0.11.4 with SDK `^0.21.0`, Kit/native
|
|
119
|
+
`^0.18.0`, the matching Runtime, and Tauri `0.10.0` when selected. Fresh scaffold
|
|
120
|
+
defaults still come from `nimiScaffoldVersions` in `package.json`; explicitly
|
|
121
|
+
select the current SDK/Kit pair to use this guide. On an initialized App, run
|
|
122
|
+
`nimi-app sync`, install the resulting dependencies, then run `nimi-app check`
|
|
123
|
+
and the App build. A fresh project installs dependencies and runs `init` first.
|
|
124
|
+
Sync preserves admitted explicit pairs and never supplies an older Host fallback.
|
|
125
|
+
|
|
126
|
+
### Music reference flow
|
|
127
|
+
|
|
128
|
+
The admitted `studio-media` feature includes the music workflow maintained in
|
|
129
|
+
Nimi Lab. Its source is read from Lab during development and materialized into
|
|
130
|
+
the existing packaged App source during build; it is not a separate sample copy.
|
|
131
|
+
It consumes the protected SDK/Kit interfaces, reads `musicInput` from the current
|
|
132
|
+
AIConfig resource, imports ABC into App assets, and preserves every returned
|
|
133
|
+
artifact and the reported generation ending. A missing input projection is not
|
|
134
|
+
inferred from a model name.
|
|
135
|
+
|
|
136
|
+
A music action saves its `clientSubmissionId` before submission. The recovery
|
|
137
|
+
view looks up the original Job and observes or saves it without generating
|
|
138
|
+
again. Runtime recovery has a 24-hour lifetime; adopted App assets and the
|
|
139
|
+
saved result are used for later reopening. Generation budgets and generated
|
|
140
|
+
plan scores must not be presented as proof of a complete song, accurate
|
|
141
|
+
transcription, original melody or a requested singer.
|
|
142
|
+
|
|
143
|
+
Use the current complete SDK/Kit/native/Runtime combination above for this
|
|
144
|
+
source. Package declarations are not a publication claim. Real model and
|
|
145
|
+
Desktop-supervised acceptance apply to the exact tested combination, separately
|
|
146
|
+
from generator checks and subjective listening.
|
|
147
|
+
|
|
148
|
+
### Local development packages
|
|
149
|
+
|
|
150
|
+
Development does not require publishing every SDK/Kit or app-tools change.
|
|
151
|
+
Keep the selected version matrix in `package.json`, and use explicit npm tarball
|
|
152
|
+
overrides in the App's own `pnpm-workspace.yaml`:
|
|
153
|
+
|
|
154
|
+
```yaml
|
|
155
|
+
packages:
|
|
156
|
+
- .
|
|
157
|
+
overrides:
|
|
158
|
+
'@nimiplatform/app-tools': file:D:/nimi-packages/nimiplatform-app-tools-0.11.4.tgz
|
|
159
|
+
'@nimiplatform/sdk': file:D:/nimi-packages/nimiplatform-sdk-0.21.0.tgz
|
|
160
|
+
'@nimiplatform/kit': file:D:/nimi-packages/nimiplatform-kit-0.18.0.tgz
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
These are example artifact locations; use the complete packages you were given.
|
|
164
|
+
Override Kit's matching native optional package too when that component changes;
|
|
165
|
+
keep the native carrier Kit-owned rather than adding it as an App dependency.
|
|
166
|
+
Local archives may also use paths relative to the App. Install, run sync and
|
|
167
|
+
check, then use the normal dev/test/build/pack loop. Sync retains these choices;
|
|
168
|
+
check verifies matrix compatibility and compares the selected tarball version,
|
|
169
|
+
source and integrity with pnpm's installed dependency lock and package manifest.
|
|
170
|
+
The default SDK `^0.21.0` / Kit `^0.18.1` / Rust carrier `0.10.0`
|
|
171
|
+
combination also admits complete local archives for development. Select the
|
|
172
|
+
matching Runtime and native packages. A local archive does not establish public
|
|
173
|
+
registry availability; production preflight checks the registry resolutions.
|
|
174
|
+
Workspace members declare their own SDK/Kit dependencies and share the root
|
|
175
|
+
tarball overrides. pnpm writes each member's `specifier` relative to that member,
|
|
176
|
+
while resolved versions and package records remain workspace-relative; check
|
|
177
|
+
compares the resulting archive identities and installed importer bindings.
|
|
178
|
+
Do not rewrite member lock entries to look identical to the root importer.
|
|
179
|
+
Updating only the lockfile does not update installed packages: run `pnpm install`
|
|
180
|
+
after selecting another local package combination. Directory links and
|
|
181
|
+
source-workspace overrides stay invalid.
|
|
182
|
+
The generated Electron packager rebases archive paths for its isolated dependency
|
|
183
|
+
staging so a local build uses the same packages.
|
|
184
|
+
|
|
185
|
+
`check --production` is the final public-release preflight and requires registry
|
|
186
|
+
resolutions. It is not a prerequisite for development or local build/pack;
|
|
187
|
+
the normal build still executes the actual declared production payload command.
|
|
188
|
+
|
|
189
|
+
For local installed-App acceptance, keep these tarball overrides and run:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
pnpm exec nimi-app check
|
|
193
|
+
pnpm exec nimi-app build --target windows-x86_64
|
|
194
|
+
pnpm exec nimi-app pack --target windows-x86_64 --production
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Use the actual target on its matching host. `pack --production` observes the
|
|
198
|
+
payload's native signature and execution permissions; it does not run registry
|
|
199
|
+
dependency preflight or publish anything. Plain `pack` writes a development
|
|
200
|
+
archive that Runtime local import rejects. Import the resulting package through
|
|
201
|
+
Desktop's Apps → Add App → Import local package, then verify its installed launch
|
|
202
|
+
and business use. This exercises the `user_imported` source independently of
|
|
203
|
+
Catalog admission and download.
|
|
204
|
+
|
|
205
|
+
When preparing a public release after development acceptance, remove local
|
|
206
|
+
overrides, install the published matched versions and complete release preflight.
|
|
207
|
+
Local import creates no GitHub Release or Registry approval and does not verify
|
|
208
|
+
Catalog download or installation on a machine without the development environment.
|
|
84
209
|
|
|
85
210
|
`init --dry-run --json` and `sync --dry-run --json` show app-tools file/field
|
|
86
211
|
changes without writes, installation or owner mutation. The separate
|
|
@@ -106,7 +231,7 @@ create -> dependency install -> init -> sync -> check
|
|
|
106
231
|
|
|
107
232
|
- `create` writes a standalone private App project with a dotted App ID, exact version, public dependency declarations, developer build/submission inputs and one managed workflow. It does not install dependencies or create admission truth.
|
|
108
233
|
- `init` materializes package-owned projections and lifecycle guidance after dependencies are installed. Fresh scaffolds also receive their scaffold lock; `init --adopt` preserves an existing App without creating scaffold intent or lock.
|
|
109
|
-
- `sync` refreshes only scaffold-managed dependencies, configuration, workflow and glue. App-owned product code
|
|
234
|
+
- `sync` refreshes only scaffold-managed dependencies, configuration, workflow and glue. App-owned product code and the project `LICENSE` are preserved.
|
|
110
235
|
- `check` is non-mutating and incorporates the former scaffold validation behavior.
|
|
111
236
|
- `dev` requests the official Desktop-supervised Electron development Host.
|
|
112
237
|
- `test` and `build` execute the real owner commands declared in `.nimi/config/build-profile.yaml`; there is no fallback success.
|
|
@@ -140,7 +265,7 @@ node app-tools/bin/nimi-app.mjs create \
|
|
|
140
265
|
|
|
141
266
|
The base is identity-neutral and combines only explicitly admitted `--features` plus their dependency closure. `--features all` means all currently admitted features, not all Nimi Lab source.
|
|
142
267
|
|
|
143
|
-
Standalone output
|
|
268
|
+
Standalone output keeps public npm and Cargo dependency version declarations. Complete local npm tarballs are supported development resolutions through the documented overrides; public-release preflight requires registry resolutions. Source-workspace paths, parent-source aliases and App-owned direct native-carrier dependencies remain outside the standalone dependency boundary.
|
|
144
269
|
|
|
145
270
|
## Development and build
|
|
146
271
|
|
|
@@ -159,6 +284,8 @@ pnpm dev
|
|
|
159
284
|
|
|
160
285
|
`dev` uses the Desktop supervisor. Direct Electron, Tauri or renderer launch cannot claim protected Nimi access. Process running and Nimi Access ready remain separate states.
|
|
161
286
|
|
|
287
|
+
Use `nimi-app dev --list-registrations` and `--resume <selector>` to continue an existing development registration and its App data. Refresh the list after Desktop restarts: selectors belong to that Desktop session. A plain `dev` launch creates a registration only when this project has none. Otherwise it asks you to select an existing registration in an interactive terminal; in scripts, pass `--resume <selector>`. Use `--new-registration` only when you want a separate identity and separate App data. A rejected or expired selection never falls back to creating a registration. Remove unwanted registrations from their source row in Apps or Settings > Developer; this stops that registration and leaves project files intact.
|
|
288
|
+
|
|
162
289
|
Every `build`, including non-production builds, requires the selected target's
|
|
163
290
|
declared payload and exact Runtime entry to exist after its owner command exits
|
|
164
291
|
successfully. Building a macOS payload cannot report success for a missing
|
|
@@ -179,7 +306,7 @@ The list shows the current project's registrations and creation times. Copy the
|
|
|
179
306
|
|
|
180
307
|
The default `windows-x86_64` build profile runs `build:electron:production`. It rebuilds the renderer and Electron main/preload, then creates a fresh, non-installer `dist-electron-package/<app>-shell-win32-x64/` directory with ASAR packaging, native `.node` addons unpacked, and an App-specific `<app>-shell.exe`. The production main bundle has a compile-time production marker and rejects every `--nimi-dev-renderer-url` argument; packaged renderer assets stay relative under `dist/`. The protected native binding is resolved from Kit's optional dependency and is never declared directly by the App.
|
|
181
308
|
|
|
182
|
-
App Tools
|
|
309
|
+
App Tools prepares the `macos-aarch64` target on an Apple Silicon Mac.
|
|
183
310
|
The same owner command produces `dist-electron-package/<app>-shell-darwin-arm64/`
|
|
184
311
|
with a native `.app` bundle and a direct `Contents/MacOS` entry. The publisher's
|
|
185
312
|
build applies an ad-hoc integrity seal without a Developer ID identity or Apple
|
|
@@ -296,6 +423,16 @@ out of source files, `.env`, and release notes.
|
|
|
296
423
|
|
|
297
424
|
### 4. Check, build, and publish a version
|
|
298
425
|
|
|
426
|
+
The project `LICENSE` belongs to the App. `create` writes it once as an MIT
|
|
427
|
+
license naming `--author`, or the App title when no author is given; replace it
|
|
428
|
+
with the App's own terms and set the matching `package.json.license`
|
|
429
|
+
identifier. `sync` never rewrites it and `check` does not lock it. The
|
|
430
|
+
template's own MIT notice stays in the scaffold-managed
|
|
431
|
+
`licenses/nimi-app-template.txt`. A project created by an app-tools version
|
|
432
|
+
that still managed `LICENSE` keeps its file byte for byte: `sync` records the
|
|
433
|
+
App as its owner, reports the handover, and adds the template notice, while
|
|
434
|
+
`check` asks for that sync first.
|
|
435
|
+
|
|
299
436
|
Keep the packaged `LICENSE` identical to the reviewed Git source. New scaffolds
|
|
300
437
|
include `LICENSE -text` in `.gitattributes`. Add the same rule to an existing
|
|
301
438
|
repository while preserving its other attributes, and commit it before tagging.
|
|
@@ -356,7 +493,11 @@ pnpm dlx --package @nimiplatform/app-tools nimi-app --help
|
|
|
356
493
|
## Portable App information (package v2)
|
|
357
494
|
|
|
358
495
|
A distribution package includes `app-info.json`, containing its actual icon,
|
|
359
|
-
summary, available usage guide and version notes, license
|
|
496
|
+
summary, available usage guide and version notes, license, portable requirements
|
|
497
|
+
and, when declared, the publisher safety declaration from `nimi.app.yaml`
|
|
498
|
+
`safety_profile` (see the lifecycle skill's safety-declaration reference). An
|
|
499
|
+
undeclared `safety_profile` stays absent and blocks nothing locally; new public
|
|
500
|
+
Registry admission requires the complete declaration.
|
|
360
501
|
Every `pack`, including development-mode packaging and non-release CI, requires
|
|
361
502
|
valid App information. Complete `nimi.app.yaml` and its resources before packing;
|
|
362
503
|
production check/build validates them before the build starts:
|
package/bin/nimi-app.mjs
CHANGED
|
@@ -22,7 +22,7 @@ function parseArgs(argv) {
|
|
|
22
22
|
const [command = '', ...rest] = argv;
|
|
23
23
|
const values = {
|
|
24
24
|
dir: '', profile: '', appId: '', version: '', title: '', packageName: '', author: '',
|
|
25
|
-
features: undefined, shell: '', cdpPort: undefined, noCdp: false, listRegistrations: false, resume: '',
|
|
25
|
+
features: undefined, shell: '', cdpPort: undefined, noCdp: false, listRegistrations: false, resume: '', newRegistration: false, target: '', aggregate: false, production: false, json: false,
|
|
26
26
|
adopt: false, dryRun: false, input: '',
|
|
27
27
|
};
|
|
28
28
|
const seen = new Set();
|
|
@@ -103,16 +103,18 @@ function parseArgs(argv) {
|
|
|
103
103
|
values.listRegistrations = true;
|
|
104
104
|
continue;
|
|
105
105
|
}
|
|
106
|
+
if (rest[index] === '--new-registration') {
|
|
107
|
+
if (seen.has('newRegistration')) throw new Error('Duplicate option: --new-registration');
|
|
108
|
+
seen.add('newRegistration');
|
|
109
|
+
values.newRegistration = true;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
106
112
|
if (rest[index] === '--no-cdp') {
|
|
107
113
|
if (seen.has('noCdp')) throw new Error('Duplicate option: --no-cdp');
|
|
108
114
|
seen.add('noCdp');
|
|
109
115
|
values.noCdp = true;
|
|
110
116
|
continue;
|
|
111
117
|
}
|
|
112
|
-
if (rest[index] === '--conformance') {
|
|
113
|
-
index = readValue(index, '--conformance', 'conformance');
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
118
|
if (rest[index] === '--target') {
|
|
117
119
|
index = readValue(index, '--target', 'target');
|
|
118
120
|
continue;
|
|
@@ -149,8 +151,8 @@ function assertCommandOptions(command, providedOptions) {
|
|
|
149
151
|
create: new Set(['dir', 'profile', 'appId', 'version', 'title', 'packageName', 'author', 'features', 'json']),
|
|
150
152
|
init: new Set(['dir', 'json', 'adopt', 'input', 'dryRun']),
|
|
151
153
|
sync: new Set(['dir', 'json', 'dryRun']),
|
|
152
|
-
check: new Set(['dir', 'json', '
|
|
153
|
-
dev: new Set(['dir', 'shell', 'cdpPort', 'noCdp', 'listRegistrations', 'resume']),
|
|
154
|
+
check: new Set(['dir', 'json', 'production']),
|
|
155
|
+
dev: new Set(['dir', 'shell', 'cdpPort', 'noCdp', 'listRegistrations', 'resume', 'newRegistration']),
|
|
154
156
|
test: new Set(['dir', 'json']),
|
|
155
157
|
build: new Set(['dir', 'target', 'production', 'json']),
|
|
156
158
|
pack: new Set(['dir', 'target', 'aggregate', 'production', 'json']),
|
|
@@ -180,8 +182,8 @@ function printUsage() {
|
|
|
180
182
|
' nimi-app create [--dir path] [--profile standalone] [--features admitted-ids|all] [--app-id dotted.id] [--version semver] [--title title] [--package-name name] [--author person-or-team] [--json]',
|
|
181
183
|
' nimi-app init [--adopt [--input json-path]] [--dry-run] [--dir path] [--json]',
|
|
182
184
|
' nimi-app sync [--dry-run] [--dir path] [--json]',
|
|
183
|
-
' nimi-app check [--dir path] [--
|
|
184
|
-
' nimi-app dev [--dir path] [--shell electron] [--list-registrations | --resume <selector>] [--cdp-port 1024..65535 | --no-cdp]',
|
|
185
|
+
' nimi-app check [--dir path] [--production] [--json]',
|
|
186
|
+
' nimi-app dev [--dir path] [--shell electron] [--list-registrations | --resume <selector> | --new-registration] [--cdp-port 1024..65535 | --no-cdp]',
|
|
185
187
|
' nimi-app test [--dir path] [--json]',
|
|
186
188
|
' nimi-app build [--dir path] [--target target-id] [--production] [--json]',
|
|
187
189
|
' nimi-app pack [--dir path] (--target target-id [--production] | --aggregate) [--json]',
|
|
@@ -209,14 +211,14 @@ function printUsage() {
|
|
|
209
211
|
' Generated Apps exclude Lab-only Settings/account, App Access diagnostics, Realm/Agent probes, World Tour, and native/diagnostic surfaces.',
|
|
210
212
|
'',
|
|
211
213
|
'Third-party topology:',
|
|
212
|
-
' standalone: any empty target directory using public
|
|
213
|
-
'
|
|
214
|
+
' standalone: any empty target directory using public dependency version declarations.',
|
|
215
|
+
' Development may resolve complete local npm tarballs through documented overrides; no additional create mode is needed.',
|
|
216
|
+
' Source-workspace paths, parent-source aliases and private validation topology are not public create modes.',
|
|
214
217
|
'',
|
|
215
218
|
'Ownership:',
|
|
216
219
|
' App-owned: workbench-core and selected module product code under src/capabilities/**.',
|
|
217
220
|
' Scaffold-managed: carrier, identity, manifest/native wiring, and generated composition glue.',
|
|
218
221
|
' sync refreshes only scaffold-managed files; check is non-mutating.',
|
|
219
|
-
' Simulator conformance remains an explicit check mode for existing Simulator Apps; this scaffold does not generate one.',
|
|
220
222
|
'',
|
|
221
223
|
'Required order:',
|
|
222
224
|
' create -> dependency install -> init -> sync -> check -> dev/test/build -> pack',
|
|
@@ -320,7 +322,7 @@ try {
|
|
|
320
322
|
noCdp,
|
|
321
323
|
listRegistrations,
|
|
322
324
|
resume,
|
|
323
|
-
|
|
325
|
+
newRegistration,
|
|
324
326
|
target,
|
|
325
327
|
aggregate,
|
|
326
328
|
production,
|
|
@@ -393,7 +395,6 @@ try {
|
|
|
393
395
|
case 'check':
|
|
394
396
|
await checkApp(process.cwd(), {
|
|
395
397
|
dir,
|
|
396
|
-
conformance,
|
|
397
398
|
production,
|
|
398
399
|
json,
|
|
399
400
|
});
|
|
@@ -425,6 +426,7 @@ try {
|
|
|
425
426
|
noCdp,
|
|
426
427
|
listRegistrations,
|
|
427
428
|
resume,
|
|
429
|
+
newRegistration,
|
|
428
430
|
});
|
|
429
431
|
break;
|
|
430
432
|
default:
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-scaf-018c
|
|
2
|
+
|
|
3
|
+
// The default remains the tested public combination. Explicitly selected
|
|
4
|
+
// development pairs use the same current Host, never an older template.
|
|
5
|
+
// Their complete tarballs and installed identities are checked separately;
|
|
6
|
+
// admitting a source pair here makes no publication or product-acceptance claim.
|
|
7
|
+
|
|
8
|
+
const SDK = '@nimiplatform/sdk';
|
|
9
|
+
const KIT = '@nimiplatform/kit';
|
|
10
|
+
|
|
11
|
+
export const ADDITIONAL_DEPENDENCY_COMBINATIONS = Object.freeze([
|
|
12
|
+
Object.freeze({ sdkVersion: '^0.21.0', kitVersion: '^0.18.0', nimiShellTauriVersion: '0.10.0', source: 'existing' }),
|
|
13
|
+
Object.freeze({ sdkVersion: '^0.20.0', kitVersion: '^0.17.0', nimiShellTauriVersion: '0.9.0', source: 'existing' }),
|
|
14
|
+
Object.freeze({ sdkVersion: '^0.18.1', kitVersion: '^0.15.3', nimiShellTauriVersion: '0.7.0', source: 'existing' }),
|
|
15
|
+
Object.freeze({ sdkVersion: '^0.19.0', kitVersion: '^0.16.0', nimiShellTauriVersion: '0.8.0', source: 'existing' }),
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
function isRegistrySpec(value) {
|
|
19
|
+
return typeof value === 'string' && /^\^?(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[0-9A-Za-z.-]+)?$/u.test(value.trim()) && value.trim() === value;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function defaultDependencyCombination(versions) {
|
|
23
|
+
return Object.freeze({
|
|
24
|
+
sdkVersion: versions.sdkVersion,
|
|
25
|
+
kitVersion: versions.kitVersion,
|
|
26
|
+
nimiShellTauriVersion: versions.nimiShellTauriVersion,
|
|
27
|
+
source: 'default',
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function describe(combination) {
|
|
32
|
+
return `${SDK}@${combination.sdkVersion} with ${KIT}@${combination.kitVersion}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Resolves the combination an App is on from its package.json. Local,
|
|
36
|
+
// workspace or missing specs are not a selected combination and resolve to the
|
|
37
|
+
// tool default (the sync normalization target for fresh or local-only
|
|
38
|
+
// projects). A registry pairing must match a declared combination exactly.
|
|
39
|
+
export function resolveDependencyCombination(packageJson, versions) {
|
|
40
|
+
const fallback = defaultDependencyCombination(versions);
|
|
41
|
+
const section = packageJson?.dependencies;
|
|
42
|
+
const sdk = section && typeof section === 'object' && !Array.isArray(section) ? section[SDK] : undefined;
|
|
43
|
+
const kit = section && typeof section === 'object' && !Array.isArray(section) ? section[KIT] : undefined;
|
|
44
|
+
if (!isRegistrySpec(sdk) || !isRegistrySpec(kit)) return fallback;
|
|
45
|
+
if (sdk === fallback.sdkVersion && kit === fallback.kitVersion) return fallback;
|
|
46
|
+
const selected = ADDITIONAL_DEPENDENCY_COMBINATIONS.find(pair => pair.sdkVersion === sdk && pair.kitVersion === kit);
|
|
47
|
+
if (selected) return selected;
|
|
48
|
+
throw new Error(`Unsupported SDK/Kit combination: ${describe({ sdkVersion: sdk, kitVersion: kit })}. Required combination: ${describe(fallback)}. Select this combination in package.json, run nimi-app sync, install dependencies, then run nimi-app check.`);
|
|
49
|
+
}
|
|
@@ -5,6 +5,7 @@ import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
|
|
|
5
5
|
import {
|
|
6
6
|
buildAppScaffoldSnapshotFromIntent,
|
|
7
7
|
managedAppReleaseWorkflowSource,
|
|
8
|
+
SCAFFOLD_APP_OWNED_HANDOVER_PATHS,
|
|
8
9
|
SCAFFOLD_INTENT_PATH,
|
|
9
10
|
SCAFFOLD_LOCK_VERSION,
|
|
10
11
|
SCAFFOLD_LOCK_PATH,
|
|
@@ -12,9 +13,9 @@ import {
|
|
|
12
13
|
SUPPORTED_APP_SCAFFOLD_PROFILES,
|
|
13
14
|
} from './app-scaffold.mjs';
|
|
14
15
|
import { assertManifestAppAccessDeclaration } from './app-access-declaration.mjs';
|
|
15
|
-
import { validateSimulatorAppSourceWithCanonicalKitExports } from './simulator-conformance.mjs';
|
|
16
16
|
import { assertLifecycleGuidanceCurrent, LIFECYCLE_SKILL_PATH, lifecycleOwnerSteps, planLifecycleGuidance } from './app-lifecycle-guidance.mjs';
|
|
17
17
|
import { applyProjectFiles, describeChanges, plannedFile } from './app-project-files.mjs';
|
|
18
|
+
import { resolveDependencyCombination } from './app-dependency-combinations.mjs';
|
|
18
19
|
|
|
19
20
|
const SCAN_EXCLUDED_DIRS = new Set([
|
|
20
21
|
'.git',
|
|
@@ -85,11 +86,10 @@ const PROVIDER_MODEL_HARDCODING_MODEL_FAMILIES = Object.freeze([
|
|
|
85
86
|
]);
|
|
86
87
|
const LOCAL_DEVELOPMENT_BYPASS_LABELS = new Set([
|
|
87
88
|
'generic platform auth helper in scaffold',
|
|
88
|
-
'Realm login bypass endpoint',
|
|
89
|
-
'Realm refresh bypass endpoint',
|
|
90
89
|
'Realm permission grant REST bypass endpoint',
|
|
91
90
|
'Realm raw request bypass',
|
|
92
91
|
// Existing Apps own ordinary HTTP routes and may retain vendor sources.
|
|
92
|
+
// Their login/refresh paths also do not identify Nimi Realm authority.
|
|
93
93
|
// A bare /api or /v1 URL does not identify Nimi Realm/Runtime authority.
|
|
94
94
|
// Those broad patterns remain applicable to our generated scaffold only.
|
|
95
95
|
'app-owned session store',
|
|
@@ -260,6 +260,18 @@ function isScannedTextPath(relativePath) {
|
|
|
260
260
|
&& TEXT_EXTENSIONS.has(path.extname(relativePath));
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
+
function isNextBuildOutputDirectory(directory) {
|
|
264
|
+
if (!path.basename(directory).startsWith('.next-')) return false;
|
|
265
|
+
// Next can separate dev and production distDir outputs. Exclude an actual
|
|
266
|
+
// output tree, not every similarly named source directory or ignored file.
|
|
267
|
+
return [directory, path.join(directory, 'dev')].some((output) => (
|
|
268
|
+
statSync(path.join(output, 'build-manifest.json'), { throwIfNoEntry: false })?.isFile()
|
|
269
|
+
&& statSync(path.join(output, 'routes-manifest.json'), { throwIfNoEntry: false })?.isFile()
|
|
270
|
+
&& statSync(path.join(output, 'server'), { throwIfNoEntry: false })?.isDirectory()
|
|
271
|
+
&& statSync(path.join(output, 'static'), { throwIfNoEntry: false })?.isDirectory()
|
|
272
|
+
));
|
|
273
|
+
}
|
|
274
|
+
|
|
263
275
|
function collectTextFiles(rootDir) {
|
|
264
276
|
const results = [];
|
|
265
277
|
const walk = (currentDir) => {
|
|
@@ -269,6 +281,11 @@ function collectTextFiles(rootDir) {
|
|
|
269
281
|
}
|
|
270
282
|
const fullPath = path.join(currentDir, entry.name);
|
|
271
283
|
if (entry.isDirectory()) {
|
|
284
|
+
if (isNextBuildOutputDirectory(fullPath)) continue;
|
|
285
|
+
// Python environments can contain bundled JS applications. Like
|
|
286
|
+
// node_modules, these installed dependencies are not App source.
|
|
287
|
+
// Use the environment marker, not a project-specific directory name.
|
|
288
|
+
if (existsSync(path.join(fullPath, 'pyvenv.cfg'))) continue;
|
|
272
289
|
walk(fullPath);
|
|
273
290
|
continue;
|
|
274
291
|
}
|
|
@@ -321,7 +338,6 @@ function buildForbiddenPatterns() {
|
|
|
321
338
|
['direct Realm permission grant module access', /\.permissionGrants\./],
|
|
322
339
|
['direct Realm permission grant method', /\b(?:listMyAppPermissionGrants|getMyAppPermissionGrant(?:Status|Projection)?|requestMyAppPermissionGrant|revokeMyAppPermissionGrant)\s*\(/],
|
|
323
340
|
['OpenAI-compatible Runtime REST endpoint assumption', /\/v1\/(?:chat\/completions|responses|embeddings|audio|images|models)\b/],
|
|
324
|
-
['app-owned session store', /sessionStore/],
|
|
325
341
|
['app-owned refresh token provider', /refreshTokenProvider/],
|
|
326
342
|
['app-owned protected Runtime gRPC client', /@grpc\/grpc-js|\bgrpc\.credentials\.createInsecure\s*\(/],
|
|
327
343
|
['app-owned Runtime endpoint custody', /\b(?:NIMI_RUNTIME_ENDPOINT|runtimeEndpoint)\b/],
|
|
@@ -614,6 +630,7 @@ function validateAppProjectState(targetDir, versions, runners = {}) {
|
|
|
614
630
|
const lock = readLock(targetDir);
|
|
615
631
|
const intent = readIntent(targetDir);
|
|
616
632
|
const snapshot = expectedSnapshotFromLock(lock, versions, intent, targetDir);
|
|
633
|
+
assertNoPendingAppOwnedHandover(lock, snapshot);
|
|
617
634
|
ensureLockMatchesCurrentGenerator(lock, snapshot);
|
|
618
635
|
assertRequiredSupportFiles(targetDir, snapshot);
|
|
619
636
|
assertProjectConfiguration(targetDir);
|
|
@@ -668,11 +685,27 @@ export function initApp(cwd, options = {}, versions, runners = {}) {
|
|
|
668
685
|
const targetDir = resolveTargetDir(cwd, options);
|
|
669
686
|
const intent = readIntent(targetDir);
|
|
670
687
|
const currentManifest = readCurrentAppManifest(targetDir);
|
|
671
|
-
|
|
688
|
+
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-scaf-018c
|
|
689
|
+
// Create still uses the tool default. An explicit listed selection before
|
|
690
|
+
// first init refreshes derived glue through this owner, just as sync does.
|
|
691
|
+
// Check the original generated files before projecting the selected pair.
|
|
692
|
+
const original = buildAppScaffoldSnapshotFromIntent({ intent, versions, targetDir });
|
|
693
|
+
const combination = resolveDependencyCombination(readJsonFile(path.join(targetDir, 'package.json')), versions);
|
|
694
|
+
const effective = { ...versions, ...combination };
|
|
695
|
+
const snapshot = buildAppScaffoldSnapshotFromIntent({ intent, versions: effective, targetDir, refreshDerived: true });
|
|
672
696
|
validateAppProjectInputs(targetDir, currentManifest, readJsonFile(path.join(targetDir, 'package.json')), true);
|
|
673
697
|
const initializedPaths = new Set(snapshot.initFiles.map((file) => file.path));
|
|
674
|
-
assertManagedFilesCurrent(targetDir, { managedFileHashes: Object.fromEntries(Object.entries(
|
|
675
|
-
const
|
|
698
|
+
assertManagedFilesCurrent(targetDir, { managedFileHashes: Object.fromEntries(Object.entries(original.lock.managedFileHashes).filter(([relativePath]) => !initializedPaths.has(relativePath))) });
|
|
699
|
+
const managedFiles = snapshot.filesWithoutLock.filter((file) => snapshot.lock.managedFileHashes[file.path]);
|
|
700
|
+
const planned = [...managedFiles.map((file) => {
|
|
701
|
+
let content = file.content;
|
|
702
|
+
if (file.path === 'nimi.app.yaml' && currentManifest) {
|
|
703
|
+
const next = parseYaml(content);
|
|
704
|
+
for (const field of APP_AUTHOR_DECLARATION_FIELDS) if (Object.hasOwn(currentManifest, field)) next[field] = currentManifest[field];
|
|
705
|
+
content = stringifyYaml(next, { lineWidth: 0 });
|
|
706
|
+
}
|
|
707
|
+
return plannedFile(targetDir, file.path, content);
|
|
708
|
+
}), ...planLifecycleGuidance(targetDir), ...snapshot.initFiles.map((file) => plannedFile(targetDir, file.path, file.content))];
|
|
676
709
|
const preview = {
|
|
677
710
|
ok: true, command: 'init', dir: targetDir, dryRun: options.dryRun === true,
|
|
678
711
|
skillPath: LIFECYCLE_SKILL_PATH, changes: describeChanges(targetDir, planned), ownerSteps: lifecycleOwnerSteps(versions),
|
|
@@ -692,7 +725,7 @@ export function initApp(cwd, options = {}, versions, runners = {}) {
|
|
|
692
725
|
assertManagedFilesCurrent(targetDir, snapshot.lock);
|
|
693
726
|
assertNimicodingProjectionCurrent(targetDir, runners);
|
|
694
727
|
applyProjectFiles(targetDir, [lockFile]);
|
|
695
|
-
validateAppProjectState(targetDir,
|
|
728
|
+
validateAppProjectState(targetDir, effective, runners);
|
|
696
729
|
const payload = {
|
|
697
730
|
...preview,
|
|
698
731
|
ok: true,
|
|
@@ -715,18 +748,6 @@ export function initApp(cwd, options = {}, versions, runners = {}) {
|
|
|
715
748
|
|
|
716
749
|
export function validateAppProject(cwd, options = {}, versions, runners = {}) {
|
|
717
750
|
const targetDir = resolveTargetDir(cwd, options);
|
|
718
|
-
if (options.conformance) {
|
|
719
|
-
if (options.conformance !== 'simulator') {
|
|
720
|
-
throw new Error(`Unsupported conformance target: ${options.conformance}`);
|
|
721
|
-
}
|
|
722
|
-
if (options.json) {
|
|
723
|
-
throw new Error('--json is not supported for Simulator source validation');
|
|
724
|
-
}
|
|
725
|
-
return validateSimulatorAppSourceWithCanonicalKitExports(targetDir).then((result) => {
|
|
726
|
-
process.stdout.write(`[nimi-app] Simulator source validation passed for ${targetDir}\n`);
|
|
727
|
-
return result;
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
751
|
const result = validateAppProjectState(targetDir, versions, runners);
|
|
731
752
|
const payload = {
|
|
732
753
|
ok: true,
|
|
@@ -761,13 +782,51 @@ function collectExpectedClasses(snapshot) {
|
|
|
761
782
|
return entries;
|
|
762
783
|
}
|
|
763
784
|
|
|
764
|
-
|
|
785
|
+
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-scaf-018c
|
|
786
|
+
// A lock written by an earlier scaffold version can still list a file that the
|
|
787
|
+
// current generator creates once for the App to own. Only the declared paths
|
|
788
|
+
// may change owner, and only from managed glue to App-owned product code.
|
|
789
|
+
function isAppOwnedHandover(relativePath, lockedEntry, current) {
|
|
790
|
+
return SCAFFOLD_APP_OWNED_HANDOVER_PATHS.includes(relativePath)
|
|
791
|
+
&& lockedEntry?.class === 'scaffold-managed glue'
|
|
792
|
+
&& current?.owner === 'app-owned'
|
|
793
|
+
&& current.class === 'app-owned product code';
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
function assertNoPendingAppOwnedHandover(lock, snapshot) {
|
|
797
|
+
const currentClasses = collectExpectedClasses(snapshot);
|
|
798
|
+
const pending = Object.entries(lock.managedFileHashes || {})
|
|
799
|
+
.filter(([relativePath, entry]) => isAppOwnedHandover(relativePath, entry, currentClasses.get(relativePath)))
|
|
800
|
+
.map(([relativePath]) => relativePath);
|
|
801
|
+
if (pending.length > 0) {
|
|
802
|
+
throw new Error(`${pending.join(', ')} now belongs to the App and is no longer scaffold-managed. Run nimi-app sync to record the new owner; sync leaves the file unchanged.`);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
function describeAppOwnedHandover(targetDir, relativePath, lockedEntry) {
|
|
807
|
+
const filePath = path.join(targetDir, relativePath);
|
|
808
|
+
if (!existsSync(filePath)) return { path: relativePath, owner: 'app', file: 'missing' };
|
|
809
|
+
return {
|
|
810
|
+
path: relativePath,
|
|
811
|
+
owner: 'app',
|
|
812
|
+
file: 'kept',
|
|
813
|
+
// True when the file still holds exactly what the earlier scaffold managed.
|
|
814
|
+
earlierScaffoldContent: hashScaffoldManagedContent(relativePath, readContentForHash(filePath)) === lockedEntry.sha256,
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
function assertNoClassificationConflict(lock, snapshot, targetDir) {
|
|
765
819
|
const currentClasses = collectExpectedClasses(snapshot);
|
|
820
|
+
const handovers = [];
|
|
766
821
|
for (const [relativePath, entry] of Object.entries(lock.managedFileHashes || {})) {
|
|
767
822
|
const current = currentClasses.get(relativePath);
|
|
768
823
|
if (current?.owner === 'managed' && current.class === entry.class) {
|
|
769
824
|
continue;
|
|
770
825
|
}
|
|
826
|
+
if (isAppOwnedHandover(relativePath, entry, current)) {
|
|
827
|
+
handovers.push(describeAppOwnedHandover(targetDir, relativePath, entry));
|
|
828
|
+
continue;
|
|
829
|
+
}
|
|
771
830
|
throw new Error(`Scaffold classification conflict: ${relativePath}`);
|
|
772
831
|
}
|
|
773
832
|
for (const [relativePath, entry] of Object.entries(lock.appOwnedInitialHashes || {})) {
|
|
@@ -777,6 +836,7 @@ function assertNoClassificationConflict(lock, snapshot) {
|
|
|
777
836
|
}
|
|
778
837
|
throw new Error(`Scaffold classification conflict: ${relativePath}`);
|
|
779
838
|
}
|
|
839
|
+
return handovers;
|
|
780
840
|
}
|
|
781
841
|
|
|
782
842
|
function readCurrentAppManifest(targetDir) {
|
|
@@ -806,7 +866,8 @@ export function planManagedAppSync(cwd, options = {}, versions) {
|
|
|
806
866
|
},
|
|
807
867
|
};
|
|
808
868
|
const snapshot = expectedSnapshotFromLock(lock, versions, versionedIntent, targetDir, { refreshDerived: true });
|
|
809
|
-
|
|
869
|
+
// Handed-over files are App-owned now: they are reported, never planned.
|
|
870
|
+
const handovers = assertNoClassificationConflict(lock, snapshot, targetDir);
|
|
810
871
|
const planned = snapshot.filesWithoutLock.filter((file) => snapshot.lock.managedFileHashes[file.path]).map((file) => {
|
|
811
872
|
let content = file.content;
|
|
812
873
|
if (file.path === 'nimi.app.yaml' && currentManifest) {
|
|
@@ -817,5 +878,5 @@ export function planManagedAppSync(cwd, options = {}, versions) {
|
|
|
817
878
|
return plannedFile(targetDir, file.path, content);
|
|
818
879
|
});
|
|
819
880
|
planned.push(...planLifecycleGuidance(targetDir), plannedFile(targetDir, SCAFFOLD_LOCK_PATH, `${JSON.stringify(snapshot.lock, null, 2)}\n`));
|
|
820
|
-
return { targetDir, snapshot, planned };
|
|
881
|
+
return { targetDir, snapshot, planned, handovers };
|
|
821
882
|
}
|