@nimiplatform/app-tools 0.12.3 → 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,456 +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.3 with SDK `^0.21.0`,
121
- Kit/native `^0.20.0`, the matching production Runtime, and Tauri `0.10.0` when
122
- selected. Existing production `^0.19.0` and D2 `^0.18.1` projects retain their
123
- declared Kit combination. Before explicitly upgrading to Kit 0.20, follow the
124
- [Realtime and conversation setup migration notes](../kit/CHANGELOG.md). Fresh scaffold
125
- defaults still come from `nimiScaffoldVersions` in `package.json`; explicitly
126
- select the current SDK/Kit pair to use this guide. On an initialized App, run
127
- `nimi-app sync`, install the resulting dependencies, then run `nimi-app check`
128
- and the App build. A fresh project installs dependencies and runs `init` first.
129
- Sync preserves admitted explicit pairs and never supplies an older Host fallback.
130
-
131
- ### Music reference flow
132
-
133
- The admitted `studio-media` feature includes the music workflow maintained in
134
- Nimi Lab. Its source is read from Lab during development and materialized into
135
- the existing packaged App source during build; it is not a separate sample copy.
136
- It consumes the protected SDK/Kit interfaces, reads `musicInput` from the current
137
- AIConfig resource, imports ABC into App assets, and preserves every returned
138
- artifact and the reported generation ending. A missing input projection is not
139
- inferred from a model name.
140
-
141
- A music action saves its `clientSubmissionId` before submission. The recovery
142
- view looks up the original Job and observes or saves it without generating
143
- again. Runtime recovery has a 24-hour lifetime; adopted App assets and the
144
- saved result are used for later reopening. Generation budgets and generated
145
- plan scores must not be presented as proof of a complete song, accurate
146
- transcription, original melody or a requested singer.
147
-
148
- Use the current complete SDK/Kit/native/Runtime combination above for this
149
- source. Package declarations are not a publication claim. Real model and
150
- Desktop-supervised acceptance apply to the exact tested combination, separately
151
- from generator checks and subjective listening.
152
-
153
- ### Local development packages
154
-
155
- Development does not require publishing every SDK/Kit or app-tools change.
156
- Keep the selected version matrix in `package.json`, and use explicit npm tarball
157
- overrides in the App's own `pnpm-workspace.yaml`:
158
-
159
- ```yaml
160
- packages:
161
- - .
162
- overrides:
163
- '@nimiplatform/app-tools': file:D:/nimi-packages/nimiplatform-app-tools-0.12.0.tgz
164
- '@nimiplatform/sdk': file:D:/nimi-packages/nimiplatform-sdk-0.21.0.tgz
165
- '@nimiplatform/kit': file:D:/nimi-packages/nimiplatform-kit-0.19.0.tgz
166
- ```
167
-
168
- These are example artifact locations; use the complete packages you were given.
169
- Override Kit's matching native optional package too when that component changes;
170
- keep the native carrier Kit-owned rather than adding it as an App dependency.
171
- Local archives may also use paths relative to the App. Install, run sync and
172
- check, then use the normal dev/test/build/pack loop. Sync retains these choices;
173
- check verifies matrix compatibility and compares the selected tarball version,
174
- source and integrity with pnpm's installed dependency lock and package manifest.
175
- The default SDK `^0.21.0` / Kit `^0.20.0` / Rust carrier `0.10.0`
176
- combination also admits complete local archives for development. Select the
177
- matching Runtime and native packages. A local archive does not establish public
178
- registry availability; production preflight checks the registry resolutions.
179
- Workspace members declare their own SDK/Kit dependencies and share the root
180
- tarball overrides. pnpm writes each member's `specifier` relative to that member,
181
- while resolved versions and package records remain workspace-relative; check
182
- compares the resulting archive identities and installed importer bindings.
183
- Do not rewrite member lock entries to look identical to the root importer.
184
- Updating only the lockfile does not update installed packages: run `pnpm install`
185
- after selecting another local package combination. Directory links and
186
- source-workspace overrides stay invalid.
187
- The generated Electron packager rebases archive paths for its isolated dependency
188
- staging so a local build uses the same packages.
189
-
190
- `check --production` is the final public-release preflight and requires registry
191
- resolutions. It is not a prerequisite for development or local build/pack;
192
- the normal build still executes the actual declared production payload command.
193
-
194
- For local installed-App acceptance, keep these tarball overrides and run:
195
-
196
- ```bash
197
- pnpm exec nimi-app check
198
- pnpm exec nimi-app build --target windows-x86_64
199
- pnpm exec nimi-app pack --target windows-x86_64 --production
200
- ```
201
-
202
- Use the actual target on its matching host. `pack --production` observes the
203
- payload's native signature and execution permissions; it does not run registry
204
- dependency preflight or publish anything. Plain `pack` writes a development
205
- archive that Runtime local import rejects. Import the resulting package through
206
- Desktop's Apps → Add App → Import local package, then verify its installed launch
207
- and business use. This exercises the `user_imported` source independently of
208
- Catalog admission and download.
209
-
210
- When preparing a public release after development acceptance, remove local
211
- overrides, install the published matched versions and complete release preflight.
212
- Local import creates no GitHub Release or Registry approval and does not verify
213
- Catalog download or installation on a machine without the development environment.
214
-
215
- `init --dry-run --json` and `sync --dry-run --json` show app-tools file/field
216
- changes without writes, installation or owner mutation. The separate
217
- nimi-coding step and expected version are listed without simulating its internals.
218
- For an upgrade, install the target app-tools and exact nimi-coding before apply.
219
- Sync recomputes fresh scaffold derived projections while retaining immutable
220
- identity/direct features and App-owned code; then install the normalized
221
- dependencies, refresh package-manager locks, check and verify the affected task.
222
- The checkout directory is reported in command output, not persisted as App
223
- identity; syncing an upgraded project after relocating it does not dirty its
224
- intent/lock merely because the absolute path changed.
225
- An installed nimi-coding version that differs from the selected tool matrix is
226
- rejected before its projection command runs.
227
-
228
- ## Command family
229
-
230
- The public CLI has exactly eight commands:
11
+ The CLI exposes an eight-command toolkit designed for rapid local iteration and secure production releases:
231
12
 
