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
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
"figures": "^3.2.0",
"fs-extra": "^9.1.0",
"lodash": "^4.17.21",
"log4js": "^6.4.0",
"node-machine-id": "^1.1.12",
"open": "^8.2.1",
"semver": "^7.5.4",
Expand Down
78 changes: 53 additions & 25 deletions packages/cli/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/cli/src/commands/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ import {
IncompatibleProjectError,
VersionState,
assembleError,
telemetryUtils,
getHashedEnv,
isUserCancelError,
maskSecret,
telemetryUtils,
} from "@microsoft/teamsfx-core";
import { cloneDeep, pick } from "lodash";
import path from "path";
import * as uuid from "uuid";
import { getFxCore } from "../activate";
import { TextType, colorize } from "../colorize";
import { tryDetectCICDPlatform } from "../commonlib/common/cicdPlatformDetector";
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/commands/models/addAuthConfig.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { CLICommand } from "@microsoft/teamsfx-api";
import { AddAuthActionInputs, AddAuthActionOptions } from "@microsoft/teamsfx-core";
import { getFxCore } from "../../activate";
import { logger } from "../../commonlib/logger";
import { commands, strings } from "../../resource";
import { TelemetryEvent } from "../../telemetry/cliTelemetryEvents";
import { ProjectFolderOption } from "../common";
import { getFxCore } from "../../activate";
import { AddAuthActionInputs, AddAuthActionOptions } from "@microsoft/teamsfx-core";
import { logger } from "../../commonlib/logger";

export const addAuthConfigCommand: CLICommand = {
name: "auth-config",
Expand Down
56 changes: 56 additions & 0 deletions packages/cli/src/commands/models/init/init.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { CLICommand, err, Inputs, ok } from "@microsoft/teamsfx-api";
import { getFxCore } from "../../../activate";
import { commands } from "../../../resource";
import { TelemetryEvent } from "../../../telemetry/cliTelemetryEvents";
import { ProjectFolderOptionWithoutValidation, TeamsAppManifestFileOption } from "../../common";
import {
localDebugOption,
playgroundOption,
programmingLanguageOption,
remoteDeployOption,
} from "./initOption";

export const initCommand: CLICommand = {
name: "init",
description: commands.init.description,
options: [
playgroundOption,
localDebugOption,
remoteDeployOption,
programmingLanguageOption,
{ ...TeamsAppManifestFileOption, required: true },
ProjectFolderOptionWithoutValidation,
],
defaultInteractiveOption: false,
telemetry: {
event: TelemetryEvent.InitProject,
},
examples: [
{
command: `${process.env.TEAMSFX_CLI_BIN_NAME} init`,
description:
"Initialize current project as a Microsoft 365 Agents Toolkit project, local debug is enabled by default",
},
{
command: `${process.env.TEAMSFX_CLI_BIN_NAME} init --remote true`,
description:
"Initialize current project as a Microsoft 365 Agents Toolkit project including remote deployment configuration",
},
{
command: `${process.env.TEAMSFX_CLI_BIN_NAME} init --playground true --local false`,
description:
"Initialize current project as a Microsoft 365 Agents Toolkit project with Playground debug option only",
},
],
handler: async (ctx) => {
const inputs = ctx.optionValues;
const core = getFxCore();
const result = await core.generateConfigFiles(inputs as Inputs);
if (result.isErr()) {
return err(result.error);
}
return ok(undefined);
},
};
41 changes: 41 additions & 0 deletions packages/cli/src/commands/models/init/initOption.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { CLICommandOption } from "@microsoft/teamsfx-api";

export const playgroundOption: CLICommandOption = {
name: "playground",
questionName: "include-playground",
description: "include playground configuration files.",
type: "boolean",
required: true,
default: true,
};

export const localDebugOption: CLICommandOption = {
name: "local",
questionName: "include-local",
description: "include local debug configuration files.",
type: "boolean",
required: true,
default: true,
};

export const remoteDeployOption: CLICommandOption = {
name: "remote",
questionName: "include-remote",
description: "include remote deploy configuration files.",
type: "boolean",
required: true,
default: false,
};

export const programmingLanguageOption: CLICommandOption = {
name: "language",
questionName: "programming-language",
description: "specify the programming language.",
type: "string",
required: true,
default: "typescript",
choices: ["typescript"],
};
2 changes: 2 additions & 0 deletions packages/cli/src/commands/models/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { getCreateCommand } from "./create";
import { deployCommand } from "./deploy";
import { entraAppCommand } from "./entraAppUpdate";
import { envCommand } from "./env";
import { initCommand } from "./init/init";
import { listCommand } from "./list";
import { m365LaunchInfoCommand } from "./m365LaunchInfo";
import { m365SideloadingCommand } from "./m365Sideloading";
Expand Down Expand Up @@ -58,6 +59,7 @@ export const rootCommand: CLICommand = {
envCommand,
permissionCommand,
upgradeCommand,
...(featureFlagManager.getBooleanValue(FeatureFlags.GenerateConfigFiles) ? [initCommand] : []),
listCommand,
helpCommand,
teamsappUpdateCommand,
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/resource/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
"env.reset": {
"description": "Reset environment file."
},
"init": {
"description": "Initialize an existing project to Microsoft 365 Agents Toolkit project."
},
"list": {
"description": "List available app templates and samples."
},
Expand Down
Loading
Loading