@wraps.dev/cli 2.17.6 → 2.17.8
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
|
@@ -12,9 +12,13 @@ var __export = (target, all6) => {
|
|
|
12
12
|
// ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/esm_shims.js
|
|
13
13
|
import path from "path";
|
|
14
14
|
import { fileURLToPath } from "url";
|
|
15
|
+
var getFilename, getDirname, __dirname;
|
|
15
16
|
var init_esm_shims = __esm({
|
|
16
17
|
"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/esm_shims.js"() {
|
|
17
18
|
"use strict";
|
|
19
|
+
getFilename = () => fileURLToPath(import.meta.url);
|
|
20
|
+
getDirname = () => path.dirname(getFilename());
|
|
21
|
+
__dirname = /* @__PURE__ */ getDirname();
|
|
18
22
|
}
|
|
19
23
|
});
|
|
20
24
|
|
|
@@ -5460,14 +5464,14 @@ async function withLockRetry(fn, options) {
|
|
|
5460
5464
|
throw error;
|
|
5461
5465
|
}
|
|
5462
5466
|
const clack51 = await import("@clack/prompts");
|
|
5463
|
-
const
|
|
5467
|
+
const pc55 = (await import("picocolors")).default;
|
|
5464
5468
|
if (options.autoConfirm) {
|
|
5465
5469
|
clack51.log.warn(
|
|
5466
5470
|
"Stack is locked from a previous interrupted run. Auto-clearing..."
|
|
5467
5471
|
);
|
|
5468
5472
|
} else {
|
|
5469
5473
|
const shouldClear = await clack51.confirm({
|
|
5470
|
-
message: `Stack is locked from a previous interrupted run. ${
|
|
5474
|
+
message: `Stack is locked from a previous interrupted run. ${pc55.yellow("Clear the stale lock and retry?")}`,
|
|
5471
5475
|
initialValue: true
|
|
5472
5476
|
});
|
|
5473
5477
|
if (clack51.isCancel(shouldClear) || !shouldClear) {
|
|
@@ -5622,6 +5626,8 @@ __export(dist_exports, {
|
|
|
5622
5626
|
retentionToDays: () => retentionToDays2
|
|
5623
5627
|
});
|
|
5624
5628
|
import { createHmac } from "crypto";
|
|
5629
|
+
import { dirname as dirname3, join as join8 } from "path";
|
|
5630
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
5625
5631
|
function retentionToDays2(retention) {
|
|
5626
5632
|
switch (retention) {
|
|
5627
5633
|
case "7days":
|
|
@@ -5741,6 +5747,10 @@ function getSMTPConnectionDetails(region) {
|
|
|
5741
5747
|
// Use STARTTLS
|
|
5742
5748
|
};
|
|
5743
5749
|
}
|
|
5750
|
+
function resolvePackagePath(relativePath) {
|
|
5751
|
+
const dir = typeof __dirname !== "undefined" ? __dirname : dirname3(fileURLToPath3(import.meta.url));
|
|
5752
|
+
return join8(dir, "..", relativePath);
|
|
5753
|
+
}
|
|
5744
5754
|
var DEFAULT_EVENT_TYPES, ALL_EVENT_TYPES, DEFAULT_SUPPRESSION_REASONS, DEFAULT_CONFIG_SET_NAME, DEFAULT_MAIL_FROM_SUBDOMAIN, DEFAULT_HISTORY_RETENTION, VERCEL_OIDC_URL, VERCEL_OIDC_THUMBPRINT, RESOURCE_PREFIX, DEFAULT_TAGS, LAMBDA_EVENT_PROCESSOR_PATH, LAMBDA_SMS_EVENT_PROCESSOR_PATH;
|
|
5745
5755
|
var init_dist = __esm({
|
|
5746
5756
|
"../core/dist/index.js"() {
|
|
@@ -5779,14 +5789,12 @@ var init_dist = __esm({
|
|
|
5779
5789
|
DEFAULT_TAGS = {
|
|
5780
5790
|
ManagedBy: "wraps"
|
|
5781
5791
|
};
|
|
5782
|
-
LAMBDA_EVENT_PROCESSOR_PATH =
|
|
5783
|
-
"
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
import.meta.url
|
|
5789
|
-
).pathname;
|
|
5792
|
+
LAMBDA_EVENT_PROCESSOR_PATH = resolvePackagePath(
|
|
5793
|
+
"lambda/event-processor"
|
|
5794
|
+
);
|
|
5795
|
+
LAMBDA_SMS_EVENT_PROCESSOR_PATH = resolvePackagePath(
|
|
5796
|
+
"lambda/sms-event-processor"
|
|
5797
|
+
);
|
|
5790
5798
|
}
|
|
5791
5799
|
});
|
|
5792
5800
|
|
|
@@ -5895,19 +5903,19 @@ import { randomBytes as randomBytes2 } from "crypto";
|
|
|
5895
5903
|
import { existsSync as existsSync7, mkdirSync } from "fs";
|
|
5896
5904
|
import { builtinModules } from "module";
|
|
5897
5905
|
import { tmpdir } from "os";
|
|
5898
|
-
import { dirname as
|
|
5899
|
-
import { fileURLToPath as
|
|
5906
|
+
import { dirname as dirname4, join as join9 } from "path";
|
|
5907
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
5900
5908
|
import * as aws8 from "@pulumi/aws";
|
|
5901
5909
|
import * as pulumi11 from "@pulumi/pulumi";
|
|
5902
5910
|
import { build } from "esbuild";
|
|
5903
5911
|
function getPackageRoot() {
|
|
5904
|
-
const currentFile =
|
|
5905
|
-
let dir =
|
|
5906
|
-
while (dir !==
|
|
5907
|
-
if (existsSync7(
|
|
5912
|
+
const currentFile = fileURLToPath4(import.meta.url);
|
|
5913
|
+
let dir = dirname4(currentFile);
|
|
5914
|
+
while (dir !== dirname4(dir)) {
|
|
5915
|
+
if (existsSync7(join9(dir, "package.json"))) {
|
|
5908
5916
|
return dir;
|
|
5909
5917
|
}
|
|
5910
|
-
dir =
|
|
5918
|
+
dir = dirname4(dir);
|
|
5911
5919
|
}
|
|
5912
5920
|
throw new Error("Could not find package.json");
|
|
5913
5921
|
}
|
|
@@ -5931,17 +5939,17 @@ async function findEventSourceMapping(functionName, queueArn) {
|
|
|
5931
5939
|
}
|
|
5932
5940
|
async function getLambdaCode(functionName) {
|
|
5933
5941
|
const packageRoot = getPackageRoot();
|
|
5934
|
-
const distLambdaPath =
|
|
5935
|
-
const distBundleMarker =
|
|
5942
|
+
const distLambdaPath = join9(packageRoot, "dist", "lambda", functionName);
|
|
5943
|
+
const distBundleMarker = join9(distLambdaPath, ".bundled");
|
|
5936
5944
|
if (existsSync7(distBundleMarker)) {
|
|
5937
5945
|
return distLambdaPath;
|
|
5938
5946
|
}
|
|
5939
|
-
const lambdaPath =
|
|
5940
|
-
const lambdaBundleMarker =
|
|
5947
|
+
const lambdaPath = join9(packageRoot, "lambda", functionName);
|
|
5948
|
+
const lambdaBundleMarker = join9(lambdaPath, ".bundled");
|
|
5941
5949
|
if (existsSync7(lambdaBundleMarker)) {
|
|
5942
5950
|
return lambdaPath;
|
|
5943
5951
|
}
|
|
5944
|
-
const sourcePath =
|
|
5952
|
+
const sourcePath = join9(lambdaPath, "index.ts");
|
|
5945
5953
|
if (!existsSync7(sourcePath)) {
|
|
5946
5954
|
throw new Error(
|
|
5947
5955
|
`Lambda source not found: ${sourcePath}
|
|
@@ -5950,7 +5958,7 @@ Try running: pnpm build`
|
|
|
5950
5958
|
);
|
|
5951
5959
|
}
|
|
5952
5960
|
const buildId = randomBytes2(8).toString("hex");
|
|
5953
|
-
const outdir =
|
|
5961
|
+
const outdir = join9(tmpdir(), `wraps-lambda-${buildId}`);
|
|
5954
5962
|
if (!existsSync7(outdir)) {
|
|
5955
5963
|
mkdirSync(outdir, { recursive: true });
|
|
5956
5964
|
}
|
|
@@ -5960,7 +5968,7 @@ Try running: pnpm build`
|
|
|
5960
5968
|
platform: "node",
|
|
5961
5969
|
target: "node24",
|
|
5962
5970
|
format: "cjs",
|
|
5963
|
-
outfile:
|
|
5971
|
+
outfile: join9(outdir, "index.js"),
|
|
5964
5972
|
external: ["@aws-sdk/*", ...nodeBuiltins],
|
|
5965
5973
|
minify: true,
|
|
5966
5974
|
sourcemap: false
|
|
@@ -6041,8 +6049,8 @@ async function deployLambdaFunctions(config2) {
|
|
|
6041
6049
|
handler: "index.handler",
|
|
6042
6050
|
role: lambdaRole.arn,
|
|
6043
6051
|
code: new pulumi11.asset.FileArchive(eventProcessorCode),
|
|
6044
|
-
timeout:
|
|
6045
|
-
//
|
|
6052
|
+
timeout: 300,
|
|
6053
|
+
// 5 minutes (matches SQS visibility timeout)
|
|
6046
6054
|
memorySize: 512,
|
|
6047
6055
|
environment: lambdaEnvironment,
|
|
6048
6056
|
tags: {
|
|
@@ -6061,8 +6069,8 @@ async function deployLambdaFunctions(config2) {
|
|
|
6061
6069
|
handler: "index.handler",
|
|
6062
6070
|
role: lambdaRole.arn,
|
|
6063
6071
|
code: new pulumi11.asset.FileArchive(eventProcessorCode),
|
|
6064
|
-
timeout:
|
|
6065
|
-
//
|
|
6072
|
+
timeout: 300,
|
|
6073
|
+
// 5 minutes (matches SQS visibility timeout)
|
|
6066
6074
|
memorySize: 512,
|
|
6067
6075
|
environment: lambdaEnvironment,
|
|
6068
6076
|
tags: {
|
|
@@ -9099,14 +9107,173 @@ var init_dynamodb_metrics = __esm({
|
|
|
9099
9107
|
}
|
|
9100
9108
|
});
|
|
9101
9109
|
|
|
9110
|
+
// src/commands/update.ts
|
|
9111
|
+
var update_exports = {};
|
|
9112
|
+
__export(update_exports, {
|
|
9113
|
+
update: () => update
|
|
9114
|
+
});
|
|
9115
|
+
import { execSync as execSync2 } from "child_process";
|
|
9116
|
+
import { createWriteStream, mkdtempSync, rmSync } from "fs";
|
|
9117
|
+
import { homedir as homedir4, tmpdir as tmpdir2 } from "os";
|
|
9118
|
+
import { join as join21 } from "path";
|
|
9119
|
+
import { Readable } from "stream";
|
|
9120
|
+
import { pipeline } from "stream/promises";
|
|
9121
|
+
import { cancel as cancel29, confirm as confirm22, intro as intro49, isCancel as isCancel31, log as log46 } from "@clack/prompts";
|
|
9122
|
+
import pc53 from "picocolors";
|
|
9123
|
+
function isStandaloneInstall() {
|
|
9124
|
+
return process.execPath.includes(".wraps/runtime");
|
|
9125
|
+
}
|
|
9126
|
+
async function fetchLatestVersion() {
|
|
9127
|
+
const res = await fetch(
|
|
9128
|
+
`https://api.github.com/repos/${REPO}/releases?per_page=20`,
|
|
9129
|
+
{
|
|
9130
|
+
headers: { Accept: "application/vnd.github+json" }
|
|
9131
|
+
}
|
|
9132
|
+
);
|
|
9133
|
+
if (!res.ok) {
|
|
9134
|
+
throw new Error(`GitHub API returned ${res.status}`);
|
|
9135
|
+
}
|
|
9136
|
+
const releases = await res.json();
|
|
9137
|
+
for (const release of releases) {
|
|
9138
|
+
if (release.tag_name.startsWith("cli@")) {
|
|
9139
|
+
const version = release.tag_name.replace("cli@", "");
|
|
9140
|
+
return { version, release };
|
|
9141
|
+
}
|
|
9142
|
+
}
|
|
9143
|
+
return null;
|
|
9144
|
+
}
|
|
9145
|
+
function detectPlatformArch() {
|
|
9146
|
+
const platform2 = process.platform === "darwin" ? "darwin" : "linux";
|
|
9147
|
+
const arch = process.arch === "arm64" ? "arm64" : "x64";
|
|
9148
|
+
return { platform: platform2, arch };
|
|
9149
|
+
}
|
|
9150
|
+
async function update(currentVersion) {
|
|
9151
|
+
intro49(pc53.bold("Wraps CLI Update"));
|
|
9152
|
+
const progress = new DeploymentProgress();
|
|
9153
|
+
const result = await progress.execute(
|
|
9154
|
+
"Checking for updates...",
|
|
9155
|
+
() => fetchLatestVersion()
|
|
9156
|
+
);
|
|
9157
|
+
if (!result) {
|
|
9158
|
+
progress.fail("Could not determine latest version from GitHub releases.");
|
|
9159
|
+
return;
|
|
9160
|
+
}
|
|
9161
|
+
const { version: latestVersion, release } = result;
|
|
9162
|
+
if (currentVersion === latestVersion) {
|
|
9163
|
+
progress.succeed(`Already up to date ${pc53.dim(`(v${currentVersion})`)}`);
|
|
9164
|
+
return;
|
|
9165
|
+
}
|
|
9166
|
+
console.log();
|
|
9167
|
+
log46.info(
|
|
9168
|
+
`Current version: ${pc53.dim(`v${currentVersion}`)}
|
|
9169
|
+
Latest version: ${pc53.cyan(`v${latestVersion}`)}`
|
|
9170
|
+
);
|
|
9171
|
+
console.log();
|
|
9172
|
+
if (!isStandaloneInstall()) {
|
|
9173
|
+
log46.info(
|
|
9174
|
+
`You installed Wraps via npm. Update with:
|
|
9175
|
+
|
|
9176
|
+
${pc53.cyan("npm update -g @wraps.dev/cli")}`
|
|
9177
|
+
);
|
|
9178
|
+
return;
|
|
9179
|
+
}
|
|
9180
|
+
const shouldUpdate = await confirm22({
|
|
9181
|
+
message: `Update to v${latestVersion}?`
|
|
9182
|
+
});
|
|
9183
|
+
if (isCancel31(shouldUpdate) || !shouldUpdate) {
|
|
9184
|
+
cancel29("Update cancelled.");
|
|
9185
|
+
return;
|
|
9186
|
+
}
|
|
9187
|
+
const { platform: platform2, arch } = detectPlatformArch();
|
|
9188
|
+
const tarballName = `wraps-${latestVersion}-${platform2}-${arch}.tar.gz`;
|
|
9189
|
+
const tarballAsset = release.assets.find((a) => a.name === tarballName);
|
|
9190
|
+
const checksumAsset = release.assets.find(
|
|
9191
|
+
(a) => a.name === "CHECKSUMS.sha256"
|
|
9192
|
+
);
|
|
9193
|
+
if (!tarballAsset) {
|
|
9194
|
+
progress.fail(
|
|
9195
|
+
`No release asset found for ${platform2}-${arch}. Download manually from GitHub.`
|
|
9196
|
+
);
|
|
9197
|
+
return;
|
|
9198
|
+
}
|
|
9199
|
+
const tmp = mkdtempSync(join21(tmpdir2(), "wraps-update-"));
|
|
9200
|
+
try {
|
|
9201
|
+
const tarballPath = join21(tmp, tarballName);
|
|
9202
|
+
await progress.execute(`Downloading ${tarballName}...`, async () => {
|
|
9203
|
+
const res = await fetch(tarballAsset.browser_download_url, {
|
|
9204
|
+
redirect: "follow"
|
|
9205
|
+
});
|
|
9206
|
+
if (!(res.ok && res.body)) {
|
|
9207
|
+
throw new Error(`Download failed: ${res.status}`);
|
|
9208
|
+
}
|
|
9209
|
+
const nodeStream = Readable.fromWeb(
|
|
9210
|
+
res.body
|
|
9211
|
+
);
|
|
9212
|
+
await pipeline(nodeStream, createWriteStream(tarballPath));
|
|
9213
|
+
});
|
|
9214
|
+
if (checksumAsset) {
|
|
9215
|
+
await progress.execute("Verifying checksum...", async () => {
|
|
9216
|
+
const res = await fetch(checksumAsset.browser_download_url, {
|
|
9217
|
+
redirect: "follow"
|
|
9218
|
+
});
|
|
9219
|
+
if (!res.ok) {
|
|
9220
|
+
throw new Error(`Checksum download failed: ${res.status}`);
|
|
9221
|
+
}
|
|
9222
|
+
const checksumText = await res.text();
|
|
9223
|
+
const line = checksumText.split("\n").find((l) => l.includes(tarballName));
|
|
9224
|
+
if (!line) {
|
|
9225
|
+
throw new Error("Tarball not found in CHECKSUMS.sha256");
|
|
9226
|
+
}
|
|
9227
|
+
const expected = line.split(WHITESPACE_RE)[0];
|
|
9228
|
+
const shaCmd = process.platform === "darwin" ? "shasum -a 256" : "sha256sum";
|
|
9229
|
+
const actual = execSync2(`${shaCmd} "${tarballPath}"`).toString().split(WHITESPACE_RE)[0];
|
|
9230
|
+
if (expected !== actual) {
|
|
9231
|
+
throw new Error(
|
|
9232
|
+
`Checksum mismatch (expected ${expected}, got ${actual})`
|
|
9233
|
+
);
|
|
9234
|
+
}
|
|
9235
|
+
});
|
|
9236
|
+
}
|
|
9237
|
+
await progress.execute("Installing update...", async () => {
|
|
9238
|
+
const extractDir = join21(tmp, "extract");
|
|
9239
|
+
execSync2(`mkdir -p "${extractDir}"`);
|
|
9240
|
+
execSync2(`tar xzf "${tarballPath}" -C "${extractDir}"`);
|
|
9241
|
+
const source = join21(extractDir, "wraps");
|
|
9242
|
+
for (const dir of ["bin", "runtime", "lib"]) {
|
|
9243
|
+
execSync2(`rm -rf "${join21(INSTALL_DIR, dir)}"`);
|
|
9244
|
+
execSync2(`cp -R "${join21(source, dir)}" "${join21(INSTALL_DIR, dir)}"`);
|
|
9245
|
+
}
|
|
9246
|
+
execSync2(`chmod +x "${join21(INSTALL_DIR, "bin", "wraps")}"`);
|
|
9247
|
+
execSync2(`chmod +x "${join21(INSTALL_DIR, "runtime", "node")}"`);
|
|
9248
|
+
});
|
|
9249
|
+
console.log();
|
|
9250
|
+
progress.succeed(
|
|
9251
|
+
`Updated to ${pc53.cyan(`v${latestVersion}`)} successfully!`
|
|
9252
|
+
);
|
|
9253
|
+
} finally {
|
|
9254
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
9255
|
+
}
|
|
9256
|
+
}
|
|
9257
|
+
var REPO, INSTALL_DIR, WHITESPACE_RE;
|
|
9258
|
+
var init_update = __esm({
|
|
9259
|
+
"src/commands/update.ts"() {
|
|
9260
|
+
"use strict";
|
|
9261
|
+
init_esm_shims();
|
|
9262
|
+
init_output();
|
|
9263
|
+
REPO = "wraps-team/wraps";
|
|
9264
|
+
INSTALL_DIR = join21(homedir4(), ".wraps");
|
|
9265
|
+
WHITESPACE_RE = /\s+/;
|
|
9266
|
+
}
|
|
9267
|
+
});
|
|
9268
|
+
|
|
9102
9269
|
// src/cli.ts
|
|
9103
9270
|
init_esm_shims();
|
|
9104
9271
|
import { readFileSync as readFileSync3 } from "fs";
|
|
9105
|
-
import { dirname as
|
|
9106
|
-
import { fileURLToPath as
|
|
9272
|
+
import { dirname as dirname5, join as join22 } from "path";
|
|
9273
|
+
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
9107
9274
|
import * as clack50 from "@clack/prompts";
|
|
9108
9275
|
import args from "args";
|
|
9109
|
-
import
|
|
9276
|
+
import pc54 from "picocolors";
|
|
9110
9277
|
|
|
9111
9278
|
// src/commands/auth/login.ts
|
|
9112
9279
|
init_esm_shims();
|
|
@@ -16980,8 +17147,8 @@ async function createSQSResources() {
|
|
|
16980
17147
|
});
|
|
16981
17148
|
const queue = new aws11.sqs.Queue("wraps-email-events", {
|
|
16982
17149
|
name: "wraps-email-events",
|
|
16983
|
-
visibilityTimeoutSeconds:
|
|
16984
|
-
// Must be >= Lambda timeout
|
|
17150
|
+
visibilityTimeoutSeconds: 300,
|
|
17151
|
+
// Must be >= Lambda timeout (5 minutes)
|
|
16985
17152
|
messageRetentionSeconds: 345600,
|
|
16986
17153
|
// 4 days
|
|
16987
17154
|
receiveWaitTimeSeconds: 20,
|
|
@@ -21738,7 +21905,7 @@ init_json_output();
|
|
|
21738
21905
|
init_output();
|
|
21739
21906
|
import { existsSync as existsSync9 } from "fs";
|
|
21740
21907
|
import { mkdir as mkdir3, readFile as readFile4, writeFile as writeFile5 } from "fs/promises";
|
|
21741
|
-
import { join as
|
|
21908
|
+
import { join as join11 } from "path";
|
|
21742
21909
|
import * as clack26 from "@clack/prompts";
|
|
21743
21910
|
import pc27 from "picocolors";
|
|
21744
21911
|
|
|
@@ -21746,7 +21913,7 @@ import pc27 from "picocolors";
|
|
|
21746
21913
|
init_esm_shims();
|
|
21747
21914
|
import { existsSync as existsSync8 } from "fs";
|
|
21748
21915
|
import { mkdir as mkdir2, readFile as readFile3, writeFile as writeFile4 } from "fs/promises";
|
|
21749
|
-
import { join as
|
|
21916
|
+
import { join as join10 } from "path";
|
|
21750
21917
|
var CLAUDE_MD_HEADER = `# Wraps
|
|
21751
21918
|
|
|
21752
21919
|
This project uses [Wraps](https://wraps.dev) for email infrastructure.
|
|
@@ -21756,8 +21923,8 @@ async function scaffoldClaudeMdSection({
|
|
|
21756
21923
|
sectionId,
|
|
21757
21924
|
sectionContent
|
|
21758
21925
|
}) {
|
|
21759
|
-
const claudeDir =
|
|
21760
|
-
const claudeMdPath =
|
|
21926
|
+
const claudeDir = join10(projectDir, ".claude");
|
|
21927
|
+
const claudeMdPath = join10(claudeDir, "CLAUDE.md");
|
|
21761
21928
|
await mkdir2(claudeDir, { recursive: true });
|
|
21762
21929
|
const startMarker = `<!-- wraps:${sectionId}-start -->`;
|
|
21763
21930
|
const endMarker = `<!-- wraps:${sectionId}-end -->`;
|
|
@@ -21798,8 +21965,8 @@ async function scaffoldClaudeSkill({
|
|
|
21798
21965
|
skillName,
|
|
21799
21966
|
skillContent
|
|
21800
21967
|
}) {
|
|
21801
|
-
const skillDir =
|
|
21802
|
-
const skillPath =
|
|
21968
|
+
const skillDir = join10(projectDir, ".claude", "skills", skillName);
|
|
21969
|
+
const skillPath = join10(skillDir, "SKILL.md");
|
|
21803
21970
|
await mkdir2(skillDir, { recursive: true });
|
|
21804
21971
|
await writeFile4(skillPath, `${skillContent.trim()}
|
|
21805
21972
|
`, "utf-8");
|
|
@@ -22184,7 +22351,7 @@ wraps email templates preview # Preview in browser
|
|
|
22184
22351
|
async function templatesInit(options) {
|
|
22185
22352
|
const startTime = Date.now();
|
|
22186
22353
|
const cwd = process.cwd();
|
|
22187
|
-
const wrapsDir =
|
|
22354
|
+
const wrapsDir = join11(cwd, "wraps");
|
|
22188
22355
|
if (!isJsonMode()) {
|
|
22189
22356
|
clack26.intro(pc27.bold("Templates as Code"));
|
|
22190
22357
|
}
|
|
@@ -22224,7 +22391,7 @@ async function templatesInit(options) {
|
|
|
22224
22391
|
let detectedDomain;
|
|
22225
22392
|
let detectedRegion;
|
|
22226
22393
|
try {
|
|
22227
|
-
const pkgPath =
|
|
22394
|
+
const pkgPath = join11(cwd, "package.json");
|
|
22228
22395
|
if (existsSync9(pkgPath)) {
|
|
22229
22396
|
const pkg = JSON.parse(await readFile4(pkgPath, "utf-8"));
|
|
22230
22397
|
if (pkg.homepage) {
|
|
@@ -22238,8 +22405,8 @@ async function templatesInit(options) {
|
|
|
22238
22405
|
} catch {
|
|
22239
22406
|
}
|
|
22240
22407
|
try {
|
|
22241
|
-
const { homedir:
|
|
22242
|
-
const connectionsDir =
|
|
22408
|
+
const { homedir: homedir5 } = await import("os");
|
|
22409
|
+
const connectionsDir = join11(homedir5(), ".wraps", "connections");
|
|
22243
22410
|
if (existsSync9(connectionsDir)) {
|
|
22244
22411
|
const { readdir: readdir5 } = await import("fs/promises");
|
|
22245
22412
|
const files = await readdir5(connectionsDir);
|
|
@@ -22255,33 +22422,33 @@ async function templatesInit(options) {
|
|
|
22255
22422
|
}
|
|
22256
22423
|
progress.start("Creating wraps/ directory structure");
|
|
22257
22424
|
await mkdir3(wrapsDir, { recursive: true });
|
|
22258
|
-
await mkdir3(
|
|
22259
|
-
await mkdir3(
|
|
22260
|
-
await mkdir3(
|
|
22261
|
-
await mkdir3(
|
|
22425
|
+
await mkdir3(join11(wrapsDir, "templates"), { recursive: true });
|
|
22426
|
+
await mkdir3(join11(wrapsDir, "templates", "_components"), { recursive: true });
|
|
22427
|
+
await mkdir3(join11(wrapsDir, "workflows"), { recursive: true });
|
|
22428
|
+
await mkdir3(join11(wrapsDir, ".wraps"), { recursive: true });
|
|
22262
22429
|
const configContent = generateConfigFile(
|
|
22263
22430
|
orgSlug,
|
|
22264
22431
|
detectedDomain,
|
|
22265
22432
|
detectedRegion
|
|
22266
22433
|
);
|
|
22267
|
-
await writeFile5(
|
|
22434
|
+
await writeFile5(join11(wrapsDir, "wraps.config.ts"), configContent, "utf-8");
|
|
22268
22435
|
const brandContent = generateBrandFile();
|
|
22269
|
-
await writeFile5(
|
|
22436
|
+
await writeFile5(join11(wrapsDir, "brand.ts"), brandContent, "utf-8");
|
|
22270
22437
|
if (!options.noExample) {
|
|
22271
22438
|
await writeFile5(
|
|
22272
|
-
|
|
22439
|
+
join11(wrapsDir, "templates", "welcome.tsx"),
|
|
22273
22440
|
generateWelcomeTemplate(),
|
|
22274
22441
|
"utf-8"
|
|
22275
22442
|
);
|
|
22276
22443
|
await writeFile5(
|
|
22277
|
-
|
|
22444
|
+
join11(wrapsDir, "templates", "_components", "footer.tsx"),
|
|
22278
22445
|
generateFooterComponent(),
|
|
22279
22446
|
"utf-8"
|
|
22280
22447
|
);
|
|
22281
22448
|
}
|
|
22282
|
-
const gitignorePath =
|
|
22449
|
+
const gitignorePath = join11(wrapsDir, ".gitignore");
|
|
22283
22450
|
await writeFile5(gitignorePath, ".wraps/\n", "utf-8");
|
|
22284
|
-
const rootGitignorePath =
|
|
22451
|
+
const rootGitignorePath = join11(cwd, ".gitignore");
|
|
22285
22452
|
if (existsSync9(rootGitignorePath)) {
|
|
22286
22453
|
const gitignoreContent = await readFile4(rootGitignorePath, "utf-8");
|
|
22287
22454
|
if (!gitignoreContent.includes("wraps/.wraps")) {
|
|
@@ -22554,7 +22721,7 @@ const unsubscribeLink = {
|
|
|
22554
22721
|
init_esm_shims();
|
|
22555
22722
|
init_events();
|
|
22556
22723
|
import { existsSync as existsSync11, watch } from "fs";
|
|
22557
|
-
import { join as
|
|
22724
|
+
import { join as join13 } from "path";
|
|
22558
22725
|
import * as clack27 from "@clack/prompts";
|
|
22559
22726
|
import pc28 from "picocolors";
|
|
22560
22727
|
|
|
@@ -22562,14 +22729,14 @@ import pc28 from "picocolors";
|
|
|
22562
22729
|
init_esm_shims();
|
|
22563
22730
|
import { existsSync as existsSync10 } from "fs";
|
|
22564
22731
|
import { mkdir as mkdir4, readdir as readdir3, writeFile as writeFile6 } from "fs/promises";
|
|
22565
|
-
import { join as
|
|
22732
|
+
import { join as join12 } from "path";
|
|
22566
22733
|
async function loadWrapsConfig(wrapsDir) {
|
|
22567
|
-
const configPath =
|
|
22734
|
+
const configPath = join12(wrapsDir, "wraps.config.ts");
|
|
22568
22735
|
const { build: build2 } = await import("esbuild");
|
|
22569
|
-
const shimDir =
|
|
22736
|
+
const shimDir = join12(wrapsDir, ".wraps", "_shims");
|
|
22570
22737
|
await mkdir4(shimDir, { recursive: true });
|
|
22571
22738
|
await writeFile6(
|
|
22572
|
-
|
|
22739
|
+
join12(shimDir, "wraps-client-shim.mjs"),
|
|
22573
22740
|
"export const defineConfig = (c) => c;\nexport const defineBrand = (b) => b;\n",
|
|
22574
22741
|
"utf-8"
|
|
22575
22742
|
);
|
|
@@ -22581,11 +22748,11 @@ async function loadWrapsConfig(wrapsDir) {
|
|
|
22581
22748
|
platform: "node",
|
|
22582
22749
|
target: "node20",
|
|
22583
22750
|
alias: {
|
|
22584
|
-
"@wraps.dev/client":
|
|
22751
|
+
"@wraps.dev/client": join12(shimDir, "wraps-client-shim.mjs")
|
|
22585
22752
|
}
|
|
22586
22753
|
});
|
|
22587
22754
|
const code = result.outputFiles[0].text;
|
|
22588
|
-
const tmpPath =
|
|
22755
|
+
const tmpPath = join12(wrapsDir, ".wraps", "_config.mjs");
|
|
22589
22756
|
await writeFile6(tmpPath, code, "utf-8");
|
|
22590
22757
|
const mod = await import(tmpPath);
|
|
22591
22758
|
const config2 = mod.default;
|
|
@@ -22610,7 +22777,7 @@ async function findCliNodeModules() {
|
|
|
22610
22777
|
const paths = [];
|
|
22611
22778
|
try {
|
|
22612
22779
|
const { createRequire } = await import("module");
|
|
22613
|
-
const { dirname:
|
|
22780
|
+
const { dirname: dirname6 } = await import("path");
|
|
22614
22781
|
for (const base of [
|
|
22615
22782
|
// The current file's location (works when running from source)
|
|
22616
22783
|
import.meta.url,
|
|
@@ -22620,8 +22787,8 @@ async function findCliNodeModules() {
|
|
|
22620
22787
|
try {
|
|
22621
22788
|
const req = createRequire(base);
|
|
22622
22789
|
const reactPkg = req.resolve("react/package.json");
|
|
22623
|
-
const reactNodeModules =
|
|
22624
|
-
if (existsSync10(
|
|
22790
|
+
const reactNodeModules = join12(dirname6(reactPkg), "..");
|
|
22791
|
+
if (existsSync10(join12(reactNodeModules, "react"))) {
|
|
22625
22792
|
paths.push(reactNodeModules);
|
|
22626
22793
|
break;
|
|
22627
22794
|
}
|
|
@@ -22649,10 +22816,10 @@ async function compileForPreview(filePath, slug, wrapsDir) {
|
|
|
22649
22816
|
}
|
|
22650
22817
|
});
|
|
22651
22818
|
const bundledCode = result.outputFiles[0].text;
|
|
22652
|
-
const projectRoot =
|
|
22653
|
-
const tmpDir =
|
|
22819
|
+
const projectRoot = join12(wrapsDir, "..");
|
|
22820
|
+
const tmpDir = join12(projectRoot, "node_modules", ".wraps-compiled");
|
|
22654
22821
|
await mkdir4(tmpDir, { recursive: true });
|
|
22655
|
-
const tmpPath =
|
|
22822
|
+
const tmpPath = join12(tmpDir, `${slug}.preview.mjs`);
|
|
22656
22823
|
await writeFile6(tmpPath, bundledCode, "utf-8");
|
|
22657
22824
|
const mod = await import(`${tmpPath}?t=${Date.now()}`);
|
|
22658
22825
|
const Component = mod.default;
|
|
@@ -22675,14 +22842,14 @@ async function compileForPreview(filePath, slug, wrapsDir) {
|
|
|
22675
22842
|
init_errors();
|
|
22676
22843
|
async function templatesPreview(options) {
|
|
22677
22844
|
const cwd = process.cwd();
|
|
22678
|
-
const wrapsDir =
|
|
22679
|
-
const configPath =
|
|
22845
|
+
const wrapsDir = join13(cwd, "wraps");
|
|
22846
|
+
const configPath = join13(wrapsDir, "wraps.config.ts");
|
|
22680
22847
|
if (!existsSync11(configPath)) {
|
|
22681
22848
|
throw errors.wrapsConfigNotFound();
|
|
22682
22849
|
}
|
|
22683
22850
|
clack27.intro(pc28.bold("Preview Templates"));
|
|
22684
22851
|
const config2 = await loadWrapsConfig(wrapsDir);
|
|
22685
|
-
const templatesDir =
|
|
22852
|
+
const templatesDir = join13(wrapsDir, config2.templatesDir || "./templates");
|
|
22686
22853
|
if (!existsSync11(templatesDir)) {
|
|
22687
22854
|
throw errors.wrapsConfigNotFound();
|
|
22688
22855
|
}
|
|
@@ -22702,7 +22869,7 @@ async function templatesPreview(options) {
|
|
|
22702
22869
|
throw new Error(`Template not found: ${slug}`);
|
|
22703
22870
|
}
|
|
22704
22871
|
const result = await compileForPreview(
|
|
22705
|
-
|
|
22872
|
+
join13(templatesDir, file),
|
|
22706
22873
|
slug,
|
|
22707
22874
|
wrapsDir
|
|
22708
22875
|
);
|
|
@@ -23006,7 +23173,7 @@ init_events();
|
|
|
23006
23173
|
import { createHash } from "crypto";
|
|
23007
23174
|
import { existsSync as existsSync13 } from "fs";
|
|
23008
23175
|
import { mkdir as mkdir6, readFile as readFile6, writeFile as writeFile8 } from "fs/promises";
|
|
23009
|
-
import { join as
|
|
23176
|
+
import { join as join15 } from "path";
|
|
23010
23177
|
import * as clack28 from "@clack/prompts";
|
|
23011
23178
|
import pc29 from "picocolors";
|
|
23012
23179
|
init_config();
|
|
@@ -23017,9 +23184,9 @@ init_json_output();
|
|
|
23017
23184
|
init_esm_shims();
|
|
23018
23185
|
import { existsSync as existsSync12 } from "fs";
|
|
23019
23186
|
import { mkdir as mkdir5, readFile as readFile5, writeFile as writeFile7 } from "fs/promises";
|
|
23020
|
-
import { join as
|
|
23187
|
+
import { join as join14 } from "path";
|
|
23021
23188
|
function getLockfilePath(wrapsDir) {
|
|
23022
|
-
return
|
|
23189
|
+
return join14(wrapsDir, ".wraps", "lockfile.json");
|
|
23023
23190
|
}
|
|
23024
23191
|
async function loadLockfile(wrapsDir) {
|
|
23025
23192
|
const path3 = getLockfilePath(wrapsDir);
|
|
@@ -23042,7 +23209,7 @@ async function loadLockfile(wrapsDir) {
|
|
|
23042
23209
|
}
|
|
23043
23210
|
async function saveLockfile(wrapsDir, lockfile) {
|
|
23044
23211
|
const path3 = getLockfilePath(wrapsDir);
|
|
23045
|
-
const dir =
|
|
23212
|
+
const dir = join14(path3, "..");
|
|
23046
23213
|
await mkdir5(dir, { recursive: true });
|
|
23047
23214
|
await writeFile7(path3, JSON.stringify(lockfile, null, 2), "utf-8");
|
|
23048
23215
|
}
|
|
@@ -23052,8 +23219,8 @@ init_output();
|
|
|
23052
23219
|
async function templatesPush(options) {
|
|
23053
23220
|
const startTime = Date.now();
|
|
23054
23221
|
const cwd = process.cwd();
|
|
23055
|
-
const wrapsDir =
|
|
23056
|
-
const configPath =
|
|
23222
|
+
const wrapsDir = join15(cwd, "wraps");
|
|
23223
|
+
const configPath = join15(wrapsDir, "wraps.config.ts");
|
|
23057
23224
|
if (!existsSync13(configPath)) {
|
|
23058
23225
|
throw errors.wrapsConfigNotFound();
|
|
23059
23226
|
}
|
|
@@ -23064,7 +23231,7 @@ async function templatesPush(options) {
|
|
|
23064
23231
|
progress.start("Loading configuration");
|
|
23065
23232
|
const config2 = await loadWrapsConfig(wrapsDir);
|
|
23066
23233
|
progress.succeed("Configuration loaded");
|
|
23067
|
-
const templatesDir =
|
|
23234
|
+
const templatesDir = join15(wrapsDir, config2.templatesDir || "./templates");
|
|
23068
23235
|
if (!existsSync13(templatesDir)) {
|
|
23069
23236
|
throw errors.wrapsConfigNotFound();
|
|
23070
23237
|
}
|
|
@@ -23083,7 +23250,7 @@ async function templatesPush(options) {
|
|
|
23083
23250
|
const compileErrors = [];
|
|
23084
23251
|
for (const file of templateFiles) {
|
|
23085
23252
|
const slug = file.replace(/\.tsx?$/, "");
|
|
23086
|
-
const filePath =
|
|
23253
|
+
const filePath = join15(templatesDir, file);
|
|
23087
23254
|
const source = await readFile6(filePath, "utf-8");
|
|
23088
23255
|
const sourceHash = sha256(source);
|
|
23089
23256
|
const localHashMatches = lockfile.templates[slug]?.localHash === sourceHash;
|
|
@@ -23225,10 +23392,10 @@ async function compileTemplate(filePath, slug, source, sourceHash, wrapsDir) {
|
|
|
23225
23392
|
}
|
|
23226
23393
|
});
|
|
23227
23394
|
const bundledCode = result.outputFiles[0].text;
|
|
23228
|
-
const projectRoot =
|
|
23229
|
-
const tmpDir =
|
|
23395
|
+
const projectRoot = join15(wrapsDir, "..");
|
|
23396
|
+
const tmpDir = join15(projectRoot, "node_modules", ".wraps-compiled");
|
|
23230
23397
|
await mkdir6(tmpDir, { recursive: true });
|
|
23231
|
-
const tmpPath =
|
|
23398
|
+
const tmpPath = join15(tmpDir, `${slug}.mjs`);
|
|
23232
23399
|
await writeFile8(tmpPath, bundledCode, "utf-8");
|
|
23233
23400
|
const mod = await import(tmpPath);
|
|
23234
23401
|
const Component = mod.default;
|
|
@@ -25534,7 +25701,7 @@ init_json_output();
|
|
|
25534
25701
|
init_output();
|
|
25535
25702
|
import { existsSync as existsSync14 } from "fs";
|
|
25536
25703
|
import { mkdir as mkdir7, readFile as readFile7, writeFile as writeFile9 } from "fs/promises";
|
|
25537
|
-
import { join as
|
|
25704
|
+
import { join as join16 } from "path";
|
|
25538
25705
|
import * as clack30 from "@clack/prompts";
|
|
25539
25706
|
import pc31 from "picocolors";
|
|
25540
25707
|
|
|
@@ -25925,7 +26092,7 @@ export default defineWorkflow({
|
|
|
25925
26092
|
async function workflowsInit(options) {
|
|
25926
26093
|
const startTime = Date.now();
|
|
25927
26094
|
const cwd = process.cwd();
|
|
25928
|
-
const workflowsDir =
|
|
26095
|
+
const workflowsDir = join16(cwd, "wraps", "workflows");
|
|
25929
26096
|
if (!isJsonMode()) {
|
|
25930
26097
|
clack30.intro(pc31.bold("Workflows as Code"));
|
|
25931
26098
|
}
|
|
@@ -25944,7 +26111,7 @@ async function workflowsInit(options) {
|
|
|
25944
26111
|
}
|
|
25945
26112
|
progress.start("Creating wraps/workflows/ directory");
|
|
25946
26113
|
await mkdir7(workflowsDir, { recursive: true });
|
|
25947
|
-
const configPath =
|
|
26114
|
+
const configPath = join16(cwd, "wraps", "wraps.config.ts");
|
|
25948
26115
|
if (existsSync14(configPath)) {
|
|
25949
26116
|
const configContent = await readFile7(configPath, "utf-8");
|
|
25950
26117
|
if (!configContent.includes("workflowsDir")) {
|
|
@@ -25962,7 +26129,7 @@ async function workflowsInit(options) {
|
|
|
25962
26129
|
}
|
|
25963
26130
|
const filesCreated = [];
|
|
25964
26131
|
if (!options.noExample) {
|
|
25965
|
-
const examplePath =
|
|
26132
|
+
const examplePath = join16(workflowsDir, "welcome.ts");
|
|
25966
26133
|
if (!existsSync14(examplePath) || options.force) {
|
|
25967
26134
|
await writeFile9(examplePath, EXAMPLE_WORKFLOW, "utf-8");
|
|
25968
26135
|
filesCreated.push("wraps/workflows/welcome.ts");
|
|
@@ -26046,7 +26213,7 @@ export default defineConfig({
|
|
|
26046
26213
|
init_esm_shims();
|
|
26047
26214
|
init_events();
|
|
26048
26215
|
import { existsSync as existsSync16 } from "fs";
|
|
26049
|
-
import { join as
|
|
26216
|
+
import { join as join18 } from "path";
|
|
26050
26217
|
import * as clack31 from "@clack/prompts";
|
|
26051
26218
|
import pc32 from "picocolors";
|
|
26052
26219
|
|
|
@@ -26267,7 +26434,7 @@ init_esm_shims();
|
|
|
26267
26434
|
import { createHash as createHash2 } from "crypto";
|
|
26268
26435
|
import { existsSync as existsSync15 } from "fs";
|
|
26269
26436
|
import { mkdir as mkdir8, readdir as readdir4, readFile as readFile8, writeFile as writeFile10 } from "fs/promises";
|
|
26270
|
-
import { basename, join as
|
|
26437
|
+
import { basename, join as join17 } from "path";
|
|
26271
26438
|
async function discoverWorkflows(dir, filter) {
|
|
26272
26439
|
if (!existsSync15(dir)) {
|
|
26273
26440
|
return [];
|
|
@@ -26292,7 +26459,7 @@ async function parseWorkflowTs(filePath, wrapsDir) {
|
|
|
26292
26459
|
const source = await readFile8(filePath, "utf-8");
|
|
26293
26460
|
const sourceHash = createHash2("sha256").update(source).digest("hex");
|
|
26294
26461
|
const slug = basename(filePath, ".ts");
|
|
26295
|
-
const shimDir =
|
|
26462
|
+
const shimDir = join17(wrapsDir, ".wraps", "_shims");
|
|
26296
26463
|
await mkdir8(shimDir, { recursive: true });
|
|
26297
26464
|
const clientShimContent = `
|
|
26298
26465
|
// Identity functions for workflow definitions
|
|
@@ -26521,7 +26688,7 @@ function durationToSeconds(duration) {
|
|
|
26521
26688
|
}
|
|
26522
26689
|
`;
|
|
26523
26690
|
await writeFile10(
|
|
26524
|
-
|
|
26691
|
+
join17(shimDir, "wraps-client-shim.mjs"),
|
|
26525
26692
|
clientShimContent,
|
|
26526
26693
|
"utf-8"
|
|
26527
26694
|
);
|
|
@@ -26533,13 +26700,13 @@ function durationToSeconds(duration) {
|
|
|
26533
26700
|
platform: "node",
|
|
26534
26701
|
target: "node20",
|
|
26535
26702
|
alias: {
|
|
26536
|
-
"@wraps.dev/client":
|
|
26703
|
+
"@wraps.dev/client": join17(shimDir, "wraps-client-shim.mjs")
|
|
26537
26704
|
}
|
|
26538
26705
|
});
|
|
26539
26706
|
const bundledCode = result.outputFiles[0].text;
|
|
26540
|
-
const tmpDir =
|
|
26707
|
+
const tmpDir = join17(wrapsDir, ".wraps", "_workflows");
|
|
26541
26708
|
await mkdir8(tmpDir, { recursive: true });
|
|
26542
|
-
const tmpPath =
|
|
26709
|
+
const tmpPath = join17(tmpDir, `${slug}.mjs`);
|
|
26543
26710
|
await writeFile10(tmpPath, bundledCode, "utf-8");
|
|
26544
26711
|
const mod = await import(`${tmpPath}?t=${Date.now()}`);
|
|
26545
26712
|
const definition = mod.default;
|
|
@@ -26892,8 +27059,8 @@ init_output();
|
|
|
26892
27059
|
async function workflowsPush(options) {
|
|
26893
27060
|
const startTime = Date.now();
|
|
26894
27061
|
const cwd = process.cwd();
|
|
26895
|
-
const wrapsDir =
|
|
26896
|
-
const configPath =
|
|
27062
|
+
const wrapsDir = join18(cwd, "wraps");
|
|
27063
|
+
const configPath = join18(wrapsDir, "wraps.config.ts");
|
|
26897
27064
|
if (!existsSync16(configPath)) {
|
|
26898
27065
|
throw errors.wrapsConfigNotFound();
|
|
26899
27066
|
}
|
|
@@ -26904,7 +27071,7 @@ async function workflowsPush(options) {
|
|
|
26904
27071
|
progress.start("Loading configuration");
|
|
26905
27072
|
const config2 = await loadWrapsConfig(wrapsDir);
|
|
26906
27073
|
progress.succeed("Configuration loaded");
|
|
26907
|
-
const workflowsDir =
|
|
27074
|
+
const workflowsDir = join18(wrapsDir, config2.workflowsDir || "./workflows");
|
|
26908
27075
|
if (!existsSync16(workflowsDir)) {
|
|
26909
27076
|
if (isJsonMode()) {
|
|
26910
27077
|
jsonSuccess("email.workflows.push", {
|
|
@@ -26931,7 +27098,7 @@ async function workflowsPush(options) {
|
|
|
26931
27098
|
return;
|
|
26932
27099
|
}
|
|
26933
27100
|
const lockfile = await loadLockfile(wrapsDir);
|
|
26934
|
-
const templatesDir =
|
|
27101
|
+
const templatesDir = join18(wrapsDir, config2.templatesDir || "./templates");
|
|
26935
27102
|
let localTemplateSlugs;
|
|
26936
27103
|
if (existsSync16(templatesDir)) {
|
|
26937
27104
|
const templateFiles = await discoverTemplates(templatesDir);
|
|
@@ -26945,7 +27112,7 @@ async function workflowsPush(options) {
|
|
|
26945
27112
|
const validationErrors = [];
|
|
26946
27113
|
for (const file of workflowFiles) {
|
|
26947
27114
|
const slug = file.replace(/\.ts$/, "");
|
|
26948
|
-
const filePath =
|
|
27115
|
+
const filePath = join18(workflowsDir, file);
|
|
26949
27116
|
progress.start(`Processing ${pc32.cyan(slug)}`);
|
|
26950
27117
|
try {
|
|
26951
27118
|
const parsed = await parseWorkflowTs(filePath, wrapsDir);
|
|
@@ -27264,7 +27431,7 @@ async function pushToAPI2(workflows, token, progress, options) {
|
|
|
27264
27431
|
init_esm_shims();
|
|
27265
27432
|
init_events();
|
|
27266
27433
|
import { existsSync as existsSync17 } from "fs";
|
|
27267
|
-
import { join as
|
|
27434
|
+
import { join as join19 } from "path";
|
|
27268
27435
|
import * as clack32 from "@clack/prompts";
|
|
27269
27436
|
import pc33 from "picocolors";
|
|
27270
27437
|
init_errors();
|
|
@@ -27273,8 +27440,8 @@ init_output();
|
|
|
27273
27440
|
async function workflowsValidate(options) {
|
|
27274
27441
|
const startTime = Date.now();
|
|
27275
27442
|
const cwd = process.cwd();
|
|
27276
|
-
const wrapsDir =
|
|
27277
|
-
const configPath =
|
|
27443
|
+
const wrapsDir = join19(cwd, "wraps");
|
|
27444
|
+
const configPath = join19(wrapsDir, "wraps.config.ts");
|
|
27278
27445
|
if (!existsSync17(configPath)) {
|
|
27279
27446
|
throw errors.wrapsConfigNotFound();
|
|
27280
27447
|
}
|
|
@@ -27285,7 +27452,7 @@ async function workflowsValidate(options) {
|
|
|
27285
27452
|
progress.start("Loading configuration");
|
|
27286
27453
|
const config2 = await loadWrapsConfig(wrapsDir);
|
|
27287
27454
|
progress.succeed("Configuration loaded");
|
|
27288
|
-
const workflowsDir =
|
|
27455
|
+
const workflowsDir = join19(wrapsDir, config2.workflowsDir || "./workflows");
|
|
27289
27456
|
if (!existsSync17(workflowsDir)) {
|
|
27290
27457
|
if (isJsonMode()) {
|
|
27291
27458
|
jsonSuccess("email.workflows.validate", { workflows: [], errors: [] });
|
|
@@ -27303,7 +27470,7 @@ async function workflowsValidate(options) {
|
|
|
27303
27470
|
}
|
|
27304
27471
|
return;
|
|
27305
27472
|
}
|
|
27306
|
-
const templatesDir =
|
|
27473
|
+
const templatesDir = join19(wrapsDir, config2.templatesDir || "./templates");
|
|
27307
27474
|
let localTemplateSlugs;
|
|
27308
27475
|
if (existsSync17(templatesDir)) {
|
|
27309
27476
|
const templateFiles = await discoverTemplates(templatesDir);
|
|
@@ -27315,7 +27482,7 @@ async function workflowsValidate(options) {
|
|
|
27315
27482
|
const parseErrors = [];
|
|
27316
27483
|
for (const file of workflowFiles) {
|
|
27317
27484
|
const slug = file.replace(/\.ts$/, "");
|
|
27318
|
-
const filePath =
|
|
27485
|
+
const filePath = join19(workflowsDir, file);
|
|
27319
27486
|
progress.start(`Validating ${pc33.cyan(slug)}`);
|
|
27320
27487
|
try {
|
|
27321
27488
|
const parsed = await parseWorkflowTs(filePath, wrapsDir);
|
|
@@ -29220,7 +29387,7 @@ import pc39 from "picocolors";
|
|
|
29220
29387
|
init_esm_shims();
|
|
29221
29388
|
import crypto from "crypto";
|
|
29222
29389
|
import path2 from "path";
|
|
29223
|
-
import { fileURLToPath as
|
|
29390
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
29224
29391
|
import express from "express";
|
|
29225
29392
|
import { createHttpTerminator } from "http-terminator";
|
|
29226
29393
|
|
|
@@ -30404,13 +30571,13 @@ function createMetricsRouter(config2) {
|
|
|
30404
30571
|
const router = createRouter5();
|
|
30405
30572
|
router.get("/stream", async (req, res) => {
|
|
30406
30573
|
const connectionId = randomUUID().slice(0, 8);
|
|
30407
|
-
const
|
|
30574
|
+
const log48 = (msg, data) => {
|
|
30408
30575
|
console.log(JSON.stringify({ connectionId, msg, ...data }));
|
|
30409
30576
|
};
|
|
30410
30577
|
res.setHeader("Content-Type", "text/event-stream");
|
|
30411
30578
|
res.setHeader("Cache-Control", "no-cache");
|
|
30412
30579
|
res.setHeader("Connection", "keep-alive");
|
|
30413
|
-
|
|
30580
|
+
log48("SSE connected");
|
|
30414
30581
|
res.write('data: {"type":"connected"}\n\n');
|
|
30415
30582
|
const { startTime, endTime } = req.query;
|
|
30416
30583
|
const getTimeRange = () => ({
|
|
@@ -30420,7 +30587,7 @@ function createMetricsRouter(config2) {
|
|
|
30420
30587
|
const sendMetrics = async () => {
|
|
30421
30588
|
try {
|
|
30422
30589
|
const timeRange = getTimeRange();
|
|
30423
|
-
|
|
30590
|
+
log48("Fetching metrics", {
|
|
30424
30591
|
start: timeRange.start.toISOString(),
|
|
30425
30592
|
end: timeRange.end.toISOString()
|
|
30426
30593
|
});
|
|
@@ -30433,7 +30600,7 @@ function createMetricsRouter(config2) {
|
|
|
30433
30600
|
),
|
|
30434
30601
|
fetchSendQuota(config2.roleArn, config2.region)
|
|
30435
30602
|
]);
|
|
30436
|
-
|
|
30603
|
+
log48("Metrics fetched successfully");
|
|
30437
30604
|
const data = {
|
|
30438
30605
|
type: "metrics",
|
|
30439
30606
|
timestamp: Date.now(),
|
|
@@ -30463,7 +30630,7 @@ function createMetricsRouter(config2) {
|
|
|
30463
30630
|
const interval = setInterval(sendMetrics, 6e4);
|
|
30464
30631
|
req.on("close", () => {
|
|
30465
30632
|
clearInterval(interval);
|
|
30466
|
-
|
|
30633
|
+
log48("SSE disconnected");
|
|
30467
30634
|
});
|
|
30468
30635
|
});
|
|
30469
30636
|
router.get("/snapshot", async (_req, res) => {
|
|
@@ -31744,7 +31911,7 @@ function createUserRouter(config2) {
|
|
|
31744
31911
|
}
|
|
31745
31912
|
|
|
31746
31913
|
// src/console/server.ts
|
|
31747
|
-
var __dirname2 = path2.dirname(
|
|
31914
|
+
var __dirname2 = path2.dirname(fileURLToPath5(import.meta.url));
|
|
31748
31915
|
async function startConsoleServer(config2) {
|
|
31749
31916
|
const app = express();
|
|
31750
31917
|
const authToken = crypto.randomBytes(32).toString("hex");
|
|
@@ -32880,18 +33047,18 @@ async function createSMSProtectConfigurationWithSDK(configurationSetName, region
|
|
|
32880
33047
|
const existing = await client.send(
|
|
32881
33048
|
new DescribeProtectConfigurationsCommand({})
|
|
32882
33049
|
);
|
|
32883
|
-
for (const
|
|
32884
|
-
if (!(
|
|
33050
|
+
for (const pc55 of existing.ProtectConfigurations || []) {
|
|
33051
|
+
if (!(pc55.ProtectConfigurationArn && pc55.ProtectConfigurationId)) {
|
|
32885
33052
|
continue;
|
|
32886
33053
|
}
|
|
32887
33054
|
const tagsResponse = await client.send(
|
|
32888
33055
|
new ListTagsForResourceCommand({
|
|
32889
|
-
ResourceArn:
|
|
33056
|
+
ResourceArn: pc55.ProtectConfigurationArn
|
|
32890
33057
|
})
|
|
32891
33058
|
);
|
|
32892
33059
|
const nameTag = tagsResponse.Tags?.find((t) => t.Key === "Name");
|
|
32893
33060
|
if (nameTag?.Value === protectConfigName) {
|
|
32894
|
-
existingProtectConfigId =
|
|
33061
|
+
existingProtectConfigId = pc55.ProtectConfigurationId;
|
|
32895
33062
|
break;
|
|
32896
33063
|
}
|
|
32897
33064
|
}
|
|
@@ -32987,13 +33154,13 @@ async function deleteSMSProtectConfigurationWithSDK(region) {
|
|
|
32987
33154
|
new DescribeProtectConfigurationsCommand({})
|
|
32988
33155
|
);
|
|
32989
33156
|
if (existing.ProtectConfigurations) {
|
|
32990
|
-
for (const
|
|
32991
|
-
if (!(
|
|
33157
|
+
for (const pc55 of existing.ProtectConfigurations) {
|
|
33158
|
+
if (!(pc55.ProtectConfigurationArn && pc55.ProtectConfigurationId)) {
|
|
32992
33159
|
continue;
|
|
32993
33160
|
}
|
|
32994
33161
|
const tagsResponse = await client.send(
|
|
32995
33162
|
new ListTagsForResourceCommand({
|
|
32996
|
-
ResourceArn:
|
|
33163
|
+
ResourceArn: pc55.ProtectConfigurationArn
|
|
32997
33164
|
})
|
|
32998
33165
|
);
|
|
32999
33166
|
const isWrapsManaged = tagsResponse.Tags?.some(
|
|
@@ -33002,7 +33169,7 @@ async function deleteSMSProtectConfigurationWithSDK(region) {
|
|
|
33002
33169
|
if (isWrapsManaged) {
|
|
33003
33170
|
await client.send(
|
|
33004
33171
|
new DeleteProtectConfigurationCommand({
|
|
33005
|
-
ProtectConfigurationId:
|
|
33172
|
+
ProtectConfigurationId: pc55.ProtectConfigurationId
|
|
33006
33173
|
})
|
|
33007
33174
|
);
|
|
33008
33175
|
}
|
|
@@ -36328,7 +36495,7 @@ async function telemetryStatus() {
|
|
|
36328
36495
|
// src/commands/workflow/init.ts
|
|
36329
36496
|
init_esm_shims();
|
|
36330
36497
|
import { existsSync as existsSync18, mkdirSync as mkdirSync2, writeFileSync } from "fs";
|
|
36331
|
-
import { join as
|
|
36498
|
+
import { join as join20 } from "path";
|
|
36332
36499
|
import * as clack49 from "@clack/prompts";
|
|
36333
36500
|
import pc52 from "picocolors";
|
|
36334
36501
|
var EXAMPLE_CASCADE_WORKFLOW = `import {
|
|
@@ -36426,14 +36593,14 @@ export default defineConfig({
|
|
|
36426
36593
|
`;
|
|
36427
36594
|
async function workflowInit(options = {}) {
|
|
36428
36595
|
clack49.intro(pc52.bgCyan(pc52.black(" wraps workflow init ")));
|
|
36429
|
-
const wrapsDir =
|
|
36430
|
-
const workflowsDir =
|
|
36431
|
-
const configPath =
|
|
36596
|
+
const wrapsDir = join20(process.cwd(), "wraps");
|
|
36597
|
+
const workflowsDir = join20(wrapsDir, "workflows");
|
|
36598
|
+
const configPath = join20(wrapsDir, "wraps.config.ts");
|
|
36432
36599
|
if (existsSync18(workflowsDir)) {
|
|
36433
36600
|
clack49.log.info(
|
|
36434
36601
|
`Workflows directory already exists at ${pc52.cyan("wraps/workflows/")}`
|
|
36435
36602
|
);
|
|
36436
|
-
const files = existsSync18(
|
|
36603
|
+
const files = existsSync18(join20(workflowsDir, "cart-recovery.ts")) || existsSync18(join20(workflowsDir, "welcome-sequence.ts"));
|
|
36437
36604
|
if (files && !options.yes) {
|
|
36438
36605
|
const shouldContinue = await clack49.confirm({
|
|
36439
36606
|
message: "Example files may already exist. Overwrite them?",
|
|
@@ -36454,12 +36621,12 @@ async function workflowInit(options = {}) {
|
|
|
36454
36621
|
s.stop("Created wraps/workflows/");
|
|
36455
36622
|
s.start("Scaffolding example workflows...");
|
|
36456
36623
|
writeFileSync(
|
|
36457
|
-
|
|
36624
|
+
join20(workflowsDir, "cart-recovery.ts"),
|
|
36458
36625
|
EXAMPLE_CASCADE_WORKFLOW,
|
|
36459
36626
|
"utf-8"
|
|
36460
36627
|
);
|
|
36461
36628
|
writeFileSync(
|
|
36462
|
-
|
|
36629
|
+
join20(workflowsDir, "welcome-sequence.ts"),
|
|
36463
36630
|
EXAMPLE_WELCOME_WORKFLOW,
|
|
36464
36631
|
"utf-8"
|
|
36465
36632
|
);
|
|
@@ -36564,10 +36731,10 @@ if (nodeMajorVersion < 20) {
|
|
|
36564
36731
|
console.error("");
|
|
36565
36732
|
process.exit(1);
|
|
36566
36733
|
}
|
|
36567
|
-
var __filename2 =
|
|
36568
|
-
var __dirname3 =
|
|
36734
|
+
var __filename2 = fileURLToPath6(import.meta.url);
|
|
36735
|
+
var __dirname3 = dirname5(__filename2);
|
|
36569
36736
|
var packageJson = JSON.parse(
|
|
36570
|
-
readFileSync3(
|
|
36737
|
+
readFileSync3(join22(__dirname3, "../package.json"), "utf-8")
|
|
36571
36738
|
);
|
|
36572
36739
|
var VERSION = packageJson.version;
|
|
36573
36740
|
setupTabCompletion();
|
|
@@ -36576,187 +36743,188 @@ function showVersion() {
|
|
|
36576
36743
|
process.exit(0);
|
|
36577
36744
|
}
|
|
36578
36745
|
function showHelp() {
|
|
36579
|
-
clack50.intro(
|
|
36746
|
+
clack50.intro(pc54.bold(`WRAPS CLI v${VERSION}`));
|
|
36580
36747
|
console.log("Deploy AWS infrastructure to your account\n");
|
|
36581
36748
|
console.log("Usage: wraps [service] <command> [options]\n");
|
|
36582
36749
|
console.log("Services:");
|
|
36583
|
-
console.log(` ${
|
|
36750
|
+
console.log(` ${pc54.cyan("email")} Email infrastructure (AWS SES)`);
|
|
36584
36751
|
console.log(
|
|
36585
|
-
` ${
|
|
36752
|
+
` ${pc54.cyan("sms")} SMS infrastructure (AWS End User Messaging)`
|
|
36586
36753
|
);
|
|
36587
36754
|
console.log(
|
|
36588
|
-
` ${
|
|
36755
|
+
` ${pc54.cyan("cdn")} CDN infrastructure (AWS S3 + CloudFront)
|
|
36589
36756
|
`
|
|
36590
36757
|
);
|
|
36591
36758
|
console.log("Email Commands:");
|
|
36592
36759
|
console.log(
|
|
36593
|
-
` ${
|
|
36760
|
+
` ${pc54.cyan("email init")} Deploy new email infrastructure`
|
|
36594
36761
|
);
|
|
36595
36762
|
console.log(
|
|
36596
|
-
` ${
|
|
36763
|
+
` ${pc54.cyan("email check")} Check email deliverability for a domain`
|
|
36597
36764
|
);
|
|
36598
36765
|
console.log(
|
|
36599
|
-
` ${
|
|
36766
|
+
` ${pc54.cyan("email connect")} Connect to existing AWS SES`
|
|
36600
36767
|
);
|
|
36601
36768
|
console.log(
|
|
36602
|
-
` ${
|
|
36769
|
+
` ${pc54.cyan("email status")} Show email infrastructure details`
|
|
36603
36770
|
);
|
|
36604
|
-
console.log(` ${
|
|
36605
|
-
console.log(` ${
|
|
36771
|
+
console.log(` ${pc54.cyan("email test")} Send a test email`);
|
|
36772
|
+
console.log(` ${pc54.cyan("email verify")} Verify domain DNS records`);
|
|
36606
36773
|
console.log(
|
|
36607
|
-
` ${
|
|
36774
|
+
` ${pc54.cyan("email sync")} Apply CLI updates to infrastructure`
|
|
36608
36775
|
);
|
|
36609
|
-
console.log(` ${
|
|
36776
|
+
console.log(` ${pc54.cyan("email upgrade")} Add features`);
|
|
36610
36777
|
console.log(
|
|
36611
|
-
` ${
|
|
36778
|
+
` ${pc54.cyan("email restore")} Restore original configuration`
|
|
36612
36779
|
);
|
|
36613
36780
|
console.log(
|
|
36614
|
-
` ${
|
|
36781
|
+
` ${pc54.cyan("email destroy")} Remove email infrastructure`
|
|
36615
36782
|
);
|
|
36616
|
-
console.log(` ${
|
|
36617
|
-
console.log(` ${
|
|
36618
|
-
console.log(` ${
|
|
36783
|
+
console.log(` ${pc54.cyan("email domains add")} Add a domain to SES`);
|
|
36784
|
+
console.log(` ${pc54.cyan("email domains list")} List all domains`);
|
|
36785
|
+
console.log(` ${pc54.cyan("email domains remove")} Remove a domain`);
|
|
36619
36786
|
console.log(
|
|
36620
|
-
` ${
|
|
36787
|
+
` ${pc54.cyan("email inbound init")} Enable inbound email receiving`
|
|
36621
36788
|
);
|
|
36622
|
-
console.log(` ${
|
|
36789
|
+
console.log(` ${pc54.cyan("email inbound status")} Show inbound email status`);
|
|
36623
36790
|
console.log(
|
|
36624
|
-
` ${
|
|
36791
|
+
` ${pc54.cyan("email inbound verify")} Verify inbound DNS records`
|
|
36625
36792
|
);
|
|
36626
36793
|
console.log(
|
|
36627
|
-
` ${
|
|
36794
|
+
` ${pc54.cyan("email inbound test")} Send test email and verify receipt`
|
|
36628
36795
|
);
|
|
36629
36796
|
console.log(
|
|
36630
|
-
` ${
|
|
36797
|
+
` ${pc54.cyan("email inbound destroy")} Remove inbound email infrastructure
|
|
36631
36798
|
`
|
|
36632
36799
|
);
|
|
36633
36800
|
console.log("Template Commands:");
|
|
36634
36801
|
console.log(
|
|
36635
|
-
` ${
|
|
36802
|
+
` ${pc54.cyan("email templates init")} Initialize templates-as-code`
|
|
36636
36803
|
);
|
|
36637
36804
|
console.log(
|
|
36638
|
-
` ${
|
|
36805
|
+
` ${pc54.cyan("email templates push")} Push templates to SES + dashboard`
|
|
36639
36806
|
);
|
|
36640
36807
|
console.log(
|
|
36641
|
-
` ${
|
|
36808
|
+
` ${pc54.cyan("email templates preview")} Preview templates in browser`
|
|
36642
36809
|
);
|
|
36643
36810
|
console.log(
|
|
36644
|
-
` ${
|
|
36811
|
+
` ${pc54.cyan("push")} ${pc54.dim("(alias for email templates push)")}
|
|
36645
36812
|
`
|
|
36646
36813
|
);
|
|
36647
36814
|
console.log("Workflow Commands:");
|
|
36648
36815
|
console.log(
|
|
36649
|
-
` ${
|
|
36816
|
+
` ${pc54.cyan("email workflows init")} Initialize workflows-as-code`
|
|
36650
36817
|
);
|
|
36651
36818
|
console.log(
|
|
36652
|
-
` ${
|
|
36819
|
+
` ${pc54.cyan("email workflows validate")} Validate workflow files`
|
|
36653
36820
|
);
|
|
36654
36821
|
console.log(
|
|
36655
|
-
` ${
|
|
36822
|
+
` ${pc54.cyan("email workflows push")} Push workflows to dashboard
|
|
36656
36823
|
`
|
|
36657
36824
|
);
|
|
36658
36825
|
console.log("SMS Commands:");
|
|
36659
|
-
console.log(` ${
|
|
36826
|
+
console.log(` ${pc54.cyan("sms init")} Deploy SMS infrastructure`);
|
|
36660
36827
|
console.log(
|
|
36661
|
-
` ${
|
|
36828
|
+
` ${pc54.cyan("sms status")} Show SMS infrastructure details`
|
|
36662
36829
|
);
|
|
36663
|
-
console.log(` ${
|
|
36830
|
+
console.log(` ${pc54.cyan("sms test")} Send a test SMS message`);
|
|
36664
36831
|
console.log(
|
|
36665
|
-
` ${
|
|
36832
|
+
` ${pc54.cyan("sms verify-number")} Verify a destination phone number`
|
|
36666
36833
|
);
|
|
36667
36834
|
console.log(
|
|
36668
|
-
` ${
|
|
36835
|
+
` ${pc54.cyan("sms sync")} Sync infrastructure (update Lambda, etc.)`
|
|
36669
36836
|
);
|
|
36670
|
-
console.log(` ${
|
|
36671
|
-
console.log(` ${
|
|
36837
|
+
console.log(` ${pc54.cyan("sms upgrade")} Upgrade SMS features`);
|
|
36838
|
+
console.log(` ${pc54.cyan("sms register")} Register toll-free number`);
|
|
36672
36839
|
console.log(
|
|
36673
|
-
` ${
|
|
36840
|
+
` ${pc54.cyan("sms destroy")} Remove SMS infrastructure
|
|
36674
36841
|
`
|
|
36675
36842
|
);
|
|
36676
36843
|
console.log("CDN Commands:");
|
|
36677
36844
|
console.log(
|
|
36678
|
-
` ${
|
|
36845
|
+
` ${pc54.cyan("cdn init")} Deploy CDN infrastructure (S3 + CloudFront)`
|
|
36679
36846
|
);
|
|
36680
36847
|
console.log(
|
|
36681
|
-
` ${
|
|
36848
|
+
` ${pc54.cyan("cdn status")} Show CDN infrastructure details`
|
|
36682
36849
|
);
|
|
36683
36850
|
console.log(
|
|
36684
|
-
` ${
|
|
36851
|
+
` ${pc54.cyan("cdn verify")} Check DNS and certificate status`
|
|
36685
36852
|
);
|
|
36686
36853
|
console.log(
|
|
36687
|
-
` ${
|
|
36854
|
+
` ${pc54.cyan("cdn upgrade")} Add custom domain after cert validation`
|
|
36688
36855
|
);
|
|
36689
36856
|
console.log(
|
|
36690
|
-
` ${
|
|
36857
|
+
` ${pc54.cyan("cdn sync")} Sync infrastructure with current config`
|
|
36691
36858
|
);
|
|
36692
36859
|
console.log(
|
|
36693
|
-
` ${
|
|
36860
|
+
` ${pc54.cyan("cdn destroy")} Remove CDN infrastructure
|
|
36694
36861
|
`
|
|
36695
36862
|
);
|
|
36696
36863
|
console.log("Local Development:");
|
|
36697
36864
|
console.log(
|
|
36698
|
-
` ${
|
|
36865
|
+
` ${pc54.cyan("console")} Start local web console
|
|
36699
36866
|
`
|
|
36700
36867
|
);
|
|
36701
36868
|
console.log("Platform:");
|
|
36702
36869
|
console.log(
|
|
36703
|
-
` ${
|
|
36870
|
+
` ${pc54.cyan("platform")} Show platform info and pricing`
|
|
36704
36871
|
);
|
|
36705
36872
|
console.log(
|
|
36706
|
-
` ${
|
|
36873
|
+
` ${pc54.cyan("platform connect")} Connect to Wraps Platform (events + IAM)`
|
|
36707
36874
|
);
|
|
36708
36875
|
console.log(
|
|
36709
|
-
` ${
|
|
36876
|
+
` ${pc54.cyan("platform update-role")} Update platform IAM permissions
|
|
36710
36877
|
`
|
|
36711
36878
|
);
|
|
36712
36879
|
console.log("Auth:");
|
|
36713
36880
|
console.log(
|
|
36714
|
-
` ${
|
|
36881
|
+
` ${pc54.cyan("auth login")} Sign in to wraps.dev (device flow)`
|
|
36715
36882
|
);
|
|
36716
|
-
console.log(` ${
|
|
36883
|
+
console.log(` ${pc54.cyan("auth status")} Show current auth state`);
|
|
36717
36884
|
console.log(
|
|
36718
|
-
` ${
|
|
36885
|
+
` ${pc54.cyan("auth logout")} Sign out and remove stored token
|
|
36719
36886
|
`
|
|
36720
36887
|
);
|
|
36721
36888
|
console.log("AWS Setup:");
|
|
36722
36889
|
console.log(
|
|
36723
|
-
` ${
|
|
36890
|
+
` ${pc54.cyan("aws setup")} Interactive AWS setup wizard`
|
|
36724
36891
|
);
|
|
36725
36892
|
console.log(
|
|
36726
|
-
` ${
|
|
36893
|
+
` ${pc54.cyan("aws doctor")} Diagnose AWS configuration issues
|
|
36727
36894
|
`
|
|
36728
36895
|
);
|
|
36729
36896
|
console.log("Global Commands:");
|
|
36730
|
-
console.log(` ${
|
|
36731
|
-
console.log(` ${
|
|
36732
|
-
console.log(` ${
|
|
36733
|
-
console.log(` ${
|
|
36897
|
+
console.log(` ${pc54.cyan("status")} Show overview of all services`);
|
|
36898
|
+
console.log(` ${pc54.cyan("destroy")} Remove deployed infrastructure`);
|
|
36899
|
+
console.log(` ${pc54.cyan("permissions")} Show required AWS IAM permissions`);
|
|
36900
|
+
console.log(` ${pc54.cyan("completion")} Generate shell completion script`);
|
|
36734
36901
|
console.log(
|
|
36735
|
-
` ${
|
|
36902
|
+
` ${pc54.cyan("telemetry")} Manage anonymous telemetry settings`
|
|
36736
36903
|
);
|
|
36737
|
-
console.log(` ${
|
|
36904
|
+
console.log(` ${pc54.cyan("update")} Update CLI to latest version`);
|
|
36905
|
+
console.log(` ${pc54.cyan("news")} Show recent Wraps updates`);
|
|
36738
36906
|
console.log(
|
|
36739
|
-
` ${
|
|
36907
|
+
` ${pc54.cyan("support")} Get help and support contact info
|
|
36740
36908
|
`
|
|
36741
36909
|
);
|
|
36742
36910
|
console.log("Options:");
|
|
36743
36911
|
console.log(
|
|
36744
|
-
` ${
|
|
36745
|
-
);
|
|
36746
|
-
console.log(` ${
|
|
36747
|
-
console.log(` ${
|
|
36748
|
-
console.log(` ${
|
|
36749
|
-
console.log(` ${
|
|
36750
|
-
console.log(` ${
|
|
36751
|
-
console.log(` ${
|
|
36752
|
-
console.log(` ${
|
|
36912
|
+
` ${pc54.dim("-p, --provider")} Hosting provider (vercel, aws, railway, other)`
|
|
36913
|
+
);
|
|
36914
|
+
console.log(` ${pc54.dim("-r, --region")} AWS region`);
|
|
36915
|
+
console.log(` ${pc54.dim("-d, --domain")} Domain name`);
|
|
36916
|
+
console.log(` ${pc54.dim("--account")} AWS account ID or alias`);
|
|
36917
|
+
console.log(` ${pc54.dim("--preset")} Configuration preset`);
|
|
36918
|
+
console.log(` ${pc54.dim("--token")} API key or token for auth`);
|
|
36919
|
+
console.log(` ${pc54.dim("-y, --yes")} Skip confirmation prompts`);
|
|
36920
|
+
console.log(` ${pc54.dim("-f, --force")} Force destructive operations`);
|
|
36753
36921
|
console.log(
|
|
36754
|
-
` ${
|
|
36922
|
+
` ${pc54.dim("--preview")} Preview changes without deploying`
|
|
36755
36923
|
);
|
|
36756
|
-
console.log(` ${
|
|
36924
|
+
console.log(` ${pc54.dim("-v, --version")} Show version number
|
|
36757
36925
|
`);
|
|
36758
36926
|
console.log(
|
|
36759
|
-
`Run ${
|
|
36927
|
+
`Run ${pc54.cyan("wraps <service> <command> --help")} for more information.
|
|
36760
36928
|
`
|
|
36761
36929
|
);
|
|
36762
36930
|
}
|
|
@@ -36982,25 +37150,25 @@ if (!primaryCommand) {
|
|
|
36982
37150
|
const telemetry = getTelemetryClient();
|
|
36983
37151
|
if (telemetry.shouldShowNotification()) {
|
|
36984
37152
|
console.log();
|
|
36985
|
-
clack50.log.info(
|
|
37153
|
+
clack50.log.info(pc54.bold("Anonymous Telemetry"));
|
|
36986
37154
|
console.log(
|
|
36987
|
-
` Wraps collects ${
|
|
37155
|
+
` Wraps collects ${pc54.cyan("anonymous usage data")} to improve the CLI.`
|
|
36988
37156
|
);
|
|
36989
37157
|
console.log(
|
|
36990
|
-
` We ${
|
|
37158
|
+
` We ${pc54.bold("never")} collect: domains, AWS credentials, email content, or PII.`
|
|
36991
37159
|
);
|
|
36992
37160
|
console.log(
|
|
36993
|
-
` We ${
|
|
37161
|
+
` We ${pc54.bold("only")} collect: command names, success/failure, CLI version, OS.`
|
|
36994
37162
|
);
|
|
36995
37163
|
console.log();
|
|
36996
|
-
console.log(` Opt-out anytime: ${
|
|
36997
|
-
console.log(` Or set: ${
|
|
36998
|
-
console.log(` Learn more: ${
|
|
37164
|
+
console.log(` Opt-out anytime: ${pc54.cyan("wraps telemetry disable")}`);
|
|
37165
|
+
console.log(` Or set: ${pc54.cyan("WRAPS_TELEMETRY_DISABLED=1")}`);
|
|
37166
|
+
console.log(` Learn more: ${pc54.cyan("https://wraps.dev/docs")}`);
|
|
36999
37167
|
console.log();
|
|
37000
37168
|
telemetry.markNotificationShown();
|
|
37001
37169
|
}
|
|
37002
37170
|
trackCommand("interactive:menu", { success: true, duration_ms: 0 });
|
|
37003
|
-
clack50.intro(
|
|
37171
|
+
clack50.intro(pc54.bold(`WRAPS CLI v${VERSION}`));
|
|
37004
37172
|
console.log(" Deploy AWS infrastructure to your account.\n");
|
|
37005
37173
|
const action = await clack50.select({
|
|
37006
37174
|
message: "What would you like to do?",
|
|
@@ -37137,20 +37305,20 @@ async function run() {
|
|
|
37137
37305
|
const telemetry = getTelemetryClient();
|
|
37138
37306
|
if (telemetry.shouldShowNotification()) {
|
|
37139
37307
|
console.log();
|
|
37140
|
-
clack50.log.info(
|
|
37308
|
+
clack50.log.info(pc54.bold("Anonymous Telemetry"));
|
|
37141
37309
|
console.log(
|
|
37142
|
-
` Wraps collects ${
|
|
37310
|
+
` Wraps collects ${pc54.cyan("anonymous usage data")} to improve the CLI.`
|
|
37143
37311
|
);
|
|
37144
37312
|
console.log(
|
|
37145
|
-
` We ${
|
|
37313
|
+
` We ${pc54.bold("never")} collect: domains, AWS credentials, email content, or PII.`
|
|
37146
37314
|
);
|
|
37147
37315
|
console.log(
|
|
37148
|
-
` We ${
|
|
37316
|
+
` We ${pc54.bold("only")} collect: command names, success/failure, CLI version, OS.`
|
|
37149
37317
|
);
|
|
37150
37318
|
console.log();
|
|
37151
|
-
console.log(` Opt-out anytime: ${
|
|
37152
|
-
console.log(` Or set: ${
|
|
37153
|
-
console.log(` Learn more: ${
|
|
37319
|
+
console.log(` Opt-out anytime: ${pc54.cyan("wraps telemetry disable")}`);
|
|
37320
|
+
console.log(` Or set: ${pc54.cyan("WRAPS_TELEMETRY_DISABLED=1")}`);
|
|
37321
|
+
console.log(` Learn more: ${pc54.cyan("https://wraps.dev/docs")}`);
|
|
37154
37322
|
console.log();
|
|
37155
37323
|
telemetry.markNotificationShown();
|
|
37156
37324
|
}
|
|
@@ -37237,7 +37405,7 @@ async function run() {
|
|
|
37237
37405
|
clack50.log.error("--domain flag is required");
|
|
37238
37406
|
console.log(
|
|
37239
37407
|
`
|
|
37240
|
-
Usage: ${
|
|
37408
|
+
Usage: ${pc54.cyan("wraps email verify --domain yourapp.com")}
|
|
37241
37409
|
`
|
|
37242
37410
|
);
|
|
37243
37411
|
throw new Error("Missing required flag: --domain");
|
|
@@ -37312,7 +37480,7 @@ Usage: ${pc53.cyan("wraps email verify --domain yourapp.com")}
|
|
|
37312
37480
|
);
|
|
37313
37481
|
console.log(
|
|
37314
37482
|
`
|
|
37315
|
-
Available commands: ${
|
|
37483
|
+
Available commands: ${pc54.cyan("init")}, ${pc54.cyan("destroy")}, ${pc54.cyan("status")}, ${pc54.cyan("verify")}, ${pc54.cyan("test")}, ${pc54.cyan("add")}, ${pc54.cyan("remove")}
|
|
37316
37484
|
`
|
|
37317
37485
|
);
|
|
37318
37486
|
throw new Error(
|
|
@@ -37340,7 +37508,7 @@ Available commands: ${pc53.cyan("init")}, ${pc53.cyan("destroy")}, ${pc53.cyan("
|
|
|
37340
37508
|
clack50.log.error("--domain flag is required");
|
|
37341
37509
|
console.log(
|
|
37342
37510
|
`
|
|
37343
|
-
Usage: ${
|
|
37511
|
+
Usage: ${pc54.cyan("wraps email domains verify --domain yourapp.com")}
|
|
37344
37512
|
`
|
|
37345
37513
|
);
|
|
37346
37514
|
throw new Error("Missing required flag: --domain");
|
|
@@ -37353,7 +37521,7 @@ Usage: ${pc53.cyan("wraps email domains verify --domain yourapp.com")}
|
|
|
37353
37521
|
clack50.log.error("--domain flag is required");
|
|
37354
37522
|
console.log(
|
|
37355
37523
|
`
|
|
37356
|
-
Usage: ${
|
|
37524
|
+
Usage: ${pc54.cyan("wraps email domains get-dkim --domain yourapp.com")}
|
|
37357
37525
|
`
|
|
37358
37526
|
);
|
|
37359
37527
|
throw new Error("Missing required flag: --domain");
|
|
@@ -37366,7 +37534,7 @@ Usage: ${pc53.cyan("wraps email domains get-dkim --domain yourapp.com")}
|
|
|
37366
37534
|
clack50.log.error("--domain flag is required");
|
|
37367
37535
|
console.log(
|
|
37368
37536
|
`
|
|
37369
|
-
Usage: ${
|
|
37537
|
+
Usage: ${pc54.cyan("wraps email domains remove --domain yourapp.com --force")}
|
|
37370
37538
|
`
|
|
37371
37539
|
);
|
|
37372
37540
|
throw new Error("Missing required flag: --domain");
|
|
@@ -37383,7 +37551,7 @@ Usage: ${pc53.cyan("wraps email domains remove --domain yourapp.com --force")}
|
|
|
37383
37551
|
);
|
|
37384
37552
|
console.log(
|
|
37385
37553
|
`
|
|
37386
|
-
Available commands: ${
|
|
37554
|
+
Available commands: ${pc54.cyan("add")}, ${pc54.cyan("list")}, ${pc54.cyan("verify")}, ${pc54.cyan("get-dkim")}, ${pc54.cyan("remove")}
|
|
37387
37555
|
`
|
|
37388
37556
|
);
|
|
37389
37557
|
throw new Error(
|
|
@@ -37428,7 +37596,7 @@ Available commands: ${pc53.cyan("add")}, ${pc53.cyan("list")}, ${pc53.cyan("veri
|
|
|
37428
37596
|
);
|
|
37429
37597
|
console.log(
|
|
37430
37598
|
`
|
|
37431
|
-
Available commands: ${
|
|
37599
|
+
Available commands: ${pc54.cyan("init")}, ${pc54.cyan("push")}, ${pc54.cyan("preview")}
|
|
37432
37600
|
`
|
|
37433
37601
|
);
|
|
37434
37602
|
throw new Error(
|
|
@@ -37472,7 +37640,7 @@ Available commands: ${pc53.cyan("init")}, ${pc53.cyan("push")}, ${pc53.cyan("pre
|
|
|
37472
37640
|
);
|
|
37473
37641
|
console.log(
|
|
37474
37642
|
`
|
|
37475
|
-
Available commands: ${
|
|
37643
|
+
Available commands: ${pc54.cyan("init")}, ${pc54.cyan("validate")}, ${pc54.cyan("push")}
|
|
37476
37644
|
`
|
|
37477
37645
|
);
|
|
37478
37646
|
throw new Error(
|
|
@@ -37493,7 +37661,7 @@ Available commands: ${pc53.cyan("init")}, ${pc53.cyan("validate")}, ${pc53.cyan(
|
|
|
37493
37661
|
clack50.log.error(`Unknown email command: ${subCommand}`);
|
|
37494
37662
|
console.log(
|
|
37495
37663
|
`
|
|
37496
|
-
Run ${
|
|
37664
|
+
Run ${pc54.cyan("wraps --help")} for available commands.
|
|
37497
37665
|
`
|
|
37498
37666
|
);
|
|
37499
37667
|
throw new Error(`Unknown email command: ${subCommand}`);
|
|
@@ -37571,7 +37739,7 @@ Run ${pc53.cyan("wraps --help")} for available commands.
|
|
|
37571
37739
|
clack50.log.error(`Unknown sms command: ${subCommand}`);
|
|
37572
37740
|
console.log(
|
|
37573
37741
|
`
|
|
37574
|
-
Run ${
|
|
37742
|
+
Run ${pc54.cyan("wraps --help")} for available commands.
|
|
37575
37743
|
`
|
|
37576
37744
|
);
|
|
37577
37745
|
throw new Error(`Unknown sms command: ${subCommand}`);
|
|
@@ -37635,7 +37803,7 @@ Run ${pc53.cyan("wraps --help")} for available commands.
|
|
|
37635
37803
|
clack50.log.error(`Unknown cdn command: ${subCommand}`);
|
|
37636
37804
|
console.log(
|
|
37637
37805
|
`
|
|
37638
|
-
Run ${
|
|
37806
|
+
Run ${pc54.cyan("wraps --help")} for available commands.
|
|
37639
37807
|
`
|
|
37640
37808
|
);
|
|
37641
37809
|
throw new Error(`Unknown cdn command: ${subCommand}`);
|
|
@@ -37661,9 +37829,9 @@ Run ${pc53.cyan("wraps --help")} for available commands.
|
|
|
37661
37829
|
`Unknown workflow command: ${subCommand || "(none)"}`
|
|
37662
37830
|
);
|
|
37663
37831
|
console.log(`
|
|
37664
|
-
Available commands: ${
|
|
37832
|
+
Available commands: ${pc54.cyan("init")}
|
|
37665
37833
|
`);
|
|
37666
|
-
console.log(`Run ${
|
|
37834
|
+
console.log(`Run ${pc54.cyan("wraps --help")} for more information.
|
|
37667
37835
|
`);
|
|
37668
37836
|
throw new Error(
|
|
37669
37837
|
`Unknown workflow command: ${subCommand || "(none)"}`
|
|
@@ -37708,11 +37876,11 @@ Available commands: ${pc53.cyan("init")}
|
|
|
37708
37876
|
clack50.log.error(`Unknown platform command: ${subCommand}`);
|
|
37709
37877
|
console.log(
|
|
37710
37878
|
`
|
|
37711
|
-
Available commands: ${
|
|
37879
|
+
Available commands: ${pc54.cyan("connect")}, ${pc54.cyan("update-role")}
|
|
37712
37880
|
`
|
|
37713
37881
|
);
|
|
37714
37882
|
console.log(
|
|
37715
|
-
`Run ${
|
|
37883
|
+
`Run ${pc54.cyan("wraps platform")} for more information.
|
|
37716
37884
|
`
|
|
37717
37885
|
);
|
|
37718
37886
|
throw new Error(`Unknown platform command: ${subCommand}`);
|
|
@@ -37740,7 +37908,7 @@ Available commands: ${pc53.cyan("connect")}, ${pc53.cyan("update-role")}
|
|
|
37740
37908
|
clack50.log.error(`Unknown auth command: ${subCommand || "(none)"}`);
|
|
37741
37909
|
console.log(
|
|
37742
37910
|
`
|
|
37743
|
-
Available commands: ${
|
|
37911
|
+
Available commands: ${pc54.cyan("login")}, ${pc54.cyan("status")}, ${pc54.cyan("logout")}
|
|
37744
37912
|
`
|
|
37745
37913
|
);
|
|
37746
37914
|
throw new Error(`Unknown auth command: ${subCommand || "(none)"}`);
|
|
@@ -37761,10 +37929,10 @@ Available commands: ${pc53.cyan("login")}, ${pc53.cyan("status")}, ${pc53.cyan("
|
|
|
37761
37929
|
clack50.log.error(`Unknown aws command: ${subCommand}`);
|
|
37762
37930
|
console.log(
|
|
37763
37931
|
`
|
|
37764
|
-
Available commands: ${
|
|
37932
|
+
Available commands: ${pc54.cyan("setup")}, ${pc54.cyan("doctor")}
|
|
37765
37933
|
`
|
|
37766
37934
|
);
|
|
37767
|
-
console.log(`Run ${
|
|
37935
|
+
console.log(`Run ${pc54.cyan("wraps --help")} for more information.
|
|
37768
37936
|
`);
|
|
37769
37937
|
throw new Error(`Unknown aws command: ${subCommand}`);
|
|
37770
37938
|
}
|
|
@@ -37811,6 +37979,11 @@ Available commands: ${pc53.cyan("setup")}, ${pc53.cyan("doctor")}
|
|
|
37811
37979
|
case "completion":
|
|
37812
37980
|
printCompletionScript();
|
|
37813
37981
|
break;
|
|
37982
|
+
case "update": {
|
|
37983
|
+
const { update: update2 } = await Promise.resolve().then(() => (init_update(), update_exports));
|
|
37984
|
+
await update2(VERSION);
|
|
37985
|
+
break;
|
|
37986
|
+
}
|
|
37814
37987
|
case "news":
|
|
37815
37988
|
await news();
|
|
37816
37989
|
break;
|
|
@@ -37840,7 +38013,7 @@ Available commands: ${pc53.cyan("setup")}, ${pc53.cyan("doctor")}
|
|
|
37840
38013
|
clack50.log.error(`Unknown telemetry command: ${subCommand}`);
|
|
37841
38014
|
console.log(
|
|
37842
38015
|
`
|
|
37843
|
-
Available commands: ${
|
|
38016
|
+
Available commands: ${pc54.cyan("enable")}, ${pc54.cyan("disable")}, ${pc54.cyan("status")}
|
|
37844
38017
|
`
|
|
37845
38018
|
);
|
|
37846
38019
|
throw new Error(`Unknown telemetry command: ${subCommand}`);
|
|
@@ -37867,7 +38040,7 @@ Please specify a command for ${primaryCommand} service.
|
|
|
37867
38040
|
clack50.log.error(`Unknown command: ${primaryCommand}`);
|
|
37868
38041
|
console.log(
|
|
37869
38042
|
`
|
|
37870
|
-
Run ${
|
|
38043
|
+
Run ${pc54.cyan("wraps --help")} for available commands.
|
|
37871
38044
|
`
|
|
37872
38045
|
);
|
|
37873
38046
|
throw new Error(`Unknown command: ${primaryCommand}`);
|