@nimiplatform/app-tools 0.12.2 → 0.13.0

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 CHANGED
@@ -1,454 +1,161 @@
1
- # `@nimiplatform/app-tools`
1
+ # @nimiplatform/app-tools
2
2
 
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.
3
+ The official full-stack developer CLI and toolchain for building, testing, and packaging Nimi desktop applications.
4
4
 
5
- The prepared App Tools 0.12.0 default is SDK 0.21.0 and Kit/native 0.19.0 for
6
- the complete Nimi Beta production Runtime, with Nimi Coding 0.6.5 and Electron 44.
7
- Existing Apps explicitly select that combination before syncing. The previously
8
- published SDK 0.21.0 / Kit 0.18.1 D2 combination remains admitted for existing
9
- source-development projects; updating the tool alone preserves their dependencies.
10
- Candidate manifest versions do not establish registry publication.
5
+ `@nimiplatform/app-tools` manages the entire application lifecycle—from project scaffolding and dependency synchronization to Desktop-supervised development, test orchestration, and deterministic `.nimiapp` distribution packaging.
11
6
 
12
- 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.
7
+ ---
13
8
 
14
- For your first public release, start with [Publishing on GitHub](#publishing-on-github), including the read-only repository-settings credential.
9
+ ## 1. The Application Lifecycle
15
10
 
16
- Simulator integration is retired. Remove `nimi-app check --conformance simulator`
17
- and imports of `@nimiplatform/app-tools/simulator-conformance` or
18
- `@nimiplatform/app-tools/simulator-css-profile` from active projects. Use the
19
- normal App lifecycle checks and Desktop-supervised development for current
20
- Apps; the archived preview implementation is no longer a release prerequisite.
21
-
22
- ## AI development and existing projects
23
-
24
- The package includes one `skills/nimi-app-lifecycle/SKILL.md` with on-demand
25
- guides for adaptation audits, creating, adapting, platform gaps and upgrades, upstream sync, releases and
26
- acceptance. Read it inside the installed package before initializing an existing
27
- repository. `nimi-app --help` prints its resolved location. Installation does
28
- not activate instructions; explicit init/sync maintains the project skill under
29
- `.agents/skills/nimi-app-lifecycle/` and an independent AGENTS.md block.
30
-
31
- 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.
32
-
33
- Install the selected app-tools and the exact nimi-coding version declared in
34
- its `nimiScaffoldVersions`. For first integration, generate a minimal reference
35
- App under `.nimi/local/` with its own identity and the needed admitted features,
36
- using this same SDK/Kit/native package combination. Run its generated foundation
37
- and reuse or align its Host, preload, renderer bridge, session, App Access,
38
- AIConfig and AI call wiring in the existing App. SDK/Kit documentation explains
39
- the contracts; it does not replace working generated code.
40
-
41
- When the task includes installation, establish the reference's local installed
42
- Access baseline as described in the packaged acceptance guide. Compare under
43
- the same conditions to separate toolchain failures from App wiring differences.
44
- Reuse passing results for ordinary business changes; no extra evidence ledger
45
- or repeated full reference run is needed.
46
-
47
- Preserve the original product's workflows and business settings while preparing
48
- its actual renderer and build/test scripts. A reference workbench or passing
49
- sample is not the complete App. Init does not convert a server framework,
50
- invent tests or replace product UI. Preview adoption after this preparation:
51
-
52
- ```bash
53
- pnpm exec nimi-app init --adopt --dry-run --json
54
- pnpm exec nimi-app init --adopt
55
- pnpm install
56
- pnpm exec nimi-app check
57
- ```
58
-
59
- Existing nimi.app.yaml and `.nimi/config/build-profile.yaml` supply the inputs.
60
- If either is missing, pass `--input .nimi/local/adopt-input.json`. This temporary
61
- JSON accepts only `manifest` and `build_profile`, using those same schemas.
62
- For an App whose named scripts are already implemented, an input is:
63
-
64
- ```json
65
- {
66
- "manifest": {
67
- "app_id": "example.editor", "display_name": "Example Editor", "version": "0.1.0",
68
- "profile": "standalone", "manifest_role": "submitted-input",
69
- "app_access": ["runtime.consume"], "capability_contract_refs": ["text.generate"],
70
- "required_standardized_feature_refs": [], "storage_policy": { "kind": "nimi-mediated-default" },
71
- "local_development": { "electron": { "renderer_origin": "http://127.0.0.1:1466" } }
72
- },
73
- "build_profile": {
74
- "build_profile_ref": "electron-packager-pnpm-vite", "profile_role": "developer-workflow-input",
75
- "test_command": "pnpm run test:app", "build_command": "pnpm run build:electron:production",
76
- "targets": {
77
- "windows-x86_64": {
78
- "os": "windows", "arch": "x86_64",
79
- "payload_path": "dist-electron-package/example-editor-shell-win32-x64",
80
- "runtime_entry": "payload/example-editor-shell.exe"
81
- }
82
- }
83
- }
84
- }
85
- ```
86
-
87
- Use actual identity, version, declarations and target outputs. Complete portable
88
- App information before packaging. Supplied input must agree with an existing
89
- file. Unknown managed-file collisions and broken markers fail before writes;
90
- existing Host, business code, README and license remain App-owned. Adoption
91
- creates no fresh scaffold intent/lock. Init validates output declarations;
92
- build/pack later verify actual payloads.
93
-
94
- An existing Next.js or other renderer can use `build_profile_ref: electron-pnpm`
95
- with its real test/build commands and target outputs. Declare `dev:renderer` in
96
- `package.json`, for example `next dev --hostname 127.0.0.1 --port 1466`, matching
97
- the manifest's loopback origin. Init/sync preserve the command for this profile. The App
98
- owns the renderer and any required local backend; `build:electron` produces the
99
- supervised Host at `dist-electron/main.js`. Fresh scaffolds keep their generated
100
- Vite recipe and existing `electron-packager-pnpm-vite` profiles remain supported.
101
- When Host sources are outside `src-electron`, declare their existing relative
102
- directory as `local_development.electron.host_source_directory` in `nimi.app.yaml`
103
- (for example `electron`). Desktop validates that directory before launch and
104
- watches it for Host rebuilds; init/sync preserve this App-owned declaration.
105
- Real development requires a Desktop version that accepts App-owned renderer
106
- commands; older Desktop versions enforcing Vite reject this project even after
107
- app-tools validation passes. Do not introduce a Vite placeholder to bypass it.
108
-
109
- Use the selected package's `nimiScaffoldVersions` declarations in `package.json`
110
- and commit the matching lockfile to pin resolved versions. Fresh `create` uses
111
- the tool default SDK/Kit combination. An existing App keeps its current SDK/Kit
112
- combination when it is one of the supported combinations app-tools declares:
113
- `sync` preserves it, `check` verifies the same combination in the manifest,
114
- lockfile and Cargo inputs, and only the app-tools and nimi-coding tool
115
- dependencies follow the selected tool version. An unlisted SDK x Kit pairing is
116
- rejected rather than normalized. A matrix range in the manifest does not
117
- require an automatic upgrade; install with the frozen lockfile until
118
- deliberately selecting and synchronizing a new component combination.
119
-
120
- The production Beta candidate guide uses App Tools 0.12.0 with SDK `^0.21.0`,
121
- Kit/native `^0.19.0`, the matching production Runtime, and Tauri `0.10.0` when
122
- selected. Existing D2 projects retain their declared `^0.18.1` Kit combination. Fresh scaffold
123
- defaults still come from `nimiScaffoldVersions` in `package.json`; explicitly
124
- select the current SDK/Kit pair to use this guide. On an initialized App, run
125
- `nimi-app sync`, install the resulting dependencies, then run `nimi-app check`
126
- and the App build. A fresh project installs dependencies and runs `init` first.
127
- Sync preserves admitted explicit pairs and never supplies an older Host fallback.
128
-
129
- ### Music reference flow
130
-
131
- The admitted `studio-media` feature includes the music workflow maintained in
132
- Nimi Lab. Its source is read from Lab during development and materialized into
133
- the existing packaged App source during build; it is not a separate sample copy.
134
- It consumes the protected SDK/Kit interfaces, reads `musicInput` from the current
135
- AIConfig resource, imports ABC into App assets, and preserves every returned
136
- artifact and the reported generation ending. A missing input projection is not
137
- inferred from a model name.
138
-
139
- A music action saves its `clientSubmissionId` before submission. The recovery
140
- view looks up the original Job and observes or saves it without generating
141
- again. Runtime recovery has a 24-hour lifetime; adopted App assets and the
142
- saved result are used for later reopening. Generation budgets and generated
143
- plan scores must not be presented as proof of a complete song, accurate
144
- transcription, original melody or a requested singer.
145
-
146
- Use the current complete SDK/Kit/native/Runtime combination above for this
147
- source. Package declarations are not a publication claim. Real model and
148
- Desktop-supervised acceptance apply to the exact tested combination, separately
149
- from generator checks and subjective listening.
150
-
151
- ### Local development packages
152
-
153
- Development does not require publishing every SDK/Kit or app-tools change.
154
- Keep the selected version matrix in `package.json`, and use explicit npm tarball
155
- overrides in the App's own `pnpm-workspace.yaml`:
156
-
157
- ```yaml
158
- packages:
159
- - .
160
- overrides:
161
- '@nimiplatform/app-tools': file:D:/nimi-packages/nimiplatform-app-tools-0.12.0.tgz
162
- '@nimiplatform/sdk': file:D:/nimi-packages/nimiplatform-sdk-0.21.0.tgz
163
- '@nimiplatform/kit': file:D:/nimi-packages/nimiplatform-kit-0.19.0.tgz
164
- ```
165
-
166
- These are example artifact locations; use the complete packages you were given.
167
- Override Kit's matching native optional package too when that component changes;
168
- keep the native carrier Kit-owned rather than adding it as an App dependency.
169
- Local archives may also use paths relative to the App. Install, run sync and
170
- check, then use the normal dev/test/build/pack loop. Sync retains these choices;
171
- check verifies matrix compatibility and compares the selected tarball version,
172
- source and integrity with pnpm's installed dependency lock and package manifest.
173
- The default SDK `^0.21.0` / Kit `^0.18.1` / Rust carrier `0.10.0`
174
- combination also admits complete local archives for development. Select the
175
- matching Runtime and native packages. A local archive does not establish public
176
- registry availability; production preflight checks the registry resolutions.
177
- Workspace members declare their own SDK/Kit dependencies and share the root
178
- tarball overrides. pnpm writes each member's `specifier` relative to that member,
179
- while resolved versions and package records remain workspace-relative; check
180
- compares the resulting archive identities and installed importer bindings.
181
- Do not rewrite member lock entries to look identical to the root importer.
182
- Updating only the lockfile does not update installed packages: run `pnpm install`
183
- after selecting another local package combination. Directory links and
184
- source-workspace overrides stay invalid.
185
- The generated Electron packager rebases archive paths for its isolated dependency
186
- staging so a local build uses the same packages.
187
-
188
- `check --production` is the final public-release preflight and requires registry
189
- resolutions. It is not a prerequisite for development or local build/pack;
190
- the normal build still executes the actual declared production payload command.
191
-
192
- For local installed-App acceptance, keep these tarball overrides and run:
193
-
194
- ```bash
195
- pnpm exec nimi-app check
196
- pnpm exec nimi-app build --target windows-x86_64
197
- pnpm exec nimi-app pack --target windows-x86_64 --production
198
- ```
199
-
200
- Use the actual target on its matching host. `pack --production` observes the
201
- payload's native signature and execution permissions; it does not run registry
202
- dependency preflight or publish anything. Plain `pack` writes a development
203
- archive that Runtime local import rejects. Import the resulting package through
204
- Desktop's Apps → Add App → Import local package, then verify its installed launch
205
- and business use. This exercises the `user_imported` source independently of
206
- Catalog admission and download.
207
-
208
- When preparing a public release after development acceptance, remove local
209
- overrides, install the published matched versions and complete release preflight.
210
- Local import creates no GitHub Release or Registry approval and does not verify
211
- Catalog download or installation on a machine without the development environment.
212
-
213
- `init --dry-run --json` and `sync --dry-run --json` show app-tools file/field
214
- changes without writes, installation or owner mutation. The separate
215
- nimi-coding step and expected version are listed without simulating its internals.
216
- For an upgrade, install the target app-tools and exact nimi-coding before apply.
217
- Sync recomputes fresh scaffold derived projections while retaining immutable
218
- identity/direct features and App-owned code; then install the normalized
219
- dependencies, refresh package-manager locks, check and verify the affected task.
220
- The checkout directory is reported in command output, not persisted as App
221
- identity; syncing an upgraded project after relocating it does not dirty its
222
- intent/lock merely because the absolute path changed.
223
- An installed nimi-coding version that differs from the selected tool matrix is
224
- rejected before its projection command runs.
225
-
226
- ## Command family
227
-
228
- The public CLI has exactly eight commands:
11
+ The CLI exposes an eight-command toolkit designed for rapid local iteration and secure production releases:
229
12
 
230
13
  ```text
231
- create -> dependency install -> init -> sync -> check
232
- -> dev / test / build -> pack
14
+ create ➔ install ➔ init ➔ sync ➔ check ➔ dev / test / build ➔ pack
233
15
  ```
234
16
 
235
- - `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.
236
- - `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.
237
- - `sync` refreshes only scaffold-managed dependencies, configuration, workflow and glue. App-owned product code and the project `LICENSE` are preserved.
238
- - `check` is non-mutating and incorporates the former scaffold validation behavior.
239
- - `dev` requests the official Desktop-supervised Electron development Host.
240
- - `test` and `build` execute the real owner commands declared in `.nimi/config/build-profile.yaml`; there is no fallback success.
241
- - `pack` is the sole local/CI `.nimiapp` packaging owner and never uploads.
242
-
243
- `doctor`, `update`, and local `publish` are absent without aliases. Use `check`
244
- and `sync`; production publication runs only from a protected version tag whose
245
- commit is already contained in the publisher repository's canonical default
246
- branch, through the managed GitHub workflow.
17
+ | Command | Role |
18
+ | :--- | :--- |
19
+ | **`create`** | Scaffolds a standalone project with reverse-domain App ID, manifest declarations, and build workflows. |
20
+ | **`init`** | Materializes managed files and lifecycle guidance after installation; fresh scaffolds also receive a scaffold lock. |
21
+ | **`sync`** | Refreshes managed build configs, CI workflows, and glue code without touching your business logic. |
22
+ | **`check`** | Validates scaffold, package constraints, and declared inputs. Run App-owned typechecks separately. |
23
+ | **`dev`** | Launches your app in the official Desktop-supervised Electron shell with a protected session bridge. |
24
+ | **`test`** | Executes the test suite declared in your `.nimi/config/build-profile.yaml`. |
25
+ | **`build`** | Compiles production binaries and assets for target platforms (macOS / Windows). |
26
+ | **`pack`** | Deterministically packages verified binaries and metadata into an immutable `.nimiapp` bundle. |
247
27
 
248
- Run the checked-in CLI help for the admitted feature catalog and exact options:
249
-
250
- ```bash
251
- node app-tools/bin/nimi-app.mjs --help
252
- ```
28
+ ---
253
29
 
254
- ## Create
30
+ ## 2. Quickstart: Creating a New App
255
31
 
256
- Interactive use validates every field, shows the resolved plan and asks for confirmation. The optional `author` names one person or team; include `--author` when creating a Windows release project because the standard packager uses it for executable metadata. Non-interactive use supplies the same inputs directly:
32
+ Run the interactive creator or pass parameters directly:
257
33
 
258
34
  ```bash
259
- node app-tools/bin/nimi-app.mjs create \
260
- --dir path/to/app \
35
+ # Using published App Tools (recommended)
36
+ pnpm dlx --package @nimiplatform/app-tools nimi-app create \
37
+ --dir my-editor-app \
261
38
  --profile standalone \
262
- --app-id example.app \
39
+ --features studio-create \
40
+ --app-id com.example.editor \
263
41
  --version 0.1.0 \
264
- --title "Example App" \
265
- --package-name example-app \
266
- --author "Example Team"
267
- ```
268
-
269
- 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.
270
-
271
- 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.
42
+ --title "Example Editor" \
43
+ --package-name example-editor \
44
+ --author "Your Team"
272
45
 
273
- ## Development and build
274
-
275
- After creation:
276
-
277
- ```bash
278
- cd path/to/app
46
+ cd my-editor-app
279
47
  pnpm install
280
48
  pnpm run init
281
49
  pnpm run sync
282
50
  pnpm run check
283
- pnpm run test
284
- pnpm run app:build -- --target windows-x86_64
285
51
  pnpm dev
286
52
  ```
287
53
 
288
- `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.
54
+ Set `--author` to the person or team responsible for the App and its license.
289
55
 
290
- 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.
56
+ ### Feature Profiles
57
+ - `--features studio-create`: Injects creative text and multimodal generation capabilities along with `runtime.consume` permissions.
58
+ - `--features studio-media`: Includes music, audio separation, and speech transcription capabilities.
291
59
 
292
- Every `build`, including non-production builds, requires the selected target's
293
- declared payload and exact Runtime entry to exist after its owner command exits
294
- successfully. Building a macOS payload cannot report success for a missing
295
- Windows target. The default recipes build for their host platform; use the
296
- matching build host or provide a real App-owned build command. This file check
297
- does not prove executable architecture or signing: production App information
298
- is checked with `--production`, and native package facts are verified by
299
- `pack --production`.
60
+ <a id="local-development-packages"></a>
300
61
 
301
- To continue an existing development App and its data, select a registration explicitly:
62
+ ### Dependencies & Existing Projects
302
63
 
303
- ```bash
304
- pnpm dev -- --list-registrations
305
- pnpm dev -- --resume <selector>
306
- ```
64
+ Standalone third-party Apps must declare public npm and Cargo dependency versions. Use published packages, or override them for local development with the complete archives described below—never point dependencies at a Nimi source checkout.
307
65
 
308
- The list shows the current project's registrations and creation times. Copy the desired selector from that list; Desktop resolves it to the exact existing Runtime-owned registration. Selectors last for the current Desktop session, so list again after restarting Desktop. No selector is stored in the App repository, and no App ID or path automatically reopens a subject. Plain `pnpm dev` keeps its fresh-registration behavior when no matching run is active. These options require a Desktop build that supports explicit launcher selection.
66
+ - **SDK and Kit Version Alignment**: Keep the SDK/Kit version combination declared by your selected App Tools release and its lockfile (`sync` preserves supported existing combinations and rejects unlisted ones). App Tools `0.13.0` defaults to SDK `0.21.0` and Kit/native `0.21.0`. When working from source, verify that the required versions are available on npm before installing them.
67
+ - **Testing Local Tarballs**: During local development, you can select complete `.tgz` archives via `pnpm-workspace.yaml` overrides, including Kit's matching optional native package. Re-run `pnpm install` whenever you change an archive. For local acceptance, run ordinary `check` and `build`, followed by `pack --production` to inspect the actual payload (`check --production` requires dependencies resolved from the public registry).
68
+ - **Adopting or Upgrading Projects**: Follow the [adoption guide](skills/nimi-app-lifecycle/SKILL.md) and [platform upgrade reference](skills/nimi-app-lifecycle/references/upgrade-platform.md). Preview managed changes before applying them with `init --adopt --dry-run --json` or `sync --dry-run --json`. Adoption preserves your App-owned product and Host code rather than converting an application framework; migrating from an older scaffold contract requires following the documented migration steps, not just bumping dependency versions.
309
69
 
310
- 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.
70
+ ---
311
71
 
312
- App Tools prepares the `macos-aarch64` target on an Apple Silicon Mac.
313
- The same owner command produces `dist-electron-package/<app>-shell-darwin-arm64/`
314
- with a native `.app` bundle and a direct `Contents/MacOS` entry. The publisher's
315
- build applies an ad-hoc integrity seal without a Developer ID identity or Apple
316
- notarization; production pack observes that absence and rejects invalid seals.
317
- Relative framework links are preserved inside the immutable payload. The App
318
- continues to consume the macOS native binding through Kit's optional dependency.
319
- Nimi installation never signs or repairs the publisher's code.
72
+ ## 3. Desktop-Supervised Development
320
73
 
321
- Existing `.nimi/config/build-profile.yaml` target choices are App-owned and are
322
- preserved by sync. To add macOS, declare `macos-aarch64` with `os: macos`,
323
- `arch: arm64`, the same production build command, the Darwin output directory
324
- above as `payload_path`, and
325
- `payload/<app>-shell.app/Contents/MacOS/<app>-shell` as `runtime_entry`.
326
- The managed workflow resolves that declared target to `macos-15`; Windows keeps
327
- its existing runner and profile. These authoring/build capabilities do not by
328
- themselves establish Registry admission or a completed Desktop lifecycle.
74
+ Nimi Apps run inside a Desktop-supervised Electron shell. The host provides a protected session for SDK calls without exposing Nimi credentials to the App renderer (note that this session bridge does not create an OS-level sandbox for the entire application).
329
75
 
330
- Tauri remains an explicit alternative through `pnpm run build:tauri:production`; selecting it requires an explicit Tauri build profile rather than changing the default Electron carrier.
76
+ ### Continuing an Existing Session
77
+ To keep your app data and registrations intact across restarts:
331
78
 
332
- ## Canonical release boundary
79
+ ```bash
80
+ # List active registrations
81
+ pnpm dev -- --list-registrations
333
82
 
334
- The Registry publication chain uses the stages below. Publisher GitHub Release
335
- is available for configured pilot repositories. Protected Registry admission and
336
- installed App lifecycle use their separate Platform, Runtime and Desktop owners;
337
- each App's declared target still needs its own acceptance.
83
+ # Resume a specific registration
84
+ pnpm dev -- --resume <selector>
85
+ ```
338
86
 
339
- ```text
340
- public App repository
341
- -> reviewed canonical default-branch commit
342
- -> immutable protected version tag
343
- -> tag-triggered publisher GitHub Actions
344
- -> immutable GitHub Release assets
345
- -> publisher-owned registry pull request
346
- -> human-reviewed static registry main
347
- -> Runtime download/install
348
- -> Desktop exact Host launch
87
+ ---
88
+
89
+ ## 4. Production Packaging & Distribution
90
+
91
+ ### Building for Targets
92
+ ```bash
93
+ # macOS (Apple Silicon)
94
+ pnpm exec nimi-app build --target macos-aarch64 --production
95
+ pnpm exec nimi-app pack --target macos-aarch64 --production
96
+
97
+ # Windows (x86_64)
98
+ pnpm exec nimi-app build --target windows-x86_64 --production
99
+ pnpm exec nimi-app pack --target windows-x86_64 --production
349
100
  ```
350
101
 
351
- External publishers submit from their own fork. An authorized publisher sharing
352
- the Registry namespace can use a same-repository branch. Both paths use one
353
- publisher-owned branch and pull request for the exact App version and Release;
354
- human maintainers own admission.
102
+ `pack --production` verifies native signatures and unpacked native `.node` addons, producing a `.nimiapp` bundle alongside an `<app_id>-<version>-<target>.app-info.json` metadata sidecar.
355
103
 
356
- The registry references publisher Release assets and never mirrors bytes. GitHub Release is not catalog admission; catalog admission is not installed; installed is not running; running is not Nimi Access ready.
104
+ ### Local Import Testing
105
+ Before publishing publicly, verify the `.nimiapp` package on your own machine:
106
+ 1. Open Nimi Home.
107
+ 2. Go to **Apps → Add App → Import local package**.
108
+ 3. Select your `.nimiapp` file and verify installation, launch, and AI workflows.
357
109
 
358
- Repository administration must enable a protected `v*` tag ruleset and GitHub immutable releases before production. The managed tag workflow fetches the repository's canonical default branch and rejects a tag commit outside that history before production preflight, build, attestation, or Release. A fine-grained `NIMI_REPOSITORY_ADMIN_TOKEN` secret with repository Administration read permission lets the workflow verify protected-tag and immutable-release settings; it cannot enable or change them. Manual workflow dispatch runs only the non-production build/package path. On Windows, the tag-only production build invokes the App-declared production build with no certificate-secret mapping or app-tools-owned signing step. Optional native signing remains publisher-owned and must already be reflected in the final exact Runtime entry before production pack observes and records its native-trust posture; a present invalid or unresolved signature still fails closed. A successful tag workflow creates the immutable publisher GitHub Release and no registry, installed, running, or Nimi Access truth. Protected Registry submission and approved Windows x86_64 and macOS arm64 installation, update, launch/focus/stop, current-session Nimi Access and uninstall are available through their Platform, Runtime and Desktop owners. Other-platform installed lifecycle and ordinary repair remain unavailable. Explicit immutable local-package import has source-qualified Desktop and Runtime implementations on Windows x86_64 and macOS arm64; combined product acceptance and public release readiness remain unverified.
110
+ Exercise the actual install, launch, and key user flows on each supported target. Passing tests or packaging alone is not enough—mark any path you have not run as `NOT-VERIFIED`.
359
111
 
360
- Registry projects must be open source with an explicit license and reviewable release source. Consistently observed unsigned packages are eligible; invalid signatures cannot be downgraded to unsigned. These Registry admission requirements do not apply to user-imported packages or Developer Mode projects. Registry approval is not a guarantee that third-party code is harmless.
112
+ Simulator integration is retired. Use Desktop-supervised Electron for App development and acceptance.
113
+
114
+ ---
361
115
 
362
116
  ## Publishing on GitHub
363
117
 
364
- Before the first release, configure `NIMI_REPOSITORY_ADMIN_TOKEN` as an Actions
365
- secret in the App repository. It needs only **Administration: Read-only**, to
366
- check tag protection and Release immutability. Local App development does not
367
- need this credential.
118
+ ### Canonical release boundary
119
+ Public publishing is currently available for configured pilot repositories. Keep in mind how lifecycle stages are separated:
120
+ - **Independent milestones**: Creating a publisher GitHub Release, passing Registry human admission, installing the package, launching the process, and obtaining ready Nimi Access are separate outcomes. App Tools never approves or installs an App as a side effect of packaging or releasing.
121
+ - **Platform support**: Local-import implementations are available on `macos-aarch64` (macOS arm64) and `windows-x86_64`; combined end-to-end product acceptance and public release readiness require their own verification. Package lifecycles for other platforms and ordinary repair flows are not yet available.
368
122
 
369
- The built-in `GITHUB_TOKEN` has no Administration permission for the
370
- [repository immutability-settings API](https://docs.github.com/en/rest/repos/repos#check-if-immutable-releases-are-enabled-for-a-repository).
371
- That is why the current release preflight needs a separate credential. Actual
372
- Release uploads use GitHub's built-in token, and build attestations use OIDC.
373
- This secret is neither a Nimi login token nor Registry approval, and needs no
374
- repository write permission.
123
+ ### Step 1: Configure the Publisher Repository
124
+ Use a public GitHub repository owned by the publisher (administrator access is required):
125
+ - In **Settings → General → Releases**, enable **Release immutability**.
126
+ - In **Settings → Rules → Rulesets**, create a **tag** ruleset with enforcement set to **Active** for tags matching `v*`. Enable **Restrict updates** and **Restrict deletions**, while leaving tag creation available to the publisher.
375
127
 
376
- Repository secrets are scoped to their repository: configuring another App,
377
- even under the same organization, does not configure this one. If you do not
378
- administer the repository, ask its maintainer to complete the setup below.
128
+ These settings protect published versions. The release workflow only verifies them—it does not modify repository settings.
379
129
 
380
- `nimi-app check --production` checks local inputs; it does not inspect remote
381
- settings or secrets. Complete the following setup before pushing a release tag.
130
+ ### Step 2: Create a Read-Only Settings Token
131
+ Open [GitHub's fine-grained token page](https://github.com/settings/personal-access-tokens/new) to create a token that lets the release workflow verify your tag protection and release immutability settings:
132
+ 1. Name the token clearly and choose an expiration date.
133
+ 2. Set **Resource owner** to the user or organization that owns the App repository.
134
+ 3. Under **Repository access**, choose **Only select repositories** and select this App repository.
135
+ 4. Under **Repository permissions**, set **Administration** to **Read-only** (GitHub automatically includes read-only **Metadata**). Do not grant write access to Contents, Actions, or Secrets, and do not enable organization-wide access.
136
+ 5. Generate the token. If your organization requires token approval, complete that approval before publishing.
382
137
 
383
- ### 1. Configure the publisher repository
138
+ The workflow uses GitHub's separate built-in token to publish release artifacts and GitHub OIDC permissions to generate build attestations.
384
139
 
385
- Use a public repository owned by the publisher. You need administrator access
386
- for this setup.
140
+ ### Step 3: Save the Token as an Actions Secret
141
+ In your App repository, open **Settings → Secrets and variables → Actions → New repository secret**:
142
+ - **Name**: `NIMI_REPOSITORY_ADMIN_TOKEN`
143
+ - **Secret**: Paste the fine-grained token value from Step 2.
387
144
 
388
- - In **Settings → General → Releases**, enable **Release immutability**.
389
- - In **Settings → Rules → Rulesets**, create a **tag** ruleset, set enforcement
390
- to **Active**, and include tags matching `v*`. Enable **Restrict updates**
391
- and **Restrict deletions**. Tag creation must remain available to the publisher.
145
+ Save it as a **secret** (not an Actions variable) and confirm the exact name appears in your Actions secrets. An organization secret is also supported when its repository-access list includes this App. Never place the token value in source files, `.env`, or release notes.
392
146
 
393
- These settings protect published versions. The workflow only checks them; it
394
- does not change repository settings.
147
+ ### Step 4: Prepare, Verify, and Tag a Release
395
148
 
396
- ### 2. Create the read-only settings token
149
+ #### License Ownership & Byte Stability
150
+ - **App-owned `LICENSE`**: The root `LICENSE` file belongs to your App. `create` initializes it once as an MIT license naming `--author` (or the App title if omitted); replace it with your App's actual license terms and set the matching `package.json.license` identifier. `sync` never rewrites `LICENSE`, and `check` does not lock it. The scaffold template's own MIT notice stays in the managed `licenses/nimi-app-template.txt` file.
151
+ - **Handover from older scaffolds**: Projects created by an earlier `app-tools` version that managed `LICENSE` retain their existing file byte-for-byte—running `sync` records the App as the owner, reports the handover, and adds `licenses/nimi-app-template.txt` (`check` will prompt you to run `sync` first).
152
+ - **Preventing line-ending mutation**: The packaged `LICENSE` must remain byte-for-byte identical to the reviewed Git source. Fresh scaffolds include `LICENSE -text` in `.gitattributes`. For existing repositories, add `LICENSE -text` to `.gitattributes` (preserving your other rules) and commit it before tagging so Windows checkout conversion cannot alter the bytes verified by the Registry against the source tag.
397
153
 
398
- Open [GitHub's fine-grained token page](https://github.com/settings/personal-access-tokens/new).
154
+ #### Native Addon Unpacking
155
+ Electron packages must keep native add-ons and their companion libraries outside the ASAR archive with their relative directory layout intact. The scaffold configures `asar: { unpack: '**/*.{node,dylib,dll}' }` on macOS and Windows. Apply the equivalent rule to any custom App-owned packager configuration and verify native module loading from the packaged layout—unpacking only `.node` files can leave companion libraries such as Sharp's `libvips` unavailable to the OS dynamic loader.
399
156
 
400
- 1. Name the token so you can recognize its purpose, and choose an expiration date.
401
- 2. Set **Resource owner** to the user or organization that owns the App repository.
402
- 3. Under **Repository access**, choose **Only select repositories** and select
403
- this App repository.
404
- 4. Under **Repository permissions**, set **Administration** to **Read-only**.
405
- GitHub includes read-only Metadata automatically. No Contents write,
406
- Actions write, Secrets write, or organization-wide access is needed.
407
- 5. Generate the token. If the organization requires approval, complete that
408
- approval before publishing.
409
-
410
- This token reads tag-protection and release-immutability settings. The workflow
411
- uses GitHub's separate built-in token to publish artifacts and its OIDC
412
- permission to create build attestations.
413
-
414
- ### 3. Save it as an Actions secret
415
-
416
- In the App repository, open **Settings → Secrets and variables → Actions →
417
- New repository secret**.
418
-
419
- - **Name:** `NIMI_REPOSITORY_ADMIN_TOKEN`
420
- - **Secret:** the fine-grained token value from step 2
421
-
422
- Save it and confirm the exact name appears in the repository's Actions secrets.
423
- Use a **secret**, not an Actions variable. An organization secret is also
424
- supported when its repository-access list includes this App. Keep the value
425
- out of source files, `.env`, and release notes.
426
-
427
- ### 4. Check, build, and publish a version
428
-
429
- The project `LICENSE` belongs to the App. `create` writes it once as an MIT
430
- license naming `--author`, or the App title when no author is given; replace it
431
- with the App's own terms and set the matching `package.json.license`
432
- identifier. `sync` never rewrites it and `check` does not lock it. The
433
- template's own MIT notice stays in the scaffold-managed
434
- `licenses/nimi-app-template.txt`. A project created by an app-tools version
435
- that still managed `LICENSE` keeps its file byte for byte: `sync` records the
436
- App as its owner, reports the handover, and adds the template notice, while
437
- `check` asks for that sync first.
438
-
439
- Keep the packaged `LICENSE` identical to the reviewed Git source. New scaffolds
440
- include `LICENSE -text` in `.gitattributes`. Add the same rule to an existing
441
- repository while preserving its other attributes, and commit it before tagging.
442
- This prevents Windows checkout conversion from changing the license bytes that
443
- Registry verifies against the exact source tag.
444
-
445
- Electron packages keep native add-ons and their companion libraries outside ASAR
446
- with their relative layout intact. The scaffold uses
447
- `asar: { unpack: '**/*.{node,dylib,dll}' }` on Mac/Windows. Apply the equivalent rule
448
- to existing App-owned packagers and verify native loading from the packaged layout;
449
- unpacking only `.node` can leave Sharp's libvips unavailable to the OS loader.
450
-
451
- Run the existing local path from the App repository:
157
+ #### Local Pre-Release Check & Tagging
158
+ Run the production verification path locally from the App repository:
452
159
 
453
160
  ```bash
454
161
  pnpm run sync
@@ -458,52 +165,27 @@ pnpm exec nimi-app build --target windows-x86_64 --production
458
165
  pnpm exec nimi-app pack --target windows-x86_64 --production
459
166
  ```
460
167
 
461
- Commit the release changes and get that exact commit onto the repository's
462
- canonical default branch. Keep `package.json` and `nimi.app.yaml` versions
463
- equal. Use that version for the annotated tag; `0.1.0` below is an example:
168
+ Ensure `package.json` and `nimi.app.yaml` declare the exact same version, commit all release changes, and land that exact commit on the repository's canonical default branch. Then create and push an annotated tag matching that version (`0.1.0` shown as an example):
464
169
 
465
170
  ```bash
466
171
  git tag -a v0.1.0 -m "Release 0.1.0"
467
172
  git push origin v0.1.0
468
173
  ```
469
174
 
470
- Open **Actions → nimi-app-release**. A successful run produces the immutable
471
- GitHub Release containing the `.nimiapp` package and aggregate candidate JSON.
472
- Manual workflow dispatch checks the development path and does not publish.
473
-
474
- If setup fails, the failed step points to the required setting. Add or replace
475
- the secret, fix its repository selection/permissions, or enable the named
476
- setting, then use **Re-run failed jobs** on the same run. A tag outside the
477
- default branch requires merging its exact commit first. A code change requires
478
- a new version and tag. Newly published release proofs can take a short time to
479
- appear; the workflow waits for this specific delay and still requires successful
480
- verification.
175
+ Open **Actions → nimi-app-release**. A successful run produces the immutable GitHub Release containing the `.nimiapp` bundle and aggregate candidate JSON (native code signing remains publisher-owned). Triggering the workflow manually checks the development path only and does not publish.
481
176
 
482
- GitHub Release publication is followed by the separate
483
- [Registry submission and human admission flow](https://github.com/nimiplatform/nimi-app-registry#ownership-boundary).
484
- App Tools does not create an approval or install the App as a side effect.
177
+ - **Troubleshooting**: If a setup check fails, the failed step points to the required setting. Add or replace the secret, fix its repository selection or permissions, or enable the named repository setting, then click **Re-run failed jobs** on the same workflow run. A tag pointing outside the default branch requires merging that exact commit into the default branch first. Any code change requires a new version and tag. Newly published release proofs can take a short time to appear; the workflow waits for this delay and still requires verification to succeed.
485
178
 
486
- ## Acceptance status
179
+ ### Step 5: Submit to the Nimi App Registry
180
+ Once the GitHub Release is published, submit a Pull Request to the [Nimi App Registry](https://github.com/nimiplatform/nimi-app-registry) following the [Registry submission and human admission flow](https://github.com/nimiplatform/nimi-app-registry#ownership-boundary).
487
181
 
488
- Help output and focused tests prove only the inspected implementation contract. Any dependency install, build, target pack, GitHub workflow, Release, registry review, Runtime install or Desktop launch not actually run remains `NOT-VERIFIED`. Product acceptance remains user-owned.
182
+ ---
489
183
 
490
- Published CLI usage is:
184
+ ## Portable App Information (Package v2)
491
185
 
492
- ```bash
493
- pnpm dlx --package @nimiplatform/app-tools nimi-app --help
494
- ```
186
+ Every `pack`—including development-mode packaging and non-release CI—requires valid App information, and production `check`/`build` validates these inputs before compilation starts. Incomplete projects remain editable with `dev` and ordinary non-production builds, but package-producing CI will fail until the required metadata and assets are in place.
495
187
 
496
- ## Portable App information (package v2)
497
-
498
- A distribution package includes `app-info.json`, containing its actual icon,
499
- summary, available usage guide and version notes, license, portable requirements
500
- and, when declared, the publisher safety declaration from `nimi.app.yaml`
501
- `safety_profile` (see the lifecycle skill's safety-declaration reference). An
502
- undeclared `safety_profile` stays absent and blocks nothing locally; new public
503
- Registry admission requires the complete declaration.
504
- Every `pack`, including development-mode packaging and non-release CI, requires
505
- valid App information. Complete `nimi.app.yaml` and its resources before packing;
506
- production check/build validates them before the build starts:
188
+ Configure your metadata, capability references, and storage policy in `nimi.app.yaml`:
507
189
 
508
190
  ```yaml
509
191
  metadata:
@@ -520,66 +202,29 @@ storage_policy:
520
202
  kind: nimi-mediated-default
521
203
  ```
522
204
 
523
- Use the canonical requirement references your App needs; an explicitly empty
524
- list is valid. Apps with their own OS storage must declare
525
- `kind: app-owned-os-storage` and `os_storage_disclosure` entries containing
526
- `path_pattern`, `purpose` and `expected_size_band`. These paths are disclosures,
527
- not instructions for Nimi to delete files. The author, homepage and support
528
- links are optional claims for local/private imports; Registry admission keeps
529
- its independent public-source, open-source license and support requirements.
530
-
531
- The icon must be a complete static PNG, square, 128–1024 pixels, no larger than
532
- 512 KiB, and not fully transparent. Supply your App's real artwork: the old
533
- 1×1 scaffold native icon is not distribution artwork. `metadata` paths are
534
- relative to the App repository. README and version notes are optional for local or
535
- private packages; omit their metadata paths when not provided. Registry admission
536
- requires both documents. Supplied README is limited to 96 KiB, version notes to
537
- 32 KiB, and the root LICENSE to 128 KiB. `package.json.license` supplies the
538
- explicit license identifier; it does not turn a private license into an
539
- open-source Registry license. Name and summary allow 120 and 280 characters.
540
- Scaffold `sync` preserves these author-edited metadata, requirement and storage
541
- fields while continuing to check the managed identity and carrier fields.
542
- The scaffold does not supply finished artwork. Add the declared icon, a summary
543
- and license information; provide any declared documents or omit optional document
544
- paths for local/private packages. Until then, package-producing CI will fail.
545
- Incomplete projects remain editable with `dev` and ordinary non-production builds.
546
-
547
- Pack writes `nimi.app-package/v2` and emits the exact embedded information bytes
548
- as `<app_id>-<version>-<target_id>.app-info.json` next to the `.nimiapp` and
549
- `.target.json`. Aggregate verifies both files and their equality with the
550
- embedded document. The managed Release workflow uploads this sidecar; a Registry
551
- candidate must reference its actual immutable Release asset identity, URL, size
552
- and digest. No App icon or document is copied into Registry storage.
553
-
554
- App Tools releases independently of SDK, Kit and Tauri shell. Its `nimiScaffoldVersions`
555
- declares the tested public SDK, Kit and Tauri shell versions used by new Apps and
556
- explicit `sync`; workspace development version bumps do not change those ranges.
557
- The release workflow requires those public versions before publishing App Tools.
558
-
559
- Existing Apps follow the [platform upgrade guide](skills/nimi-app-lifecycle/references/upgrade-platform.md).
560
- Select a published app-tools version and the exact nimi-coding version in that
561
- release's `nimiScaffoldVersions`. Install both in the App's `devDependencies`
562
- before invoking the target tool. Read the SDK/Kit migration notes and update the
563
- affected App-owned API uses, then preview and apply:
205
+ Scaffold `sync` preserves your author-edited `metadata`, requirement, and storage fields while continuing to validate managed identity and carrier fields.
564
206
 
565
- ```bash
566
- pnpm exec nimi-app sync --dry-run --json
567
- pnpm exec nimi-app sync
568
- pnpm install
569
- pnpm exec nimi-app check
570
- pnpm exec nimi-app test
571
- pnpm exec nimi-app build --target windows-x86_64
572
- ```
207
+ ### Field & Asset Requirements
208
+ All `metadata` file paths are relative to the App repository root:
209
+
210
+ | Item | Constraints & Admission Rules |
211
+ | :--- | :--- |
212
+ | **Name & Summary** | Up to **120 characters** for the App name and **280 characters** for `metadata.summary`. |
213
+ | **App Icon (`icon`)** | Required. Complete static PNG, square (`128–1024` pixels), max **512 KiB**, and not fully transparent. The scaffold does not supply finished artwork (the legacy `1×1` scaffold native icon is not valid distribution artwork). |
214
+ | **Root `LICENSE` & `package.json.license`** | Required (`LICENSE` max **128 KiB**). `package.json.license` provides the explicit license identifier; setting an identifier does not turn a private license into an open-source Registry license. |
215
+ | **Usage Guide (`readme`) & Version Notes (`release_notes`)** | Optional for local or private packages (omit their paths in `metadata` when not provided), but **both are required for Registry admission**. Size limits: `README` up to **96 KiB**, version notes up to **32 KiB**. |
216
+ | **Author, Homepage & Support URLs** | Optional claims for local/private imports. Public Registry admission enforces its own independent public-source, open-source license, and support requirements. |
217
+ | **Capability & Feature Refs** | Use the canonical requirement references your App needs; an explicitly empty list (`[]`) is valid. |
218
+ | **Storage Policy (`storage_policy`)** | Declare `kind: nimi-mediated-default` for Nimi-mediated storage. Apps managing their own OS storage must declare `kind: app-owned-os-storage` along with `os_storage_disclosure` entries specifying `path_pattern`, `purpose`, and `expected_size_band` (these are disclosures only, not instructions for Nimi to delete files). |
219
+ | **Safety Declaration (`safety_profile`)** | When declared in `nimi.app.yaml`, included in `app-info.json` (see the lifecycle skill's safety-declaration reference). An undeclared `safety_profile` stays absent and blocks nothing locally; the Registry's current admission policy determines whether public submissions require it (App Tools does not fetch Registry policy during local checks). |
220
+
221
+ ### Package v2 Output & Sidecar Verification
222
+ `pack` writes the `nimi.app-package/v2` format and emits the exact embedded `app-info.json` bytes as a sidecar file named `<app_id>-<version>-<target_id>.app-info.json` alongside the `.nimiapp` bundle and `.target.json`. Aggregate verification checks both files and confirms they match the embedded document byte-for-byte.
223
+
224
+ During release, the managed GitHub Actions workflow uploads this sidecar to the immutable GitHub Release. A Registry candidate must reference the actual immutable Release asset identity, URL, size, and digest—no App icon or documentation is copied into Registry storage.
225
+
226
+ ---
227
+
228
+ ## License
573
229
 
574
- Use the App's declared target for the final build. `sync` preserves App-owned
575
- product code; update any affected SDK/Kit API usage in that code before release.
576
-
577
- The v2 Runtime rejects v1 packages. Existing immutable publisher Releases and
578
- approved descriptors must not be edited to invent the missing asset. Prepare a
579
- new App version and real target builds, publish new immutable assets, and follow
580
- normal Registry review. The coordinated pre-release Registry data cutover must
581
- retire v1 entries/descriptors from the active dataset, retaining their history
582
- in Git; adding v2 releases alone cannot make old descriptors satisfy the new
583
- required-field schema. Do not deploy the v2 consumer before that reviewed
584
- cutover is ready. Installed information is source-qualified and stored offline
585
- by Runtime; metadata does not grant Registry verification or App Access.
230
+ Licensed under [Apache-2.0](../licenses/Apache-2.0.txt).