native-update 3.1.0 → 3.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.
Files changed (64) hide show
  1. package/AI-INTEGRATION-GUIDE.md +88 -58
  2. package/Readme.md +57 -88
  3. package/cli/AGENTS.md +9 -0
  4. package/cli/CLAUDE.md +9 -0
  5. package/cli/package.json +2 -2
  6. package/dist/esm/app-update/app-update-checker.d.ts +19 -0
  7. package/dist/esm/app-update/app-update-checker.js +19 -0
  8. package/dist/esm/background-update/background-scheduler.d.ts +21 -0
  9. package/dist/esm/background-update/background-scheduler.js +47 -24
  10. package/dist/esm/core/update-check.d.ts +89 -0
  11. package/dist/esm/core/update-check.js +86 -0
  12. package/dist/esm/definitions.d.ts +11 -1
  13. package/dist/esm/live-update/version-manager.js +43 -27
  14. package/dist/esm/plugin.js +14 -20
  15. package/dist/esm/types/rollout.d.ts +9 -3
  16. package/dist/plugin.cjs.js +1 -1
  17. package/dist/plugin.esm.js +1 -1
  18. package/dist/plugin.js +2 -2
  19. package/docs/AGENTS.md +9 -0
  20. package/docs/CHANGELOG.md +51 -0
  21. package/docs/CLAUDE.md +9 -0
  22. package/docs/DEPLOY_NOTES.md +116 -0
  23. package/docs/MANUAL-TASKS.md +18 -5
  24. package/docs/api/background-update-api.md +14 -1
  25. package/docs/features/e2e-full-verification/00-overview.md +99 -0
  26. package/docs/features/e2e-full-verification/00-tracker.json +284 -0
  27. package/docs/features/e2e-full-verification/phase01-backend-schema-fixes.md +183 -0
  28. package/docs/features/e2e-full-verification/phase02-test-auth.md +176 -0
  29. package/docs/features/e2e-full-verification/phase03-api-test-coverage.md +63 -0
  30. package/docs/features/e2e-full-verification/phase04-frontend-package-contract-audit.md +73 -0
  31. package/docs/features/e2e-full-verification/phase05-browser-e2e-matrix.md +69 -0
  32. package/docs/features/e2e-full-verification/phase06-deploy-prod-smoke.md +51 -0
  33. package/docs/features/e2e-full-verification/results/phase01-drift-report.md +50 -0
  34. package/docs/features/e2e-full-verification/results/phase03-coverage-matrix.md +215 -0
  35. package/docs/features/e2e-full-verification/results/phase04-frontend-contract.md +139 -0
  36. package/docs/features/e2e-full-verification/results/phase05-e2e-results.md +99 -0
  37. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-01-dashboard.png +0 -0
  38. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-02-signup.png +0 -0
  39. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-03-settings-persisted.png +0 -0
  40. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04a-app-created.png +0 -0
  41. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04b-duplicate-bundle-422.png +0 -0
  42. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-05-plan-limit-403.png +0 -0
  43. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08a-upload-graceful-fail.png +0 -0
  44. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08b-builds-list.png +0 -0
  45. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-10-rollout-25pct.png +0 -0
  46. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-11-analytics.png +0 -0
  47. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-12-drive-disconnected.png +0 -0
  48. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-13-pricing.png +0 -0
  49. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-14-isolation-403.png +0 -0
  50. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15a-admin-overview.png +0 -0
  51. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15b-regular-user-admin-redirect.png +0 -0
  52. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-16a-delete-dialog.png +0 -0
  53. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-17-mobile-375.png +0 -0
  54. package/docs/features/e2e-full-verification/results/route-list.json +1 -0
  55. package/docs/features/queues-and-emails/00-overview.md +41 -0
  56. package/docs/features/queues-and-emails/00-tracker.json +99 -0
  57. package/docs/features/queues-and-emails/phase01-foundation.md +15 -0
  58. package/docs/features/queues-and-emails/phase02-queued-jobs.md +19 -0
  59. package/docs/features/queues-and-emails/phase03-transactional-emails.md +16 -0
  60. package/docs/features/queues-and-emails/phase04-quota-ops.md +17 -0
  61. package/docs/features/queues-and-emails/phase05-async-build-processing-DECISION.md +16 -0
  62. package/docs/features/queues-and-emails/phase06-verify-deploy.md +17 -0
  63. package/docs/server-requirements.md +41 -11
  64. package/package.json +1 -1
