Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VSCode build/debug seetings and ESLint #71

Merged
merged 22 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1551f22
Add ESLint configuration and scripts for code quality checks
rido-min Feb 21, 2025
079c01a
Refactor launch configurations and tasks for copilotstudio-client; ad…
rido-min Feb 21, 2025
68339a4
Update CI workflow to set working directory for linting and dependenc…
rido-min Feb 21, 2025
7e48a8d
Replace ESLint configuration with neostandard; update lint script and…
rido-min Feb 21, 2025
1cd613b
Add README.md for M365 Agents SDK Samples with debugging instructions
rido-min Feb 21, 2025
8d1cbd5
Add samples list to README.md for better navigation and clarity
rido-min Feb 21, 2025
c3fda6f
Update sample links in README.md for improved navigation
rido-min Feb 21, 2025
c652cc9
Update samples table in README.md for consistency in column headers
rido-min Feb 21, 2025
2b4361e
Fix endpoint URL format in manifest.template.json by removing the pro…
rido-min Feb 21, 2025
7dff8ef
Add post-create command and recommended extensions for development co…
rido-min Feb 21, 2025
f4afd3b
Install OpenSSH server in post-create command for improved developmen…
rido-min Feb 21, 2025
c9afc1a
Fix typo in postCreateCommand.sh for xdg-utils installation
rido-min Feb 21, 2025
be653de
Update devcontainer image version and add new VS Code extensions
rido-min Feb 21, 2025
c11accb
Update devcontainer image and add TypeScript and Deno features
rido-min Feb 21, 2025
a401a0a
Add ESLint extension to development container configuration
rido-min Feb 21, 2025
1f94fd9
Refactor VS Code configurations and update package import syntax for …
rido-min Feb 24, 2025
fc215ba
Migrate Node.js project to TypeScript and restructure build process
rido-min Feb 24, 2025
e44b3ba
Add cards bot sample (#68)
JhontSouth Feb 24, 2025
03d2110
Add prebuild and prestart scripts, and configure VS Code launch and t…
rido-min Feb 24, 2025
08f3f88
Merge branch 'main' into users/rido/node-infra
rido-min Feb 24, 2025
b03a4da
Add build steps for Cards bot and Skill bot in CI workflow
rido-min Feb 24, 2025
f383f1e
Remove VS Code configuration from .gitignore and add node-samples wor…
rido-min Feb 25, 2025
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
13 changes: 9 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@
"features": {
"ghcr.io/devcontainers/features/azure-cli:1": {},
"ghcr.io/devcontainers/features/powershell:1": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/stuartleeks/dev-container-features/dev-tunnels:0": {}
"ghcr.io/stuartleeks/dev-container-features/dev-tunnels:0": {},
"ghcr.io/devcontainers-community/npm-features/typescript:1": {},
"ghcr.io/devcontainers-extra/features/deno:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"GitHub.copilot-chat",
"TeamsDevApp.vscode-adaptive-cards"
"TeamsDevApp.vscode-adaptive-cards",
"ms-dotnettools.csdevkit",
"github.vscode-github-actions",
"dbaeumer.vscode-eslint"
]
}
}
},
"postCreateCommand": "bash .devcontainer/postCreateCommand.sh"
}
11 changes: 11 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sudo apt update

sudo DEBIAN_FRONTEND=noninteractive \
UCF_FORCE_CONFFOLD=1 \
UCF_FORCE_CONFDEF=1 \
apt -o Dpkg::Options::="--force-confdef" \
-o Dpkg::Options::="--force-confold" \
install openssh-server -y

sudo apt upgrade -y
sudo apt install xdg-utils -y
22 changes: 21 additions & 1 deletion .github/workflows/ci-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,34 @@ jobs:
with:
node-version: 22

- name: Build echo bot
- name: Install dependencies
run: npm install
working-directory: ./samples

- name: Run lint
run: npm run lint
working-directory: ./samples