232
13
  ```text
233
- create -> dependency install -> init -> sync -> check
234
- -> dev / test / build -> pack
14
+ create ➔ install ➔ init ➔ sync ➔ check ➔ dev / test / build ➔ pack
235
15
  ```
236
16
 
237
- - `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.
238
- - `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.
239
- - `sync` refreshes only scaffold-managed dependencies, configuration, workflow and glue. App-owned product code and the project `LICENSE` are preserved.
240
- - `check` is non-mutating and incorporates the former scaffold validation behavior.
241
- - `dev` requests the official Desktop-supervised Electron development Host.
242
- - `test` and `build` execute the real owner commands declared in `.nimi/config/build-profile.yaml`; there is no fallback success.
243
- - `pack` is the sole local/CI `.nimiapp` packaging owner and never uploads.
244
-
245
- `doctor`, `update`, and local `publish` are absent without aliases. Use `check`
246
- and `sync`; production publication runs only from a protected version tag whose
247
- commit is already contained in the publisher repository's canonical default
248
- 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. |
249
27
 
250
- Run the checked-in CLI help for the admitted feature catalog and exact options:
251
-
252
- ```bash
253
- node app-tools/bin/nimi-app.mjs --help
254
- ```
28
+ ---
255
29
 
256
- ## Create
30
+ ## 2. Quickstart: Creating a New App
257
31
 
258
- 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:
259
33
 