@@ -24,13 +24,16 @@ Native Update provides three main features:
24
24
  ```typescript
25
25
  import { NativeUpdate } from 'native-update';
26
26
 
27
- // Configure the plugin
27
+ // Configure the plugin (nested UpdateConfig — one section per feature)
28
28
  await NativeUpdate.configure({
29
- appId: 'your-app-id',
30
- channel: 'production', // 'development' | 'staging' | 'production'
31
- updateUrl: 'https://your-update-server.com/api',
32
- autoCheck: true,
33
- checkInterval: 3600000, // 1 hour in ms
29
+ liveUpdate: {
30
+ appId: 'your-app-id',
31
+ // OTA update checks are issued as GET {serverUrl}/v1/updates/check
32
+ serverUrl: 'https://your-update-server.com',
33
+ channel: 'production', // e.g. 'development' | 'staging' | 'production'
34
+ autoUpdate: true,
35
+ updateStrategy: 'background', // 'immediate' | 'background' | 'manual'
36
+ },
34
37
  });
35
38
  ```
36
39
 
@@ -39,17 +42,21 @@ await NativeUpdate.configure({
39
42
  ```typescript
40
43
  import { NativeUpdate } from 'native-update';
41
44
 
42
- // Check and apply updates
45
+ // Check and apply updates — sync() reports a status enum
43
46
  const result = await NativeUpdate.sync();
44
- if (result.updateAvailable) {
45
- console.log('Update applied, reload required');
47
+ if (result.status === 'UPDATE_INSTALLED') {
48
+ // sync() already downloaded + staged the bundle
46
49
  await NativeUpdate.reload();
47
50
  }
48
51
 
49
52
  // Manual update flow
50
53
  const latest = await NativeUpdate.getLatest();
51
- if (latest.available) {
52
- const bundle = await NativeUpdate.download({ version: latest.version });
54
+ if (latest.available && latest.url && latest.version && latest.checksum) {
55
+ const bundle = await NativeUpdate.download({
56
+ url: latest.url,
57
+ version: latest.version,
58
+ checksum: latest.checksum,
59
+ });
53
60
  await NativeUpdate.set(bundle);
54
61
  await NativeUpdate.reload();
55
62
  }
@@ -84,10 +91,10 @@ if (updateInfo.updateAvailable) {
84
91
  import { NativeUpdate } from 'native-update';
85
92
 
86
93
  // Request review at appropriate moment
87
- const canRequest = await NativeUpdate.canRequestReview();
88
- if (canRequest.eligible) {
94
+ const eligibility = await NativeUpdate.canRequestReview();
95
+ if (eligibility.canRequest) {
89
96
  const result = await NativeUpdate.requestReview();
90
- // Note: Actual review submission not guaranteed (platform controls)
97
+ // result.displayed — note: actual review submission not guaranteed (platform controls)
91
98
  }
92
99
  ```
93
100
 
@@ -129,47 +136,59 @@ if (canRequest.eligible) {
129
136
 
130
137
  ## Configuration Options
131
138
 
139
+ `configure()` takes a nested `UpdateConfig` — one optional section per feature:
140
+
132
141
  ```typescript
133
- interface NativeUpdateConfig {
134
- appId: string; // Your app identifier
142
+ interface UpdateConfig {
143
+ liveUpdate?: LiveUpdateConfig; // OTA updates
144
+ appUpdate?: AppUpdateConfig; // app store updates
145
+ appReview?: AppReviewConfig; // in-app reviews
146
+ backgroundUpdate?: BackgroundUpdateConfig; // background checks + notifications
147
+ security?: SecurityConfig; // HTTPS enforcement, cert pinning
148
+ }
149
+
150
+ interface LiveUpdateConfig {
151
+ appId: string; // Your app identifier (required)
152
+ serverUrl?: string; // Backend base URL; checks hit {serverUrl}/v1/updates/check (HTTPS required in production)
135
153
  channel?: string; // Update channel (default: 'production')
136
- updateUrl?: string; // Update server URL
137
- autoCheck?: boolean; // Auto-check for updates (default: true)
138
- checkInterval?: number; // Check interval in ms (default: 3600000)
139
- autoDownload?: boolean; // Auto-download updates (default: false)
140
- autoInstall?: boolean; // Auto-install after download (default: false)
141
- requireWifi?: boolean; // Only download on WiFi (default: true)
142
- minBatteryLevel?: number; // Min battery % for updates (default: 20)
154
+ autoUpdate?: boolean; // Auto-check + apply updates
155
+ updateStrategy?: 'immediate' | 'background' | 'manual';
143
156
  publicKey?: string; // Public key for signature verification
144
- checksumAlgorithm?: 'sha256' | 'sha512'; // Checksum algorithm (default: 'sha256')
157
+ requireSignature?: boolean; // Reject unsigned bundles
158
+ checksumAlgorithm?: 'SHA-256' | 'SHA-512'; // (default: 'SHA-256')
159
+ checkInterval?: number; // Auto-check interval
145
160
  }
146
161
  ```
147
162
 
163
+ See the full field list for every section in `src/definitions.ts` or the
164
+ [Configuration Guide](https://nativeupdate.aoneahsan.com/docs/getting-started/configuration).
165
+
148
166
  ## Event Listeners
149
167
 
168
+ Available events (see `src/definitions.ts` for payload types):
169
+
170
+ | Event | Fires when |
171
+ |-------|------------|
172
+ | `downloadProgress` | OTA bundle download progresses (`{ percent, bytesDownloaded, totalBytes, bundleId }`) |
173
+ | `updateStateChanged` | An OTA bundle changes state (pending → downloading → ready → active/failed) |
174
+ | `backgroundUpdateProgress` | A background update advances through its phases |
175
+ | `backgroundUpdateNotification` | A background-update notification is shown/tapped |
176
+ | `appUpdateStateChanged` / `appUpdateProgress` | Native app-store update state/progress changes |
177
+ | `appUpdateAvailable` / `appUpdateReady` / `appUpdateFailed` | App-store update lifecycle |
178
+ | `appUpdateNotificationClicked` / `appUpdateInstallClicked` | User interacted with an app-update notification |
179
+
150
180
  ```typescript
151
181
  import { NativeUpdate } from 'native-update';
152
182
 
153
- // Listen for update events
154
- NativeUpdate.addListener('updateAvailable', (info) => {
155
- console.log('Update available:', info.version);
156
- });
157
-
158
- NativeUpdate.addListener('downloadProgress', (progress) => {
183
+ const progressListener = await NativeUpdate.addListener('downloadProgress', (progress) => {
159
184
  console.log(`Download: ${progress.percent}%`);
160
185
  });
161
186
 
162
- NativeUpdate.addListener('downloadComplete', (bundle) => {
163
- console.log('Download complete:', bundle.version);
187
+ const stateListener = await NativeUpdate.addListener('updateStateChanged', (event) => {
188
+ console.log('Bundle state:', event.status);
164
189
  });
165
190
 
166
- NativeUpdate.addListener('updateFailed', (error) => {
167
- console.error('Update failed:', error.message);
168
- });
169
-
170
- NativeUpdate.addListener('updateInstalled', (bundle) => {
171
- console.log('Update installed:', bundle.version);
172
- });
191
+ // Later: await progressListener.remove(); or await NativeUpdate.removeAllListeners();
173
192
  ```
174
193
 
175
194
  ## Update Channels
@@ -182,22 +201,33 @@ NativeUpdate.addListener('updateInstalled', (bundle) => {
182
201
 
183
202
  ## Backend Requirements
184
203
 
185
- Your update server must implement these endpoints:
204
+ Easiest path: use the hosted backend at [nativeupdate.aoneahsan.com](https://nativeupdate.aoneahsan.com)
205
+ (free dashboard — register the app, upload bundles, get the `serverUrl` + API key).
206
+ Self-hosting instead? Your server must implement this contract
207
+ (full spec: [server requirements](https://nativeupdate.aoneahsan.com/docs/server-requirements)):
208
+
209
+ ### GET {serverUrl}/v1/updates/check?channel={channel}
210
+
211
+ Request headers sent by the plugin: `X-API-Key`, `X-Device-ID`,
212
+ `X-Current-Version`, `X-Platform` (and `X-App-Version` when known).
213
+
214
+ Response — `200` with `available: false` when there is no update, `200` with:
186
215
 
187
- ### GET /api/check
188
216
  ```json
189
217
  {
190
218
  "available": true,
191
219
  "version": "1.2.0",
192
- "url": "https://cdn.example.com/bundles/1.2.0.zip",
193
- "checksum": "sha256:abc123...",
220
+ "bundleId": "bundle-ulid",
221
+ "downloadUrl": "https://cdn.example.com/bundles/1.2.0.zip",
222
+ "checksum": "sha256-hex...",
194
223
  "signature": "base64signature...",
224
+ "size": 1048576,
225
+ "mandatory": false,
195
226
  "releaseNotes": "Bug fixes and improvements"
196
227
  }
197
228
  ```
198
229
 
199
- ### GET /api/download/:version
200
- Returns the bundle zip file.
230
+ `downloadUrl` must be an HTTPS URL that returns the bundle zip.
201
231
 
202
232
  ## CLI Tools
203
233
 
@@ -211,20 +241,20 @@ npx native-update bundle sign ./bundles/1.2.0.zip --key ./private.key
211
241
  # Verify a bundle
212
242
  npx native-update bundle verify ./bundles/1.2.0.zip --key ./public.key
213
243
 
214
- # Upload to server
215
- npx native-update bundle upload ./bundles/1.2.0.zip --server https://api.example.com
244
+ # Generate signing keys
245
+ npx native-update keys generate --type rsa --size 4096
216
246
  ```
217
247
 
248
+ Upload the resulting bundle through your backend's dashboard/API (hosted
249
+ dashboard: the Upload page at nativeupdate.aoneahsan.com).
250
+
218
251
  ## Platform-Specific Setup
219
252
 
220
253
  ### Android
221
254
 
222
- Add to `android/app/build.gradle`:
223
- ```gradle
224
- dependencies {
225
- implementation 'com.google.android.play:core:1.10.3'
226
- }
227
- ```
255
+ No additional setup required. The plugin's own Gradle config already includes
256
+ the Google Play App Update and Play Review libraries (do NOT add the legacy
257
+ `com.google.android.play:core` artifact — it conflicts with them).
228
258
 
229
259
  ### iOS
230
260
 
@@ -252,9 +282,9 @@ import { NativeUpdate } from 'native-update';
252
282
 
253
283
  App.addListener('appStateChange', async ({ isActive }) => {
254
284
  if (isActive) {
255
- const result = await NativeUpdate.sync({ silent: true });
256
- if (result.updateAvailable && result.updateReady) {
257
- // Show user prompt to reload
285
+ const result = await NativeUpdate.sync();
286
+ if (result.status === 'UPDATE_INSTALLED') {
287
+ // Show user prompt to reload (NativeUpdate.reload())
258
288
  }
259
289
  }
260
290
  });
@@ -265,8 +295,8 @@ App.addListener('appStateChange', async ({ isActive }) => {
265
295
  ```typescript
266
296
  async function handlePurchaseComplete() {
267
297
  // After successful purchase
268
- const canRequest = await NativeUpdate.canRequestReview();
269
- if (canRequest.eligible) {
298
+ const eligibility = await NativeUpdate.canRequestReview();
299
+ if (eligibility.canRequest) {
270
300
  await NativeUpdate.requestReview();
271
301
  }
272
302
  }
package/Readme.md CHANGED
@@ -1,29 +1,26 @@
1
1
  # Capacitor Native Update Plugin
2
2
 
3
- > ⚠️ **IMPORTANT: Production-Ready with Complete Examples** ⚠️
4
- >
5
- > This package is now **feature-complete** with significant improvements:
3
+ [![npm version](https://img.shields.io/npm/v/native-update)](https://www.npmjs.com/package/native-update)
4
+ [![license](https://img.shields.io/npm/l/native-update)](./LICENSE)
5
+
6
+ > ⚠️ **Production-Ready** ⚠️
6
7
  >
7
- > - ✅ **yarn Workspace Monorepo** - Seamless development with workspace:* references
8
- > - ✅ **3 Complete Examples** - React+Capacitor frontend, Node.js+Express and Firebase backends in `example-apps/`
9
- > - ✅ **Native Implementations Complete** - iOS (Swift) and Android (Kotlin) fully implemented
10
- > - ✅ **Development Tools Included** - Bundle creator, signer, and CLI tools
11
- > - ✅ **Security Features Implemented** - HTTPS enforcement, signatures, checksums
8
+ > - ✅ **Complete native implementations** - iOS (Swift) and Android (Kotlin) fully implemented
9
+ > - ✅ **Two complete examples** - React + Capacitor app and a Node.js + Express backend in `example-apps/`
10
+ > - ✅ **Backend included** - Laravel 13 + Nova 5 reference backend (`backend/`) powers the hosted SaaS and is self-hostable
11
+ > - ✅ **Development tools included** - Bundle creator, signer, and CLI tools
12
+ > - ✅ **Security features implemented** - HTTPS enforcement, signatures, checksums
12
13
  >
13
- > **🚀 Try the example apps in `example-apps/` to see all features in action!**
14
+ > **🚀 Try the example app in `example-apps/` to see all features in action!**
14
15
 
15
16
  ## Current State
16
17
 
17
- - Package version: `3.1.0`
18
- - Verified on: `2026-05-18`
18
+ - Package version: see the npm badge above — the single source of truth is `package.json` `version`, and it is deliberately not duplicated in this file
19
+ - Verified on: `2026-07-14`
19
20
  - Tests: `134/134` backend PHPUnit via `php artisan test`
20
21
  - Build: `yarn build` succeeds (root plugin Rollup + website Vite + Docusaurus docs site)
21
22
  - Root package manager is standardized on Yarn, and the root scripts no longer shell out to npm or pnpm
22
23
  - Backend: Laravel 13 + Nova 5 — the only backend after v3.0.0 (Firestore removed); identity via Laravel Socialite + Sanctum personal access tokens; RBAC via `spatie/laravel-permission` (roles `super-admin`, `admin`, `user`)
23
- - Root portfolio info file:
24
- - `NATIVE-UPDATE_portfolio-info_2026-06-26.md`
25
- - Current dated project profile:
26
- - `docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-05-19.md`
27
24
 
28
25
  ## 📚 Documentation
29
26
 
@@ -168,24 +165,34 @@ async function checkLiveUpdates() {
168
165
  try {
169
166
  const result = await NativeUpdate.sync();
170
167
 
168
+ if (result.status === 'UPDATE_INSTALLED') {
169
+ // sync() already downloaded and staged the bundle — reload to apply
170
+ await NativeUpdate.reload();
171
+ return;
172
+ }
173
+
171
174
  if (result.status === 'UPDATE_AVAILABLE') {
172
- // Download update with progress tracking
173
- const listener = NativeUpdate.addListener('downloadProgress', (progress) => {
175
+ // Manual flow: fetch the manifest, then download + apply
176
+ const latest = await NativeUpdate.getLatest();
177
+ if (!latest.available || !latest.url || !latest.version || !latest.checksum) {
178
+ return;
179
+ }
180
+
181
+ // Track download progress
182
+ const listener = await NativeUpdate.addListener('downloadProgress', (progress) => {
174
183
  console.log(`Downloading: ${progress.percent}%`);
175
184
  });
176
185
 
177
- // Download the update
178
186
  const bundle = await NativeUpdate.download({
179
- url: result.url,
180
- version: result.version,
181
- checksum: result.checksum
187
+ url: latest.url,
188
+ version: latest.version,
189
+ checksum: latest.checksum,
182
190
  });
191
+ await listener.remove();
183
192
 
184
193
  // Set the bundle and reload
185
194
  await NativeUpdate.set(bundle);
186
195
  await NativeUpdate.reload();
187
-
188
- listener.remove();
189
196
  }
190
197
  } catch (error) {
191
198
  console.error('Update failed:', error);
@@ -203,7 +210,7 @@ async function checkNativeUpdates() {
203
210
  if (result.updateAvailable) {
204
211
  if (result.immediateUpdateAllowed) {
205
212
  // Critical update - must install
206
- await NativeUpdate.startImmediateUpdate();
213
+ await NativeUpdate.performImmediateUpdate();
207
214
  } else if (result.flexibleUpdateAllowed) {
208
215
  // Optional update - download in background
209
216
  await NativeUpdate.startFlexibleUpdate();
@@ -328,7 +335,7 @@ export class AppComponent implements OnInit {
328
335
 
329
336
  ## Requirements
330
337
 
331
- - Capacitor 5.0+
338
+ - Capacitor 8.x (peer dependency `@capacitor/core` `^8.0.1`)
332
339
  - iOS 13.0+
333
340
  - Android 5.0+ (API 21+)
334
341
 
@@ -343,7 +350,7 @@ This plugin implements multiple security layers:
343
350
 
344
351
  ## 🎯 Complete Example Implementations
345
352
 
346
- This repository uses **yarn workspace** for seamless development. All examples reference the local plugin via `workspace:*` - no need to publish to npm for testing!
353
+ The example app references the local plugin via yarn's `portal:` protocol - no need to publish to npm for testing!
347
354
 
348
355
  ### Frontend Example: React + Capacitor
349
356
 
@@ -353,7 +360,7 @@ This repository uses **yarn workspace** for seamless development. All examples r
353
360
  - ✅ Single-page app with "change this text and deploy" example
354
361
  - ✅ Capacitor integration (iOS + Android)
355
362
  - ✅ TypeScript + Vite for modern development
356
- - ✅ Uses local plugin via workspace reference
363
+ - ✅ Uses local plugin via yarn `portal:` reference
357
364
 
358
365
  ### Backend Examples
359
366
 
@@ -372,8 +379,8 @@ This repository uses **yarn workspace** for seamless development. All examples r
372
379
 
373
380
  The canonical backend ships in this monorepo under [`backend/`](./backend) — a
374
381
  Laravel 13 + Nova 5 application that powers the hosted Native Update SaaS at
375
- `api.nativeupdate.aoneahsan.com`. You can use it as a managed service or
376
- self-host it on any PHP 8.2+ host. Setup is documented in
382
+ `nativeupdatebe.aoneahsan.com`. You can use it as a managed service or
383
+ self-host it on any PHP 8.3+ host. Setup is documented in
377
384
  [`docs/deployment/PRODUCTION-DEPLOY-CHECKLIST.md`](./docs/deployment/PRODUCTION-DEPLOY-CHECKLIST.md).
378
385
 
379
386
  - ✅ Google OAuth (Socialite) + Sanctum bearer tokens + spatie/laravel-permission RBAC
@@ -428,71 +435,33 @@ npx native-update backend create express --with-admin
428
435
 
429
436
  See [CLI Reference](https://nativeupdate.aoneahsan.com/docs/cli-reference) for complete documentation.
430
437
 
431
- ## 🏗️ Development Status
432
-
433
- ### What This Package Provides
434
-
435
- ✅ **Architecture & Design**
436
- - Well-designed TypeScript interfaces and plugin structure
437
- - Modular architecture for live updates, app updates, and reviews
438
- - Security-first design patterns
439
-
440
- ✅ **Documentation**
441
- - Comprehensive API documentation
442
- - Security best practices guide
443
- - Implementation examples and guides
444
-
445
- ✅ **Foundation Code**
446
- - TypeScript/Web implementation
447
- - Plugin interfaces and definitions
448
- - Basic native platform stubs
449
-
450
- ### What You Need to Build
451
-
452
- ❌ **Backend Infrastructure**
453
- - Update server with API endpoints
454
- - Bundle storage and CDN
455
- - Version management system
456
- - Signing and encryption services
457
-
458
- ❌ **Complete Native Implementation**
459
- - Verify and complete iOS implementation
460
- - Verify and complete Android implementation
461
- - Platform-specific testing
438
+ ## 🏗️ What Ships in This Package
462
439
 
463
- ❌ **Testing & Quality Assurance**
464
- - Unit tests for all modules
465
- - Integration tests
466
- - End-to-end testing
467
- - Security testing
440
+ ✅ **Complete plugin implementation**
441
+ - TypeScript/web implementation with full type definitions (`src/definitions.ts`)
442
+ - Native iOS (Swift) and Android (Kotlin) implementations
443
+ - Live updates, app store updates, in-app reviews, and background updates
468
444
 
469
- ❌ **Tooling & Utilities**
470
- - Bundle creation tools
471
- - Signing utilities
472
- - Deployment scripts
473
- - Monitoring solutions
445
+ ✅ **Tooling**
446
+ - `npx native-update` CLI: bundle create/sign/verify, key generation, backend templates, migration
447
+ - Example React + Capacitor app and Node.js + Express backend in `example-apps/`
474
448
 
475
- ## 🚀 Getting Started with Development
449
+ ✅ **Backend options**
450
+ - Hosted dashboard at [nativeupdate.aoneahsan.com](https://nativeupdate.aoneahsan.com) (Laravel 13 + Nova 5, source in `backend/`, self-hostable)
451
+ - Documented HTTP contract for fully custom servers ([server requirements](https://nativeupdate.aoneahsan.com/docs/server-requirements))
476
452
 
477
- 1. **Understand the Architecture**:
478
- - Review the documentation at `https://nativeupdate.aoneahsan.com/docs`
479
- - Study the TypeScript interfaces in `/src/definitions.ts`
480
- - Check the [ROADMAP.md](https://nativeupdate.aoneahsan.com/docs/ROADMAP) for development priorities
453
+ ### What You Still Own as an Integrator
481
454
 
482
- 2. **Build Required Infrastructure**:
483
- - Set up an update server (see [server requirements](https://nativeupdate.aoneahsan.com/docs/server-requirements))
484
- - Implement bundle storage solution
485
- - Create signing infrastructure
455
+ - Choosing a backend: the hosted dashboard, a self-hosted `backend/` deployment, the Express example, or your own server implementing the documented contract
456
+ - Generating and safeguarding your bundle-signing keys (`npx native-update keys generate`)
457
+ - Testing your update flows on real devices before production rollouts
486
458
 
487
- 3. **Complete Native Implementation**:
488
- - Test and verify iOS implementation
489
- - Test and verify Android implementation
490
- - Ensure all plugin methods work correctly
459
+ ## 🚀 Getting Started
491
460
 
492
- 4. **Create Testing Suite**:
493
- - Add unit tests for TypeScript code
494
- - Create integration tests for native platforms
495
- - Implement end-to-end testing scenarios
461
+ 1. **Install and configure** — follow the [Quick Start](https://nativeupdate.aoneahsan.com/docs/getting-started/quick-start)
462
+ 2. **Pick a backend** — hosted dashboard or self-hosted (see [server requirements](https://nativeupdate.aoneahsan.com/docs/server-requirements))
463
+ 3. **Create signing keys and a first bundle** — `npx native-update keys generate`, then `npx native-update bundle create ./dist`
464
+ 4. **Verify the full cycle on a device** — deploy, update, and roll back through channels before going live
496
465
 
497
466
  ## 💡 Key Benefits
498
467
 
@@ -520,7 +489,7 @@ This package is **open-source** and created by **Ahsan Mahmood** for the develop
520
489
  - **Performance Optimization**: Performance tuning and optimization
521
490
  - **Training and Consulting**: Team training and consultation
522
491
 
523
- ## 📈 Why Use This Foundation?
492
+ ## 📈 Why Native Update?
524
493
 
525
494
  - **Solid Architecture**: Well-designed plugin structure and interfaces
526
495
  - **Platform Agnostic**: Works with any JavaScript framework
package/cli/AGENTS.md CHANGED
@@ -41,3 +41,12 @@ Full rule + private/public protocol: `~/.claude/rules/project-config.md`.
41
41
  Gitignore Last Verified: 2026-06-24
42
42
 
43
43
  **Last Updated**: 2026-04-25
44
+
45
+
46
+ ## Sub-agents & Skills — Main-Context-First (IRON-SOLID)
47
+ Default/built-in sub-agents (`general-purpose`, `Explore`, `Plan`, `claude`, `fork`, …) do NOT have
48
+ access to `/skills`, so delegating to them silently SKIPS the skills RULE #0 requires. Do all
49
+ skill-relevant work in the **MAIN context**; use a sub-agent ONLY when a **custom** agent exists in
50
+ `.claude/agents/` for that job; a default `Explore`/`Plan` agent is allowed ONLY for read-only,
51
+ no-skill search/exploration. When a relevant skill is missing, **install/enable it** rather than
52
+ proceeding skill-less. (Owner directive 2026-07-11; full text in `~/.claude/CLAUDE.md`.)
package/cli/CLAUDE.md CHANGED
@@ -63,3 +63,12 @@ Full rule + private/public protocol: `~/.claude/rules/project-config.md`.
63
63
  Gitignore Last Verified: 2026-06-24
64
64
 
65
65
  **Last Updated**: 2026-04-25
66
+
67
+
68
+ ## Sub-agents & Skills — Main-Context-First (IRON-SOLID)
69
+ Default/built-in sub-agents (`general-purpose`, `Explore`, `Plan`, `claude`, `fork`, …) do NOT have
70
+ access to `/skills`, so delegating to them silently SKIPS the skills RULE #0 requires. Do all
71
+ skill-relevant work in the **MAIN context**; use a sub-agent ONLY when a **custom** agent exists in
72
+ `.claude/agents/` for that job; a default `Explore`/`Plan` agent is allowed ONLY for read-only,
73
+ no-skill search/exploration. When a relevant skill is missing, **install/enable it** rather than
74
+ proceeding skill-less. (Owner directive 2026-07-11; full text in `~/.claude/CLAUDE.md`.)
package/cli/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "native-update-cli",
3
- "version": "3.1.0",
4
- "description": "CLI for Native Update",
3
+ "private": true,
4
+ "description": "CLI for Native Update. No version field on purpose: the CLI ships inside the native-update npm package and reads its version from the ROOT package.json (single source of truth) via cli/index.js.",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=24.16.0"
@@ -13,6 +13,25 @@ export declare class AppUpdateChecker {
13
13
  private cachedAppInfo;
14
14
  private readonly CACHE_DURATION;
15
15
  constructor(config: PluginConfig);
16
+ /**
17
+ * Query an OPTIONAL custom app-version endpoint for a newer native
18
+ * app-store binary. This is a self-hoster extension point, independent
19
+ * of the Native Update (Laravel) OTA backend — configure it via
20
+ * `updateUrl`. When `updateUrl` is unset (the default) this is a no-op.
21
+ *
22
+ * Contract the custom server must implement:
23
+ * ```
24
+ * GET {updateUrl}/app-version?platform={ios|android|web}&current={ver}[&channel={ch}]
25
+ * X-App-Version: <installed version> X-App-Platform: <platform>
26
+ * → 200 {
27
+ * "version": "2.1.0", // latest store version
28
+ * "priority": 3, // optional update priority
29
+ * "releaseNotes": "…", // optional
30
+ * "size": 12345, // optional bytes
31
+ * "downloadUrl": "https://…" // optional store/deeplink URL
32
+ * }
33
+ * ```
34
+ */
16
35
  checkServerVersion(_?: AppUpdateOptions): Promise<Partial<AppUpdateInfo>>;
17
36
  compareVersions(version1: string, version2: string): number;
18
37
  isUpdateRequired(currentVersion: string, availableVersion: string, minimumVersion?: string): boolean;
@@ -6,6 +6,25 @@ export class AppUpdateChecker {
6
6
  this.config = config;
7
7
  this.logger = new Logger('AppUpdateChecker');
8
8
  }
9
+ /**
10
+ * Query an OPTIONAL custom app-version endpoint for a newer native
11
+ * app-store binary. This is a self-hoster extension point, independent
12
+ * of the Native Update (Laravel) OTA backend — configure it via
13
+ * `updateUrl`. When `updateUrl` is unset (the default) this is a no-op.
14
+ *
15
+ * Contract the custom server must implement:
16
+ * ```
17
+ * GET {updateUrl}/app-version?platform={ios|android|web}&current={ver}[&channel={ch}]
18
+ * X-App-Version: <installed version> X-App-Platform: <platform>
19
+ * → 200 {
20
+ * "version": "2.1.0", // latest store version
21
+ * "priority": 3, // optional update priority
22
+ * "releaseNotes": "…", // optional
23
+ * "size": 12345, // optional bytes
24
+ * "downloadUrl": "https://…" // optional store/deeplink URL
25
+ * }
26
+ * ```
27
+ */
9
28
  async checkServerVersion(_) {
10
29
  if (!this.config.updateUrl) {
11
30
  return {};
@@ -22,6 +22,27 @@ export declare class BackgroundScheduler {
22
22
  getStatus(): BackgroundUpdateStatus;
23
23
  performCheck(): Promise<BackgroundCheckResult>;
24
24
  private checkForUpdates;
25
+ /**
26
+ * Check whether a newer NATIVE app-store binary is available.
27
+ *
28
+ * Primary path: the platform `AppUpdateManager` (Play Core / App Store).
29
+ *
30
+ * Fallback path: a GET to `{serverUrl}/app-version`. This is a
31
+ * deliberate **custom-backend extension point**, NOT part of the Native
32
+ * Update (Laravel) backend — that backend ships OTA bundles, it has no
33
+ * concept of the store binary version. A self-hoster who wants
34
+ * server-driven native-update prompts implements this endpoint:
35
+ *
36
+ * ```
37
+ * GET {serverUrl}/app-version
38
+ * X-Current-Version: <installed app version>
39
+ * X-Platform: ios | android | web
40
+ * → 200 { "version": "2.1.0", "priority": 3 } // or { "latestVersion": … }
41
+ * ```
42
+ *
43
+ * If the endpoint is absent the fallback just fails closed
44
+ * (updateAvailable=false). See `docs/api/background-update-api.md`.
45
+ */
25
46
  private checkAppUpdate;
26
47
  private checkLiveUpdate;
27
48
  private sendNotification;