@nimiplatform/app-tools 0.13.0 → 0.14.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 +18 -4
- package/lib/app-dependency-combinations.mjs +4 -0
- package/lib/app-doctor-update.mjs +3 -0
- package/lib/app-icons.mjs +181 -0
- package/lib/app-info.mjs +21 -33
- package/lib/app-lifecycle-guidance.mjs +1 -0
- package/lib/app-scaffold-profiles.mjs +27 -2
- package/lib/app-scaffold.mjs +6 -5
- package/package.json +21 -20
- package/skills/nimi-app-lifecycle/SKILL.md +10 -4
- package/skills/nimi-app-lifecycle/references/adapt.md +2 -0
- package/skills/nimi-app-lifecycle/references/create.md +2 -0
- package/skills/nimi-app-lifecycle/references/release.md +2 -0
- package/skills/nimi-app-lifecycle/references/upgrade-platform.md +11 -0
- package/templates/app-source/src/ai-studio-core/messages/en.json +6 -0
- package/templates/app-source/src/ai-studio-core/messages/zh.json +6 -0
- package/templates/app-source/src/ai-studio-core/non-success-presentation.ts +10 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-result.tsx +6 -2
- package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +3 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-transcription-result.tsx +24 -7
- package/templates/app-source/src/ai-studio-core/section-ai-testing.tsx +24 -5
- package/templates/app-source/src/studio-modules/studio-create/messages/en.json +5 -0
- package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +5 -0
- package/templates/app-source/src/studio-modules/studio-create/parameter-panel.tsx +24 -1
- package/templates/app-source/src/studio-modules/studio-create/parameters.ts +2 -1
- package/templates/app-source/src/studio-modules/studio-create/runtime.ts +1 -0
- package/templates/default-starter/AGENTS.md +5 -2
- package/templates/default-starter/NIMI_APP.md +7 -0
- package/templates/default-starter/README.md +2 -0
- package/templates/default-starter/src/shell/App.tsx +6 -2
- package/templates/default-starter/src-tauri/Cargo.toml +3 -3
- package/templates/default-starter.manifest.json +6 -2
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ Set `--author` to the person or team responsible for the App and its license.
|
|
|
63
63
|
|
|
64
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.
|
|
65
65
|
|
|
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.
|
|
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.14.0` defaults to SDK `0.22.2`, Kit/native `0.22.1`, and `nimi-shell-tauri` `0.11.1`. When working from source, verify that the required versions are available on npm before installing them.
|
|
67
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
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.
|
|
69
69
|
|
|
@@ -109,7 +109,7 @@ Before publishing publicly, verify the `.nimiapp` package on your own machine:
|
|
|
109
109
|
|
|
110
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`.
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
Use Desktop-supervised Electron for App development and acceptance.
|
|
113
113
|
|
|
114
114
|
---
|
|
115
115
|
|
|
@@ -191,7 +191,6 @@ Configure your metadata, capability references, and storage policy in `nimi.app.
|
|
|
191
191
|
metadata:
|
|
192
192
|
summary: A short description of what your App helps people do.
|
|
193
193
|
icon: assets/app-icon.png
|
|
194
|
-
readme: README.md
|
|
195
194
|
release_notes: RELEASE_NOTES.md
|
|
196
195
|
author: Your team
|
|
197
196
|
homepage_url: https://example.com
|
|
@@ -204,6 +203,10 @@ storage_policy:
|
|
|
204
203
|
|
|
205
204
|
Scaffold `sync` preserves your author-edited `metadata`, requirement, and storage fields while continuing to validate managed identity and carrier fields.
|
|
206
205
|
|
|
206
|
+
`metadata.icon` is portable App artwork for Nimi Home and distribution information, not a pre-rendered macOS Dock tile. Keep platform padding, outer bevels and shadows out of this source; a background that belongs to the App's brand can remain. The generated Electron build preserves that artwork in `app-icon.png`, derives a separate `app-icon-macos.png` with a light neutral rounded-square plate and transparent outer margin, and packages the same macOS composition as ICNS with 1×/2× representations from 16 through 1024 pixels. Windows ICO preserves the source silhouette and transparency, with 15 sizes from 16 through 256 pixels, including intermediate high-DPI taskbar sizes. Development uses the platform-specific window/Dock resource; production packaging includes those runtime resources and embeds ICNS or ICO before signing. Custom repository-relative source paths are supported. Rebuild after changing the image or its declaration. Development without artwork remains available with an explicit warning; invalid artwork fails the build, and production requires valid artwork. Removing or invalidating an image clears its old derived icons.
|
|
207
|
+
|
|
208
|
+
Windows taskbar identity is `ai.nimi.dev.apps.<app_id>` for the generated development Host and `ai.nimi.apps.<app_id>` for a production bundle. Separate namespaces also avoid collisions with an App whose canonical ID ends in `.dev`. This does not change the canonical App ID or Runtime registration. Existing scaffold projects receive this managed Host/build logic through `sync`; adopted App-owned Hosts must implement the same behavior in their own code.
|
|
209
|
+
|
|
207
210
|
### Field & Asset Requirements
|
|
208
211
|
All `metadata` file paths are relative to the App repository root:
|
|
209
212
|
|
|
@@ -212,12 +215,23 @@ All `metadata` file paths are relative to the App repository root:
|
|
|
212
215
|
| **Name & Summary** | Up to **120 characters** for the App name and **280 characters** for `metadata.summary`. |
|
|
213
216
|
| **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
217
|
| **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
|
-
| **
|
|
218
|
+
| **App introduction (`NIMI_APP.md`)** | Required at the repository root for every App, including local/private packages. Nonempty UTF-8 regular file, at most **96 KiB**. Home reads this file; `metadata.readme` and README fallback are not supported. |
|
|
219
|
+
| **Version Notes (`release_notes`)** | Optional for local/private packages, required for Registry admission; at most **32 KiB**. |
|
|
216
220
|
| **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
221
|
| **Capability & Feature Refs** | Use the canonical requirement references your App needs; an explicitly empty list (`[]`) is valid. |
|
|
218
222
|
| **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
223
|
| **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
224
|
|
|
225
|
+
### Write the App introduction
|
|
226
|
+
|
|
227
|
+
`NIMI_APP.md` is the single Home introduction source. Write for the App's actual users: what it helps them do, how to start the main task, required configuration, relevant data handling and current limitations, and where to get help. Developer tools may retain the technical precision their users need. Describe available behavior, not roadmap promises or inferred acceptance.
|
|
228
|
+
|
|
229
|
+
Keep repository setup, architecture, build/release commands and engineering acceptance logs in `README.md` or developer documentation. Use self-contained Markdown: Home displays image alt text and only opens absolute HTTP(S) links; relative file links and anchors are not navigable. Keep necessary instructions in the introduction itself.
|
|
230
|
+
|
|
231
|
+
`create` supplies an honest starter introduction. Replace its unfinished-product notice with the App's actual user content as the product develops. `NIMI_APP.md` is App-owned: `sync` neither overwrites nor recreates it. Existing Apps must author this file and remove `metadata.readme` before checking; there is no automatic document migration. `check` and `pack` validate the file, not the truth or quality of its prose. Review it alongside the real user journey.
|
|
232
|
+
|
|
233
|
+
Packaging copies its exact text into the existing `app-info.json` `readme_markdown` field. Installed and Catalog entries display their exact release snapshot; changing source documentation does not rewrite an immutable release.
|
|
234
|
+
|
|
221
235
|
### Package v2 Output & Sidecar Verification
|
|
222
236
|
`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
237
|
|
|
@@ -9,6 +9,10 @@ const SDK = '@nimiplatform/sdk';
|
|
|
9
9
|
const KIT = '@nimiplatform/kit';
|
|
10
10
|
|
|
11
11
|
export const ADDITIONAL_DEPENDENCY_COMBINATIONS = Object.freeze([
|
|
12
|
+
Object.freeze({ sdkVersion: '^0.22.1', kitVersion: '^0.22.1', nimiShellTauriVersion: '0.11.1', source: 'existing' }),
|
|
13
|
+
Object.freeze({ sdkVersion: '^0.22.1', kitVersion: '^0.22.0', nimiShellTauriVersion: '0.11.0', source: 'existing' }),
|
|
14
|
+
Object.freeze({ sdkVersion: '^0.22.0', kitVersion: '^0.22.0', nimiShellTauriVersion: '0.11.0', source: 'existing' }),
|
|
15
|
+
Object.freeze({ sdkVersion: '^0.21.0', kitVersion: '^0.21.0', nimiShellTauriVersion: '0.10.0', source: 'existing' }),
|
|
12
16
|
Object.freeze({ sdkVersion: '^0.21.0', kitVersion: '^0.20.0', nimiShellTauriVersion: '0.10.0', source: 'existing' }),
|
|
13
17
|
Object.freeze({ sdkVersion: '^0.21.0', kitVersion: '^0.19.0', nimiShellTauriVersion: '0.10.0', source: 'existing' }),
|
|
14
18
|
Object.freeze({ sdkVersion: '^0.21.0', kitVersion: '^0.18.1', nimiShellTauriVersion: '0.10.0', source: 'existing' }),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { APP_AUTHOR_DECLARATION_FIELDS, hashScaffoldManagedContent } from './app-scaffold.mjs';
|
|
2
|
+
import { readAppIntroduction } from './app-info.mjs';
|
|
2
3
|
import { existsSync, readdirSync, readFileSync, realpathSync, statSync } from 'node:fs';
|
|
3
4
|
import path from 'node:path';
|
|
4
5
|
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
|
|
@@ -485,6 +486,7 @@ function assertProjectConfiguration(targetDir, parsedManifest = null, managed =
|
|
|
485
486
|
}
|
|
486
487
|
}
|
|
487
488
|
const rendererOrigin = assertElectronLocalDevelopmentManifest(document);
|
|
489
|
+
readAppIntroduction(targetDir, document);
|
|
488
490
|
assertDeclaredHostSourceDirectory(targetDir, document);
|
|
489
491
|
assertOfficialDevelopmentEntrypoints(targetDir, rendererOrigin, undefined, managed || !usesAppOwnedRenderer(targetDir));
|
|
490
492
|
}
|
|
@@ -591,6 +593,7 @@ function assertNimicodingProjectionCurrent(targetDir, runners) {
|
|
|
591
593
|
|
|
592
594
|
export function validateAppProjectInputs(targetDir, manifest, packageJson, managed = false, plannedSources) {
|
|
593
595
|
assertManifestAppAccessDeclaration(stringifyYaml(manifest), 'nimi.app.yaml');
|
|
596
|
+
readAppIntroduction(targetDir, manifest);
|
|
594
597
|
const rendererOrigin = assertElectronLocalDevelopmentManifest(manifest);
|
|
595
598
|
assertDeclaredHostSourceDirectory(targetDir, manifest);
|
|
596
599
|
assertOfficialDevelopmentEntrypoints(targetDir, rendererOrigin, packageJson, managed || !usesAppOwnedRenderer(targetDir, plannedSources));
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { lstatSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { PNG } from 'pngjs';
|
|
4
|
+
import { parse as parseYaml } from 'yaml';
|
|
5
|
+
|
|
6
|
+
const PNG_SIGNATURE = Buffer.from('89504e470d0a1a0a', 'hex');
|
|
7
|
+
|
|
8
|
+
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-042a
|
|
9
|
+
export function validateAppIcon(bytes) {
|
|
10
|
+
if (!Buffer.isBuffer(bytes) || bytes.length > 512 * 1024 || !bytes.subarray(0, 8).equals(PNG_SIGNATURE)) {
|
|
11
|
+
throw new Error('App icon must be a PNG of at most 512 KiB');
|
|
12
|
+
}
|
|
13
|
+
let offset = 8;
|
|
14
|
+
let ended = false;
|
|
15
|
+
while (offset + 12 <= bytes.length) {
|
|
16
|
+
const length = bytes.readUInt32BE(offset);
|
|
17
|
+
const type = bytes.toString('ascii', offset + 4, offset + 8);
|
|
18
|
+
if (offset + length + 12 > bytes.length || type === 'acTL') throw new Error('App icon must be a complete static PNG');
|
|
19
|
+
if (offset === 8 && (type !== 'IHDR' || length !== 13)) throw new Error('App icon PNG header is invalid');
|
|
20
|
+
if (type === 'IHDR') {
|
|
21
|
+
const width = bytes.readUInt32BE(offset + 8);
|
|
22
|
+
const height = bytes.readUInt32BE(offset + 12);
|
|
23
|
+
if (width < 128 || width > 1024 || width !== height) throw new Error('App icon must be square, 128–1024 pixels');
|
|
24
|
+
}
|
|
25
|
+
offset += length + 12;
|
|
26
|
+
if (type === 'IEND') { ended = length === 0 && offset === bytes.length; break; }
|
|
27
|
+
}
|
|
28
|
+
if (!ended) throw new Error('App icon PNG is truncated or has trailing content');
|
|
29
|
+
const decoded = PNG.sync.read(bytes, { checkCRC: true });
|
|
30
|
+
for (let index = 3; index < decoded.data.length; index += 4) {
|
|
31
|
+
if (decoded.data[index] !== 0) return bytes;
|
|
32
|
+
}
|
|
33
|
+
throw new Error('App icon is fully transparent; supply actual App artwork');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function readAppIcon(root, { required = true } = {}) {
|
|
37
|
+
const manifest = parseYaml(readFileSync(path.join(root, 'nimi.app.yaml'), 'utf8'));
|
|
38
|
+
const relative = manifest?.metadata?.icon;
|
|
39
|
+
if (relative === undefined && !required) return null;
|
|
40
|
+
if (typeof relative !== 'string' || path.isAbsolute(relative) || relative.includes('\\')
|
|
41
|
+
|| relative.includes(':') || relative.split('/').some(part => !part || part === '.' || part === '..')) {
|
|
42
|
+
throw new Error('metadata.icon must name an App-relative resource');
|
|
43
|
+
}
|
|
44
|
+
const file = path.join(root, relative);
|
|
45
|
+
let stat;
|
|
46
|
+
try { stat = lstatSync(file); } catch (error) {
|
|
47
|
+
if (error.code !== 'ENOENT') throw error;
|
|
48
|
+
if (!required) return null;
|
|
49
|
+
throw new Error(`metadata.icon resource is missing: ${relative}`);
|
|
50
|
+
}
|
|
51
|
+
const physicalRelative = path.relative(realpathSync(root), realpathSync(file));
|
|
52
|
+
if (physicalRelative.startsWith(`..${path.sep}`) || physicalRelative === '..' || path.isAbsolute(physicalRelative)
|
|
53
|
+
|| !stat.isFile() || stat.isSymbolicLink() || stat.size > 512 * 1024) {
|
|
54
|
+
throw new Error('metadata.icon must be a regular PNG inside the App repository, at most 512 KiB');
|
|
55
|
+
}
|
|
56
|
+
return validateAppIcon(readFileSync(file));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Area sampling in premultiplied alpha avoids dark borders around transparent artwork.
|
|
60
|
+
function resizedPng(source, size) {
|
|
61
|
+
if (size === source.width) return PNG.sync.write(source);
|
|
62
|
+
const target = new PNG({ width: size, height: size });
|
|
63
|
+
const scale = source.width / size;
|
|
64
|
+
for (let y = 0; y < size; y++) {
|
|
65
|
+
for (let x = 0; x < size; x++) {
|
|
66
|
+
const sum = [0, 0, 0, 0];
|
|
67
|
+
if (scale < 1) {
|
|
68
|
+
const sx = Math.max(0, Math.min(source.width - 1, (x + 0.5) * scale - 0.5));
|
|
69
|
+
const sy = Math.max(0, Math.min(source.height - 1, (y + 0.5) * scale - 0.5));
|
|
70
|
+
const x0 = Math.floor(sx), y0 = Math.floor(sy);
|
|
71
|
+
for (const [px, wx] of [[x0, 1 - (sx - x0)], [Math.min(x0 + 1, source.width - 1), sx - x0]]) {
|
|
72
|
+
for (const [py, wy] of [[y0, 1 - (sy - y0)], [Math.min(y0 + 1, source.height - 1), sy - y0]]) {
|
|
73
|
+
const offset = (py * source.width + px) * 4;
|
|
74
|
+
const alpha = source.data[offset + 3] * wx * wy;
|
|
75
|
+
for (let channel = 0; channel < 3; channel++) sum[channel] += source.data[offset + channel] * alpha;
|
|
76
|
+
sum[3] += alpha;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const offset = (y * size + x) * 4;
|
|
80
|
+
for (let channel = 0; channel < 3; channel++) target.data[offset + channel] = sum[3] ? Math.round(sum[channel] / sum[3]) : 0;
|
|
81
|
+
target.data[offset + 3] = Math.round(sum[3]);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
for (let sy = Math.floor(y * scale); sy < Math.ceil((y + 1) * scale); sy++) {
|
|
85
|
+
const wy = Math.min(sy + 1, (y + 1) * scale) - Math.max(sy, y * scale);
|
|
86
|
+
for (let sx = Math.floor(x * scale); sx < Math.ceil((x + 1) * scale); sx++) {
|
|
87
|
+
const weight = wy * (Math.min(sx + 1, (x + 1) * scale) - Math.max(sx, x * scale));
|
|
88
|
+
const offset = (sy * source.width + sx) * 4;
|
|
89
|
+
const alpha = source.data[offset + 3] * weight;
|
|
90
|
+
for (let channel = 0; channel < 3; channel++) sum[channel] += source.data[offset + channel] * alpha;
|
|
91
|
+
sum[3] += alpha;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const offset = (y * size + x) * 4;
|
|
95
|
+
for (let channel = 0; channel < 3; channel++) target.data[offset + channel] = sum[3] ? Math.round(sum[channel] / sum[3]) : 0;
|
|
96
|
+
target.data[offset + 3] = Math.round(sum[3] / (scale * scale));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return PNG.sync.write(target);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// metadata.icon is portable in-product artwork. Only the macOS native export
|
|
103
|
+
// receives a platform tile and outer margin; never feed this back into app-info.
|
|
104
|
+
export function createMacIconPng(bytes) {
|
|
105
|
+
const source = PNG.sync.read(validateAppIcon(bytes));
|
|
106
|
+
const artwork = PNG.sync.read(resizedPng(source, 824));
|
|
107
|
+
const target = new PNG({ width: 1024, height: 1024 });
|
|
108
|
+
for (let y = 0; y < 824; y++) for (let x = 0; x < 824; x++) {
|
|
109
|
+
// A continuous rounded-square silhouette with antialiased edge coverage.
|
|
110
|
+
let coverage = 0;
|
|
111
|
+
for (const dy of [0.125, 0.375, 0.625, 0.875]) for (const dx of [0.125, 0.375, 0.625, 0.875]) {
|
|
112
|
+
if (Math.pow(Math.abs((x + dx - 412) / 412), 5)
|
|
113
|
+
+ Math.pow(Math.abs((y + dy - 412) / 412), 5) <= 1) coverage += 1 / 16;
|
|
114
|
+
}
|
|
115
|
+
if (!coverage) continue;
|
|
116
|
+
const from = (y * 824 + x) * 4;
|
|
117
|
+
const to = ((y + 100) * 1024 + x + 100) * 4;
|
|
118
|
+
const alpha = artwork.data[from + 3] / 255;
|
|
119
|
+
const fraction = y / 823;
|
|
120
|
+
const background = [248 - 13 * fraction, 250 - 12 * fraction, 252 - 9 * fraction];
|
|
121
|
+
for (let channel = 0; channel < 3; channel++) {
|
|
122
|
+
target.data[to + channel] = Math.round(artwork.data[from + channel] * alpha + background[channel] * (1 - alpha));
|
|
123
|
+
}
|
|
124
|
+
target.data[to + 3] = Math.round(255 * coverage);
|
|
125
|
+
}
|
|
126
|
+
return PNG.sync.write(target);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function encodeWindowsIcon(bytes) {
|
|
130
|
+
const source = PNG.sync.read(validateAppIcon(bytes));
|
|
131
|
+
const sizes = [16, 20, 24, 30, 32, 36, 40, 48, 60, 64, 72, 80, 96, 128, 256];
|
|
132
|
+
const images = sizes.map(size => resizedPng(source, size));
|
|
133
|
+
const directory = Buffer.alloc(6 + sizes.length * 16);
|
|
134
|
+
directory.writeUInt16LE(1, 2);
|
|
135
|
+
directory.writeUInt16LE(sizes.length, 4);
|
|
136
|
+
let position = directory.length;
|
|
137
|
+
sizes.forEach((size, index) => {
|
|
138
|
+
const offset = 6 + index * 16;
|
|
139
|
+
directory[offset] = directory[offset + 1] = size === 256 ? 0 : size;
|
|
140
|
+
directory.writeUInt16LE(1, offset + 4);
|
|
141
|
+
directory.writeUInt16LE(32, offset + 6);
|
|
142
|
+
directory.writeUInt32LE(images[index].length, offset + 8);
|
|
143
|
+
directory.writeUInt32LE(position, offset + 12);
|
|
144
|
+
position += images[index].length;
|
|
145
|
+
});
|
|
146
|
+
return Buffer.concat([directory, ...images]);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function encodeMacIcon(bytes) {
|
|
150
|
+
const source = PNG.sync.read(createMacIconPng(bytes));
|
|
151
|
+
const chunks = [[16, 'icp4'], [32, 'ic11'], [32, 'icp5'], [64, 'ic12'],
|
|
152
|
+
[128, 'ic07'], [256, 'ic13'], [256, 'ic08'], [512, 'ic14'], [512, 'ic09'], [1024, 'ic10']]
|
|
153
|
+
.map(([size, type]) => {
|
|
154
|
+
const png = resizedPng(source, size);
|
|
155
|
+
const header = Buffer.alloc(8);
|
|
156
|
+
header.write(type);
|
|
157
|
+
header.writeUInt32BE(png.length + 8, 4);
|
|
158
|
+
return Buffer.concat([header, png]);
|
|
159
|
+
});
|
|
160
|
+
const header = Buffer.alloc(8);
|
|
161
|
+
header.write('icns');
|
|
162
|
+
header.writeUInt32BE(8 + chunks.reduce((length, chunk) => length + chunk.length, 0), 4);
|
|
163
|
+
return Buffer.concat([header, ...chunks]);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function prepareElectronIcons(root, { required = false } = {}) {
|
|
167
|
+
const output = path.join(root, 'dist-electron');
|
|
168
|
+
// Remove only our derived files, including when artwork was removed or became invalid.
|
|
169
|
+
const files = ['app-icon.png', 'app-icon.ico', 'app-icon.icns', 'app-icon-macos.png'];
|
|
170
|
+
for (const file of files) rmSync(path.join(output, file), { force: true });
|
|
171
|
+
const bytes = readAppIcon(root, { required });
|
|
172
|
+
if (!bytes) {
|
|
173
|
+
process.stderr.write('[nimi-app] No App artwork yet: supply metadata.icon for native window and Dock icons. Production packaging requires it.\n');
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
const ico = encodeWindowsIcon(bytes);
|
|
177
|
+
const icns = encodeMacIcon(bytes);
|
|
178
|
+
mkdirSync(output, { recursive: true });
|
|
179
|
+
for (const [index, content] of [bytes, ico, icns, createMacIconPng(bytes)].entries()) writeFileSync(path.join(output, files[index]), content);
|
|
180
|
+
return { png: path.join(output, files[0]), ico: path.join(output, files[1]), icns: path.join(output, files[2]), macPng: path.join(output, files[3]) };
|
|
181
|
+
}
|
package/lib/app-info.mjs
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-042a
|
|
2
2
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-043a
|
|
3
|
+
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-042d
|
|
3
4
|
import { existsSync, lstatSync, readFileSync } from 'node:fs';
|
|
4
5
|
import path from 'node:path';
|
|
5
|
-
import {
|
|
6
|
+
import { readAppIcon, validateAppIcon } from './app-icons.mjs';
|
|
7
|
+
export { validateAppIcon } from './app-icons.mjs';
|
|
6
8
|
import { parse as parseYaml } from 'yaml';
|
|
7
9
|
import { normalizeAppAccessItems } from './app-access-declaration.mjs';
|
|
8
10
|
import { CANONICAL_CAPABILITY_IDS } from './canonical-capability-ids.generated.mjs';
|
|
9
11
|
import { SAFETY_PROFILE_FIELD, normalizeSafetyProfile } from './app-safety-profile.mjs';
|
|
10
12
|
|
|
11
13
|
export const APP_INFO_MAX_BYTES = 1024 * 1024;
|
|
14
|
+
export const APP_INTRODUCTION_FILE = 'NIMI_APP.md';
|
|
12
15
|
export const APP_INFO_FIELDS = Object.freeze([
|
|
13
16
|
'format', 'app_id', 'version', 'target_id', 'display_name', 'summary', 'icon', 'readme_markdown', 'release_notes_markdown',
|
|
14
17
|
'license', 'app_access', 'capability_contract_refs', 'required_standardized_feature_refs', 'storage_policy', 'author',
|
|
@@ -17,7 +20,6 @@ export const APP_INFO_FIELDS = Object.freeze([
|
|
|
17
20
|
// Declaration fields that App Tools projects from nimi.app.yaml into the
|
|
18
21
|
// archive declaration and that Registry compares against the candidate.
|
|
19
22
|
export const APP_INFO_DECLARATION_FIELDS = Object.freeze(['app_id', 'display_name', 'version', 'app_access', 'capability_contract_refs', 'required_standardized_feature_refs', 'storage_policy', SAFETY_PROFILE_FIELD]);
|
|
20
|
-
const PNG_SIGNATURE = Buffer.from('89504e470d0a1a0a', 'hex');
|
|
21
23
|
|
|
22
24
|
function text(value, label, max, multiline = false) {
|
|
23
25
|
if (typeof value !== 'string' || !value.trim() || value.includes('\0')
|
|
@@ -41,33 +43,6 @@ function refs(value, label) {
|
|
|
41
43
|
return entries;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
export function validateAppIcon(bytes) {
|
|
45
|
-
if (!Buffer.isBuffer(bytes) || bytes.length > 512 * 1024 || !bytes.subarray(0, 8).equals(PNG_SIGNATURE)) {
|
|
46
|
-
throw new Error('App icon must be a PNG of at most 512 KiB');
|
|
47
|
-
}
|
|
48
|
-
let offset = 8;
|
|
49
|
-
let ended = false;
|
|
50
|
-
while (offset + 12 <= bytes.length) {
|
|
51
|
-
const length = bytes.readUInt32BE(offset);
|
|
52
|
-
const type = bytes.toString('ascii', offset + 4, offset + 8);
|
|
53
|
-
if (offset + length + 12 > bytes.length || type === 'acTL') throw new Error('App icon must be a complete static PNG');
|
|
54
|
-
if (offset === 8 && (type !== 'IHDR' || length !== 13)) throw new Error('App icon PNG header is invalid');
|
|
55
|
-
if (type === 'IHDR') {
|
|
56
|
-
const width = bytes.readUInt32BE(offset + 8);
|
|
57
|
-
const height = bytes.readUInt32BE(offset + 12);
|
|
58
|
-
if (width < 128 || width > 1024 || width !== height) throw new Error('App icon must be square, 128–1024 pixels');
|
|
59
|
-
}
|
|
60
|
-
offset += length + 12;
|
|
61
|
-
if (type === 'IEND') { ended = length === 0 && offset === bytes.length; break; }
|
|
62
|
-
}
|
|
63
|
-
if (!ended) throw new Error('App icon PNG is truncated or has trailing content');
|
|
64
|
-
const decoded = PNG.sync.read(bytes, { checkCRC: true });
|
|
65
|
-
for (let index = 3; index < decoded.data.length; index += 4) {
|
|
66
|
-
if (decoded.data[index] !== 0) return bytes;
|
|
67
|
-
}
|
|
68
|
-
throw new Error('App icon is fully transparent; supply actual App artwork');
|
|
69
|
-
}
|
|
70
|
-
|
|
71
46
|
function storage(value) {
|
|
72
47
|
if (!value || !['nimi-mediated-default', 'app-owned-os-storage'].includes(value.kind)) {
|
|
73
48
|
throw new Error('App info storage_policy must declare its storage kind');
|
|
@@ -114,7 +89,7 @@ export function validateAppInfo(info) {
|
|
|
114
89
|
const icon = Buffer.from(info.icon.data_base64, 'base64');
|
|
115
90
|
if (icon.toString('base64') !== info.icon.data_base64) throw new Error('App icon base64 is not canonical');
|
|
116
91
|
validateAppIcon(icon);
|
|
117
|
-
|
|
92
|
+
text(info.readme_markdown, 'App introduction', 96 * 1024, true);
|
|
118
93
|
if (info.release_notes_markdown !== undefined && info.release_notes_markdown !== '') text(info.release_notes_markdown, 'release notes', 32 * 1024, true);
|
|
119
94
|
text(info.license?.identifier, 'license identifier', 200);
|
|
120
95
|
text(info.license?.text, 'license text', 128 * 1024, true);
|
|
@@ -135,7 +110,7 @@ function resource(root, relative, label, maxBytes) {
|
|
|
135
110
|
if (typeof relative !== 'string' || path.isAbsolute(relative) || relative.includes('\\')
|
|
136
111
|
|| relative.split('/').some((part) => !part || part === '.' || part === '..')) throw new Error(`metadata.${label} must name an App-relative resource`);
|
|
137
112
|
const file = path.join(root, relative);
|
|
138
|
-
const field = label === 'license' ? 'App license' : `metadata.${label}`;
|
|
113
|
+
const field = label === 'license' ? 'App license' : label === 'introduction' ? APP_INTRODUCTION_FILE : `metadata.${label}`;
|
|
139
114
|
try {
|
|
140
115
|
const stat = lstatSync(file);
|
|
141
116
|
if (!stat.isFile() || stat.isSymbolicLink() || stat.size === 0 || stat.size > maxBytes) throw new Error(`must be a nonempty regular file of at most ${maxBytes} bytes`);
|
|
@@ -146,6 +121,19 @@ function resource(root, relative, label, maxBytes) {
|
|
|
146
121
|
}
|
|
147
122
|
}
|
|
148
123
|
|
|
124
|
+
export function readAppIntroduction(root, manifest) {
|
|
125
|
+
if (manifest?.metadata && Object.hasOwn(manifest.metadata, 'readme')) {
|
|
126
|
+
throw new Error('metadata.readme is not supported; put the user introduction in root NIMI_APP.md and remove metadata.readme');
|
|
127
|
+
}
|
|
128
|
+
let content;
|
|
129
|
+
try {
|
|
130
|
+
content = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(resource(root, APP_INTRODUCTION_FILE, 'introduction', 96 * 1024));
|
|
131
|
+
} catch (error) {
|
|
132
|
+
throw new Error(`Invalid ${APP_INTRODUCTION_FILE}: ${error.message}`, { cause: error });
|
|
133
|
+
}
|
|
134
|
+
return text(content, APP_INTRODUCTION_FILE, 96 * 1024, true);
|
|
135
|
+
}
|
|
136
|
+
|
|
149
137
|
export function readAppInfo(root, targetId) {
|
|
150
138
|
const manifest = parseYaml(readFileSync(path.join(root, 'nimi.app.yaml'), 'utf8'));
|
|
151
139
|
const pkg = JSON.parse(readFileSync(path.join(root, 'package.json'), 'utf8'));
|
|
@@ -156,8 +144,8 @@ export function readAppInfo(root, targetId) {
|
|
|
156
144
|
const info = validateAppInfo({
|
|
157
145
|
format: 'nimi.app-info/v1', app_id: manifest.app_id, version: manifest.version, target_id: targetId,
|
|
158
146
|
display_name: manifest.display_name, summary: metadata.summary,
|
|
159
|
-
icon: { media_type: 'image/png', data_base64:
|
|
160
|
-
readme_markdown:
|
|
147
|
+
icon: { media_type: 'image/png', data_base64: readAppIcon(root).toString('base64') },
|
|
148
|
+
readme_markdown: readAppIntroduction(root, manifest),
|
|
161
149
|
release_notes_markdown: metadata.release_notes === undefined ? '' : readText(metadata.release_notes, 'release_notes', 32 * 1024),
|
|
162
150
|
license: { identifier: pkg.license, text: readText('LICENSE', 'license', 128 * 1024) },
|
|
163
151
|
app_access: refs(manifest.app_access, 'app_access'),
|
|
@@ -16,6 +16,7 @@ const AGENTS_BLOCK = `${START}
|
|
|
16
16
|
- Keep App-owned product behavior, Host code, business accounts and non-AI services with this repository. Use the SDK/Kit Local App carrier for Nimi AI, configuration, storage and session access.
|
|
17
17
|
- Development may consume complete local npm tarballs through the supported explicit overrides and version matrix; public-release preflight uses registry resolutions. Do not substitute source-workspace or directory links.
|
|
18
18
|
- App Tools owns its lifecycle skill, this block, managed workflow and declared engineering fields; preserve other instructions, product source and licenses. Existing adoption does not create fresh scaffold intent or lock.
|
|
19
|
+
- Maintain root NIMI_APP.md for the App’s actual users: purpose, first steps, configuration, data handling, limitations and help. Keep engineering instructions and acceptance logs in README/developer documentation. metadata.readme and README fallback are not supported; sync never overwrites or recreates this App-owned introduction.
|
|
19
20
|
- Product-operation guides apply to their specific business tasks; they do not replace the Nimi development boundary.
|
|
20
21
|
- Reuse the user's confirmed scope and authorization. Report command checks separately from actual App journeys; unrun relevant paths remain NOT-VERIFIED.
|
|
21
22
|
${END}`;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
2
3
|
|
|
3
4
|
export const SUPPORTED_APP_SCAFFOLD_PROFILES = ['standalone'];
|
|
4
5
|
|
|
@@ -78,6 +79,11 @@ export function buildDefaultStarterFiles(identity) {
|
|
|
78
79
|
content: DEFAULT_ELECTRON_PRELOAD_BUNDLER,
|
|
79
80
|
mutationClass: 'scaffold-managed glue',
|
|
80
81
|
},
|
|
82
|
+
{
|
|
83
|
+
path: 'scripts/app-icons.mjs',
|
|
84
|
+
content: readFileSync(new URL('./app-icons.mjs', import.meta.url), 'utf8'),
|
|
85
|
+
mutationClass: 'scaffold-managed glue',
|
|
86
|
+
},
|
|
81
87
|
{
|
|
82
88
|
path: 'scripts/clean-electron-production.mjs',
|
|
83
89
|
content: DEFAULT_ELECTRON_PRODUCTION_CLEANER,
|
|
@@ -131,10 +137,12 @@ const DEFAULT_ELECTRON_PRELOAD = [
|
|
|
131
137
|
|
|
132
138
|
const DEFAULT_ELECTRON_PRELOAD_BUNDLER = [
|
|
133
139
|
"import { build } from 'esbuild';",
|
|
140
|
+
"import { prepareElectronIcons } from './app-icons.mjs';",
|
|
134
141
|
"import path from 'node:path';",
|
|
135
142
|
"import { fileURLToPath } from 'node:url';",
|
|
136
143
|
'',
|
|
137
144
|
"const appRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');",
|
|
145
|
+
'prepareElectronIcons(appRoot);',
|
|
138
146
|
'',
|
|
139
147
|
'await build({',
|
|
140
148
|
" entryPoints: [path.join(appRoot, 'src-electron/preload.cts')],",
|
|
@@ -167,6 +175,7 @@ function renderDefaultElectronProductionPackager(identity) {
|
|
|
167
175
|
"import path from 'node:path';",
|
|
168
176
|
"import { fileURLToPath } from 'node:url';",
|
|
169
177
|
"import { packager } from '@electron/packager';",
|
|
178
|
+
"import { prepareElectronIcons } from './app-icons.mjs';",
|
|
170
179
|
"import { build } from 'esbuild';",
|
|
171
180
|
"import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';",
|
|
172
181
|
'',
|
|
@@ -216,6 +225,7 @@ function renderDefaultElectronProductionPackager(identity) {
|
|
|
216
225
|
'let packageCompleted = false;',
|
|
217
226
|
'',
|
|
218
227
|
'try {',
|
|
228
|
+
' const icons = prepareElectronIcons(appRoot, { required: true });',
|
|
219
229
|
' await build({',
|
|
220
230
|
" entryPoints: [path.join(appRoot, 'src-electron/main.ts')],",
|
|
221
231
|
" outfile: path.join(appRoot, 'dist-electron/main.js'),",
|
|
@@ -247,6 +257,9 @@ function renderDefaultElectronProductionPackager(identity) {
|
|
|
247
257
|
" await cp(path.join(appRoot, 'dist'), path.join(productionSourceRoot, 'dist'), { recursive: true, force: false });",
|
|
248
258
|
" await copyFile(path.join(appRoot, 'dist-electron', 'main.js'), path.join(productionSourceRoot, 'dist-electron', 'main.js'));",
|
|
249
259
|
" await copyFile(path.join(appRoot, 'dist-electron', 'preload.cjs'), path.join(productionSourceRoot, 'dist-electron', 'preload.cjs'));",
|
|
260
|
+
" await copyFile(icons.png, path.join(productionSourceRoot, 'dist-electron', 'app-icon.png'));",
|
|
261
|
+
" await copyFile(icons.macPng, path.join(productionSourceRoot, 'dist-electron', 'app-icon-macos.png'));",
|
|
262
|
+
" await copyFile(icons.ico, path.join(productionSourceRoot, 'dist-electron', 'app-icon.ico'));",
|
|
250
263
|
' await installProductionDependencies(productionSourceRoot);',
|
|
251
264
|
'',
|
|
252
265
|
" const productionManifestPath = path.join(productionSourceRoot, 'package.json');",
|
|
@@ -267,6 +280,7 @@ function renderDefaultElectronProductionPackager(identity) {
|
|
|
267
280
|
'',
|
|
268
281
|
' const packagePaths = await packager({',
|
|
269
282
|
' dir: productionSourceRoot,',
|
|
283
|
+
' icon: MACOS_BUILD ? icons.icns : icons.ico,',
|
|
270
284
|
' platform: NATIVE_PLATFORM,',
|
|
271
285
|
' arch: NATIVE_ARCH,',
|
|
272
286
|
` appBundleId: ${JSON.stringify(identity.tauriIdentifier)},`,
|
|
@@ -491,7 +505,9 @@ export function createAppNavigation() {
|
|
|
491
505
|
}
|
|
492
506
|
type NavigationOwner = {
|
|
493
507
|
navigation: ReturnType<typeof createAppNavigation>;
|
|
508
|
+
locale: 'en' | 'zh';
|
|
494
509
|
ready: boolean; setReady: (value: boolean) => void;
|
|
510
|
+
sidebarAvailable: boolean;
|
|
495
511
|
sidebarVisible: boolean; setSidebarVisible: (value: boolean) => void;
|
|
496
512
|
};
|
|
497
513
|
const Context = createContext<NavigationOwner | null>(null);
|
|
@@ -501,6 +517,7 @@ export function useAppNavigation(): NavigationOwner {
|
|
|
501
517
|
return owner;
|
|
502
518
|
}
|
|
503
519
|
export function AppNavigationProvider({ children }: { children: ReactNode }) {
|
|
520
|
+
const locale = navigator.language.toLowerCase().startsWith('zh') ? 'zh' : 'en';
|
|
504
521
|
const [navigation] = useState(createAppNavigation);
|
|
505
522
|
const [ready, updateReady] = useState(false);
|
|
506
523
|
const [sidebarVisible, setSidebarVisible] = useState(true);
|
|
@@ -516,7 +533,7 @@ export function AppNavigationProvider({ children }: { children: ReactNode }) {
|
|
|
516
533
|
if (!value) navigation.reset({ id: generatedInitialViewId ?? 'welcome' });
|
|
517
534
|
updateReady(value);
|
|
518
535
|
}, [navigation]);
|
|
519
|
-
return <Context.Provider value={{ navigation, ready, sidebarVisible, setSidebarVisible, setReady }}><NimiNavigationProvider controller={navigation}>{children}</NimiNavigationProvider></Context.Provider>;
|
|
536
|
+
return <Context.Provider value={{ navigation, locale, ready, sidebarAvailable: hasGeneratedViews, sidebarVisible, setSidebarVisible, setReady }}><NimiNavigationProvider controller={navigation}>{children}</NimiNavigationProvider></Context.Provider>;
|
|
520
537
|
}
|
|
521
538
|
`;
|
|
522
539
|
}
|
|
@@ -1335,6 +1352,7 @@ function renderDefaultTauriMain() {
|
|
|
1335
1352
|
function renderDefaultElectronMain(identity) {
|
|
1336
1353
|
return [
|
|
1337
1354
|
"import path from 'node:path';",
|
|
1355
|
+
"import { existsSync } from 'node:fs';",
|
|
1338
1356
|
"import { fileURLToPath, pathToFileURL } from 'node:url';",
|
|
1339
1357
|
"import { app, BrowserWindow, ipcMain, Menu, protocol, session, webContents } from 'electron';",
|
|
1340
1358
|
"import { configureNimiElectronAppHostProfile } from '@nimiplatform/kit/shell/electron/host-profile';",
|
|
@@ -1367,6 +1385,9 @@ function renderDefaultElectronMain(identity) {
|
|
|
1367
1385
|
' && __NIMI_ELECTRON_PRODUCTION__;',
|
|
1368
1386
|
"const currentDir = path.dirname(fileURLToPath(import.meta.url));",
|
|
1369
1387
|
"const appRoot = path.resolve(currentDir, '..');",
|
|
1388
|
+
"const appIconPath = path.join(currentDir, process.platform === 'win32' ? 'app-icon.ico' : process.platform === 'darwin' ? 'app-icon-macos.png' : 'app-icon.png');",
|
|
1389
|
+
"if (IS_PRODUCTION_BUNDLE && !existsSync(appIconPath)) throw new Error('Packaged App icon is missing.');",
|
|
1390
|
+
'const windowIcon = existsSync(appIconPath) ? appIconPath : undefined;',
|
|
1370
1391
|
"const preloadPath = path.join(currentDir, 'preload.cjs');",
|
|
1371
1392
|
"const productionRendererUrl = pathToFileURL(path.join(appRoot, 'dist', 'index.html')).toString();",
|
|
1372
1393
|
'const developmentRendererUrl = readDevelopmentRendererUrl();',
|
|
@@ -1376,7 +1397,9 @@ function renderDefaultElectronMain(identity) {
|
|
|
1376
1397
|
'let quitting = false;',
|
|
1377
1398
|
'',
|
|
1378
1399
|
`app.setName(${JSON.stringify(identity.appTitle)});`,
|
|
1379
|
-
'
|
|
1400
|
+
"if (process.platform === 'win32') {",
|
|
1401
|
+
' app.setAppUserModelId(IS_PRODUCTION_BUNDLE ? NATIVE_BUNDLE_IDENTIFIER : `ai.nimi.dev.apps.${APP_ID}`);',
|
|
1402
|
+
'}',
|
|
1380
1403
|
'const chromeHost = createNimiElectronAppChromeHost({',
|
|
1381
1404
|
` metadata: { name: ${JSON.stringify(identity.appTitle)}, version: ${JSON.stringify(identity.version)} },`,
|
|
1382
1405
|
' allowedRendererUrls, app,',
|
|
@@ -1385,6 +1408,7 @@ function renderDefaultElectronMain(identity) {
|
|
|
1385
1408
|
'registerNimiElectronAppAssetProtocolScheme(protocol);',
|
|
1386
1409
|
'',
|
|
1387
1410
|
'void app.whenReady().then(async () => {',
|
|
1411
|
+
" if (process.platform === 'darwin' && !IS_PRODUCTION_BUNDLE && windowIcon) app.dock?.setIcon(windowIcon);",
|
|
1388
1412
|
' registerNimiElectronAppBridge({',
|
|
1389
1413
|
' chromeHost,',
|
|
1390
1414
|
' appId: APP_ID,',
|
|
@@ -1426,6 +1450,7 @@ function renderDefaultElectronMain(identity) {
|
|
|
1426
1450
|
' minWidth: 360,',
|
|
1427
1451
|
' minHeight: 560,',
|
|
1428
1452
|
` title: ${JSON.stringify(identity.appTitle)},`,
|
|
1453
|
+
' icon: windowIcon,',
|
|
1429
1454
|
' autoHideMenuBar: true,',
|
|
1430
1455
|
' webPreferences: {',
|
|
1431
1456
|
' preload: preloadPath,',
|
package/lib/app-scaffold.mjs
CHANGED
|
@@ -46,7 +46,7 @@ export const SCAFFOLD_LOCK_PATH = `${SCAFFOLD_STATE_DIR}/lock.json`;
|
|
|
46
46
|
export const SCAFFOLD_TEMPLATE_LICENSE_NOTICE_PATH = 'licenses/nimi-app-template.txt';
|
|
47
47
|
// Files that earlier scaffold versions managed and that now belong to the App.
|
|
48
48
|
// Sync records the new owner and leaves the existing file exactly as it is.
|
|
49
|
-
export const SCAFFOLD_APP_OWNED_HANDOVER_PATHS = Object.freeze(['LICENSE']);
|
|
49
|
+
export const SCAFFOLD_APP_OWNED_HANDOVER_PATHS = Object.freeze(['LICENSE', 'README.md', 'SECURITY.md']);
|
|
50
50
|
const TEMPLATE_LICENSE_COPYRIGHT_LINE = /^Copyright \(c\) (\d{4}) \S.*$/gmu;
|
|
51
51
|
const TEMPLATE_LICENSE_NOTICE_HEADER = [
|
|
52
52
|
'Nimi App template notice',
|
|
@@ -621,6 +621,7 @@ function buildPackageJson(profile, versions, identity) {
|
|
|
621
621
|
'@vitejs/plugin-react': versions.viteReactPluginVersion,
|
|
622
622
|
electron: versions.electronVersion,
|
|
623
623
|
esbuild: versions.esbuildVersion,
|
|
624
|
+
pngjs: versions.pngjsVersion,
|
|
624
625
|
tailwindcss: versions.tailwindcssVersion,
|
|
625
626
|
typescript: versions.typescriptVersion,
|
|
626
627
|
vite: versions.viteVersion,
|
|
@@ -707,9 +708,9 @@ function buildCargoDependencies(profile, versions, capabilityResolution) {
|
|
|
707
708
|
serde: { version: '1', features: ['derive'] },
|
|
708
709
|
serde_json: '1',
|
|
709
710
|
url: '2',
|
|
710
|
-
base64: '0.
|
|
711
|
-
dirs: '
|
|
712
|
-
time: '=0.3.
|
|
711
|
+
base64: '0.23',
|
|
712
|
+
dirs: '7',
|
|
713
|
+
time: '=0.3.55',
|
|
713
714
|
'tauri-build': { version: '2', features: [] },
|
|
714
715
|
};
|
|
715
716
|
for (const [name, value] of Object.entries(capabilityResolution.cargoDependencies || {})) {
|
|
@@ -898,7 +899,6 @@ function buildNimiAppManifest(identity) {
|
|
|
898
899
|
metadata: {
|
|
899
900
|
summary: '',
|
|
900
901
|
icon: 'assets/app-icon.png',
|
|
901
|
-
readme: 'README.md',
|
|
902
902
|
release_notes: 'RELEASE_NOTES.md',
|
|
903
903
|
},
|
|
904
904
|
local_development: {
|
|
@@ -1382,6 +1382,7 @@ function buildDependencyMatrix(profile, versions, capabilityResolution) {
|
|
|
1382
1382
|
'@electron/packager': versions.electronPackagerVersion,
|
|
1383
1383
|
electron: versions.electronVersion,
|
|
1384
1384
|
esbuild: versions.esbuildVersion,
|
|
1385
|
+
pngjs: versions.pngjsVersion,
|
|
1385
1386
|
yaml: versions.yamlVersion,
|
|
1386
1387
|
},
|
|
1387
1388
|
cargo: buildCargoDependencies(profile, versions, capabilityResolution),
|