260
34
  ```bash
261
- node app-tools/bin/nimi-app.mjs create \
262
- --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 \
263
38
  --profile standalone \
264
- --app-id example.app \
39
+ --features studio-create \
40
+ --app-id com.example.editor \
265
41
  --version 0.1.0 \
266
- --title "Example App" \
267
- --package-name example-app \
268
- --author "Example Team"
269
- ```
270
-
271
- 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.
272
-
273
- 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"
274
45
 
275
- ## Development and build
276
-
277
- After creation:
278
-
279
- ```bash
280
- cd path/to/app
46
+ cd my-editor-app
281
47
  pnpm install
282
48
  pnpm run init
283
49
  pnpm run sync
284
50
  pnpm run check
285
- pnpm run test
286
- pnpm run app:build -- --target windows-x86_64
287
51
  pnpm dev
288
52
  ```
289
53
 
290
- `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.
291
55
 
292
- 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.
293
59
 
294
- Every `build`, including non-production builds, requires the selected target's
295
- declared payload and exact Runtime entry to exist after its owner command exits
296
- successfully. Building a macOS payload cannot report success for a missing
297
- Windows target. The default recipes build for their host platform; use the
298
- matching build host or provide a real App-owned build command. This file check
299
- does not prove executable architecture or signing: production App information
300
- is checked with `--production`, and native package facts are verified by
301
- `pack --production`.
60
+ <a id="local-development-packages"></a>
302
61
 
303
- To continue an existing development App and its data, select a registration explicitly:
62
+ ### Dependencies & Existing Projects
304
63
 
305
- ```bash
306
- pnpm dev -- --list-registrations
307
- pnpm dev -- --resume <selector>
308
- ```
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.
309
65
 
310
- 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.
311
69
 
312
- 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
+ ---
313
71
 
314
- App Tools prepares the `macos-aarch64` target on an Apple Silicon Mac.
315
- The same owner command produces `dist-electron-package/<app>-shell-darwin-arm64/`
316
- with a native `.app` bundle and a direct `Contents/MacOS` entry. The publisher's
317
- build applies an ad-hoc integrity seal without a Developer ID identity or Apple
318
- notarization; production pack observes that absence and rejects invalid seals.
319
- Relative framework links are preserved inside the immutable payload. The App
320
- continues to consume the macOS native binding through Kit's optional dependency.
321
- Nimi installation never signs or repairs the publisher's code.
72
+ ## 3. Desktop-Supervised Development
322
73
 
323
- Existing `.nimi/config/build-profile.yaml` target choices are App-owned and are
324
- preserved by sync. To add macOS, declare `macos-aarch64` with `os: macos`,
325
- `arch: arm64`, the same production build command, the Darwin output directory
326
- above as `payload_path`, and
327
- `payload/<app>-shell.app/Contents/MacOS/<app>-shell` as `runtime_entry`.
328
- The managed workflow resolves that declared target to `macos-15`; Windows keeps
329
- its existing runner and profile. These authoring/build capabilities do not by
330
- 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).
331
75
 
332
- 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:
333
78
 
334
- ## Canonical release boundary
79
+ ```bash
80
+ # List active registrations
81
+ pnpm dev -- --list-registrations
335
82
 
336
- The Registry publication chain uses the stages below. Publisher GitHub Release
337
- is available for configured pilot repositories. Protected Registry admission and
338
- installed App lifecycle use their separate Platform, Runtime and Desktop owners;
339
- each App's declared target still needs its own acceptance.
83
+ # Resume a specific registration
84
+ pnpm dev -- --resume <selector>
85
+ ```
340
86
 
341
- ```text
342
- public App repository
343
- -> reviewed canonical default-branch commit
344
- -> immutable protected version tag
345
- -> tag-triggered publisher GitHub Actions
346
- -> immutable GitHub Release assets
347
- -> publisher-owned registry pull request
348
- -> human-reviewed static registry main
349
- -> Runtime download/install
350
- -> 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
351
100
  ```
352
101
 
353
- External publishers submit from their own fork. An authorized publisher sharing
354
- the Registry namespace can use a same-repository branch. Both paths use one
355
- publisher-owned branch and pull request for the exact App version and Release;
356
- 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.
357
103
 
358
- 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.
359
109
 
360
- 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`.
361
111
 
