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
Initial commit
Priyanshu Agrawal69e10edb853a
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonnew file mode 100644index 000000000..1f666ff4b--- /dev/null+++ b/.claude-plugin/plugin.json@@ -0,0 +1,24 @@+{+ "name": "power-pages",+ "version": "1.0.0",+ "description": "Create and deploy Power Pages sites using modern development approaches. Supports code sites (SPAs) with React, Angular, Vue, or Astro, with more site types coming soon.",+ "author": {+ "name": "Microsoft",+ "url": "https://www.microsoft.com"+ },+ "homepage": "https://learn.microsoft.com/power-pages/configure/create-code-sites",+ "repository": "https://github.com/microsoft/power-pages-claude-plugin",+ "license": "MIT",+ "keywords": [+ "power-pages",+ "site-builder",+ "code-sites",+ "spa",+ "react",+ "angular",+ "vue",+ "astro",+ "pac-cli",+ "dataverse"+ ]+}diff --git a/README.md b/README.mdindex ad2e7beec..87f122599 100644--- a/README.md+++ b/README.md@@ -1,14 +1,96 @@-# Project+# Power Pages Site Builder Plugin (v3)-> This repo has been populated by an initial template to help get you started. Please-> make sure to update the content to build a great experience for community-building.+Create and deploy Power Pages sites using modern development approaches.-As the maintainer of this project, please make a few updates:+**Currently supported**: Code Sites (SPAs) with React, Angular, Vue, or Astro+**Coming soon**: Standard sites, Enhanced data model sites, Templates-- Improving this README.MD file to provide a great experience-- Updating SUPPORT.MD with content about this project's support experience-- Understanding the security reporting process in SECURITY.MD-- Remove this section from the README+## Overview++This plugin enables makers to:++1. **Create** a Power Pages code site using their preferred frontend framework+2. **Design** production-grade UI with the frontend-design skill+3. **Upload** the site to Power Pages using PAC CLI+4. **Activate** the website via Power Pages REST API+5. **Verify** deployment and get the live URL++## Quick Start++Run the skill:+```+/create-code-site+```++The skill will guide you through:+- Choosing a frontend framework (React, Angular, Vue, Astro)+- Defining site features and design preferences+- Building and deploying the site++## Prerequisites++- **PAC CLI** (v1.44+) installed and authenticated+- **Azure CLI** installed for API authentication+- **Node.js** (v18+) for building frontend projects+- Power Pages environment with admin privileges++## Workflow++```+┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐+│ 1. Design │ ──▶ │ 2. Build │ ──▶ │ 3. Upload │ ──▶ │ 4. Activate │+│ & Create │ │ Project │ │ (Inactive) │ │ (Go Live) │+└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘+```++## Available Skills++| Skill | Description |+|-------|-------------|+| `create-code-site` | Full workflow to create, upload, and activate a Power Pages code site |++## Supported Frameworks++| Framework | Recommended For | Build Output |+|-----------|-----------------|--------------|+| **React** (Recommended) | Complex interactive UIs | `/build` |+| **Angular** | Enterprise applications | `/dist/<project>` |+| **Vue** | Balanced simplicity/power | `/dist` |+| **Astro** | Content-focused sites | `/dist` |++## Key Commands++### PAC CLI - Upload Code Site+```bash+pac pages upload-code-site \+ --rootPath "./my-site" \+ --compiledPath "./build" \+ --siteName "My Site"+```++### Power Pages API - Activate Website+```+POST https://api.powerplatform.com/powerpages/environments/{envId}/websites+```++### Power Pages API - Check Status+```+GET https://api.powerplatform.com/powerpages/environments/{envId}/websites+```++## Next Steps After Deployment++After your site is live, consider:++1. **Web API Integration** - Connect to Dataverse data+2. **Authentication** - Enable Microsoft Entra ID sign-in+3. **Table Permissions** - Configure data access security++## Documentation++- [Power Pages Code Sites](https://learn.microsoft.com/en-us/power-pages/configure/create-code-sites)+- [Power Pages REST API](https://learn.microsoft.com/en-us/rest/api/power-platform/powerpages/websites)+- [PAC CLI Reference](https://learn.microsoft.com/en-us/power-platform/developer/cli/reference/pages)## Contributing@@ -31,3 +113,4 @@ trademarks or logos is subject to and must follow[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/legal/intellectualproperty/trademarks/usage/general).Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.Any use of third-party trademarks or logos are subject to those third-party's policies.+diff --git a/agents/code-site-architect.md b/agents/code-site-architect.mdnew file mode 100644index 000000000..6bd6430eb--- /dev/null+++ b/agents/code-site-architect.md@@ -0,0 +1,100 @@+# Code Site Architect++You are a Power Pages Code Site Architect with deep expertise in building Single Page Applications (SPAs) for Power Pages deployment.++## Your Expertise++- **Frontend Frameworks**: React, Angular, Vue, Astro - understanding their strengths and trade-offs for Power Pages+- **Power Pages Integration**: How SPAs integrate with Power Pages infrastructure, authentication, and Web API+- **Build Optimization**: Creating production-ready builds optimized for Power Pages hosting+- **Security**: Client-side security considerations, CORS, authentication flows with Microsoft Entra ID++## Your Role++When consulted, you provide guidance on:++1. **Framework Selection**: Help makers choose the right framework based on their requirements+2. **Architecture Decisions**: Component structure, state management, routing strategies+3. **Power Pages Compatibility**: Ensure the site will work correctly when deployed to Power Pages+4. **Performance**: Bundle optimization, lazy loading, caching strategies+5. **Authentication Integration**: How to integrate Microsoft Entra ID authentication in SPAs++## Key Considerations for Power Pages Code Sites++### Framework-Specific Guidance++**React**++- Use Vite or Create React App for project setup+- Build output goes to `/build` or `/dist`+- React Router for client-side routing+- Consider React Query for Web API data fetching++**Angular**++- Use Angular CLI for project setup+- Build output goes to `/dist/<project-name>`+- Angular Router with hash-based routing recommended+- HttpClient for Web API integration++**Vue**++- Use Vite or Vue CLI for project setup+- Build output goes to `/dist`+- Vue Router for navigation+- Pinia or Vuex for state management++**Astro**++- Ideal for content-heavy sites with minimal interactivity+- Supports partial hydration for interactive islands+- Build output goes to `/dist`+- Can integrate React/Vue/Svelte components++### Power Pages Specific Requirements++1. **Client-side rendering only** - No server-side rendering support+2. **Static assets** - All assets must be bundled or reference external CDNs+3. **Authentication** - Use `window["Microsoft"].Dynamic365.Portal.User` for user context+4. **Web API** - Use `/_api/` endpoints for Dataverse access+5. **CORS** - Configure proxy during development for API calls++### Authentication Pattern++```javascript+// Check if user is authenticated+const user = window["Microsoft"]?.Dynamic365?.Portal?.User;+const isAuthenticated = user?.userName !== "";++// Get user details+const userInfo = {+ userName: user?.userName,+ firstName: user?.firstName,+ lastName: user?.lastName,+ email: user?.email+};+```++### Web API Integration Pattern++```javascript+// Fetch data from Dataverse via Power Pages Web API+const fetchAccounts = async () => {+ const response = await fetch('/_api/accounts?$select=name,accountnumber&$top=10', {+ headers: {+ 'Accept': 'application/json',+ 'OData-MaxVersion': '4.0',+ 'OData-Version': '4.0'+ }+ });+ return response.json();+};+```++## Response Style++- Be direct and practical+- Provide code examples when helpful+- Always consider Power Pages constraints+- Suggest the simplest solution that meets requirements+- Warn about common pitfalls specific to Power Pagesdiff --git a/commands/create-site.md b/commands/create-site.mdnew file mode 100644index 000000000..ad865d69d--- /dev/null+++ b/commands/create-site.md@@ -0,0 +1,12 @@+# Create Power Pages Code Site++Read and follow the instructions in `${CLAUDE_PLUGIN_ROOT}/skills/create-site/SKILL.md` to guide the user through creating a Power Pages code site.++**Important**:++- Do not summarize the skill - execute it step by step+- Start by gathering requirements in STEP 1 (ask what they want to build)+- Check prerequisites (PAC CLI and Azure CLI) in STEP 3 before uploading+- Use the AskUserQuestion tool for gathering requirements+- Use the frontend-design skill when creating the site+- Execute all PAC CLI and API commands as specifieddiff --git a/skills/create-site/SKILL.md b/skills/create-site/SKILL.mdnew file mode 100644index 000000000..270c0cf61--- /dev/null+++ b/skills/create-site/SKILL.md@@ -0,0 +1,402 @@+---+description: Create a Power Pages code site (SPA) using modern frontend frameworks like React, Angular, Vue, or Astro. Guides through design, build, upload, and activation.+user-invocable: true+allowed-tools: Bash(pac:*), Bash(az:*)+model: opus+---++# Create Power Pages Code Site++This skill guides makers through creating a complete Power Pages code site (Single Page Application) from scratch, deploying it to Power Pages, and activating it for public access.++## Workflow Overview++```text+┌─────────────────────────────────────────────────────────────────────────────┐+│ STEP 1: Gather Requirements │+│ ───────────────────────────────────────────────────────────────────────── │+│ • Frontend framework selection (React, Angular, Vue, Astro) │+│ • Site features and functionality │+│ • Design preferences and style │+└─────────────────────────────────────────────────────────────────────────────┘+ ↓+┌─────────────────────────────────────────────────────────────────────────────┐+│ STEP 2: Create the Site │+│ ───────────────────────────────────────────────────────────────────────── │+│ • Use frontend-design skill to build production-grade UI │+│ • Generate complete SPA with chosen framework │+│ • Build the project for production │+└─────────────────────────────────────────────────────────────────────────────┘+ ↓+┌─────────────────────────────────────────────────────────────────────────────┐+│ STEP 3: Check Prerequisites │+│ ───────────────────────────────────────────────────────────────────────── │+│ • Verify PAC CLI is installed (install if missing) │+│ • Verify Azure CLI is installed (install if missing) │+│ • Ensure authentication is configured │+└─────────────────────────────────────────────────────────────────────────────┘+ ↓+┌─────────────────────────────────────────────────────────────────────────────┐+│ STEP 4: Upload to Power Pages (Inactive) │+│ ───────────────────────────────────────────────────────────────────────── │+│ • Use PAC CLI: pac pages upload-code-site │+│ • Site uploaded in INACTIVE mode │+│ • Get websiteRecordId for activation │+└─────────────────────────────────────────────────────────────────────────────┘+ ↓+┌─────────────────────────────────────────────────────────────────────────────┐+│ STEP 5: Preview Locally │+│ ───────────────────────────────────────────────────────────────────────── │+│ • Run the app locally to verify it works │+│ • Test all features before activation │+└─────────────────────────────────────────────────────────────────────────────┘+ ↓+┌─────────────────────────────────────────────────────────────────────────────┐+│ STEP 6: Activate Website Manually │+│ ───────────────────────────────────────────────────────────────────────── │+│ • Go to Power Pages home page → Inactive sites │+│ • Click Reactivate on your site │+│ • Configure name and web address → Done │+└─────────────────────────────────────────────────────────────────────────────┘+```++---++## STEP 1: Gather Requirements++**IMPORTANT**: Before creating anything, you MUST ask the maker the following questions using the AskUserQuestion tool.++### Question 1: What do you want to build?++If the user has not already specified what they want to build, ask them to describe their site:++- What is the purpose of the site? (e.g., company portal, customer self-service, employee directory, event registration)+- What key functionality do they need?+- Who is the target audience?++This helps inform framework selection and feature recommendations.++### Question 2: Frontend Framework++Based on what they want to build, ask the maker which frontend framework they want to use:++| Option | Description |+|--------|-------------|+| **React (Recommended)** | Most popular choice with excellent ecosystem. Best for complex interactive UIs. |+| **Angular** | Full-featured framework by Google. Great for enterprise applications with built-in state management. |+| **Vue** | Progressive framework, easy to learn. Good balance of simplicity and power. |+| **Astro** | Modern static site generator with partial hydration. Best for content-focused sites with minimal JS. |++### Question 3: Site Features++Ask what features the maker wants in their site. Common options:++- Landing page / Hero section+- Navigation menu+- Contact form+- About page+- Services/Products showcase+- Image gallery+- Blog/News section+- User authentication (Microsoft Entra ID)+- Data display from Dataverse (Web API)++### Question 4: Design Preferences++Ask about design preferences:++- **Style**: Modern/Minimalist, Corporate/Professional, Creative/Bold, Elegant/Luxury+- **Color scheme**: Let them specify or suggest based on their brand+- **Special requirements**: Accessibility, mobile-first, specific branding guidelines++---++## STEP 2: Create the Site++After gathering requirements, use the **frontend-design skill** to create the site.++### Instructions for Site Creation++1. **Invoke the frontend-design skill** with the gathered requirements+2. The skill will create a production-grade, distinctive UI+3. Ensure the project structure follows Power Pages code site requirements++### Required Project Structure++```text+/site-project+├── src/ # Source code+├── public/ # Static assets+├── build/ or dist/ # Compiled output (after build)+├── package.json # Dependencies+├── powerpages.config.json # Power Pages configuration (create this)+└── README.md+```++### Create powerpages.config.json++After the site is created, add this configuration file:++```json+{+ "siteName": "<SITE_NAME>",+ "defaultLandingPage": "index.html",+ "compiledPath": "./build"+}+```++For Vue/Astro projects, change `compiledPath` to `"./dist"`.++### Build the Project++Run the appropriate build command:++```bash+# React (Create React App or Vite)+npm run build++# Angular+ng build --configuration production++# Vue+npm run build++# Astro+npm run build+```++---++## STEP 3: Check Prerequisites++**IMPORTANT**: Before uploading, verify that all required CLI tools are installed on the user's machine.++### Check PAC CLI++Run the following command to check if PAC CLI is installed:++```powershell+pac help+```++**If the command fails or PAC CLI is not found**, install it using .NET tool:++```powershell+dotnet tool install --global Microsoft.PowerApps.CLI.Tool+```++If installation fails, guide the user based on the error.++After installation, verify it works:++```powershell+pac help+```++### Check Azure CLI++Run the following command to check if Azure CLI is installed:++```powershell+az --version+```++**If the command fails or Azure CLI is not found**, install it using winget:++```powershell+winget install -e --id Microsoft.AzureCLI+```++After installation, the user may need to restart their terminal. Then verify it works:++```powershell+az --version+```++### Verify Authentication++Once both CLIs are installed, ensure the user is authenticated:++```powershell+# Check PAC CLI authentication+pac auth list++# If not authenticated, prompt user to authenticate+pac auth create++# Check Azure CLI authentication+az account show++# If not authenticated, prompt user to login+az login+```++### Verify Environment Connection++```powershell+pac org who+```++---++## STEP 4: Upload to Power Pages (Inactive)++### Upload Command++```powershell+pac pages upload-code-site `+ --rootPath "<PROJECT_ROOT_PATH>" `+```++**Example:**++```powershell+pac pages upload-code-site `+ --rootPath "C:\repos\my-power-pages-site" `+```++### Get Website Record ID++After upload, list sites to get the websiteRecordId:++```powershell+pac pages list --verbose+```++Note the **Website ID** (GUID) - this is needed for activation.++---++## STEP 5: Preview Locally++Before activating the site, run it locally to verify everything works correctly.++### Run the Development Server++```powershell+# React (Vite)+npm run dev++# React (Create React App)+npm start++# Angular+ng serve++# Vue+npm run dev++# Astro+npm run dev+```++### Verify the Site++1. Open the local URL (usually `http://localhost:5173` or `http://localhost:3000`)+2. Test all pages and navigation+3. Verify forms and interactive elements work+4. Check responsive design on different screen sizes++Once you're satisfied with the local preview, proceed to activate the site.++---++## STEP 6: Activate Website Manually++After uploading, your site appears as **Inactive** in Power Pages. Follow these steps to activate it manually.++### Steps to Activate++1. **Go to Power Pages home page**+ - Navigate to [make.powerpages.microsoft.com](https://make.powerpages.microsoft.com)+ - Select your environment++2. **Find your inactive site**+ - Click on **Inactive sites** in the left navigation+ - Your uploaded site will appear in the list++3. **Reactivate the site**+ - Click the **Reactivate** button next to your site++4. **Configure site details**+ - **Website name**: Enter or confirm the display name+ - **Web address**: Choose a subdomain (e.g., `my-site` → `my-site.powerappsportals.com`)+ - Click **Done**++5. **Wait for provisioning**+ - The site will take a few minutes to provision+ - Once complete, it will appear in **Active sites**++### Verify Activation++```powershell+pac pages list --verbose+```++Your site should now show as **Active** with a URL.++**Reference**: [Reactivate a website - Microsoft Learn](https://learn.microsoft.com/en-us/power-pages/admin/reactivate-website)++---++## Next Steps++After the site is active, suggest the maker proceed with:++### Web API Integration++> **Recommended Next Step**: Implement Web API to connect your site to Dataverse data.+>+> This will allow your site to:+>+> - Read and display data from Dataverse tables+> - Create, update, and delete records+> - Implement user-specific data views+>+> Use the **configure-web-api** skill to set this up.++### Additional Enhancements++- **Authentication**: Set up Microsoft Entra ID for user sign-in+- **Table Permissions**: Configure entity permissions for data access+- **Custom styling**: Further refine the design+- **Performance optimization**: Enable caching and CDN++---++## Troubleshooting++### Upload Fails with JavaScript Error++Enable JavaScript file uploads:++1. Go to Power Platform admin center+2. Navigate to Environments → [Your Environment] → Settings+3. Go to Product → Privacy + Security+4. In "Blocked Attachments", remove `js` from the list+5. Save changes++### Site Shows as Inactive After Upload++This is expected. The upload creates an INACTIVE record. Follow STEP 6 to manually activate it via the Power Pages home page.++### Site Not Appearing in Inactive Sites++- Verify the upload completed successfully+- Check you're in the correct environment+- Run `pac pages list --verbose` to confirm the site exists++### Reactivation Fails++Ensure your user has appropriate permissions:++- System Administrator or System Customizer role in the environment+- Power Pages administrator access++---++## Reference Documentation++- [Create Code Sites in Power Pages](https://learn.microsoft.com/en-us/power-pages/configure/create-code-sites)+- [Reactivate a Website](https://learn.microsoft.com/en-us/power-pages/admin/reactivate-website)+- [PAC CLI Reference](https://learn.microsoft.com/en-us/power-platform/developer/cli/reference/pages)