- name: Build Echo bot
working-directory: ./samples/basic/echo-bot/nodejs/
run: |
npm install
npm run build

- name: Build Cards bot
working-directory: ./samples/basic/cards/nodejs/
run: |
npm install
npm run build

- name: Build Copilot Studio client sample
working-directory: ./samples/basic/copilotstudio-client/nodejs/
run: |
npm install
npm run build

- name: Build Skill bot
working-directory: ./samples/complex/copilotstudio-skill/nodejs/
run: |
npm install
npm run build
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,6 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd

# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

Expand Down
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"github.copilot-chat",
"github.codespaces",
"ms-dotnettools.csdevkit",
"teamsdevapp.vscode-adaptive-cards"
]
}
20 changes: 0 additions & 20 deletions .vscode/launch.json

This file was deleted.

20 changes: 20 additions & 0 deletions node-samples.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"folders": [
{
"path": "samples/basic/echo-bot/nodejs",
"name" : "echo bot"
},
{
"path": "samples/basic/cards/nodejs",
"name": "cards"
},
{
"path": "samples/basic/copilotstudio-client/nodejs",
"name": "copilotstudio-client"
},
{
"path" : "samples/complex/copilotstudio-skill/nodejs",
"name": "copilotstudio-skill"
}
]
}
8 changes: 8 additions & 0 deletions samples/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
]
}
4 changes: 4 additions & 0 deletions samples/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"version": "2.0.0",
"tasks": []
}
16 changes: 16 additions & 0 deletions samples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# M365 Agents SDK Samples

To enable debugging, open this folder using Visual Studio Code (VSCode). Follow these steps:

1. Launch VSCode.
2. Select `File` > `Open Folder...`.
3. Navigate to the `/workspaces/Agents/samples` directory and open it.
4. Once the folder is open, you can start debugging by setting breakpoints and running the samples.

## Samples list

|Category | Name | Description | node | dotnet | python |
|---------|-------------|-------------|--------|--------|--------|
| Basic | Echo Bot | Simplest bot | [basic/echo-bot/nodejs](./basic/echo-bot/nodejs) | TBD | TBD |
| Basic | Copilot Studio Client | Consume CopilotStudio Agent | [basic/copilotstudio-client/nodejs](./basic/copilotstudio-client/nodejs) | TBD | TBD |
| Complex | Copilot Studio Skill | Call the echo bot from a Copilot Studio skill | [complex/copilotstudio-skill/nodejs](./complex/copilotstudio-skill/nodejs) | TBD | TBD |
17 changes: 17 additions & 0 deletions samples/basic/cards/nodejs/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "node-card-bot",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/dist/index.js",
"outFiles": [ "${workspaceFolder}/**/dist/**/*.js" ],
"envFile": "${workspaceFolder}/.env",
"preLaunchTask": "npm: build card-bot"
}
]
}
15 changes: 15 additions & 0 deletions samples/basic/cards/nodejs/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"label": "npm: build card-bot"
}
]
}
1 change: 1 addition & 0 deletions samples/basic/cards/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"license": "MIT",
"main": "./lib/index.js",
"scripts": {
"prebuild": "npm install",
"build": "tsc --build",
"prestart": "npm run build",
"start": "node --env-file .env ./dist/index.js",
Expand Down
17 changes: 17 additions & 0 deletions samples/basic/copilotstudio-client/nodejs/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "node-copilotstudio-client",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/dist/index.js",
"outFiles": [ "${workspaceFolder}/**/dist/**/*.js" ],
"envFile": "${workspaceFolder}/.env",
"preLaunchTask": "npm: build copilotstudio-client"
}
]
}
15 changes: 15 additions & 0 deletions samples/basic/copilotstudio-client/nodejs/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"label": "npm: build copilotstudio-client"
}
]
}
9 changes: 9 additions & 0 deletions samples/basic/copilotstudio-client/nodejs/env.TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
environmentId=127b164e-50eb-e1f3-9e9e-a3b54a865c16
botIdentifier=cr0d1_myTestAgent
tenantId=18743834-d9d8-4376-aba7-5dba2dbe8c2a
appClientId=3be1aa5f-e633-437a-bf2b-9a8b6627195c