362
- 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
+ ---
363
115
 
364
116
  ## Publishing on GitHub
365
117
 
366
- Before the first release, configure `NIMI_REPOSITORY_ADMIN_TOKEN` as an Actions
367
- secret in the App repository. It needs only **Administration: Read-only**, to
368
- check tag protection and Release immutability. Local App development does not
369
- 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.
370
122
 
371
- The built-in `GITHUB_TOKEN` has no Administration permission for the
372
- [repository immutability-settings API](https://docs.github.com/en/rest/repos/repos#check-if-immutable-releases-are-enabled-for-a-repository).
373
- That is why the current release preflight needs a separate credential. Actual
374
- Release uploads use GitHub's built-in token, and build attestations use OIDC.
375
- This secret is neither a Nimi login token nor Registry approval, and needs no
376
- 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.
377
127
 
378
- Repository secrets are scoped to their repository: configuring another App,
379
- even under the same organization, does not configure this one. If you do not
380
- 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.
381
129
 
382
- `nimi-app check --production` checks local inputs; it does not inspect remote
383
- 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.
384
137
 
385
- ### 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.
386
139
 
387
- Use a public repository owned by the publisher. You need administrator access
388
- 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.
389
144
 
390
- - In **Settings → General → Releases**, enable **Release immutability**.
391
- - In **Settings → Rules → Rulesets**, create a **tag** ruleset, set enforcement
392
- to **Active**, and include tags matching `v*`. Enable **Restrict updates**
393
- 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.
394
146
 
395
- These settings protect published versions. The workflow only checks them; it
396
- does not change repository settings.
147
+ ### Step 4: Prepare, Verify, and Tag a Release
397
148
 
398
- ### 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.
399
153
 
400
- 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.
401
156
 
402
- 1. Name the token so you can recognize its purpose, and choose an expiration date.
403
- 2. Set **Resource owner** to the user or organization that owns the App repository.
404
- 3. Under **Repository access**, choose **Only select repositories** and select
405
- this App repository.
406
- 4. Under **Repository permissions**, set **Administration** to **Read-only**.
407
- GitHub includes read-only Metadata automatically. No Contents write,
408
- Actions write, Secrets write, or organization-wide access is needed.
409
- 5. Generate the token. If the organization requires approval, complete that
410
- approval before publishing.
411
-
412
- This token reads tag-protection and release-immutability settings. The workflow
413
- uses GitHub's separate built-in token to publish artifacts and its OIDC
414
- permission to create build attestations.
415
-
416
- ### 3. Save it as an Actions secret
417
-
418
- In the App repository, open **Settings → Secrets and variables → Actions →
419
- New repository secret**.
420
-
421
- - **Name:** `NIMI_REPOSITORY_ADMIN_TOKEN`
422
- - **Secret:** the fine-grained token value from step 2
423
-
424
- Save it and confirm the exact name appears in the repository's Actions secrets.
425
- Use a **secret**, not an Actions variable. An organization secret is also
426
- supported when its repository-access list includes this App. Keep the value
427
- out of source files, `.env`, and release notes.
428
-
429
- ### 4. Check, build, and publish a version
430
-
431
- The project `LICENSE` belongs to the App. `create` writes it once as an MIT
432
- license naming `--author`, or the App title when no author is given; replace it
433
- with the App's own terms and set the matching `package.json.license`
434
- identifier. `sync` never rewrites it and `check` does not lock it. The
435
- template's own MIT notice stays in the scaffold-managed
436
- `licenses/nimi-app-template.txt`. A project created by an app-tools version
437
- that still managed `LICENSE` keeps its file byte for byte: `sync` records the
438
- App as its owner, reports the handover, and adds the template notice, while
439
- `check` asks for that sync first.
440
-
441
- Keep the packaged `LICENSE` identical to the reviewed Git source. New scaffolds
442
- include `LICENSE -text` in `.gitattributes`. Add the same rule to an existing
443
- repository while preserving its other attributes, and commit it before tagging.
444
- This prevents Windows checkout conversion from changing the license bytes that
445
- Registry verifies against the exact source tag.
446
-
447
- Electron packages keep native add-ons and their companion libraries outside ASAR
448
- with their relative layout intact. The scaffold uses
449
- `asar: { unpack: '**/*.{node,dylib,dll}' }` on Mac/Windows. Apply the equivalent rule
450
- to existing App-owned packagers and verify native loading from the packaged layout;
451
- unpacking only `.node` can leave Sharp's libvips unavailable to the OS loader.
452
-
453
- 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:
454
159
 
455
160
  ```bash
456
161
  pnpm run sync
@@ -460,54 +165,27 @@ pnpm exec nimi-app build --target windows-x86_64 --production
460
165
  pnpm exec nimi-app pack --target windows-x86_64 --production
461
166
  ```
462
167
 
463
- Commit the release changes and get that exact commit onto the repository's
464
- canonical default branch. Keep `package.json` and `nimi.app.yaml` versions
465
- 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):
466
169
 
