5 added, 13 removed. Audit A to A.
---
name: deploy
description: Builds and deploys a Power Apps code app to Power Platform. Use when deploying changes, redeploying an existing app, or pushing updates.
user-invocable: true
allowed-tools: Read, Edit, Write, Grep, Glob, Bash
model: sonnet
---
**๐ Shared Instructions: [shared-instructions.md](${CLAUDE_PLUGIN_ROOT}/shared/shared-instructions.md)** - Cross-cutting concerns.
# Deploy
Builds and deploys the app in the current directory to Power Platform.
## Workflow
1. Check Memory Bank โ 2. Build โ 3. Deploy โ 4. Update Memory Bank
---
### Step 1: Check Memory Bank
Check for `memory-bank.md` in the project root. If found, read it for the project name and environment. If not found, proceed โ the project may have been created without the plugin.
### Step 2: Build
- ```powershell
+ ```bash
npm run build
```
If the build fails:
- **TS6133 (unused import)**: Remove the unused import and retry.
- **Other TypeScript errors**: Report the error with the file and line number and stop. Do not deploy a broken build.
Verify `dist/` exists with `index.html` before continuing.
### Step 3: Deploy
Ask the user: _"Ready to deploy to [environment name]? This will update the live app."_ Wait for explicit confirmation before proceeding.
```bash
- pwsh -NoProfile -Command "pac code push"
+ npx power-apps push
```
Capture the app URL from the output if present.
- If deploy fails, report the error and stop โ do not retry silently. Common fixes are in the troubleshooting guide:
-
- - Auth error โ `pwsh -NoProfile -Command "pac auth create"`
- - Environment mismatch โ `pwsh -NoProfile -Command "pac env select --environment <id>"`
+ If deploy fails, report the error and stop โ do not retry silently. Common fixes:
- **Mac fallback โ if `pac code push` fails with an auth error on macOS:**
- `pac` has known authentication bugs on Mac that can block the push. Use the npx CLI instead:
- ```bash
- npm install -g @microsoft/power-apps-cli # skip if already installed
- npx power-apps push
- ```
- This is functionally equivalent to `pac code push` and bypasses the Mac auth issue.
+ - Auth error / token expired โ `npx power-apps logout`, then retry โ the CLI will re-prompt browser login.
+ - Environment mismatch โ update `environmentId` in `power.config.json` to the correct value and retry.
### Step 4: Update Memory Bank
If `memory-bank.md` exists, update:
- Last deployed timestamp
- App URL (if captured)