@nimiplatform/app-tools 0.2.7 → 0.2.9
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 +102 -5
- package/bin/nimi-app.mjs +21 -3
- package/lib/app-doctor-update.mjs +7 -1
- package/lib/app-scaffold-profiles.mjs +2 -2
- package/lib/app-scaffold.mjs +45 -6
- package/package.json +4 -4
- package/scripts/dev-shell.mjs +30 -2
- package/templates/default-starter/README.md +25 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ node app-tools/bin/nimi-app.mjs --help
|
|
|
34
34
|
|
|
35
35
|
## Create
|
|
36
36
|
|
|
37
|
-
Interactive use validates every field, shows the resolved plan and asks for confirmation. The optional `author` names one person or team. Non-interactive use supplies the same inputs directly:
|
|
37
|
+
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:
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
40
|
node app-tools/bin/nimi-app.mjs create \
|
|
@@ -68,15 +68,24 @@ pnpm dev
|
|
|
68
68
|
|
|
69
69
|
`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.
|
|
70
70
|
|
|
71
|
+
To continue an existing development App and its data, select a registration explicitly:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pnpm dev -- --list-registrations
|
|
75
|
+
pnpm dev -- --resume <selector>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
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.
|
|
79
|
+
|
|
71
80
|
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` disabled 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.
|
|
72
81
|
|
|
73
82
|
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.
|
|
74
83
|
|
|
75
84
|
## Canonical release boundary
|
|
76
85
|
|
|
77
|
-
The
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
The publisher GitHub Release stage is available for configured repositories.
|
|
87
|
+
Registry review, Runtime installation, and Desktop launch are separate owner
|
|
88
|
+
stages:
|
|
80
89
|
|
|
81
90
|
```text
|
|
82
91
|
public App repository
|
|
@@ -92,7 +101,95 @@ public App repository
|
|
|
92
101
|
|
|
93
102
|
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.
|
|
94
103
|
|
|
95
|
-
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.
|
|
104
|
+
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. Submit the immutable Release to the Registry review flow, then use a current Nimi Desktop build with verified Windows package support for installation and acceptance.
|
|
105
|
+
|
|
106
|
+
## Publishing on GitHub
|
|
107
|
+
|
|
108
|
+
Local development does not need a GitHub token. Publishing an App Release does.
|
|
109
|
+
`nimi-app check --production` checks local inputs; the tag workflow checks the
|
|
110
|
+
GitHub repository settings. Complete the one-time setup below before pushing a
|
|
111
|
+
release tag.
|
|
112
|
+
|
|
113
|
+
### 1. Configure the publisher repository
|
|
114
|
+
|
|
115
|
+
Use a public repository owned by the publisher. You need administrator access
|
|
116
|
+
for this setup.
|
|
117
|
+
|
|
118
|
+
- In **Settings → General → Releases**, enable **Release immutability**.
|
|
119
|
+
- In **Settings → Rules → Rulesets**, create a **tag** ruleset, set enforcement
|
|
120
|
+
to **Active**, and include tags matching `v*`. Enable **Restrict updates**
|
|
121
|
+
and **Restrict deletions**. Tag creation must remain available to the publisher.
|
|
122
|
+
|
|
123
|
+
These settings protect published versions. The workflow only checks them; it
|
|
124
|
+
does not change repository settings.
|
|
125
|
+
|
|
126
|
+
### 2. Create the read-only settings token
|
|
127
|
+
|
|
128
|
+
Open [GitHub's fine-grained token page](https://github.com/settings/personal-access-tokens/new).
|
|
129
|
+
|
|
130
|
+
1. Name the token so you can recognize its purpose, and choose an expiration date.
|
|
131
|
+
2. Set **Resource owner** to the user or organization that owns the App repository.
|
|
132
|
+
3. Under **Repository access**, choose **Only select repositories** and select
|
|
133
|
+
this App repository.
|
|
134
|
+
4. Under **Repository permissions**, set **Administration** to **Read-only**.
|
|
135
|
+
GitHub includes read-only Metadata automatically. No Contents write,
|
|
136
|
+
Actions write, Secrets write, or organization-wide access is needed.
|
|
137
|
+
5. Generate the token. If the organization requires approval, complete that
|
|
138
|
+
approval before publishing.
|
|
139
|
+
|
|
140
|
+
This token reads tag-protection and release-immutability settings. The workflow
|
|
141
|
+
uses GitHub's separate built-in token to publish artifacts and its OIDC
|
|
142
|
+
permission to create build attestations.
|
|
143
|
+
|
|
144
|
+
### 3. Save it as an Actions secret
|
|
145
|
+
|
|
146
|
+
In the App repository, open **Settings → Secrets and variables → Actions →
|
|
147
|
+
New repository secret**.
|
|
148
|
+
|
|
149
|
+
- **Name:** `NIMI_REPOSITORY_ADMIN_TOKEN`
|
|
150
|
+
- **Secret:** the fine-grained token value from step 2
|
|
151
|
+
|
|
152
|
+
Save it and confirm the exact name appears in the repository's Actions secrets.
|
|
153
|
+
Use a **secret**, not an Actions variable. An organization secret is also
|
|
154
|
+
supported when its repository-access list includes this App. Keep the value
|
|
155
|
+
out of source files, `.env`, and release notes.
|
|
156
|
+
|
|
157
|
+
### 4. Check, build, and publish a version
|
|
158
|
+
|
|
159
|
+
Run the existing local path from the App repository:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
pnpm run sync
|
|
163
|
+
pnpm exec nimi-app check --production
|
|
164
|
+
pnpm exec nimi-app test
|
|
165
|
+
pnpm exec nimi-app build --target windows-x86_64 --production
|
|
166
|
+
pnpm exec nimi-app pack --target windows-x86_64 --production
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Commit the release changes and get that exact commit onto the repository's
|
|
170
|
+
canonical default branch. Keep `package.json` and `nimi.app.yaml` versions
|
|
171
|
+
equal. Use that version for the annotated tag; `0.1.0` below is an example:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
git tag -a v0.1.0 -m "Release 0.1.0"
|
|
175
|
+
git push origin v0.1.0
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Open **Actions → nimi-app-release**. A successful run produces the immutable
|
|
179
|
+
GitHub Release containing the `.nimiapp` package and aggregate candidate JSON.
|
|
180
|
+
Manual workflow dispatch checks the development path and does not publish.
|
|
181
|
+
|
|
182
|
+
If setup fails, the failed step points to the required setting. Add or replace
|
|
183
|
+
the secret, fix its repository selection/permissions, or enable the named
|
|
184
|
+
setting, then use **Re-run failed jobs** on the same run. A tag outside the
|
|
185
|
+
default branch requires merging its exact commit first. A code change requires
|
|
186
|
+
a new version and tag. Newly published release proofs can take a short time to
|
|
187
|
+
appear; the workflow waits for this specific delay and still requires successful
|
|
188
|
+
verification.
|
|
189
|
+
|
|
190
|
+
GitHub Release publication is followed by the separate
|
|
191
|
+
[Registry submission and human admission flow](https://github.com/nimiplatform/nimi-app-registry#ownership-boundary).
|
|
192
|
+
App Tools does not create an approval or install the App as a side effect.
|
|
96
193
|
|
|
97
194
|
## Acceptance status
|
|
98
195
|
|
package/bin/nimi-app.mjs
CHANGED
|
@@ -21,7 +21,7 @@ function parseArgs(argv) {
|
|
|
21
21
|
const [command = '', ...rest] = argv;
|
|
22
22
|
const values = {
|
|
23
23
|
dir: '', profile: '', appId: '', version: '', title: '', packageName: '', author: '',
|
|
24
|
-
features: undefined, shell: '', cdpPort: undefined, noCdp: false, conformance: '', target: '', aggregate: false, production: false, json: false,
|
|
24
|
+
features: undefined, shell: '', cdpPort: undefined, noCdp: false, listRegistrations: false, resume: '', conformance: '', target: '', aggregate: false, production: false, json: false,
|
|
25
25
|
};
|
|
26
26
|
const seen = new Set();
|
|
27
27
|
const readValue = (index, flag, key, preserve = false) => {
|
|
@@ -80,6 +80,16 @@ function parseArgs(argv) {
|
|
|
80
80
|
index = readValue(index, '--cdp-port', 'cdpPort');
|
|
81
81
|
continue;
|
|
82
82
|
}
|
|
83
|
+
if (rest[index] === '--resume') {
|
|
84
|
+
index = readValue(index, '--resume', 'resume', true);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (rest[index] === '--list-registrations') {
|
|
88
|
+
if (seen.has('listRegistrations')) throw new Error('Duplicate option: --list-registrations');
|
|
89
|
+
seen.add('listRegistrations');
|
|
90
|
+
values.listRegistrations = true;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
83
93
|
if (rest[index] === '--no-cdp') {
|
|
84
94
|
if (seen.has('noCdp')) throw new Error('Duplicate option: --no-cdp');
|
|
85
95
|
seen.add('noCdp');
|
|
@@ -127,7 +137,7 @@ function assertCommandOptions(command, providedOptions) {
|
|
|
127
137
|
init: new Set(['dir', 'json']),
|
|
128
138
|
sync: new Set(['dir', 'json']),
|
|
129
139
|
check: new Set(['dir', 'json', 'conformance', 'production']),
|
|
130
|
-
dev: new Set(['dir', 'shell', 'cdpPort', 'noCdp']),
|
|
140
|
+
dev: new Set(['dir', 'shell', 'cdpPort', 'noCdp', 'listRegistrations', 'resume']),
|
|
131
141
|
test: new Set(['dir', 'json']),
|
|
132
142
|
build: new Set(['dir', 'target', 'production', 'json']),
|
|
133
143
|
pack: new Set(['dir', 'target', 'aggregate', 'production', 'json']),
|
|
@@ -158,7 +168,7 @@ function printUsage() {
|
|
|
158
168
|
' nimi-app init [--dir path] [--json]',
|
|
159
169
|
' nimi-app sync [--dir path] [--json]',
|
|
160
170
|
' nimi-app check [--dir path] [--conformance simulator | --production] [--json]',
|
|
161
|
-
' nimi-app dev [--dir path] [--shell electron] [--cdp-port 1024..65535 | --no-cdp]',
|
|
171
|
+
' nimi-app dev [--dir path] [--shell electron] [--list-registrations | --resume <selector>] [--cdp-port 1024..65535 | --no-cdp]',
|
|
162
172
|
' nimi-app test [--dir path] [--json]',
|
|
163
173
|
' nimi-app build [--dir path] [--target target-id] [--production] [--json]',
|
|
164
174
|
' nimi-app pack [--dir path] (--target target-id [--production] | --aggregate) [--json]',
|
|
@@ -285,6 +295,8 @@ try {
|
|
|
285
295
|
shell,
|
|
286
296
|
cdpPort,
|
|
287
297
|
noCdp,
|
|
298
|
+
listRegistrations,
|
|
299
|
+
resume,
|
|
288
300
|
conformance,
|
|
289
301
|
target,
|
|
290
302
|
aggregate,
|
|
@@ -354,6 +366,10 @@ try {
|
|
|
354
366
|
production,
|
|
355
367
|
json,
|
|
356
368
|
});
|
|
369
|
+
if (production && !json) {
|
|
370
|
+
process.stdout.write('[nimi-app] Local checks do not verify GitHub repository settings or secrets. Before tagging, configure NIMI_REPOSITORY_ADMIN_TOKEN and release protection:\n');
|
|
371
|
+
process.stdout.write('https://github.com/nimiplatform/nimi/blob/main/app-tools/README.md#publishing-on-github\n');
|
|
372
|
+
}
|
|
357
373
|
break;
|
|
358
374
|
case 'test':
|
|
359
375
|
testApp(process.cwd(), { dir, json });
|
|
@@ -375,6 +391,8 @@ try {
|
|
|
375
391
|
shell: shell || 'electron',
|
|
376
392
|
cdpPort,
|
|
377
393
|
noCdp,
|
|
394
|
+
listRegistrations,
|
|
395
|
+
resume,
|
|
378
396
|
});
|
|
379
397
|
break;
|
|
380
398
|
default:
|
|
@@ -388,7 +388,13 @@ function scanForbiddenPatterns(targetDir, profile, selectedLabels = null) {
|
|
|
388
388
|
if (label === 'environment custody of protected material' && isManagedReleaseWorkflow) {
|
|
389
389
|
continue;
|
|
390
390
|
}
|
|
391
|
-
|
|
391
|
+
// Publishing documentation names the GitHub-only repository secret.
|
|
392
|
+
// App/runtime source still cannot read it, and other protected Nimi
|
|
393
|
+
// environment material remains forbidden in documentation as well.
|
|
394
|
+
const scanText = label === 'environment custody of protected material' && relativePath.endsWith('.md')
|
|
395
|
+
? text.replace(/\bNIMI_REPOSITORY_ADMIN_TOKEN\b/gu, '')
|
|
396
|
+
: text;
|
|
397
|
+
if (pattern.test(scanText)) {
|
|
392
398
|
findings.push(`${relativePath}: ${label}`);
|
|
393
399
|
}
|
|
394
400
|
}
|
|
@@ -135,9 +135,7 @@ function renderDefaultElectronProductionPackager(identity) {
|
|
|
135
135
|
'',
|
|
136
136
|
`const APP_EXECUTABLE_NAME = ${JSON.stringify(identity.cargoPackageName)};`,
|
|
137
137
|
`const APP_PRODUCT_NAME = ${JSON.stringify(identity.appTitle)};`,
|
|
138
|
-
`const APP_VERSION = ${JSON.stringify(identity.version)};`,
|
|
139
138
|
resolveWindowsResourceVersion.toString(),
|
|
140
|
-
'const WINDOWS_RESOURCE_VERSION = resolveWindowsResourceVersion(APP_VERSION);',
|
|
141
139
|
"const NATIVE_BINDING_PACKAGE = '@nimiplatform/kit-protected-local-win32-x64';",
|
|
142
140
|
"const appRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');",
|
|
143
141
|
"const outputRoot = path.join(appRoot, 'dist-electron-package');",
|
|
@@ -148,6 +146,8 @@ function renderDefaultElectronProductionPackager(identity) {
|
|
|
148
146
|
'}',
|
|
149
147
|
'',
|
|
150
148
|
"const appPackage = JSON.parse(await readFile(path.join(appRoot, 'package.json'), 'utf8'));",
|
|
149
|
+
'const APP_VERSION = appPackage.version;',
|
|
150
|
+
'const WINDOWS_RESOURCE_VERSION = resolveWindowsResourceVersion(APP_VERSION);',
|
|
151
151
|
"for (const sectionName of ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']) {",
|
|
152
152
|
' if (Object.hasOwn(appPackage[sectionName] || {}, NATIVE_BINDING_PACKAGE)) {',
|
|
153
153
|
" throw new Error('The protected native binding must arrive through the Kit optional dependency.');",
|
package/lib/app-scaffold.mjs
CHANGED
|
@@ -79,7 +79,6 @@ const APP_RELEASE_WORKFLOW = [
|
|
|
79
79
|
' - run: pnpm exec nimi-app sync',
|
|
80
80
|
' - run: test -z "$(git status --porcelain)"',
|
|
81
81
|
' - run: pnpm exec nimi-app check --json > .nimi-targets.json',
|
|
82
|
-
' - run: pnpm exec nimi-app test',
|
|
83
82
|
' - name: Require tag/version lockstep',
|
|
84
83
|
" if: github.event_name == 'push' && github.ref_type == 'tag'",
|
|
85
84
|
' run: node -e "const p=require(\'./package.json\'); if (process.env.GITHUB_REF_NAME !== (\'v\' + p.version)) throw new Error(\'tag_version_mismatch\')"',
|
|
@@ -107,8 +106,23 @@ const APP_RELEASE_WORKFLOW = [
|
|
|
107
106
|
' GH_TOKEN: ${{ secrets.NIMI_REPOSITORY_ADMIN_TOKEN }}',
|
|
108
107
|
' shell: bash',
|
|
109
108
|
' run: |',
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
" if test -z \"$GH_TOKEN\"; then",
|
|
110
|
+
" echo \"::error title=Missing release setup::Add the repository Actions secret NIMI_REPOSITORY_ADMIN_TOKEN before publishing.\"",
|
|
111
|
+
" echo \"Create a fine-grained personal access token at https://github.com/settings/personal-access-tokens/new\"",
|
|
112
|
+
" echo \"Select the repository owner and only $GITHUB_REPOSITORY. Grant repository Administration: Read-only.\"",
|
|
113
|
+
" echo \"Save its value as NIMI_REPOSITORY_ADMIN_TOKEN at https://github.com/$GITHUB_REPOSITORY/settings/secrets/actions\"",
|
|
114
|
+
" echo \"Guide: https://github.com/nimiplatform/nimi/blob/main/app-tools/README.md#publishing-on-github\"",
|
|
115
|
+
" echo \"Then open this Actions run and choose Re-run failed jobs. Keep the existing tag.\"",
|
|
116
|
+
" exit 1",
|
|
117
|
+
" fi",
|
|
118
|
+
" if ! immutable=$(gh api \"repos/$GITHUB_REPOSITORY/immutable-releases\" --jq .enabled); then",
|
|
119
|
+
" echo \"::error title=Release settings inaccessible::Check token expiration, repository selection, Administration: Read-only, and any required organization approval.\"",
|
|
120
|
+
" exit 1",
|
|
121
|
+
" fi",
|
|
122
|
+
" if test \"$immutable\" != true; then",
|
|
123
|
+
" echo \"::error title=Immutable releases required::Enable release immutability in repository Settings > General > Releases, then re-run failed jobs.\"",
|
|
124
|
+
" exit 1",
|
|
125
|
+
" fi",
|
|
112
126
|
' protected=false',
|
|
113
127
|
' while read -r ruleset_id; do',
|
|
114
128
|
' ruleset=$(gh api "repos/$GITHUB_REPOSITORY/rulesets/$ruleset_id")',
|
|
@@ -122,7 +136,11 @@ const APP_RELEASE_WORKFLOW = [
|
|
|
122
136
|
' break',
|
|
123
137
|
' fi',
|
|
124
138
|
' done < <(gh api "repos/$GITHUB_REPOSITORY/rulesets" --jq \'.[] | select(.target == "tag" and .enforcement == "active") | .id\')',
|
|
125
|
-
|
|
139
|
+
" if test \"$protected\" != true; then",
|
|
140
|
+
" echo \"::error title=Version tag protection required::Create an active tag ruleset for v* with Restrict updates and Restrict deletions in repository Settings > Rules > Rulesets.\"",
|
|
141
|
+
" echo \"After saving the ruleset, re-run failed jobs. Do not move or replace the existing tag.\"",
|
|
142
|
+
" exit 1",
|
|
143
|
+
" fi",
|
|
126
144
|
' - name: Resolve declared target matrix',
|
|
127
145
|
' id: matrix',
|
|
128
146
|
' shell: bash',
|
|
@@ -148,6 +166,8 @@ const APP_RELEASE_WORKFLOW = [
|
|
|
148
166
|
' package-manager-cache: false',
|
|
149
167
|
' - run: corepack enable',
|
|
150
168
|
' - run: pnpm install --frozen-lockfile',
|
|
169
|
+
' - name: Test declared target',
|
|
170
|
+
' run: pnpm exec nimi-app test',
|
|
151
171
|
' - name: Build development target',
|
|
152
172
|
" if: github.event_name != 'push' || github.ref_type != 'tag'",
|
|
153
173
|
' env:',
|
|
@@ -248,6 +268,25 @@ const APP_RELEASE_WORKFLOW = [
|
|
|
248
268
|
' run: |',
|
|
249
269
|
' set -euo pipefail',
|
|
250
270
|
' shopt -s nullglob',
|
|
271
|
+
" verify_release() {",
|
|
272
|
+
" local verification_log",
|
|
273
|
+
" verification_log=$(mktemp)",
|
|
274
|
+
" for attempt in 1 2 3 4 5 6; do",
|
|
275
|
+
" if gh release verify \"$GITHUB_REF_NAME\" --repo \"$GITHUB_REPOSITORY\" >\"$verification_log\" 2>&1; then",
|
|
276
|
+
" cat \"$verification_log\"",
|
|
277
|
+
" rm \"$verification_log\"",
|
|
278
|
+
" return 0",
|
|
279
|
+
" fi",
|
|
280
|
+
" cat \"$verification_log\"",
|
|
281
|
+
" if ! grep -q \"no attestations for tag\" \"$verification_log\" || test \"$attempt\" = 6; then",
|
|
282
|
+
" rm \"$verification_log\"",
|
|
283
|
+
" echo \"::error title=Release verification failed::Inspect the error above. A published immutable Release must not be replaced; re-run failed jobs after its proof is available.\"",
|
|
284
|
+
" return 1",
|
|
285
|
+
" fi",
|
|
286
|
+
" echo \"Waiting for GitHub to make the new immutable Release attestation available (attempt $attempt/6).\"",
|
|
287
|
+
" sleep 10",
|
|
288
|
+
" done",
|
|
289
|
+
" }",
|
|
251
290
|
' assets=(release-assets/*.nimiapp release-assets/*.candidate.json)',
|
|
252
291
|
' test "${#assets[@]}" -gt 0',
|
|
253
292
|
" expected=$(printf '%s\\n' \"${assets[@]##*/}\" | jq -R -s -c 'split(\"\\n\")[:-1] | sort')",
|
|
@@ -258,7 +297,7 @@ const APP_RELEASE_WORKFLOW = [
|
|
|
258
297
|
' test "$unexpected" -eq 0',
|
|
259
298
|
' if test "$(jq -r .draft <<<"$release_json")" = false; then',
|
|
260
299
|
' test "$existing" = "$expected"',
|
|
261
|
-
'
|
|
300
|
+
' verify_release',
|
|
262
301
|
' for asset in "${assets[@]}"; do gh release verify-asset "$GITHUB_REF_NAME" "$asset" --repo "$GITHUB_REPOSITORY"; done',
|
|
263
302
|
' exit 0',
|
|
264
303
|
' fi',
|
|
@@ -280,7 +319,7 @@ const APP_RELEASE_WORKFLOW = [
|
|
|
280
319
|
' fi',
|
|
281
320
|
' done',
|
|
282
321
|
' gh release edit "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --draft=false',
|
|
283
|
-
'
|
|
322
|
+
' verify_release',
|
|
284
323
|
' for asset in "${assets[@]}"; do gh release verify-asset "$GITHUB_REF_NAME" "$asset" --repo "$GITHUB_REPOSITORY"; done',
|
|
285
324
|
'',
|
|
286
325
|
].join('\n');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimiplatform/app-tools",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
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.9.
|
|
22
|
-
"appToolsVersion": "^0.2.
|
|
21
|
+
"sdkVersion": "^0.9.1",
|
|
22
|
+
"appToolsVersion": "^0.2.9",
|
|
23
23
|
"nimicodingVersion": "0.6.1",
|
|
24
24
|
"aiSdkVersion": "^6.0.85",
|
|
25
|
-
"kitVersion": "^0.5.
|
|
25
|
+
"kitVersion": "^0.5.1",
|
|
26
26
|
"reactVersion": "^19.2.8",
|
|
27
27
|
"reactDomVersion": "^19.2.8",
|
|
28
28
|
"i18nextVersion": "^25.10.10",
|
package/scripts/dev-shell.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { parse as parseYaml } from 'yaml';
|
|
|
10
10
|
const DESCRIPTOR_RELATIVE_PATH = ['.nimi', 'run', 'desktop', 'local-development', 'presence.v1.json'];
|
|
11
11
|
const MAX_HEARTBEAT_AGE_MS = 10_000;
|
|
12
12
|
const REQUEST_TIMEOUT_MS = 5_000;
|
|
13
|
+
const INTENT_REQUEST_TIMEOUT_MS = 30_000;
|
|
13
14
|
const STATUS_POLL_MS = 350;
|
|
14
15
|
const AUTO_CDP_PORT = 0;
|
|
15
16
|
const CDP_PORT_ENV_KEY = 'NIMI_APP_DEV_CDP_PORT';
|
|
@@ -22,11 +23,16 @@ const TERMINAL_STATES = new Set([
|
|
|
22
23
|
'stopped',
|
|
23
24
|
]);
|
|
24
25
|
|
|
26
|
+
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-scaf-018a
|
|
25
27
|
export async function runDevShell(cwd, options = {}) {
|
|
28
|
+
if (options.listRegistrations && options.resume) throw new DevShellError('local-development-intent-invalid', '--list-registrations and --resume cannot be combined.');
|
|
29
|
+
if (options.resume && !/^dev-project-[A-Za-z0-9_-]{1,148}$/u.test(options.resume)) {
|
|
30
|
+
throw new DevShellError('local-development-selector-invalid', '--resume requires a current-host selector from --list-registrations.');
|
|
31
|
+
}
|
|
26
32
|
const shell = normalizeShell(options.shell || 'electron');
|
|
27
33
|
assertLocalDevelopmentPlatform(process.platform, shell);
|
|
28
34
|
const projectRoot = await canonicalProjectRoot(cwd, options.dir);
|
|
29
|
-
const cdpPort = await resolveRequestedCdpPort(projectRoot, options);
|
|
35
|
+
const cdpPort = options.listRegistrations ? undefined : await resolveRequestedCdpPort(projectRoot, options);
|
|
30
36
|
const appId = await readAppId(projectRoot);
|
|
31
37
|
const descriptorPath = options.descriptorPath
|
|
32
38
|
? path.resolve(options.descriptorPath)
|
|
@@ -36,6 +42,26 @@ export async function runDevShell(cwd, options = {}) {
|
|
|
36
42
|
if (typeof fetchImpl !== 'function') {
|
|
37
43
|
throw new DevShellError('local-development-launcher-unavailable', 'This Node.js runtime does not provide fetch.');
|
|
38
44
|
}
|
|
45
|
+
if (options.listRegistrations) {
|
|
46
|
+
const listed = await postJson(fetchImpl, descriptor.endpoint, '/v1/registrations', {
|
|
47
|
+
schemaVersion: 1, appId, projectRoot, shell,
|
|
48
|
+
});
|
|
49
|
+
if (listed?.status !== 'ok' || !Array.isArray(listed.registrations)) {
|
|
50
|
+
throw new DevShellError(listed?.reasonCode || 'local-development-intent-invalid', 'Desktop could not list current-host registrations.');
|
|
51
|
+
}
|
|
52
|
+
const output = options.output ?? process.stdout;
|
|
53
|
+
for (const row of listed.registrations) {
|
|
54
|
+
if (typeof row.selector !== 'string' || !/^dev-project-[A-Za-z0-9_-]{1,148}$/u.test(row.selector)
|
|
55
|
+
|| typeof row.displayName !== 'string' || !Number.isSafeInteger(row.registeredAtUnixMs)) {
|
|
56
|
+
throw new DevShellError('local-development-intent-invalid', 'Desktop returned an invalid registration projection.');
|
|
57
|
+
}
|
|
58
|
+
output.write(`${row.selector}\t${new Date(row.registeredAtUnixMs).toISOString()}\t${row.displayName}\n`);
|
|
59
|
+
}
|
|
60
|
+
output.write(listed.registrations.length
|
|
61
|
+
? '[nimi-app dev] Resume an explicit selection with: pnpm dev -- --resume <selector>\n'
|
|
62
|
+
: '[nimi-app dev] No current-host registrations for this project. Run pnpm dev to create one.\n');
|
|
63
|
+
return listed.registrations;
|
|
64
|
+
}
|
|
39
65
|
|
|
40
66
|
const startIntent = {
|
|
41
67
|
schemaVersion: 1,
|
|
@@ -43,6 +69,7 @@ export async function runDevShell(cwd, options = {}) {
|
|
|
43
69
|
projectRoot,
|
|
44
70
|
shell,
|
|
45
71
|
...(cdpPort === undefined ? {} : { cdpPort }),
|
|
72
|
+
...(options.resume ? { registrationSelector: options.resume } : {}),
|
|
46
73
|
};
|
|
47
74
|
const start = await postJson(fetchImpl, descriptor.endpoint, '/v1/start', startIntent);
|
|
48
75
|
const initial = parseBridgeRun(start);
|
|
@@ -213,7 +240,8 @@ async function postJson(fetchImpl, endpoint, route, body) {
|
|
|
213
240
|
headers: { 'Content-Type': 'application/json' },
|
|
214
241
|
body: JSON.stringify(body),
|
|
215
242
|
redirect: 'error',
|
|
216
|
-
signal: AbortSignal.timeout(
|
|
243
|
+
signal: AbortSignal.timeout(route === '/v1/start' || route === '/v1/registrations'
|
|
244
|
+
? INTENT_REQUEST_TIMEOUT_MS : REQUEST_TIMEOUT_MS),
|
|
217
245
|
});
|
|
218
246
|
} catch {
|
|
219
247
|
throw new DevShellError(
|
|
@@ -24,7 +24,7 @@ pnpm run app:build -- --target windows-x86_64
|
|
|
24
24
|
pnpm dev
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
After a real target build, `pnpm run pack -- --target <target-id>` uses app-tools as the only package owner.
|
|
27
|
+
After a real target build, `pnpm run pack -- --target <target-id>` uses app-tools as the only package owner. App Tools has no local `publish` command. A protected version tag runs the managed GitHub Release workflow; submit the resulting immutable Release through the separate Registry pull-request and human-review flow.
|
|
28
28
|
|
|
29
29
|
Before production, the public GitHub repository must enable a protected `v*` tag ruleset and immutable releases and provide a read-only repository-admin token for checking those settings. On Windows, the tag-only production build runs the App-declared build owner without a Nimi signing step. A publisher may sign the exact declared Host through its own build or signing custody; production pack records either verified Authenticode or explicit unsigned posture and rejects invalid or unresolved signatures. Manual workflow dispatch runs only the non-production path. The resulting GitHub Release remains independent from registry admission, Runtime installation, Desktop launch, and Nimi Access.
|
|
30
30
|
|
|
@@ -36,6 +36,30 @@ The default `windows-x86_64` build creates a fresh non-installer Electron direct
|
|
|
36
36
|
|
|
37
37
|
Runtime, Realm, registry admission, installed state and process truth remain with their canonical owners. This repository stores no Runtime credentials or protected session material.
|
|
38
38
|
|
|
39
|
+
## Publish with GitHub
|
|
40
|
+
|
|
41
|
+
Before pushing a release tag, complete these one-time repository steps:
|
|
42
|
+
|
|
43
|
+
1. **Settings → General → Releases:** enable Release immutability.
|
|
44
|
+
2. **Settings → Rules → Rulesets:** create an active tag ruleset for `v*`
|
|
45
|
+
that restricts updates and deletions.
|
|
46
|
+
3. [Create a fine-grained token](https://github.com/settings/personal-access-tokens/new)
|
|
47
|
+
for this repository's owner and only this repository, with **Administration:
|
|
48
|
+
Read-only**. Complete organization approval if required.
|
|
49
|
+
4. **Settings → Secrets and variables → Actions → New repository secret:**
|
|
50
|
+
save the token value under the exact name `NIMI_REPOSITORY_ADMIN_TOKEN`.
|
|
51
|
+
|
|
52
|
+
See the [step-by-step publishing guide](https://github.com/nimiplatform/nimi/blob/main/app-tools/README.md#publishing-on-github)
|
|
53
|
+
for repository setup, permission details, version tagging, and
|
|
54
|
+
recovery from setup errors. Local checks do not verify GitHub secrets.
|
|
55
|
+
|
|
56
|
+
Run `pnpm exec nimi-app check --production`, then the real production build
|
|
57
|
+
and pack. Commit the release on the repository's default branch and push an
|
|
58
|
+
annotated `v<package.json version>` tag. Watch **Actions → nimi-app-release**.
|
|
59
|
+
If a repository setting or secret is missing, fix it and **Re-run failed jobs**;
|
|
60
|
+
keep the existing tag. Registry admission is a separate human review after
|
|
61
|
+
the immutable Release exists.
|
|
62
|
+
|
|
39
63
|
## Support
|
|
40
64
|
|
|
41
65
|
Report startup or Runtime issues through this repository's issue tracker. Diagnostics must exclude credentials and other private data.
|