Skip to content

Add copilot-component-minimal template - #256

Draft
Nick Pape (nick-pape) wants to merge 1 commit into
SharePoint:mainfrom
nick-pape:nicpape/copilot-component-template
Draft

Add copilot-component-minimal template#256
Nick Pape (nick-pape) wants to merge 1 commit into
SharePoint:mainfrom
nick-pape:nicpape/copilot-component-template

Conversation

@nick-pape

Copy link
Copy Markdown
Contributor

Description

Adds a new copilot template category and a minimal Copilot Component template (copilot-component-minimal) based on the greeting-copilot-component reference implementation in odsp-web.

The template scaffolds a hello-world CopilotComponent with:

  • BaseCopilotComponent from @microsoft/sp-copilot-component
  • Zod-based properties schema (single source of truth for TypeScript types + JSON Schema)
  • Declarative agent manifests (copilot/manifest.json, declarativeAgent.json, ai-plugin.json)
  • config/copilot-agent.json for SPFx agent registration

Note: The example is not registered in rush.json because @microsoft/sp-copilot-component has not been published yet — rush update would fail trying to resolve it.

How was this tested

  • rush build — full build passes
  • rushx test in api/spfx-template-api — 357 tests pass (including category validation)
  • rushx test in apps/spfx-cli — 109 tests pass
  • rushx test in tests/spfx-template-test — 20 tests pass (new template scaffolds and matches example)

Type of change

  • New feature (non-breaking change which adds functionality)
  • Template change (new or updated template/example)

🤖 Generated with Claude Code

Adds a new "copilot" template category and a minimal Copilot Component
template based on the greeting-copilot-component reference implementation.
The template scaffolds a hello-world CopilotComponent with Zod-based
properties schema, declarative agent manifests, and copilot agent config.

Note: the example is not registered in rush.json because
@microsoft/sp-copilot-component has not been published yet.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
svalenciasan added a commit that referenced this pull request Aug 6, 2026
## Description

Adds a full set of **Copilot Component templates** to the SPFx template
system and brings them up to date with the newer reference
implementations in `odsp-web`.

This builds on and supersedes #256 (which added
`copilot-component-minimal`). It is based on that work (the original
minimal template commit is included in this branch) and then:

- **Aligns the SPFx version** used by the copilot templates to
`1.24.0-beta.2` — the newest line that is actually published to public
npm for all required `@microsoft/*` packages (the repo's other templates
track `1.23.2`, which is not published for
`@microsoft/sp-copilot-component`).
- **Updates `copilot-component-minimal`** to match the current odsp-web
behavior: renders `this.properties.message`, uses the default
`zodToJsonSchema` import with a compile-clean `zod` `3.24.1` /
`zod-to-json-schema` `3.24.1` pair, fixes `@types/heft-jest` →
`@types/jest`, bumps the agent schemas (Teams manifest v1.29,
declarative agent v1.8, ai-plugin v2.4), points the serve page at
`CopilotWorkbench.aspx`, and adds `tsconfig` `watchOptions` to avoid the
copilot-agent build loop.
- **Adds `copilot-component-noframework`** (migrated from the odsp
"none" template): an HTML/CSS sample that reads host theme/display mode,
shows a welcome image, and exposes an expand-to-fullscreen control.
Includes `.module.scss` + `sass.json`, localization (`loc/`,
`typescript.json` static assets, `config.json` `localizedResources`),
and `images.d.ts`.
- **Adds `copilot-component-react`** (migrated from the odsp react
template): fetches the current user (Microsoft Graph `/me`) and site
(SharePoint REST) via brokered SSO, then mounts a Fluent UI v9 React
tree with host-context badges and four bridge actions (expand, open
link, follow-up message, resize).

This effectively migrates the odsp-web Yeoman copilot templates to the
spfx repo template system so the odsp version can be deprecated.

### Notes for reviewers
- **Conventions:** these follow spfx repo conventions, not odsp's — flat
`src/`, `.eslintrc.js` (+ eslint 8), published-version deps via `<%=
spfxVersion %>`, the spfx rig, and `_phase:*` scripts. No `.yo-rc.json`
/ yeoman artifacts. A dependency is added only when the migrated source
actually imports it.
- **Version allowlist:** `common/config/rush/common-versions.json`
allowlists the copilot templates' `1.24.0-beta.2` SPFx packages,
`@microsoft/sp-lodash-subset`, and `zod` `3.24.1`, since the copilot
line intentionally tracks a newer SPFx than the other templates.
- **`copilot-component-minimal` example** is now registered in
`rush.json` (previously blocked because
`@microsoft/sp-copilot-component` was unpublished; it is now published
at `1.24.0-beta.2`).
- The react example uses component name `Sample` to avoid colliding with
the `import * as React from 'react'` symbol.
- `teams/<solution>-agent.zip` is a copilot-agent build artifact and is
gitignored (not committed).

Relationship to #256: this can supersede it, or #256 can be closed in
its favor — whichever the maintainers prefer.

## How was this tested?

- `rush build` — all 22 projects build, including the three new copilot
examples.
- `cd tests/spfx-template-test && heft test --clean` — 22/22 pass (21
template scaffolds + 1 multi-component); snapshots and `examples/`
golden copies regenerated from the templates via the CLI in CI mode.
- `rush check` — no dependency mismatches.
- Working tree is clean after a build (agent-zip artifacts ignored).
- Each example was individually built against the published
`1.24.0-beta.2` packages to confirm the migrated samples compile
(including the Fluent UI v9 / `sp-http` / bridge react sample).

## Type of change
- [ ] Bug fix
- [x] New feature / enhancement
- [x] Template change
- [ ] Documentation / CI / governance

---------

Co-authored-by: Nick Pape <5674316+nick-pape@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Santiago Valencia Sanchez <svalenciasan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant