@nimiplatform/app-tools 0.5.3 → 0.6.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 +31 -2
- package/bin/nimi-app.mjs +2 -1
- package/lib/app-doctor-update.mjs +46 -11
- package/lib/app-pack.mjs +2 -1
- package/lib/app-project-lifecycle.mjs +15 -14
- package/package.json +5 -5
- package/skills/nimi-app-lifecycle/SKILL.md +1 -1
- package/skills/nimi-app-lifecycle/references/adapt.md +11 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ repository. `nimi-app --help` prints its resolved location. Installation does
|
|
|
15
15
|
not activate instructions; explicit init/sync maintains the project skill under
|
|
16
16
|
`.agents/skills/nimi-app-lifecycle/` and an independent AGENTS.md block.
|
|
17
17
|
|
|
18
|
-
Prepare the existing App's actual pnpm/
|
|
18
|
+
Prepare the existing App's actual renderer, pnpm/Electron supervised Host
|
|
19
19
|
and build/test scripts first. Init does not convert a server framework, invent
|
|
20
20
|
tests or replace product UI. Install the selected app-tools and the exact
|
|
21
21
|
nimi-coding version declared in its `nimiScaffoldVersions`, then preview:
|
|
@@ -42,7 +42,7 @@ For an App whose named scripts are already implemented, an input is:
|
|
|
42
42
|
"local_development": { "electron": { "renderer_origin": "http://127.0.0.1:1466" } }
|
|
43
43
|
},
|
|
44
44
|
"build_profile": {
|
|
45
|
-
|
|
45
|
+
"build_profile_ref": "electron-packager-pnpm-vite", "profile_role": "developer-workflow-input",
|
|
46
46
|
"test_command": "pnpm run test:app", "build_command": "pnpm run build:electron:production",
|
|
47
47
|
"targets": {
|
|
48
48
|
"windows-x86_64": {
|
|
@@ -62,6 +62,26 @@ existing Host, business code, README and license remain App-owned. Adoption
|
|
|
62
62
|
creates no fresh scaffold intent/lock. Init validates output declarations;
|
|
63
63
|
build/pack later verify actual payloads.
|
|
64
64
|
|
|
65
|
+
An existing Next.js or other renderer can use `build_profile_ref: electron-pnpm`
|
|
66
|
+
with its real test/build commands and target outputs. Declare `dev:renderer` in
|
|
67
|
+
`package.json`, for example `next dev --hostname 127.0.0.1 --port 1466`, matching
|
|
68
|
+
the manifest's loopback origin. Init/sync preserve the command for this profile. The App
|
|
69
|
+
owns the renderer and any required local backend; `build:electron` produces the
|
|
70
|
+
supervised Host at `dist-electron/main.js`. Fresh scaffolds keep their generated
|
|
71
|
+
Vite recipe and existing `electron-packager-pnpm-vite` profiles remain supported.
|
|
72
|
+
When Host sources are outside `src-electron`, declare their existing relative
|
|
73
|
+
directory as `local_development.electron.host_source_directory` in `nimi.app.yaml`
|
|
74
|
+
(for example `electron`). Desktop validates that directory before launch and
|
|
75
|
+
watches it for Host rebuilds; init/sync preserve this App-owned declaration.
|
|
76
|
+
Real development requires a Desktop version that accepts App-owned renderer
|
|
77
|
+
commands; older Desktop versions enforcing Vite reject this project even after
|
|
78
|
+
app-tools validation passes. Do not introduce a Vite placeholder to bypass it.
|
|
79
|
+
|
|
80
|
+
Use the selected package's `nimiScaffoldVersions` declarations in `package.json`
|
|
81
|
+
and commit the matching lockfile to pin resolved versions. A matrix range in the
|
|
82
|
+
manifest does not require an automatic upgrade; install with the frozen lockfile
|
|
83
|
+
until deliberately selecting and synchronizing a new component combination.
|
|
84
|
+
|
|
65
85
|
`init --dry-run --json` and `sync --dry-run --json` show app-tools file/field
|
|
66
86
|
changes without writes, installation or owner mutation. The separate
|
|
67
87
|
nimi-coding step and expected version are listed without simulating its internals.
|
|
@@ -139,6 +159,15 @@ pnpm dev
|
|
|
139
159
|
|
|
140
160
|
`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.
|
|
141
161
|
|
|
162
|
+
Every `build`, including non-production builds, requires the selected target's
|
|
163
|
+
declared payload and exact Runtime entry to exist after its owner command exits
|
|
164
|
+
successfully. Building a macOS payload cannot report success for a missing
|
|
165
|
+
Windows target. The default recipes build for their host platform; use the
|
|
166
|
+
matching build host or provide a real App-owned build command. This file check
|
|
167
|
+
does not prove executable architecture or signing: production App information
|
|
168
|
+
is checked with `--production`, and native package facts are verified by
|
|
169
|
+
`pack --production`.
|
|
170
|
+
|
|
142
171
|
To continue an existing development App and its data, select a registration explicitly:
|
|
143
172
|
|
|
144
173
|
```bash
|
package/bin/nimi-app.mjs
CHANGED
|
@@ -222,7 +222,8 @@ function printUsage() {
|
|
|
222
222
|
' create -> dependency install -> init -> sync -> check -> dev/test/build -> pack',
|
|
223
223
|
' Run init and later commands only after dependency installation.',
|
|
224
224
|
` Before init, read the packaged lifecycle skill: ${LIFECYCLE_SKILL_PATH}`,
|
|
225
|
-
' Existing adoption requires
|
|
225
|
+
' Existing adoption requires pnpm, a supervised Electron Host, an App-owned renderer command and real build/test inputs.',
|
|
226
|
+
' Use electron-pnpm for an existing renderer framework; no fresh scaffold lock is created.',
|
|
226
227
|
'',
|
|
227
228
|
'Development CDP:',
|
|
228
229
|
' Electron CDP defaults to an automatically selected loopback port.',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APP_AUTHOR_DECLARATION_FIELDS, hashScaffoldManagedContent } from './app-scaffold.mjs';
|
|
2
|
-
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
2
|
+
import { existsSync, readdirSync, readFileSync, realpathSync, statSync } from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
|
|
5
5
|
import {
|
|
@@ -89,10 +89,9 @@ const LOCAL_DEVELOPMENT_BYPASS_LABELS = new Set([
|
|
|
89
89
|
'Realm refresh bypass endpoint',
|
|
90
90
|
'Realm permission grant REST bypass endpoint',
|
|
91
91
|
'Realm raw request bypass',
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
'OpenAI-compatible Runtime REST endpoint assumption',
|
|
92
|
+
// Existing Apps own ordinary HTTP routes and may retain vendor sources.
|
|
93
|
+
// A bare /api or /v1 URL does not identify Nimi Realm/Runtime authority.
|
|
94
|
+
// Those broad patterns remain applicable to our generated scaffold only.
|
|
96
95
|
'app-owned session store',
|
|
97
96
|
'app-owned refresh token provider',
|
|
98
97
|
'app-owned protected Runtime gRPC client',
|
|
@@ -444,7 +443,15 @@ function assertRequiredSupportFiles(targetDir, snapshot) {
|
|
|
444
443
|
}
|
|
445
444
|
}
|
|
446
445
|
|
|
447
|
-
function
|
|
446
|
+
function usesAppOwnedRenderer(targetDir, plannedSources) {
|
|
447
|
+
const relativePath = '.nimi/config/build-profile.yaml';
|
|
448
|
+
const filePath = path.join(targetDir, relativePath);
|
|
449
|
+
const source = plannedSources?.get(relativePath)
|
|
450
|
+
?? (existsSync(filePath) ? readFileSync(filePath, 'utf8') : undefined);
|
|
451
|
+
return source !== undefined && parseYaml(source)?.build_profile_ref === 'electron-pnpm';
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function assertProjectConfiguration(targetDir, parsedManifest = null, managed = true) {
|
|
448
455
|
const manifestPath = path.join(targetDir, 'nimi.app.yaml');
|
|
449
456
|
const manifest = readFileSync(manifestPath, 'utf8');
|
|
450
457
|
assertManifestAppAccessDeclaration(manifest, manifestPath);
|
|
@@ -457,10 +464,17 @@ function assertProjectConfiguration(targetDir, parsedManifest = null) {
|
|
|
457
464
|
}
|
|
458
465
|
}
|
|
459
466
|
const rendererOrigin = assertElectronLocalDevelopmentManifest(document);
|
|
460
|
-
|
|
467
|
+
assertDeclaredHostSourceDirectory(targetDir, document);
|
|
468
|
+
assertOfficialDevelopmentEntrypoints(targetDir, rendererOrigin, undefined, managed || !usesAppOwnedRenderer(targetDir));
|
|
461
469
|
}
|
|
462
470
|
|
|
463
471
|
function assertElectronLocalDevelopmentManifest(document) {
|
|
472
|
+
const sourceDirectory = document?.local_development?.electron?.host_source_directory;
|
|
473
|
+
if (sourceDirectory !== undefined && (typeof sourceDirectory !== 'string'
|
|
474
|
+
|| sourceDirectory.trim() !== sourceDirectory || /[\\:\r\n\0]/u.test(sourceDirectory)
|
|
475
|
+
|| sourceDirectory.split('/').some((segment) => !segment || segment === '.' || segment === '..'))) {
|
|
476
|
+
throw new Error('nimi.app.yaml local_development.electron.host_source_directory must be a canonical project-relative directory');
|
|
477
|
+
}
|
|
464
478
|
const rendererOrigin = document?.local_development?.electron?.renderer_origin;
|
|
465
479
|
if (typeof rendererOrigin !== 'string' || rendererOrigin.trim() !== rendererOrigin) {
|
|
466
480
|
throw new Error('nimi.app.yaml must declare local_development.electron.renderer_origin');
|
|
@@ -487,7 +501,21 @@ function assertElectronLocalDevelopmentManifest(document) {
|
|
|
487
501
|
return parsed.origin;
|
|
488
502
|
}
|
|
489
503
|
|
|
490
|
-
function
|
|
504
|
+
function assertDeclaredHostSourceDirectory(targetDir, document) {
|
|
505
|
+
const relative = document?.local_development?.electron?.host_source_directory;
|
|
506
|
+
if (relative === undefined) return;
|
|
507
|
+
try {
|
|
508
|
+
const root = realpathSync(targetDir);
|
|
509
|
+
const source = realpathSync(path.join(root, relative));
|
|
510
|
+
const contained = path.relative(root, source);
|
|
511
|
+
if (!contained || contained === '..' || contained.startsWith(`..${path.sep}`)
|
|
512
|
+
|| path.isAbsolute(contained) || !statSync(source).isDirectory()) throw new Error('outside project');
|
|
513
|
+
} catch {
|
|
514
|
+
throw new Error('nimi.app.yaml local_development.electron.host_source_directory must exist inside this project');
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
function assertOfficialDevelopmentEntrypoints(targetDir, rendererOrigin, packageJson = readJsonFile(path.join(targetDir, 'package.json'), 'package.json'), managed = true) {
|
|
491
519
|
const scripts = packageJson?.scripts;
|
|
492
520
|
if (!scripts || typeof scripts !== 'object' || Array.isArray(scripts)) {
|
|
493
521
|
throw new Error('package.json scripts are required');
|
|
@@ -496,13 +524,19 @@ function assertOfficialDevelopmentEntrypoints(targetDir, rendererOrigin, package
|
|
|
496
524
|
const required = {
|
|
497
525
|
dev: 'nimi-app dev --shell electron',
|
|
498
526
|
'dev:shell': 'nimi-app dev',
|
|
499
|
-
'dev:renderer': `vite --host 127.0.0.1 --port ${rendererPort} --strictPort
|
|
527
|
+
...(managed ? { 'dev:renderer': `vite --host 127.0.0.1 --port ${rendererPort} --strictPort` } : {}),
|
|
500
528
|
};
|
|
501
529
|
for (const [name, command] of Object.entries(required)) {
|
|
502
530
|
if (scripts[name] !== command) {
|
|
503
531
|
throw new Error(`package.json ${name} must use the official local-development launcher: ${command}`);
|
|
504
532
|
}
|
|
505
533
|
}
|
|
534
|
+
const rendererCommand = scripts['dev:renderer'];
|
|
535
|
+
if (typeof rendererCommand !== 'string' || !rendererCommand || rendererCommand.trim() !== rendererCommand
|
|
536
|
+
|| /[\r\n\0]/u.test(rendererCommand)
|
|
537
|
+
|| /\b(?:nimi-app\s+dev|(?:pnpm|npm)\s+(?:run\s+)?(?:dev|dev:renderer))(?=\s|$)/u.test(rendererCommand)) {
|
|
538
|
+
throw new Error('package.json dev:renderer must be a non-recursive App-owned renderer command for the declared loopback origin');
|
|
539
|
+
}
|
|
506
540
|
if (
|
|
507
541
|
typeof scripts['build:electron'] !== 'string'
|
|
508
542
|
|| scripts['build:electron'].trim() !== scripts['build:electron']
|
|
@@ -537,7 +571,8 @@ function assertNimicodingProjectionCurrent(targetDir, runners) {
|
|
|
537
571
|
export function validateAppProjectInputs(targetDir, manifest, packageJson, managed = false, plannedSources) {
|
|
538
572
|
assertManifestAppAccessDeclaration(stringifyYaml(manifest), 'nimi.app.yaml');
|
|
539
573
|
const rendererOrigin = assertElectronLocalDevelopmentManifest(manifest);
|
|
540
|
-
|
|
574
|
+
assertDeclaredHostSourceDirectory(targetDir, manifest);
|
|
575
|
+
assertOfficialDevelopmentEntrypoints(targetDir, rendererOrigin, packageJson, managed || !usesAppOwnedRenderer(targetDir, plannedSources));
|
|
541
576
|
const findings = scanForbiddenPatterns(targetDir, manifest.profile, managed ? null : LOCAL_DEVELOPMENT_BYPASS_LABELS, plannedSources);
|
|
542
577
|
if (findings.length) throw new Error(`Forbidden App source patterns: ${findings.join('; ')}`);
|
|
543
578
|
}
|
|
@@ -615,7 +650,7 @@ function validateExistingSubmittedApp(targetDir) {
|
|
|
615
650
|
if (parsed?.manifest_role !== 'submitted-input') {
|
|
616
651
|
throw new Error('Submitted manifest marker missing');
|
|
617
652
|
}
|
|
618
|
-
assertProjectConfiguration(targetDir, parsed);
|
|
653
|
+
assertProjectConfiguration(targetDir, parsed, false);
|
|
619
654
|
const forbiddenFindings = scanForbiddenPatterns(targetDir, profile, LOCAL_DEVELOPMENT_BYPASS_LABELS);
|
|
620
655
|
if (forbiddenFindings.length > 0) {
|
|
621
656
|
throw new Error(`Forbidden local-development bypasses detected: ${forbiddenFindings.join('; ')}`);
|
package/lib/app-pack.mjs
CHANGED
|
@@ -27,6 +27,7 @@ const TARGET_METADATA_FORMAT = 'nimi.app-target-candidate/v1';
|
|
|
27
27
|
const AGGREGATE_FORMAT = 'nimi.app-release-candidate/v1';
|
|
28
28
|
const BUILD_PROFILE_PATH = '.nimi/config/build-profile.yaml';
|
|
29
29
|
const ELECTRON_BUILD_PROFILE_REF = 'electron-packager-pnpm-vite';
|
|
30
|
+
const APP_OWNED_ELECTRON_BUILD_PROFILE_REF = 'electron-pnpm';
|
|
30
31
|
const TAURI_BUILD_PROFILE_REF = 'tauri-pnpm-vite';
|
|
31
32
|
const OUTPUT_DIR = 'dist/nimi-app';
|
|
32
33
|
const SEMVER_PATTERN = /^(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?(?:\+[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?$/u;
|
|
@@ -282,7 +283,7 @@ function readPackInputs(targetDir, targetId) {
|
|
|
282
283
|
const appInfo = readAppInfo(targetDir, targetId);
|
|
283
284
|
const buildProfile = readYaml(path.join(targetDir, BUILD_PROFILE_PATH), BUILD_PROFILE_PATH);
|
|
284
285
|
const buildProfileRef = buildProfile.build_profile_ref;
|
|
285
|
-
if (
|
|
286
|
+
if (![ELECTRON_BUILD_PROFILE_REF, APP_OWNED_ELECTRON_BUILD_PROFILE_REF, TAURI_BUILD_PROFILE_REF].includes(buildProfileRef)) {
|
|
286
287
|
throw new Error(`${BUILD_PROFILE_PATH} build_profile_ref is unsupported: ${String(buildProfileRef)}`);
|
|
287
288
|
}
|
|
288
289
|
const requiresTauri = buildProfileRef === TAURI_BUILD_PROFILE_REF;
|
|
@@ -42,8 +42,9 @@ const SYNCHRONIZED_NIMI_PACKAGES = new Set([
|
|
|
42
42
|
]);
|
|
43
43
|
const BUILD_PROFILE_PATH = '.nimi/config/build-profile.yaml';
|
|
44
44
|
const ELECTRON_BUILD_PROFILE_REF = 'electron-packager-pnpm-vite';
|
|
45
|
+
const APP_OWNED_ELECTRON_BUILD_PROFILE_REF = 'electron-pnpm';
|
|
45
46
|
const TAURI_BUILD_PROFILE_REF = 'tauri-pnpm-vite';
|
|
46
|
-
const SUPPORTED_BUILD_PROFILE_REFS = new Set([ELECTRON_BUILD_PROFILE_REF, TAURI_BUILD_PROFILE_REF]);
|
|
47
|
+
const SUPPORTED_BUILD_PROFILE_REFS = new Set([ELECTRON_BUILD_PROFILE_REF, APP_OWNED_ELECTRON_BUILD_PROFILE_REF, TAURI_BUILD_PROFILE_REF]);
|
|
47
48
|
const MANAGED_WORKFLOW_PATH = '.github/workflows/nimi-app-release.yml';
|
|
48
49
|
const APP_IDENTITY_PATH = '.nimi/config/app-identity.yaml';
|
|
49
50
|
const SUBMISSION_PATH = '.nimi/admission/submission.yaml';
|
|
@@ -250,7 +251,7 @@ function assertPackageManifestCurrent(packageJson, versions) {
|
|
|
250
251
|
}
|
|
251
252
|
}
|
|
252
253
|
|
|
253
|
-
function normalizePackageManifest(packageJson, descriptor, versions) {
|
|
254
|
+
function normalizePackageManifest(packageJson, descriptor, versions, buildProfileRef) {
|
|
254
255
|
if (!packageJson || typeof packageJson !== 'object' || Array.isArray(packageJson)) {
|
|
255
256
|
throw new Error('package.json must contain an object');
|
|
256
257
|
}
|
|
@@ -283,7 +284,9 @@ function normalizePackageManifest(packageJson, descriptor, versions) {
|
|
|
283
284
|
normalized.scripts.dev = 'nimi-app dev --shell electron';
|
|
284
285
|
normalized.scripts['dev:shell'] = 'nimi-app dev';
|
|
285
286
|
normalized.scripts['dev:electron'] = 'nimi-app dev --shell electron';
|
|
286
|
-
|
|
287
|
+
if (buildProfileRef !== APP_OWNED_ELECTRON_BUILD_PROFILE_REF) {
|
|
288
|
+
normalized.scripts['dev:renderer'] = `vite --host 127.0.0.1 --port ${new URL(descriptor.rendererOrigin).port} --strictPort`;
|
|
289
|
+
}
|
|
287
290
|
normalized.scripts.sync ||= 'nimi-app sync';
|
|
288
291
|
normalized.scripts.pack = 'nimi-app pack';
|
|
289
292
|
delete normalized.scripts.publish;
|
|
@@ -897,12 +900,12 @@ function selectBuildOwner(profile, requestedTarget) {
|
|
|
897
900
|
return { target, command, payloadPath, runtimeEntry };
|
|
898
901
|
}
|
|
899
902
|
|
|
900
|
-
function
|
|
903
|
+
function assertBuiltRuntimeEntry(targetDir, selected) {
|
|
901
904
|
const projectRoot = path.resolve(targetDir);
|
|
902
905
|
const payloadPath = path.resolve(projectRoot, ...selected.payloadPath.split('/'));
|
|
903
906
|
const projectPrefix = `${projectRoot}${path.sep}`;
|
|
904
907
|
if (!payloadPath.startsWith(projectPrefix) || !existsSync(payloadPath)) {
|
|
905
|
-
throw new Error(`
|
|
908
|
+
throw new Error(`Build payload is missing or noncanonical: ${selected.payloadPath}`);
|
|
906
909
|
}
|
|
907
910
|
const payloadStat = lstatSync(payloadPath);
|
|
908
911
|
let runtimeTarget = payloadPath;
|
|
@@ -910,20 +913,20 @@ function assertProductionRuntimeEntry(targetDir, selected) {
|
|
|
910
913
|
const runtimeRelative = selected.runtimeEntry.slice('payload/'.length);
|
|
911
914
|
runtimeTarget = path.resolve(payloadPath, ...runtimeRelative.split('/'));
|
|
912
915
|
} else if (payloadStat.isFile() && selected.runtimeEntry !== `payload/${path.basename(payloadPath)}`) {
|
|
913
|
-
throw new Error(`
|
|
916
|
+
throw new Error(`Build Runtime entry does not select the direct payload file: ${selected.runtimeEntry}`);
|
|
914
917
|
} else if (!payloadStat.isFile() || payloadStat.isSymbolicLink()) {
|
|
915
|
-
throw new Error(`
|
|
918
|
+
throw new Error(`Build payload is not a direct file or directory: ${selected.payloadPath}`);
|
|
916
919
|
}
|
|
917
920
|
const payloadPrefix = `${payloadPath}${path.sep}`;
|
|
918
921
|
if (
|
|
919
922
|
!existsSync(runtimeTarget)
|
|
920
923
|
|| (!payloadStat.isFile() && !runtimeTarget.startsWith(payloadPrefix))
|
|
921
924
|
) {
|
|
922
|
-
throw new Error(`
|
|
925
|
+
throw new Error(`Build Runtime entry is missing or noncanonical: ${selected.runtimeEntry}`);
|
|
923
926
|
}
|
|
924
927
|
const runtimeTargetStat = lstatSync(runtimeTarget);
|
|
925
928
|
if (!runtimeTargetStat.isFile() || runtimeTargetStat.isSymbolicLink()) {
|
|
926
|
-
throw new Error(`
|
|
929
|
+
throw new Error(`Build Runtime entry must be a direct regular file: ${selected.runtimeEntry}`);
|
|
927
930
|
}
|
|
928
931
|
}
|
|
929
932
|
|
|
@@ -993,7 +996,7 @@ function buildExistingSubmittedAppSyncPlan(targetDir, versions, sources) {
|
|
|
993
996
|
author: typeof files.packageJson.author === 'string' ? files.packageJson.author : '',
|
|
994
997
|
};
|
|
995
998
|
const planned = [
|
|
996
|
-
{ path: files.packagePath, content: normalizePackageManifest(files.packageJson, descriptor, versions), previous: files.packageSource },
|
|
999
|
+
{ path: files.packagePath, content: normalizePackageManifest(files.packageJson, descriptor, versions, buildProfile.buildProfileRef), previous: files.packageSource },
|
|
997
1000
|
];
|
|
998
1001
|
if (requiresTauri) {
|
|
999
1002
|
planned.push(
|
|
@@ -1202,7 +1205,7 @@ export function adoptAppProject(cwd, options = {}, versions, runners = {}) {
|
|
|
1202
1205
|
} catch (cause) {
|
|
1203
1206
|
throw new Error(`${cause.message}. Prepare the real App-owned Host and build/test inputs using ${LIFECYCLE_SKILL_PATH}`, { cause });
|
|
1204
1207
|
}
|
|
1205
|
-
if (plan.buildProfileRef
|
|
1208
|
+
if (![ELECTRON_BUILD_PROFILE_REF, APP_OWNED_ELECTRON_BUILD_PROFILE_REF].includes(plan.buildProfileRef)) throw new Error('Existing-App init supports electron-pnpm and electron-packager-pnpm-vite; existing Tauri projects retain their sync path.');
|
|
1206
1209
|
const files = readProjectLifecycleFiles(targetDir, plan.buildProfileRef);
|
|
1207
1210
|
const profile = readBuildProfile(targetDir, sources);
|
|
1208
1211
|
for (const command of [profile.testCommand, profile.buildCommand, ...Object.keys(profile.targets).map((target) => selectBuildOwner(profile, target).command)]) {
|
|
@@ -1271,9 +1274,7 @@ export function buildAppProject(cwd, options = {}, runners = {}) {
|
|
|
1271
1274
|
const selected = selectBuildOwner(profile, options.target);
|
|
1272
1275
|
if (options.production === true) readAppInfo(targetDir, selected.target);
|
|
1273
1276
|
const result = runOwnerCommand(targetDir, 'build', selected.command, options, runners);
|
|
1274
|
-
|
|
1275
|
-
assertProductionRuntimeEntry(targetDir, selected);
|
|
1276
|
-
}
|
|
1277
|
+
assertBuiltRuntimeEntry(targetDir, selected);
|
|
1277
1278
|
return emitResult({
|
|
1278
1279
|
ok: true,
|
|
1279
1280
|
command: 'build',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimiplatform/app-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Public app-authoring CLI for Nimi App projects.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"provenance": true
|
|
19
19
|
},
|
|
20
20
|
"nimiScaffoldVersions": {
|
|
21
|
-
"sdkVersion": "^0.
|
|
22
|
-
"appToolsVersion": "^0.
|
|
21
|
+
"sdkVersion": "^0.13.0",
|
|
22
|
+
"appToolsVersion": "^0.6.0",
|
|
23
23
|
"nimicodingVersion": "0.6.3",
|
|
24
24
|
"aiSdkVersion": "^6.0.85",
|
|
25
|
-
"kitVersion": "^0.
|
|
25
|
+
"kitVersion": "^0.9.0",
|
|
26
26
|
"reactVersion": "^19.2.8",
|
|
27
27
|
"reactDomVersion": "^19.2.8",
|
|
28
28
|
"i18nextVersion": "^25.10.10",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"tailwindcssViteVersion": "^4.3.3",
|
|
39
39
|
"tauriCliVersion": "^2.11.4",
|
|
40
40
|
"yamlVersion": "^2.9.0",
|
|
41
|
-
"nimiShellTauriVersion": "0.
|
|
41
|
+
"nimiShellTauriVersion": "0.5.0",
|
|
42
42
|
"electronPackagerVersion": "^20.3.0",
|
|
43
43
|
"electronVersion": "^42.10.1",
|
|
44
44
|
"esbuildVersion": "^0.28.2",
|
|
@@ -21,7 +21,7 @@ For an ordinary product edit, follow its existing code and tests. Do not reiniti
|
|
|
21
21
|
## Boundaries that matter
|
|
22
22
|
|
|
23
23
|
- App-owned workflows, tool handlers, business accounts, non-AI services and product presentation stay with the App. Nimi AI, configuration, managed storage and protected sessions use public SDK/Kit Local App surfaces. Display identity is not a business login ticket.
|
|
24
|
-
-
|
|
24
|
+
- Fresh Apps use pnpm, Vite and Desktop-supervised Electron. Existing Apps may use another renderer framework with an App-owned development command and the `electron-pnpm` build profile. A Next/server or Python project still needs real Host and backend lifecycle/build work. Preserve its original user tasks and framework where they fit; initialization does not convert the product.
|
|
25
25
|
- Read the selected app-tools package's `nimiScaffoldVersions` and the SDK/Kit migration notes. Public Apps use published registry dependencies. Private platform experiments are not public installation evidence.
|
|
26
26
|
- App Tools maintains its fixed lifecycle skill, AGENTS block and declared engineering projections. Existing Apps have no fresh scaffold intent/lock. Preserve their Host, product source and license; report unknown file collisions rather than inventing ownership.
|
|
27
27
|
- GitHub owns publisher builds and Releases; Registry owns candidate validation and human admission; Runtime owns packages and App access; Desktop owns exact processes. These are separate facts. The external AI host owns the development task.
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Before changing code, identify the upstream URL and baseline commit, license, user journeys, actual AI/auth/storage entry points, business services, helper processes and active instruction loaders. Record a short upstream/range note in the existing App README or product document; do not create another integration state file.
|
|
4
4
|
|
|
5
|
-
Install a selected published app-tools package and read this package skill before init. Install its matching SDK/Kit and exact nimi-coding. Prepare actual
|
|
5
|
+
Install a selected published app-tools package and read this package skill before init. Install its matching SDK/Kit and exact nimi-coding. Follow the package's manifest version matrix and use the lockfile to pin actual resolutions. Prepare the actual pnpm/Electron Host, renderer and test/production-build commands; do not make init manufacture a test success or convert a server deployment implicitly.
|
|
6
|
+
|
|
7
|
+
For a Next.js or other existing renderer, declare the framework-neutral `electron-pnpm` build profile and a real `dev:renderer` package script serving the manifest's loopback origin. Init/sync preserve that command and the App's build owners. The official `dev` launcher still asks Desktop to supervise the Host; `build:electron` must produce `dist-electron/main.js`. Keep any required local backend under App lifecycle management. A Desktop that still requires the old exact Vite command must be upgraded before this project's real launch; do not add an empty Vite server or lose server routes to pass checks.
|
|
8
|
+
|
|
9
|
+
If Host sources live outside the scaffold's `src-electron`, declare the actual project-relative directory in `nimi.app.yaml` as `local_development.electron.host_source_directory` (for example `electron`). The directory must exist inside the project. Desktop validates it before launch and watches it for Host rebuilds; init/sync retain it. Keep the upstream source layout instead of adding a placeholder directory.
|
|
6
10
|
|
|
7
11
|
Use `pnpm exec nimi-app init --adopt --dry-run --json`, then apply without `--dry-run` once the changes fit the authorized scope. Existing nimi.app.yaml and `.nimi/config/build-profile.yaml` are the inputs. If either is absent, supply `--input <json-path>` with only `manifest` and/or `build_profile`, using their existing schemas from the app-tools README. A file under `.nimi/local/` is sufficient. Input supplied alongside an existing file must agree with it. Target paths are declarations at init; build/pack later verify real artifacts.
|
|
8
12
|
|
|
@@ -12,8 +16,14 @@ Review the exact dependency, dev/renderer/pack script and workflow changes. Exis
|
|
|
12
16
|
|
|
13
17
|
- Renderer code can use `createNimiClient` with Kit's `createNimiLocalAppStandardShellSurface`. Node business work uses `registerNimiElectronAppBridge(...).services` from the same protected Host, fixed app commands and session invalidation callbacks. Consult the installed SDK/Kit public types for exact inputs.
|
|
14
18
|
- Keep the App's tool loop, IDs, ordered tool results and any opaque continuity needed in subsequent turns. An SDK model step does not run business callbacks.
|
|
19
|
+
- For an existing Vercel AI SDK 6 App, use the matching independent `@nimiplatform/sdk-adapter-vercel-ai` package and its Host-bound Local App factory. Read its README for image upload and complete UI message metadata; keep `useChat`/`streamText` and App-owned tools instead of rebuilding their wire protocol inside the App.
|
|
15
20
|
- Preserve Runtime-issued embedding space across batches; do not combine incompatible results. Carry cancellation and session invalidation into outstanding work and prevent late writes to a new session.
|
|
16
21
|
- Local media helpers receive bounded business inputs and an explicit environment; they do not receive Nimi credentials or a generic protected forwarding endpoint.
|
|
17
22
|
- Non-AI services, such as search engines, stay App-owned with honest setup requirements. Do not turn all external HTTP into an AI bypass finding.
|
|
18
23
|
|
|
24
|
+
For an existing App, a generic `/api/...` route or provider `/v1/...` URL alone
|
|
25
|
+
does not prove a Nimi Realm/Runtime bypass. The checker retains explicit
|
|
26
|
+
protected-custody/private-import checks; review actual product call paths to
|
|
27
|
+
establish Nimi AI routing. Do not edit vendor code just to remove a keyword.
|
|
28
|
+
|
|
19
29
|
Separate development instructions from product-operation guides, including other host entry files actually used by the repository. Upstream supplier examples may remain as knowledge; check the active product/agent route instead of deleting by keyword. Keep unimplemented original workflows explicit rather than counting a visible menu or retained source as completion.
|