Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ed62fe6
fix: update devDependencies to latest versions in package.json.tpl
sebastienlevert Sep 22, 2025
1b3df7f
feat: add script to generate TypeSpec variables from environment files
sebastienlevert Sep 24, 2025
170aa26
feat: rename generate-variables files
sebastienlevert Sep 29, 2025
005841d
refactor: updated folder structure
sebastienlevert Oct 9, 2025
963f786
fix: add 'Install dependencies' task to tasks.json.tpl and update REA…
sebastienlevert Oct 9, 2025
8f05bcd
fix: adding build folder to the ignore list
sebastienlevert Oct 9, 2025
911aacb
feat: restructure TypeSpec agent template and update paths for better…
sebastienlevert Oct 10, 2025
2535e2b
fix: update @microsoft/typespec-m365-copilot version to 1.0.0-rc.5
sebastienlevert Oct 23, 2025
0be69f8
fix: update TypeSpec capability property names for consistency and cl…
sebastienlevert Oct 23, 2025
980cc2a
feat: add detailed documentation for agent decorators and capabilitie…
sebastienlevert Oct 24, 2025
96a4c72
feat: add auto-generated environment variables file for declarative a…
sebastienlevert Oct 24, 2025
97292be
fix: update @microsoft/typespec-m365-copilot version to 1.0.0-rc.6
sebastienlevert Oct 31, 2025
70bd2e2
feat: Teams AI CSharp batch 3 (#14579)
yuqizhou77 Sep 23, 2025
e0ef8b6
fix: template e2e cases part 2 (#14575)
tecton Sep 23, 2025
47ff10d
fix: template typos (#14583)
yuqizhou77 Sep 23, 2025
d44a348
refactor: csharp AI V2 readme
yuqizhou77 Sep 23, 2025
a343856
refactor: csharp AI V2 readme
yuqizhou77 Sep 23, 2025
780fbce
fix: cherry-pick decryption error across projects (#14582)
qinzhouxu Sep 24, 2025
c88eb08
test: upgrade dependencies of fs-extra to latest version (#14591)
hellyzh Sep 25, 2025
5b79b9c
feat: support MFA enforcement in VSC ATK (#14573)
HuihuiWu-Microsoft Sep 25, 2025
e064b32
test: change chef bot sample path (#14594)
ayachensiyuan Sep 25, 2025
df0464a
refactor: csharp AI V2 readme
yuqizhou77 Sep 23, 2025
da75082
refactor: csharp AI V2 readme
yuqizhou77 Sep 23, 2025
9e05054
Merge branch 'dev' into chore/update-typespec
sebastienlevert Nov 3, 2025
13d14a4
fix: local debug and build issue
qinzhouxu Nov 4, 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ node_modules/
.DS_Store

# generated files
appPackage/.generated
appPackage/.generated
# generated variables
variables.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace GitHubAPI {
/**
* The base URL for the GitHub API.
*/
const SERVER_URL = "https://api.github.com";
const SERVER_URL = global.GITHUB_API_URL;

/**
* Search open issues from GitHub repositories.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Built-in environment variables
TEAMSFX_ENV=dev
APP_NAME_SUFFIX=dev
GITHUB_API_URL=https://api.github.com
{{#ShareEnabled}}
AGENT_SCOPE=shared
{{/ShareEnabled}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,18 @@ provision:
writeToEnvironmentFile:
teamsAppId: TEAMS_APP_ID

# Install all dependencies (including TypeSpec for Microsoft 365 Copilot)
- uses: cli/runNpmCommand
name: install dependencies
with:
args: install --no-audit --progress=false

# Generates a TypeSpec version of the environment variables
- uses: cli/runNpmCommand
name: Generate TypeSpec environment variables
with:
args: run generate:variables -- ${{TEAMSFX_ENV}}

# Compile typespec files and generate necessary files for agent.
# If you want to update the outputDir, please make sure the following paths are also updated.
# 1. File paths in tspconfig.yaml.
Expand Down
11 changes: 2 additions & 9 deletions templates/vsc/common/declarative-agent-typespec/main.tsp.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import "@typespec/http";
import "@typespec/openapi3";
import "@microsoft/typespec-m365-copilot";
import "./actions.tsp";
import "./variables.tsp";

using TypeSpec.Http;
using TypeSpec.M365.Copilot.Agents;
using TypeSpec.M365.Copilot.Actions;

@agent(
"{{appName}}",
Expand All @@ -24,11 +23,5 @@ using TypeSpec.M365.Copilot.Actions;
// })

namespace {{appName}} {
// Uncomment this part to add actions to the agent.
// @service
// @server(global.GitHubAPI.SERVER_URL)
// @actions(global.GitHubAPI.ACTIONS_METADATA)
// namespace GitHubAPIActions {
// op searchIssues is global.GitHubAPI.searchIssues;
// }
// op searchIssues is global.GitHubAPI.searchIssues;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"name": "{{SafeProjectNameLowerCase}}",
"version": "1.0.0",
"scripts": {
"generate:variables": "node scripts/generate-variables.js"
},
"devDependencies": {
"@microsoft/typespec-m365-copilot": "1.0.0-rc.3",
"@typespec/compiler": "1.0.0-rc.1",
"@typespec/http": "1.0.0-rc.1",
"@typespec/openapi": "1.0.0-rc.1",
"@typespec/openapi3": "1.0.0-rc.1"
"@microsoft/typespec-m365-copilot": "1.0.0-rc.4",
"@typespec/compiler": "^1.0.0",
"@typespec/http": "^1.0.0",
"@typespec/openapi": "^1.0.0",
"@typespec/openapi3": "^1.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env node

// Self-executing script to generate variables.json and variables.tsp from env/.env.{environment}
(async function main() {
const fs = require("fs");
const path = require("path");

try {
const envArg = process.argv[2] || "dev";

// src/agent is the parent of this scripts directory
const repoAgentDir = path.resolve(__dirname, "..");
const envFilePath = path.join(repoAgentDir, "env", `.env.${envArg}`);
const outJsonPath = path.join(repoAgentDir, "variables.json");
const outTspPath = path.join(repoAgentDir, "variables.tsp");

if (!fs.existsSync(envFilePath)) {
console.error(`Environment file not found: ${envFilePath}`);
console.error(`Usage: node generate-variables.js <environment> (e.g. dev, prod)`);
process.exitCode = 2;
return;
}

const raw = fs.readFileSync(envFilePath, "utf8");

const vars = {};

for (const rawLine of raw.split(/\r?\n/)) {
const line = rawLine.trim();
if (!line || line.startsWith("#")) continue;

// support lines like KEY=value or export KEY=value
const cleaned = line.replace(/^export\s+/, "");
const match = cleaned.match(/^([A-Za-z0-9_.-]+)\s*=\s*(.*)$/);
if (!match) continue;

const key = match[1];
let value = match[2] || "";

// strip surrounding single or double quotes
if (
(value.startsWith('"') && value.endsWith('"')) ||
(value.startsWith("'") && value.endsWith("'"))
) {
value = value.slice(1, -1);
}

// Unescape common sequences (keep as-is if not needed)
value = value.replace(/\\n/g, "\n").replace(/\\r/g, "\r");

vars[key] = value;
}

const tspLines = [];
tspLines.push("// Auto-generated by scripts/generate-variables.js - DO NOT EDIT");
tspLines.push(`// Source: env/.env.${envArg}`);
tspLines.push("");

const keys = Object.keys(vars).sort();
for (const originalKey of keys) {
const value = vars[originalKey];

// Convert original env key to a safe TypeSpec identifier: replace invalid chars with _ and ensure it doesn't start with a digit
let ident = originalKey.replace(/[^A-Za-z0-9_]/g, "_");
if (/^[0-9]/.test(ident)) ident = "_" + ident;

// Add a comment with the original env key for traceability
tspLines.push(`// ${originalKey}`);

// Escape backslashes and double quotes for safe TS string literal
const escaped = value.replace(/\\/g, "\\\\").replace(/\"/g, '\\"');

tspLines.push(`const ${ident} = "${escaped}";`);
tspLines.push("");
}

fs.writeFileSync(outTspPath, tspLines.join("\n") + "\n", "utf8");

console.log(`Generated: ${outTspPath}`);
} catch (err) {
console.error("Failed to generate variables:", err && err.stack ? err.stack : err);
process.exitCode = 1;
}
})();