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

build: prerelease Sep 04 #12379

Merged
merged 39 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
49010a0
Merge pull request #12331 from OfficeDev/dev
MSFT-yiz Sep 4, 2024
700f177
docs: changelog new features sep
MuyangAmigo Sep 4, 2024
18bb2f1
refactor: feature flag
yuqizhou77 Sep 5, 2024
c0f621a
refactor: skip single
yuqizhou77 Sep 5, 2024
1c58403
remove confict dependency (#12336)
QinghuiMeng-M Sep 5, 2024
d1b5ef1
test: fix ut
yuqizhou77 Sep 5, 2024
a4e6781
Merge pull request #12338 from OfficeDev/yuqzho/main-dc-plugin-ff
MSFT-yiz Sep 5, 2024
92d57bc
Merge branch 'main' of https://github.com/OfficeDev/TeamsFx into kuoj…
kuojianlu Sep 5, 2024
be43f0e
Merge pull request #12339 from OfficeDev/kuojianlu/fix-copilot-deps
MSFT-yiz Sep 5, 2024
636bd7a
fix: instruction.txt
yuqizhou77 Sep 6, 2024
c442982
Merge pull request #12342 from OfficeDev/yuqzho/dc-oauth-template
MSFT-yiz Sep 6, 2024
bae2c29
refactor: remove preview tag for Python templates
frankqianms Sep 6, 2024
10b53e7
fix(kiota): add auth actions in yaml files
KennethBWSong Sep 6, 2024
f24ae6b
Merge pull request #12344 from OfficeDev/bowsong/hotfix_kiota_auth
MSFT-yiz Sep 6, 2024
dbc3d15
docs: add bug fix for sep changelog
MuyangAmigo Sep 6, 2024
0449b12
update language with copilot
MuyangAmigo Sep 6, 2024
efe99ff
Merge branch 'main' into changelog-sep-pre
MuyangAmigo Sep 6, 2024
75df004
Merge pull request #12353 from OfficeDev/frank/remove-preview-tag
MSFT-yiz Sep 9, 2024
cce629f
perf(kiota): add dc support for kiota integration
KennethBWSong Sep 6, 2024
0cb49e0
fix: fix typo
KennethBWSong Sep 9, 2024
fe85fc0
Merge pull request #12347 from OfficeDev/bowsong/kiota_dc
MSFT-yiz Sep 9, 2024
15fb6c8
Merge pull request #12333 from OfficeDev/changelog-sep-pre
MSFT-yiz Sep 9, 2024
c1144dc
fix: remove single quote from secret variable in template file
tecton Sep 9, 2024
12ddf0a
fix: tab-bot template deploy
yuqizhou77 Sep 9, 2024
2916be8
Merge pull request #12356 from OfficeDev/nintan/fix-template-env-var
MSFT-yiz Sep 10, 2024
b188a5d
Merge branch 'main' into yuqzho/tdp-template-main
yuqizhou77 Sep 10, 2024
7330ceb
Merge pull request #12355 from OfficeDev/yuqzho/tdp-template-main
MSFT-yiz Sep 10, 2024
1135096
perf(kiota): add version check and vsc setting for kiota
KennethBWSong Sep 9, 2024
9dc9cc7
test: add ut
KennethBWSong Sep 9, 2024
6bebf00
perf: update kiota version
KennethBWSong Sep 10, 2024
828a8f9
docs: update message
KennethBWSong Sep 10, 2024
ad47724
Merge pull request #12354 from OfficeDev/bowsong/hotfix_kiota_setting
MSFT-yiz Sep 10, 2024
a3126b1
docs(kiota): update message
KennethBWSong Sep 11, 2024
5981fd5
fix: fix api-key template always return empty
Yimin-Jin Sep 11, 2024
fd4eef2
Merge pull request #12364 from OfficeDev/bowsong/hotfix_kiota_message
MSFT-yiz Sep 11, 2024
be73357
Merge branch 'main' into yimin/fix-apikey
Yimin-Jin Sep 11, 2024
cff77ab
Merge pull request #12365 from OfficeDev/yimin/fix-apikey
MSFT-yiz Sep 11, 2024
69ad155
fix: hide the AAD in copilot extensions
huimiu Sep 11, 2024
fddd364
Merge pull request #12370 from OfficeDev/hui/feature-flag-aad
MSFT-yiz Sep 11, 2024
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 packages/api/src/qm/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export interface SingleSelectQuestion extends UserInputQuestion {
* if true: single select question will be automatically answered with the single option;
* if false: use still need to do the selection manually even there is no other choice.
*/
skipSingleOption?: boolean;
skipSingleOption?: boolean | LocalFunc<boolean>;

/**
* the command is only for CLI option description
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export interface CreateProjectResult {
warnings?: Warning[];
shouldInvokeTeamsAgent?: boolean;
projectId?: string;
createProjectForKiota?: boolean;
lastCommand?: string;
}

export interface TeamsAppInputs extends InputsWithProjectPath {
Expand Down
7 changes: 1 addition & 6 deletions packages/cli/src/commands/models/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ import { CLICommand } from "@microsoft/teamsfx-api";
import { commands } from "../../resource";
import { addSPFxWebpartCommand } from "./addSPFxWebpart";
import { addPluginCommand } from "./addPlugin";
import { isCopilotExtensionEnabled } from "@microsoft/teamsfx-core";

const adjustCommands = (): CLICommand[] => {
if (isCopilotExtensionEnabled()) {
return [addSPFxWebpartCommand, addPluginCommand];
} else {
return [addSPFxWebpartCommand];
}
return [addSPFxWebpartCommand, addPluginCommand];
};
export function addCommand(): CLICommand {
return {
Expand Down
21 changes: 10 additions & 11 deletions packages/cli/src/commands/models/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
CliQuestionName,
CreateProjectInputs,
CreateProjectOptions,
isCopilotExtensionEnabled,
MeArchitectureOptions,
QuestionNames,
} from "@microsoft/teamsfx-core";
Expand Down Expand Up @@ -45,16 +44,16 @@ function adjustOptions(options: CLICommandOption[]) {
}
}

if (!isCopilotExtensionEnabled()) {
//skip Copilot extension questions if the feature flag is not enabled.
const questionsToDelete = [
QuestionNames.ApiPluginType,
QuestionNames.WithPlugin,
QuestionNames.PluginManifestFilePath,
QuestionNames.PluginOpenApiSpecFilePath,
];
options = options.filter((option) => !questionsToDelete.includes(option.name as QuestionNames));
}
// if (!isCopilotExtensionEnabled()) {
// //skip Copilot extension questions if the feature flag is not enabled.
// const questionsToDelete = [
// QuestionNames.ApiPluginType,
// QuestionNames.WithPlugin,
// QuestionNames.PluginManifestFilePath,
// QuestionNames.PluginOpenApiSpecFilePath,
// ];
// options = options.filter((option) => !questionsToDelete.includes(option.name as QuestionNames));
// }

return options;
}
Expand Down
34 changes: 0 additions & 34 deletions packages/cli/tests/unit/commands.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,40 +99,6 @@ describe("CLI commands", () => {
telemetryProperties: {},
};

const filteredQuestionNames = [
QuestionNames.WithPlugin.toString(),
QuestionNames.ApiPluginType.toString(),
];
assert.isTrue(
ctx.command.options?.filter((o) => filteredQuestionNames.includes(o.name)).length === 0
);

const res = await getCreateCommand().handler!(ctx);
assert.isTrue(res.isOk());
});

it("createProjectOptions - need to adjust options when feature flag is enabled", async () => {
mockedEnvRestore = mockedEnv({
[FeatureFlags.CopilotExtension.name]: "true",
});
sandbox.stub(activate, "getFxCore").returns(new FxCore({} as any));
sandbox.stub(FxCore.prototype, "createProject").resolves(ok({ projectPath: "..." }));

const ctx: CLIContext = {
command: { ...getCreateCommand(), fullName: "new" },
optionValues: {},
globalOptionValues: {},
argumentValues: [],
telemetryProperties: {},
};

const filteredQuestionNames = [
QuestionNames.WithPlugin.toString(),
QuestionNames.ApiPluginType.toString(),
];
assert.isTrue(
ctx.command.options?.filter((o) => filteredQuestionNames.includes(o.name)).length === 2
);
const res = await getCreateCommand().handler!(ctx);
assert.isTrue(res.isOk());
});
Expand Down
13 changes: 6 additions & 7 deletions packages/fx-core/src/common/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export class FeatureFlagName {
static readonly OfficeAddin = "TEAMSFX_OFFICE_ADDIN";
static readonly CopilotExtension = "DEVELOP_COPILOT_EXTENSION";
static readonly CopilotPlugin = "DEVELOP_COPILOT_PLUGIN";
static readonly DeclarativeCopilot = "TEAMSFX_DECLARATIVE_COPILOT";
static readonly SampleConfigBranch = "TEAMSFX_SAMPLE_CONFIG_BRANCH";
static readonly TestTool = "TEAMSFX_TEST_TOOL";
static readonly METestTool = "TEAMSFX_ME_TEST_TOOL";
Expand All @@ -31,6 +30,7 @@ export class FeatureFlagName {
static readonly SyncManifest = "TEAMSFX_SYNC_MANIFEST";
static readonly EnvFileFunc = "TEAMSFX_ENV_FILE_FUNC";
static readonly KiotaIntegration = "TEAMSFX_KIOTA_INTEGRATION";
static readonly ApiPluginAAD = "TEAMSFX_API_PLUGIN_AAD";
}

export interface FeatureFlag {
Expand All @@ -49,10 +49,6 @@ export class FeatureFlags {
name: FeatureFlagName.CopilotPlugin,
defaultValue: "false",
}; // old feature flag. Keep it for backwards compatibility.
static readonly DeclarativeCopilot = {
name: FeatureFlagName.DeclarativeCopilot,
defaultValue: "false",
}; // old feature flag. Keep it for backwards compatibility.
static readonly TestTool = { name: FeatureFlagName.TestTool, defaultValue: "true" };
static readonly METestTool = { name: FeatureFlagName.METestTool, defaultValue: "true" };
static readonly OfficeAddin = { name: FeatureFlagName.OfficeAddin, defaultValue: "false" };
Expand Down Expand Up @@ -94,13 +90,16 @@ export class FeatureFlags {
name: FeatureFlagName.KiotaIntegration,
defaultValue: "false",
};
static readonly ApiPluginAAD = {
name: FeatureFlagName.ApiPluginAAD,
defaultValue: "false",
};
}

export function isCopilotExtensionEnabled(): boolean {
return (
featureFlagManager.getBooleanValue(FeatureFlags.CopilotExtension) ||
featureFlagManager.getBooleanValue(FeatureFlags.CopilotPlugin) ||
featureFlagManager.getBooleanValue(FeatureFlags.DeclarativeCopilot)
featureFlagManager.getBooleanValue(FeatureFlags.CopilotPlugin)
);
}

Expand Down
5 changes: 5 additions & 0 deletions packages/fx-core/src/component/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,8 @@ export enum BotScenario {
export const AadConstants = {
DefaultTemplateFileName: "aad.manifest.json",
};

export const KiotaLastCommands = {
createPluginWithManifest: "createPluginWithManifest",
createDeclarativeCopilotWithManifest: "createDeclarativeCopilotWithManifest",
};
13 changes: 10 additions & 3 deletions packages/fx-core/src/component/coordinator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ import { LifeCycleUndefinedError } from "../../error/yml";
import {
ApiPluginStartOptions,
AppNamePattern,
CapabilityOptions,
ProjectTypeOptions,
QuestionNames,
ScratchOptions,
} from "../../question/constants";
import { ExecutionError, ExecutionOutput, ILifecycle } from "../configManager/interface";
import { Lifecycle } from "../configManager/lifecycle";
import { CoordinatorSource } from "../constants";
import { CoordinatorSource, KiotaLastCommands } from "../constants";
import { deployUtils } from "../deployUtils";
import { developerPortalScaffoldUtils } from "../developerPortalScaffoldUtils";
import { DriverContext } from "../driver/interface/commonArgs";
Expand Down Expand Up @@ -97,9 +98,15 @@ class Coordinator {
inputs.platform === Platform.VSCode &&
featureFlagManager.getBooleanValue(FeatureFlags.KiotaIntegration) &&
inputs[QuestionNames.ApiPluginType] === ApiPluginStartOptions.apiSpec().id &&
!inputs[QuestionNames.ApiPluginManifestPath]
!inputs[QuestionNames.ApiPluginManifestPath] &&
(inputs[QuestionNames.Capabilities] === CapabilityOptions.apiPlugin().id ||
inputs[QuestionNames.Capabilities] === CapabilityOptions.declarativeCopilot().id)
) {
return ok({ projectPath: "", createProjectForKiota: true });
const lastCommand =
inputs[QuestionNames.Capabilities] === CapabilityOptions.apiPlugin().id
? KiotaLastCommands.createPluginWithManifest
: KiotaLastCommands.createDeclarativeCopilotWithManifest;
return ok({ projectPath: "", lastCommand: lastCommand });
}

let folder = inputs["folder"] as string;
Expand Down
25 changes: 25 additions & 0 deletions packages/fx-core/src/component/generator/apiSpec/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
ResponseTemplatesFolderName,
Result,
SystemError,
UserError,
Warning,
err,
ok,
Expand Down Expand Up @@ -56,6 +57,7 @@ import {
generateScaffoldingSummary,
getEnvName,
getParserOptions,
listOperations,
updateForCustomApi,
} from "./helper";
import { copilotGptManifestUtils } from "../../driver/teamsApp/utils/CopilotGptManifestUtils";
Expand Down Expand Up @@ -167,6 +169,29 @@ export class SpecGenerator extends DefaultTemplateGenerator {
[telemetryProperties.templateName]: getTemplateInfosState.templateName,
[telemetryProperties.isDeclarativeCopilot]: isDeclarativeCopilot.toString(),
});

// For Kiota integration, we need to get auth info here
if (
featureFlagManager.getBooleanValue(FeatureFlags.KiotaIntegration) &&
inputs[QuestionNames.ApiPluginManifestPath]
) {
const operationsResult = await listOperations(
context,
inputs[QuestionNames.ApiSpecLocation],
inputs
);
if (operationsResult.isErr()) {
const msg = operationsResult.error.map((e) => e.content).join("\n");
return err(new UserError("generator", "ListOperationsFailed", msg));
}

const operations = operationsResult.value;
const authApi = operations.find((api) => !!api.data.authName);
if (authApi) {
authData = authApi.data;
}
}

const appName = inputs[QuestionNames.AppName];
let language = inputs[QuestionNames.ProgrammingLanguage] as ProgrammingLanguage;
if (getTemplateInfosState.templateName !== forCustomCopilotRagCustomApi) {
Expand Down
1 change: 1 addition & 0 deletions packages/fx-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,4 @@ export * from "./question/options";
export * from "./component/middleware/actionExecutionMW";
export { TemplateInfo } from "./component/generator/templates/templateInfo";
export { AadSet } from "./common/globalVars";
export { KiotaLastCommands } from "./component/constants";
15 changes: 9 additions & 6 deletions packages/fx-core/src/question/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,11 +601,16 @@
return items;
}

static copilotExtensions(inputs?: Inputs): OptionItem[] {
static copilotExtensions(inputs?: Inputs, isStatic?: boolean): OptionItem[] {
if (isStatic) {
return [CapabilityOptions.apiPlugin(), CapabilityOptions.declarativeCopilot()];
}
if (inputs && getRuntime(inputs) === RuntimeOptions.DotNet().id) {
return [CapabilityOptions.apiPlugin()];
} else {
} else if (isCopilotExtensionEnabled()) {
return [CapabilityOptions.apiPlugin(), CapabilityOptions.declarativeCopilot()];
} else {

Check warning on line 612 in packages/fx-core/src/question/constants.ts

View check run for this annotation

Codecov / codecov/patch

packages/fx-core/src/question/constants.ts#L612

Added line #L612 was not covered by tests
return [CapabilityOptions.declarativeCopilot()];
}
}

Expand Down Expand Up @@ -635,7 +640,7 @@
...CapabilityOptions.bots(inputs),
...CapabilityOptions.tabs(),
...CapabilityOptions.collectMECaps(),
...CapabilityOptions.copilotExtensions(inputs),
...CapabilityOptions.copilotExtensions(inputs, true),
...CapabilityOptions.customCopilots(),
...CapabilityOptions.tdpIntegrationCapabilities(),
];
Expand All @@ -655,9 +660,7 @@
...CapabilityOptions.tabs(),
...CapabilityOptions.collectMECaps(),
];
if (isCopilotExtensionEnabled()) {
capabilityOptions.push(...CapabilityOptions.copilotExtensions());
}
capabilityOptions.push(...CapabilityOptions.copilotExtensions());
capabilityOptions.push(...CapabilityOptions.customCopilots());
if (featureFlagManager.getBooleanValue(FeatureFlags.TdpTemplateCliTest)) {
// test templates that are used by TDP integration only
Expand Down
Loading
Loading