@anvil-works/anvil-cli 0.8.0-canary.19 → 0.8.0-canary.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -16382,6 +16382,7 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
16382
16382
  }
16383
16383
  if (void 0 !== value.toolbox_item && !isPlainObject(value.toolbox_item)) formTemplateValidation_pushIssue(issues, path("toolbox_item"), "must be an object");
16384
16384
  if (void 0 !== value.layout_metadata && !isPlainObject(value.layout_metadata)) formTemplateValidation_pushIssue(issues, path("layout_metadata"), "must be an object");
16385
+ if (void 0 !== value.help_text && "string" != typeof value.help_text) formTemplateValidation_pushIssue(issues, path("help_text"), "must be a string");
16385
16386
  if (void 0 !== value.item_type) if (isPlainObject(value.item_type)) {
16386
16387
  if ("number" != typeof value.item_type.table_id) formTemplateValidation_pushIssue(issues, path("item_type.table_id"), "must be a number");
16387
16388
  } else formTemplateValidation_pushIssue(issues, path("item_type"), "must be an object");
@@ -16456,7 +16457,8 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
16456
16457
  "toolbox_item",
16457
16458
  "layout_metadata",
16458
16459
  "item_type",
16459
- "slots"
16460
+ "slots",
16461
+ "help_text"
16460
16462
  ]);
16461
16463
  const FRONTMATTER_DISALLOWED_KEYS = new Set([
16462
16464
  "container",
@@ -24029,6 +24031,246 @@ Examples:
24029
24031
  }
24030
24032
  });
24031
24033
  }