467
170
  ```bash
468
171
  git tag -a v0.1.0 -m "Release 0.1.0"
469
172
  git push origin v0.1.0
470
173
  ```
471
174
 
472
- Open **Actions → nimi-app-release**. A successful run produces the immutable
473
- GitHub Release containing the `.nimiapp` package and aggregate candidate JSON.
474
- Manual workflow dispatch checks the development path and does not publish.
475
-
476
- If setup fails, the failed step points to the required setting. Add or replace
477
- the secret, fix its repository selection/permissions, or enable the named
478
- setting, then use **Re-run failed jobs** on the same run. A tag outside the
479
- default branch requires merging its exact commit first. A code change requires
480
- a new version and tag. Newly published release proofs can take a short time to
481
- appear; the workflow waits for this specific delay and still requires successful
482
- 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.
483
176
 
484
- GitHub Release publication is followed by the separate
485
- [Registry submission and human admission flow](https://github.com/nimiplatform/nimi-app-registry#ownership-boundary).
486
- 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.
487
178
 
488
- ## 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).
489
181
 
490
- 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
+ ---
491
183
 
492
- Published CLI usage is:
184
+ ## Portable App Information (Package v2)
493
185
 
494
- ```bash
495
- pnpm dlx --package @nimiplatform/app-tools nimi-app --help
496
- ```
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.
497
187
 
498
- ## Portable App information (package v2)
499
-
500
- A distribution package includes `app-info.json`, containing its actual icon,
501
- summary, available usage guide and version notes, license, portable requirements
502
- and, when declared, the publisher safety declaration from `nimi.app.yaml`
503
- `safety_profile` (see the lifecycle skill's safety-declaration reference). An
504
- undeclared `safety_profile` stays absent and blocks nothing locally. The
505
- Registry's current admission policy determines whether a public submission
506
- requires the complete declaration; App Tools does not fetch that policy during
507
- local checks.
508
- Every `pack`, including development-mode packaging and non-release CI, requires
509
- valid App information. Complete `nimi.app.yaml` and its resources before packing;
510
- production check/build validates them before the build starts:
188
+ Configure your metadata, capability references, and storage policy in `nimi.app.yaml`:
511
189
 
512
190
  ```yaml
513
191
  metadata:
@@ -524,66 +202,29 @@ storage_policy:
524
202
  kind: nimi-mediated-default
525
203
  ```
526
204
 
527
- Use the canonical requirement references your App needs; an explicitly empty
528
- list is valid. Apps with their own OS storage must declare
529
- `kind: app-owned-os-storage` and `os_storage_disclosure` entries containing
530
- `path_pattern`, `purpose` and `expected_size_band`. These paths are disclosures,
531
- not instructions for Nimi to delete files. The author, homepage and support
532
- links are optional claims for local/private imports; Registry admission keeps
533
- its independent public-source, open-source license and support requirements.
534
-
535
- The icon must be a complete static PNG, square, 128–1024 pixels, no larger than
536
- 512 KiB, and not fully transparent. Supply your App's real artwork: the old
537
- 1×1 scaffold native icon is not distribution artwork. `metadata` paths are
538
- relative to the App repository. README and version notes are optional for local or
539
- private packages; omit their metadata paths when not provided. Registry admission
540
- requires both documents. Supplied README is limited to 96 KiB, version notes to
541
- 32 KiB, and the root LICENSE to 128 KiB. `package.json.license` supplies the
542
- explicit license identifier; it does not turn a private license into an
543
- open-source Registry license. Name and summary allow 120 and 280 characters.
544
- Scaffold `sync` preserves these author-edited metadata, requirement and storage
545
- fields while continuing to check the managed identity and carrier fields.
546
- The scaffold does not supply finished artwork. Add the declared icon, a summary
547
- and license information; provide any declared documents or omit optional document
548
- paths for local/private packages. Until then, package-producing CI will fail.
549
- Incomplete projects remain editable with `dev` and ordinary non-production builds.
550
-
551
- Pack writes `nimi.app-package/v2` and emits the exact embedded information bytes
552
- as `<app_id>-<version>-<target_id>.app-info.json` next to the `.nimiapp` and
553
- `.target.json`. Aggregate verifies both files and their equality with the
554
- embedded document. The managed Release workflow uploads this sidecar; a Registry
555
- candidate must reference its actual immutable Release asset identity, URL, size
556
- and digest. No App icon or document is copied into Registry storage.
557
-
558
- App Tools releases independently of SDK, Kit and Tauri shell. Its `nimiScaffoldVersions`
559
- declares the tested public SDK, Kit and Tauri shell versions used by new Apps and
560
- explicit `sync`; workspace development version bumps do not change those ranges.
561
- The release workflow requires those public versions before publishing App Tools.
562
-
563
- Existing Apps follow the [platform upgrade guide](skills/nimi-app-lifecycle/references/upgrade-platform.md).
564
- Select a published app-tools version and the exact nimi-coding version in that
565
- release's `nimiScaffoldVersions`. Install both in the App's `devDependencies`
566
- before invoking the target tool. Read the SDK/Kit migration notes and update the
567
- 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.
568
206
 
569
- ```bash
570
- pnpm exec nimi-app sync --dry-run --json
571
- pnpm exec nimi-app sync
572
- pnpm install
573
- pnpm exec nimi-app check
574
- pnpm exec nimi-app test
575
- pnpm exec nimi-app build --target windows-x86_64
576
- ```
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
577
229
 
578
- Use the App's declared target for the final build. `sync` preserves App-owned
579
- product code; update any affected SDK/Kit API usage in that code before release.
580
-
581
- The v2 Runtime rejects v1 packages. Existing immutable publisher Releases and
582
- approved descriptors must not be edited to invent the missing asset. Prepare a
583
- new App version and real target builds, publish new immutable assets, and follow
584
- normal Registry review. The coordinated pre-release Registry data cutover must
585
- retire v1 entries/descriptors from the active dataset, retaining their history
586
- in Git; adding v2 releases alone cannot make old descriptors satisfy the new
587
- required-field schema. Do not deploy the v2 consumer before that reviewed
588
- cutover is ready. Installed information is source-qualified and stored offline
589
- by Runtime; metadata does not grant Registry verification or App Access.
230
+ Licensed under [Apache-2.0](../licenses/Apache-2.0.txt).