# cloud= # PowerPlatformCloud enum key.
# customPowerPlatformCloud= # Power Platform API endpoint to use if Cloud is configured as "Other"
# copilotBotType="" # BotType enum key.
DEBUG="copilot-studio-client"
1 change: 1 addition & 0 deletions samples/basic/copilotstudio-client/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"main": "./dist/index.js",
"type": "module",
"scripts": {
"prebuild": "npm install",
"build": "tsc --build",
"prestart": "npm run build",
"start": "node --env-file .env ./dist/index.js"
Expand Down
8 changes: 5 additions & 3 deletions samples/basic/copilotstudio-client/nodejs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import path from 'path'

import { MsalCachePlugin } from './msalCachePlugin.js'

async function acquireToken(settings: ConnectionSettings): Promise<string> {
async function acquireToken (settings: ConnectionSettings): Promise<string> {
const msalConfig = {
auth: {
clientId: settings.appClientId,
Expand All @@ -25,8 +25,10 @@ async function acquireToken(settings: ConnectionSettings): Promise<string> {
},
system: {
loggerOptions: {
loggerCallback(loglevel: msal.LogLevel, message: string, containsPii: boolean) {
console.log(message)
loggerCallback (loglevel: msal.LogLevel, message: string, containsPii: boolean) {
if (!containsPii) {
console.log(loglevel, message)
}
},
piiLoggingEnabled: false,
logLevel: msal.LogLevel.Verbose,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { ICachePlugin, TokenCacheContext } from '@azure/msal-node'

export class MsalCachePlugin implements ICachePlugin {
private cacheLocation: string = ''
constructor(cacheLocation: string) {
constructor (cacheLocation: string) {
this.cacheLocation = cacheLocation
}

async beforeCacheAccess(tokenCacheContext: TokenCacheContext): Promise<void> {
async beforeCacheAccess (tokenCacheContext: TokenCacheContext): Promise<void> {
return new Promise((resolve, reject) => {
if (fs.existsSync(this.cacheLocation)) {
fs.readFile(this.cacheLocation, 'utf-8', (error, data) => {
Expand All @@ -32,7 +32,7 @@ export class MsalCachePlugin implements ICachePlugin {
})
}

async afterCacheAccess(tokenCacheContext: TokenCacheContext): Promise<void> {
async afterCacheAccess (tokenCacheContext: TokenCacheContext): Promise<void> {
return new Promise((resolve, reject) => {
if (tokenCacheContext.cacheHasChanged) {
fs.writeFile(this.cacheLocation, tokenCacheContext.tokenCache.serialize(), (error) => {
Expand Down
17 changes: 17 additions & 0 deletions samples/basic/echo-bot/nodejs/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "node-echo-bot",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/dist/index.js",
"outFiles": [ "${workspaceFolder}/**/dist/**/*.js" ],
"envFile": "${workspaceFolder}/.env",
"preLaunchTask": "npm: build echo-bot"
}
]
}
15 changes: 15 additions & 0 deletions samples/basic/echo-bot/nodejs/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"label": "npm: build echo-bot"
}
]
}
1 change: 1 addition & 0 deletions samples/basic/echo-bot/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"license": "MIT",
"main": "./dist/index.js",
"scripts": {
"prebuild": "npm install",
"build": "tsc --build",
"prestart": "npm run build",
"start": "node --env-file .env ./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion samples/basic/echo-bot/nodejs/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ActivityHandler, MessageFactory } from '@microsoft/agents-bot-hosting'
import { version } from '@microsoft/agents-bot-hosting/package.json'

export class EchoBot extends ActivityHandler {
constructor() {
constructor () {
super()
this.onMessage(async (context, next) => {
const replyText = `Echo: ${context.activity.text}`
Expand Down
Loading