24034
+ const external_yaml_namespaceObject = require("yaml");
24035
+ async function encryptSecret(appId, secretName, options = {}) {
24036
+ const anvilUrl = options.anvilUrl ?? await resolveAuthAnvilUrl();
24037
+ const token = await auth_getValidAuthToken(anvilUrl);
24038
+ const response = await fetch(`${anvilUrl}/ide/api/_/apps/${encodeURIComponent(appId)}/secrets/encrypt`, {
24039
+ method: "POST",
24040
+ headers: {
24041
+ Authorization: `Bearer ${token}`,
24042
+ "Content-Type": "application/json"
24043
+ },
24044
+ body: JSON.stringify({
24045
+ name: secretName,
24046
+ ...void 0 === options.secret ? {} : {
24047
+ secret: options.secret
24048
+ }
24049
+ })
24050
+ });
24051
+ if (!response.ok) throw new Error(formatHttpError("Failed to set secret", response.status, await response.text()));
24052
+ return await response.json();
24053
+ }
24054
+ async function generateSecretKey(appId, keyName, options = {}) {
24055
+ const anvilUrl = options.anvilUrl ?? await resolveAuthAnvilUrl();
24056
+ const token = await auth_getValidAuthToken(anvilUrl);
24057
+ const response = await fetch(`${anvilUrl}/ide/api/_/apps/${encodeURIComponent(appId)}/secrets/generate-key`, {
24058
+ method: "POST",
24059
+ headers: {
24060
+ Authorization: `Bearer ${token}`,
24061
+ "Content-Type": "application/json"
24062
+ },
24063
+ body: JSON.stringify({
24064
+ name: keyName
24065
+ })
24066
+ });
24067
+ if (!response.ok) throw new Error(formatHttpError("Failed to generate key", response.status, await response.text()));
24068
+ return await response.json();
24069
+ }
24070
+ function secret_anvilYamlPath(projectRoot) {
24071
+ return external_path_default().join(projectRoot, "anvil.yaml");
24072
+ }
24073
+ function checkSecretTypeInDoc(doc, secretName, type) {
24074
+ const existingType = doc.getIn([
24075
+ "secrets",
24076
+ secretName,
24077
+ "type"
24078
+ ]);
24079
+ if (void 0 !== existingType && existingType !== type) throw new Error(`'${secretName}' is a ${existingType} in anvil.yaml, not a ${type}`);
24080
+ }
24081
+ function secretExistsInDoc(doc, secretName, appId) {
24082
+ return doc.hasIn([
24083
+ "secrets",
24084
+ secretName,
24085
+ "value",
24086
+ appId
24087
+ ]);
24088
+ }
24089
+ async function findSecretInAnvilYaml(projectRoot, secretName, appId) {
24090
+ const doc = (0, external_yaml_namespaceObject.parseDocument)(await external_fs_.promises.readFile(secret_anvilYamlPath(projectRoot), "utf8"));
24091
+ if (!doc.hasIn([
24092
+ "secrets",
24093
+ secretName
24094
+ ])) return;
24095
+ return {
24096
+ type: doc.getIn([
24097
+ "secrets",
24098
+ secretName,
24099
+ "type"
24100
+ ]),
24101
+ existsForApp: secretExistsInDoc(doc, secretName, appId)
24102
+ };
24103
+ }
24104
+ async function writeSecretToAnvilYaml(projectRoot, secretName, options) {
24105
+ const { appId, encrypted, overwrite, type } = options;
24106
+ const filePath = secret_anvilYamlPath(projectRoot);
24107
+ const doc = (0, external_yaml_namespaceObject.parseDocument)(await external_fs_.promises.readFile(filePath, "utf8"));
24108
+ checkSecretTypeInDoc(doc, secretName, type);
24109
+ if (secretExistsInDoc(doc, secretName, appId)) {
24110
+ if (!overwrite) throw new Error(`'${secretName}' already exists for app ${appId} in anvil.yaml`);
24111
+ if (!doc.hasIn([
24112
+ "secrets",
24113
+ secretName,
24114
+ "value",
24115
+ appId,
24116
+ "all"
24117
+ ])) throw new Error(`'${secretName}' for app ${appId} in anvil.yaml cannot be overridden`);
24118
+ }
24119
+ if (doc.hasIn([
24120
+ "secrets",
24121
+ secretName
24122
+ ])) {
24123
+ if (!(0, external_yaml_namespaceObject.isMap)(doc.getIn([
24124
+ "secrets",
24125
+ secretName,
24126
+ "value"
24127
+ ]))) doc.setIn([
24128
+ "secrets",
24129
+ secretName,
24130
+ "value"
24131
+ ], doc.createNode({}));
24132
+ } else doc.setIn([
24133
+ "secrets",
24134
+ secretName
24135
+ ], doc.createNode({
24136
+ type,
24137
+ value: {}
24138
+ }));
24139
+ const value = new external_yaml_namespaceObject.Scalar(encrypted);
24140
+ value.type = external_yaml_namespaceObject.Scalar.QUOTE_DOUBLE;
24141
+ if ((0, external_yaml_namespaceObject.isMap)(doc.getIn([
24142
+ "secrets",
24143
+ secretName,
24144
+ "value",
24145
+ appId
24146
+ ]))) doc.setIn([
24147
+ "secrets",
24148
+ secretName,
24149
+ "value",
24150
+ appId,
24151
+ "all"
24152
+ ], value);
24153
+ else doc.setIn([
24154
+ "secrets",
24155
+ secretName,
24156
+ "value",
24157
+ appId
24158
+ ], doc.createNode({
24159
+ all: value
24160
+ }, {
24161
+ flow: true
24162
+ }));
24163
+ await external_fs_.promises.writeFile(filePath, doc.toString(), "utf8");
24164
+ }
24165
+ function registerSecretCommand(program) {
24166
+ if ("1" !== process.env.ANVIL_AGENT_HOST) return;
24167
+ const secret = program.command("secret").description("Manage app secrets");
24168
+ secret.command("set").description("Set an app secret. The value is read from stdin, or prompted for if stdin is a terminal.").argument("<name>", "Name of the secret").option("--generate", "Have the server autogenerate the secret value instead of reading it").option("-f, --force", "Overwrite the secret if it is already set for this app").action(async (name, options)=>{
24169
+ try {
24170
+ const projectRoot = process.cwd();
24171
+ auth_setRepoContext(projectRoot);
24172
+ const anvilUrl = await resolveAuthAnvilUrl();
24173
+ const appId = await resolvePrimaryAppId(projectRoot, anvilUrl);
24174
+ if (!appId) throw new Error("No Anvil app found in current directory. Make sure you're in a directory with an Anvil app git remote.");
24175
+ const overwrite = await confirmOverwriteIfExists(projectRoot, name, {
24176
+ appId,
24177
+ type: "secret",
24178
+ force: options.force
24179
+ });
24180
+ const value = options.generate ? void 0 : await readSecretValue(name);
24181
+ const response = await encryptSecret(appId, name, {
24182
+ anvilUrl,
24183
+ secret: value
24184
+ });
24185
+ await writeSecretToAnvilYaml(projectRoot, name, {
24186
+ appId,
24187
+ encrypted: response.encrypted,
24188
+ overwrite,
24189
+ type: "secret"
24190
+ });
24191
+ if (getGlobalOutputConfig().jsonMode) logJsonResult(true, {
24192
+ data: {
24193
+ encrypted: response.encrypted
24194
+ }
24195
+ });
24196
+ else logger_logger.info(`Secret '${name}' written to anvil.yaml`);
24197
+ } catch (error) {
24198
+ const message = errors_getErrorMessage(error);
24199
+ if (getGlobalOutputConfig().jsonMode) logJsonResult(false, {
24200
+ error: message
24201
+ });
24202
+ else logger_logger.error(message);
24203
+ process.exit(1);
24204
+ }
24205
+ });
24206
+ secret.command("generate-key").description("Generate an app encryption key. The key is always generated by the server, and its value is never shown.").argument("<name>", "Name of the key").option("-f, --force", "Replace the key if it is already set for this app").action(async (name, options)=>{
24207
+ try {
24208
+ const projectRoot = process.cwd();
24209
+ auth_setRepoContext(projectRoot);
24210
+ const anvilUrl = await resolveAuthAnvilUrl();
24211
+ const appId = await resolvePrimaryAppId(projectRoot, anvilUrl);
24212
+ if (!appId) throw new Error("No Anvil app found in current directory. Make sure you're in a directory with an Anvil app git remote.");
24213
+ const overwrite = await confirmOverwriteIfExists(projectRoot, name, {
24214
+ appId,
24215
+ type: "key",
24216
+ force: options.force
24217
+ });
24218
+ const response = await generateSecretKey(appId, name, {
24219
+ anvilUrl
24220
+ });
24221
+ await writeSecretToAnvilYaml(projectRoot, name, {
24222
+ appId,
24223
+ encrypted: response.encrypted,
24224
+ overwrite,
24225
+ type: "key"
24226
+ });
24227
+ if (getGlobalOutputConfig().jsonMode) logJsonResult(true, {
24228
+ data: {
24229
+ encrypted: response.encrypted
24230
+ }
24231
+ });
24232
+ else logger_logger.info(`Key '${name}' written to anvil.yaml`);
24233
+ } catch (error) {
24234
+ const message = errors_getErrorMessage(error);
24235
+ if (getGlobalOutputConfig().jsonMode) logJsonResult(false, {
24236
+ error: message
24237
+ });
24238
+ else logger_logger.error(message);
24239
+ process.exit(1);
24240
+ }
24241
+ });
24242
+ }
24243
+ async function confirmOverwriteIfExists(projectRoot, name, options) {
24244
+ const { appId, type, force = false } = options;
24245
+ const existing = await findSecretInAnvilYaml(projectRoot, name, appId);
24246
+ if (existing?.type && existing.type !== type) throw new Error(`'${name}' is a ${existing.type} in anvil.yaml, not a ${type}`);
24247
+ if (!existing?.existsForApp) return false;
24248
+ if (force) return true;
24249
+ const message = `'${name}' already exists for app ${appId} in anvil.yaml`;
24250
+ if (!process.stdin.isTTY) throw new Error(`${message}. Use --force to overwrite it.`);
24251
+ if (!await logger_logger.confirm(`${message}. Overwrite it?`, false)) throw new Error(`Not overwriting '${name}'`);
24252
+ return true;
24253
+ }
24254
+ async function readSecretValue(name) {
24255
+ if (process.stdin.isTTY) {
24256
+ const { secret } = await logger_logger.prompt([
24257
+ {
24258
+ type: "password",
24259
+ name: "secret",
24260
+ message: `Value for secret '${name}':`
24261
+ }
24262
+ ]);
24263
+ if (!secret) throw new Error("No secret value entered");
24264
+ return secret;
24265
+ }
24266
+ {
24267
+ const chunks = [];
24268
+ for await (const chunk of process.stdin)chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
24269
+ const secret = Buffer.concat(chunks).toString("utf8").replace(/\r?\n$/, "");
24270
+ if (!secret) throw new Error("No secret value received on stdin");
24271
+ return secret;
24272
+ }
24273
+ }
24032
24274
  const program_packageJson = JSON.parse((0, external_fs_.readFileSync)((0, external_path_namespaceObject.join)(__dirname, "../package.json"), "utf-8"));
