Skip to content
Draft
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/spfx-template-api/etc/spfx-template-api.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export class ServeJsonMergeHelper extends JsonMergeHelper {
}

// @public
export const SPFX_TEMPLATE_CATEGORIES: readonly ['webpart', 'extension', 'ace', 'library'];
export const SPFX_TEMPLATE_CATEGORIES: readonly ['webpart', 'extension', 'ace', 'library', 'copilot'];

// @public
export type SPFxRepositorySource = LocalFileSystemRepositorySource | PublicGitHubRepositorySource;
Expand Down
5 changes: 3 additions & 2 deletions api/spfx-template-api/src/templating/SPFxTemplateJsonFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ const DESCRIPTION_MAX_LENGTH: number = 500;
* The allowed category values for SPFx templates.
* @public
*/
export const SPFX_TEMPLATE_CATEGORIES: readonly ['webpart', 'extension', 'ace', 'library'] = [
export const SPFX_TEMPLATE_CATEGORIES: readonly ['webpart', 'extension', 'ace', 'library', 'copilot'] = [
'webpart',
'extension',
'ace',
'library'
'library',
'copilot'
] as const;

/**
Expand Down
6 changes: 6 additions & 0 deletions apps/spfx-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ Templates are fetched at runtime from the [SharePoint/spfx](https://github.com/S
| `ace-generic-primarytext-card` | Generic primary text card |
| `ace-search-card` | Search card |

### Copilot Components

| Name | Description |
|------|-------------|
| `copilot-component-minimal` | Bare-bones Copilot Component, no UI framework |

### Other

| Name | Description |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/spfx-cli",
"comment": "",
"type": "none"
}
],
"packageName": "@microsoft/spfx-cli"
}
148 changes: 148 additions & 0 deletions examples/copilot-component-minimal/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
extends: ['@microsoft/eslint-config-spfx/lib/profiles/default'],
parserOptions: { tsconfigRootDir: __dirname },
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
ecmaVersion: 2018,
sourceType: 'module'
},
rules: {
'@rushstack/no-new-null': 1,
'@rushstack/hoist-jest-mock': 1,
'@rushstack/import-requires-chunk-name': 1,
'@rushstack/security/no-unsafe-regexp': 1,
'@typescript-eslint/adjacent-overload-signatures': 1,
'@typescript-eslint/explicit-function-return-type': [
1,
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: false
}
],
'@typescript-eslint/explicit-member-accessibility': 0,
'@typescript-eslint/no-array-constructor': 1,
'@typescript-eslint/no-explicit-any': 1,
'@typescript-eslint/no-floating-promises': 2,
'@typescript-eslint/no-for-in-array': 2,
'@typescript-eslint/no-misused-new': 2,
'@typescript-eslint/no-namespace': [
1,
{
allowDeclarations: false,
allowDefinitionFiles: false
}
],
'@typescript-eslint/parameter-properties': 0,
'@typescript-eslint/no-unused-vars': [
1,
{
vars: 'all',
args: 'none'
}
],
'@typescript-eslint/no-use-before-define': [
2,
{
functions: false,
classes: true,
variables: true,
enums: true,
typedefs: true
}
],
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-namespace-keyword': 1,
'@typescript-eslint/no-inferrable-types': 0,
'@typescript-eslint/no-empty-interface': 0,
'accessor-pairs': 1,
'dot-notation': [
1,
{
allowPattern: '^_'
}
],
eqeqeq: 1,
'for-direction': 1,
'guard-for-in': 2,
'max-lines': ['warn', { max: 2000 }],
'no-async-promise-executor': 2,
'no-caller': 2,
'no-compare-neg-zero': 2,
'no-cond-assign': 2,
'no-constant-condition': 1,
'no-control-regex': 2,
'no-debugger': 1,
'no-delete-var': 2,
'no-duplicate-case': 2,
'no-empty': 1,
'no-empty-character-class': 2,
'no-empty-pattern': 1,
'no-eval': 1,
'no-ex-assign': 2,
'no-extend-native': 1,
'no-extra-label': 1,
'no-fallthrough': 2,
'no-func-assign': 1,
'no-implied-eval': 2,
'no-invalid-regexp': 2,
'no-label-var': 2,
'no-lone-blocks': 1,
'no-misleading-character-class': 2,
'no-multi-str': 2,
'no-new': 1,
'no-new-func': 2,
'no-new-object': 2,
'no-new-wrappers': 1,
'no-octal': 2,
'no-octal-escape': 2,
'no-regex-spaces': 2,
'no-return-assign': 2,
'no-script-url': 1,
'no-self-assign': 2,
'no-self-compare': 2,
'no-sequences': 1,
'no-shadow-restricted-names': 2,
'no-sparse-arrays': 2,
'no-throw-literal': 2,
'no-unmodified-loop-condition': 1,
'no-unsafe-finally': 2,
'no-unused-expressions': 1,
'no-unused-labels': 1,
'no-useless-catch': 1,
'no-useless-concat': 1,
'no-var': 2,
'no-void': 1,
'no-with': 2,
'prefer-const': 1,
'promise/param-names': 2,
'require-atomic-updates': 2,
'require-yield': 1,
strict: [2, 'never'],
'use-isnan': 2,
'no-extra-boolean-cast': 0,
'@microsoft/spfx/no-require-ensure': 2
}
},
{
files: [
'*.test.ts',
'*.test.tsx',
'*.spec.ts',
'*.spec.tsx',
'**/__mocks__/*.ts',
'**/__mocks__/*.tsx',
'**/__tests__/*.ts',
'**/__tests__/*.tsx',
'**/test/*.ts',
'**/test/*.tsx'
],
rules: {}
}
]
};
33 changes: 33 additions & 0 deletions examples/copilot-component-minimal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Logs
logs
*.log
npm-debug.log*

# Dependency directories
node_modules

# Build generated files
dist
lib
lib-dts
lib-commonjs
lib-esm
jest-output
release
solution
temp
*.sppkg
.heft
.spfx-scaffold.jsonl

# Coverage directory used by tools like istanbul
coverage

# OSX
.DS_Store

# Visual Studio files
.ntvs_analysis.dat
.vs
bin
obj
32 changes: 32 additions & 0 deletions examples/copilot-component-minimal/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Ignore everything by default
**

# Use negative patterns to bring back the specific things we want to publish
!/bin/**
!/dist/**
!/EULA/**
!/lib/**
!/lib-*/**
!ThirdPartyNotice.txt

# Ignore certain files in the above folders
/dist/*.stats.*
/dist/**/*.map
/lib/**/*.map
/lib/**/*.test.*
/lib/**/test/**
/lib-*/**/*.map
/lib-*/**/*.test.*
/lib-*/**/test/**

# NOTE: These don't need to be specified, because NPM includes them automatically.
#
# package.json
# README (and its variants)
# CHANGELOG (and its variants)
# LICENSE / LICENCE

## Project specific definitions
# -----------------------------
/lib/**/integration-test/**
/lib/scripts/**
67 changes: 67 additions & 0 deletions examples/copilot-component-minimal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# @spfx-template/copilot-component-minimal

## Summary

Short summary on functionality and used technologies.

[picture of the solution in action, if possible]

## Used SharePoint Framework Version

[![version](https://img.shields.io/badge/version-1.22.2-green.svg)](https://img.shields.io/badge/version-1.22.2-green.svg)

## Applies to

- [SharePoint Framework](https://aka.ms/spfx)
- [Microsoft 365 Copilot](https://learn.microsoft.com/copilot/microsoft-365/)

> Get your own free development tenant by subscribing to [Microsoft 365 developer program](http://aka.ms/o365devprogram)

## Prerequisites

> Any special pre-requisites?

## Solution

| Solution | Author(s) |
| ----------- | ------------------------------------------------------- |
| folder name | Author details (name, company, twitter alias with link) |

## Version history

| Version | Date | Comments |
| ------- | ---------------- | --------------- |
| 1.0 | January 1, 2025 | Initial release |

## Disclaimer

**THIS CODE IS PROVIDED _AS IS_ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**

---

## Minimal Path to Awesome

- Clone this repository
- Ensure that you are at the solution folder
- in the command-line run:
- `npm install -g @rushstack/heft`
- `npm install`
- `heft start`

> Include any additional steps as needed.

Other build commands can be listed using `heft --help`.

## Features

This Copilot Component renders a greeting card when invoked by Microsoft 365 Copilot.

- Demonstrates the `BaseCopilotComponent` base class
- Uses Zod for properties schema (single source of truth for TypeScript types and JSON Schema)
- Includes a declarative agent manifest for Microsoft 365 Copilot

## References

- [Getting started with SharePoint Framework](https://docs.microsoft.com/sharepoint/dev/spfx/set-up-your-developer-tenant)
- [Microsoft 365 Copilot extensibility](https://learn.microsoft.com/copilot/microsoft-365/extensibility/)
- [Heft Documentation](https://heft.rushstack.io/)
14 changes: 14 additions & 0 deletions examples/copilot-component-minimal/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"minimal-copilot-component": {
"components": [
{
"entrypoint": "./lib/MinimalCopilotComponent.js",
"manifest": "./src/minimal-copilot-component.manifest.json"
}
]
}
}
}
11 changes: 11 additions & 0 deletions examples/copilot-component-minimal/config/copilot-agent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../node_modules/@microsoft/spfx-heft-plugins/lib-commonjs/plugins/copilotAgentPlugin/copilot-agent.schema.json",

"agents": [
{
"name": { "default": "Minimal Agent" },
"description": { "default": "Minimal CopilotComponent Description" },
"components": ["838638c8-36e9-53b5-a8c3-37a22b55fa22"]
}
]
}
Loading
Loading