Alexa 对话描述语言 (ACDL) 编译器
此软件包包含 ACDL 编译器 API.
资源
安装
npm i @alexa/acdl
国 际
我们建议您使用 askx CLI 与编译器合作, 但是 @alexa/acdl 还包含了自己的CLI, acc,有专为ACDL提供的公用事业.
Usage: acc
Commands:
acc compile compile ACDL module
acc package create a skill-package
acc decompile decompile ASKIR files to ACDL files and
move the ASKIR files to the build directory
acc deploy package and deploy the skill
acc bootstrap-lwa-secrets-manager store LWA refresh token credentials in a
secure AWS Secret managed by AWS Secrets
Manager
acc bootstrap Creates a CloudFormation stack with a
Secure AWS Secret Manager and uploads your
LWA credentials credential to the Secret.
Options:
--version Show version number [boolean]
-v, --verbose Run with verbose logging [boolean] [default: false]
--skip-validation Force the CLI to generate ASKIR without validation.
[boolean] [default: false]
-h, --help Show help [boolean]
项目 API
@alexa/acdl 是一个 TypeScript/JavaScript 库,它暴露了API用于读取,分析和写ACDL和ASKIR模块文件.
以下是一些用于加载、验证和汇编 ACDL 项目的顶级API :
import * as acdl from "@alexa/acdl";
const project = await acdl.loadProject(await acdl.loadProjectConfig("./my-project-path"));
// validate the correctness
const errors = acdl.validateProject(project);
const compiledProject = acdl.compileProject(project);
// synthesize ACDL files to ASKIR modules and write them to the outDir
await acdl.synthesizeProject(project);
await acdl.bundleProject(project);
项目配置
说明 await acdl.loadProjectConfig("./my-project-path");。编译器将尝试从 ask 输入 package.json 或从 ask.json 文件,位于根 ./my-project-path。 。 。 .
例如:
{
"srcDir": "src",
"outDir": "build"
}
此配置指示编译器从中装入 ACDL 和 ASKIR JSON 模块文件 src/ 文件夹并写入所有编译的文件 build/。 。 。 .
src/
-my-dialog.acdl ## file authored by the developer
build/
-my-dialog.json ## file written by the compiler when running
技能软件包套装
产出 bundleProject 是一个有效的 技能软件包 可部署到 SMAPI 软件。 。 。 .
要捆绑一个技能包, 您必须在 ASK 配置中指定您技能的完全合格名称 :
{
"srcDir": "src",
"outDir": "build",
"skill": "org.example.MySkill"
}
A 类 skill-package 文件夹随后将包含在 outDir数字 :
build/
skill-package/
conversations/
-my-dialog.json
response/prompts/
template/
-document.json
interactionModels/custom/
-en-US.json