24033
24275
  const VERSION = program_packageJson.version;
24034
24276
  setLogger(new CLILogger({
@@ -24452,6 +24694,7 @@ Examples:
24452
24694
  registerDbCommand(program);
24453
24695
  registerEnvCommand(program);
24454
24696
  registerReplCommand(program);
24697
+ registerSecretCommand(program);
24455
24698
  program.command("update").description("Update anvil to the latest version").alias("u").action(async ()=>{
24456
24699
  await handleUpdateCommand();
24457
24700
  });
@@ -16,4 +16,5 @@ export { registerDepsCommand } from "./deps";
16
16
  export { registerDbCommand } from "./db";
17
17
  export { registerEnvCommand } from "./env";
18
18
  export { registerReplCommand } from "./repl";
19
+ export { registerSecretCommand } from "./secret";
19
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,E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 import { Command } from "commander";
2
+ export declare function registerSecretCommand(program: Command): void;
3
+ //# sourceMappingURL=secret.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secret.d.ts","sourceRoot":"","sources":["../../src/commands/secret.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiF5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"formTemplateValidation.d.ts","sourceRoot":"","sources":["../src/formTemplateValidation.ts"],"names":[],"mappings":"AAIA,KAAK,eAAe,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAgSF,KAAK,uBAAuB,GAAG,sBAAsB,GAAG,cAAc,CAAC;AAMvE,wBAAgB,4BAA4B,CACxC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE;IACL,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC3B,GACP,eAAe,EAAE,CAsInB;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,EAAE,CAmF1E"}
1
+ {"version":3,"file":"formTemplateValidation.d.ts","sourceRoot":"","sources":["../src/formTemplateValidation.ts"],"names":[],"mappings":"AAIA,KAAK,eAAe,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAgSF,KAAK,uBAAuB,GAAG,sBAAsB,GAAG,cAAc,CAAC;AAMvE,wBAAgB,4BAA4B,CACxC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE;IACL,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC3B,GACP,eAAe,EAAE,CA0InB;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,EAAE,CAmF1E"}
package/dist/index.js CHANGED
@@ -16423,6 +16423,7 @@ Promise.resolve()
16423
16423
  }
16424
16424
  if (void 0 !== value.toolbox_item && !isPlainObject(value.toolbox_item)) formTemplateValidation_pushIssue(issues, path("toolbox_item"), "must be an object");
16425
16425
  if (void 0 !== value.layout_metadata && !isPlainObject(value.layout_metadata)) formTemplateValidation_pushIssue(issues, path("layout_metadata"), "must be an object");
16426
+ if (void 0 !== value.help_text && "string" != typeof value.help_text) formTemplateValidation_pushIssue(issues, path("help_text"), "must be a string");
16426
16427
  if (void 0 !== value.item_type) if (isPlainObject(value.item_type)) {
16427
16428
  if ("number" != typeof value.item_type.table_id) formTemplateValidation_pushIssue(issues, path("item_type.table_id"), "must be a number");
16428
16429
  } else formTemplateValidation_pushIssue(issues, path("item_type"), "must be an object");
@@ -16497,7 +16498,8 @@ Promise.resolve()
16497
16498
  "toolbox_item",
16498
16499
  "layout_metadata",
16499
16500
  "item_type",
16500
- "slots"
16501
+ "slots",
16502
+ "help_text"
16501
16503
  ]);
