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
Fix/model apps update check (#409)
Tony Nguyen625e2feddbbb
diff --git a/plugins/model-apps/.claude-plugin/plugin.json b/plugins/model-apps/.claude-plugin/plugin.jsonindex 841160428..3d3125105 100644--- a/plugins/model-apps/.claude-plugin/plugin.json+++ b/plugins/model-apps/.claude-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "model-apps",- "version": "2.4.3",+ "version": "2.4.4","description": "Build model-driven Power Apps end to end: /app-builder authors whole apps (tables, relationships, forms, views, charts, security roles, app + sitemap) from a natural-language intent, and /genpage builds generative pages with specialist agents for planning, entity creation, and parallel code generation. Requires PAC CLI > 2.10.0 and Azure CLI (`az`). See CHANGELOG.md for v1.x -> v2.x migration.","author": {"name": "Microsoft",diff --git a/plugins/model-apps/.plugin/plugin.json b/plugins/model-apps/.plugin/plugin.jsonindex 841160428..3d3125105 100644--- a/plugins/model-apps/.plugin/plugin.json+++ b/plugins/model-apps/.plugin/plugin.json@@ -1,6 +1,6 @@{"name": "model-apps",- "version": "2.4.3",+ "version": "2.4.4","description": "Build model-driven Power Apps end to end: /app-builder authors whole apps (tables, relationships, forms, views, charts, security roles, app + sitemap) from a natural-language intent, and /genpage builds generative pages with specialist agents for planning, entity creation, and parallel code generation. Requires PAC CLI > 2.10.0 and Azure CLI (`az`). See CHANGELOG.md for v1.x -> v2.x migration.","author": {"name": "Microsoft",diff --git a/plugins/model-apps/AGENTS.md b/plugins/model-apps/AGENTS.mdindex 672ac23b9..e178d5c46 100644--- a/plugins/model-apps/AGENTS.md+++ b/plugins/model-apps/AGENTS.md@@ -687,6 +687,9 @@ repo-root `shared/telemetry/`; `scripts/lib/telemetry/lib` is a **physical copy*- Write descriptions in third person ("Creates X" not "This skill guides you through creating X")- Use progressive disclosure: SKILL.md for workflow, reference files for details- Link to references inline: `See [troubleshooting.md](../../references/troubleshooting.md)`+- Immediately after the frontmatter of every user-invocable skill, run+ `node "${PLUGIN_ROOT}/scripts/check-version.js"` and show any output before+ proceeding. The check is best-effort and must never block skill execution.## Building & Testingdiff --git a/plugins/model-apps/CHANGELOG.md b/plugins/model-apps/CHANGELOG.mdindex 4355ffd6b..8d6bc2e75 100644--- a/plugins/model-apps/CHANGELOG.md+++ b/plugins/model-apps/CHANGELOG.md@@ -2,9 +2,16 @@All notable changes to the **model-apps** plugin.-## [Unreleased] — 2.4.3+## [Unreleased] — 2.4.4-Fixes four crash paths and a smoke-eval assertion that could never pass live.+Adds plugin update notices, fixes four crash paths, and corrects a smoke-eval+assertion that could never pass live.++### Added+- **Automatic plugin update notice.** Every user-invocable skill now runs the+ non-blocking `scripts/check-version.js` preflight, which compares the installed+ Model Apps version with `origin/main` and shows update commands for the active+ GitHub Copilot CLI or Claude Code host when a newer version is available.### Fixed- **Malformed specs now produce validation errors instead of raw `TypeError`s.** `validateAppSpec()`diff --git a/plugins/model-apps/scripts/check-version.js b/plugins/model-apps/scripts/check-version.jsnew file mode 100644index 000000000..a500031a8--- /dev/null+++ b/plugins/model-apps/scripts/check-version.js@@ -0,0 +1,137 @@+#!/usr/bin/env node++/**+ * Plugin version check. Compares the local plugin manifest version against+ * origin/main and prints an update notice if the remote version is newer.+ * Exits silently if versions match or on any error.+ *+ * Usage: node check-version.js+ * Functions are also exported for testing.+ */++const { execFileSync, execSync } = require('child_process');+const path = require('path');+const fs = require('fs');++const MARKETPLACE_PATHS = [+ 'marketplace.json',+ '.plugin/marketplace.json',+ '.claude-plugin/marketplace.json',+];+const PLUGIN_MANIFEST_PATHS = [+ '.plugin/plugin.json',+ '.claude-plugin/plugin.json',+];++function compareSemver(localVersion, remoteVersion) {+ const localParts = localVersion.split('.').map(Number);+ const remoteParts = remoteVersion.split('.').map(Number);+ for (let index = 0; index < 3; index++) {+ if ((remoteParts[index] || 0) > (localParts[index] || 0)) return 1;+ if ((remoteParts[index] || 0) < (localParts[index] || 0)) return -1;+ }+ return 0;+}++function detectHost(env = process.env) {+ return env.COPILOT_CLI === '1' ? 'copilot' : 'claude';+}++function formatUpdateMessage(+ pluginName,+ localVersion,+ remoteVersion,+ marketplaceName,+ host = detectHost()+) {+ const qualifiedName = marketplaceName ? `${pluginName}@${marketplaceName}` : pluginName;+ let message = `\nPlugin update available: ${pluginName} ${localVersion} -> ${remoteVersion}.\n`;+ if (marketplaceName) {+ message += `Run:\n ${host} plugin marketplace update ${marketplaceName}\n ${host} plugin update ${qualifiedName}`;+ } else {+ message += `Run: ${host} plugin update ${qualifiedName}`;+ }+ return message;+}++function firstExistingPath(root, relativePaths) {+ for (const relativePath of relativePaths) {+ const filePath = path.join(root, relativePath);+ if (fs.existsSync(filePath)) return filePath;+ }+ return null;+}++function readFirstJson(root, relativePaths) {+ const filePath = firstExistingPath(root, relativePaths);+ if (!filePath) return null;+ return JSON.parse(fs.readFileSync(filePath, 'utf8'));+}++function readMarketplaceName(gitRoot) {+ const marketplace = readFirstJson(gitRoot, MARKETPLACE_PATHS);+ return marketplace?.name || null;+}++function readJsonFromGit(ref, relativePaths) {+ for (const relativePath of relativePaths) {+ try {+ const content = execFileSync('git', ['show', `${ref}:${relativePath}`], {+ encoding: 'utf8',+ timeout: 5000,+ stdio: ['pipe', 'pipe', 'pipe'],+ });+ return JSON.parse(content);+ } catch {+ // Open Plugins and legacy installs use different manifest paths.+ }+ }+ return null;+}++module.exports = { compareSemver, detectHost, formatUpdateMessage, readMarketplaceName };++if (require.main === module) {+ try {+ const pluginRoot = path.resolve(__dirname, '..');+ const pluginJsonPath = firstExistingPath(pluginRoot, PLUGIN_MANIFEST_PATHS);+ if (!pluginJsonPath) process.exit(0);++ const localPlugin = JSON.parse(fs.readFileSync(pluginJsonPath, 'utf8'));+ const localVersion = localPlugin.version;+ if (!localVersion) process.exit(0);++ const gitRoot = execSync('git rev-parse --show-toplevel', {+ encoding: 'utf8',+ timeout: 5000,+ stdio: ['pipe', 'pipe', 'pipe'],+ }).trim();++ const remoteManifestPaths = PLUGIN_MANIFEST_PATHS.map((manifestPath) =>+ path.relative(gitRoot, path.join(pluginRoot, manifestPath)).replace(/\\/g, '/')+ );++ try {+ execSync('git fetch origin main --quiet', {+ encoding: 'utf8',+ timeout: 10000,+ stdio: ['pipe', 'pipe', 'pipe'],+ });+ } catch {+ // A cached origin/main is sufficient when the network is unavailable.+ }++ const remotePlugin = readJsonFromGit('origin/main', remoteManifestPaths);+ if (!remotePlugin?.version) process.exit(0);++ if (compareSemver(localVersion, remotePlugin.version) > 0) {+ const pluginName = localPlugin.name || 'model-apps';+ const marketplaceName = readMarketplaceName(gitRoot);+ console.log(+ formatUpdateMessage(pluginName, localVersion, remotePlugin.version, marketplaceName)+ );+ }+ } catch {+ // Version checks must never block skill execution.+ }+}diff --git a/plugins/model-apps/scripts/tests/check-version.test.js b/plugins/model-apps/scripts/tests/check-version.test.jsnew file mode 100644index 000000000..bdb2c9cdf--- /dev/null+++ b/plugins/model-apps/scripts/tests/check-version.test.js@@ -0,0 +1,85 @@+const test = require('node:test');+const assert = require('node:assert/strict');+const fs = require('node:fs');+const os = require('node:os');+const path = require('node:path');++const {+ compareSemver,+ detectHost,+ formatUpdateMessage,+ readMarketplaceName,+} = require('../check-version');++test('compareSemver compares major, minor, and patch versions', () => {+ assert.equal(compareSemver('1.2.0', '1.2.0'), 0);+ assert.equal(compareSemver('1.2', '1.2.0'), 0);+ assert.equal(compareSemver('1.2.0', '2.0.0'), 1);+ assert.equal(compareSemver('1.2.0', '1.3.0'), 1);+ assert.equal(compareSemver('1.2.0', '1.2.1'), 1);+ assert.equal(compareSemver('2.0.0', '1.9.9'), -1);+});++test('detectHost recognizes GitHub Copilot CLI', () => {+ assert.equal(detectHost({ COPILOT_CLI: '1' }), 'copilot');+ assert.equal(detectHost({}), 'claude');+});++test('formatUpdateMessage emits Copilot update commands', () => {+ const message = formatUpdateMessage(+ 'model-apps',+ '2.4.3',+ '2.4.4',+ 'power-platform-skills',+ 'copilot'+ );++ assert.match(message, /model-apps 2\.4\.3 -> 2\.4\.4/);+ assert.match(message, /copilot plugin marketplace update power-platform-skills/);+ assert.match(message, /copilot plugin update model-apps@power-platform-skills/);+ assert.ok(message.indexOf('marketplace update') < message.indexOf('plugin update model-apps@'));+});++test('formatUpdateMessage emits Claude update commands', () => {+ const message = formatUpdateMessage(+ 'model-apps',+ '2.4.3',+ '2.4.4',+ 'power-platform-skills',+ 'claude'+ );++ assert.match(message, /claude plugin marketplace update power-platform-skills/);+ assert.match(message, /claude plugin update model-apps@power-platform-skills/);+});++test('formatUpdateMessage uses the plain plugin name without a marketplace', () => {+ const message = formatUpdateMessage('model-apps', '2.4.3', '2.4.4', null, 'copilot');++ assert.match(message, /copilot plugin update model-apps/);+ assert.doesNotMatch(message, /marketplace update/);+ assert.doesNotMatch(message, /@/);+});++test('readMarketplaceName reads the repository marketplace', () => {+ const { execSync } = require('node:child_process');+ const gitRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf8' }).trim();++ assert.equal(readMarketplaceName(gitRoot), 'power-platform-skills');+});++test('readMarketplaceName falls back to the legacy marketplace path', () => {+ const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'model-apps-version-'));+ fs.mkdirSync(path.join(tempDir, '.claude-plugin'));+ fs.writeFileSync(+ path.join(tempDir, '.claude-plugin', 'marketplace.json'),+ JSON.stringify({ name: 'legacy-marketplace' })+ );++ assert.equal(readMarketplaceName(tempDir), 'legacy-marketplace');+});++test('readMarketplaceName returns null when no marketplace exists', () => {+ const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'model-apps-version-'));+ assert.equal(readMarketplaceName(tempDir), null);+});diff --git a/plugins/model-apps/skills/app-builder/SKILL.md b/plugins/model-apps/skills/app-builder/SKILL.mdindex a423143ad..d220f34ef 100644--- a/plugins/model-apps/skills/app-builder/SKILL.md+++ b/plugins/model-apps/skills/app-builder/SKILL.md@@ -1,6 +1,6 @@---name: app-builder-version: 0.8.0+version: 0.8.1description: (Preview) Builds and edits a model-driven Power Apps app from a natural-language intent — tables, columns, relationships, adaptive forms with sub-grids, views, Choice-column charts, generative page intents for overview/dashboard surfaces (page `.tsx` generated in generate-pages after plan approval), and an app module + sitemap — via the headless cds-maker-sdk. Runs an interactive, multi-turn authoring flow (env selection, jobs-to-be-done first, then design-only App Spec authoring across confirmed levels, guardrail lint, plan-mode approval, generate-pages, full build) and a narrated build, and can download a deployed app back into an editable spec to change it. Use when the user says "build an app for X", "create a model-driven app", "make me an app to manage Y", or "edit/add to my app". This skill stands alone and does not require /genpage — but for a standalone generative page added to an app that already exists, use /genpage instead.author: Microsoft Corporationargument-hint: "<app description>"@@ -8,6 +8,8 @@ user-invocable: trueallowed-tools: Read, Write, Edit, Bash, Glob, Grep, Task, AskUserQuestion, EnterPlanMode, ExitPlanMode, TaskCreate, TaskUpdate, TaskList---+> **Plugin check**: Run `node "${PLUGIN_ROOT}/scripts/check-version.js"` — if it outputs a message, show it to the user before proceeding.+# app-builder — intent → model-driven app> ⚠️ **Preview.** This skill is in preview — its App Spec shape, flags, and build behavior may changediff --git a/plugins/model-apps/skills/genpage/SKILL.md b/plugins/model-apps/skills/genpage/SKILL.mdindex 10119c917..f73f41455 100644--- a/plugins/model-apps/skills/genpage/SKILL.md+++ b/plugins/model-apps/skills/genpage/SKILL.md@@ -1,6 +1,6 @@---name: genpage-version: 2.3.0+version: 2.3.1description: Creates, updates, and deploys Power Apps generative pages for model-driven apps using React v17, TypeScript, and Fluent UI V9. Orchestrates specialist agents for planning, entity creation, and code generation. Use it when user asks to build, retrieve, or update a page in an existing Microsoft Power Apps model-driven app. Use it when user mentions "generative page", "page in a model-driven", or "genux". This skill stands alone and does not require /app-builder — but if the user wants a whole app built (tables, forms, views, sitemap) rather than pages for an app that already exists, use /app-builder instead.author: Microsoft Corporationargument-hint: "<page description> | edit"@@ -9,6 +9,8 @@ model: sonnetallowed-tools: Read, Write, Edit, Bash, Glob, Grep, WebFetch, Task, AskUserQuestion, TaskCreate, TaskUpdate, TaskList---+> **Plugin check**: Run `node "${PLUGIN_ROOT}/scripts/check-version.js"` — if it outputs a message, show it to the user before proceeding.+# Power Apps Generative Pages Builder**Triggers:** genpage, generative page, create genpage, genux page, build genux, power apps page, model pagediff --git a/plugins/model-apps/skills/report-issue/SKILL.md b/plugins/model-apps/skills/report-issue/SKILL.mdindex 169e8dc03..f833ee21d 100644--- a/plugins/model-apps/skills/report-issue/SKILL.md+++ b/plugins/model-apps/skills/report-issue/SKILL.md@@ -10,4 +10,6 @@ allowed-tools: Read, Bash, Glob, Grep, AskUserQuestion, TaskCreate, TaskUpdate,model: sonnet---+> **Plugin check**: Run `node "${PLUGIN_ROOT}/scripts/check-version.js"` — if it outputs a message, show it to the user before proceeding.+**Workflow: [report-issue-workflow.md](${PLUGIN_ROOT}/skills/report-issue/report-issue-workflow.md)** — Read and follow all phases defined in that bundled file.diff --git a/plugins/model-apps/skills/telemetry/SKILL.md b/plugins/model-apps/skills/telemetry/SKILL.mdindex 65b201269..f33e2cbab 100644--- a/plugins/model-apps/skills/telemetry/SKILL.md+++ b/plugins/model-apps/skills/telemetry/SKILL.md@@ -11,4 +11,6 @@ allowed-tools: Bashmodel: haiku---+> **Plugin check**: Run `node "${PLUGIN_ROOT}/scripts/check-version.js"` — if it outputs a message, show it to the user before proceeding.+**Workflow: [telemetry-workflow.md](${PLUGIN_ROOT}/skills/telemetry/telemetry-workflow.md)** — Read and follow all steps defined in that bundled file.