@nimiplatform/app-tools 0.1.0 → 0.1.2
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 +3 -2
- package/lib/app-doctor-update.mjs +16 -0
- package/lib/app-scaffold.mjs +115 -9
- package/lib/index.mjs +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,8 +10,9 @@ pnpm dlx @nimiplatform/app-tools nimi-app update --dir path/to/app
|
|
|
10
10
|
|
|
11
11
|
`nimi-app create` emits a publishable Tauri app-authoring scaffold. The
|
|
12
12
|
generated project is designed to install its own dependencies with
|
|
13
|
-
`pnpm install`, run local checks, produce a
|
|
14
|
-
and remain directly usable without
|
|
13
|
+
`pnpm install`, run with `pnpm dev:shell`, run local checks, produce a
|
|
14
|
+
developer-submitted Nimi listing packet, and remain directly usable without
|
|
15
|
+
hand-editing scaffold-managed glue.
|
|
15
16
|
|
|
16
17
|
`nimi-app doctor` verifies scaffold lock state, managed glue, package-owned
|
|
17
18
|
projections, dependency alignment, and forbidden shortcut patterns in a source
|
|
@@ -210,6 +210,8 @@ function buildForbiddenPatterns() {
|
|
|
210
210
|
['stale Runtime shell API', new RegExp(runtimeBridgeName)],
|
|
211
211
|
['retired template flag', new RegExp(retiredFlag.replace('-', '\\-'))],
|
|
212
212
|
['retired template builder', new RegExp(retiredBuilders)],
|
|
213
|
+
['retired kit package name', /@nimiplatform\/nimi-kit/],
|
|
214
|
+
['retired developer tools package name', /@nimiplatform\/dev-tools/],
|
|
213
215
|
['retired profile switch branch', new RegExp(`case\\s+['"](?:${retiredProfiles.join('|')})['"]`)],
|
|
214
216
|
['retired submitted profile', new RegExp(`(?:profile|template):\\s*(?:${retiredProfiles.join('|')})\\b`)],
|
|
215
217
|
['retired vercel profile remnant', new RegExp(retiredProfiles[1])],
|
|
@@ -272,6 +274,20 @@ function assertSemanticMarkers(targetDir) {
|
|
|
272
274
|
throw new Error('Submitted manifest contains admission or grant wording');
|
|
273
275
|
}
|
|
274
276
|
|
|
277
|
+
const submission = readFileSync(path.join(targetDir, '.nimi/admission/submission.yaml'), 'utf8');
|
|
278
|
+
for (const marker of [
|
|
279
|
+
'submission_role: developer-submitted-input',
|
|
280
|
+
'dev_shell_command: pnpm dev:shell',
|
|
281
|
+
'admission_truth: platform-owned-after-review',
|
|
282
|
+
]) {
|
|
283
|
+
if (!submission.includes(marker)) {
|
|
284
|
+
throw new Error(`Admission submission marker missing: ${marker}`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (/admitted|descriptor_role:\s*release|grant(ed)?_permissions/i.test(submission)) {
|
|
288
|
+
throw new Error('Admission submission contains admission or grant wording');
|
|
289
|
+
}
|
|
290
|
+
|
|
275
291
|
const buildProfile = readFileSync(path.join(targetDir, '.nimi/config/build-profile.yaml'), 'utf8');
|
|
276
292
|
for (const marker of [
|
|
277
293
|
'build_profile_ref:',
|
package/lib/app-scaffold.mjs
CHANGED
|
@@ -125,14 +125,21 @@ function resolveProfile(options) {
|
|
|
125
125
|
function buildPackageJson(profile, versions, identity) {
|
|
126
126
|
const packageJson = {
|
|
127
127
|
name: identity.packageName,
|
|
128
|
-
private:
|
|
128
|
+
private: false,
|
|
129
129
|
type: 'module',
|
|
130
|
+
publishConfig: {
|
|
131
|
+
access: 'public',
|
|
132
|
+
},
|
|
130
133
|
scripts: {
|
|
131
|
-
dev: '
|
|
134
|
+
dev: 'pnpm run dev:renderer',
|
|
135
|
+
'dev:renderer': 'vite --host 127.0.0.1 --port 1420 --strictPort',
|
|
136
|
+
'dev:shell': 'tauri dev',
|
|
137
|
+
typecheck: 'tsc --noEmit',
|
|
132
138
|
build: 'tsc --noEmit && vite build',
|
|
139
|
+
'build:shell': 'tauri build',
|
|
133
140
|
test: 'node --test test/*.test.mjs',
|
|
134
141
|
check: 'pnpm run doctor && pnpm run test && pnpm run validate',
|
|
135
|
-
pack: 'node scripts/pack.mjs',
|
|
142
|
+
pack: 'pnpm run build && node scripts/pack.mjs',
|
|
136
143
|
validate: 'node scripts/validate.mjs',
|
|
137
144
|
'local-audit': 'node scripts/local-audit.mjs',
|
|
138
145
|
doctor: 'nimi-app doctor',
|
|
@@ -147,6 +154,7 @@ function buildPackageJson(profile, versions, identity) {
|
|
|
147
154
|
},
|
|
148
155
|
devDependencies: {
|
|
149
156
|
'@nimiplatform/app-tools': profile === 'workspace-app' ? 'workspace:*' : versions.appToolsVersion,
|
|
157
|
+
'@tauri-apps/cli': versions.tauriCliVersion,
|
|
150
158
|
'@types/node': versions.nodeTypesVersion,
|
|
151
159
|
'@types/react': versions.reactTypesVersion,
|
|
152
160
|
'@types/react-dom': versions.reactDomTypesVersion,
|
|
@@ -479,6 +487,31 @@ function buildCommonFiles(identity, versions) {
|
|
|
479
487
|
'',
|
|
480
488
|
].join('\n'),
|
|
481
489
|
},
|
|
490
|
+
{
|
|
491
|
+
path: '.nimi/admission/submission.yaml',
|
|
492
|
+
content: [
|
|
493
|
+
`app_id: ${identity.appId}`,
|
|
494
|
+
`display_name: ${identity.appTitle}`,
|
|
495
|
+
`profile: ${identity.profile}`,
|
|
496
|
+
`npm_package_name: ${identity.packageName}`,
|
|
497
|
+
`cargo_package_name: ${identity.cargoPackageName}`,
|
|
498
|
+
`tauri_identifier: ${identity.tauriIdentifier}`,
|
|
499
|
+
...(identity.author ? [`package_author: ${identity.author}`] : []),
|
|
500
|
+
'submission_role: developer-submitted-input',
|
|
501
|
+
'publish_readiness:',
|
|
502
|
+
' install_command: pnpm install',
|
|
503
|
+
' dev_shell_command: pnpm dev:shell',
|
|
504
|
+
' build_command: pnpm run build',
|
|
505
|
+
' pack_command: pnpm run pack',
|
|
506
|
+
'review_inputs:',
|
|
507
|
+
' manifest: nimi.app.yaml',
|
|
508
|
+
' build_profile: .nimi/config/build-profile.yaml',
|
|
509
|
+
' scaffold_boundary: .nimi/contracts/scaffold-boundary.yaml',
|
|
510
|
+
' local_audit: pnpm run local-audit',
|
|
511
|
+
'admission_truth: platform-owned-after-review',
|
|
512
|
+
'',
|
|
513
|
+
].join('\n'),
|
|
514
|
+
},
|
|
482
515
|
{
|
|
483
516
|
path: '.nimi/config/app-identity.yaml',
|
|
484
517
|
content: [
|
|
@@ -525,10 +558,12 @@ function buildCommonFiles(identity, versions) {
|
|
|
525
558
|
' - .nimi/config/**',
|
|
526
559
|
' - .nimi/contracts/**',
|
|
527
560
|
' - .nimi/methodology/**',
|
|
561
|
+
' - .nimi/admission/**',
|
|
528
562
|
' scaffold_managed_glue:',
|
|
529
563
|
' - .github/**',
|
|
530
564
|
' - .gitignore',
|
|
531
565
|
' - package.json',
|
|
566
|
+
' - ADMISSION.md',
|
|
532
567
|
' - README.md',
|
|
533
568
|
' - SECURITY.md',
|
|
534
569
|
' - nimi.app.yaml',
|
|
@@ -546,7 +581,8 @@ function buildCommonFiles(identity, versions) {
|
|
|
546
581
|
'# AGENTS.md',
|
|
547
582
|
'- Treat `.nimi/**` as host-local scaffold truth for this generated app.',
|
|
548
583
|
'- Keep auth, Runtime, permission, manifest, and Tauri shell glue in scaffold-managed files.',
|
|
549
|
-
'-
|
|
584
|
+
'- The app-owned area is `src/shell/routes/product-area.tsx` unless a later scaffold update expands it.',
|
|
585
|
+
'- `.nimi/admission/**` and `ADMISSION.md` are developer-submitted review inputs, not platform admission truth.',
|
|
550
586
|
'- Local checks are pre-submission self-checks only.',
|
|
551
587
|
'',
|
|
552
588
|
].join('\n'),
|
|
@@ -576,7 +612,7 @@ function buildCommonFiles(identity, versions) {
|
|
|
576
612
|
'',
|
|
577
613
|
'```bash',
|
|
578
614
|
'pnpm install',
|
|
579
|
-
'pnpm
|
|
615
|
+
'pnpm dev:shell',
|
|
580
616
|
'pnpm run validate',
|
|
581
617
|
'pnpm run local-audit',
|
|
582
618
|
'pnpm run pack',
|
|
@@ -586,10 +622,41 @@ function buildCommonFiles(identity, versions) {
|
|
|
586
622
|
'',
|
|
587
623
|
'`doctor` and `update` are developer scaffold checks for this source repository. They do not update an installed app, publish admission truth, create release descriptors, or grant permissions.',
|
|
588
624
|
'',
|
|
625
|
+
'For Nimi listing review, keep `nimi.app.yaml`, `.nimi/admission/submission.yaml`, `.nimi/config/build-profile.yaml`, and `ADMISSION.md` in sync with the product behavior under `src/shell/routes/product-area.tsx`.',
|
|
626
|
+
'',
|
|
589
627
|
'Upstream Platform/Runtime review produces release descriptors, ordinary visibility, install truth, and scope authorization. This scaffold does not mint those outcomes.',
|
|
590
628
|
'',
|
|
591
629
|
].join('\n'),
|
|
592
630
|
},
|
|
631
|
+
{
|
|
632
|
+
path: 'ADMISSION.md',
|
|
633
|
+
content: [
|
|
634
|
+
`# ${identity.appTitle} Nimi Listing Request`,
|
|
635
|
+
'',
|
|
636
|
+
'This document is a developer-submitted listing request. It is not an approval, release descriptor, permission grant, or install truth.',
|
|
637
|
+
'',
|
|
638
|
+
'## Developer Runbook',
|
|
639
|
+
'',
|
|
640
|
+
'```bash',
|
|
641
|
+
'pnpm install',
|
|
642
|
+
'pnpm dev:shell',
|
|
643
|
+
'pnpm run check',
|
|
644
|
+
'pnpm run pack',
|
|
645
|
+
'```',
|
|
646
|
+
'',
|
|
647
|
+
'## Submission Inputs',
|
|
648
|
+
'',
|
|
649
|
+
'- `nimi.app.yaml` declares app identity and requested API scopes.',
|
|
650
|
+
'- `.nimi/admission/submission.yaml` records publish-readiness commands and review inputs.',
|
|
651
|
+
'- `.nimi/config/build-profile.yaml` records install, build, and lockfile policy.',
|
|
652
|
+
'- `dist/nimi-app-submission.json` is produced by `pnpm run pack` after a successful renderer build.',
|
|
653
|
+
'',
|
|
654
|
+
'## Reviewer Boundary',
|
|
655
|
+
'',
|
|
656
|
+
'Nimi Platform review owns final admission, release descriptors, ordinary-user visibility, install availability, and permission grants.',
|
|
657
|
+
'',
|
|
658
|
+
].join('\n'),
|
|
659
|
+
},
|
|
593
660
|
{
|
|
594
661
|
path: 'LICENSE',
|
|
595
662
|
content: [
|
|
@@ -622,9 +689,16 @@ function buildCommonFiles(identity, versions) {
|
|
|
622
689
|
"import { readFileSync } from 'node:fs';",
|
|
623
690
|
'',
|
|
624
691
|
"const manifest = readFileSync(new URL('../nimi.app.yaml', import.meta.url), 'utf8');",
|
|
692
|
+
"const submission = readFileSync(new URL('../.nimi/admission/submission.yaml', import.meta.url), 'utf8');",
|
|
625
693
|
"if (!manifest.includes('manifest_role: submitted-input')) {",
|
|
626
694
|
" throw new Error('submitted manifest role marker missing');",
|
|
627
695
|
'}',
|
|
696
|
+
"if (!submission.includes('submission_role: developer-submitted-input')) {",
|
|
697
|
+
" throw new Error('developer submission role marker missing');",
|
|
698
|
+
'}',
|
|
699
|
+
"if (!submission.includes('dev_shell_command: pnpm dev:shell')) {",
|
|
700
|
+
" throw new Error('dev shell command marker missing');",
|
|
701
|
+
'}',
|
|
628
702
|
"console.log('[nimi-app] validate pre-submission self-check passed');",
|
|
629
703
|
'',
|
|
630
704
|
].join('\n'),
|
|
@@ -645,12 +719,35 @@ function buildCommonFiles(identity, versions) {
|
|
|
645
719
|
{
|
|
646
720
|
path: 'scripts/pack.mjs',
|
|
647
721
|
content: [
|
|
648
|
-
"import { mkdirSync, writeFileSync } from 'node:fs';",
|
|
722
|
+
"import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';",
|
|
649
723
|
"import { join } from 'node:path';",
|
|
650
724
|
'',
|
|
725
|
+
"if (!existsSync(join('dist', 'index.html'))) {",
|
|
726
|
+
" throw new Error('renderer build output missing: run pnpm run build before packing');",
|
|
727
|
+
'}',
|
|
728
|
+
"const packageJson = JSON.parse(readFileSync('package.json', 'utf8'));",
|
|
729
|
+
"const tauriConfig = JSON.parse(readFileSync(join('src-tauri', 'tauri.conf.json'), 'utf8'));",
|
|
730
|
+
"const manifest = readFileSync('nimi.app.yaml', 'utf8');",
|
|
731
|
+
"const submission = readFileSync(join('.nimi', 'admission', 'submission.yaml'), 'utf8');",
|
|
732
|
+
"if (!manifest.includes('manifest_role: submitted-input')) {",
|
|
733
|
+
" throw new Error('submitted manifest role marker missing');",
|
|
734
|
+
'}',
|
|
735
|
+
"if (!submission.includes('submission_role: developer-submitted-input')) {",
|
|
736
|
+
" throw new Error('developer submission role marker missing');",
|
|
737
|
+
'}',
|
|
651
738
|
"mkdirSync('dist', { recursive: true });",
|
|
652
|
-
|
|
653
|
-
"
|
|
739
|
+
'const packet = {',
|
|
740
|
+
" packetRole: 'developer-submitted-input',",
|
|
741
|
+
' packageName: packageJson.name,',
|
|
742
|
+
' appVersion: tauriConfig.version,',
|
|
743
|
+
' tauriIdentifier: tauriConfig.identifier,',
|
|
744
|
+
" rendererEntry: 'dist/index.html',",
|
|
745
|
+
" manifestPath: 'nimi.app.yaml',",
|
|
746
|
+
" admissionRequestPath: '.nimi/admission/submission.yaml',",
|
|
747
|
+
" generatedBy: '@nimiplatform/app-tools',",
|
|
748
|
+
'};',
|
|
749
|
+
"writeFileSync(join('dist', 'nimi-app-submission.json'), `${JSON.stringify(packet, null, 2)}\\n`);",
|
|
750
|
+
"console.log('[nimi-app] pack wrote dist/nimi-app-submission.json');",
|
|
654
751
|
'',
|
|
655
752
|
].join('\n'),
|
|
656
753
|
},
|
|
@@ -663,6 +760,7 @@ function buildCommonFiles(identity, versions) {
|
|
|
663
760
|
'',
|
|
664
761
|
"const authSource = readFileSync(new URL('../src/shell/auth/runtime-platform.ts', import.meta.url), 'utf8');",
|
|
665
762
|
"const manifest = readFileSync(new URL('../nimi.app.yaml', import.meta.url), 'utf8');",
|
|
763
|
+
"const submission = readFileSync(new URL('../.nimi/admission/submission.yaml', import.meta.url), 'utf8');",
|
|
666
764
|
'',
|
|
667
765
|
"test('auth glue uses Nimi App runtime platform helper', () => {",
|
|
668
766
|
" assert.match(authSource, /createNimiAppRuntimePlatformClient/);",
|
|
@@ -674,6 +772,12 @@ function buildCommonFiles(identity, versions) {
|
|
|
674
772
|
" assert.match(manifest, /declared_nimi_api_scopes/);",
|
|
675
773
|
"});",
|
|
676
774
|
'',
|
|
775
|
+
"test('admission request remains submitted input', () => {",
|
|
776
|
+
" assert.match(submission, /submission_role: developer-submitted-input/);",
|
|
777
|
+
" assert.match(submission, /dev_shell_command: pnpm dev:shell/);",
|
|
778
|
+
" assert.match(submission, /admission_truth: platform-owned-after-review/);",
|
|
779
|
+
"});",
|
|
780
|
+
'',
|
|
677
781
|
].join('\n'),
|
|
678
782
|
},
|
|
679
783
|
{
|
|
@@ -740,7 +844,7 @@ function buildTauriFiles(identity, versions) {
|
|
|
740
844
|
version: '0.1.0',
|
|
741
845
|
identifier: identity.tauriIdentifier,
|
|
742
846
|
build: {
|
|
743
|
-
beforeDevCommand: 'pnpm run dev',
|
|
847
|
+
beforeDevCommand: 'pnpm run dev:renderer',
|
|
744
848
|
beforeBuildCommand: 'pnpm run build',
|
|
745
849
|
devUrl: 'http://localhost:1420',
|
|
746
850
|
frontendDist: '../dist',
|
|
@@ -813,6 +917,7 @@ function classifyScaffoldFile(filePath) {
|
|
|
813
917
|
filePath.startsWith('.nimi/config/')
|
|
814
918
|
|| filePath.startsWith('.nimi/contracts/')
|
|
815
919
|
|| filePath.startsWith('.nimi/methodology/')
|
|
920
|
+
|| filePath.startsWith('.nimi/admission/')
|
|
816
921
|
|| /^apps\/[^/]+\/spec\//.test(filePath)
|
|
817
922
|
) {
|
|
818
923
|
return 'package-owned projection';
|
|
@@ -835,6 +940,7 @@ function buildDependencyMatrix(profile, versions) {
|
|
|
835
940
|
'react-dom': versions.reactDomVersion,
|
|
836
941
|
typescript: versions.typescriptVersion,
|
|
837
942
|
vite: versions.viteVersion,
|
|
943
|
+
'@tauri-apps/cli': versions.tauriCliVersion,
|
|
838
944
|
'@vitejs/plugin-react': versions.viteReactPluginVersion,
|
|
839
945
|
},
|
|
840
946
|
cargo: {
|
package/lib/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { createAppScaffold } from './app-scaffold.mjs';
|
|
|
4
4
|
import { doctorApp, updateApp } from './app-doctor-update.mjs';
|
|
5
5
|
|
|
6
6
|
const SDK_VERSION = '^0.5.15';
|
|
7
|
-
const APP_TOOLS_VERSION = '^0.1.
|
|
7
|
+
const APP_TOOLS_VERSION = '^0.1.2';
|
|
8
8
|
const KIT_VERSION = '^0.1.0';
|
|
9
9
|
const REACT_VERSION = '^19.1.0';
|
|
10
10
|
const REACT_DOM_VERSION = '^19.1.0';
|
|
@@ -16,6 +16,7 @@ const REACT_DOM_TYPES_VERSION = '^19.2.3';
|
|
|
16
16
|
const VITE_VERSION = '^7.2.4';
|
|
17
17
|
const VITE_REACT_PLUGIN_VERSION = '^5.1.1';
|
|
18
18
|
const TAURI_API_VERSION = '^2.9.1';
|
|
19
|
+
const TAURI_CLI_VERSION = '^2.11.2';
|
|
19
20
|
const NIMI_SHELL_TAURI_VERSION = '0.1.0';
|
|
20
21
|
const AI_SDK_VERSION = '^6.0.85';
|
|
21
22
|
|
|
@@ -61,6 +62,7 @@ function appScaffoldVersions() {
|
|
|
61
62
|
viteVersion: VITE_VERSION,
|
|
62
63
|
viteReactPluginVersion: VITE_REACT_PLUGIN_VERSION,
|
|
63
64
|
tauriApiVersion: TAURI_API_VERSION,
|
|
65
|
+
tauriCliVersion: TAURI_CLI_VERSION,
|
|
64
66
|
nimiShellTauriVersion: NIMI_SHELL_TAURI_VERSION,
|
|
65
67
|
};
|
|
66
68
|
}
|