Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
45 changes: 44 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ The Power CAT Copilot Studio Kit ships:
components: validation framework, library components, governance tooling,
agent inventory, etc. These get packaged and imported into customer
environments.
- **Code apps** under `code-apps/` (Vite + React 19 + Fluent UI v9 +
TypeScript) — the source code of the Power Apps code apps Copilot Agent Kit
for Makers (`code-apps/makers`) and Copilot Agent Kit for Admins
(`code-apps/admin`). The Kit solution installs these apps.
- **A GitHub Pages landing page** at https://microsoft.github.io/Power-CAT-Copilot-Studio-Kit/
built from `site-src/` (Vite + React 19 + Fluent UI v9 + TypeScript) and
deployed from `docs/` on the `feature/github-pages-agent` branch.
Expand Down Expand Up @@ -56,11 +60,40 @@ solution files.

Standard markdown edits. No build step. Open PRs against `main`.

### 4. Code-app changes (`code-apps/`)

Read `code-apps/README.md` and the `README.md` of the app before you change
anything in `code-apps/`. For all the rules, see
[Contribute to the code apps](../CONTRIBUTING.md#contribute-to-the-code-apps).

Key rules for code-app work:

- Use Node.js 22.13 or later. Run `npm ci` in `code-apps/makers` or
`code-apps/admin`. Do not use `npm install`.
- In each app that you change, run `npm run build`, `npm test`, and
`npm run lint`. All tests must pass. Lint must report 0 errors and no new
warnings. After the checks, `git status --porcelain` must show no output.
- Do not skip, remove, or weaken a test. Add a test for each bug fix.
- Do not change dependency versions or `package-lock.json` unless the issue
asks for it.
- Keep the placeholder values in `power.config.json`. Do not commit the IDs of
environments, apps, or flows. Do not commit secrets.
- Do not write user data (names, email addresses, user IDs, tokens) to the
browser console.
- The Agent Library code in `src/features/agent-library/library` is the same in
both apps. Make each change in both copies.
- Use LF line ends.
- The apps need a Power Platform environment and a signed-in user, so you
cannot run them in a Copilot session. Do not run `npx power-apps` commands.
Check your change with the build, the tests, and the lint. In the PR, tell
the reviewer what to test in the app.
- Open the PR against `main`.

## Branching strategy

| Branch | Purpose |
|---|---|
| `main` | Default. Solution files, top-level docs, this instructions file, the `copilot-setup-steps.yml` workflow. |
| `main` | Default. Solution files, the code-app source (`code-apps/`), top-level docs, this instructions file, the `copilot-setup-steps.yml` workflow. |
| `feature/github-pages-agent` | GitHub Pages source. `docs/**` pushes here trigger deploy. **Target this branch for landing-page PRs.** |
| Topic branches | Always branch off the appropriate base above. Use kebab-case names. |

Expand All @@ -71,6 +104,9 @@ Use [Conventional Commits](https://www.conventionalcommits.org/):

Scope landing-page commits with `(pages)`: e.g., `feat(pages): lighten hero palette`.

Scope code-app commits with `(makers)`, `(admin)`, or `(code-apps)` for a
change to both apps: e.g., `fix(makers): keep the review filter after a refresh`.

Always include the trailer:

```
Expand All @@ -93,11 +129,18 @@ branches where the project isn't present (e.g. `site-src/` on `main` before
the redesign PR lands). The npm cache is keyed on each project's
`package-lock.json` so dependency changes automatically invalidate it.

The workflow does not install the code apps in `code-apps/`. They need
Node.js 22.13 or later, but the workflow sets up Node 20. Before you run
`npm ci` in `code-apps/makers` or `code-apps/admin`, make sure that
`node --version` shows 22.13 or later. If you cannot get that version, tell
the reviewer in the PR that you did not run the checks.

## When in doubt

- Visual / UX questions → mirror https://adoption.microsoft.com/en-us/copilot/
- Brand color → `#833D91` (purple); the six-stop rainbow is decorative
- Component library → built on the [Agent Archetype Framework](https://learn.microsoft.com/en-us/agents/agent-archetypes/framework-apply)
3Cs model (Categories / Capabilities / Components)
- Code apps → the `README.md` of the app (`code-apps/makers` or `code-apps/admin`)
- Need more context on the kit overall → see the top-level [README.md](../README.md)
and https://learn.microsoft.com/en-us/microsoft-copilot-studio/guidance/copilot-studio-kit-overview
102 changes: 102 additions & 0 deletions .github/workflows/code-apps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Code apps

on:
pull_request:
paths:
- "code-apps/**"
- ".github/workflows/code-apps.yml"
push:
branches:
- main
paths:
- "code-apps/**"
- ".github/workflows/code-apps.yml"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
check:
name: ${{ matrix.app }} on Node.js ${{ matrix.node }}
runs-on: ubuntu-24.04
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
app:
- makers
- admin
# 22.13.0 is the minimum version in the README files of the apps.
# 26 is the current LTS version.
node:
- "22.13.0"
- "26"
defaults:
run:
working-directory: code-apps/${{ matrix.app }}
steps:
- name: Check out the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Set up Node.js ${{ matrix.node }}
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ matrix.node }}
cache: npm
cache-dependency-path: code-apps/${{ matrix.app }}/package-lock.json

- name: Install the packages
run: npm ci

- name: Build
run: npm run build

- name: Test
run: npm test

- name: Lint
run: npm run lint

- name: Make sure that the checks did not change or add files
run: |
changes="$(git status --porcelain)"
if [ -n "$changes" ]; then
echo "::error::The checks changed or added files:"
echo "$changes"
exit 1
fi

source-checks:
name: Line ends and Agent Library copies
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Check out the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

# A CRLF file in the repository shows as a change on all of its lines,
# and it can change the build output (for example, the size of an SVG image).
- name: Make sure that the text files in code-apps have LF line ends
run: |
crlf="$(git ls-files --eol -- code-apps | grep -E '^i/(crlf|mixed)[[:space:]]' || true)"
if [ -n "$crlf" ]; then
echo "::error::These files have CRLF line ends in the repository. Change their line ends to LF and commit them again. See CONTRIBUTING.md."
echo "$crlf"
exit 1
fi

- name: Compare the 2 Agent Library copies
run: |
if ! diff -r code-apps/makers/src/features/agent-library/library code-apps/admin/src/features/agent-library/library; then
echo "::error::The 2 copies of the Agent Library are different. Make the same change in both copies."
exit 1
fi
68 changes: 68 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,71 @@ instructions provided by the bot. You will only need to do this once across all
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

## Contribute to the code apps

The `code-apps` folder has the source code of 2 Power Apps code apps:

- Copilot Agent Kit for Makers, in `code-apps/makers`
- Copilot Agent Kit for Admins, in `code-apps/admin`

For the setup steps of an app, see the `README.md` file in the folder of the app.

### Before you start

- For a large change, open an issue first. Tell us what you want to change and why. Then we can agree on the approach before you write the code.
- Use Node.js 22.13 or later.
- Install the packages with `npm ci`. Do not use `npm install`, because it can change `package-lock.json`.
- Some paths in the repository are long. On Windows, clone the repository with `git clone -c core.longpaths=true <URL>`, into a folder that OneDrive or a similar service does not synchronize.
- Some comments in the code refer to internal design documents, for example a spec number, a PRD section, or a Figma node. These documents are not in this repository. You do not need them to change the code.

### Checks for each pull request

Run these commands in the folder of each app that you change. The **Code apps** workflow runs the same checks on Node.js 22.13.0 and Node.js 26.

| Command | Expected result |
| --- | --- |
| `npm ci` | The command completes without errors. |
| `npm run build` | The type check and the build complete without errors. |
| `npm test` | All tests pass. |
| `npm run lint` | 0 errors, and no new warnings. |
| `git status --porcelain` | No output. The checks do not change or add files. |

Run the checks with the placeholder values in `power.config.json`. A test of the Makers app fails when the file has the ID of your flow. To restore the file, run `git checkout -- power.config.json`.

### Rules for code changes

- Do not skip, remove, or weaken a test to make a check pass. When you fix a bug, add a test that fails without the fix.
- Do not change the dependency versions or `package-lock.json` in a pull request for a feature or a bug fix. Use a separate pull request for dependency changes.
- Keep the placeholder values in `power.config.json`. Do not commit the IDs of environments, apps, or flows. Do not commit keys, tokens, or other secrets.
- If a test needs a value that looks like a secret, make the value from parts when the test runs. Then secret scanning does not find it. Use this only for fake values. Do not commit a real secret, also not in parts.
- Do not commit the new `*.Schema.json` files that `npx power-apps refresh-data-source` writes. They have values from your environment.
- Do not write user data to the browser console. For example, do not write names, email addresses, user IDs, or tokens.
- The 2 apps have the same copy of the Agent Library code, in `src/features/agent-library/library`. If you change this code in 1 app, make the same change in the other app. The workflow compares the 2 copies.
- Use LF line ends. The workflow fails when a text file in `code-apps` has CRLF line ends in the repository. To change CRLF line ends to LF, run `git -c core.autocrlf=true add --renormalize -- code-apps` for files that are in the repository, and `git -c core.autocrlf=true add <file>` for new files. Then commit.
- Update the `README.md` file of the app when you change a command, a prerequisite, a data source, the data that the app sends, or a known issue.

### Commit messages

Use [Conventional Commits](https://www.conventionalcommits.org/). Use one of these scopes:

| Scope | Use it for |
| --- | --- |
| `makers` | A change to `code-apps/makers` only |
| `admin` | A change to `code-apps/admin` only |
| `code-apps` | A change to both apps, or to the shared files in `code-apps` |

Examples:

- `fix(makers): show the agent name in the review summary`
- `docs(code-apps): change the minimum Node.js version`

### Code scanning

CodeQL checks each pull request. If your pull request adds an alert, fix the cause. If you think that the alert is a false positive, tell us why in the pull request. A maintainer then decides about the alert.

If you find a secret, personal data, or other private data in this repository, do not write it in an issue or a pull request. Report it as described in [SECURITY.md](SECURITY.md).

### How we merge pull requests

We keep the main copy of the code app source in an internal repository, and we build the Copilot Agent Kit releases from it. When we merge your pull request, we also make the same change in the internal repository. Thus, the next release keeps your change. Each release then updates the `code-apps` folder in this repository with a pull request.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ Stay up to date with our releases by **subscribing** to them:

The Copilot Agent Kit GitHub Repo contains the source, releases, issues and backlog items of all components that are part of the Copilot Agent Kit.

The [code-apps](./code-apps/README.md) folder has the source code of the code apps Copilot Agent Kit for Makers and Copilot Agent Kit for Admins. To build and run an app, see the `README.md` file of the app. To contribute to the code apps, see [Contribute to the code apps](./CONTRIBUTING.md#contribute-to-the-code-apps).

## Submit a feature request

Let us know by filing an issue.
Expand Down
1 change: 1 addition & 0 deletions code-apps/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.svg text eol=lf
33 changes: 33 additions & 0 deletions code-apps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Code apps

This folder has the source code of the Power Apps code apps of the Copilot Agent Kit.

> **What is a code app?** A [Power Apps code app](https://learn.microsoft.com/power-apps/developer/code-apps/overview) is a web app that you build in a code editor, for example with React and TypeScript. It runs in Power Apps, and it can use Power Platform connectors.

## Available apps

| Folder | Package | App |
| --- | --- | --- |
| `makers` | `copilotstudiokitformakers` | Copilot Agent Kit for Makers |
| `admin` | `copilotstudiokitforadmins` | Copilot Agent Kit for Admins |

> [!NOTE]
> The old name of the kit is Copilot Studio Kit. The package names still use the old name.

The Copilot Agent Kit solution installs these apps. To install the kit, see [Installing the Copilot Agent Kit](../INSTALLATION_INSTRUCTIONS.md).

## Getting started

1. Open the folder of the app. See the table above.
2. Follow the `README.md` in that folder.

## Data collection

The apps send usage events to a cloud flow in your environment. For the details, and for the steps to turn off the data collection, see these sections:

- [Copilot Agent Kit for Makers: Data collection](makers/README.md#data-collection)
- [Copilot Agent Kit for Admins: Data collection](admin/README.md#data-collection)

## Contributing

To contribute to the code apps, see [Contribute to the code apps](../CONTRIBUTING.md#contribute-to-the-code-apps).
24 changes: 24 additions & 0 deletions code-apps/admin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
Loading
Loading