Skip to content

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.

feat(code-apps): support dual pa/power-apps CLI binaries with grouped flag renames (#321)

ergonza93d44759bc0399
diff --git a/plugins/code-apps/.claude-plugin/plugin.json b/plugins/code-apps/.claude-plugin/plugin.json
index bafc27f38..a5d4c5b67 100644
--- a/plugins/code-apps/.claude-plugin/plugin.json
+++ b/plugins/code-apps/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "code-apps-preview",
- "version": "1.0.0",
+ "version": "1.1.0",
"description": "Build and deploy Power Apps code apps using React, Vite, and Power Platform connectors.",
"author": {
"name": "Microsoft",
diff --git a/plugins/code-apps/.plugin/plugin.json b/plugins/code-apps/.plugin/plugin.json
index bafc27f38..a5d4c5b67 100644
--- a/plugins/code-apps/.plugin/plugin.json
+++ b/plugins/code-apps/.plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "code-apps-preview",
- "version": "1.0.0",
+ "version": "1.1.0",
"description": "Build and deploy Power Apps code apps using React, Vite, and Power Platform connectors.",
"author": {
"name": "Microsoft",
diff --git a/plugins/code-apps/AGENTS.md b/plugins/code-apps/AGENTS.md
index 977e3dc56..599aa0485 100644
--- a/plugins/code-apps/AGENTS.md
+++ b/plugins/code-apps/AGENTS.md
@@ -4,7 +4,7 @@ This file provides guidance to AI Agents when working with the **power-apps** pl
## What This Plugin Is
-A plugin for building and deploying Power Apps code apps using React + Vite + TypeScript, connected to Power Platform via connectors (Dataverse, SharePoint, Teams, Azure DevOps, OneDrive, Excel, Office 365, and more). Apps are deployed via the Power Apps NPX CLI (`npx power-apps push`).
+A plugin for building and deploying Power Apps code apps using React + Vite + TypeScript, connected to Power Platform via connectors (Dataverse, SharePoint, Teams, Azure DevOps, OneDrive, Excel, Office 365, and more). Apps are deployed via the Power Apps NPX CLI (`pa app push`).
## Local Development
@@ -89,7 +89,7 @@ Power Apps code apps run in a sandbox — direct HTTP calls (`fetch`, `axios`, G
### Generated Services
-`npx power-apps add-data-source` generates typed TypeScript services in `src/generated/`:
+`pa app add data-source` generates typed TypeScript services in `src/generated/`:
- `src/generated/models/{Name}Model.ts` — TypeScript interfaces
- `src/generated/services/{Name}Service.ts` — CRUD methods
@@ -97,12 +97,12 @@ Always use generated services for data access.
### CLI
-The Power Apps CLI (`@microsoft/power-apps-cli`) is installed locally via `npm install` as part of the app template. All commands use `npx power-apps <verb>` from within the project directory — runs natively in bash on all platforms, no PowerShell wrapper needed.
+The Power Apps CLI (`@microsoft/power-apps-cli`) is installed locally via `npm install` as part of the app template. It ships two binaries — grouped **`pa`** (preferred) and flat **`power-apps`** (fallback). **Resolve which one the project has via [shared/cli-binary.md](./shared/cli-binary.md) first**, then invoke it with `npx --no-install <pa|power-apps>` from the project directory — runs natively in bash on all platforms, no PowerShell wrapper needed. Commands below use the canonical grouped `pa` form:
```bash
-npx power-apps push # Deploy app
-npx power-apps add-data-source -a ... # Add connector
-npx power-apps list-connections # List connections
+pa app push # Deploy app
+pa app add data-source --connector ... # Add connector
+pa connection list # List connections
```
### Scaffolding
@@ -120,4 +120,4 @@ After modifying this plugin:
1. Run `claude --debug` to see plugin loading details
2. Test skill invocation with `/create-code-app`
3. Verify connector-first guardrails are enforced
-4. Test CLI commands (`npx power-apps push`, `npx power-apps add-data-source`, etc.)
+4. Test CLI commands (`pa app push`, `pa app add data-source`, etc.)
diff --git a/plugins/code-apps/agents/code-app-architect.md b/plugins/code-apps/agents/code-app-architect.md
index a104edf14..5113bcc66 100644
--- a/plugins/code-apps/agents/code-app-architect.md
+++ b/plugins/code-apps/agents/code-app-architect.md
@@ -66,11 +66,11 @@ The Power Apps CLI is installed automatically via `npm install` from the app tem
**If none of the specific skills match**, invoke `/add-connector` — it handles any connector not covered above. Browse available connectors at https://learn.microsoft.com/en-us/connectors/connector-reference/ to find the correct API name. **If no connector exists for the required functionality, tell the user clearly and do not implement a direct API call as a workaround — it will not work in production.**
-**Connection IDs**: All non-Dataverse connectors require a connection ID (`-c` flag). Run `/list-connections` to find it, then run `npx power-apps add-data-source -a <connector> -c <connection-id>`.
+**Connection IDs**: All non-Dataverse connectors require a connection ID (`-c` flag). Run `/list-connections` to find it, then run `pa app add data-source --connector <connector> -c <connection-id>`.
### Generated Code Pattern
-Code apps use `npx power-apps add-data-source` to generate typed services:
+Code apps use `pa app add data-source` to generate typed services:
- `src/generated/models/{Table}Model.ts` -- TypeScript interfaces
- `src/generated/services/{Table}Service.ts` -- CRUD methods
@@ -89,7 +89,7 @@ npm install
After scaffolding, initialize:
```bash
-npx power-apps init -n '{app-name}' -e <environment-id>
+pa app init -n '{app-name}' -e <environment-id>
```
### Dataverse Gotchas
@@ -106,7 +106,7 @@ npx power-apps init -n '{app-name}' -e <environment-id>
- **Azure DevOps**: HttpRequest method requires renaming `parameters` to `body` in 3 generated files.
- **SharePoint/Excel**: Tabular datasources need `--dataset` and `--table` parameters when adding.
- **Excel Online**: Body is a flat key-value object -- no `{ items: ... }` wrapper.
-- **Work IQ** (`shared_a365copilotchatmcp`): stateless-tolerant MCP connector — the connection is created with `npx power-apps create-connection` (browser OAuth) and it needs the `McpSession` wrapper (send **no** session id on `initialize`). See the `/add-workiq` skill for setup steps.
+- **Work IQ** (`shared_a365copilotchatmcp`): stateless-tolerant MCP connector — the connection is created with `pa connection create` (browser OAuth) and it needs the `McpSession` wrapper (send **no** session id on `initialize`). See the `/add-workiq` skill for setup steps.
### Default Environment
@@ -114,25 +114,25 @@ Check `power.config.json` in the project root for an `environmentId` — use it
### CLI Commands
-The Power Apps CLI (`@microsoft/power-apps-cli`) installs locally via `npm install`. Use `npx power-apps` from within the project directory — works natively in bash on all platforms:
+The Power Apps CLI (`@microsoft/power-apps-cli`) installs locally via `npm install`. It ships two binaries — grouped **`pa`** (preferred) and flat **`power-apps`** (fallback). **Resolve which one the project has via [cli-binary.md](../shared/cli-binary.md) before running any command**, then invoke it with `npx --no-install <pa|power-apps>` from the project directory (works natively in bash on all platforms). Commands below are shown in the canonical grouped `pa` form:
```bash
-npx power-apps push # Deploy
-npx power-apps add-data-source -a <api> -c <id> # Add connector
-npx power-apps list-connections # List connections
-npx power-apps list-datasets -a <api> -c <id> # List datasets
-npx power-apps list-tables -a <api> -c <id> -d <ds> # List tables
-npx power-apps logout # Log out
+pa app push # Deploy
+pa app add data-source --connector <api> -c <id> # Add connector
+pa connection list # List connections
+pa connector list-datasets --connector <api> -c <id> # List datasets
+pa connector list-tables --connector <api> -c <id> -d <ds> # List tables
+pa auth logout # Log out
```
**Auth**: MSAL-based — browser popup on first command requiring auth. No separate auth setup needed.
-**Environment**: Set once via `npx power-apps init -e <env-id>`, stored in `power.config.json`.
+**Environment**: Set once via `pa app init -e <env-id>`, stored in `power.config.json`.
### Build Requirements
Key rules:
-- Always `npm run build` before `npx power-apps push`
+- Always `npm run build` before `pa app push`
- Remove unused imports (TS6133 strict mode)
- Don't edit files in `src/generated/` unless fixing known issues
- Node.js 22+ required — `add-data-source` rejects older versions
diff --git a/plugins/code-apps/shared/cli-binary.md b/plugins/code-apps/shared/cli-binary.md
new file mode 100644
index 000000000..bbf2aa9c6
--- /dev/null
+++ b/plugins/code-apps/shared/cli-binary.md
@@ -0,0 +1,128 @@
+# CLI Binary Resolution (`pa` preferred, `power-apps` fallback)
+
+**This file is the single source of truth for which CLI binary to run and how to translate commands.** Every skill that runs a Power Apps CLI command MUST resolve the binary using the algorithm below **before** running any command, and MUST author commands in the canonical grouped **`pa`** form (see the mapping table).
+
+---
+
+## Why two binaries
+
+`@microsoft/power-apps-cli` ships two executables from the **same package**:
+
+| Binary | Syntax | Example |
+| ------------ | ------- | ------------------------------------------ |
+| `pa` | grouped | `pa app add data-source --connector ...` |
+| `power-apps` | flat | `power-apps add-data-source -a ...` |
+
+Both are installed together, so a project's `node_modules/.bin/pa` shim exists **only if** the installed CLI version is new enough to include the grouped `pa` binary. Older projects have only `power-apps`. We therefore **prefer `pa`** and **fall back to `power-apps`**.
+
+**Two things differ between the binaries — the verb structure AND some flags:**
+
+1. **Verb structure** — grouped noun-verb (`pa app push`) vs flat (`power-apps push`). See the command mapping table.
+2. **Flag renames** — the grouped `pa` surface renames several customer-facing selector flags and **drops their short aliases** (the "Phase 2" `grouped_flag_renames` mechanism, now live). The flat `power-apps` surface keeps the original flags byte-identical. See the flag mapping table.
+
+When translating a canonical `pa` command to flat `power-apps`, you must convert **both** the verb path and any renamed flags.
+
+---
+
+## Resolution algorithm (run once per session, then cache)
+
+Resolve from the **project root** (the directory containing `package.json` / `power.config.json`):
+
+```bash
+# Prefer the grouped `pa` binary; fall back to flat `power-apps`.
+# --no-install is REQUIRED: it stops npx from silently fetching a remote
+# package named `pa`/`power-apps` from the registry if no local shim exists.
+# Probe both the extensionless shim (bash/sh) and the `.cmd` shim that
+# package managers create on Windows, so a valid install is never missed.
+if [ -e node_modules/.bin/pa ] || [ -e node_modules/.bin/pa.cmd ]; then
+ PA="npx --no-install pa" # grouped syntax → use the "pa" column below
+ PA_KIND="pa"
+elif [ -e node_modules/.bin/power-apps ] || [ -e node_modules/.bin/power-apps.cmd ]; then
+ PA="npx --no-install power-apps" # flat syntax → translate via the mapping table
+ PA_KIND="power-apps"
+else
+ # Neither shim present → the CLI is not installed yet.
+ # Run `npm install` in the project root (per the normal scaffold flow), then re-probe.
+ PA=""
+ PA_KIND="none"
+fi
+```
+
+Rules:
+
+1. **Probe by file presence only** — do not pin or parse a version. A shim (`.bin/pa` or, on Windows, `.bin/pa.cmd`) existing == the grouped binary is available. This is deterministic and cheaper than spawning `--version`. Always check the `.cmd` variant too: npm/pnpm/yarn/bun create `pa.cmd`/`power-apps.cmd` on Windows and an extensionless-only probe would misclassify a valid install as `none`.
+2. **Always use `npx --no-install`.** Never run a bare `npx pa ...`: if the local shim is missing, npx would try to download and execute an unrelated remote package named `pa`. `--no-install` fails closed instead.
+3. **Cache the result** in the project memory bank (`CLI Binary` row — see `memory-bank.md`) so subsequent skills/commands in the session don't re-probe. Re-probe only after an `npm install` that could have changed the installed CLI.
+4. **`none` → install first.** If neither shim exists, the CLI isn't installed; run the project's `npm install` (already part of the scaffold flow) and re-probe before running any command.
+
+---
+
+## Authoring rule for skills
+
+- **Author every command in the canonical grouped `pa` form** (the left/`pa` column below), using the **renamed `pa` flags** from the flag mapping table, e.g. `pa app push`, `pa app add data-source --connector shared_office365 -c <conn-id>`.
+- Substitute the resolved `$PA` prefix (which already contains `npx --no-install`) for the binary at run time. When `PA_KIND=pa`, run the canonical command as-is: `$PA app push` → `npx --no-install pa app push`. When `PA_KIND=power-apps`, translate the verb path (and renamed flags) per the next rule before running: `$PA push` → `npx --no-install power-apps push`.
+- **If `PA_KIND` is `power-apps`, translate each grouped command to its flat equivalent before running it — convert BOTH the verb path AND any renamed flags.** The flat binary does **not** understand the grouped noun-verb form (`power-apps app push` is invalid — it must become `power-apps push`), and it does **not** accept the renamed long flags (`--connector` must become `--api-id`/`-a`, `--table` must become `--resource-name`/`-t`, etc.).
+- **Most flags are unchanged** — only the selector flags in the flag mapping table are renamed on `pa`. Connection ID (`-c`), dataset (`-d`), environment (`-e`), and display name (`-n` on `init`/`connection create`) are identical on both binaries.
+
+---
+
+## Command mapping table (grouped `pa` ↔ flat `power-apps`)
+
+| Operation | Canonical (`pa`) | Flat (`power-apps`) |
+| ------------------------ | --------------------------------- | --------------------------------- |
+| Initialize project | `pa app init` | `power-apps init` |
+| Deploy / push | `pa app push` | `power-apps push` |
+| Local dev server | `pa app run` | `power-apps run` |
+| List code apps | `pa app list` | `power-apps list-codeapps` |
+| Add data source | `pa app add data-source` | `power-apps add-data-source` |
+| Add Dataverse API | `pa app add dataverse-api` | `power-apps add-dataverse-api` |
+| Add flow | `pa app add flow` | `power-apps add-flow` |
+| Remove data source | `pa app remove data-source` | `power-apps delete-data-source` |
+| Remove flow | `pa app remove flow` | `power-apps remove-flow` |
+| Refresh data source | `pa app refresh data-source` | `power-apps refresh-data-source` |
+| Find Dataverse API | `pa app find-dataverse-api` | `power-apps find-dataverse-api` |
+| List environment vars | `pa app list-environment-variables` | `power-apps list-environment-variables` |
+| List flows | `pa app list-flows` | `power-apps list-flows` |
+| List connections | `pa connection list` | `power-apps list-connections` |
+| List connection refs | `pa connection list-references` | `power-apps list-connection-references` |
+| Create connection | `pa connection create` | `power-apps create-connection` |
+| List connectors | `pa connector list` | `power-apps list-connectors` |
+| List datasets | `pa connector list-datasets` | `power-apps list-datasets` |
+| List tables | `pa connector list-tables` | `power-apps list-tables` |
+| List stored procedures | `pa connector list-procedures` | `power-apps list-sqlStoredProcedures` |
+| Sign in | `pa auth login` | `power-apps login` |
+| Sign out | `pa auth logout` | `power-apps logout` |
+| Auth status | `pa auth status` | `power-apps auth-status` |
+| Switch account | `pa auth switch` | `power-apps auth-switch` |
+| Telemetry enable | `pa telemetry enable` | `power-apps telemetry --enable` |
+| Telemetry disable | `pa telemetry disable` | `power-apps telemetry --disable` |
+| Telemetry status | `pa telemetry status` | `power-apps telemetry --show-settings` |
+
+> **Note:** the operations above differ only in verb structure. Renamed **flags** (which apply to several of these operations) are listed separately in the flag mapping table below.
+
+---
+
+## Flag mapping table (grouped `pa` ↔ flat `power-apps`)
+
+The grouped `pa` surface renames these customer-facing selector flags and **drops their short aliases**. The flat `power-apps` surface keeps the original flag names and aliases. All other flags are identical on both binaries.
+
+| Selector | Canonical (`pa`) | Flat (`power-apps`) | Used by |
+| ----------------------- | -------------------- | ---------------------------------- | --------------------------------------------------- |
+| Connector / API | `--connector` | `--api-id` (alias `-a`) | `add data-source`, `connector list-*`, `connection create` |
+| Table / resource | `--table` | `--resource-name` (alias `-t`) | `add data-source` |
+| Data source name | `--name` | `--data-source-name` (alias `-n`) | `add data-source`, `refresh data-source` |
+| SQL stored procedure | `--procedure` | `--sql-stored-procedure` (alias `-sp`) | `connector list-procedures` |
+| Connection reference | `--connection-ref` | `--connection-ref` (alias `-cr`) | `add data-source` (Dataverse) — **alias `-cr` dropped on `pa`, long flag unchanged** |
+
+**Unchanged on both binaries** (do NOT rewrite these): `--connection-id`/`-c`, `--dataset`/`-d`, `--environment-id`/`-e`, `--display-name`/`-n` (on `init` and `connection create`), `--solution-id`, `--search`, `--cloud`.
+
+> ⚠️ **`-n` is context-dependent.** On `add data-source`/`refresh data-source`, `-n` is the (renamed) `data-source-name` → `--name`. On `init` and `connection create`, `-n` is `display-name`, which is **not** renamed. Translate based on the verb, not the letter.
+
+---
+
+## `npx` prefix note
+
+Skill examples elsewhere in the plugin are written in the **canonical grouped `pa` form** (e.g. `pa app push`). These are authoring shorthand — read them as the **canonical operation**, resolve `$PA`, and run the resolved form with the required `npx --no-install` prefix:
+
+- resolved `pa` → `npx --no-install pa <noun> <verb> ...`
+- resolved `power-apps` → translate via the mapping table, then `npx --no-install power-apps <verb> ...`
diff --git a/plugins/code-apps/shared/connector-reference.md b/plugins/code-apps/shared/connector-reference.md
index 2c733d0fc..0bba1c256 100644
--- a/plugins/code-apps/shared/connector-reference.md
+++ b/plugins/code-apps/shared/connector-reference.md
@@ -4,11 +4,11 @@ Applies to all connector skills (`/add-azuredevops`, `/add-teams`, `/add-excel`,
## Connection ID (Required)
-All non-Dataverse connectors require a **connection ID** (`-c`) when adding via `npx power-apps add-data-source`. Without it, the command fails with: `CONNECTION_ID argument is required for connector data sources`.
+All non-Dataverse connectors require a **connection ID** (`-c`) when adding via `pa app add data-source`. Without it, the command fails with: `CONNECTION_ID argument is required for connector data sources`.
### Step 1: List Existing Connections
-Run the `/list-connections` skill. It runs `npx power-apps list-connections` and returns a table of connection IDs and connector names.
+Run the `/list-connections` skill. It runs `pa connection list` and returns a table of connection IDs and connector names.
Look for the connector in the output. Note the **ConnectionId** column value.
@@ -27,11 +27,14 @@ The user must create one first:
Always pass `-c <connection-id>` when adding a connector:
```bash
+# Commands shown in canonical `pa` form — resolve the binary via shared/cli-binary.md
+# and translate to flat `power-apps add-data-source ...` when only `power-apps` is installed.
+
# Non-tabular connectors
-npx power-apps add-data-source -a <api-name> -c <connection-id>
+pa app add data-source --connector <api-name> -c <connection-id>
# Tabular connectors (also need -d and -t)
-npx power-apps add-data-source -a <api-name> -c <connection-id> -d '<dataset>' -t '<table>'
+pa app add data-source --connector <api-name> -c <connection-id> -d '<dataset>' --table '<table>'
```
diff --git a/plugins/code-apps/shared/development-standards.md b/plugins/code-apps/shared/development-standards.md
index 35afe288d..a79f8b0b3 100644
--- a/plugins/code-apps/shared/development-standards.md
+++ b/plugins/code-apps/shared/development-standards.md
@@ -9,13 +9,13 @@ Standards that apply to all Power Apps code app skills.
## Node.js
-- **Node.js 22+ is required** -- `npx power-apps add-data-source` rejects Node 20 and earlier
+- **Node.js 22+ is required** -- `pa app add data-source` rejects Node 20 and earlier
- Check with `node --version` before starting
- If the user has multiple versions, suggest `nvm use 22`
## Build & Deploy
-- **Always** run `npm run build` before `npx power-apps push` -- never skip the build step
+- **Always** run `npm run build` before `pa app push` (deploy) -- never skip the build step
- Verify `dist/` folder contains `index.html` and `assets/` before deploying
- When adding multiple connectors: do **NOT** deploy after each one — run `npm run build` to verify, then deploy once after all connectors are added
diff --git a/plugins/code-apps/shared/memory-bank.md b/plugins/code-apps/shared/memory-bank.md
index c91f9149f..20aaaca6b 100644
--- a/plugins/code-apps/shared/memory-bank.md
+++ b/plugins/code-apps/shared/memory-bank.md
@@ -104,6 +104,7 @@ Update after:
| Environment | [ENVIRONMENT_NAME] |
| Environment ID | [ENVIRONMENT_GUID] |
| App URL | [APP_URL] |
+| CLI Binary | [pa / power-apps] |
| Created Date | [DATE] |
| Status | [In Progress/Created/Deployed] |
@@ -121,7 +122,7 @@ Update after:
- [x] Prerequisites validated (Node.js)
- [x] Environment ID confirmed
- [x] Scaffolded from template
-- [x] Initialized with npx power-apps init
+- [x] Initialized with `pa app init` (or `power-apps init`)
- [x] Built successfully
- [x] Deployed to Power Platform
- App URL: [URL]
diff --git a/plugins/code-apps/shared/shared-instructions.md b/plugins/code-apps/shared/shared-instructions.md
index 5d51205d2..7a6c36453 100644
--- a/plugins/code-apps/shared/shared-instructions.md
+++ b/plugins/code-apps/shared/shared-instructions.md
@@ -18,7 +18,7 @@ Run at the start of every skill execution (at most once per day). Notifies the u
### MUST (required before acting)
-- **Confirm before any deployment**: Before running `npx power-apps push`, ask: _"Ready to deploy to [environment name]? This will update the live app."_ Wait for explicit user confirmation.
+- **Confirm before any deployment**: Before running `pa app push` (deploy), ask: _"Ready to deploy to [environment name]? This will update the live app."_ Wait for explicit user confirmation.
Exception: the baseline deploy in `create-code-app` Step 7 is pre-approved as part of the scaffold flow. The final deploy in Step 10 still requires confirmation.
- **Confirm before any global install**: Before running `npm install -g ...` or `winget install ...`, ask: _"This will install [tool] globally on your machine. OK to proceed?"_ Wait for explicit user confirmation. This applies even when the install is a documented prerequisite.
- **Confirm before writing outside project root**: Before writing, editing, or deleting any file that is not inside the current project directory, ask the user for confirmation.
@@ -26,7 +26,7 @@ Run at the start of every skill execution (at most once per day). Notifies the u
### MUST NOT
-- MUST NOT run `npx power-apps push` if `npm run build` has not succeeded in the current session.
+- MUST NOT run `pa app push` (deploy) if `npm run build` has not succeeded in the current session.
- MUST NOT edit any file under `src/generated/` unless the step explicitly calls for it (e.g., the `add-azuredevops` HttpRequest fix).
- MUST NOT install packages globally (`npm install -g`, `winget install`) without user confirmation.
- MUST NOT make changes outside the project root without user confirmation.
@@ -74,7 +74,7 @@ Standards for versioning, theme, build workflow, and TypeScript strict mode.
**Key Points:**
- Always display version in UI, increment on each deploy
- Default to dark theme (user can override)
-- Always `npm run build` before `npx power-apps push` -- never skip the build
+- Always `npm run build` before `pa app push` (deploy) -- never skip the build
- Remove unused imports before building (TS6133 strict mode)
---
@@ -108,7 +108,7 @@ All non-Dataverse connectors require a connection ID. Read this before any `/add
**Key Points:**
- Run `/list-connections` to find the connection ID before adding a connector
-- Always pass `-c <connection-id>` to `npx power-apps add-data-source`
+- Always pass `-c <connection-id>` to `pa app add data-source`
---
@@ -125,21 +125,34 @@ When selecting an environment, use this priority order: `power.config.json` →
---
+## CLI Binary Resolution (`pa` preferred)
+
+**📋 [cli-binary.md](./cli-binary.md)**
+
+The CLI ships two binaries — grouped `pa` (preferred) and flat `power-apps` (fallback). Resolve which one the project has **before running any command**, and author commands in the canonical grouped `pa` form.
+
+**Key Points:**
+- Probe `node_modules/.bin/pa` from the project root: if present use `pa` (grouped), else fall back to `power-apps` (flat). Cache the result in the memory bank.
+- **Always** invoke via `npx --no-install <pa|power-apps>` — `--no-install` prevents npx from fetching an unrelated remote package.
+- Author commands in the grouped form using the renamed `pa` flags (`pa app add data-source --connector <api> --table <table>`); if the project only has `power-apps`, translate **both the verb path and the renamed flags** to their flat equivalents (`--connector`→`--api-id`/`-a`, `--table`→`--resource-name`/`-t`) using the mapping tables in `cli-binary.md` before running. Most flags (`-c`, `-d`, `-e`) are unchanged.
+
+---
+
## CLI Commands
-The Power Apps code app CLI (`@microsoft/power-apps-cli`) is installed locally as part of `npm install` when a project is scaffolded with the template. All CLI commands run via `npx power-apps` from within the project directory — no global install or `pwsh` wrapper needed.
+The Power Apps code app CLI (`@microsoft/power-apps-cli`) is installed locally as part of `npm install` when a project is scaffolded with the template. **Never invoke a bare `pa`/`power-apps`** — always run the locally-installed CLI through the resolved `$PA` prefix (`npx --no-install …`) from within the project directory. **Resolve the binary first (see [cli-binary.md](./cli-binary.md)); the commands below are canonical grouped `pa` templates — substitute `$PA` for the leading `pa`, and when `PA_KIND=power-apps` translate the verb path and renamed flags via the mapping tables before running.**
-**Core commands:**
+**Core commands (canonical `pa` form — translate to flat `power-apps` via [cli-binary.md](./cli-binary.md) when only `power-apps` is installed):**
```bash
-npx power-apps init -n '<app-name>' -e <env-id> # Initialize project, create power.config.json
-npx power-apps push # Deploy app to Power Platform (run npm run build first)
-npx power-apps run # Start local dev server
-npx power-apps add-data-source -a <api> [-c <conn-id>] [-d <dataset>] [-t <table>]
-npx power-apps list-connections # List connections in current environment
-npx power-apps list-datasets -a <api> -c <conn-id> # List datasets for a connector
-npx power-apps list-tables -a <api> -c <conn-id> -d <dataset> # List tables in a dataset
-npx power-apps logout # Log out
+pa app init -n '<app-name>' -e <env-id> # Initialize project, create power.config.json
+pa app push # Deploy app to Power Platform (run npm run build first)
+pa app run # Start local dev server
+pa app add data-source --connector <api> [-c <conn-id>] [-d <dataset>] [--table <table>]
+pa connection list # List connections in current environment
+pa connector list-datasets --connector <api> -c <conn-id> # List datasets for a connector
+pa connector list-tables --connector <api> -c <conn-id> -d <dataset> # List tables in a dataset
+pa auth logout # Log out
```
**Authentication:** The CLI uses MSAL (browser-based login). On the first command that requires auth, a browser window opens for Microsoft sign-in. The token is cached for subsequent commands. No separate auth setup step is needed.
@@ -150,7 +163,7 @@ npx power-apps logout # Log out
## Command Failure Handling
-Apply these rules whenever an `npx power-apps` or `npm` command exits non-zero. Do NOT retry silently or proceed past a failure.
+Apply these rules whenever a Power Apps CLI (`pa`/`power-apps`) or `npm` command exits non-zero. Do NOT retry silently or proceed past a failure.
### `npm run build` failures
@@ -167,16 +180,16 @@ Apply these rules whenever an `npx power-apps` or `npm` command exits non-zero.
**Example — build error requiring user input:**
> "Build failed with an error I cannot automatically fix: `[exact error text]`. Please review the error above and let me know how you'd like to proceed."
-### `npx power-apps add-data-source` failures
+### `pa app add data-source` failures
| Condition | Action |
| --- | --- |
| Non-zero exit / error output | Report the exact error. STOP. Do not continue to the build step. |
| "connectionId not found" or empty `-c` | Ask the user to run `/list-connections` to get a valid connection ID and retry. |
-| Auth error / token expired | Run `npx power-apps logout`, then retry — the CLI will prompt re-authentication. |
+| Auth error / token expired | Run `pa auth logout` (or `power-apps logout` on `power-apps`-only projects), then retry — the CLI will prompt re-authentication. |
**Example:**
-> "The `npx power-apps add-data-source` command failed: `Error: connectionId 'abc123' not found in environment.` Please run `/list-connections` to confirm the connection exists and get the correct ID."
+> "The `pa app add data-source` command failed: `Error: connectionId 'abc123' not found in environment.` Please run `/list-connections` to confirm the connection exists and get the correct ID."
---
diff --git a/plugins/code-apps/skills/add-azuredevops/SKILL.md b/plugins/code-apps/skills/add-azuredevops/SKILL.md
index d15475867..8948a5060 100644
--- a/plugins/code-apps/skills/add-azuredevops/SKILL.md
+++ b/plugins/code-apps/skills/add-azuredevops/SKILL.md
@@ -27,7 +27,7 @@ Check for `memory-bank.md` per [shared-instructions.md](${PLUGIN_ROOT}/shared/sh
Run the `/list-connections` skill. Find the Azure DevOps connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create.
```bash
-npx power-apps add-data-source -a azuredevops -c <connection-id>
+pa app add data-source --connector azuredevops -c <connection-id>
```
### Step 3: Apply HttpRequest Fix (Required)
diff --git a/plugins/code-apps/skills/add-connector/SKILL.md b/plugins/code-apps/skills/add-connector/SKILL.md
index fb4525cb9..a72ec030a 100644
--- a/plugins/code-apps/skills/add-connector/SKILL.md
+++ b/plugins/code-apps/skills/add-connector/SKILL.md
@@ -67,18 +67,18 @@ Run the `/list-connections` skill. Find the connector in the output. If none exi
```bash
# Non-tabular connectors (Teams, Azure DevOps, etc.)
-npx power-apps add-data-source -a <connector-api-name> -c <connection-id>
+pa app add data-source --connector <connector-api-name> -c <connection-id>
# Tabular connectors (SharePoint, Excel, SQL, etc.) -- also need dataset and table
-npx power-apps add-data-source -a <connector-api-name> -c <connection-id> -d '<dataset>' -t '<table>'
+pa app add data-source --connector <connector-api-name> -c <connection-id> -d '<dataset>' --table '<table>'
```
**Parameter reference:**
-- `-a` (apiId) -- connector name (e.g., `sharepointonline`, `teams`)
+- `--connector` (apiId) -- connector name (e.g., `sharepointonline`, `teams`). On the flat `power-apps` binary this is `--api-id`/`-a`.
- `-c` (connectionId) -- **required** for all non-Dataverse connectors. Get from `/list-connections`.
- `-d` (dataset) -- required for tabular datasources (e.g., SharePoint site URL, SQL database). Not needed for Dataverse.
-- `-t` (table) -- table/list name for tabular datasources (e.g., SharePoint list, Dataverse table logical name)
+- `--table` (table) -- table/list name for tabular datasources (e.g., SharePoint list, Dataverse table logical name). On the flat `power-apps` binary this is `--resource-name`/`-t`.
### Step 4: Inspect & Configure
diff --git a/plugins/code-apps/skills/add-dataverse/SKILL.md b/plugins/code-apps/skills/add-dataverse/SKILL.md
index 1b021c219..1fb7f31c3 100644
--- a/plugins/code-apps/skills/add-dataverse/SKILL.md
+++ b/plugins/code-apps/skills/add-dataverse/SKILL.md
@@ -97,7 +97,7 @@ Use safe functions from [table-management-reference.md](./references/table-manag
For each table:
```bash
-npx power-apps add-data-source -a dataverse -t <table-logical-name>
+pa app add data-source --connector dataverse --table <table-logical-name>
```
Can add multiple tables by running the command for each one.
diff --git a/plugins/code-apps/skills/add-excel/SKILL.md b/plugins/code-apps/skills/add-excel/SKILL.md
index 4f033153c..0818247f4 100644
--- a/plugins/code-apps/skills/add-excel/SKILL.md
+++ b/plugins/code-apps/skills/add-excel/SKILL.md
@@ -34,14 +34,14 @@ Ask the user:
Run the `/list-connections` skill. Find the Excel Online (Business) connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create.
-Excel Online is a tabular datasource -- requires `-c` (connection ID), `-d` (drive), and `-t` (table name in workbook):
+Excel Online is a tabular datasource -- requires `-c` (connection ID), `-d` (drive), and `--table` (table name in workbook):
```bash
# OneDrive workbook
-npx power-apps add-data-source -a excelonlinebusiness -c <connection-id> -d 'me' -t 'Table1'
+pa app add data-source --connector excelonlinebusiness -c <connection-id> -d 'me' --table 'Table1'
# SharePoint workbook -- dataset is the document library path
-npx power-apps add-data-source -a excelonlinebusiness -c <connection-id> -d 'sites/your-site' -t 'Table1'
+pa app add data-source --connector excelonlinebusiness -c <connection-id> -d 'sites/your-site' --table 'Table1'
```
Run for each table the user needs.
diff --git a/plugins/code-apps/skills/add-mcscopilot/SKILL.md b/plugins/code-apps/skills/add-mcscopilot/SKILL.md
index 6a727eaa0..e5fe5225f 100644
--- a/plugins/code-apps/skills/add-mcscopilot/SKILL.md
+++ b/plugins/code-apps/skills/add-mcscopilot/SKILL.md
@@ -27,7 +27,7 @@ Check for `memory-bank.md` per [shared-instructions.md](${PLUGIN_ROOT}/shared/sh
Run the `/list-connections` skill. Find the Microsoft Copilot Studio connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create.
```bash
-npx power-apps add-data-source -a microsoftcopilotstudio -c <connection-id>
+pa app add data-source --connector microsoftcopilotstudio -c <connection-id>
```
### Step 3: Configure
diff --git a/plugins/code-apps/skills/add-office365/SKILL.md b/plugins/code-apps/skills/add-office365/SKILL.md
index 598bba451..bdcae9555 100644
--- a/plugins/code-apps/skills/add-office365/SKILL.md
+++ b/plugins/code-apps/skills/add-office365/SKILL.md
@@ -27,7 +27,7 @@ Check for `memory-bank.md` per [shared-instructions.md](${PLUGIN_ROOT}/shared/sh
Run the `/list-connections` skill. Find the Office 365 Outlook connection in the output (API name contains `office365`). If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create.
```bash
-npx power-apps add-data-source -a office365 -c <connection-id>
+pa app add data-source --connector office365 -c <connection-id>
```
### Step 3: Review Generated Service
diff --git a/plugins/code-apps/skills/add-onedrive/SKILL.md b/plugins/code-apps/skills/add-onedrive/SKILL.md
index cd451913c..74199728c 100644
--- a/plugins/code-apps/skills/add-onedrive/SKILL.md
+++ b/plugins/code-apps/skills/add-onedrive/SKILL.md
@@ -27,7 +27,7 @@ Check for `memory-bank.md` per [shared-instructions.md](${PLUGIN_ROOT}/shared/sh
Run the `/list-connections` skill. Find the OneDrive for Business connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create.
```bash
-npx power-apps add-data-source -a onedriveforbusiness -c <connection-id>
+pa app add data-source --connector onedriveforbusiness -c <connection-id>
```
### Step 3: Configure
diff --git a/plugins/code-apps/skills/add-sharepoint/SKILL.md b/plugins/code-apps/skills/add-sharepoint/SKILL.md
index 14f4533df..2fc5ffbf8 100644
--- a/plugins/code-apps/skills/add-sharepoint/SKILL.md
+++ b/plugins/code-apps/skills/add-sharepoint/SKILL.md
@@ -93,13 +93,13 @@ Run the `/list-connections` skill. Find the SharePoint Online connection in the
List available SharePoint sites the user has access to:
```bash
-npx power-apps list-datasets -a sharepointonline -c <connection-id>
+pa connector list-datasets --connector sharepointonline -c <connection-id>
```
Present the sites to the user and ask which one(s) they want to connect to. If the user already specified a site URL, confirm it appears in the list.
-**If `npx power-apps list-datasets` fails or returns no results:**
-- Auth error: Run `npx power-apps logout`, then retry — the CLI will re-prompt browser login.
+**If `pa connector list-datasets` fails or returns no results:**
+- Auth error: Run `pa auth logout` (or `power-apps logout` on `power-apps`-only projects), then retry — the CLI will re-prompt browser login.
- Empty list: Confirm the connection ID is for a SharePoint Online connection and the user has access to at least one site. STOP if the list is empty after confirming.
- Any other non-zero exit: Report the exact error output. STOP.
@@ -108,10 +108,10 @@ Present the sites to the user and ask which one(s) they want to connect to. If t
For each selected site, list the available lists and document libraries:
```bash
-npx power-apps list-tables -a sharepointonline -c <connection-id> -d '<site-url>'
+pa connector list-tables --connector sharepointonline -c <connection-id> -d '<site-url>'
```
-**If `npx power-apps list-tables` fails or returns no results:**
+**If `pa connector list-tables` fails or returns no results:**
- Confirm the site URL from Step 7 is exact (copy from the output — do not retype).
- If still empty, the user may not have access to that site's lists. Ask them to verify permissions in SharePoint.
- Any other non-zero exit: Report the exact error output. STOP.
@@ -120,13 +120,13 @@ Present the tables to the user and ask which ones they want to add. Suggest tabl
### Step 9: Add Connector
-SharePoint is a tabular datasource -- requires `-c` (connection ID), `-d` (site URL), and `-t` (list name):
+SharePoint is a tabular datasource -- requires `-c` (connection ID), `-d` (site URL), and `--table` (list name):
```bash
-npx power-apps add-data-source -a sharepointonline -c <connection-id> -d '<site-url>' -t '<table-name>'
+pa app add data-source --connector sharepointonline -c <connection-id> -d '<site-url>' --table '<table-name>'
```
-Run the command for each list or library the user selected. The `-d` (dataset) is the SharePoint site URL from Step 7, `-t` (table) is the list/library name from Step 8.
+Run the command for each list or library the user selected. The `-d` (dataset) is the SharePoint site URL from Step 7, `--table` is the list/library name from Step 8.
### Step 10: Configure
diff --git a/plugins/code-apps/skills/add-sharepoint/references/sharepoint-reference.md b/plugins/code-apps/skills/add-sharepoint/references/sharepoint-reference.md
index 0835ce9b7..0bdd88b42 100644
--- a/plugins/code-apps/skills/add-sharepoint/references/sharepoint-reference.md
+++ b/plugins/code-apps/skills/add-sharepoint/references/sharepoint-reference.md
@@ -100,7 +100,7 @@ await SharePointOnlineService.PatchItem({
| Error | Cause | Fix |
| ------------------------------------------------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `"Column 'X' does not exist"` | Using display name instead of internal name | Check generated model for actual property name; may need `_x0020_` encoding |
-| `"The list 'X' does not exist"` | List name doesn't match exactly | Verify list display name via `npx power-apps list-tables`; names are case-sensitive |
+| `"The list 'X' does not exist"` | List name doesn't match exactly | Verify list display name via `pa connector list-tables`; names are case-sensitive |
| `"Value does not fall within the expected range"` | Invalid choice value or column type mismatch | Verify the exact choice option strings; SharePoint choices are case-sensitive |
| `"Item does not exist"` | Using wrong ID format or deleted item | SharePoint list item IDs are sequential integers, not GUIDs |
| `"Access denied"` | Insufficient SharePoint permissions | User needs at least Edit permission on the list |
@@ -127,7 +127,7 @@ await SharePointOnlineService.PatchItem({
## Generated Service Patterns
-After running `npx power-apps add-data-source -a sharepointonline`, the generated `SharePointOnlineService.ts` provides methods that work across all connected lists. The `dataset` (site URL) and `table` (list name) parameters select which list to operate on:
+After running `pa app add data-source --connector sharepointonline`, the generated `SharePointOnlineService.ts` provides methods that work across all connected lists. The `dataset` (site URL) and `table` (list name) parameters select which list to operate on:
```typescript
import { SharePointOnlineService } from "../generated/services/SharePointOnlineService";
diff --git a/plugins/code-apps/skills/add-teams/SKILL.md b/plugins/code-apps/skills/add-teams/SKILL.md
index 9c8d28c71..5c96f6476 100644
--- a/plugins/code-apps/skills/add-teams/SKILL.md
+++ b/plugins/code-apps/skills/add-teams/SKILL.md
@@ -27,7 +27,7 @@ Check for `memory-bank.md` per [shared-instructions.md](${PLUGIN_ROOT}/shared/sh
Run the `/list-connections` skill. Find the Teams connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create.
```bash
-npx power-apps add-data-source -a teams -c <connection-id>
+pa app add data-source --connector teams -c <connection-id>
```
### Step 3: Configure
diff --git a/plugins/code-apps/skills/add-workiq/SKILL.md b/plugins/code-apps/skills/add-workiq/SKILL.md
index cf42ddec1..5bdc2949f 100644
--- a/plugins/code-apps/skills/add-workiq/SKILL.md
+++ b/plugins/code-apps/skills/add-workiq/SKILL.md
@@ -28,14 +28,14 @@ Check for `memory-bank.md` per [shared-instructions.md](${PLUGIN_ROOT}/shared/sh
### Step 2: Add Connector
-The Power Apps code-app CLI (`@microsoft/power-apps-cli`, invoked as `npx power-apps`) creates the connection and generates the typed service itself. Make sure the CLI is installed (`npm install`) and you are signed in (`npx power-apps auth-status`; it shares the same auth as the rest of the code-app skills).
+The Power Apps code-app CLI (`@microsoft/power-apps-cli`, invoked as `pa` or `power-apps` — resolve via [cli-binary.md](${PLUGIN_ROOT}/shared/cli-binary.md)) creates the connection and generates the typed service itself. Make sure the CLI is installed (`npm install`) and you are signed in (`pa auth status`, or `power-apps auth-status` on `power-apps`-only projects; it shares the same auth as the rest of the code-app skills).
#### Find or Create the Connection
**Check for an existing connection first:**
```bash
-npx power-apps list-connections
+pa connection list
```
Look for a **Work IQ Copilot MCP (Preview)** connection (api id `shared_a365copilotchatmcp`) in the output. If one is listed, note its Connection ID and skip to "Add the Data Source" below.
@@ -43,7 +43,7 @@ Look for a **Work IQ Copilot MCP (Preview)** connection (api id `shared_a365copi
**Otherwise create one** with the native `create-connection` verb:
```bash
-npx power-apps create-connection --api-id shared_a365copilotchatmcp
+pa connection create --connector shared_a365copilotchatmcp
```
- The environment is read automatically from the app's `power.config.json` — you do **not** need to pass an environment id.
@@ -57,7 +57,7 @@ npx power-apps create-connection --api-id shared_a365copilotchatmcp
3. **Wait for the user to confirm** the browser shows success before continuing.
**If `create-connection` fails:**
-- "not signed in" / auth error → run `npx power-apps auth-status` (sign in if needed) and retry.
+- "not signed in" / auth error → run `pa auth status` (or `power-apps auth-status` on `power-apps`-only projects), sign in if needed, and retry.
- "Connection creation was cancelled." → the browser flow was closed early; re-run and complete it.
- Any other non-zero exit → report the exact error and STOP.
@@ -68,10 +68,10 @@ As a fallback, the user can create the connection manually in the maker portal:
Once the connection exists, add it to the code app (this is what generates the typed service + model):
```bash
-npx power-apps add-data-source -a shared_a365copilotchatmcp -c <connection-id>
+pa app add data-source --connector shared_a365copilotchatmcp -c <connection-id>
```
-This is a **non-tabular** connector — only `-a` (api id) and `-c` (connection id) are needed.
+This is a **non-tabular** connector — only `--connector` (api id) and `-c` (connection id) are needed.
### Step 3: Inspect Generated Service
diff --git a/plugins/code-apps/skills/create-code-app/SKILL.md b/plugins/code-apps/skills/create-code-app/SKILL.md
index 3513c7219..cf8c2f533 100644
--- a/plugins/code-apps/skills/create-code-app/SKILL.md
+++ b/plugins/code-apps/skills/create-code-app/SKILL.md
@@ -98,8 +98,10 @@ Verify: `package.json` exists, `node_modules/` created.
### Step 5: Initialize
+> Resolve the CLI first (see [cli-binary.md](${PLUGIN_ROOT}/shared/cli-binary.md)): run as `$PA app init …` (`npx --no-install pa …`), never a bare `pa`. On `power-apps`-only projects, translate to `power-apps init …` (the `init` verb and its `-n`/`-e` flags are unchanged on both binaries).
+
```bash
-npx power-apps init -n '{user-provided-app-name}' -e <environment-id>
+pa app init -n '{user-provided-app-name}' -e <environment-id>
```
**Finding the environment ID:** It's the GUID in the make.powerapps.com URL: `https://make.powerapps.com/environments/<env-id>/home`. If you don't pass `-e`, the CLI will prompt for it interactively.
@@ -108,11 +110,11 @@ npx power-apps init -n '{user-provided-app-name}' -e <environment-id>
See [preferred-environment.md](${PLUGIN_ROOT}/shared/preferred-environment.md) for environment selection details.
-**`npx power-apps init` failure:**
+**`pa app init` failure:**
- Non-zero exit: Report the exact output and STOP. Do not continue to Step 6.
- "environmentId not found" or environment validation error: Verify the environment ID is correct and the user has maker permissions in that environment, then retry.
-- Example: _"The `npx power-apps init` command failed: `[error text]`. Please check that environment ID `32a51012-...` is correct and that you have maker permissions in that environment."_
+- Example: _"The `pa app init` command failed: `[error text]`. Please check that environment ID `32a51012-...` is correct and that you have maker permissions in that environment."_
**Critical:** Read `power.config.json` after init and verify `environmentId` is set correctly.
@@ -128,8 +130,10 @@ npm run build
Verify `dist/` folder created with `index.html` and `assets/`.
+> Deploy via the resolved CLI: `$PA app push` on `pa`, or `power-apps push` on `power-apps`-only projects (see [cli-binary.md](${PLUGIN_ROOT}/shared/cli-binary.md)).
+
```bash
-npx power-apps push
+pa app push
```
**Capture app URL** from output: `https://apps.powerapps.com/play/e/{env-id}/app/{app-id}`
@@ -193,7 +197,7 @@ Fix any TypeScript errors. Verify `dist/` contains the updated app.
Ask the user: _"Ready to deploy to [environment name]? This will update the live app."_ Wait for explicit confirmation before proceeding.
```bash
-npx power-apps push
+pa app push
```
### Step 10: Summary
@@ -202,7 +206,7 @@ Provide:
- App name, environment, app URL, project location
- What was built: features, data sources, components
-- Next steps: how to iterate (`npm run build && npx power-apps push`), how to add more data sources
+- Next steps: how to iterate (`npm run build && pa app push`), how to add more data sources
- Suggest what else the app could do:
- `/add-datasource` -- add another data source (describe what you need, and the plugin will recommend the best approach)
- `/add-dataverse` -- store and manage custom business data
@@ -249,29 +253,29 @@ cd powerapps-task-tracker-20260302
npm install
# Step 5: Initialize (browser login prompt on first run; CLI prompts for env ID if -e omitted)
-npx power-apps init -n 'Task Tracker' -e <environment-id>
+pa app init -n 'Task Tracker' -e <environment-id>
# Step 6: Baseline deploy (pre-approved as part of scaffold flow)
npm run build
-npx power-apps push
+pa app push
# → App URL: https://apps.powerapps.com/play/e/32a51012-.../app/<app-id>
# Step 7: Add Dataverse (via /add-dataverse)
-npx power-apps add-data-source -a dataverse -t cr123_task
+pa app add data-source --connector dataverse --table cr123_task
npm run build # verify connector — no deploy yet
# Step 9: Final deploy (requires user confirmation)
npm run build
-npx power-apps push
+pa app push
```
**Files changed:**
| File | Change |
| --------------------------------------------- | ----------------------------------------------------- |
-| `power.config.json` | Created by `npx power-apps init` — contains `environmentId` |
-| `src/generated/models/Cr123_taskModel.ts` | Generated by `npx power-apps add-data-source` |
-| `src/generated/services/Cr123_taskService.ts` | Generated by `npx power-apps add-data-source` |
+| `power.config.json` | Created by `pa app init` — contains `environmentId` |
+| `src/generated/models/Cr123_taskModel.ts` | Generated by `pa app add data-source` |
+| `src/generated/services/Cr123_taskService.ts` | Generated by `pa app add data-source` |
| `src/components/TaskList.tsx` | Created — renders task list with status filter |
| `src/components/AddTaskForm.tsx` | Created — form to add new tasks |
| `src/App.tsx` | Updated — wires components to `Cr123_taskService` |
@@ -293,7 +297,7 @@ What was built:
- Mark complete / delete actions
- Dataverse table `cr123_task` (Title, Description, DueDate, IsComplete)
-To redeploy: npm run build && npx power-apps push (from the project folder)
+To redeploy: npm run build && pa app push (from the project folder)
What you can add next:
- /add-teams — post task updates to a Teams channel
@@ -316,7 +320,7 @@ What you can add next:
- [x] Step 1: Prerequisites validated
- [x] Step 4: Scaffold (npx degit)
-- [x] Step 5: Initialize (npx power-apps init)
+- [x] Step 5: Initialize (pa app init)
- [x] Step 6: Baseline deploy
- [x] Step 7: Add Dataverse (cr123_task)
- [x] Step 8: Implement app (TaskList, AddTaskForm)
@@ -348,19 +352,19 @@ What you can add next:
```bash
# Step 6: Get connection ID (via /list-connections)
-npx power-apps list-connections
+pa connection list
# → ConnectionId: conn-sp-xyz789 (SharePoint Online)
# Step 7: Discover sites
-npx power-apps list-datasets -a sharepointonline -c conn-sp-xyz789
+pa connector list-datasets --connector sharepointonline -c conn-sp-xyz789
# → https://contoso.sharepoint.com/sites/Projects
# Step 8: Discover tables
-npx power-apps list-tables -a sharepointonline -c conn-sp-xyz789 -d 'https://contoso.sharepoint.com/sites/Projects'
+pa connector list-tables --connector sharepointonline -c conn-sp-xyz789 -d 'https://contoso.sharepoint.com/sites/Projects'
# → Project Milestones, Documents, Team Wiki
# Step 9: Add connector
-npx power-apps add-data-source -a sharepointonline -c conn-sp-xyz789 -d 'https://contoso.sharepoint.com/sites/Projects' -t 'Project Milestones'
+pa app add data-source --connector sharepointonline -c conn-sp-xyz789 -d 'https://contoso.sharepoint.com/sites/Projects' --table 'Project Milestones'
# Step 11: Build to verify
npm run build # → success
diff --git a/plugins/code-apps/skills/create-code-app/references/prerequisites-reference.md b/plugins/code-apps/skills/create-code-app/references/prerequisites-reference.md
index f4013a12f..cdb47d8f7 100644
--- a/plugins/code-apps/skills/create-code-app/references/prerequisites-reference.md
+++ b/plugins/code-apps/skills/create-code-app/references/prerequisites-reference.md
@@ -26,10 +26,10 @@ When using plan mode, include these in `allowedPrompts`:
{ "tool": "Bash", "prompt": "scaffold power apps template (npx degit)" },
{ "tool": "Bash", "prompt": "install npm dependencies" },
{ "tool": "Bash", "prompt": "build for production (npm run build)" },
- { "tool": "Bash", "prompt": "initialize power apps project (npx power-apps init)" },
- { "tool": "Bash", "prompt": "list connections (npx power-apps list-connections)" },
- { "tool": "Bash", "prompt": "add data sources (npx power-apps add-data-source)" },
- { "tool": "Bash", "prompt": "deploy to power platform (npx power-apps push)" }
+ { "tool": "Bash", "prompt": "initialize power apps project (pa app init)" },
+ { "tool": "Bash", "prompt": "list connections (pa connection list)" },
+ { "tool": "Bash", "prompt": "add data sources (pa app add data-source)" },
+ { "tool": "Bash", "prompt": "deploy to power platform (pa app push)" }
]
}
```
diff --git a/plugins/code-apps/skills/create-code-app/references/troubleshooting.md b/plugins/code-apps/skills/create-code-app/references/troubleshooting.md
index 0618ef755..75dcb9780 100644
--- a/plugins/code-apps/skills/create-code-app/references/troubleshooting.md
+++ b/plugins/code-apps/skills/create-code-app/references/troubleshooting.md
@@ -14,7 +14,7 @@
| ----------------------- | ------------------------------------------------------------------ |
| Build fails | Check Node.js 22+ version, run `npm install` |
| Build fails with TS6133 | Unused imports cause errors in strict mode. Remove unused imports. |
-| Auth error | Run `npx power-apps logout`, then retry — the CLI will re-prompt browser login. |
+| Auth error | Run `pa auth logout` (or `power-apps logout` on `power-apps`-only projects), then retry — the CLI will re-prompt browser login. |
| No data | Verify user has read access to table, check browser console |
| Local testing | Use same browser profile as Power Platform auth |
@@ -24,7 +24,7 @@
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| "environment config does not match" | Update `environmentId` in `power.config.json` to match the target environment, then retry. |
| DNS/network error | Try different environment or contact admin. |
-| Auth error / token expired | Run `npx power-apps logout`, then retry `npx power-apps push` — CLI will prompt re-authentication via browser. |
+| Auth error / token expired | Run `pa auth logout`, then retry `pa app push` — CLI will prompt re-authentication via browser. On `power-apps`-only projects use `power-apps logout` then `power-apps push`. |
## Resources
diff --git a/plugins/code-apps/skills/deploy/SKILL.md b/plugins/code-apps/skills/deploy/SKILL.md
index 4b081112a..e1ed5f6af 100644
--- a/plugins/code-apps/skills/deploy/SKILL.md
+++ b/plugins/code-apps/skills/deploy/SKILL.md
@@ -39,15 +39,17 @@ Verify `dist/` exists with `index.html` before continuing.
Ask the user: _"Ready to deploy to [environment name]? This will update the live app."_ Wait for explicit confirmation before proceeding.
+> Resolve the CLI first (see [cli-binary.md](${PLUGIN_ROOT}/shared/cli-binary.md)): run as `$PA app push` (`npx --no-install pa …`), never a bare `pa`. On `power-apps`-only projects, translate to `power-apps push`.
+
```bash
-npx power-apps push
+pa app push
```
Capture the app URL from the output if present.
If deploy fails, report the error and stop — do not retry silently. Common fixes:
-- Auth error / token expired → `npx power-apps logout`, then retry — the CLI will re-prompt browser login.
+- Auth error / token expired → `pa auth logout` (or `power-apps logout` on `power-apps`-only projects), 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
diff --git a/plugins/code-apps/skills/list-connections/SKILL.md b/plugins/code-apps/skills/list-connections/SKILL.md
index 65998ec4b..91be30d57 100644
--- a/plugins/code-apps/skills/list-connections/SKILL.md
+++ b/plugins/code-apps/skills/list-connections/SKILL.md
@@ -20,8 +20,10 @@ Lists all Power Platform connections in the current environment using the Power
### Step 1: Fetch Connections
+> Resolve the CLI first (see [cli-binary.md](${PLUGIN_ROOT}/shared/cli-binary.md)): run as `$PA connection list` (`npx --no-install pa …`), never a bare `pa`. On `power-apps`-only projects, translate to `power-apps list-connections`.
+
```bash
-npx power-apps list-connections
+pa connection list
```
If the CLI is not authenticated, it will open a browser for login automatically. Complete the login and retry.