@nimiplatform/app-tools 0.7.5 → 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 +56 -5
- package/bin/nimi-app.mjs +11 -3
- package/lib/app-access-declaration.mjs +1 -0
- package/lib/app-dependency-combinations.mjs +15 -28
- package/lib/app-doctor-update.mjs +66 -7
- package/lib/app-info.mjs +8 -1
- package/lib/app-project-lifecycle.mjs +82 -9
- package/lib/app-scaffold-capabilities.mjs +3 -3
- package/lib/app-scaffold-profiles.mjs +96 -26
- package/lib/app-scaffold.mjs +54 -7
- package/lib/canonical-capability-ids.generated.mjs +4 -0
- package/package.json +26 -25
- package/scripts/dev-shell.mjs +61 -17
- package/skills/nimi-app-lifecycle/references/acceptance.md +1 -1
- package/skills/nimi-app-lifecycle/references/adapt.md +2 -2
- package/skills/nimi-app-lifecycle/references/release.md +1 -1
- package/skills/nimi-app-lifecycle/references/upgrade-platform.md +14 -0
- 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 +28 -0
- 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/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/README.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
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.
|
|
@@ -110,6 +115,36 @@ rejected rather than normalized. A matrix range in the manifest does not
|
|
|
110
115
|
require an automatic upgrade; install with the frozen lockfile until
|
|
111
116
|
deliberately selecting and synchronizing a new component combination.
|
|
112
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
|
+
|
|
113
148
|
### Local development packages
|
|
114
149
|
|
|
115
150
|
Development does not require publishing every SDK/Kit or app-tools change.
|
|
@@ -120,9 +155,9 @@ overrides in the App's own `pnpm-workspace.yaml`:
|
|
|
120
155
|
packages:
|
|
121
156
|
- .
|
|
122
157
|
overrides:
|
|
123
|
-
'@nimiplatform/app-tools': file:D:/nimi-packages/nimiplatform-app-tools-0.
|
|
124
|
-
'@nimiplatform/sdk': file:D:/nimi-packages/nimiplatform-sdk-0.
|
|
125
|
-
'@nimiplatform/kit': file:D:/nimi-packages/nimiplatform-kit-0.
|
|
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
|
|
126
161
|
```
|
|
127
162
|
|
|
128
163
|
These are example artifact locations; use the complete packages you were given.
|
|
@@ -132,6 +167,10 @@ Local archives may also use paths relative to the App. Install, run sync and
|
|
|
132
167
|
check, then use the normal dev/test/build/pack loop. Sync retains these choices;
|
|
133
168
|
check verifies matrix compatibility and compares the selected tarball version,
|
|
134
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.
|
|
135
174
|
Workspace members declare their own SDK/Kit dependencies and share the root
|
|
136
175
|
tarball overrides. pnpm writes each member's `specifier` relative to that member,
|
|
137
176
|
while resolved versions and package records remain workspace-relative; check
|
|
@@ -192,7 +231,7 @@ create -> dependency install -> init -> sync -> check
|
|
|
192
231
|
|
|
193
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.
|
|
194
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.
|
|
195
|
-
- `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.
|
|
196
235
|
- `check` is non-mutating and incorporates the former scaffold validation behavior.
|
|
197
236
|
- `dev` requests the official Desktop-supervised Electron development Host.
|
|
198
237
|
- `test` and `build` execute the real owner commands declared in `.nimi/config/build-profile.yaml`; there is no fallback success.
|
|
@@ -245,6 +284,8 @@ pnpm dev
|
|
|
245
284
|
|
|
246
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.
|
|
247
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
|
+
|
|
248
289
|
Every `build`, including non-production builds, requires the selected target's
|
|
249
290
|
declared payload and exact Runtime entry to exist after its owner command exits
|
|
250
291
|
successfully. Building a macOS payload cannot report success for a missing
|
|
@@ -265,7 +306,7 @@ The list shows the current project's registrations and creation times. Copy the
|
|
|
265
306
|
|
|
266
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.
|
|
267
308
|
|
|
268
|
-
App Tools
|
|
309
|
+
App Tools prepares the `macos-aarch64` target on an Apple Silicon Mac.
|
|
269
310
|
The same owner command produces `dist-electron-package/<app>-shell-darwin-arm64/`
|
|
270
311
|
with a native `.app` bundle and a direct `Contents/MacOS` entry. The publisher's
|
|
271
312
|
build applies an ad-hoc integrity seal without a Developer ID identity or Apple
|
|
@@ -382,6 +423,16 @@ out of source files, `.env`, and release notes.
|
|
|
382
423
|
|
|
383
424
|
### 4. Check, build, and publish a version
|
|
384
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
|
+
|
|
385
436
|
Keep the packaged `LICENSE` identical to the reviewed Git source. New scaffolds
|
|
386
437
|
include `LICENSE -text` in `.gitattributes`. Add the same rule to an existing
|
|
387
438
|
repository while preserving its other attributes, and commit it before tagging.
|
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: '', target: '', aggregate: false, production: false, json: false,
|
|
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,6 +103,12 @@ 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');
|
|
@@ -146,7 +152,7 @@ function assertCommandOptions(command, providedOptions) {
|
|
|
146
152
|
init: new Set(['dir', 'json', 'adopt', 'input', 'dryRun']),
|
|
147
153
|
sync: new Set(['dir', 'json', 'dryRun']),
|
|
148
154
|
check: new Set(['dir', 'json', 'production']),
|
|
149
|
-
dev: new Set(['dir', 'shell', 'cdpPort', 'noCdp', 'listRegistrations', 'resume']),
|
|
155
|
+
dev: new Set(['dir', 'shell', 'cdpPort', 'noCdp', 'listRegistrations', 'resume', 'newRegistration']),
|
|
150
156
|
test: new Set(['dir', 'json']),
|
|
151
157
|
build: new Set(['dir', 'target', 'production', 'json']),
|
|
152
158
|
pack: new Set(['dir', 'target', 'aggregate', 'production', 'json']),
|
|
@@ -177,7 +183,7 @@ function printUsage() {
|
|
|
177
183
|
' nimi-app init [--adopt [--input json-path]] [--dry-run] [--dir path] [--json]',
|
|
178
184
|
' nimi-app sync [--dry-run] [--dir path] [--json]',
|
|
179
185
|
' nimi-app check [--dir path] [--production] [--json]',
|
|
180
|
-
' nimi-app dev [--dir path] [--shell electron] [--list-registrations | --resume <selector>] [--cdp-port 1024..65535 | --no-cdp]',
|
|
186
|
+
' nimi-app dev [--dir path] [--shell electron] [--list-registrations | --resume <selector> | --new-registration] [--cdp-port 1024..65535 | --no-cdp]',
|
|
181
187
|
' nimi-app test [--dir path] [--json]',
|
|
182
188
|
' nimi-app build [--dir path] [--target target-id] [--production] [--json]',
|
|
183
189
|
' nimi-app pack [--dir path] (--target target-id [--production] | --aggregate) [--json]',
|
|
@@ -316,6 +322,7 @@ try {
|
|
|
316
322
|
noCdp,
|
|
317
323
|
listRegistrations,
|
|
318
324
|
resume,
|
|
325
|
+
newRegistration,
|
|
319
326
|
target,
|
|
320
327
|
aggregate,
|
|
321
328
|
production,
|
|
@@ -419,6 +426,7 @@ try {
|
|
|
419
426
|
noCdp,
|
|
420
427
|
listRegistrations,
|
|
421
428
|
resume,
|
|
429
|
+
newRegistration,
|
|
422
430
|
});
|
|
423
431
|
break;
|
|
424
432
|
default:
|
|
@@ -1,31 +1,20 @@
|
|
|
1
1
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-scaf-018c
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// one of the limited combinations below; sync preserves it and its matching
|
|
8
|
-
// glue, while the app-tools and nimi-coding tool dependencies are still
|
|
9
|
-
// synchronized to the selected tool version. Manifest, lock, Cargo, glue,
|
|
10
|
-
// build/pack and workflow checks all resolve the combination through
|
|
11
|
-
// `resolveDependencyCombination` so no entry point accepts an arbitrary
|
|
12
|
-
// SDK x Kit pairing.
|
|
13
|
-
//
|
|
14
|
-
// Evidence for each row is a shipped app-tools default matrix
|
|
15
|
-
// (app-tools/package.json history) whose Kit release declares the paired SDK
|
|
16
|
-
// range and whose Kit release commit carries the listed nimi-shell-tauri
|
|
17
|
-
// crate version. Add a row only with that evidence; never widen to ranges.
|
|
18
|
-
export const SUPPORTED_DEPENDENCY_COMBINATIONS = Object.freeze([
|
|
19
|
-
Object.freeze({ sdkVersion: '^0.11.0', kitVersion: '^0.7.0', nimiShellTauriVersion: '0.3.0' }),
|
|
20
|
-
Object.freeze({ sdkVersion: '^0.12.0', kitVersion: '^0.8.0', nimiShellTauriVersion: '0.4.0' }),
|
|
21
|
-
Object.freeze({ sdkVersion: '^0.13.0', kitVersion: '^0.9.0', nimiShellTauriVersion: '0.5.0' }),
|
|
22
|
-
Object.freeze({ sdkVersion: '^0.14.0', kitVersion: '^0.10.0', nimiShellTauriVersion: '0.6.0' }),
|
|
23
|
-
Object.freeze({ sdkVersion: '^0.15.0', kitVersion: '^0.11.0', nimiShellTauriVersion: '0.6.0' }),
|
|
24
|
-
]);
|
|
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.
|
|
25
7
|
|
|
26
8
|
const SDK = '@nimiplatform/sdk';
|
|
27
9
|
const KIT = '@nimiplatform/kit';
|
|
28
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
|
+
|
|
29
18
|
function isRegistrySpec(value) {
|
|
30
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;
|
|
31
20
|
}
|
|
@@ -46,7 +35,7 @@ function describe(combination) {
|
|
|
46
35
|
// Resolves the combination an App is on from its package.json. Local,
|
|
47
36
|
// workspace or missing specs are not a selected combination and resolve to the
|
|
48
37
|
// tool default (the sync normalization target for fresh or local-only
|
|
49
|
-
// projects). A registry pairing must match
|
|
38
|
+
// projects). A registry pairing must match a declared combination exactly.
|
|
50
39
|
export function resolveDependencyCombination(packageJson, versions) {
|
|
51
40
|
const fallback = defaultDependencyCombination(versions);
|
|
52
41
|
const section = packageJson?.dependencies;
|
|
@@ -54,9 +43,7 @@ export function resolveDependencyCombination(packageJson, versions) {
|
|
|
54
43
|
const kit = section && typeof section === 'object' && !Array.isArray(section) ? section[KIT] : undefined;
|
|
55
44
|
if (!isRegistrySpec(sdk) || !isRegistrySpec(kit)) return fallback;
|
|
56
45
|
if (sdk === fallback.sdkVersion && kit === fallback.kitVersion) return fallback;
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
return Object.freeze({ ...supported, source: 'existing' });
|
|
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.`);
|
|
62
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,
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
import { assertManifestAppAccessDeclaration } from './app-access-declaration.mjs';
|
|
15
16
|
import { assertLifecycleGuidanceCurrent, LIFECYCLE_SKILL_PATH, lifecycleOwnerSteps, planLifecycleGuidance } from './app-lifecycle-guidance.mjs';
|
|
16
17
|
import { applyProjectFiles, describeChanges, plannedFile } from './app-project-files.mjs';
|
|
18
|
+
import { resolveDependencyCombination } from './app-dependency-combinations.mjs';
|
|
17
19
|
|
|
18
20
|
const SCAN_EXCLUDED_DIRS = new Set([
|
|
19
21
|
'.git',
|
|
@@ -628,6 +630,7 @@ function validateAppProjectState(targetDir, versions, runners = {}) {
|
|
|
628
630
|
const lock = readLock(targetDir);
|
|
629
631
|
const intent = readIntent(targetDir);
|
|
630
632
|
const snapshot = expectedSnapshotFromLock(lock, versions, intent, targetDir);
|
|
633
|
+
assertNoPendingAppOwnedHandover(lock, snapshot);
|
|
631
634
|
ensureLockMatchesCurrentGenerator(lock, snapshot);
|
|
632
635
|
assertRequiredSupportFiles(targetDir, snapshot);
|
|
633
636
|
assertProjectConfiguration(targetDir);
|
|
@@ -682,11 +685,27 @@ export function initApp(cwd, options = {}, versions, runners = {}) {
|
|
|
682
685
|
const targetDir = resolveTargetDir(cwd, options);
|
|
683
686
|
const intent = readIntent(targetDir);
|
|
684
687
|
const currentManifest = readCurrentAppManifest(targetDir);
|
|
685
|
-
|
|
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 });
|
|
686
696
|
validateAppProjectInputs(targetDir, currentManifest, readJsonFile(path.join(targetDir, 'package.json')), true);
|
|
687
697
|
const initializedPaths = new Set(snapshot.initFiles.map((file) => file.path));
|
|
688
|
-
assertManagedFilesCurrent(targetDir, { managedFileHashes: Object.fromEntries(Object.entries(
|
|
689
|
-
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))];
|
|
690
709
|
const preview = {
|
|
691
710
|
ok: true, command: 'init', dir: targetDir, dryRun: options.dryRun === true,
|
|
692
711
|
skillPath: LIFECYCLE_SKILL_PATH, changes: describeChanges(targetDir, planned), ownerSteps: lifecycleOwnerSteps(versions),
|
|
@@ -706,7 +725,7 @@ export function initApp(cwd, options = {}, versions, runners = {}) {
|
|
|
706
725
|
assertManagedFilesCurrent(targetDir, snapshot.lock);
|
|
707
726
|
assertNimicodingProjectionCurrent(targetDir, runners);
|
|
708
727
|
applyProjectFiles(targetDir, [lockFile]);
|
|
709
|
-
validateAppProjectState(targetDir,
|
|
728
|
+
validateAppProjectState(targetDir, effective, runners);
|
|
710
729
|
const payload = {
|
|
711
730
|
...preview,
|
|
712
731
|
ok: true,
|
|
@@ -763,13 +782,51 @@ function collectExpectedClasses(snapshot) {
|
|
|
763
782
|
return entries;
|
|
764
783
|
}
|
|
765
784
|
|
|
766
|
-
|
|
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) {
|
|
767
819
|
const currentClasses = collectExpectedClasses(snapshot);
|
|
820
|
+
const handovers = [];
|
|
768
821
|
for (const [relativePath, entry] of Object.entries(lock.managedFileHashes || {})) {
|
|
769
822
|
const current = currentClasses.get(relativePath);
|
|
770
823
|
if (current?.owner === 'managed' && current.class === entry.class) {
|
|
771
824
|
continue;
|
|
772
825
|
}
|
|
826
|
+
if (isAppOwnedHandover(relativePath, entry, current)) {
|
|
827
|
+
handovers.push(describeAppOwnedHandover(targetDir, relativePath, entry));
|
|
828
|
+
continue;
|
|
829
|
+
}
|
|
773
830
|
throw new Error(`Scaffold classification conflict: ${relativePath}`);
|
|
774
831
|
}
|
|
775
832
|
for (const [relativePath, entry] of Object.entries(lock.appOwnedInitialHashes || {})) {
|
|
@@ -779,6 +836,7 @@ function assertNoClassificationConflict(lock, snapshot) {
|
|
|
779
836
|
}
|
|
780
837
|
throw new Error(`Scaffold classification conflict: ${relativePath}`);
|
|
781
838
|
}
|
|
839
|
+
return handovers;
|
|
782
840
|
}
|
|
783
841
|
|
|
784
842
|
function readCurrentAppManifest(targetDir) {
|
|
@@ -808,7 +866,8 @@ export function planManagedAppSync(cwd, options = {}, versions) {
|
|
|
808
866
|
},
|
|
809
867
|
};
|
|
810
868
|
const snapshot = expectedSnapshotFromLock(lock, versions, versionedIntent, targetDir, { refreshDerived: true });
|
|
811
|
-
|
|
869
|
+
// Handed-over files are App-owned now: they are reported, never planned.
|
|
870
|
+
const handovers = assertNoClassificationConflict(lock, snapshot, targetDir);
|
|
812
871
|
const planned = snapshot.filesWithoutLock.filter((file) => snapshot.lock.managedFileHashes[file.path]).map((file) => {
|
|
813
872
|
let content = file.content;
|
|
814
873
|
if (file.path === 'nimi.app.yaml' && currentManifest) {
|
|
@@ -819,5 +878,5 @@ export function planManagedAppSync(cwd, options = {}, versions) {
|
|
|
819
878
|
return plannedFile(targetDir, file.path, content);
|
|
820
879
|
});
|
|
821
880
|
planned.push(...planLifecycleGuidance(targetDir), plannedFile(targetDir, SCAFFOLD_LOCK_PATH, `${JSON.stringify(snapshot.lock, null, 2)}\n`));
|
|
822
|
-
return { targetDir, snapshot, planned };
|
|
881
|
+
return { targetDir, snapshot, planned, handovers };
|
|
823
882
|
}
|
package/lib/app-info.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import path from 'node:path';
|
|
|
5
5
|
import { PNG } from 'pngjs';
|
|
6
6
|
import { parse as parseYaml } from 'yaml';
|
|
7
7
|
import { normalizeAppAccessItems } from './app-access-declaration.mjs';
|
|
8
|
+
import { CANONICAL_CAPABILITY_IDS } from './canonical-capability-ids.generated.mjs';
|
|
8
9
|
import { SAFETY_PROFILE_FIELD, normalizeSafetyProfile } from './app-safety-profile.mjs';
|
|
9
10
|
|
|
10
11
|
export const APP_INFO_MAX_BYTES = 1024 * 1024;
|
|
@@ -31,7 +32,13 @@ function refs(value, label) {
|
|
|
31
32
|
if (!Array.isArray(value) || new Set(value).size !== value.length) {
|
|
32
33
|
throw new Error(`App info ${label} must be an explicit unique list (empty is allowed)`);
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
const entries = value.map((item) => text(item, label, 200));
|
|
36
|
+
if (label === 'capability_contract_refs') {
|
|
37
|
+
for (const entry of entries) {
|
|
38
|
+
if (!CANONICAL_CAPABILITY_IDS.includes(entry)) throw new Error(`App info ${label} contains unknown CapabilityContract: ${entry}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return entries;
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
export function validateAppIcon(bytes) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { readAppInfo } from './app-info.mjs';
|
|
2
|
+
import { CANONICAL_CAPABILITY_IDS } from './canonical-capability-ids.generated.mjs';
|
|
2
3
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-scaf-018c
|
|
3
4
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-009b
|
|
4
5
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-043a
|
|
@@ -43,6 +44,7 @@ const SYNCHRONIZED_NIMI_PACKAGES = new Set([
|
|
|
43
44
|
'@nimiplatform/kit',
|
|
44
45
|
'@nimiplatform/app-tools',
|
|
45
46
|
'@nimiplatform/nimi-coding',
|
|
47
|
+
'@nimiplatform/sdk-adapter-vercel-ai',
|
|
46
48
|
...KIT_OWNED_NATIVE_CARRIERS,
|
|
47
49
|
]);
|
|
48
50
|
const BUILD_PROFILE_PATH = '.nimi/config/build-profile.yaml';
|
|
@@ -138,6 +140,9 @@ function readSubmittedManifest(targetDir, sources) {
|
|
|
138
140
|
throw new Error('Existing submitted app version must be an exact semantic version');
|
|
139
141
|
}
|
|
140
142
|
let safetyProfile;
|
|
143
|
+
if (document.capability_contract_refs !== undefined) {
|
|
144
|
+
canonicalInputList(document.capability_contract_refs, 'nimi.app.yaml capability_contract_refs');
|
|
145
|
+
}
|
|
141
146
|
if (document[SAFETY_PROFILE_FIELD] !== undefined) {
|
|
142
147
|
try {
|
|
143
148
|
safetyProfile = normalizeSafetyProfile(document[SAFETY_PROFILE_FIELD]);
|
|
@@ -180,10 +185,9 @@ function selectDependencyCombination(packageJson, versions, managed) {
|
|
|
180
185
|
return managed ? defaultDependencyCombination(versions) : resolveDependencyCombination(packageJson, versions);
|
|
181
186
|
}
|
|
182
187
|
|
|
183
|
-
//
|
|
184
|
-
//
|
|
185
|
-
//
|
|
186
|
-
// Only a fresh create starts from the tool default. An unlisted pairing fails.
|
|
188
|
+
// Validate the App's explicit SDK/Kit selection before deriving or writing
|
|
189
|
+
// managed glue. A previous Host contract must be upgraded by the App first;
|
|
190
|
+
// selecting a newer tool never silently changes business dependencies.
|
|
187
191
|
function managedProjectVersions(targetDir, versions) {
|
|
188
192
|
const packagePath = path.join(targetDir, 'package.json');
|
|
189
193
|
if (!existsSync(packagePath)) return versions;
|
|
@@ -394,6 +398,11 @@ function canonicalInputList(value, label, allowEmpty = true) {
|
|
|
394
398
|
if (!Array.isArray(value) || (!allowEmpty && value.length === 0)) throw new Error(`${label} must be ${allowEmpty ? 'an array' : 'a non-empty array'}`);
|
|
395
399
|
const entries = value.map((item, index) => canonicalInputText(item, `${label}[${index}]`));
|
|
396
400
|
if (new Set(entries).size !== entries.length) throw new Error(`${label} must not contain duplicates`);
|
|
401
|
+
if (label.endsWith('capability_contract_refs')) {
|
|
402
|
+
for (const entry of entries) {
|
|
403
|
+
if (!CANONICAL_CAPABILITY_IDS.includes(entry)) throw new Error(`${label} contains unknown CapabilityContract: ${entry}`);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
397
406
|
return entries;
|
|
398
407
|
}
|
|
399
408
|
|
|
@@ -589,7 +598,12 @@ function assertPnpmLockCurrent(targetDir, packageJson, localPackages, versions,
|
|
|
589
598
|
}
|
|
590
599
|
if (!existsSync(manifestPath)) throw installRequiredError(`Local Nimi package is not installed: ${name}`);
|
|
591
600
|
const installed = readJsonFile(manifestPath, name);
|
|
592
|
-
const
|
|
601
|
+
const declared = NPM_DEPENDENCY_SECTIONS.map((section) => dependencySection(packageJson, section)?.[name]).filter((value) => value !== undefined);
|
|
602
|
+
const expected = expectedNimiDependencies(versions, combination).find((entry) => entry.name === name)?.version
|
|
603
|
+
|| (KIT_OWNED_NATIVE_CARRIERS.includes(name) ? combination.kitVersion : declared[0]);
|
|
604
|
+
if (!expected || declared.some((specifier) => specifier !== expected)) {
|
|
605
|
+
throw installRequiredError(`Local Nimi package has no consistent declared version: ${name}`);
|
|
606
|
+
}
|
|
593
607
|
if (installed.name !== name || !satisfies(installed.version, expected, { includePrerelease: true })) {
|
|
594
608
|
throw installRequiredError(`Installed local Nimi package must be ${name}@${expected}`);
|
|
595
609
|
}
|
|
@@ -944,6 +958,43 @@ function assertCanonicalAuthoringInputs(targetDir, descriptor, files, version, n
|
|
|
944
958
|
return { identity, submission };
|
|
945
959
|
}
|
|
946
960
|
|
|
961
|
+
function isScopedComponentReleaseWorkflow(source, targetDir) {
|
|
962
|
+
// A separate, non-latest component tag with matching bounded asset names is
|
|
963
|
+
// not the App release. Unclassified releases still require owner review.
|
|
964
|
+
if (/candidate-uploads|\/api\/platform\/apps\/candidates|\.nimiapp\b|\bnimi-app\s+(?:build|pack)\b|\belectron-builder\b|\btauri\s+build\b/iu.test(source)
|
|
965
|
+
|| /\bgh\s+release\s+(?:create|upload|edit|delete)\b/iu.test(source)) return false;
|
|
966
|
+
const packageJson = JSON.parse(readFileSync(path.join(targetDir, 'package.json'), 'utf8'));
|
|
967
|
+
const inspectedScripts = new Set();
|
|
968
|
+
const invokesAppBuild = command => {
|
|
969
|
+
if (/\bnimi-app\s+(?:build|pack)\b|\belectron-builder\b|\btauri\s+build\b/u.test(command)) return true;
|
|
970
|
+
for (const match of command.matchAll(/\b(?:npm|pnpm)\s+(?:run\s+)?([\w:-]+)/gu)) {
|
|
971
|
+
if (inspectedScripts.has(match[1])) continue;
|
|
972
|
+
inspectedScripts.add(match[1]);
|
|
973
|
+
const script = packageJson.scripts?.[match[1]];
|
|
974
|
+
if (script && invokesAppBuild(script)) return true;
|
|
975
|
+
}
|
|
976
|
+
return false;
|
|
977
|
+
};
|
|
978
|
+
if (invokesAppBuild(source)) return false;
|
|
979
|
+
let workflow;
|
|
980
|
+
try { workflow = parseYaml(source); } catch { return false; }
|
|
981
|
+
const releaseSteps = Object.values(workflow?.jobs ?? {}).flatMap(job => job?.steps ?? [])
|
|
982
|
+
.filter(step => /(?:softprops\/action-gh-release|ncipollo\/release-action|actions\/create-release)/iu.test(String(step?.uses ?? '')));
|
|
983
|
+
if (releaseSteps.length === 0) return false;
|
|
984
|
+
return releaseSteps.every(step => {
|
|
985
|
+
if (!/^softprops\/action-gh-release@/u.test(String(step.uses)) || step.with?.make_latest !== false) return false;
|
|
986
|
+
const tag = String(step.with?.tag_name ?? '');
|
|
987
|
+
const prefix = /^([a-zA-Z0-9][a-zA-Z0-9._-]*)-v(?=\$\{\{|\d)/u.exec(tag)?.[1];
|
|
988
|
+
if (!prefix || prefix === packageJson.name || prefix === packageJson.name?.replace(/^@[^/]+\//u, '')) return false;
|
|
989
|
+
const files = typeof step.with?.files === 'string' ? step.with.files.trim().split(/\r?\n/u) : [];
|
|
990
|
+
return files.length > 0 && files.every(file => (
|
|
991
|
+
(file.startsWith(`${prefix}-`) || file.startsWith(`${prefix}.`))
|
|
992
|
+
&& !/[\\/]/u.test(file) && !file.includes('..')
|
|
993
|
+
&& /\.(?:zip|tar\.gz|exe|dll|node|\*)$/u.test(file)
|
|
994
|
+
));
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
|
|
947
998
|
function assertManagedWorkflowCurrent(targetDir, sources) {
|
|
948
999
|
const workflowPath = path.join(targetDir, MANAGED_WORKFLOW_PATH);
|
|
949
1000
|
if (!hasProjectFile(targetDir, MANAGED_WORKFLOW_PATH, sources)) throw new Error(`Required App lifecycle file is missing: ${MANAGED_WORKFLOW_PATH}`);
|
|
@@ -955,11 +1006,11 @@ function assertManagedWorkflowCurrent(targetDir, sources) {
|
|
|
955
1006
|
const candidatePath = path.join(workflowDir, name);
|
|
956
1007
|
if (candidatePath === workflowPath || !/\.ya?ml$/iu.test(name)) continue;
|
|
957
1008
|
const source = readFileSync(candidatePath, 'utf8');
|
|
958
|
-
if (
|
|
1009
|
+
if (!isScopedComponentReleaseWorkflow(source, targetDir) && (
|
|
959
1010
|
/\bgh\s+release\s+(?:create|upload|edit|delete)\b/iu.test(source)
|
|
960
1011
|
|| /(?:softprops\/action-gh-release|ncipollo\/release-action|actions\/create-release)/iu.test(source)
|
|
961
1012
|
|| /candidate-uploads|\/api\/platform\/apps\/candidates/iu.test(source)
|
|
962
|
-
) {
|
|
1013
|
+
)) {
|
|
963
1014
|
throw new Error(`Parallel App production workflow is forbidden: .github/workflows/${name}`);
|
|
964
1015
|
}
|
|
965
1016
|
}
|
|
@@ -1280,13 +1331,30 @@ function validateProjectPlan(targetDir, versions, planned, managed) {
|
|
|
1280
1331
|
}
|
|
1281
1332
|
|
|
1282
1333
|
export function validateAppInitialization(targetDir, versions) {
|
|
1283
|
-
const
|
|
1334
|
+
const effective = managedProjectVersions(targetDir, versions);
|
|
1335
|
+
const current = assertProjectLifecycleCurrent(targetDir, effective, { managed: true });
|
|
1284
1336
|
for (const target of Object.keys(current.buildProfile.targets)) selectBuildOwner(current.buildProfile, target);
|
|
1285
1337
|
}
|
|
1286
1338
|
|
|
1339
|
+
function ownershipHandoverMessage(handover) {
|
|
1340
|
+
if (handover.file === 'missing') {
|
|
1341
|
+
return `${handover.path} now belongs to the App and is missing; add the App's own ${handover.path} before packaging.`;
|
|
1342
|
+
}
|
|
1343
|
+
const kept = `${handover.path} now belongs to the App; sync keeps it unchanged and will not rewrite it.`;
|
|
1344
|
+
return handover.earlierScaffoldContent
|
|
1345
|
+
? `${kept} It still holds the text the earlier scaffold wrote: replace it with the App's own license and copyright holder.`
|
|
1346
|
+
: kept;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
function emitOwnershipHandovers(handovers, options) {
|
|
1350
|
+
if (options.json) return;
|
|
1351
|
+
for (const handover of handovers) process.stdout.write(`[nimi-app] ${ownershipHandoverMessage(handover)}\n`);
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1287
1354
|
function executeProjectPlan(targetDir, options, versions, runners, plan, scaffold, toolVersions = versions) {
|
|
1288
1355
|
if (scaffold) validateManagedAppFiles(targetDir, scaffold.snapshot.lock, planSources(targetDir, plan.planned));
|
|
1289
1356
|
validateProjectPlan(targetDir, versions, plan.planned, Boolean(scaffold));
|
|
1357
|
+
const handovers = scaffold?.handovers ?? [];
|
|
1290
1358
|
const preview = {
|
|
1291
1359
|
ok: true, command: options.adopt ? 'init' : 'sync', dir: targetDir,
|
|
1292
1360
|
managed: Boolean(scaffold), appId: plan.descriptor.appId,
|
|
@@ -1294,8 +1362,12 @@ function executeProjectPlan(targetDir, options, versions, runners, plan, scaffol
|
|
|
1294
1362
|
changes: describeChanges(targetDir, plan.planned), ownerSteps: lifecycleOwnerSteps(versions),
|
|
1295
1363
|
nextSteps: lifecycleNextSteps(plan.buildProfileRef, plan.combination),
|
|
1296
1364
|
dependencyCombination: describeCombination(plan.combination, toolVersions),
|
|
1365
|
+
...(scaffold ? { ownershipHandover: handovers } : {}),
|
|
1297
1366
|
};
|
|
1298
|
-
if (options.dryRun)
|
|
1367
|
+
if (options.dryRun) {
|
|
1368
|
+
emitOwnershipHandovers(handovers, options);
|
|
1369
|
+
return emitResult(preview, options, `${preview.command} preview: ${preview.changes.map((file) => `${file.action} ${file.path}`).join(', ') || 'no app-tools changes'}`);
|
|
1370
|
+
}
|
|
1299
1371
|
const nimicoding = runNimicodingSync(targetDir, 'apply', runners);
|
|
1300
1372
|
const lockPath = path.join(targetDir, SCAFFOLD_LOCK_PATH);
|
|
1301
1373
|
const lockFile = plan.planned.find((file) => file.path === lockPath);
|
|
@@ -1309,6 +1381,7 @@ function executeProjectPlan(targetDir, options, versions, runners, plan, scaffol
|
|
|
1309
1381
|
synchronizedFiles.push(...applyProjectFiles(targetDir, [lockFile]));
|
|
1310
1382
|
}
|
|
1311
1383
|
validateAppProject(targetDir, { silent: true }, versions, runners);
|
|
1384
|
+
emitOwnershipHandovers(handovers, options);
|
|
1312
1385
|
return emitResult({ ...preview, synchronizedFiles, nimicodingSync: nimicoding?.summary || null }, options, `${preview.command} completed for ${targetDir}`);
|
|
1313
1386
|
}
|
|
1314
1387
|
|
|
@@ -97,13 +97,13 @@ export const APP_SCAFFOLD_MODULE_REGISTRY = Object.freeze({
|
|
|
97
97
|
requires: ['ai-studio-core'],
|
|
98
98
|
sourceMappings: [frozenSourceMapping('src/studio-modules/studio-media', 'src/capabilities/studio-media')],
|
|
99
99
|
appAccessItems: ['runtime.consume'],
|
|
100
|
-
capabilityContractRefs: ['image.generate', 'video.generate', 'music.generate'],
|
|
100
|
+
capabilityContractRefs: ['image.generate', 'video.generate', 'music.generate', 'music.transcribe', 'audio.voice.convert', 'audio.separate'],
|
|
101
101
|
requiredStandardizedFeatureRefs: [],
|
|
102
102
|
npmDependencies: {},
|
|
103
103
|
cargoDependencies: {},
|
|
104
104
|
hostAdapterContract: 'ai-studio-host-v1',
|
|
105
|
-
views: ['image.generate', 'video.generate', 'music.generate'],
|
|
106
|
-
navigation: ['image.generate', 'video.generate', 'music.generate'],
|
|
105
|
+
views: ['image.generate', 'video.generate', 'music.generate', 'music.transcribe', 'audio.voice.convert', 'audio.separate'],
|
|
106
|
+
navigation: ['image.generate', 'video.generate', 'music.generate', 'music.transcribe', 'audio.voice.convert', 'audio.separate'],
|
|
107
107
|
styles: [],
|
|
108
108
|
assets: [],
|
|
109
109
|
productEntry: Object.freeze({
|