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
mobile-apps: reconcile offline profile with schema changes across the app lifecycle (#260)
iamrikscd3c1fd0fc69
diff --git a/plugins/mobile-apps/AGENTS.md b/plugins/mobile-apps/AGENTS.mdindex 04a9e362d..c460e7dbc 100644--- a/plugins/mobile-apps/AGENTS.md+++ b/plugins/mobile-apps/AGENTS.md@@ -86,6 +86,7 @@ Do not add preparation rewrites for `scheme`, `package`, `bundleIdentifier`, `sr- ✅ Offline profile creation is **author-only in v0.1** — `/setup-offline-profile` and `/enable-tables-offline` POST `mobileofflineprofile` / `mobileofflineprofileitem` / `mobileofflineprofileitemassociation` to Dataverse and write `offline-profile.json` to the project, but do NOT scaffold offline runtime code (SQLite store, sync engine, write queue) into the generated app. Runtime support is gated on upstream `@microsoft/power-apps-native-host` confirmation.- ✅ Custom filter mode (`recorddistributioncriteria=3`, `profileitemrule` → `savedquery`) is **deferred to v0.5**. v0.1 supports Related-rows-only / All-records / Organization-rows radio options only.- ✅ `offline-profile-architect` agent follows the existing `mobile-app:` namespace + status-code protocol (`DONE` / `DONE_WITH_CONCERNS:` / `NEEDS_CONTEXT:` / `BLOCKED:`). Read-only — proposes scope; never mutates Dataverse. Mutation lives in `/setup-offline-profile` after the 3 gates.+- ✅ **Offline profile ↔ schema reconciliation across the lifecycle.** Any schema change (`/add-dataverse`, `/setup-datamodel`, `/edit-app`) reconciles an existing offline profile, and `/deploy` gates the final push on offline coverage. Mechanism: `scripts/offline-profile-delta.js` — a purely LOCAL, no-network diff of `.datamodel-manifest.json` (schema) vs `offline-profile.json` (offline coverage) reporting `missingTables` + new columns; `status` ∈ `no-manifest`/`no-profile`/`in-sync`/`delta`/`error` (exit 0 = ran, 1 = fatal). It is distinct from `verify-offline-profile.js`, which is a Dataverse-network drift check of the snapshot vs the live published profile. Column delta is computed against a per-table `schemaColumns` baseline (all schema columns present at reconciliation time), written by `/setup-offline-profile`, `/add-table-to-offline-profile`, and refreshed by `/edit-offline-profile` — NOT against the curated `selectedColumns`, so deliberate exclusions aren't false-flagged; legacy snapshots without it degrade to table-only delta. The one canonical flow (prompt wording, reconcile ordering, deploy gate/override) lives in [`shared/references/offline-profile-reconciliation.md`](shared/references/offline-profile-reconciliation.md); the four skills reference it rather than duplicating it. Orchestrator-invoked `/add-dataverse` (`--skip-planning`) suppresses its own Step 8.5 so the orchestrator owns reconciliation once.## Maintaining This Filediff --git a/plugins/mobile-apps/scripts/offline-profile-delta.js b/plugins/mobile-apps/scripts/offline-profile-delta.jsnew file mode 100644index 000000000..9d4180934--- /dev/null+++ b/plugins/mobile-apps/scripts/offline-profile-delta.js@@ -0,0 +1,251 @@+#!/usr/bin/env node++// Schema ↔ offline-profile coverage delta for Power Apps mobile apps.+//+// Compares the Dataverse data-model manifest (`.datamodel-manifest.json` — the app's+// authored schema) against the offline-profile snapshot (`offline-profile.json` — the+// tables and columns actually included in the Mobile Offline Profile) and reports what+// schema is NOT yet covered offline. It answers ONE question: "did a table or column+// get added to the data model that the offline profile hasn't picked up yet?"+//+// This is a purely LOCAL, deterministic, no-network comparison — it never reads a token+// and never calls Dataverse — so it is cheap enough to run as a gate before `/deploy`+// and after any schema change (`/add-dataverse`, `/edit-app`, `/setup-datamodel`).+//+// It is deliberately DISTINCT from verify-offline-profile.js, which makes a NETWORK call+// to Dataverse to detect DRIFT between the local snapshot and the live published profile+// (unpublished, criteria/sync/flag drift, prereq reverts). This script instead detects+// the SCHEMA-COVERAGE DELTA between two local files and needs no auth.+//+// Column-level delta is only computed for a table when the profile snapshot records a+// `schemaColumns` baseline for that table (the set of schema column logical names that+// existed when the table was last reconciled into the profile — written by+// /setup-offline-profile, /add-table-to-offline-profile, and /edit-offline-profile).+// Without that baseline we cannot tell a genuinely-new column apart from one the offline+// architect deliberately EXCLUDED from `selectedColumns`, so comparing against+// `selectedColumns` would emit a false positive on every curated exclusion. When the+// baseline is absent we therefore skip column delta for that table and surface it under+// `columnBaselineMissing` instead of guessing.+//+// Usage:+// node offline-profile-delta.js [--project-root <path>] [--manifest <path>] [--profile <path>]+//+// --project-root Directory holding offline-profile.json + .datamodel-manifest.json.+// Default: cwd.+// --manifest Explicit path to the data-model manifest (overrides auto-locate).+// --profile Explicit path to offline-profile.json (overrides auto-locate).+//+// Output (single-line JSON to stdout):+// { "status": "in-sync", "profileId": "...", "columnBaselineMissing": [...], ... }+// { "status": "delta", "missingTables": [...], "tablesWithNewColumns": [...], ... }+// { "status": "no-profile", "manifestPath": "...", "tables": [...] } // schema exists, no profile+// { "status": "no-manifest" } // no Dataverse schema to compare+// { "status": "error", "error": "..." }+//+// Exit codes:+// 0 — comparison ran; branch on the `status` field (in-sync / delta / no-profile / no-manifest)+// 1 — fatal error (bad args, an explicit --manifest/--profile path that doesn't exist,+// an unreadable file, or invalid JSON)++const fs = require('fs');+const path = require('path');++function usage(msg) {+ process.stderr.write(`Error: ${msg}\n\n`);+ process.stderr.write(+ 'Usage: node offline-profile-delta.js [--project-root <path>] [--manifest <path>] [--profile <path>]\n',+ );+ process.exit(1);+}++function parseArgs(argv) {+ const out = { projectRoot: process.cwd(), manifest: null, profile: null };+ for (let i = 0; i < argv.length; i++) {+ const flag = argv[i];+ const next = argv[i + 1];+ switch (flag) {+ case '--project-root': out.projectRoot = next; i++; break;+ case '--manifest': out.manifest = next; i++; break;+ case '--profile': out.profile = next; i++; break;+ default: usage(`Unknown flag: ${flag}`);+ }+ }+ return out;+}++// The manifest lives at either the project root (legacy) or docs/plan-artifacts/+// (newer scaffolds) — mirror the dual-location probe used across the offline skills,+// e.g. /setup-offline-profile Step 1 and /add-table-to-offline-profile Step 1.+function locateManifest(projectRoot, explicit) {+ if (explicit) return fs.existsSync(explicit) ? explicit : null;+ const candidates = [+ path.join(projectRoot, '.datamodel-manifest.json'),+ path.join(projectRoot, 'docs', 'plan-artifacts', '.datamodel-manifest.json'),+ ];+ return candidates.find((p) => fs.existsSync(p)) || null;+}++function locateProfile(projectRoot, explicit) {+ if (explicit) return fs.existsSync(explicit) ? explicit : null;+ const p = path.join(projectRoot, 'offline-profile.json');+ return fs.existsSync(p) ? p : null;+}++// Normalize a manifest table's columns to a flat list of logical names. Manifest+// column entries are objects — { "logicalName": "cr123_total", "type": "Money" } — but+// tolerate bare-string entries too so a hand-edited manifest doesn't crash the gate.+function manifestColumnNames(table) {+ const cols = Array.isArray(table && table.columns) ? table.columns : [];+ return cols+ .map((c) => (typeof c === 'string' ? c : c && c.logicalName))+ .filter(Boolean);+}++/**+ * Pure comparison: given a parsed manifest and profile, return the coverage delta.+ * Exported for reuse/tests — the CLI below is a thin wrapper that locates + reads files.+ *+ * @param {object} manifest - parsed .datamodel-manifest.json ({ tables: [...] })+ * @param {object} profile - parsed offline-profile.json ({ profileId, tables: [...] })+ */+function computeOfflineProfileDelta(manifest, profile) {+ const manifestTables = Array.isArray(manifest && manifest.tables) ? manifest.tables : [];+ const profileTables = Array.isArray(profile && profile.tables) ? profile.tables : [];+ const profileByName = new Map(+ profileTables.filter((t) => t && t.logicalName).map((t) => [t.logicalName, t]),+ );++ const missingTables = [];+ const tablesWithNewColumns = [];+ const columnBaselineMissing = [];++ for (const mt of manifestTables) {+ const name = mt && mt.logicalName;+ if (!name) continue; // malformed manifest entry — skip rather than crash the gate++ const pt = profileByName.get(name);+ if (!pt) {+ // A table exists in the data model but not in the offline profile at all — the+ // strongest, always-computable delta. /add-table-to-offline-profile fixes it.+ missingTables.push({+ logicalName: name,+ displayName: mt.displayName || name,+ status: mt.status || 'unknown',+ });+ continue;+ }++ const manifestCols = manifestColumnNames(mt);+ if (manifestCols.length === 0) continue; // nothing to compare (e.g. reused table)++ // `schemaColumns` is the reconciliation baseline. Absent it we cannot distinguish a+ // new column from a deliberately-excluded one, so we report the gap instead of a+ // false-positive column delta. See the header note.+ if (!Array.isArray(pt.schemaColumns)) {+ columnBaselineMissing.push(name);+ continue;+ }++ const baseline = new Set(pt.schemaColumns);+ const newColumns = manifestCols.filter((c) => !baseline.has(c));+ if (newColumns.length > 0) {+ tablesWithNewColumns.push({ logicalName: name, itemId: pt.itemId, newColumns });+ }+ }++ const hasDelta = missingTables.length > 0 || tablesWithNewColumns.length > 0;+ return {+ status: hasDelta ? 'delta' : 'in-sync',+ profileId: profile && profile.profileId,+ missingTables,+ tablesWithNewColumns,+ columnBaselineMissing,+ summary: {+ missingTableCount: missingTables.length,+ newColumnTableCount: tablesWithNewColumns.length,+ newColumnCount: tablesWithNewColumns.reduce((n, t) => n + t.newColumns.length, 0),+ columnBaselineMissingCount: columnBaselineMissing.length,+ },+ };+}++function readJson(filePath) {+ const raw = fs.readFileSync(filePath, 'utf8');+ return JSON.parse(raw);+}++function main() {+ const { projectRoot, manifest: manifestFlag, profile: profileFlag } = parseArgs(+ process.argv.slice(2),+ );++ // An explicit --manifest / --profile that doesn't exist is a bad invocation, not an+ // absent artifact. Fail loudly (exit 1) so a typo'd path can't masquerade as+ // `no-manifest` / `no-profile` and make a caller silently skip reconciliation. The+ // auto-locate path (no flag) legitimately returns null → no-manifest / no-profile.+ if (manifestFlag && !fs.existsSync(manifestFlag)) usage(`--manifest path not found: ${manifestFlag}`);+ if (profileFlag && !fs.existsSync(profileFlag)) usage(`--profile path not found: ${profileFlag}`);++ const manifestPath = locateManifest(projectRoot, manifestFlag);+ if (!manifestPath) {+ // No Dataverse schema in this project (connectors-only app, or data model not yet+ // applied). There is nothing to reconcile against an offline profile.+ console.log(JSON.stringify({ status: 'no-manifest' }));+ return;+ }++ const profilePath = locateProfile(projectRoot, profileFlag);+ if (!profilePath) {+ // The app HAS a data model but no offline profile. This is not a delta to patch —+ // it means offline was never set up. Callers should offer /setup-offline-profile+ // (or skip silently when the app opted out of offline), never auto-run an edit.+ let tables = [];+ try {+ const manifest = readJson(manifestPath);+ tables = (Array.isArray(manifest.tables) ? manifest.tables : [])+ .map((t) => t && t.logicalName)+ .filter(Boolean);+ } catch (e) {+ console.log(JSON.stringify({ status: 'error', error: `Failed to read manifest: ${e.message}` }));+ process.exit(1);+ }+ console.log(JSON.stringify({ status: 'no-profile', manifestPath, tables }));+ return;+ }++ let manifest;+ let profile;+ try {+ manifest = readJson(manifestPath);+ } catch (e) {+ console.log(JSON.stringify({ status: 'error', error: `.datamodel-manifest.json is not valid JSON: ${e.message}` }));+ process.exit(1);+ }+ try {+ profile = readJson(profilePath);+ } catch (e) {+ console.log(JSON.stringify({ status: 'error', error: `offline-profile.json is not valid JSON: ${e.message}` }));+ process.exit(1);+ }++ const result = computeOfflineProfileDelta(manifest, profile);+ result.manifestPath = manifestPath;+ result.profilePath = profilePath;+ console.log(JSON.stringify(result));+}++if (require.main === module) {+ try {+ main();+ } catch (err) {+ process.stderr.write(`Unexpected error: ${(err && err.stack) || err}\n`);+ process.exit(1);+ }+}++module.exports = {+ computeOfflineProfileDelta,+ locateManifest,+ locateProfile,+ manifestColumnNames,+};diff --git a/plugins/mobile-apps/scripts/tests/offline-profile-delta.test.js b/plugins/mobile-apps/scripts/tests/offline-profile-delta.test.jsnew file mode 100644index 000000000..50304824c--- /dev/null+++ b/plugins/mobile-apps/scripts/tests/offline-profile-delta.test.js@@ -0,0 +1,247 @@+'use strict';++// Tests for offline-profile-delta.js — the LOCAL schema ↔ offline-profile coverage+// diff. Run with: node --test plugins/mobile-apps/scripts/tests/+//+// Covers the pure comparison (computeOfflineProfileDelta) plus the CLI's file-location+// and status routing (no-manifest / no-profile / delta / in-sync) via temp fixtures.++const test = require('node:test');+const assert = require('node:assert');+const fs = require('fs');+const os = require('os');+const path = require('path');+const { execFileSync } = require('child_process');++const {+ computeOfflineProfileDelta,+ manifestColumnNames,+} = require('../offline-profile-delta');++const SCRIPT = path.join(__dirname, '..', 'offline-profile-delta.js');++function runCli(projectRoot, extraArgs = []) {+ // The CLI exits 0 for any comparison that ran and 1 only on fatal errors, so capture+ // both the parsed JSON and the exit code to assert the exit-code contract too.+ try {+ const stdout = execFileSync('node', [SCRIPT, '--project-root', projectRoot, ...extraArgs], {+ encoding: 'utf8',+ });+ return { code: 0, json: JSON.parse(stdout.trim()) };+ } catch (e) {+ return {+ code: e.status,+ json: e.stdout ? JSON.parse(e.stdout.toString().trim()) : null,+ stderr: e.stderr ? e.stderr.toString() : '',+ };+ }+}++function tmpProject() {+ return fs.mkdtempSync(path.join(os.tmpdir(), 'offline-delta-'));+}++// ── Pure function ────────────────────────────────────────────────────────────++test('in-sync when every manifest table is covered and no new columns', () => {+ const manifest = {+ tables: [{ logicalName: 'cr123_order', columns: [{ logicalName: 'cr123_total' }] }],+ };+ const profile = {+ profileId: 'p1',+ tables: [{ logicalName: 'cr123_order', schemaColumns: ['cr123_total'], selectedColumns: ['cr123_total'] }],+ };+ const delta = computeOfflineProfileDelta(manifest, profile);+ assert.strictEqual(delta.status, 'in-sync');+ assert.strictEqual(delta.summary.missingTableCount, 0);+ assert.strictEqual(delta.summary.newColumnCount, 0);+});++test('flags a table present in the manifest but missing from the profile', () => {+ const manifest = {+ tables: [+ { logicalName: 'cr123_order', displayName: 'Order', status: 'new', columns: [] },+ { logicalName: 'cr123_case', displayName: 'Case', status: 'new', columns: [] },+ ],+ };+ const profile = { profileId: 'p1', tables: [{ logicalName: 'cr123_order', schemaColumns: [] }] };+ const delta = computeOfflineProfileDelta(manifest, profile);+ assert.strictEqual(delta.status, 'delta');+ assert.deepStrictEqual(+ delta.missingTables.map((t) => t.logicalName),+ ['cr123_case'],+ );+ assert.strictEqual(delta.missingTables[0].displayName, 'Case');+});++test('flags new columns added to a table since its reconciliation baseline', () => {+ const manifest = {+ tables: [+ {+ logicalName: 'cr123_order',+ columns: [{ logicalName: 'cr123_total' }, { logicalName: 'cr123_priority' }],+ },+ ],+ };+ const profile = {+ profileId: 'p1',+ tables: [{ logicalName: 'cr123_order', itemId: 'i1', schemaColumns: ['cr123_total'] }],+ };+ const delta = computeOfflineProfileDelta(manifest, profile);+ assert.strictEqual(delta.status, 'delta');+ assert.strictEqual(delta.tablesWithNewColumns.length, 1);+ assert.deepStrictEqual(delta.tablesWithNewColumns[0].newColumns, ['cr123_priority']);+ assert.strictEqual(delta.tablesWithNewColumns[0].itemId, 'i1');+});++test('does NOT flag columns as new when they predate the baseline (deliberate exclusions)', () => {+ // cr123_notes is in the schema baseline but intentionally not in selectedColumns —+ // that is a curated exclusion, NOT a delta. The gate must stay quiet about it.+ const manifest = {+ tables: [+ {+ logicalName: 'cr123_order',+ columns: [{ logicalName: 'cr123_total' }, { logicalName: 'cr123_notes' }],+ },+ ],+ };+ const profile = {+ profileId: 'p1',+ tables: [+ {+ logicalName: 'cr123_order',+ schemaColumns: ['cr123_total', 'cr123_notes'],+ selectedColumns: ['cr123_total'],+ },+ ],+ };+ const delta = computeOfflineProfileDelta(manifest, profile);+ assert.strictEqual(delta.status, 'in-sync');+});++test('reports columnBaselineMissing (not a delta) for legacy snapshots without schemaColumns', () => {+ const manifest = {+ tables: [{ logicalName: 'cr123_order', columns: [{ logicalName: 'cr123_total' }] }],+ };+ const profile = {+ profileId: 'p1',+ tables: [{ logicalName: 'cr123_order', selectedColumns: ['cr123_total'] }], // no schemaColumns+ };+ const delta = computeOfflineProfileDelta(manifest, profile);+ assert.strictEqual(delta.status, 'in-sync');+ assert.deepStrictEqual(delta.columnBaselineMissing, ['cr123_order']);+});++test('tolerates bare-string manifest column entries', () => {+ assert.deepStrictEqual(+ manifestColumnNames({ columns: ['cr123_total', { logicalName: 'cr123_priority' }, null] }),+ ['cr123_total', 'cr123_priority'],+ );+});++test('missing table + new column combine into one delta', () => {+ const manifest = {+ tables: [+ { logicalName: 'cr123_order', columns: [{ logicalName: 'cr123_total' }, { logicalName: 'cr123_priority' }] },+ { logicalName: 'cr123_case', displayName: 'Case', status: 'new', columns: [] },+ ],+ };+ const profile = {+ profileId: 'p1',+ tables: [{ logicalName: 'cr123_order', schemaColumns: ['cr123_total'] }],+ };+ const delta = computeOfflineProfileDelta(manifest, profile);+ assert.strictEqual(delta.status, 'delta');+ assert.strictEqual(delta.summary.missingTableCount, 1);+ assert.strictEqual(delta.summary.newColumnCount, 1);+});++// ── CLI + file location ──────────────────────────────────────────────────────++test('CLI returns no-manifest when there is no data model', () => {+ const dir = tmpProject();+ const res = runCli(dir);+ assert.strictEqual(res.code, 0);+ assert.strictEqual(res.json.status, 'no-manifest');+});++test('CLI returns no-profile when a manifest exists but no offline profile', () => {+ const dir = tmpProject();+ fs.writeFileSync(+ path.join(dir, '.datamodel-manifest.json'),+ JSON.stringify({ tables: [{ logicalName: 'cr123_order' }, { logicalName: 'cr123_case' }] }),+ );+ const res = runCli(dir);+ assert.strictEqual(res.code, 0);+ assert.strictEqual(res.json.status, 'no-profile');+ assert.deepStrictEqual(res.json.tables, ['cr123_order', 'cr123_case']);+});++test('CLI locates the manifest under docs/plan-artifacts/', () => {+ const dir = tmpProject();+ const artifactsDir = path.join(dir, 'docs', 'plan-artifacts');+ fs.mkdirSync(artifactsDir, { recursive: true });+ fs.writeFileSync(+ path.join(artifactsDir, '.datamodel-manifest.json'),+ JSON.stringify({ tables: [{ logicalName: 'cr123_order', columns: [{ logicalName: 'cr123_total' }] }] }),+ );+ fs.writeFileSync(+ path.join(dir, 'offline-profile.json'),+ JSON.stringify({ profileId: 'p1', tables: [{ logicalName: 'cr123_order', schemaColumns: ['cr123_total'] }] }),+ );+ const res = runCli(dir);+ assert.strictEqual(res.code, 0);+ assert.strictEqual(res.json.status, 'in-sync');+ assert.ok(res.json.manifestPath.includes(path.join('docs', 'plan-artifacts')));+});++test('CLI reports delta end-to-end', () => {+ const dir = tmpProject();+ fs.writeFileSync(+ path.join(dir, '.datamodel-manifest.json'),+ JSON.stringify({+ tables: [+ { logicalName: 'cr123_order', columns: [{ logicalName: 'cr123_total' }] },+ { logicalName: 'cr123_case', displayName: 'Case', status: 'new', columns: [] },+ ],+ }),+ );+ fs.writeFileSync(+ path.join(dir, 'offline-profile.json'),+ JSON.stringify({ profileId: 'p1', tables: [{ logicalName: 'cr123_order', schemaColumns: ['cr123_total'] }] }),+ );+ const res = runCli(dir);+ assert.strictEqual(res.code, 0);+ assert.strictEqual(res.json.status, 'delta');+ assert.deepStrictEqual(res.json.missingTables.map((t) => t.logicalName), ['cr123_case']);+});++test('CLI exits 1 on invalid JSON', () => {+ const dir = tmpProject();+ fs.writeFileSync(path.join(dir, '.datamodel-manifest.json'), '{ not valid json');+ fs.writeFileSync(path.join(dir, 'offline-profile.json'), JSON.stringify({ profileId: 'p1', tables: [] }));+ const res = runCli(dir);+ assert.strictEqual(res.code, 1);+ assert.strictEqual(res.json.status, 'error');+});++test('CLI exits 1 when an explicit --manifest path does not exist (not silently no-manifest)', () => {+ const dir = tmpProject();+ const res = runCli(dir, ['--manifest', path.join(dir, 'does-not-exist.json')]);+ assert.strictEqual(res.code, 1);+ // Usage errors go to stderr, not the JSON stdout contract.+ assert.strictEqual(res.json, null);+ assert.match(res.stderr, /--manifest path not found/);+});++test('CLI exits 1 when an explicit --profile path does not exist (not silently no-profile)', () => {+ const dir = tmpProject();+ fs.writeFileSync(+ path.join(dir, '.datamodel-manifest.json'),+ JSON.stringify({ tables: [{ logicalName: 'cr123_order' }] }),+ );+ const res = runCli(dir, ['--profile', path.join(dir, 'nope.json')]);+ assert.strictEqual(res.code, 1);+ assert.strictEqual(res.json, null);+ assert.match(res.stderr, /--profile path not found/);+});diff --git a/plugins/mobile-apps/shared/references/offline-profile-reconciliation.md b/plugins/mobile-apps/shared/references/offline-profile-reconciliation.mdnew file mode 100644index 000000000..792c711a0--- /dev/null+++ b/plugins/mobile-apps/shared/references/offline-profile-reconciliation.md@@ -0,0 +1,121 @@+# Offline Profile ↔ Schema Reconciliation++Keeps a Mobile Offline Profile in sync with the app's Dataverse schema across the whole+development lifecycle. Whenever the data model changes (a table or column is added), the+offline profile can silently fall behind — a new table isn't in the profile, so it never+syncs to the device, and a new column isn't in `selectedColumns`, so it's blank offline.++This reference is the single source of truth for that reconciliation flow. The schema+skills (`/add-dataverse`, `/setup-datamodel`, `/edit-app`) and the publish skill+(`/deploy`) all reference it instead of duplicating the logic.++There are two related-but-distinct offline checks — do not confuse them:++| Script | Question | Network? | Used by |+|---|---|---|---|+| `scripts/offline-profile-delta.js` | Is a table/column in the **schema** but **not in the offline profile** yet? | **No** (local file diff) | schema skills + `/deploy` (this doc) |+| `scripts/verify-offline-profile.js` | Does `offline-profile.json` still match the **live published profile** in Dataverse (drift/reverts)? | Yes (Dataverse) | `/setup-offline-profile` Step 9.5 |++---++## The delta check++```bash+node "${PLUGIN_ROOT}/scripts/offline-profile-delta.js" [--project-root <path>]+```++Purely local and deterministic — no `az` token, no Dataverse call — so it is safe and+fast to run as a gate. It auto-locates `.datamodel-manifest.json` (root or+`docs/plan-artifacts/`) and `offline-profile.json` (root). Output is single-line JSON on+stdout; exit `0` when the comparison ran (branch on `status`), exit `1` on a fatal error+(bad args, an explicit `--manifest`/`--profile` path that doesn't exist, or an+unreadable/invalid JSON file).++| `status` | Meaning | What to do |+|---|---|---|+| `no-manifest` | No Dataverse schema in the project (connectors-only, or data model not applied). | Nothing to reconcile. Continue silently. |+| `no-profile` | The app has a data model but **no** offline profile. | The app never set up offline (or opted out). Do **not** auto-run an edit. Offer `/setup-offline-profile` only if the user wants offline; otherwise continue. |+| `in-sync` | Every schema table is in the profile and no new columns since each table's baseline. | Continue. |+| `delta` | ≥1 table missing from the profile, and/or ≥1 table has new columns since its baseline. | Reconcile — see below. |+| `error` | Fatal — `offline-profile.json` (or the manifest) is unreadable/invalid JSON; the script also **exits non-zero**. | Surface the `error` string and **stop** (do not treat as `in-sync`/continue): coverage can't be validated against a corrupt file. Skip reconciliation; the user must fix the file and re-run. At `/deploy` this maps to STOP-or-`deploy without offline` override. |++A `delta` result carries:++- `missingTables[]` — `{ logicalName, displayName, status }` for each schema table absent+ from the profile. This is the **strong, always-computable** signal.+- `tablesWithNewColumns[]` — `{ logicalName, itemId, newColumns[] }` for each profiled+ table that gained schema columns since it was last reconciled.+- `columnBaselineMissing[]` — profiled tables whose snapshot predates the `schemaColumns`+ baseline (see below). Column delta can't be computed for these; treat as advisory only.++---++## The `schemaColumns` baseline (why column delta is precise, not noisy)++An offline profile's `selectedColumns` is a **curated subset** — the offline architect+deliberately omits columns that don't need to sync. So "column in the schema but not in+`selectedColumns`" is NOT, by itself, a delta; it's usually an intentional exclusion.++To tell a *genuinely new* column apart from a *deliberately excluded* one, each table+entry in `offline-profile.json` records `schemaColumns` — the set of schema column+logical names that existed when that table was last reconciled into the profile. The+delta is then `manifest.columns − schemaColumns` (new since the baseline), never+`manifest.columns − selectedColumns`.++The offline skills write/refresh this baseline:++- `/setup-offline-profile` (Step 9a) and `/add-table-to-offline-profile` (Step 7) write+ `schemaColumns` = the table's current manifest columns when the item is created.+- `/edit-offline-profile` (Step 6) refreshes `schemaColumns` to the current manifest+ columns after a column edit, re-baselining so a reconciled delta clears.++Legacy snapshots without `schemaColumns` degrade gracefully: table-level delta still+works; the table is reported under `columnBaselineMissing` instead of producing false+positives. Running `/edit-offline-profile --table <t> --columns reset` re-establishes the+baseline.++---++## Reconcile a `delta` (schema skills)++After a schema change, when the delta is `delta`, prompt the user (one `AskUserQuestion`,+default = update now):++> "You changed the data model. `<N>` new table(s) and `<M>` new column(s) aren't in the+> offline profile `<name>` yet, so they won't sync to devices. Update the offline profile+> now?"+> - **Yes — update the offline profile (recommended)**+> - Skip — I'll run it later (it will be re-checked at `/deploy`)++On **Yes**, apply in this order (both are non-interactive when the target is explicit):++1. For each `missingTables[]` entry → `/add-table-to-offline-profile --table <logicalName>`+ (or `--all-new` to add them all at once).+2. For each `tablesWithNewColumns[]` entry →+ `/edit-offline-profile --table <logicalName> --columns add:<comma-separated newColumns>`.++Re-run the delta check afterward; expect `in-sync`. Surface any remaining `delta` as a+concern rather than looping.++Skip the prompt entirely on `no-manifest`, `in-sync`, and `no-profile` (for `no-profile`,+only mention `/setup-offline-profile` if the user has expressed interest in offline).++---++## Gate a `delta` (`/deploy`, the final publish step)++`/deploy` is the last chance to catch schema that never made it into the offline profile+before it ships. Run the delta check **before** `npx power-apps push`:++- `no-manifest` / `no-profile` / `in-sync` → no gate; continue (for `no-profile`, print a+ one-line note that no offline profile exists).+- `delta` → **STOP before pushing.** Print `missingTables` + `tablesWithNewColumns`, then+ offer:+ - **Update the offline profile now** (recommended) → run the reconcile steps above,+ re-check to `in-sync`, then continue to push.+ - **Deploy anyway** → requires an explicit override (type `deploy without offline`),+ mirroring the environment-mismatch gate. A bare `y`/`yes` is not enough — deploying a+ schema the offline profile doesn't cover is a silent data-availability bug on devices.++This makes the deploy gate the backstop for any schema change whose reconciliation prompt+was skipped earlier in the lifecycle.diff --git a/plugins/mobile-apps/shared/references/offline-profile-schema.md b/plugins/mobile-apps/shared/references/offline-profile-schema.mdindex 5b76e0e31..3bfd58654 100644--- a/plugins/mobile-apps/shared/references/offline-profile-schema.md+++ b/plugins/mobile-apps/shared/references/offline-profile-schema.md@@ -194,6 +194,7 @@ Shape:"recordsOwnedByMyBusinessUnit": false,"syncIntervalInMinutes": 10,"selectedColumns": ["cr123_title", "cr123_body", "..."],+ "schemaColumns": ["cr123_title", "cr123_body", "cr123_internalnotes", "..."],"relationships": [{"associationId": "<guid>",@@ -206,6 +207,8 @@ Shape:}```+`selectedColumns` is the curated set the runtime syncs; `schemaColumns` is the **schema-reconciliation baseline** — every schema column logical name the table had (from `.datamodel-manifest.json`) when this item was last reconciled, including columns deliberately left out of `selectedColumns`. `scripts/offline-profile-delta.js` diffs later manifest columns against `schemaColumns` (not `selectedColumns`) so it only surfaces *genuinely new* columns. See [offline-profile-reconciliation.md](./offline-profile-reconciliation.md).+App-level offline config (previously written into `power.config.json` as an `offline` block) now lives inside the same `offline-profile.json` file under an `appConfig` key:```jsondiff --git a/plugins/mobile-apps/skills/add-dataverse/SKILL.md b/plugins/mobile-apps/skills/add-dataverse/SKILL.mdindex c2abea194..f24b16c46 100644--- a/plugins/mobile-apps/skills/add-dataverse/SKILL.md+++ b/plugins/mobile-apps/skills/add-dataverse/SKILL.md@@ -17,7 +17,7 @@ Two paths:## Workflow-1. Verify project & auth → 2. Resolve plan → 3. Setup Dataverse Web API auth → 4. Review existing tables → 5. Create / extend tables → 5d. Create alternate keys → 6. Add data sources → 6b. Publish customizations → 6c. Verify tables → 6d. Write manifest → 7. Inspect generated files → 8. Type-check → 9. Summary+1. Verify project & auth → 2. Resolve plan → 3. Setup Dataverse Web API auth → 4. Review existing tables → 5. Create / extend tables → 5d. Create alternate keys → 6. Add data sources → 6b. Publish customizations → 6c. Verify tables → 6d. Write manifest → 7. Inspect generated files → 8. Type-check → 8.5. Offline profile reconciliation → 9. Summary---@@ -779,6 +779,26 @@ npx tsc --noEmitFix any errors. Common: missing peer dependencies — `npx expo install <package>`.+### Step 8.5 — Offline profile reconciliation++A schema change here (new table or new column) can leave an existing Mobile Offline Profile behind — new tables never sync to devices and new columns come down blank. Reconcile the profile with what you just created.++**Skip this step entirely when `$ARGUMENTS` contains `--skip-planning`** (the orchestrator-invoked path). `/create-mobile-app`, `/setup-datamodel`, and `/edit-app` own offline reconciliation in their own flow, so running it here too would double-prompt.++Otherwise (manual `/add-dataverse`), run the local, no-network delta check:++```bash+node "${CLAUDE_SKILL_DIR}/../../scripts/offline-profile-delta.js"+```++Branch on the JSON `status` per [offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md):++| `status` | Action |+|---|---|+| `no-manifest` / `no-profile` / `in-sync` | Continue to Step 9 silently. For `no-profile` (no offline profile exists) do not nag — the app may not use offline. |+| `error` | `offline-profile.json` is unreadable — the script prints `status: error` and **exits non-zero**. Do NOT treat this as an `/add-dataverse` failure (the tables are already created): surface the `error` string, **skip reconciliation** (never drive the update skills against a corrupt file), and finish with `DONE_WITH_CONCERNS` telling the user to fix `offline-profile.json`, then run `/add-table-to-offline-profile` manually. |+| `delta` | Prompt the user (one `AskUserQuestion`, default = update now) to add the missing tables / new columns to the offline profile, then invoke `/add-table-to-offline-profile` (for `missingTables[]`) and `/edit-offline-profile --table <t> --columns add:<newColumns>` (for `tablesWithNewColumns[]`). Re-run the delta check; it should read `in-sync`. Follow the exact prompt + ordering in the reconciliation reference. |+### Step 9 — Summary```@@ -837,3 +857,4 @@ After printing the summary, **offer one-click sample-data seeding** — but only## Reference- [`scripts/dataverse-request.js`](../../scripts/dataverse-request.js) — bundled in this plugin+- [shared/references/offline-profile-reconciliation.md](../../shared/references/offline-profile-reconciliation.md) — Step 8.5 offline delta check + reconciliation flowdiff --git a/plugins/mobile-apps/skills/add-table-to-offline-profile/SKILL.md b/plugins/mobile-apps/skills/add-table-to-offline-profile/SKILL.mdindex fd9c8e3f5..6513eac13 100644--- a/plugins/mobile-apps/skills/add-table-to-offline-profile/SKILL.md+++ b/plugins/mobile-apps/skills/add-table-to-offline-profile/SKILL.md@@ -11,6 +11,7 @@ model: sonnet**References:**- [dataverse-offline-api.md](${CLAUDE_SKILL_DIR}/../../shared/references/dataverse-offline-api.md) §4 + §7 — POST item + PATCH selectedcolumns+- [offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md) — the `schemaColumns` baseline written in Step 7# Add Table to Offline Profile@@ -155,7 +156,9 @@ Publishes only this profile, not the entire org's customizations. See [shared/re### Step 7 — Update artifacts-Append to `offline-profile.json` `tables[]` array. Append to `memory-bank.md` `## Offline profile` block:+Append the new table's entry to `offline-profile.json` `tables[]`. The entry MUST include a `schemaColumns` array — the added table's full set of schema column logical names from `.datamodel-manifest.json` at this moment. This is the schema-reconciliation baseline that `scripts/offline-profile-delta.js` diffs future manifest changes against; omitting it makes the lifecycle delta check report this table under `columnBaselineMissing` until it is re-reconciled. It is distinct from `selectedColumns` (the curated sync set) — see [offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md). Match the canonical entry shape in [`/setup-offline-profile` Step 9a](../setup-offline-profile/SKILL.md).++Append to `memory-bank.md` `## Offline profile` block:```yamladdedTables:diff --git a/plugins/mobile-apps/skills/deploy/SKILL.md b/plugins/mobile-apps/skills/deploy/SKILL.mdindex 6ab46fec2..9ba72cf2c 100644--- a/plugins/mobile-apps/skills/deploy/SKILL.md+++ b/plugins/mobile-apps/skills/deploy/SKILL.md@@ -2,7 +2,7 @@name: deploydescription: Use when the user wants to deploy / publish / push a Power Apps mobile app to a Power Platform tenant so others can run it.user-invocable: true-allowed-tools: Read, Glob, Bash, AskUserQuestion+allowed-tools: Read, Glob, Bash, AskUserQuestion, Skillmodel: sonnet---@@ -22,7 +22,7 @@ This skill uses the standard 4-step deployment flow for this plugin: check memor## Workflow-1. Check memory bank → 2. Build → 3. Deploy → 4. Update memory bank+1. Check memory bank → 2. Build → 2.5 Offline profile coverage gate → 3. Deploy → 4. Update memory bank---@@ -64,6 +64,43 @@ If the build fails:Verify `dist/` exists with `index.html` before continuing.+### Step 2.5 — Offline profile coverage gate++This is the final chance to catch schema that never made it into the Mobile Offline Profile before it ships — a table added to the data model but not the profile never syncs to devices, and a new column arrives blank offline. Validate that every schema change is covered **before** pushing.++Run the local, no-network delta check (`.datamodel-manifest.json` vs `offline-profile.json`):++```bash+node "${CLAUDE_SKILL_DIR}/../../scripts/offline-profile-delta.js"+```++Branch on the JSON `status` (full contract in [offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md)):++| `status` | Action |+|---|---|+| `no-manifest` | Connectors-only app — no Dataverse schema. Continue to Step 3 silently. |+| `no-profile` | No offline profile in this project. Print one line: `↷ No offline profile — skipping offline coverage check. Run /setup-offline-profile if you want offline support.` Continue to Step 3. |+| `in-sync` | Print `✓ Offline profile covers all schema changes.` Continue to Step 3. |+| `error` | `offline-profile.json` is unreadable — the script prints `status: error` and **exits non-zero**. Offline coverage can't be validated against a corrupt file, so **STOP before pushing**: surface the `error` string and have the user fix `offline-profile.json` and re-run, or type the `deploy without offline` override (below) to push anyway. |+| `delta` | **STOP before pushing.** See below. |++**On `delta`** — print the uncovered schema, then gate with `AskUserQuestion`:++```+⚠ The offline profile is missing schema changes. If you deploy now, these won't be+ available on disconnected devices:++ Tables not in the profile : <missingTables[].logicalName>+ Tables with new columns : <tablesWithNewColumns[].logicalName (newColumns)>+```++Options:++- **Update the offline profile now (recommended)** — invoke `/add-table-to-offline-profile` for each `missingTables[]` entry (or once with `--all-new`) and `/edit-offline-profile --table <t> --columns add:<newColumns>` for each `tablesWithNewColumns[]` entry, following the ordering in the reconciliation reference. Then re-run the delta check; when it reports `in-sync`, continue to Step 3.+- **Deploy anyway** — requires an explicit override. Wait for the exact phrase `deploy without offline` (case-insensitive); a bare `y`/`yes` is not enough, mirroring the environment-mismatch gate in Step 3. Then continue to Step 3 and note the skipped reconciliation in the Step 4 build-history row.++Do not push until the gate is resolved (reconciled to `in-sync`, or explicitly overridden).+### Step 3 — Deploy**Resolve and confirm the target environment FIRST.** `npx power-apps push` deploys to the environment configured in `power.config.json`. Resolve that ID to a Dataverse URL so the user catches drift before pushing.@@ -152,3 +189,4 @@ If they want to compile a native binary locally, they run the platform-specific- [`shared/version-check.md`](${CLAUDE_SKILL_DIR}/../../shared/version-check.md) — min versions (only Always-required tier matters here)- [`shared/memory-bank.md`](${CLAUDE_SKILL_DIR}/../../shared/memory-bank.md) — Build history schema+- [`shared/references/offline-profile-reconciliation.md`](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md) — Step 2.5 offline coverage gatediff --git a/plugins/mobile-apps/skills/edit-app/SKILL.md b/plugins/mobile-apps/skills/edit-app/SKILL.mdindex 1b70f9cc6..61bfad536 100644--- a/plugins/mobile-apps/skills/edit-app/SKILL.md+++ b/plugins/mobile-apps/skills/edit-app/SKILL.md@@ -403,6 +403,18 @@ Replace or create the `## Generated Services (snapshot at <ISO timestamp>)` sectDo not ask the user to run these follow-up skills manually. This skill is the orchestrator.+#### Step 5.6 — Offline profile reconciliation++If Step 5 created or extended Dataverse tables, an existing Mobile Offline Profile may now be missing those tables/columns (new tables never sync to devices; new columns arrive blank). Step 5's `/add-dataverse --skip-planning` suppresses that skill's own Step 8.5 reconciliation, so this orchestrator owns the check. Skip when no Data Model mutation occurred in this edit.++Run the local, no-network delta check:++```bash+node "${CLAUDE_SKILL_DIR}/../../scripts/offline-profile-delta.js"+```++Branch on the JSON `status` per [offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md): `no-manifest` / `no-profile` / `in-sync` → continue silently (do not nag when no profile exists); `delta` → prompt to update, then invoke `/add-table-to-offline-profile` (for `missingTables[]`) and `/edit-offline-profile --table <t> --columns add:<newColumns>` (for `tablesWithNewColumns[]`), and re-check to `in-sync`. Record the reconciliation outcome in the Step 8 memory-bank edit entry.+### Step 6 — Rebuild affected screensUse the plan diff plus the user's request to build the affected screen set:diff --git a/plugins/mobile-apps/skills/edit-offline-profile/SKILL.md b/plugins/mobile-apps/skills/edit-offline-profile/SKILL.mdindex 7ec0ad9f4..3bd53afc0 100644--- a/plugins/mobile-apps/skills/edit-offline-profile/SKILL.md+++ b/plugins/mobile-apps/skills/edit-offline-profile/SKILL.md@@ -11,6 +11,7 @@ model: sonnet**References:**- [dataverse-offline-api.md](${CLAUDE_SKILL_DIR}/../../shared/references/dataverse-offline-api.md) §4 / §7 — POST item + PATCH selectedcolumns+- [offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md) — refreshing the `schemaColumns` baseline after a column edit# Edit Offline Profile@@ -127,7 +128,9 @@ On `400 / 0x80071141` "circular relationship" — same handling as `/setup-offli### Step 6 — Update artifacts-Re-read the changed item(s) and rewrite the matching entry in `offline-profile.json`. Append a one-line entry to `memory-bank.md` `## Offline profile` block:+Re-read the changed item(s) and rewrite the matching entry in `offline-profile.json`. When the edit changed a table's **columns** (`--columns add:/remove:/reset`), also refresh that table entry's `schemaColumns` to the table's current full column set from `.datamodel-manifest.json` (root or `docs/plan-artifacts/`). This re-baselines the schema-reconciliation marker so a delta that was just reconciled clears on the next `scripts/offline-profile-delta.js` run; leave `schemaColumns` untouched for scope/sync/rename-only edits. See [offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md).++Append a one-line entry to `memory-bank.md` `## Offline profile` block:```yamledits:diff --git a/plugins/mobile-apps/skills/setup-datamodel/SKILL.md b/plugins/mobile-apps/skills/setup-datamodel/SKILL.mdindex 67774d2c9..df38eb280 100644--- a/plugins/mobile-apps/skills/setup-datamodel/SKILL.md+++ b/plugins/mobile-apps/skills/setup-datamodel/SKILL.md@@ -158,6 +158,18 @@ Arguments:Run sequentially. Skip if `## Connectors` is "None".+### Phase 6.5 — Offline profile reconciliation++If Phase 5 created or extended Dataverse tables, an existing Mobile Offline Profile may now be missing those tables/columns. Because Phase 5 invoked `/add-dataverse` with `--skip-planning` (which suppresses that skill's own Step 8.5 reconciliation), this orchestrator owns the check. Skip when Phase 2 chose Path C (no Dataverse).++Run the local, no-network delta check:++```bash+node "${CLAUDE_SKILL_DIR}/../../scripts/offline-profile-delta.js"+```++Branch on the JSON `status` per [offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md): `no-manifest` / `no-profile` / `in-sync` → continue to Phase 7 silently (do not nag when no profile exists); `delta` → prompt to update, then invoke `/add-table-to-offline-profile` (for `missingTables[]`) and `/edit-offline-profile --table <t> --columns add:<newColumns>` (for `tablesWithNewColumns[]`), and re-check to `in-sync`.+### Phase 7 — Summary```@@ -188,5 +200,6 @@ Next steps:## Reference- [shared/references/connector-planning.md](${CLAUDE_SKILL_DIR}/../../shared/references/connector-planning.md) — connector inference + confirmation logic+- [shared/references/offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md) — Phase 6.5 offline delta check + reconciliation flow- [skills/add-dataverse/SKILL.md](../add-dataverse/SKILL.md) — full data model execution workflow- [agents/data-model-architect.md](../../agents/data-model-architect.md) — read-only architect agentdiff --git a/plugins/mobile-apps/skills/setup-offline-profile/SKILL.md b/plugins/mobile-apps/skills/setup-offline-profile/SKILL.mdindex dbe40949c..99eedefc1 100644--- a/plugins/mobile-apps/skills/setup-offline-profile/SKILL.md+++ b/plugins/mobile-apps/skills/setup-offline-profile/SKILL.md@@ -12,6 +12,7 @@ model: opus- [offline-profile-schema.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-schema.md) — Dataverse entity field map- [dataverse-offline-api.md](${CLAUDE_SKILL_DIR}/../../shared/references/dataverse-offline-api.md) — Web API recipes for profile / item / association POSTs+- [offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md) — the `schemaColumns` baseline this skill writes + the lifecycle delta check that consumes it# Setup Offline Profile@@ -542,6 +543,7 @@ After confirmed success, re-GET the profile and check `publishedon` for the arti"recordsOwnedByMyBusinessUnit": false,"syncIntervalInMinutes": 10,"selectedColumns": ["cr123_ordernumber", "cr123_total", "..."],+ "schemaColumns": ["cr123_ordernumber", "cr123_total", "cr123_notes", "..."],"relationships": [{"schemaName": "cr123_order_cr123_orderline",@@ -561,6 +563,7 @@ After confirmed success, re-GET the profile and check `publishedon` for the arti- `relationships[]` lives on the **PARENT** table entry (the table on the 1-side of the 1:N relationship). Pure-child tables (e.g. `cr123_orderline`) have empty `relationships: []`.- Each `relationships[]` entry has `schemaName` (the relationship's `SchemaName` from EntityDefinitions metadata), `relationshipId` (the relationship's `MetadataId` GUID — **this is the canonical comparison key**, stable across server-side relationshipname formatting), `targetEntity` (child entity logical name), and `associationId` (the created `mobileofflineprofileitemassociationid`).- `recordDistributionCriteria=1` (All records) parents always have `relationships: []` — associations would be redundant (see architect Step 5 pruning rule).+- `schemaColumns[]` is the **schema-reconciliation baseline** — the full set of the table's schema column logical names (from `.datamodel-manifest.json`) that existed when this item was created. It is NOT the same as `selectedColumns` (which is a curated subset the runtime syncs): `schemaColumns` records everything the schema had at reconciliation time, including columns deliberately left out of `selectedColumns`. `scripts/offline-profile-delta.js` compares later manifest columns against this baseline to detect *genuinely new* schema columns (`manifest.columns − schemaColumns`) without false-flagging deliberate exclusions. Populate it from the manifest entry for each table; if the manifest lists no columns for a reused table, write `[]`. See [offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md).- JSON doesn't support comments — the `/* BEGIN/END OFFLINE-CONFIG-WORKAROUND */` keys above are illustrative bracketing for the SKILL author. **Do NOT write those literal keys to `offline-profile.json`.** When the skill actually patches the file, emit only the real fields (`useDda`, `entitiesIncluded`, `instanceUrl`) inside `appConfig` and keep them contiguous.Example node script (writes the file in one shot — no read-modify-write against `power.config.json`):