16502
16504
  const FRONTMATTER_DISALLOWED_KEYS = new Set([
16503
16505
  "container",
@@ -1 +1 @@
1
- {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgCpC,OAAO,EAAyD,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAiC3G,KAAK,sBAAsB,GAAG,eAAe,GAAG;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAoKF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,MAAM,CAO7F;AAmLD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,EAAE,CAezE;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAwFzD;AAiBD,wBAAgB,YAAY,IAAI,OAAO,CAoGtC"}
1
+ {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiCpC,OAAO,EAAyD,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAiC3G,KAAK,sBAAsB,GAAG,eAAe,GAAG;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAoKF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,MAAM,CAO7F;AAmLD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,EAAE,CAezE;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAwFzD;AAiBD,wBAAgB,YAAY,IAAI,OAAO,CAqGtC"}
@@ -0,0 +1,39 @@
1
+ export interface EncryptSecretOptions {
2
+ anvilUrl?: string;
3
+ /** The secret value. Omit to have the server autogenerate one. */
4
+ secret?: string;
5
+ }
6
+ export interface EncryptSecretResponse {
7
+ plain_text: string;
8
+ encrypted: string;
9
+ }
10
+ /** Set an app secret, returning the encrypted value from the server. */
11
+ export declare function encryptSecret(appId: string, secretName: string, options?: EncryptSecretOptions): Promise<EncryptSecretResponse>;
12
+ export interface GenerateSecretKeyOptions {
13
+ anvilUrl?: string;
14
+ }
15
+ export interface GenerateSecretKeyResponse {
16
+ encrypted: string;
17
+ }
18
+ /** Have the server generate an app encryption key, returning the encrypted value from the server. */
19
+ export declare function generateSecretKey(appId: string, keyName: string, options?: GenerateSecretKeyOptions): Promise<GenerateSecretKeyResponse>;
20
+ export type SecretType = "secret" | "key";
21
+ export interface ExistingSecret {
22
+ type?: SecretType;
23
+ existsForApp: boolean;
24
+ }
25
+ /** Look up `secretName` in `anvil.yaml`. Returns undefined if it isn't defined for any app. */
26
+ export declare function findSecretInAnvilYaml(projectRoot: string, secretName: string, appId: string): Promise<ExistingSecret | undefined>;
27
+ export interface WriteSecretOptions {
28
+ appId: string;
29
+ encrypted: string;
30
+ overwrite: boolean;
31
+ type: SecretType;
32
+ }
33
+ /**
34
+ * Add an encrypted secret for an app to `anvil.yaml`, preserving existing content.
35
+ * Fails if the secret is already defined with a different type, or is already defined for
36
+ * that app, unless `overwrite` is set and the existing definition has an `all` value.
37
+ */
38
+ export declare function writeSecretToAnvilYaml(projectRoot: string, secretName: string, options: WriteSecretOptions): Promise<void>;
39
+ //# sourceMappingURL=secret.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secret.d.ts","sourceRoot":"","sources":["../../src/services/secret.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,wEAAwE;AACxE,wBAAsB,aAAa,CAC/B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,oBAAyB,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAoBhC;AAED,MAAM,WAAW,wBAAwB;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,yBAAyB;IACtC,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,qGAAqG;AACrG,wBAAsB,iBAAiB,CACnC,KAAK,EAAE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,MAAM,GAAG,eAAe,EAAE,CAyClF;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,kBAAkB,GAAG,eAAe,EAAE,CAExF;AAED,wBAAgB,wBAAwB,CACpC,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,SAA4C,EACvD,OAAO,GAAE,+BAAoC,GAC9C,4BAA4B,CA8C9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anvil-works/anvil-cli",
3
- "version": "0.8.0-canary.19",
3
+ "version": "0.8.0-canary.20",
4
4
  "description": "CLI tool for developing Anvil apps locally",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/api.d.ts",