A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.
JavaScript claude-code-pluginclaude-code-skillscode-appsgithub-copilot-pluginpower-appspower-pagespower-platform
Loosen compatibility checks to avoid blockers in upgrades and development (#885)
Ameya Aptecbbeec63dc11
diff --git a/plugins/mobile-apps/.claude-plugin/plugin.json b/plugins/mobile-apps/.claude-plugin/plugin.jsonindex 7deccbd5f..3f8907381 100644--- a/plugins/mobile-apps/.claude-plugin/plugin.json+++ b/plugins/mobile-apps/.claude-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "mobile-app",- "version": "0.6.3",+ "version": "0.6.4","description": "Build and deploy Power Apps code apps for mobile using Expo (React Native), with native device functionality and Power Platform connectors","author": {"name": "Microsoft",diff --git a/plugins/mobile-apps/.plugin/plugin.json b/plugins/mobile-apps/.plugin/plugin.jsonindex 7deccbd5f..3f8907381 100644--- a/plugins/mobile-apps/.plugin/plugin.json+++ b/plugins/mobile-apps/.plugin/plugin.json@@ -1,6 +1,6 @@{"name": "mobile-app",- "version": "0.6.3",+ "version": "0.6.4","description": "Build and deploy Power Apps code apps for mobile using Expo (React Native), with native device functionality and Power Platform connectors","author": {"name": "Microsoft",diff --git a/plugins/mobile-apps/AGENTS.md b/plugins/mobile-apps/AGENTS.mdindex eb5076138..9e90e6ef0 100644--- a/plugins/mobile-apps/AGENTS.md+++ b/plugins/mobile-apps/AGENTS.md@@ -8,7 +8,7 @@ This file provides guidance to AI Agents when working with the **mobile-app** plA plugin for building and deploying **Power Apps code apps that run as native mobile + web apps** using Expo + React Native + TypeScript. Connects to Power Platform via connectors using the standard `pa app add data-source` workflow.-`/create-mobile-app` selects an exact published template package, acquires it only into a new/empty folder after approval, installs its lockfile after separate approval, then validates and prepares it. Existing fresh installed folders must match its package-owned host contract. See [mobile-release-lifecycle.md](shared/references/mobile-release-lifecycle.md); missing published compatibility metadata blocks native adoption.+`/create-mobile-app` selects an exact published template package, acquires it only into a new/empty folder after approval, installs its lockfile after separate approval, then inspects and prepares it. Existing fresh installed folders use advisory local-development compatibility checks, not blocking admission before installation/startup. See [mobile-release-lifecycle.md](shared/references/mobile-release-lifecycle.md); strict compatibility remains required for deployment.## Local Development@@ -58,6 +58,12 @@ archive selected by the immutable template lock, never from mutable installedhashes alone.Metadata checks do not certify offline synchronization or database migration.Never patch, fork or locally rewrite a first-party package to work around a defect.+For fixable upgrade failures, follow the [check-updates repair loop](skills/check-updates/SKILL.md#explain-choices-clearly-and-work-through-fixable-problems).+Local workflows and their children follow the+[local-development policy](shared/references/mobile-release-lifecycle.md#local-installation-and-startup-are-not-release-admission-gates):+use `--local-development` on the resolver and changed-file validator; retain+unverified compatibility without blocking installation/startup. Deployment+keeps strict first-party package/base validation.Do not add preparation rewrites for `scheme`, `package`, `bundleIdentifier`, `src/playerConfig.ts`, `fingerprint.config.js`, or `native-runtime.json` unless those files exist in the synced main template.diff --git a/plugins/mobile-apps/README.md b/plugins/mobile-apps/README.mdindex 4c05aa59e..0e8c825cb 100644--- a/plugins/mobile-apps/README.md+++ b/plugins/mobile-apps/README.md@@ -175,11 +175,15 @@ bases/players. It checks for stale templates even when the host was alreadyupdated and supports same-template host repair. It previews every migration ina disposable copy, then asks separately before applying the full reviewedchain. Customer code, settings, local changes, and instruction files are preserved.+Failed checks trigger diagnosis, suggested fixes and minimal app-code repairs in+the test copy, preserving functionality. Repairs are tested and included in your+approval before application.Managed/native packages are never offered as unrelated npm bumps. Pure-JSdependencies retain individual approval, validation, rollback, and direct-advisory-auditing. Unsupported metadata, conflicts, unavailable releases, and incomplete-previews block changes rather than inventing state. See+auditing. Unsupported metadata, unavailable releases, package defects without a+safe app-level fix, and unsafe recovery still block the affected upgrade. Required+checks cannot be bypassed and dependencies are never patched. See[the lifecycle contract](shared/references/mobile-release-lifecycle.md).When an old app has no supported migration, retain the original app and reportdiff --git a/plugins/mobile-apps/agents/native-app-planner.md b/plugins/mobile-apps/agents/native-app-planner.mdindex e04a7dcc2..89342472a 100644--- a/plugins/mobile-apps/agents/native-app-planner.md+++ b/plugins/mobile-apps/agents/native-app-planner.md@@ -112,10 +112,10 @@ Read these references once before doing anything else:Do not assume scaffolding has completed or infer a runtime from plugin files.If the release context is missing, request it from the orchestrator or resolve-read-only with `node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>'`.-Unknown/missing records block native capability approval for implementation.-Existing pure source/UI planning may continue explicitly unverified; do not-turn a plan-only proposal into a native-readiness claim.+read-only with `node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>' --local-development`.+An explicit `local-development-only` result is valid context. Follow the+shared lifecycle's local-development policy for installed APIs and unverified+handoffs; do not turn local planning into a Player-readiness claim.From the planner prompt extract:- **Target platforms** — always iOS + Android. The foreground does not ask the user to choose a subset; retain platform-specific fallback behavior for both.@@ -165,13 +165,13 @@ This restriction does not apply to verified pure-JavaScript dependencies.Do not infer native code from a package-name prefix.```bash-node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>'+node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>' --local-development```Carry the sanitized resolved context unchanged to every architect, screen-planner, revision, and downstream builder. Missing published compatibility-metadata blocks native mutations; it is not evidence that every package is supported.-Inspect `nativePackages` for canonical `node_modules`-relative package paths+planner, revision, and downstream builder. Local-development results carry+unverified status rather than a release inventory. For strict resolved context,+inspect `nativePackages` for canonical `node_modules`-relative package pathsand exact reviewed versions, including nested native dependencies. Inspect`managedDependencies` for published host dependency declarations. These are packagemetadata, not absolute project paths, raw manifests, or lockfile download URLs.diff --git a/plugins/mobile-apps/agents/screen-builder.md b/plugins/mobile-apps/agents/screen-builder.mdindex 344f89a7a..badd69596 100644--- a/plugins/mobile-apps/agents/screen-builder.md+++ b/plugins/mobile-apps/agents/screen-builder.md@@ -30,10 +30,10 @@ You will be invoked by `/create-mobile-app` Step 11 or `/edit-app` screen-rebuil- **App-matched release context.** Read[release lifecycle](../shared/references/mobile-release-lifecycle.md) and usethe orchestrator's sanitized resolved context, not the newest bundled- template. A missing context is `NEEDS_CONTEXT`; unknown/missing release- records block new/changed native use. Existing pure source/UI work may- continue against installed APIs with native compatibility explicitly- unverified. Never install/upgrade a host, Expo package, controls aggregate,+ template. A missing context is `NEEDS_CONTEXT`; an explicit+ `local-development-only` result is valid context under the shared lifecycle+ policy. Existing pure source/UI work may continue explicitly unverified.+ Never install/upgrade a host, Expo package, controls aggregate,or leaf to make a screen compile, and never claim native validation from tsc.Preserve and forward the same context on any handoff.Release-matched installed APIs take precedence over illustrative samples indiff --git a/plugins/mobile-apps/agents/screen-planner.md b/plugins/mobile-apps/agents/screen-planner.mdindex 78fdb8ccf..90b4b13ab 100644--- a/plugins/mobile-apps/agents/screen-planner.md+++ b/plugins/mobile-apps/agents/screen-planner.md@@ -38,8 +38,8 @@ The planner gives you:for existing pure source/UI work. Read[release lifecycle](../shared/references/mobile-release-lifecycle.md); use thesame context throughout planning and builder handoffs. Do not use the newest- bundled template as a runtime allowlist. Unknown/missing release records- block new/changed native use, not pure source/UI planning. Mark native+ bundled template as a runtime allowlist. An explicit `local-development-only`+ result follows the shared lifecycle policy, not a startup admission gate. Mark nativecompatibility unverified; approval and previews are not native validation.Treat sample APIs as illustrative: verify them against installed releasedocs/types before planning their use, rather than assuming newest-host APIs.diff --git a/plugins/mobile-apps/hooks/validate-package-deps.js b/plugins/mobile-apps/hooks/validate-package-deps.jsindex 1be38a1f0..0fa8aa432 100644--- a/plugins/mobile-apps/hooks/validate-package-deps.js+++ b/plugins/mobile-apps/hooks/validate-package-deps.js@@ -151,6 +151,40 @@ function main(input) {fail('Diagnostic artifact mode is retired. Resolve the app against its published host and template packages.');}const explicit = toolInput.validation_mode === 'explicit-mobile-workflow';+ const approved = approvedJsDependencies(toolInput);+ if (explicit && toolInput.validation_scope === 'local-development') {+ const before = toolInput.before_package_json ?? reconstructBefore(toolName, toolInput, content);+ const baseline = before === null ? null : packageDeps(parseJson(before, 'previous package.json'));+ // Installation workflows supply the pre-install manifest. Ordinary local+ // checks have no dependency delta and must not re-admit existing packages.+ const planned = baseline ? new Set(Object.keys(dependencies).filter((name) =>+ dependencies[name] !== baseline[name] && !isRuntimePackage(name))) : new Set(approved.keys());+ for (const name of planned) {+ if (approved.get(name) !== dependencies[name]) {+ fail(`Dependency \`${name}\` requires the same exact name/version from the user-approved JavaScript Dependencies plan.`);+ }+ }+ if (planned.size) {+ const installed = inspectInstalledPackages(projectRoot, null, planned);+ // Existing root peers (e.g. React/RN) do not make a JS UI library native.+ // Inspect only the planned packages' closures, without release admission.+ const peers = new Set(Object.keys(dependencies).filter((name) => installed.has(`node_modules/${name}`)+ && (!baseline || baseline[name] === dependencies[name]))+ .map((name) => `node_modules/${name}`));+ for (const name of planned) {+ if (installed.get(`node_modules/${name}`)?.version !== approved.get(name)) {+ fail(`Approved JavaScript dependency \`${name}\` must be installed at its exact approved version.`);+ }+ if (hasNativeClosure(installed, `node_modules/${name}`, peers)) {+ fail(`Dependency \`${name}\` contains native/runtime code and cannot be added through a JavaScript Dependencies plan.`);+ }+ }+ }+ // Package policy still applies above, but a template-lock/native mismatch+ // must not prevent npm installation or trying the app in Dev Player.+ process.stderr.write('WARNING: Local development does not verify Dev Player/Wrap compatibility. Use /debug-app for observed native failures.\n');+ return;+ }if (explicit && toolInput.validation_scope === 'upgrade-only') {// The host CLI owns installation; upgrades rely on Expo/Doctor/TypeScript,// not this separate app-lock and native-inventory admission policy.@@ -168,7 +202,6 @@ function main(input) {installed = inspectInstalledPackages(projectRoot);baseline = legacyBaseline(toolName, toolInput, content, projectRoot, installed);}- const approved = approvedJsDependencies(toolInput);const unchangedPeers = new Set(Object.entries(baseline).filter(([name, version]) => dependencies[name] === version&& installed.has(`node_modules/${name}`)).map(([name]) => `node_modules/${name}`));for (const name of new Set([...Object.keys(baseline), ...Object.keys(dependencies)])) {diff --git a/plugins/mobile-apps/scripts/lib/mobile-published-packages.js b/plugins/mobile-apps/scripts/lib/mobile-published-packages.jsindex fb19ab460..73b00e057 100644--- a/plugins/mobile-apps/scripts/lib/mobile-published-packages.js+++ b/plugins/mobile-apps/scripts/lib/mobile-published-packages.js@@ -3,6 +3,7 @@const fs = require('node:fs');const os = require('node:os');const path = require('node:path');+const semver = require('../vendor/semver.cjs');const { runCliSync, CliLaunchError } = require('./process-runner');const { unpack, hashFile, readOfflineContract, verifyInstalledOfflineSdk } = require('./mobile-package-artifacts');const {@@ -197,6 +198,7 @@ function templateState(template) {}function findTemplate(source, host, requestedVersion) {+ const managed = validateHost(host);const versions = requestedVersion ? [requestedVersion]: source.versions().filter((version) => exactVersion(version, true)).sort((a, b) => compareVersions(b, a));for (const version of versions) {@@ -228,6 +230,19 @@ function findTemplate(source, host, requestedVersion) {requireValue(template.lock.packages[`node_modules/${name}`]?.version === version,'The template lock does not match the selected host Expo/React/React Native requirements.');}+ // Validate the publication against its own host before skipping an incompatible candidate.+ const baselineContract = contractFromPackages(baseline, template);+ const compatible = Object.values(managed).every((dependencies) => Object.entries(dependencies).every(([name, spec]) => {+ if (name === HOST) return true;+ const version = baselineContract.nativePackages[`node_modules/${name}`];+ return version+ ? spec.startsWith('file:./vendor/') || semver.satisfies(version, spec)+ : !isRuntimePackage(name);+ }));+ if (!compatible) {+ if (requestedVersion) requireValue(false, 'Selected host and template have incompatible managed native dependency requirements.');+ continue;+ }return template;}requireValue(false, 'No published template matches this host compatibility profile. Finish publishing the matching template; do not use a bundled snapshot.');@@ -326,6 +341,8 @@ function planPublishedUpdate(projectRoot, hostVersion, options = {}) {const sourceRequirements = readSourceRequirements(projectRoot);requireValue(compareVersions(sourceRequirements.hostVersion, hostVersion) <= 0,'Selected published host would downgrade the app; choose a supported forward version.');+ requireValue(semver.major(hostVersion) <= semver.major(sourceRequirements.hostVersion) + 1,+ `Cannot skip host majors; upgrade to the latest supported ${semver.major(sourceRequirements.hostVersion) + 1}.x.x release first.`);const source = createSource({ ...options, cwd: projectRoot });const host = source.read(HOST, hostVersion);validateHost(host);@@ -349,18 +366,9 @@ function planPublishedUpdate(projectRoot, hostVersion, options = {}) {}}}- const edges = [];for (let version = sourceRequirements.templateVersion; version < target.templateVersion; version += 1) {const matching = host.migrations.filter((migration) => migration.fromTemplateVersion === version);requireValue(matching.length === 1, 'The selected published host does not contain an unambiguous migration chain for this app.');- edges.push(matching[0]);- }- if (nativeChanged) {- const fromSpec = edges[0]?.packageTransitions?.dependencies?.[HOST]?.from;- const fromVersion = typeof fromSpec === 'string' ? fromSpec.replace(/^[~^]/, '') : sourceRequirements.hostVersion;- requireValue(exactVersion(fromVersion, true)- && BigInt(hostVersion.split('.')[0]) > BigInt(fromVersion.split('.')[0]),- 'A native runtime transition requires a new host major; the published migration must identify the source host requirement.');}const hostInstallRequired = sourceRequirements.hostVersion !== hostVersion;return {diff --git a/plugins/mobile-apps/scripts/lib/mobile-release.js b/plugins/mobile-apps/scripts/lib/mobile-release.jsindex f22a4abb0..52efa2c66 100644--- a/plugins/mobile-apps/scripts/lib/mobile-release.js+++ b/plugins/mobile-apps/scripts/lib/mobile-release.js@@ -10,6 +10,16 @@ const semver = require('../vendor/semver.cjs');const HOST = '@microsoft/power-apps-native-host';const SECTIONS = ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'];const CORE = [HOST, 'expo', 'react-native', 'react'];+const RELEASE_MANAGED_PACKAGES = new Set([+ HOST,+ '@microsoft/power-apps-native-assets',+ '@microsoft/power-apps-native-auth',+ '@microsoft/power-apps-native-common',+ '@microsoft/power-apps-native-controls',+ '@microsoft/power-apps-native-offline',+ '@microsoft/power-apps-native-push-notifications',+ '@microsoft/power-apps-native-template',+]);const TOKEN = /^[a-zA-Z0-9][a-zA-Z0-9._+-]{0,127}$/;const PACKAGE_PART = '[a-z0-9][a-z0-9._-]*';const PACKAGE_NAME = new RegExp(`^(?:@${PACKAGE_PART}/)?${PACKAGE_PART}$`);@@ -242,38 +252,61 @@ function detectsNative(directory, pkg) {return visit(directory);}-function inspectInstalledPackages(projectRoot, lock) {+function inspectInstalledPackages(projectRoot, lock, dependencyRoots) {const installed = new Map();+ const scoped = dependencyRoots !== undefined;+ const available = { has: (relativePath) => fs.existsSync(path.join(projectRoot, relativePath)) };+ function visitPackage(relativePath) {+ if (installed.has(relativePath)) return;+ requireValue(safeInstallPath(relativePath), 'Unsupported installed package path.');+ const absolutePath = path.join(projectRoot, relativePath);+ if (scoped) {+ // Scoped reads bypass visitModules, so check the containing scopes and+ // node_modules directories too, without enumerating unrelated packages.+ let directory = projectRoot;+ for (const part of relativePath.split('/').slice(0, -1)) {+ directory = path.join(directory, part);+ requireValue(!fs.lstatSync(directory).isSymbolicLink(), 'Linked packages cannot be verified against the reviewed runtime.');+ }+ }+ requireValue(!fs.lstatSync(absolutePath).isSymbolicLink(), 'Linked packages cannot be verified against the reviewed runtime.');+ const pkg = readJson(path.join(absolutePath, 'package.json'), 'installed package manifest');+ const name = relativePath.split('/node_modules/').pop().replace(/^node_modules\//, '');+ requireValue(safePackageName(pkg.name) && exactVersion(pkg.version), 'Installed package identity or version is invalid.');+ dependencySections(pkg);+ const native = isRuntimePackage(name) || isRuntimePackage(pkg.name) || detectsNative(absolutePath, pkg);+ const alias = pkg.name !== name;+ const locked = lock?.packages?.[relativePath];+ if (alias) {+ // npm aliases retain the canonical package name, e.g.+ // string-width-cjs -> string-width. Strict admission also binds the lock;+ // scoped JS inspection classifies actual contents without consulting it.+ requireValue(!native, 'Native/runtime npm aliases cannot be admitted by the reviewed inventory schema.');+ if (!scoped) requireValue([2, 3].includes(lock?.lockfileVersion) && object(locked) && !locked.link+ && locked.name === pkg.name && locked.version === pkg.version,+ 'Installed npm alias must match its canonical name and exact version in the app lock.');+ }+ requireValue(locked?.name === undefined || locked.name === pkg.name, 'Installed package canonical identity differs from the app lock.');+ installed.set(relativePath, {+ name, canonicalName: pkg.name, alias, version: pkg.version, pkg, native,+ });+ if (scoped) {+ // A native node already answers the JS-only question. Do not inspect its+ // subtree or unrelated nested packages; root React/RN peers are reusable.+ if (native) return;+ for (const [name, edge] of dependencyEdges(pkg)) {+ const dependency = resolveInstalledDependency(available, relativePath, name);+ requireValue(dependency || edge.optional, `Cannot inspect missing JavaScript dependency ${name}. Install the approved package before validation.`);+ if (dependency) visitPackage(dependency);+ }+ } else {+ visitModules(`${relativePath}/node_modules`);+ }+ }function visitModules(relativeDirectory) {const directory = path.join(projectRoot, relativeDirectory);if (!fs.existsSync(directory)) return;requireValue(!fs.lstatSync(directory).isSymbolicLink(), 'Linked node_modules cannot be verified against the reviewed runtime.');- function visitPackage(relativePath) {- requireValue(safeInstallPath(relativePath), 'Unsupported installed package path.');- const absolutePath = path.join(projectRoot, relativePath);- requireValue(!fs.lstatSync(absolutePath).isSymbolicLink(), 'Linked packages cannot be verified against the reviewed runtime.');- const pkg = readJson(path.join(absolutePath, 'package.json'), 'installed package manifest');- const name = relativePath.split('/node_modules/').pop().replace(/^node_modules\//, '');- requireValue(safePackageName(pkg.name) && exactVersion(pkg.version), 'Installed package identity or version is invalid.');- dependencySections(pkg);- const native = isRuntimePackage(name) || isRuntimePackage(pkg.name) || detectsNative(absolutePath, pkg);- const alias = pkg.name !== name;- const locked = lock?.packages?.[relativePath];- if (alias) {- // npm aliases retain the canonical package name in package.json and the- // v2/v3 lock entry, e.g. string-width-cjs -> string-width. The release- // inventory cannot bind a separate canonical native identity safely.- requireValue(!native, 'Native/runtime npm aliases cannot be admitted by the reviewed inventory schema.');- requireValue([2, 3].includes(lock?.lockfileVersion) && object(locked) && !locked.link- && locked.name === pkg.name && locked.version === pkg.version,- 'Installed npm alias must match its canonical name and exact version in the app lock.');- }- requireValue(locked?.name === undefined || locked.name === pkg.name, 'Installed package canonical identity differs from the app lock.');- installed.set(relativePath, {- name, canonicalName: pkg.name, alias, version: pkg.version, pkg, native,- });- visitModules(`${relativePath}/node_modules`);- }for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {if (entry.name.startsWith('.')) continue;if (entry.name.startsWith('@')) {@@ -289,8 +322,12 @@ function inspectInstalledPackages(projectRoot, lock) {}try {const lockPath = path.join(projectRoot, 'package-lock.json');- if (lock === undefined && fs.existsSync(lockPath)) lock = readJson(lockPath, 'package-lock.json');- visitModules('node_modules');+ if (!scoped && lock === undefined && fs.existsSync(lockPath)) lock = readJson(lockPath, 'package-lock.json');+ if (scoped) {+ for (const name of dependencyRoots) visitPackage(`node_modules/${name}`);+ } else {+ visitModules('node_modules');+ }return installed;} catch (error) {if (error.code === 'MOBILE_RELEASE_BLOCKED') throw error;@@ -459,25 +496,48 @@ function readProject(projectRoot, platformContext) {function validateProjectAgainstRelease(project, release) {const { declarations, installed, lock } = project;+ // This gate owns published first-party compatibility, not a byte-for-byte+ // template dependency graph. npm/Expo and the app's own lock validate the rest.const managed = new Set();for (const section of SECTIONS) {for (const [name, spec] of Object.entries(release.managedDependencies[section] || {})) {- requireValue(declarations[section]?.[name] === spec, `Managed dependency ${name} does not match the reviewed release declaration. Restore the release dependency set.`);+ if (!RELEASE_MANAGED_PACKAGES.has(name)) continue;+ const actual = installed.get(`node_modules/${name}`);+ const declared = declarations[section]?.[name];+ // "^1.0.0" and "1.0.0" can resolve to the same admitted native version.+ // Vendor archives have no SemVer range, so retain their exact declaration.+ requireValue(typeof declared === 'string' && (spec.startsWith('file:')+ ? declared === spec+ : semver.validRange(declared) !== null && semver.satisfies(actual?.version || '', declared)+ && semver.satisfies(actual?.version || '', spec)),+ `Managed dependency ${name} does not satisfy the reviewed release requirements. Restore the release dependency set.`);requireValue(SECTIONS.every((other) => other === section || !Object.hasOwn(declarations[other] || {}, name)), 'A managed dependency is shadowed in another dependency section.');managed.add(name);}}for (const dependencies of Object.values(declarations)) {for (const name of Object.keys(dependencies)) {- requireValue(managed.has(name) || !(isRuntimePackage(name) || installed.get(`node_modules/${name}`)?.native), `Native/runtime dependency ${name} is not managed by this app's verified release.`);+ requireValue(managed.has(name) || !RELEASE_MANAGED_PACKAGES.has(name), `Native/runtime dependency ${name} is not managed by this app's verified first-party release.`);}}+ const reviewed = new Set();for (const [installPath, version] of Object.entries(release.nativePackages)) {- requireValue(installed.get(installPath)?.version === version && lock.packages[installPath]?.version === version, 'Installed native inventory does not match the reviewed release, including nested package versions. Restore the release lock and installation.');+ const name = installPath.split('/node_modules/').pop().replace(/^node_modules\//, '');+ if (RELEASE_MANAGED_PACKAGES.has(name)) reviewed.add(`${name}@${version}`);}+ const missing = new Set(reviewed);for (const [installPath, actual] of installed) {- requireValue(!actual.native || release.nativePackages[installPath] === actual.version, 'Unreviewed native package detected in the installed dependency tree. Select a verified runtime that includes it; JavaScript approval cannot add native code.');+ if (!RELEASE_MANAGED_PACKAGES.has(actual.canonicalName)) continue;+ // npm may hoist an unchanged first-party package to a different path. Check every+ // installed instance by identity/version, not against the template's layout;+ // the app's own lock still has to match that instance at its actual path.+ const identity = `${actual.canonicalName}@${actual.version}`;+ requireValue(reviewed.has(identity)+ && lock.packages[installPath]?.version === actual.version,+ `Unreviewed first-party package ${identity}: first-party native inventory does not match the reviewed release, including nested package versions. Restore the release dependency set.`);+ missing.delete(identity);}+ requireValue(missing.size === 0, 'First-party native inventory is missing reviewed package versions. Restore the release dependency set.');}function reviewedProjectCatalog(catalog) {diff --git a/plugins/mobile-apps/scripts/resolve-mobile-release.js b/plugins/mobile-apps/scripts/resolve-mobile-release.jsindex 73d2185a5..dd8938b6d 100644--- a/plugins/mobile-apps/scripts/resolve-mobile-release.js+++ b/plugins/mobile-apps/scripts/resolve-mobile-release.js@@ -12,11 +12,11 @@ function main(argv) {selectRelease, resolveProjectRelease, selectProjectRelease, summarizeRelease,} = require('./lib/mobile-release');const values = {};- const flags = new Set(['--project-root', '--release', '--host-version', '--template-version', '--default', '--platform', '--base-version', '--base-fingerprint', '--base-runtime-version', '--requirements-only']);+ const flags = new Set(['--project-root', '--release', '--host-version', '--template-version', '--default', '--platform', '--base-version', '--base-fingerprint', '--base-runtime-version', '--requirements-only', '--local-development']);for (let index = 0; index < argv.length; index += 1) {const flag = argv[index];if (!flags.has(flag) || Object.hasOwn(values, flag)) fail('Unknown or duplicate release resolver argument.');- if (flag === '--default' || flag === '--requirements-only') {+ if (flag === '--default' || flag === '--requirements-only' || flag === '--local-development') {values[flag] = true;} else {const value = argv[++index];@@ -49,6 +49,34 @@ function main(argv) {fail('Requirements-only planning cannot assert a selected release or check deployment targets. Use strict project resolution for admission and deployment.');}}+ if (values['--local-development']+ && (!values['--project-root'] || ['--platform', '--requirements-only', '--release', '--host-version', '--template-version', '--default'].some((flag) => values[flag]))) {+ fail('Local-development diagnostics require --project-root and cannot select a release or authorize deployment.');+ }+ if (values['--local-development']) {+ const fs = require('node:fs');+ if (!fs.existsSync(values['--project-root']) || !fs.statSync(values['--project-root']).isDirectory()) {+ fail('Local-development diagnostics require an existing project directory.');+ }+ const summary = {+ validationScope: 'local-development-only', packageCompatibility: 'unverified',+ warnings: ['Native compatibility is not checked; local installation/startup may continue. Use /debug-app if Dev Player fails.'],+ };+ // Read recorded requirements only: local startup must not wait on registry+ // access, inspect the dependency tree, or pretend to admit a native release.+ try {+ const source = selectProjectRelease(values['--project-root']);+ summary.templateVersion = source.templateVersion;+ summary.nativeRuntimeVersions = source.nativeRuntimeVersions;+ summary.hostVersion = source.hostVersion;+ } catch (error) {+ if (error.code !== 'MOBILE_RELEASE_BLOCKED') throw error;+ summary.warnings.unshift(error.message);+ }+ process.stderr.write(`${summary.warnings.map((warning) => `WARNING: ${warning}`).join('\n')}\n`);+ process.stdout.write(`${JSON.stringify(summary, null, 2)}\n`);+ return;+ }let selected = null;const context = values['--project-root'] ? { cwd: values['--project-root'] } : {};diff --git a/plugins/mobile-apps/scripts/tests/mobile-published-packages.test.js b/plugins/mobile-apps/scripts/tests/mobile-published-packages.test.jsindex fabada46f..6271f7d93 100644--- a/plugins/mobile-apps/scripts/tests/mobile-published-packages.test.js+++ b/plugins/mobile-apps/scripts/tests/mobile-published-packages.test.js@@ -112,6 +112,22 @@ test('requirements-only inspection reads recorded state without a catalogue or rassert.deepEqual(f.requests, []);});+test('local-development CLI reads requirements without lock, inventory or registry admission', (t) => {+ const f = fixture(t);+ fs.writeFileSync(path.join(f.projectRoot, 'package-lock.json'), 'not JSON');+ fs.writeFileSync(path.join(f.projectRoot, 'node_modules/expo-haptics/package.json'), 'not JSON');+ const result = spawnSync(process.execPath, [+ path.resolve(__dirname, '../resolve-mobile-release.js'),+ '--project-root', f.projectRoot, '--local-development',+ ], { cwd: f.projectRoot, encoding: 'utf8' });+ assert.equal(result.status, 0, result.stderr);+ const summary = JSON.parse(result.stdout);+ assert.equal(summary.templateVersion, 1);+ assert.equal(summary.hostVersion, '1.0.0');+ assert.equal(summary.packageCompatibility, 'unverified');+ assert.equal(summary.nativePackages, undefined);+});+test('published contract derives native pins from the template lock without inventing binary availability', (t) => {const f = fixture(t);const result = selectPublishedContract('1.0.0', f.options);@@ -170,6 +186,60 @@ test('same-runtime host patch uses the existing compatible template without a Plassert.match(result.binaryAvailability, /not-checked/);});+test('same-runtime host selection accepts an older template SDK and CLI without retaining their JavaScript versions', t => {+ const f = fixture(t);+ const sdk = '@microsoft/power-apps';+ const cli = '@microsoft/power-apps-cli';+ const baseline = f.packages.get(`${HOST}@1.0.0`);+ baseline.profile.managedDependencies[sdk] = '1.5.0';+ baseline.profile.managedDevDependencies = { [cli]: '1.2.0' };+ const template = f.packages.get(`${TEMPLATE}@1.0.0`);+ for (const manifest of [template.manifest, template.lock.packages['']]) {+ manifest.dependencies[sdk] = '1.5.0';+ manifest.devDependencies = { [cli]: '1.2.0' };+ }+ template.lock.packages[`node_modules/${sdk}`] = { version: '1.5.0' };+ template.lock.packages[`node_modules/${cli}`] = { version: '1.2.0' };+ const selected = f.host('1.0.4');+ selected.profile.managedDependencies[sdk] = '1.6.0';+ selected.profile.managedDevDependencies = { [cli]: '1.4.1' };++ const contract = selectPublishedContract('1.0.4', f.options);+ assert.equal(contract.template.version, '1.0.0');+ assert.equal(contract.managedDependencies.dependencies[sdk], '1.6.0');+ assert.equal(contract.managedDependencies.devDependencies[cli], '1.4.1');+ assert.equal(Object.hasOwn(contract.nativePackages, `node_modules/${sdk}`), false);+ assert.equal(Object.hasOwn(contract.nativePackages, `node_modules/${cli}`), false);+ assert.equal(planPublishedUpdate(f.projectRoot, '1.0.4', f.options).kind, 'host-repair');+});++test('template discovery skips a valid maintenance publication with incompatible managed native versions', t => {+ const f = fixture(t);+ const offline = '@microsoft/power-apps-native-offline';+ for (const [hostVersion, templateVersion, sdkVersion] of [+ ['1.1.0', '1.1.0', '0.2.2'],+ ['1.0.5', '1.1.1', '0.2.3'],+ ]) {+ f.host(hostVersion).profile.managedDependencies[offline] = sdkVersion;+ const template = f.template(templateVersion, hostVersion);+ template.manifest.dependencies[offline] = sdkVersion;+ template.lock.packages[''].dependencies[offline] = sdkVersion;+ template.lock.packages[`node_modules/${offline}`] = { version: sdkVersion };+ }+ assert.equal(selectPublishedContract('1.0.5', { ...f.options, templateVersion: '1.1.1' }).template.version, '1.1.1');+ assert.equal(selectPublishedContract('1.1.0', f.options).template.version, '1.1.0');+ assert.equal(planPublishedUpdate(f.projectRoot, '1.1.0', f.options).target.template.version, '1.1.0');+ assert.throws(() => selectPublishedContract('1.1.0', {+ ...f.options, templateVersion: '1.1.1',+ }), /incompatible managed native dependency/);++ f.packages.get(`${HOST}@1.1.0`).profile.managedDependencies[offline] = '^0.2.2';+ assert.equal(selectPublishedContract('1.1.0', f.options).template.version, '1.1.1');++ f.packages.get(`${TEMPLATE}@1.1.1`).lock.packages[`node_modules/${offline}`].version = 'invalid';+ assert.throws(() => selectPublishedContract('1.1.0', f.options), /invalid native lock entry/);+});+test('a non-native template migration advances template state without changing native runtime', (t) => {const f = fixture(t);f.host('1.1.0', 2, 1, [migration('1.1.0')]);@@ -204,11 +274,41 @@ test('a manually updated host does not hide the older recorded template or requiassert.equal(result.target.templateVersion, 2);});-test('native changes cannot be hidden in a patch or minor target', (t) => {+test('native patch/minor transitions are supported through an explicit template migration', (t) => {const f = fixture(t);f.host('1.1.0', 2, 2, [migration('1.1.0')]);f.template('1.1.0', '1.1.0');- assert.throws(() => planPublishedUpdate(f.projectRoot, '1.1.0', f.options), /new host major/);+ const result = planPublishedUpdate(f.projectRoot, '1.1.0', f.options);+ assert.equal(result.kind, 'template-upgrade');+ assert.equal(result.nativeChanged, true);+ f.host('3.0.0', 2, 2, [migration('3.0.0')]);+ assert.throws(() => planPublishedUpdate(f.projectRoot, '3.0.0', f.options), /2\.x\.x release first/);+});++test('0.5.1 and 1.0.3 apps select the final 1.0.4 native release without acquiring the intermediate host', async (t) => {+ for (const [sourceHost, version] of [['0.5.1', 1], ['1.0.3', 2]]) {+ await t.test(sourceHost, (t) => {+ const f = fixture(t);+ modifyJson(path.join(f.projectRoot, 'node_modules', HOST, 'package.json'), (pkg) => { pkg.version = sourceHost; });+ modifyJson(path.join(f.projectRoot, 'app.json'), (app) => {+ Object.assign(app.expo.extra.powerappsNative, {+ templateVersion: version, nativeRuntimeVersions: { android: version, ios: version },+ });+ });+ const first = migration('1.0.3', '^0.5.1');+ const next = {+ ...migration('1.0.4', '^1.0.3'), id: 'template-v3', fromTemplateVersion: 2, toTemplateVersion: 3,+ };+ f.host('1.0.4', 3, 3, [first, next]);+ f.template('1.0.4', '1.0.4');+ const result = planPublishedUpdate(f.projectRoot, '1.0.4', f.options);+ assert.equal(result.kind, 'template-upgrade');+ assert.equal(result.target.host.version, '1.0.4');+ assert.equal(result.target.templateVersion, 3);+ assert.equal(result.nativeChanged, true);+ assert.equal(f.requests.includes(`${HOST}@1.0.3`), false);+ });+ }});test('unpublished or unfinalized targets fail before mutation without falling back', (t) => {@@ -242,22 +342,26 @@ test('current-version upgrade planning does not read the app lock or dependencyassert.equal(planPublishedUpdate(f.projectRoot, '1.0.0', f.options).kind, 'current');});-test('native inventory comes from the published lock, never from the customer lock', (t) => {+test('first-party inventory comes from the published lock, never from the customer lock', (t) => {const f = fixture(t);+ const name = '@microsoft/power-apps-native-common';+ const installPath = `node_modules/${name}`;+ f.packages.get(`${TEMPLATE}@1.0.0`).lock.packages[installPath] = { version: '1.0.0' };+ addDependency(f.projectRoot, name, '1.0.0', { section: null });const project = () => readProject(f.projectRoot, readPlatformContext());validateProjectAgainstRelease(project(), projectContract(f.projectRoot, project(), f.options));- modifyJson(path.join(f.projectRoot, 'node_modules/expo-haptics/package.json'), (pkg) => { pkg.version = '1.0.1'; });- modifyJson(path.join(f.projectRoot, 'package-lock.json'), (lock) => { lock.packages['node_modules/expo-haptics'].version = '1.0.1'; });+ modifyJson(path.join(f.projectRoot, installPath, 'package.json'), (pkg) => { pkg.version = '1.0.1'; });+ modifyJson(path.join(f.projectRoot, 'package-lock.json'), (lock) => { lock.packages[installPath].version = '1.0.1'; });const changed = project();assert.throws(() => validateProjectAgainstRelease(changed, projectContract(f.projectRoot, changed, f.options)), /native inventory/);});-test('custom native code cannot extend the fixed runtime', (t) => {+test('third-party native packages are outside the first-party release gate', (t) => {const f = fixture(t);addDependency(f.projectRoot, 'ordinary-wrapper', '1.0.0');fs.mkdirSync(path.join(f.projectRoot, 'node_modules/ordinary-wrapper/android'));const project = readProject(f.projectRoot, readPlatformContext());- assert.throws(() => validateProjectAgainstRelease(project, projectContract(f.projectRoot, project, f.options)), /not managed|Unreviewed native/);+ assert.doesNotThrow(() => validateProjectAgainstRelease(project, projectContract(f.projectRoot, project, f.options)));});test('runtime labels cannot excuse mismatching published fingerprints', (t) => {diff --git a/plugins/mobile-apps/scripts/tests/mobile-release-surfaces.test.js b/plugins/mobile-apps/scripts/tests/mobile-release-surfaces.test.jsindex af7168ce9..2afa87f4a 100644--- a/plugins/mobile-apps/scripts/tests/mobile-release-surfaces.test.js+++ b/plugins/mobile-apps/scripts/tests/mobile-release-surfaces.test.js@@ -189,7 +189,7 @@ test('controls adoption is conditional and documents the public aggregate contraassert.match(source, /Expo 55/);assert.match(source, /not evidence of Expo 57 compatibility/);assert.match(source, /Do not install the aggregate to[\s\S]{0,20}fix older binaries/);- assert.match(source, /Legacy leaf imports are allowed only when the resolved release actually includes[\s\S]{0,50}matching leaf and version/);+ assert.match(source, /Legacy leaf imports follow the same strict\/local rules for the matching version/);assert.match(source, /installed public README, exports, and types/);});@@ -208,7 +208,6 @@ test('control wrapper examples guard platforms before lazy literal subpath imporassert.doesNotMatch(example, /from ['"]@microsoft\/power-apps-native-/);assert.doesNotMatch(example, /import\(['"]@microsoft\/power-apps-native-controls['"]\)/);assert.match(source, /legacy/i);- assert.match(source, /verified release|resolved release/);}});@@ -259,7 +258,8 @@ test('source-only editing and JS planning stay available without a native compatconst edit = read('skills/edit-app/SKILL.md');const js = read('shared/references/javascript-dependency-planning.md');const version = read('shared/version-check.md');- assert.match(edit, /block native mutations, not[\s\S]{0,60}pure source\/UI planning and editing/);+ assert.match(edit, /source-only work can use installed contracts/);+ assert.match(edit, /Do not force repair before local startup/);assert.match(edit, /exact verified release/);assert.match(edit, /Release context: <sanitized resolved tuple/);assert.match(edit, /Approve and apply/);diff --git a/plugins/mobile-apps/scripts/tests/mobile-release.test.js b/plugins/mobile-apps/scripts/tests/mobile-release.test.jsindex 81a46f9d5..7caffb146 100644--- a/plugins/mobile-apps/scripts/tests/mobile-release.test.js+++ b/plugins/mobile-apps/scripts/tests/mobile-release.test.js@@ -539,6 +539,96 @@ test('declared managed dependencies cannot be moved to another section', (t) =>blocked(runCli(fixture, ['--project-root', fixture.projectRoot]), /Managed dependency/);});+test('equivalent first-party declarations may differ while resolving to the reviewed version', (t) => {+ const fixture = createFixture(t);+ for (const file of ['package.json', 'package-lock.json']) modifyJson(path.join(fixture.projectRoot, file), (data) => {+ (data.packages?.[''] || data).dependencies[HOST] = '1.0.0';+ });+ assert.equal(resolveProjectRelease(fixture.projectRoot, fixture.catalog), fixture.release);+});++test('third-party runtime and tooling lock versions need not match the template', (t) => {+ const release = fixtureRelease();+ release.managedDependencies.devDependencies = { typescript: '5.0.0' };+ release.nativePackages['node_modules/@expo/cli'] = '1.0.0';+ const fixture = createFixture(t, { release });+ addDependency(fixture.projectRoot, 'typescript', '5.1.0', { section: 'devDependencies' });+ addDependency(fixture.projectRoot, '@expo/cli', '1.1.0');+ for (const name of ['expo', 'react', 'react-native', 'expo-haptics']) {+ addDependency(fixture.projectRoot, name, '1.1.0');+ }+ assert.equal(resolveProjectRelease(fixture.projectRoot, fixture.catalog), fixture.release);+});++test('first-party inventory tolerates npm hoisting but checks each installed version', (t) => {+ const release = fixtureRelease();+ const name = '@microsoft/power-apps-native-common';+ const original = `node_modules/expo/node_modules/${name}`;+ release.nativePackages[original] = '1.0.0';+ const fixture = createFixture(t, { release });+ const hoisted = `node_modules/${name}`;+ fs.mkdirSync(path.dirname(path.join(fixture.projectRoot, hoisted)), { recursive: true });+ fs.renameSync(path.join(fixture.projectRoot, original), path.join(fixture.projectRoot, hoisted));+ modifyJson(path.join(fixture.projectRoot, 'package-lock.json'), (lock) => {+ lock.packages[hoisted] = lock.packages[original];+ delete lock.packages[original];+ });+ assert.equal(resolveProjectRelease(fixture.projectRoot, fixture.catalog), fixture.release);+ addDependency(fixture.projectRoot, name, '1.0.1', {+ section: null, installPath: original, properties: { codegenConfig: {} },+ });+ assert.throws(() => resolveProjectRelease(fixture.projectRoot, fixture.catalog), /Unreviewed first-party package @microsoft\/[email protected]/);+});++test('offline lock versions must match the reviewed first-party release', (t) => {+ const release = fixtureRelease();+ const name = '@microsoft/power-apps-native-offline';+ release.managedDependencies.dependencies[name] = '^1.0.0';+ release.nativePackages[`node_modules/${name}`] = '1.0.0';+ const fixture = createFixture(t, { release });+ assert.equal(resolveProjectRelease(fixture.projectRoot, fixture.catalog), fixture.release);+ addDependency(fixture.projectRoot, name, '1.0.1');+ assert.throws(() => resolveProjectRelease(fixture.projectRoot, fixture.catalog), /Unreviewed first-party package.*offline/);+});++test('local development reports mismatch or preinstall state without blocking installation/startup', (t) => {+ for (const change of [+ (fixture) => addDependency(fixture.projectRoot, '@microsoft/power-apps-native-controls', '1.0.0'),+ (fixture) => fs.unlinkSync(path.join(fixture.projectRoot, 'package-lock.json')),+ (fixture) => fs.rmSync(path.join(fixture.projectRoot, 'node_modules'), { recursive: true }),+ ]) {+ const fixture = createFixture(t);+ change(fixture);+ blocked(runCli(fixture, ['--project-root', fixture.projectRoot]));+ const result = runCli(fixture, ['--project-root', fixture.projectRoot, '--local-development']);+ assert.equal(result.status, 0, result.stderr);+ assert.match(result.stderr, /WARNING:[\s\S]*installation\/startup may continue[\s\S]*\/debug-app/);+ const summary = JSON.parse(result.stdout);+ assert.equal(summary.validationScope, 'local-development-only');+ assert.equal(summary.packageCompatibility, 'unverified');+ assert.ok(summary.warnings.length > 0);+ assert.equal(summary.nativePackages, undefined, 'Local diagnostics must not fabricate a verified inventory');+ assert.equal(summary.id, undefined);+ assert.doesNotMatch(result.stdout + result.stderr, /fixture-secret-do-not-echo/);+ }+});++test('local-development mode cannot bypass deployment or argument validation', (t) => {+ const fixture = createFixture(t);+ const platform = fixture.release.platforms.android;+ for (const args of [+ ['--local-development'],+ ['--project-root', fixture.projectRoot, '--local-development', '--requirements-only'],+ ['--project-root', fixture.projectRoot, '--local-development', '--platform', 'android',+ '--base-version', platform.base.version, '--base-fingerprint', platform.fingerprint],+ ['--project-root', fixture.projectRoot, '--local-development', '--unknown'],+ ['--project-root', path.join(fixture.projectRoot, 'missing'), '--local-development'],+ ...[+ ['--host-version', '1.0.0'], ['--template-version', '1.0.0'], ['--default'],+ ].map((selection) => ['--project-root', fixture.projectRoot, '--local-development', ...selection]),+ ]) blocked(runCli(fixture, args));+});+test('uninstalled, untracked and lock-mismatched native dependencies cannot pass', (t) => {for (const edit of [(root) => fs.rmSync(path.join(root, 'node_modules/expo'), { recursive: true }),@@ -588,14 +678,15 @@ test('missing CLI implementation files still produce sanitized BLOCKED errors',blocked(runCli(fixture, ['--default']), /Unable to verify/);});-test('a nested second native instance cannot borrow approval from a root instance', (t) => {+test('a nested second first-party instance cannot borrow approval from a root instance', (t) => {const release = fixtureRelease();- release.nativePackages['node_modules/ordinary-bridge'] = '1.0.0';+ const name = '@microsoft/power-apps-native-common';+ release.nativePackages[`node_modules/${name}`] = '1.0.0';const fixture = createFixture(t, { release });- addDependency(fixture.projectRoot, 'ordinary-bridge', '2.0.0', {- section: null, installPath: 'node_modules/expo/node_modules/ordinary-bridge', properties: { codegenConfig: {} },+ addDependency(fixture.projectRoot, name, '2.0.0', {+ section: null, installPath: `node_modules/expo/node_modules/${name}`, properties: { codegenConfig: {} },});- blocked(runCli(fixture, ['--project-root', fixture.projectRoot]), /Unreviewed native/);+ blocked(runCli(fixture, ['--project-root', fixture.projectRoot]), /Unreviewed first-party/);});test('unsafe lock paths and symlinked installations fail closed', (t) => {@@ -856,19 +947,19 @@ test('missing required lock entries are not optional merely because a skipped paassert.throws(() => resolveProjectRelease(fixture.projectRoot, fixture.catalog, LINUX_GLIBC), /locked dependency is not installed/);});-test('all reviewed native entries remain mandatory even inside an exclusively omitted optional subtree', (t) => {+test('unused reviewed native entries do not require installing an omitted optional subtree', (t) => {const release = fixtureRelease();const nativePath = 'node_modules/fixture-required-native';release.nativePackages[nativePath] = '1.0.0';const fixture = createFixture(t, { release });addOmittedWindowsSubtree(fixture, { childName: 'fixture-required-native' });fs.rmSync(path.join(fixture.projectRoot, nativePath), { recursive: true });- assert.throws(() => resolveProjectRelease(fixture.projectRoot, fixture.catalog, LINUX_GLIBC), /native inventory/);+ assert.equal(resolveProjectRelease(fixture.projectRoot, fixture.catalog, LINUX_GLIBC), fixture.release);});-test('an installed native leftover is inspected even when its optional parent is omitted', (t) => {+test('an installed first-party leftover is inspected even when its optional parent is omitted', (t) => {const fixture = createFixture(t);- const { childPath } = addOmittedWindowsSubtree(fixture);+ const { childPath } = addOmittedWindowsSubtree(fixture, { childName: '@microsoft/power-apps-native-auth' });installPackage(fixture.projectRoot, childPath, '1.0.0', { codegenConfig: {} });- assert.throws(() => resolveProjectRelease(fixture.projectRoot, fixture.catalog, LINUX_GLIBC), /Unreviewed native package/);+ assert.throws(() => resolveProjectRelease(fixture.projectRoot, fixture.catalog, LINUX_GLIBC), /Unreviewed first-party package/);});diff --git a/plugins/mobile-apps/scripts/tests/mobile-template-workflow.test.js b/plugins/mobile-apps/scripts/tests/mobile-template-workflow.test.jsindex eb3fdc7a9..a8723ed0a 100644--- a/plugins/mobile-apps/scripts/tests/mobile-template-workflow.test.js+++ b/plugins/mobile-apps/scripts/tests/mobile-template-workflow.test.js@@ -24,11 +24,12 @@ test('native updates are evaluated independently of outdated-host discovery', ()});test('rehearsal, full-chain approval, drift checks and recovery are separate gates', () => {- const rehearsal = updates.indexOf('Prepare isolated preview');- const perEdge = updates.indexOf('repeat dry-run and apply');- const approval = updates.indexOf('Apply reviewed release');+ const rehearsal = updates.indexOf('Test the upgrade in a copy of my app');+ const transaction = updates.indexOf('clean full-chain plan');+ const approval = updates.indexOf('Apply the tested upgrade to my app');const apply = updates.indexOf('### Apply only the approved plan');- assert.ok(rehearsal < perEdge && perEdge < approval && approval < apply);+ assert.ok(rehearsal >= 0 && rehearsal < transaction && transaction < approval && approval < apply);+ assert.doesNotMatch(updates, /repeat dry-run and apply until/);assert.match(updates, /nonzero preview is never automatically a clean plan/);assert.match(updates, /`--no-install` to simulate state advancement/);assert.match(updates, /under `<working_dir>`/);@@ -39,6 +40,64 @@ test('rehearsal, full-chain approval, drift checks and recovery are separate gatassert.match(updates, /Skipping excludes all coupled packages/);});+test('upgrade failures require actionable app-owned repairs without weakening validation', () => {+ assert.match(updates, /For every failed preparation, install, migration or validation check/);+ assert.match(updates, /Explain the failure, its impact and a concrete possible fix/);+ assert.match(updates, /minimal app-owned source\/configuration fixes in the test copy/);+ assert.match(updates, /Test-copy approval covers these\s+repairs, not original-app edits/);+ assert.match(updates, /never\s+weaken types\/checks, suppress diagnostics or disable offline/);+ assert.match(updates, /Rerun the failed check, then all mandatory checks and relevant existing app\s+tests/);+ assert.match(updates, /including the approved app-code fixes in their rehearsed order/);+ assert.match(updates, /After successful recovery, diagnose and repair the failure in the test copy/);+ assert.match(updates, /Existing plugin-restart, publication, approval and recovery gates still apply/);+ assert.match(updates, /Never patch npm packages via `node_modules`, `patch-package`/);+});++test('local workflows carry unverified compatibility without gating installation or startup', () => {+ assert.match(create, /resolve-mobile-release\.js[^\n]*--local-development/);+ assert.match(create, /Compatibility warnings do not block installation, preparation or trying the app/);+ assert.match(create, /do not add a pre-start\s+repair gate/);+ assert.match(lifecycle, /packageCompatibility: "unverified"/);+ assert.match(lifecycle, /not a resolved release or evidence\s+of native support/);+ assert.match(lifecycle, /If Dev Player actually fails,\s+invoke `\/debug-app`/);+ assert.match(lifecycle, /Deployment still requires\s+strict project\/base validation/);+ const shared = read('shared/shared-instructions.md');+ const validation = shellBlocks(shared).find(block => block.includes('scripts/validate-mobile-files.js'));+ assert.match(validation, /--local-development/);+ assert.match(read('skills/edit-app/SKILL.md'), /resolve-mobile-release\.js[^\n]*--local-development/);+ assert.match(read('skills/debug-app/SKILL.md'), /compare the actual Player runtime and installed\s+package versions/);+ for (const file of [+ 'agents/native-app-planner.md', 'agents/screen-planner.md', 'agents/screen-builder.md',+ 'skills/create-mobile-app/references/requirements-discovery.md',+ ]) assert.match(read(file), /local-development-only/, file);+ for (const helper of ['add-camera', 'add-geolocation', 'add-pdf-report', 'add-pdf-viewer', 'add-pen-input']) {+ assert.match(read(`skills/add-native/${helper}/SKILL.md`), /resolve-mobile-release\.js[^\n]*--local-development/, helper);+ }+});++test('strict template discovery is limited to empty targets, not existing fresh starters', () => {+ const acquisition = create.slice(create.indexOf('**New/empty-directory acquisition only:**'),+ create.indexOf('**Existing fresh starters, installed or awaiting installation:**'));+ assert.match(acquisition, /discover published template versions through npm/);+ assert.match(acquisition, /resolve-mobile-release\.js --template-version/);+ assert.match(acquisition, /`BLOCKED` before scaffolding/);+ const existing = create.slice(create.indexOf('**Existing fresh starters, installed or awaiting installation:**'),+ create.indexOf('**Fresh template required for creation.**'));+ assert.match(existing, /skip npm template discovery and strict `--template-version` resolution/);+ assert.match(existing, /shipped-lock installation and local diagnostic/);+ assert.ok(create.indexOf('before any registry request') < create.indexOf('**New/empty-directory acquisition only:**'));+});++test('individual package failures allow approved repairs or safe skipping, not immediate abandonment', () => {+ const packageUpdates = updates.slice(updates.indexOf('For each approved JavaScript-only package update in Steps 3 and 4:'));+ assert.match(packageUpdates, /any approved app-code repair files \(including modes and absent-file state\)/);+ assert.match(updates, /obtain approval and back up additional\s+app-code repair files before editing them/);+ assert.match(packageUpdates, /If any command fails, follow the repair loop above/);+ assert.match(packageUpdates, /If the user declines the repair, restore safely, record the package as skipped and continue/);+ assert.match(packageUpdates, /stop mutations if restoration is unsafe/);+ assert.doesNotMatch(packageUpdates, /return `BLOCKED` with the failed command, and do not offer later packages/);+});+test('JavaScript updates retain approval and audit safeguards without native bumps', () => {assert.match(updates, /Skip package.*recommended default/);assert.match(updates, /validate-mobile-files\.js --upgrade-only/);diff --git a/plugins/mobile-apps/scripts/tests/native-helper-reuse-contract.test.js b/plugins/mobile-apps/scripts/tests/native-helper-reuse-contract.test.jsindex f3292f052..f8dc77be9 100644--- a/plugins/mobile-apps/scripts/tests/native-helper-reuse-contract.test.js+++ b/plugins/mobile-apps/scripts/tests/native-helper-reuse-contract.test.js@@ -297,8 +297,27 @@ test('PDF viewer compares URI behavior and installed version, not just an exportconst versionGate = section(skill('add-pdf-viewer'), '### 2. Verify the app-matched release and import path');assert.match(versionGate, /resolve-mobile-release\.js/);assert.match(versionGate, /file URI support requires the PDF 0\.2\.9\+ contract/);- assert.match(versionGate, /If resolution fails,\s+STOP/);- assert.match(versionGate, /exact leaf\/version is included/);+ assert.match(versionGate, /--local-development/);+ assert.match(versionGate, /shared\s+local-development policy/);+ assert.match(versionGate, /import-selection rules/);+});++test('native wrapper and import gates allow installed APIs with unverified local context', () => {+ const gate = section(native, '## Native capability gate');+ assert.match(gate, /Strict context[\s\S]*exact installed package\/version[\s\S]*published inventory/);+ assert.match(gate, /Local context[\s\S]*local-development-only[\s\S]*no published\s+inventory is required/);+ assert.match(gate, /installed `expo-haptics` APIs can support an approved\s+local wrapper/);+ const verify = section(native, '### Step 4 — Verify installed API in context');+ assert.match(verify, /In local context,[\s\S]*without requiring a resolved inventory/);+ assert.match(verify, /In strict context,[\s\S]*published inventory/);+ const imports = section(read('skills/add-native/references/native-controls.md'), '## Public imports are release-conditional');+ assert.match(imports, /Strict context[\s\S]*exact installed aggregate or legacy leaf[\s\S]*published inventory/);+ assert.match(imports, /Local context[\s\S]*public exports, docs and types;[\s\S]*no published inventory is required/);+ assert.match(imports, /matching installed legacy\s+leaf/);+ assert.match(imports, /Keep Player\/base compatibility unverified/);+ for (const helper of ['add-pdf-viewer', 'add-pen-input', 'add-geolocation']) {+ assert.match(skill(helper), /import-selection rules to\s+the\s+strict\/local context/, helper);+ }});test('pen capture-only reuse cannot conceal required Image/File normalization', () => {diff --git a/plugins/mobile-apps/scripts/tests/validate-package-deps.test.js b/plugins/mobile-apps/scripts/tests/validate-package-deps.test.jsindex 748bc5d97..2a088581e 100644--- a/plugins/mobile-apps/scripts/tests/validate-package-deps.test.js+++ b/plugins/mobile-apps/scripts/tests/validate-package-deps.test.js@@ -158,6 +158,149 @@ test('upgrade file validation skips lock and installed-inventory admission but rblocked(invoke(true), /Forbidden dependency/);});+test('local changed-file validation permits preinstall/native drift but retains package policy', (t) => {+ const fixture = createFixture(t);+ addDependency(fixture.projectRoot, '@microsoft/power-apps-native-controls', '1.0.0');+ const invoke = (...flags) => spawnSync(process.execPath, [+ path.join(fixture.pluginRoot, 'scripts/validate-mobile-files.js'),+ '--project-root', fixture.projectRoot, '--file', 'package.json', ...flags,+ ], {+ cwd: fixture.projectRoot, encoding: 'utf8',+ env: { ...process.env, POWER_PLATFORM_SKILLS_TELEMETRY_MOBILE_APP_OPTOUT: '1' },+ });+ blocked(invoke(), /Native\/runtime dependency/);+ const result = invoke('--local-development');+ assert.equal(result.status, 0, result.stderr);+ assert.match(result.stderr, /WARNING: Local development[\s\S]*\/debug-app/);+ fs.unlinkSync(path.join(fixture.projectRoot, 'package-lock.json'));+ fs.rmSync(path.join(fixture.projectRoot, 'node_modules'), { recursive: true });+ assert.equal(invoke('--local-development').status, 0);+ modifyJson(path.join(fixture.projectRoot, 'package.json'), (pkg) => { pkg.dependencies.axios = '1.0.0'; });+ blocked(invoke('--local-development'), /Forbidden dependency/);+ modifyJson(path.join(fixture.projectRoot, 'package.json'), (pkg) => {+ delete pkg.dependencies.axios;+ pkg.dependencies['expo-msal-intune'] = '1.0.0';+ });+ blocked(invoke('--local-development'), /Vendor-only dependency/);+ assert.equal(invoke('--local-development', '--upgrade-only').status, 1);+});++test('local JS installation requires exact approval without release admission', (t) => {+ const { fixture } = calendarFixture(t);+ addDependency(fixture.projectRoot, '@microsoft/power-apps-native-controls', '1.0.0');+ const before = JSON.parse(fs.readFileSync(path.join(fixture.projectRoot, 'package.json'), 'utf8'));+ delete before.dependencies['react-native-calendars'];+ writeJson(path.join(fixture.projectRoot, 'before-install.json'), before);+ const invoke = (...approved) => spawnSync(process.execPath, [+ path.join(fixture.pluginRoot, 'scripts/validate-mobile-files.js'),+ '--project-root', fixture.projectRoot, '--local-development', '--file', 'package.json',+ '--before-package-json', 'before-install.json',+ ...approved.flatMap((entry) => ['--approved-js-dependency', entry]),+ ], {+ cwd: fixture.projectRoot, encoding: 'utf8',+ env: { ...process.env, POWER_PLATFORM_SKILLS_TELEMETRY_MOBILE_APP_OPTOUT: '1' },+ });+ blocked(invoke(), /user-approved JavaScript Dependencies plan/);+ blocked(invoke('[email protected]'), /user-approved JavaScript Dependencies plan/);+ const approved = invoke('[email protected]');+ assert.equal(approved.status, 0, approved.stderr);+ fs.writeFileSync(path.join(fixture.projectRoot, 'package-lock.json'), 'invalid and unrelated');+ fs.writeFileSync(path.join(fixture.projectRoot, 'node_modules/expo-haptics/package.json'), 'invalid and unrelated');+ assert.equal(invoke('[email protected]').status, 0);+ modifyJson(path.join(fixture.projectRoot, 'node_modules/react-native-calendars/package.json'), (pkg) => {+ pkg.version = '1.1300.0';+ });+ blocked(invoke('[email protected]'), /installed at its exact approved version/);+ fs.writeFileSync(path.join(fixture.projectRoot, 'before-install.json'), 'invalid snapshot');+ blocked(invoke('[email protected]'), /previous package.json/);+});++test('ordinary local work never reapproves or scans unchanged JavaScript packages', (t) => {+ const { fixture } = calendarFixture(t);+ const content = fs.readFileSync(path.join(fixture.projectRoot, 'package.json'), 'utf8');+ fs.writeFileSync(path.join(fixture.projectRoot, 'package-lock.json'), 'invalid and unrelated');+ fs.writeFileSync(path.join(fixture.projectRoot, 'node_modules/react-native-calendars/package.json'), 'invalid existing installation');+ for (const options of [+ { input: { validation_scope: 'local-development' } },+ { tool: 'Edit', input: { validation_scope: 'local-development', old_string: content, new_string: content } },+ ]) {+ const result = runValidator(fixture, options);+ assert.equal(result.status, 0, result.stderr);+ }+});++test('local edits enforce approval for added and changed JS dependencies, not existing rows', (t) => {+ const fixture = createFixture(t);+ addDependency(fixture.projectRoot, 'react-native-existing-ui', '1.0.0');+ for (const version of ['1.0.0', '2.0.0']) {+ const before = fs.readFileSync(path.join(fixture.projectRoot, 'package.json'), 'utf8');+ addDependency(fixture.projectRoot, 'ordinary-js-library', version);+ const input = {+ validation_scope: 'local-development', old_string: before,+ new_string: fs.readFileSync(path.join(fixture.projectRoot, 'package.json'), 'utf8'),+ };+ blocked(runValidator(fixture, { tool: 'Edit', input }), /user-approved JavaScript Dependencies plan/);+ const result = runValidator(fixture, { tool: 'Edit', input, approved: [`ordinary-js-library@${version}`] });+ assert.equal(result.status, 0, result.stderr);+ }+});++test('local JS inspection follows nested, hoisted and aliased dependencies without reading the lock', (t) => {+ const { fixture } = calendarFixture(t);+ addDependency(fixture.projectRoot, '@scope/helper', '1.0.0', { section: null });+ addDependency(fixture.projectRoot, 'helper-alias', '1.0.0', {+ section: null, installPath: 'node_modules/react-native-calendars/node_modules/helper-alias',+ properties: { name: 'canonical-helper' },+ });+ modifyJson(path.join(fixture.projectRoot, 'node_modules/@scope/helper/package.json'), (pkg) => {+ pkg.dependencies = { 'react-native-calendars': '*' };+ });+ modifyJson(path.join(fixture.projectRoot, 'node_modules/react-native-calendars/package.json'), (pkg) => {+ pkg.dependencies = { '@scope/helper': '*', 'helper-alias': 'npm:[email protected]' };+ pkg.optionalDependencies = { 'missing-optional-helper': '1.0.0' };+ });+ writeJson(path.join(fixture.projectRoot, 'node_modules/react-native-calendars/node_modules/unrelated/package.json'), { invalid: true });+ fs.writeFileSync(path.join(fixture.projectRoot, 'package-lock.json'), 'invalid and unrelated');+ const invoke = () => runValidator(fixture, {+ approved: ['[email protected]'], input: { validation_scope: 'local-development' },+ });+ const result = invoke();+ assert.equal(result.status, 0, result.stderr);+ modifyJson(path.join(fixture.projectRoot, 'node_modules/react-native-calendars/node_modules/helper-alias/package.json'), (pkg) => {+ pkg.codegenConfig = {};+ });+ blocked(invoke(), /native\/runtime/i);+});++test('a local dependency snapshot cannot replace the manifest validation target', (t) => {+ const fixture = createFixture(t);+ addDependency(fixture.projectRoot, 'axios', '1.0.0');+ const result = spawnSync(process.execPath, [+ path.join(fixture.pluginRoot, 'scripts/validate-mobile-files.js'),+ '--project-root', fixture.projectRoot, '--local-development', '--file', 'package.json',+ '--before-package-json', 'package.json',+ ], {+ cwd: fixture.projectRoot, encoding: 'utf8',+ env: { ...process.env, POWER_PLATFORM_SKILLS_TELEMETRY_MOBILE_APP_OPTOUT: '1' },+ });+ blocked(result, /separate pre-install snapshot/);+});++test('local JS approval cannot bypass native contents or transitive native dependencies', (t) => {+ for (const transitive of [false, true]) {+ const fixture = createFixture(t);+ addDependency(fixture.projectRoot, 'ordinary-js-wrapper', '1.0.0', {+ properties: transitive ? { dependencies: { 'native-child': '1.0.0' } } : { codegenConfig: {} },+ });+ if (transitive) addDependency(fixture.projectRoot, 'native-child', '1.0.0', {+ section: null, properties: { codegenConfig: {} },+ });+ blocked(runValidator(fixture, {+ approved: ['[email protected]'], input: { validation_scope: 'local-development' },+ }), /contains native\/runtime code/);+ }+});+test('old apps are admitted by their release, not by a newer default release', (t) => {const old = fixtureRelease();const newest = fixtureRelease(2);@@ -223,9 +366,9 @@ test('a JS-only host remains runtime-sensitive and its installed version cannotblocked(runValidator(fixture), /native inventory/);});-test('nested native instances must match their exact reviewed path and version', (t) => {+test('nested first-party instances must match a reviewed identity and version', (t) => {const release = fixtureRelease();- const nested = 'node_modules/expo/node_modules/ordinary-bridge';+ const nested = 'node_modules/expo/node_modules/@microsoft/power-apps-native-common';release.nativePackages[nested] = '1.0.0';const fixture = createFixture(t, { release });assert.equal(runValidator(fixture).status, 0);@@ -266,7 +409,7 @@ test('detects ordinary-name native modules in a JS dependency transitive closureaddDependency(fixture.projectRoot, 'ordinary-bridge', '1.0.0', {section: null, installPath: 'node_modules/ordinary-ui/node_modules/ordinary-bridge', properties: { codegenConfig: {} },});- blocked(runValidator(fixture), /Unreviewed native package/);+ blocked(runValidator(fixture), /Native\/runtime dependency/);});test('rejects malformed package, app, lock and installed JSON without leaking content', (t) => {diff --git a/plugins/mobile-apps/scripts/validate-mobile-files.js b/plugins/mobile-apps/scripts/validate-mobile-files.jsindex fde9e331e..35338b7cd 100644--- a/plugins/mobile-apps/scripts/validate-mobile-files.js+++ b/plugins/mobile-apps/scripts/validate-mobile-files.js@@ -15,12 +15,14 @@ const PLUGIN_ROOT = path.resolve(__dirname, '..');function usage() {return [- 'Usage: node validate-mobile-files.js --project-root <path> (--all-source | --file <path> [--file <path> ...]) [--approved-js-dependency <name>@<exact-version> ...] [--upgrade-only]',+ 'Usage: node validate-mobile-files.js --project-root <path> (--all-source | --file <path> [--file <path> ...]) [--approved-js-dependency <name>@<exact-version> ...] [--upgrade-only | --local-development] [--before-package-json <path>]','','Paths must be regular files. Relative paths resolve from --project-root.','--all-source validates every .ts/.tsx file under app/ and src/, plus root .ts/.tsx files.','Approved JavaScript dependencies must use exact semver versions from the reviewed app plan.','--upgrade-only skips app-lock/native-inventory admission; the upgrade must pass Expo, Expo Doctor and TypeScript checks.',+ '--local-development retains file/package policies without blocking installation/startup on native compatibility.',+ '--before-package-json supplies a project-local pre-install manifest to scope local JS approval checks to additions/changes.',].join('\n');}@@ -43,6 +45,7 @@ function parseArgs(argv) {projectRoot: null,targets: [],upgradeOnly: false,+ localDevelopment: false,};for (let index = 0; index < argv.length; index += 1) {@@ -57,6 +60,12 @@ function parseArgs(argv) {parsed.allSource = true;} else if (arg === '--upgrade-only') {parsed.upgradeOnly = true;+ } else if (arg === '--local-development') {+ parsed.localDevelopment = true;+ } else if (arg === '--before-package-json') {+ const value = argv[index + 1];+ if (!value || value.startsWith('--')) parsed.errors.push('Missing --before-package-json path.');+ else { parsed.beforePackageJson = value; index += 1; }} else if (arg === '--diagnostic-artifacts') {parsed.errors.push('BLOCKED: --diagnostic-artifacts is retired. Use published host/template packages.');parsed.blocked = true;@@ -76,6 +85,12 @@ function parseArgs(argv) {}}+ if (parsed.upgradeOnly && parsed.localDevelopment) {+ parsed.errors.push('Choose --upgrade-only or --local-development, not both.');+ }+ if (parsed.beforePackageJson && !parsed.localDevelopment) {+ parsed.errors.push('--before-package-json requires --local-development.');+ }return parsed;}@@ -112,7 +127,7 @@ function collectSourceTargets(projectRoot) {return targets.sort();}-function runValidator(validatorName, filePath, content, projectRoot, approvedJsDependencies, upgradeOnly) {+function runValidator(validatorName, filePath, content, projectRoot, approvedJsDependencies, upgradeOnly, localDevelopment, beforePackageJson) {const validatorPath = path.join(PLUGIN_ROOT, 'hooks', validatorName);const payload = JSON.stringify({cwd: projectRoot,@@ -123,7 +138,9 @@ function runValidator(validatorName, filePath, content, projectRoot, approvedJsDfilePath,validation_mode: 'explicit-mobile-workflow',approved_js_dependencies: approvedJsDependencies,+ before_package_json: beforePackageJson,...(upgradeOnly ? { validation_scope: 'upgrade-only' } : {}),+ ...(localDevelopment ? { validation_scope: 'local-development' } : {}),},});@@ -143,12 +160,14 @@ function main(argv) {const {allSource,approvedJsDependencies,+ beforePackageJson: beforePackageJsonArg,blocked: invalidSelection,errors,help,projectRoot: projectRootArg,targets,upgradeOnly,+ localDevelopment,} = parseArgs(argv);if (help) {process.stdout.write(`${usage()}\n`);@@ -173,10 +192,17 @@ function main(argv) {return 1;}const projectRoot = fs.realpathSync(requestedProjectRoot);- const validationTargets = allSource ? collectSourceTargets(projectRoot) : targets;+ const validationTargets = allSource ? collectSourceTargets(projectRoot) : [...targets];+ if (beforePackageJsonArg) validationTargets.push(beforePackageJsonArg);+ const beforePath = beforePackageJsonArg ? path.resolve(projectRoot, beforePackageJsonArg) : null;+ if (beforePath === path.join(projectRoot, 'package.json')) {+ process.stderr.write('BLOCKED: --before-package-json must name a separate pre-install snapshot, not the current package.json.\n');+ return 2;+ }const files = new Set();let blocked = false;+ let beforePackageJson;for (const target of validationTargets) {const requestedTargetPath = path.resolve(projectRoot, target);@@ -207,7 +233,8 @@ function main(argv) {blocked = true;continue;}- files.add(targetPath);+ if (requestedTargetPath === beforePath) beforePackageJson = fs.readFileSync(targetPath, 'utf8');+ else files.add(targetPath);}let binaryFiles = 0;@@ -225,6 +252,8 @@ function main(argv) {projectRoot,approvedJsDependencies,upgradeOnly,+ localDevelopment,+ beforePackageJson,);if (result.stdout) process.stdout.write(result.stdout);if (result.stderr) process.stderr.write(result.stderr);diff --git a/plugins/mobile-apps/shared/references/javascript-dependency-planning.md b/plugins/mobile-apps/shared/references/javascript-dependency-planning.mdindex a36539636..685ba8352 100644--- a/plugins/mobile-apps/shared/references/javascript-dependency-planning.md+++ b/plugins/mobile-apps/shared/references/javascript-dependency-planning.md@@ -23,7 +23,7 @@ evidence: a `react-native-*` package may still be pure JavaScript.Use the orchestrator's sanitized resolved context, or resolve it read-only:```bash-node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>'+node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>' --local-development```Unknown/missing release records block native mutations, not pure source/UI@@ -79,7 +79,10 @@ A full month/week/agenda scheduling surface triggers candidate selection. Evalua## Installation Contract-Only `/create-mobile-app` or `/edit-app` installs approved rows, before screen builders run:+Only `/create-mobile-app` or `/edit-app` installs new or changed approved rows,+before screen builders run. First save `package.json` to an invocation-specific+snapshot inside the project's temporary directory; keep its path for validation.+Do not reinstall or reapprove unchanged existing rows.```bashnpm install --save-exact <package>@<exact-version>@@ -90,20 +93,24 @@ Then verify:- `package.json` records the exact version in `dependencies`- the lockfile is updated when the project uses one- `require.resolve('<package>', { paths: [process.cwd()] })` succeeds-- the changed-file dependency validator passes with one exact approval argument for every row currently in `### JavaScript Dependencies`:+- the changed-file dependency validator passes using that pre-install snapshot+ and one exact approval argument for each added/changed JavaScript dependency:```bashnode "${PLUGIN_ROOT}/scripts/validate-mobile-files.js" \--project-root '<working_dir>' \+ --local-development \+ --before-package-json '<pre-install-snapshot-path>' \--file package.json \--approved-js-dependency "<package>@<exact-version>" \[--approved-js-dependency "<another-package>@<exact-version>" ...]```- The approval arguments are deterministic exceptions for package names that the baseline conservatively classifies as native-like. They do not classify package contents and cannot override packages known to require native runtime support.+ The snapshot identifies additions/changes without consulting the lockfile. Check only those packages' approved versions and relevant installed dependency closures, not all of `node_modules`. Ordinary local checks without a dependency delta do not reapprove existing libraries. Existing unchanged root React/RN peers are not new native code; approvals cannot override native contents or native runtime dependencies.- `npx --no-install tsc --noEmit` passes after the consuming code is builtIf installed contents reveal native code/config or an incompatible runtime dependency, remove only the newly added package, report the block, and do not let builders import it. Pure-JavaScript additions do not need `/add-native`, `app.config.js`, CocoaPods, Gradle, a native rebuild, or a rewrap-base update.+Remove only this invocation's pre-install snapshot after validation or verified recovery.## Builder Contractdiff --git a/plugins/mobile-apps/shared/references/mobile-release-lifecycle.md b/plugins/mobile-apps/shared/references/mobile-release-lifecycle.mdindex c1fd8669b..2574f5857 100644--- a/plugins/mobile-apps/shared/references/mobile-release-lifecycle.md+++ b/plugins/mobile-apps/shared/references/mobile-release-lifecycle.md@@ -13,17 +13,46 @@ player or wrapped binary contains the same native runtime.node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>'```-Only exit 0 authorizes using the returned release as a native dependency-baseline. Pass the sanitized result to planners/builders, not a copy of+Only strict resolution with exit 0 authorizes using the returned release as a+native dependency baseline. Pass the sanitized result to planners/builders, not a copy of`app.json`, auth settings, or connection strings. Never substitute the plugin'sbundled `template/package.json`. An old app does not gain capabilities when itsplugin is updated.+### Local installation and startup are not release-admission gates++For local creation, editing and startup preflight, use:++```bash+node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>' --local-development+```++This mode reads recorded requirements only, with no registry/lock/inventory+admission. It reports a warning, exit 0 and+`validationScope: "local-development-only"` with+`packageCompatibility: "unverified"`. This is not a resolved release or evidence+of native support. Continue approved installation, preparation and local code+generation against installed public APIs; preserve unverified status in all+planner/builder/helper handoffs. Missing APIs require a scoped capability+decision, not an assumed package installation or Player/base change.+Do not force repair/upgrades before trying the app. If Dev Player actually fails,+invoke `/debug-app` and compare installed packages with the actual Player runtime.++Use `validate-mobile-files.js --local-development` for local changed-file checks.+It retains forbidden-package, vendor-source and file-safety policies, plus exact+JS-plan approval and scoped installed-closure checks for added/changed libraries, without+requiring native admission. npm installation and TypeScript/bundle checks still+apply; this mode grants no dependency/behavior-change approval.+Deployment still requires+strict project/base validation; local mode cannot select a release or deployment+target. Omit the flag for strict diagnostics and existing debug/update repairs.+The protected source is `app.json` → `expo.extra.powerappsNative`:`schemaVersion`, `templateVersion`, and per-platform `nativeRuntimeVersions`.These are not npm versions. Preserve them during preparation and ordinary appedits. Only a successful host migration may advance them. Missing, malformed,-or unknown state blocks native work; do not backfill it from installed packages.+or unknown state blocks strict native admission, not approved local wrappers;+do not backfill it from installed packages.App-owned extras, telemetry preferences, branding, navigation, authentication,offline settings, and custom instruction files remain customer-owned.Tenant settings such as `tenantMode`, `appDisplayName`, `appName` and@@ -54,10 +83,20 @@ the helper never treats a missing hash as success.The published host's `compatibility/current.json` owns target template/runtimerequirements, managed dependencies and migration references. A matching publishedtemplate's protected metadata and packaged lock provide the immutable native-inventory, including nested packages. The app's own lock is checked against that-reference; it is not allowed to declare new native packages compatible with a-fixed binary. Missing or malformed metadata, fingerprint disagreement, an-unpublished/unfinalized target, and dependency drift remain blockers.+inventory, including nested package versions. The release dependency gate is+limited to the published first-party host, offline, assets, auth, common,+controls, push-notifications and template packages under+`@microsoft/power-apps-native-*`. It compares their identities and exact versions,+not npm hoisting paths. Equivalent declaration ranges are allowed when the+installed version satisfies both the app and host requirements.+It does not compare third-party versions (including Expo, React Native and React)+or JavaScript/tooling versions with the template lock. The app's own manifest,+lock and installation must still agree; npm/Expo checks remain required.+Package-owned offline integrity, peers and runtime requirements remain enforced.+This narrow gate alone does not certify third-party native or Player compatibility.+Missing or malformed metadata, fingerprint disagreement, an+unpublished/unfinalized target, and incompatible first-party dependency drift remain+blockers.Inspect a target without changing the app:@@ -96,9 +135,13 @@ retain their separate archive validation. Explicit template selections remainattached to subsequent project resolution rather than silently choosing adifferent, newer template with the same runtime.+Automatic selection skips otherwise valid templates whose managed native versions+do not satisfy the selected host, and continues searching compatible publications.+Malformed publications still block; explicit template selections never fall back.+Package compatibility and binary availability are separate. A same-runtimepatch/minor host update needs no new Player/base record. Native changes need a-host major, a template migration and matching native binaries before those+template migration and matching native binaries before thosefeatures can run. Compare actual Player metadata when available; do not inventstore availability or a future release date. Wrap must supply and verify itsselected base's version, native runtime and fingerprint before deployment.@@ -156,8 +199,8 @@ against the installed SDK's bundled versions; it does not skip validation oradopt newer online recommendations. Keep npm installation, Expo Doctor,configuration, TypeScript and bundle checks in their normal environment.Do not use target-reference `NODE_PATH` instead of the source dependency context.-Preview one edge with `--project '<preview_dir>' --dry-run`, then apply only an-approved clean edge with the same CLI and its normal validated installation.+Preview the complete chain with `--project '<preview_dir>' --dry-run`, then apply+the approved clean plan with the same CLI and its normal validated installation.An intermediate write-only operation must use `--no-install` separately; itdoes not advance state and is not completed migration.@@ -168,8 +211,8 @@ pins distinguishable from genuine customer customizations.Published migrations use the host-owned strict npm installer and guarded lockregeneration. A broken published CLI requires a producer fix; do not locallyrewrite first-party packages or use Player-build scripts to repair an app.-After every edge, recheck the target requirements and run changed-file validation before-advancing through the reviewed migration chain.+After the transaction, recheck the final target requirements and run changed-file+validation against the reviewed aggregate diff.During the Host-owned native migration/repair in `/check-updates` Step 2, do notrun strict app-lock or installed-package/native inventory admission. The host@@ -193,6 +236,9 @@ creation refuses an existing file or a directory resolving outside the app.Never use `--upgrade-only` or `--requirements-only`alone as proof that a JavaScript update did not introduce native dependencies.+A failed upgrade check pauses application, not diagnosis. Follow the+[`/check-updates` repair loop](../../skills/check-updates/SKILL.md#explain-choices-clearly-and-work-through-fixable-problems).+Compare app requirements with the actual supported counters of a selected Playerwhen available. A mismatch requires a matching binary or an approved migration,never rewriting compatibility labels. Package publication does not establish@@ -239,9 +285,10 @@ Runtime counter or fingerprint changes require a published template migration.No independent host, Expo, React Native, controls, or other native package bumpsare permitted.-At published planning, a native transition must target a **new host major** and-a host-owned template migration, not only new runtime counters. Producers own-the coordinated host/template release-version rules.+At published planning, a native transition requires a host-owned template+migration, not only new runtime counters. Native changes may ship in a host+patch/minor; an Expo SDK major requires a host major. Actual source-to-target+host majors cannot be skipped. Producers own the coordinated release-version rules.Published host and template identities require exact stable versions; prereleasehosts are restricted to the diagnostic contract. Scaffoldable local diagnostics and controlled private prerelease targets requirea new host and template package major for a native transition.@@ -249,8 +296,9 @@ Previously verified `0.x` source-version `upgrade-inspection-only` artifactsinstead report the required production major and cannot claim to satisfy thatproduction release requirement.-The currently supported `upgrade-template` CLI previews **one edge** per call-with `--dry-run`. It has no promised JSON/multi-edge planning API or+The current `upgrade-template` CLI previews the **entire remaining chain**+with `--dry-run`, composes its configuration changes in memory and installs only+the selected release's final dependency graph once. It has no promised JSON API or`--from-version` flag. `--no-install` does not advance template state. A nonzerodry-run can mean conflicts, not just a broken command. Diagnose its sanitizedoutput; never treat every failure as a clean preview or apply it to the real app.@@ -279,8 +327,8 @@ An older published host without a safe install path requires a producer fix,not a force/legacy-peer bypass or a skill-authored repair.To approve a whole chain, first rehearse it in a user-approved private disposable-copy of the app, with the exact target host, normal validated installs, and a-separate preview and diff for **every edge**. Record source/target state and+copy of the app, with the exact target host, one final validated installation, and+an aggregate preview containing **every edge**. Record source/target state andcustomer conflicts throughout. Stop on conflicts, no progress, skipped edges,overshoot, unsupported CLI behavior, or an interrupted journal. Never guesslater operations from the first preview. If a complete safe rehearsal cannot@@ -291,7 +339,7 @@ plan with the user before touching the real app. Approval of the rehearsal isnot approval of application. Preserve local uncommitted changes with a boundedfile snapshot; never use a Git reset. Recheck source bytes and dependency stateafter approval. Any changed input or newly discovered operation invalidates-approval. Apply only the reviewed sequence and validate after each edge.+approval. Apply only the reviewed transaction and validate its final state.## Controls and binary boundariesdiff --git a/plugins/mobile-apps/shared/shared-instructions.md b/plugins/mobile-apps/shared/shared-instructions.mdindex 5117f744c..cbeefb75e 100644--- a/plugins/mobile-apps/shared/shared-instructions.md+++ b/plugins/mobile-apps/shared/shared-instructions.md@@ -133,6 +133,10 @@ dependencies, and verify the intended base before deployment. Never use thenewest bundled template as an old app's native allowlist. This is an explicitworkflow gate, not a telemetry/write hook. Source-only edits can continue whenrelease evidence is unavailable without claiming native validation.+Local installation/startup uses the release resolver's `--local-development`+mode. Compatibility warnings do not block approved installation, preparation+or trying the app; preserve the unverified status and use `/debug-app` if the+Player actually fails. Strict deployment/base checks remain mandatory.Local diagnostic artifact selection is retired. Use the finalized publishedhost/template contract and preserve app-owned offline configuration, normal@@ -349,11 +353,14 @@ they do not require full app integration or authorize unrelated feature changes.Plugin-level hooks also run during unrelated plugin workflows, so every mutating mobile skill owns its validation:1. Track changed files by writer: the skill/subagents and preparation helpers versus trusted generators. Use a helper's returned `writtenFiles` when available; track removals separately, not as files to validate. CLI-owned output means output actually produced by `pa app init`, `pa app add data-source`, `pa app refresh data-source`, or `pa app remove data-source` through the resolved `$PA` command. It is excluded only when produced by that command and not modified afterward by the skill or its subagents. Newly generated does not mean manually written.-2. Before returning success, pass each existing skill/helper-owned changed file explicitly:+2. Before returning success, pass each existing skill/helper-owned changed file explicitly.+ For local app generation/editing/startup, use `--local-development` as below;+ deployment and release admission omit it:```bashnode "${PLUGIN_ROOT}/scripts/validate-mobile-files.js" \--project-root '<working_dir>' \+ --local-development \--file '<changed-file-1>' \--file '<changed-file-2>'```diff --git a/plugins/mobile-apps/shared/version-check.md b/plugins/mobile-apps/shared/version-check.mdindex aebf4ae07..59df633e8 100644--- a/plugins/mobile-apps/shared/version-check.md+++ b/plugins/mobile-apps/shared/version-check.md@@ -107,6 +107,8 @@ mismatched fingerprint blocks deployment even when the version label matches.## Standard prereq snippet for skillsMost skills only need the always-required tier. Copy this into Step 1.+Local installation/startup uses advisory compatibility diagnostics; warnings+must not prevent trying the app. Strict deployment checks omit this mode.Use shell/project-file checks directly:@@ -119,7 +121,7 @@ node --version # expect v22+# Project-local (only if inside a project)test -f power.config.json && echo "OK: code app project"-node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>'+node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>' --local-development```**Do NOT call `xcodebuild`, `java -version`, or check for Android Studio in any skill.** Local native compile is the user's choice, not a plugin concern.diff --git a/plugins/mobile-apps/skills/add-native/SKILL.md b/plugins/mobile-apps/skills/add-native/SKILL.mdindex cf8f68086..a1282a4b6 100644--- a/plugins/mobile-apps/skills/add-native/SKILL.md+++ b/plugins/mobile-apps/skills/add-native/SKILL.md@@ -20,8 +20,8 @@ every shell call and file tool, not a previous shell's cwd.**Entry routing:** use the shared [App feature entry points](../../shared/shared-instructions.md#app-feature-entry-points)preflight before the workflow below.-Generate a typed wrapper under `src/native/` for a native capability in the app's-[verified release context](../../shared/references/mobile-release-lifecycle.md).+Generate a typed wrapper under `src/native/` using the app's+[release or unverified local context](../../shared/references/mobile-release-lifecycle.md).Screens import the wrapper instead of touching native packages directly.Read [native controls](references/native-controls.md) for conditional aggregateadoption, legacy imports, permission boundaries, and location ownership.@@ -31,7 +31,7 @@ adoption, legacy imports, permission boundaries, and location ownership.1. **Never run `npx expo install`, `npm install`, or `yarn add` for a native module.** Native support is fixed by the app-matched verified release and selected player/base, not the newest bundled template or the customer's manifest.2. **Never edit `app.config.js`** — plugins, `ios.infoPlist`, `android.permissions`, or anything else. Native config belongs to the verified fixed-capability base; arbitrary additions cannot be honored at rewrap time.3. **Never edit `package.json` `dependencies` for native modules.** Native means the package ships platform source/projects, a podspec, codegen, an Expo module/config plugin, or `react-native.config.js`; a package-name prefix alone is not proof. Pure-JavaScript dependencies are out of scope for `/add-native` and are installed from an approved `JavaScript Dependencies` plan by `/create-mobile-app` or `/edit-app`.-4. **If release resolution fails, or package/version/native inventory disagree — STOP before native mutation.** A dependency being present is necessary, not sufficient. Do not install the controls aggregate or newer leaf to repair an older binary.+4. **Do not claim Player/base support from package presence.** Follow the shared [local-development policy](../../shared/references/mobile-release-lifecycle.md#local-installation-and-startup-are-not-release-admission-gates) for approved wrappers against installed APIs; missing packages/APIs still block that capability, not trying the rest of the app. Do not install the controls aggregate or newer leaf to repair an older binary.5. **Keep inclusion, declarations, grants, and usage separate.** The base owns OS declarations. Dependency/config toggles do not remove unused default Android permissions; different declarations require another verified base. Optional permission wrapping is deferred.## Routing — `/add-native` is the public entry point@@ -57,14 +57,20 @@ For every other capability listed below, this skill writes the wrapper directly.Before adding any native control or wrapper, verify the project and run thepackage-contract resolver in Step 1.-Use its sanitized tuple as the shared resolved context for helpers/planners/builders.-Unknown/missing published contracts block native mutations, not permission to-assume a runtime. No separate skills release list is required. Classify the intent, resolve-the exact package and version from this app's inventory, confirm it is not-runtime-banned, and verify input/output/storage constraints. The newest bundled-template is never a runtime allowlist. Every “present” requirement below means-present in both this release context and the installed app, with compatible-native support; manifest presence alone cannot pass the gate.+Pass its sanitized context to helpers/planners/builders. Apply one branch:++- **Strict context:** require the exact installed package/version in the resolved+ published inventory with compatible native support.+- **Local context** (`validationScope: "local-development-only"`): no published+ inventory is required. Inspect the exact installed version, public exports,+ docs and types for the requested API, and preserve native compatibility as+ unverified. For example, installed `expo-haptics` APIs can support an approved+ local wrapper without claiming Player/base support.++In both branches, confirm the package is not runtime-banned and verify+input/output/storage constraints. Every “present” requirement below follows+this branch policy; manifest presence alone is insufficient. The newest bundled+template is never a runtime allowlist.For controls, select aggregate subpaths or legacy leaves using the[version-conditional import contract](references/native-controls.md).@@ -85,7 +91,7 @@ published host 0.4.0 lacks it. No root barrel or barcode subpath is available.| Continuous/background GPS tracking with durable Dataverse upload | `/add-native geolocation` | Resolved controls `/geolocation` or matching legacy background-location leaf | Do not use a one-shot read for tracking; background-location 0.2.3 tracking uses background permissions even with `trackInBackground: false` || Tactile feedback for presses, selections, and operation results | `/add-native haptics` | `expo-haptics` present | Use the typed wrapper and pair every haptic with visible UI feedback || Store generated PDF/signature artifact | Generated Dataverse services after parent row exists | File/Image column or child Evidence/Attachment table exists | Never put File bytes in create/update JSON |-| Native capability not listed in this table | Resolve from the app-matched native inventory, then add an inline wrapper only when installed and not runtime-banned | Exact relevant package/version in the verified release | If no relevant package exists, or the package is runtime-banned, add a transparency note and stop |+| Native capability not listed in this table | Apply the strict/local branch above, then add an inline wrapper only when installed and not runtime-banned | Exact installed package/version and requested API; published inventory in strict context | If no relevant package exists, or the package is runtime-banned, add a transparency note and stop |Handle multi-part requests row-by-row. Example: "capture signature and attach signed report PDF" requires `pen-input`, `pdf-report`, Dataverse artifact storage, and possibly `sharing`; do not add only the native capability while leaving storage or screen states undefined. The map is not closed: for new shipped packages, resolve by capability semantics, use the directly matching package when safe, and ask once only if multiple installed packages plausibly match.@@ -155,9 +161,9 @@ Use `/add-native` wrappers only when the workflow is not a Dataverse File/Image## Supported capabilitiesApply the Native capability gate above. This is a capability map, not release-evidence. Legacy leaf names below are aliases only; use aggregate subpaths when-the resolved release includes controls, and keep a leaf import only when that-release includes the matching leaf. Read installed public docs/types first.+evidence. Select aggregate subpaths or legacy leaves through the+[strict/local import-selection rules](references/native-controls.md#public-imports-are-release-conditional).+Read installed public docs/types first.| Capability | Module | Wrapper to generate | Notes ||---|---|---|---|@@ -165,16 +171,16 @@ release includes the matching leaf. Read installed public docs/types first.| `image-picker`, `gallery`, `expo-image-picker` | `expo-image-picker` | `src/native/camera.ts` (`pickImage`) | `/add-native` routes internally to `add-camera`; preserve compatible existing re-exports || `barcode-scanner`, `qr-scanner`, `scanner`, `barcode`, `qr` | `expo-camera` | `src/native/barcodeScanner.tsx` | `/add-native` routes internally to `add-camera` || `document-picker` | `expo-document-picker` | `src/native/documentPicker.ts` | Picks/imports user-selected files (PDF, docs, etc.) from the device |-| `pdf-viewer`, `native-pdf-viewer`, `pdf-control`, `open-pdf`, `@microsoft/power-apps-native-pdf-viewer` | Controls `/pdf` or verified legacy PDF leaf | `src/native/pdfViewer.ts` | `/add-native` routes internally to `add-pdf-viewer`; require the resolved contract's HTTPS/file URI support |+| `pdf-viewer`, `native-pdf-viewer`, `pdf-control`, `open-pdf`, `@microsoft/power-apps-native-pdf-viewer` | Controls `/pdf` or matching installed legacy PDF leaf | `src/native/pdfViewer.ts` | `/add-native` routes internally to `add-pdf-viewer`; require the selected API's HTTPS/file URI support || `pdf-report`, `pdf-export`, `generate-pdf`, `print-report`, `evidence-packet` | `expo-print` (+ optional `expo-sharing`) | `src/native/pdfReport.ts` | `/add-native` routes internally to `add-pdf-report`; generated local files are shared only when `expo-sharing` is present, or uploaded to Dataverse |-| `pen-input`, `signature`, `ink`, `draw`, `@microsoft/power-apps-native-pen-input` | Controls `/pen` or verified legacy pen leaf | `src/native/penInput.ts` | `/add-native` routes internally to `add-pen-input`; captures PNG data URI |-| `geolocation`, `location-tracking`, `background-location`, `gps-tracking`, `geo-tracking`, `@microsoft/power-apps-native-bglocation` | Controls `/geolocation` or verified background-location leaf | `src/native/geolocation.ts` | `/add-native` routes internally to `add-geolocation`; tracking + durable Dataverse sync, distinct from one-shot `location` |+| `pen-input`, `signature`, `ink`, `draw`, `@microsoft/power-apps-native-pen-input` | Controls `/pen` or matching installed legacy pen leaf | `src/native/penInput.ts` | `/add-native` routes internally to `add-pen-input`; captures PNG data URI |+| `geolocation`, `location-tracking`, `background-location`, `gps-tracking`, `geo-tracking`, `@microsoft/power-apps-native-bglocation` | Controls `/geolocation` or matching installed background-location leaf | `src/native/geolocation.ts` | `/add-native` routes internally to `add-geolocation`; tracking + durable Dataverse sync, distinct from one-shot `location` || `secure-store` | `expo-secure-store` | `src/native/secureStore.ts` | || `file-system` | `expo-file-system` | `src/native/fileSystem.ts` | || `sharing` | `expo-sharing` | `src/native/sharing.ts` | || `location` | Resolved controls `/geolocation` or matching leaf; independently verified `expo-location` if applicable | `src/native/location.ts` | One-shot only; geolocation helper skips tracking/table setup |-| `biometrics`, `local-authentication` | `expo-local-authentication` | `src/native/biometrics.ts` | Use only when included in the app's verified release |-| `clipboard` | `expo-clipboard` | `src/native/clipboard.ts` | Use only when included in the app's verified release |+| `biometrics`, `local-authentication` | `expo-local-authentication` | `src/native/biometrics.ts` | Apply the strict/local capability gate |+| `clipboard` | `expo-clipboard` | `src/native/clipboard.ts` | Apply the strict/local capability gate || `mail-composer`, `email-draft` | `expo-mail-composer` | `src/native/mailComposer.ts` | Opens native mail compose when the package is present; connectors still own server-side email sends || `audio` | `expo-audio` | `src/native/audio.ts` | Use for audio recording/playback only when package is present || `video` | `expo-video` | `src/native/video.ts` | Use for video playback only when package is present |@@ -206,13 +212,13 @@ For custom workflows outside Dataverse File/Image form fields, use the `image-pi- Never put File column bytes in the create/update JSON body. File bytes are uploaded only after the parent row ID exists.- Screens must handle unsupported, cancelled, upload failed, and viewer failed states explicitly. Pen cancellation is a non-error result that screens can ignore.-**Missing or gated packages:** the resolved release, installed versions, and-matching native runtime are authoritative together. If any evidence is missing,-stop with a transparency note; never claim native readiness from TypeScript alone.+**Missing or gated packages:** apply the strict/local capability gate. Missing+installed APIs or runtime bans stop that capability; absent published inventory+alone does not stop local wrappers. Never claim native readiness from TypeScript.## Workflow-1. Verify project → 2. Resolve release and capability → 3. Auto-route to dedicated skill if one exists → 4. Verify package in resolved release → 5. Write wrapper → 6. Type-check → 7. Summary+1. Verify project → 2. Resolve context and capability → 3. Auto-route to dedicated skill if one exists → 4. Verify installed API in context → 5. Write wrapper → 6. Type-check → 7. Summary---@@ -227,7 +233,7 @@ After the project gate succeeds, resolve its native contract:```bashcd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }-node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>'+node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>' --local-development```### Step 2 — Resolve capability@@ -278,11 +284,12 @@ esac`/add-native` remains the only user-facing command for these controls.- **INLINE:** continue to Step 4.-### Step 4 — Verify module in the resolved release+### Step 4 — Verify installed API in context-Require a successful release resolution before this installed-manifest check.-Confirm the exact installed version against the resolved inventory and read its-public docs/types. A matching package name alone does not prove compatibility.+Apply the Native capability gate's strict/local branch before this manifest+check. In local context, inspect the installed version, exports and public+docs/types without requiring a resolved inventory. In strict context, also+confirm the exact version against the published inventory.```bashcd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }@@ -478,8 +485,8 @@ created/updated/reused paths and do not claim completion for unresolved artifact```✅ Native wrapper generated: <capability>─────────────────────────────────────────────-Module (release-matched) : <package>@<resolved-version>-Release context : <verified-release-id>+Module (installed) : <package>@<installed-version>+Release context : <verified-release-id or local-development-only; compatibility unverified>Wrapper created : src/native/<capability>.tspackage.json : unchanged ✓app.config.js : unchanged ✓@@ -497,8 +504,8 @@ Sample usage:showToast('Camera permission required');}-⚠️ No local native build performed. Wrapper edits use the matching verified- player/base; package changes require a verified release migration.+⚠️ No local native build performed. Local context leaves Player/base support+ unverified; package changes require a verified release migration.Type-check alone does not prove native execution or permission grants.─────────────────────────────────────────────```@@ -506,7 +513,6 @@ Sample usage:## Notes- This skill never modifies `package.json`, `app.config.js`, `src/playerConfig.ts`, `src/generated/`, or any screen file.-- For unlisted capabilities, resolve against the app's verified native inventory.- Missing support requires another verified release, not a new dependency or- configuration toggle. Do NOT install or configure native modules yourself.+- For unlisted capabilities, apply the same strict/local capability gate.+ Do NOT install or configure native modules yourself.- Pure-JavaScript libraries are out of scope for this skill. `/create-mobile-app` or `/edit-app` selects and installs them through [`shared/references/javascript-dependency-planning.md`](${PLUGIN_ROOT}/shared/references/javascript-dependency-planning.md); no native wrapper or Android/iOS rebuild is needed. The prohibition above applies only to packages with native source/config.diff --git a/plugins/mobile-apps/skills/add-native/add-camera/SKILL.md b/plugins/mobile-apps/skills/add-native/add-camera/SKILL.mdindex 9f0f93179..33d4eba6f 100644--- a/plugins/mobile-apps/skills/add-native/add-camera/SKILL.md+++ b/plugins/mobile-apps/skills/add-native/add-camera/SKILL.md@@ -90,7 +90,7 @@ Resolve the app's package contract before module checks or wrapper edits:```bashcd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }-node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>'+node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>' --local-development```Then check only the approved artifact keys:diff --git a/plugins/mobile-apps/skills/add-native/add-geolocation/SKILL.md b/plugins/mobile-apps/skills/add-native/add-geolocation/SKILL.mdindex dcf6d4453..f6eb71fda 100644--- a/plugins/mobile-apps/skills/add-native/add-geolocation/SKILL.md+++ b/plugins/mobile-apps/skills/add-native/add-geolocation/SKILL.md@@ -30,16 +30,15 @@ Do not substitute another library's `configureSync` / `HttpSyncContract` API.```bashcd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }test -f app.config.js && test -f power.config.json && test -f package.json && test -d src || { echo "BLOCKED: working_dir is not an initialized app" >&2; exit 1; }-node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>'+node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>' --local-development```-Unknown/missing records block native mutation. Do not install packages, edit-native config, or run local native builds. Match the installed public README,-exports, and types to the resolved inventory before generating any wrapper.-Use `@microsoft/power-apps-native-controls/geolocation` only when that aggregate-is included in the verified release. Use the legacy-`@microsoft/power-apps-native-bglocation` import only when the matching leaf-is actually included. Pick one literal import at generation time, never both.+Follow the lifecycle's local-development policy for unverified context. Do not install packages, edit+native config, or run local native builds. Apply the native-controls+import-selection rules to the strict/local context, using the installed public+README, exports and types. Select `@microsoft/power-apps-native-controls/geolocation`+or the matching legacy `@microsoft/power-apps-native-bglocation` leaf under those rules.+Pick one literal import at generation time, never both.The public runtime exports are `BgLocationClient`, `geoService`, `AuthMethod`,and `ConnectionType`. Controls 0.2.0 uses background-location 0.2.3; do not copy@@ -58,7 +57,7 @@ For a single coordinate read, write `src/native/location.ts`. This path needsCheck the selected version's location permission requirements; native binaryinclusion, OS declarations, runtime grants, and use are distinct.-Conditional example for a resolved release that contains the aggregate:+Conditional example when the import-selection rules select the aggregate:```tsimport { Platform } from 'react-native';@@ -82,7 +81,7 @@ export async function getCurrentLocation() {Refine permission/error results only from the installed public contract. Do notguess fields or classify errors by matching arbitrary native error text. Screensshow an appropriate denied/unsupported/failure state without exposing raw errors.-If the resolved release instead supports `expo-location`, use its installed+If the capability gate instead selects installed `expo-location`, use itsone-shot contract with the same platform and result guards, not tracking setup.## 3. Continuous tracking — permissions and ownership firstdiff --git a/plugins/mobile-apps/skills/add-native/add-pdf-report/SKILL.md b/plugins/mobile-apps/skills/add-native/add-pdf-report/SKILL.mdindex 05ae327d5..42b3fa97c 100644--- a/plugins/mobile-apps/skills/add-native/add-pdf-report/SKILL.md+++ b/plugins/mobile-apps/skills/add-native/add-pdf-report/SKILL.md@@ -46,12 +46,12 @@ If this fails, tell the user to run `/create-mobile-app` first and STOP.### 2. Verify the app's release and packagesRead [release lifecycle](../../../shared/references/mobile-release-lifecycle.md)-and [native controls](../references/native-controls.md). Resolve the app before-native mutations; unknown/missing records block even if a dependency is present.+and [native controls](../references/native-controls.md). Use the shared+local-development policy for installed APIs with unverified compatibility.```bashcd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }-node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>' || exit $?+node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>' --local-development || exit $?node -e "const p=require('./package.json'); const deps={...p.dependencies,...p.devDependencies}; const required='expo-print'; if (!deps[required]) { console.error('MISSING: expo-print is not in package.json. The template/app must already ship it for /add-native pdf-report. This skill will not install it or edit native config. Capability not added.'); process.exit(1); } console.log('OK: expo-print package present'); console.log(deps['expo-sharing'] ? 'OK: expo-sharing package present' : 'OPTIONAL_MISSING: expo-sharing is not in package.json; generated PDFs can be created/viewed/uploaded, but sharing helpers must not be generated.');"```diff --git a/plugins/mobile-apps/skills/add-native/add-pdf-viewer/SKILL.md b/plugins/mobile-apps/skills/add-native/add-pdf-viewer/SKILL.mdindex c25d3af5b..68da626f2 100644--- a/plugins/mobile-apps/skills/add-native/add-pdf-viewer/SKILL.md+++ b/plugins/mobile-apps/skills/add-native/add-pdf-viewer/SKILL.md@@ -35,19 +35,18 @@ If this fails, tell the user to run `/create-mobile-app` first and STOP.```bashcd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }-node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>'+node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>' --local-development```Read [release lifecycle](../../../shared/references/mobile-release-lifecycle.md)-and [native controls](../references/native-controls.md). If resolution fails,-STOP before writing wrappers. Do not install packages, run local native builds,-or edit native config. Check installed docs/types against the resolved native-inventory; file URI support requires the PDF 0.2.9+ contract in the binary.--The example below is conditional on a verified release containing-`@microsoft/power-apps-native-controls/pdf`. For a verified legacy release,-replace only the literal import with `@microsoft/power-apps-native-pdf-viewer`-after confirming that exact leaf/version is included. Do not import the root+and [native controls](../references/native-controls.md), including the shared+local-development policy. Do not install packages, run local native builds,+or edit native config. Apply the native-controls import-selection rules to the+strict/local context; file URI support requires the PDF 0.2.9+ contract in the binary.++The example below uses `@microsoft/power-apps-native-controls/pdf`. When the+import-selection rules select the legacy leaf, replace only the literal import+with `@microsoft/power-apps-native-pdf-viewer`. Do not import the rootaggregate or emit a runtime fallback between packages.### 2a. Reconcile requested artifactsdiff --git a/plugins/mobile-apps/skills/add-native/add-pen-input/SKILL.md b/plugins/mobile-apps/skills/add-native/add-pen-input/SKILL.mdindex 501e06504..35fb4d454 100644--- a/plugins/mobile-apps/skills/add-native/add-pen-input/SKILL.md+++ b/plugins/mobile-apps/skills/add-native/add-pen-input/SKILL.md@@ -35,18 +35,18 @@ If this fails, tell the user to run `/create-mobile-app` first and STOP.```bashcd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }-node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>'+node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>' --local-development```Read [release lifecycle](../../../shared/references/mobile-release-lifecycle.md)-and [native controls](../references/native-controls.md). Unknown/missing release-records STOP native mutation. Match installed public docs/types and native-inventory before using the example. Do not install packages or edit native config.--The example uses `@microsoft/power-apps-native-controls/pen` only when the-verified release contains it. A verified legacy release may instead use the-literal `@microsoft/power-apps-native-pen-input` import if the matching leaf-is included. Never import both, the aggregate root, or a runtime fallback.+and [native controls](../references/native-controls.md), including the shared+local-development policy. Apply the native-controls import-selection rules to+the strict/local context. Do not install packages or edit native config.++The example uses `@microsoft/power-apps-native-controls/pen`. When the+import-selection rules select the legacy leaf, use the literal+`@microsoft/power-apps-native-pen-input` import instead. Never import both,+the aggregate root, or a runtime fallback.### 2a. Reconcile requested artifactsdiff --git a/plugins/mobile-apps/skills/add-native/references/native-controls.md b/plugins/mobile-apps/skills/add-native/references/native-controls.mdindex 385c60317..69aa2a4c8 100644--- a/plugins/mobile-apps/skills/add-native/references/native-controls.md+++ b/plugins/mobile-apps/skills/add-native/references/native-controls.md@@ -4,10 +4,10 @@ Read the [release lifecycle](../../../shared/references/mobile-release-lifecyclefirst. Resolve the existing app, not the newest plugin template:```bash-node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>'+node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>' --local-development```-Missing/unknown release records block native mutations. A package manifest,+Local-development results follow the shared lifecycle policy. A package manifest,successful import, or successful TypeScript check does not prove that a playeror wrapped base contains matching native code. Do not install the aggregate tofix older binaries. Upgrade only through a separately approved, exact verified@@ -15,8 +15,18 @@ release migration.## Public imports are release-conditional+Use these import-selection rules before generating any wrapper:++- **Strict context:** require the exact installed aggregate or legacy leaf in+ the published inventory.+- **Local context** (`validationScope: "local-development-only"`): select from+ installed packages using their exact versions, public exports, docs and types;+ no published inventory is required. Prefer aggregate subpaths when installed+ and exposing the requested API; otherwise use the matching installed legacy+ leaf. Keep Player/base compatibility unverified.+`@microsoft/power-apps-native-controls` at the root is metadata, not a runtime-barrel. When the resolved release includes the aggregate, use these subpaths:+barrel. When the applicable branch selects the aggregate, use these subpaths:| Capability | Public subpath | Runtime exports ||---|---|---|@@ -34,8 +44,7 @@ verified player/base is available, and not evidence of Expo 57 compatibility.Read the installed public README, exports, and types for the selected version;do not infer newer method signatures or copy a different library's examples.-Legacy leaf imports are allowed only when the resolved release actually includes-the matching leaf and version:+Legacy leaf imports follow the same strict/local rules for the matching version:- `@microsoft/power-apps-native-pdf-viewer`- `@microsoft/power-apps-native-pen-input`diff --git a/plugins/mobile-apps/skills/check-updates/SKILL.md b/plugins/mobile-apps/skills/check-updates/SKILL.mdindex 9e21549b1..e51599818 100644--- a/plugins/mobile-apps/skills/check-updates/SKILL.md+++ b/plugins/mobile-apps/skills/check-updates/SKILL.md@@ -24,6 +24,42 @@ upgrade, do not invoke this workflow on their app or make a rehearsal copy.Run the steps below in order. Begin the final response with `DONE` when updates complete or are declined, or `BLOCKED` when the workflow cannot continue.+## Explain choices clearly and work through fixable problems++Use plain language in prompts and progress updates. Say "test copy of your app"+instead of "isolated preview", "upgrade steps" instead of "migration edges",+"update the related packages together" instead of "coupled release", and "backup"+instead of "recovery snapshot". Explain what each choice changes and whether the+original app is affected; keep exact versions, commands and diagnostics in details.++The goal is to complete the approved upgrade while keeping the app's functionality+unchanged. For every failed preparation, install, migration or validation check:++1. Explain the failure, its impact and a concrete possible fix. Investigate command+ output and app usage of public package APIs before declaring a package defect.+2. Make minimal app-owned source/configuration fixes in the test copy, including+ imports, API calls, types or bundler settings. Test-copy approval covers these+ repairs, not original-app edits. Preserve features, settings and data; never+ weaken types/checks, suppress diagnostics or disable offline to pass. Ask before+ changing behavior, dependencies, customer pins, install scripts or approved scope.+3. Rerun the failed check, then all mandatory checks and relevant existing app+ tests. Include repairs in the full diff and backup, and rehearse their order+ with the upgrade steps before requesting real-app application approval.+ For individual JavaScript updates, obtain approval and back up additional+ app-code repair files before editing them.+4. Resolve recoverable setup/auth/network problems and retry the reviewed target,+ rather than returning `BLOCKED` at the first failure. Do not repeat failed+ commands without new evidence. If a repair is declined, safely restore that+ update, record it as skipped and continue independent work.++Existing plugin-restart, publication, approval and recovery gates still apply.+Otherwise stop the affected upgrade only when no safe app-level fix or supported+recovery exists. Never patch npm packages via `node_modules`, `patch-package`,+postinstall rewrites, forks, vendoring or local substitutes, or bypass protected+metadata. For an unavoidable package defect, provide sanitized reproduction+details and the required upstream fix (`/report-issue` for mobile-app packages).+For any terminal blocker, explain the attempted remedies and how to resume.+## Step 1: Check The Plugin**Telemetry checkpoint: `check_mobile_app_plugin_version`**@@ -88,8 +124,9 @@ Missing protected metadata, unpublished packages, an unfinalized host migration,For a patch/minor update with unchanged native requirements, no new Player or base release record is required. A native-changing update requires the host-owned migration and a matching Player for preview. Rely on the existing Player native-version mismatch check; it directs older apps to `/check-updates`. Do not add a routine Play Store/App Store lookup or block upgrade planning on store availability. Only inspect availability when it helps explain a specific mismatch; npm publication alone does not prove availability or a release date. Wrap performs its own selected-base compatibility and availability checks before deployment.-The published planning boundary rejects native transitions without a host major-and an unambiguous template migration. Package producers own version preparation;+The published planning boundary rejects native transitions without an unambiguous+template migration and rejects skipped host majors. Native counters can advance+in a host patch/minor; an Expo SDK major requires a host major. Package producers own version preparation;use actual published versions, never predicted majors or private test identities.Interpret the decision:@@ -104,7 +141,7 @@ Interpret the decision:### Preview the entire change before approval1. Inspect the app's installed host documentation and supported CLI. Check for an active/interrupted upgrade journal **under `<working_dir>`**, never the process's unrelated cwd. Stop for documented recovery; do not delete a journal or reset template state.-2. Show source/target template, host, Expo/RN, Android/iOS runtime requirements/fingerprints, the coupled dependency changes, and required downloads/install scripts. Report Player/base availability separately as verified or unknown; package metadata does not supply binary release evidence. Ask **Prepare isolated preview** or **Skip native release** (recommended). This only authorizes local rehearsal, not changes to the app. Skipping excludes all coupled packages from Steps 3-4.+2. Show source/target template, host, Expo/RN, Android/iOS runtime requirements/fingerprints, the coupled dependency changes, and required downloads/install scripts. Report Player/base availability separately as verified or unknown; package metadata does not supply binary release evidence. Explain: "I'll test the upgrade and any needed compatibility fixes in a separate copy. Your app will stay unchanged until you approve the final changes." Ask **Test the upgrade in a copy of my app** or **Skip this app upgrade for now** (recommended). This only authorizes local rehearsal and the bounded app-code repairs above, not changes to the original app. Skipping excludes all coupled packages from Steps 3-4.3. Capture a private local snapshot of the current app (including dirty/untracked app-owned files, instructions, lockfiles, configuration, permissions and absent-file state). Exclude `.git`, `node_modules`, generated native build output, and logs from the rehearsal copy. Do not follow symlinks outside the project or upload the snapshot. Stop if the copy cannot preserve the app safely. No Git reset/checkout/stash.Restore the preview's source dependencies from its unchanged lock using thereviewed install policy before resolving inherited TypeScript configuration.@@ -114,10 +151,10 @@ Interpret the decision:`npm install` during preview preparation: shells do not preserve a previous`cd`, and doing so can replace the source app's dependencies before approval.The helper keeps registry/auth context but directs npm writes to the explicit- preview prefix. Unsupported workspace/package-manager layouts block for review.- A missing source configuration is a preparation blocker; do not substitute+ preview prefix. Unsupported workspace/package-manager layouts require review.+ Diagnose and repair missing source configuration in the test copy; do not substitutetarget-reference `NODE_PATH` resolution for the source dependency context.-4. Obtain the **exact reviewed target host** in a separate private tooling installation, not by installing it into the old app's dependency graph. Use `mobile-template-lifecycle.js acquire --destination '<reference_dir>' --host-version "<exact-host-version>"` with a new/empty directory. It installs the exact host with lifecycle scripts disabled, seeds the verified release's managed dependencies and overrides to avoid floating optional peers, and checks its npm lock integrity and contained upgrade CLI. Review any required lifecycle scripts separately before approving their execution. This tooling folder is not a scaffolded app; do not run app admission against it or copy its lock over the customer app. Read the installed host's actual `bin["upgrade-template"]` path and supported help; invoke that CLI with `--project '<preview_dir>' --dry-run` to preview one edge. The host owns the app's dependency edits and installation, including the section/spec recorded in the target's `managedDependencies`; an exact installed version does not authorize rewriting a reviewed range. Do not install a new host with incompatible peers into the old dependency set before previewing the coupled migration. Classify output: conflicts block application and need a reviewed resolution; other command failures block investigation. A nonzero preview is never automatically a clean plan.+4. Obtain the **exact reviewed target host** in a separate private tooling installation, not by installing it into the old app's dependency graph. Use `mobile-template-lifecycle.js acquire --destination '<reference_dir>' --host-version "<exact-host-version>"` with a new/empty directory. It installs the exact host with lifecycle scripts disabled, seeds the verified release's managed dependencies and overrides to avoid floating optional peers, and checks its npm lock integrity and contained upgrade CLI. Review any required lifecycle scripts separately before approving their execution. This tooling folder is not a scaffolded app; do not run app admission against it or copy its lock over the customer app. Read the installed host's actual `bin["upgrade-template"]` path and supported help; invoke that CLI with `--project '<preview_dir>' --dry-run` to preview the complete remaining chain. The host owns the app's dependency edits and installation, including the section/spec recorded in the target's `managedDependencies`; an exact installed version does not authorize rewriting a reviewed range. Do not install a new host with incompatible peers into the old dependency set before previewing the coupled migration. Classify output: conflicts block application until reviewed and resolved; other command failures require diagnosis and the repair loop above, not an immediate exit. A nonzero preview is never automatically a clean plan.Package override conflicts are blocking even when source patches apply. Showthe retained override and proposed direct dependency, obtain approval for theexact resolution, and rerun the preview. Never silently remove customer pins@@ -129,7 +166,7 @@ Interpret the decision:published host lacks a safe validated installation path, block and request aproducer fix. Migration authoring, release tagging, runtime preparation andPlayer build scripts are maintainer tools, not customer upgrade steps.-5. For a clean edge, apply it only to the disposable copy with `upgrade-template --project '<preview_dir>'`, including its validated install. Do not use `--no-install` to simulate state advancement. Record every changed/deleted/created file and dependency, plus the actual before/after protected metadata. Require progress without overshoot, then repeat dry-run and apply until the selected target is reached. No target migration is needed for host-only repair. Never reuse approval of one preview for unseen later edges.+5. Apply the clean full-chain plan only to the disposable copy with `upgrade-template --project '<preview_dir>'`, including its validated install. The host composes all required configuration edges before installing only the selected release's final dependencies once; it must not install a broken historical host as an intermediate step. Do not use `--no-install` to simulate state advancement. Record every changed/deleted/created file and dependency, plus the actual before/after protected metadata. Require the selected final target without overshoot, then rerun the dry-run and require no remaining changes. No target migration is needed for host-only repair. If an older selected CLI cannot safely compose the required chain, block for a producer fix rather than implementing a skill-side installer.6. Re-run `mobile-template-lifecycle.js plan --project-root '<preview_dir>' --host-version "<exact-host-version>"`and require `kind: "current"` to confirm the selected host/template/runtimestate was reached. Do not run strict app admission or add a separate lockfile,@@ -137,7 +174,8 @@ Interpret the decision:dependency installation. Use `validate-mobile-files.js --project-root '<preview_dir>' --upgrade-only --file <changed-file>`for changed-file policies without that duplicate package admission.Expo compatibility, Expo Doctor, TypeScript and platform bundles are mandatory;- any failure blocks application. Require successful Expo Doctor output from+ any failure blocks application until the repair loop succeeds.+ Require successful Expo Doctor output fromthis host-owned installation, or run it separately through the approved tooling.Surface planning's fingerprint `warnings` without claiming Player/Wrap support.Preserve customer instructions/settings and review conflicts rather than@@ -155,14 +193,17 @@ Interpret the decision:When a client is available, load the intended route and exercise the customerworkflow. Report bundle and runtime results separately; do not fabricateenvironment/auth configuration to manufacture a successful smoke test.-7. Present the **aggregate full-chain diff**, each edge, conflicts/resolutions, install scripts, expected binaries, and rollback scope. Ask **Apply reviewed release** or **Skip native release** (recommended). Only explicit application approval authorizes real edits.+7. Present the **aggregate full-chain diff**, each edge, conflicts/resolutions, app-code fixes, install scripts, expected binaries, check results and rollback scope. State any untested device workflows separately. Explain that the test copy passed required checks and a backup will be kept. Ask **Apply the tested upgrade to my app** or **Skip this app upgrade for now** (recommended). Only explicit application approval authorizes real edits.### Apply only the approved plan-Recheck every source input against the snapshot, including lock/dependency state and the project-scoped journal. Changed inputs invalidate approval and require a new preview. Take the recovery snapshot before the first real edit, then invoke the same verified reference host CLI and migration sequence rehearsed above with the real app's `--project` path. The host performs the coordinated installation; do not separately preinstall the new host into the old app. After every edge compare operations and state with the approved preview and validate before continuing. New operations, conflicts, lack of progress, or unexpected target metadata stop the chain; do not silently extend approval.+Recheck every source input against the snapshot, including lock/dependency state and the project-scoped journal. Changed inputs invalidate approval and require a new preview. Take the recovery snapshot before the first real edit, then invoke the same verified reference host CLI and full-chain transaction rehearsed above with the real app's `--project` path, including the approved app-code fixes in their rehearsed order. The host performs the coordinated installation; do not separately preinstall the new host into the old app. Compare the aggregate operations and final state with the approved preview and validate. New operations, conflicts, lack of progress, or unexpected target metadata pause application for diagnosis and a revised preview/approval; do not silently extend approval.On failure restore only touched files from this invocation's snapshot, including deleted/created paths and original modes, without disturbing pre-existing customer changes. Reconcile installed dependencies from the restored lockfile using the reviewed install policy. If rollback or journal recovery cannot complete safely, preserve the snapshot/journal, report both failures, and stop. Never report `DONE` for a partial migration.+After successful recovery, diagnose and repair the failure in the test copy,+rerun validation, and obtain approval for the revised full diff before retrying.+After success re-run the metadata-only plan and the same mandatory checks as the rehearsal against `<working_dir>`, passing `--upgrade-only` to changed-file validation. Fingerprint differences remain warnings; deployment retains its separate strict admission. Only a host-validated migration may advance protected template/runtime state; never set it by hand. Update the relevant existing plan/runtime summary, not unrelated memory-bank content. Release approval is not deployment approval.## Step 3: Update Other Microsoft Packages@@ -181,7 +222,7 @@ Offer each remaining outdated direct **JavaScript-only** registry package separaFor each approved JavaScript-only package update in Steps 3 and 4:-1. Snapshot `package.json`, existing npm lockfiles, and `native-app-plan.md` when that package will change it under `.tmp/dependency-maintenance/`.+1. Snapshot `package.json`, existing npm lockfiles, `native-app-plan.md` when that package will change it, and any approved app-code repair files (including modes and absent-file state) under `.tmp/dependency-maintenance/`.Before installation, capture the app's actual installed native dependenciesand protected requirements in this package's recovery directory. The helpercreates a new local snapshot and refuses to overwrite an existing one.@@ -213,7 +254,7 @@ For each approved JavaScript-only package update in Steps 3 and 4:when TypeScript is declared), and `validate-mobile-files.js --upgrade-only`for each changed file (including `package.json`). That file-policy mode doesnot replace `check-native`. Never run `npx expo install --fix`.-4. If any command fails, including `check-native`, restore that package's snapshot, reconcile `node_modules`, return `BLOCKED` with the failed command, and do not offer later packages. Keep `native-before.json` until recovery is verified; otherwise delete it with the successful package snapshot and continue.+4. If any command fails, follow the repair loop above. For native-check failures, including `check-native`, restore that package's snapshot and reconcile `node_modules` from its restored lock before diagnosing a safe retry. Use the same recovery when needed for other failures. If the user declines the repair, restore safely, record the package as skipped and continue. Preserve recovery evidence and stop mutations if restoration is unsafe. Keep `native-before.json` until recovery is verified; delete it with the package snapshot only after successful validation or verified restoration.Do not update transitive packages directly, add overrides, move packages between dependency sections, or use Git to roll back project files.@@ -229,4 +270,4 @@ Report a security finding only when all are true:Ignore string-only `via` rollups. When `fixAvailable` names a different package, include it only as context; never recommend a downgrade based on that graph-level fix.-Remove this invocation's `outdated.json` and return `DONE` with a concise summary of changed, skipped, current, and unmanaged packages plus direct security findings. Use `BLOCKED` when release evidence, validation, migration, or recovery remains unresolved, even if the read-only audit completed. Do not include raw audit JSON, snapshots, credentials, or transitive package lists. If no direct advisory exists, say so.\ No newline at end of file+Remove this invocation's `outdated.json` and return `DONE` with a concise summary of changed, skipped, current, and unmanaged packages, app-code fixes, check results, untested device workflows and direct security findings. Use `BLOCKED` for unmet safety/publication/restart prerequisites or failures with no safe fix after the repair loop, even if the read-only audit completed. A declined repair with verified restoration is skipped, not an upgrade success. Do not include raw audit JSON, snapshots, credentials, or transitive package lists. If no direct advisory exists, say so.\ No newline at end of filediff --git a/plugins/mobile-apps/skills/create-mobile-app/SKILL.md b/plugins/mobile-apps/skills/create-mobile-app/SKILL.mdindex 7d743bd07..cb7c6dc40 100644--- a/plugins/mobile-apps/skills/create-mobile-app/SKILL.md+++ b/plugins/mobile-apps/skills/create-mobile-app/SKILL.md@@ -39,7 +39,11 @@ and summary.## Fresh-template working-directory mode-Only after confirming new-app intent through the state routing below, read [mobile-release-lifecycle.md](../../shared/references/mobile-release-lifecycle.md). Discover published template versions through npm, select an exact stable version, and inspect it with `resolve-mobile-release.js --template-version "<exact-template-version>"`. Missing or incompatible published package metadata means `BLOCKED` before scaffolding or data-platform mutations. The helper checks the immutable template against its published host contract; there is no plugin-owned release list. npm channel names, the plugin's bundled snapshot, and a mutable Git branch are not compatibility evidence. Report Player availability separately; if its native runtime differs, offer an explicitly selected compatible template for the new app rather than promising the latest package can run in that Player.+After confirming new-app intent, classify the directory using the state routing below before any registry request. Read [mobile-release-lifecycle.md](../../shared/references/mobile-release-lifecycle.md).++**New/empty-directory acquisition only:** discover published template versions through npm, select an exact stable version, and inspect it with `resolve-mobile-release.js --template-version "<exact-template-version>"`. Missing or incompatible published package metadata means `BLOCKED` before scaffolding or data-platform mutations on this path. The helper checks the immutable template against its published host contract; there is no plugin-owned release list. npm channel names, the plugin's bundled snapshot, and a mutable Git branch are not compatibility evidence. Report Player availability separately; if its native runtime differs, offer an explicitly selected compatible template rather than promising the latest package can run in that Player.++**Existing fresh starters, installed or awaiting installation:** skip npm template discovery and strict `--template-version` resolution. Use the shipped-lock installation and local diagnostic paths below; unavailable registry metadata does not block this routing.**Fresh template required for creation.** If the working directory is not a freshtemplate, STOP creation and follow the state-specific routing below. Do not send@@ -53,7 +57,11 @@ permission to reconstruct a template or copy a bundled snapshot.For a new/empty target, offer **Acquire reviewed template** or **Cancel**. After explicit approval, run `mobile-template-lifecycle.js acquire --template-version "<exact-template-version>" --destination '<working_dir>'`. It verifies the immutable package and metadata before using the package's creation CLI. Separately approve dependency installation with the shipped lockfile (`npm ci`); use existing registry authentication, never print/provision credentials here. Do not fall back to `degit` or copy a bundled template on failure.-An existing **fresh installed** template may be used only after `resolve-mobile-release.js --project-root '<working_dir>' --template-version "<exact-template-version>"` succeeds. Preserve its shipped instructions and all compatibility metadata. Never run acquisition over a non-empty directory or adopt an already-created app through this gate.+For an existing **fresh installed** template, run `resolve-mobile-release.js --project-root '<working_dir>' --local-development`. Compatibility warnings do not block installation, preparation or trying the app in Dev Player. Preserve its shipped instructions and all compatibility metadata. Never run acquisition over a non-empty directory or adopt an already-created app through this gate.++Follow the shared [local-development policy](../../shared/references/mobile-release-lifecycle.md#local-installation-and-startup-are-not-release-admission-gates)+for unverified handoffs and observed startup failures; do not add a pre-start+repair gate or bypass the state routing.Resolve the original request before classifying project state. Apply thisstate-routing table once in Step 0, in the order below; file markers are@@ -63,8 +71,8 @@ supporting evidence, not user intent or approval.|---|---|---|| Creation continuation | Explicit creation-continuation intent or a valid current create handoff for this app, not a request to edit an existing app | Use Step 0's continuation path. Require matching unfinished creation progress and confirm the next phase before continuing; missing or conflicting progress requires clarification, not fresh scaffolding. || Already-created app | Existing-app intent or confirmed app customizations/materialized state, even when generated markers are missing. `memory-bank.md`, `.datamodel-manifest.json`, and `src/generated/services/*.ts` can corroborate state, but do not select creation resume | STOP creation: never re-scaffold it. If the request changes this app, preserve the original request and execute the shared existing-app entry routing; invoke `/edit-app` only after **Full app integration**. If the user wants a separate new app, ask for a fresh template folder. |-| Fresh template | Confirmed new-app intent and a confirmed uncustomized starter; `package.json`, `app.config.js`, `auth.config.json`, and `tamagui.config.ts` exist; `node_modules/expo` exists; no materialized app bindings, `memory-bank.md`, `.datamodel-manifest.json`, or generated Dataverse services. An approved creation plan and its planning artifacts are allowed | Proceed to Step 1 only when every condition is satisfied and the selected published package contract resolves. Missing generated markers alone do not establish freshness. |-| Template not installed | Confirmed new-app intent and a confirmed uncustomized starter with the required template files, but `node_modules/expo` is absent | Offer the separately approved `npm ci` install from its shipped lock, then resolve the package contract. Stop for a missing/mismatched lock; do not provision registry credentials or regenerate native pins here. |+| Fresh template | Confirmed new-app intent and a confirmed uncustomized starter; `package.json`, `app.config.js`, `auth.config.json`, and `tamagui.config.ts` exist; `node_modules/expo` exists; no materialized app bindings, `memory-bank.md`, `.datamodel-manifest.json`, or generated Dataverse services. An approved creation plan and its planning artifacts are allowed | Proceed to Step 1 only when every condition is satisfied and the local-development diagnostic has run; compatibility warnings are non-blocking. Missing generated markers alone do not establish freshness. |+| Template not installed | Confirmed new-app intent and a confirmed uncustomized starter with the required template files, but `node_modules/expo` is absent | Offer the separately approved `npm ci` install from its shipped lock, then run the local-development diagnostic. Stop for a missing/mismatched lock; do not provision registry credentials or regenerate native pins here. || New/empty directory | Confirmed new-app intent after excluding existing-app work and creation continuation, with no existing customer files | Offer the immutable acquisition described above, then separately approve the shipped-lock installation. || Not template | Confirmed new-app intent in a non-empty unsupported directory, after excluding existing-app work and creation continuation | STOP: preserve every file and select a separate empty target. Never re-scaffold existing work or copy a mutable bundled template. || Unclear state or intent | New-app versus edit intent, customization, or creation progress cannot be established | Ask before selecting a workflow. Preserve the directory, plan, and history; do not default to fresh creation or resume. |@@ -313,7 +321,7 @@ Use only a validated phase ID from the recorded creation state. Resolve the CLIbelow before entering the verified phase; do not skip unresolved approval orvalidation gates merely because an older plan exists.-Before continuing or resuming native work, resolve the app against its published host/template contract. Pass its sanitized compatibility context to every planner/builder; do not use the plugin template's current dependencies as the app's inventory.+Before continuing or resuming local work, run the local-development diagnostic. Pass its sanitized compatibility context to every planner/builder, including any unverified warning; do not use the plugin template's current dependencies as the app's inventory or treat a warning-only result as a resolved release.**Do not silently copy a bundled template over the user's folder.** A fresh template may contain an empty placeholder `power.config.json`; Step 5 removes only that empty placeholder immediately before Step 6 runs `pa app init`. Preserve populated settings even when `environmentId` is empty.@@ -1544,7 +1552,7 @@ node "${PLUGIN_ROOT}/scripts/app-docs.js" --working-dir '<working_dir>' step --i```This step is template-only and foreground-only. Do not clone/copy templates, do not run background scaffold jobs, and do not use any legacy fallback path.-Acquisition and release resolution must already have passed Step 0.+Acquisition and the local-development diagnostic must already have completed Step 0; compatibility warnings do not block this preparation.**Print before starting:**> "→ [Step 5/13] Preparing existing Expo standalone template in <working_dir> …"@@ -2508,7 +2516,7 @@ If the plan says "None — this app uses only standard React Native components a**Telemetry checkpoint: `install_approved_javascript_dependencies`**-Read and execute the Installation Contract in [`shared/references/javascript-dependency-planning.md`](${PLUGIN_ROOT}/shared/references/javascript-dependency-planning.md) for every approved row in `## Screens → ### JavaScript Dependencies`. If the subsection is absent or says `None.`, continue without changing dependencies.+Read and execute the Installation Contract in [`shared/references/javascript-dependency-planning.md`](${PLUGIN_ROOT}/shared/references/javascript-dependency-planning.md) for new or changed approved rows in `## Screens → ### JavaScript Dependencies`; reuse unchanged existing rows. If the subsection is absent or says `None.`, continue without changing dependencies.Gate 4 approval is consent for exactly the packages and versions in the table. Install them into `<working_dir>` before any skeleton or builder imports them, validate `package.json` and the lockfile, and verify module resolution. Do not substitute another package/version, infer a package from a compiler error, or route a JS-only package through `/add-native`. If final inspection finds native code/config or incompatible runtime dependencies, remove only the newly added package and STOP with the exact failed criterion.diff --git a/plugins/mobile-apps/skills/create-mobile-app/references/requirements-discovery.md b/plugins/mobile-apps/skills/create-mobile-app/references/requirements-discovery.mdindex 9f9f06d85..52668f048 100644--- a/plugins/mobile-apps/skills/create-mobile-app/references/requirements-discovery.md+++ b/plugins/mobile-apps/skills/create-mobile-app/references/requirements-discovery.md@@ -24,7 +24,7 @@ Scan the user's description and wizard answers for these signals, then confirm i| "Teams", "chat", "message" | Teams connector || "report", "dashboard", "history", "view all" | Read/list screens |-Resolve every native signal against the app-version-matched context from `resolve-mobile-release.js`, following [mobile-release-lifecycle.md](../../../shared/references/mobile-release-lifecycle.md). Do not use the newest plugin template as an old app's inventory. If support or fixed-base declarations cannot be verified, block that capability instead of pretending it exists. Follow `agents/native-app-planner.md` Step 3.0 and `/add-native` for version-conditional controls/legacy-leaf routing.+Resolve every native signal against the app-version-matched context from `resolve-mobile-release.js`, following [mobile-release-lifecycle.md](../../../shared/references/mobile-release-lifecycle.md), including its `local-development-only` policy for unverified local planning. Do not use the newest plugin template as an old app's inventory or invent missing packages/APIs. Follow `agents/native-app-planner.md` Step 3.0 and `/add-native` for version-conditional controls/legacy-leaf routing.Apply the shared[`connectivity-intent-ownership.md`](${PLUGIN_ROOT}/shared/references/connectivity-intent-ownership.md)diff --git a/plugins/mobile-apps/skills/debug-app/SKILL.md b/plugins/mobile-apps/skills/debug-app/SKILL.mdindex f8b359e80..2ba406253 100644--- a/plugins/mobile-apps/skills/debug-app/SKILL.md+++ b/plugins/mobile-apps/skills/debug-app/SKILL.md@@ -1002,6 +1002,13 @@ cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1;node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>'```+This strict command is diagnostic evidence, not permission to stop diagnosis+or prevent the app from being tried. If Dev Player reports a missing/incorrect+native module or ABI mismatch, compare the actual Player runtime and installed+package versions, including any extra native packages. Correlate a resolver+failure with that observed symptom before proposing repair. Local workflows+may intentionally arrive here with unverified compatibility warnings.+Use only the sanitized tuple in diagnostic handoffs. The newest bundledtemplate is not this app's runtime allowlist. Unknown/missing records blocknative mutations, not source-only diagnosis and fixes; mark native compatibilitydiff --git a/plugins/mobile-apps/skills/edit-app/SKILL.md b/plugins/mobile-apps/skills/edit-app/SKILL.mdindex bf31f21af..c07e6cdfe 100644--- a/plugins/mobile-apps/skills/edit-app/SKILL.md+++ b/plugins/mobile-apps/skills/edit-app/SKILL.md@@ -280,14 +280,13 @@ Resolve the existing app, not the newest bundled template:```bashcd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }-node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>'+node "${PLUGIN_ROOT}/scripts/resolve-mobile-release.js" --project-root '<working_dir>' --local-development```-Keep its sanitized resolved context for every planner/builder handoff and-native helper. Unknown/missing release records block native mutations, not-existing pure source/UI planning and editing. For source-only work, inspect-installed contracts and mark native compatibility unverified. Do not claim-that preview or TypeScript validates a player/base.+Keep the sanitized context, including unverified status, for every planner/builder+handoff and native helper. Follow the shared lifecycle's local-development policy:+source-only work can use installed contracts without claiming preview or+TypeScript validates a player/base. Do not force repair before local startup.Native/host/Expo upgrades are a separate approved `/check-updates` migration toan exact verified release. Do not silently upgrade an existing app, install the