@specific.dev/cli 0.1.223 → 0.1.225
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/admin/404/index.html +1 -1
- package/dist/admin/404.html +1 -1
- package/dist/admin/__next.!KGRlZmF1bHQp.__PAGE__.txt +1 -1
- package/dist/admin/__next.!KGRlZmF1bHQp.txt +1 -1
- package/dist/admin/__next._full.txt +2 -2
- package/dist/admin/__next._head.txt +1 -1
- package/dist/admin/__next._index.txt +2 -2
- package/dist/admin/__next._tree.txt +2 -2
- package/dist/admin/_next/static/chunks/{1fac7a1b12b837ea.css → 24ff82c52f4b2700.css} +3 -3
- package/dist/admin/_not-found/__next._full.txt +2 -2
- package/dist/admin/_not-found/__next._head.txt +1 -1
- package/dist/admin/_not-found/__next._index.txt +2 -2
- package/dist/admin/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/admin/_not-found/__next._not-found.txt +1 -1
- package/dist/admin/_not-found/__next._tree.txt +2 -2
- package/dist/admin/_not-found/index.html +1 -1
- package/dist/admin/_not-found/index.txt +2 -2
- package/dist/admin/crons/__next.!KGRlZmF1bHQp.crons.__PAGE__.txt +1 -1
- package/dist/admin/crons/__next.!KGRlZmF1bHQp.crons.txt +1 -1
- package/dist/admin/crons/__next.!KGRlZmF1bHQp.txt +1 -1
- package/dist/admin/crons/__next._full.txt +2 -2
- package/dist/admin/crons/__next._head.txt +1 -1
- package/dist/admin/crons/__next._index.txt +2 -2
- package/dist/admin/crons/__next._tree.txt +2 -2
- package/dist/admin/crons/index.html +1 -1
- package/dist/admin/crons/index.txt +2 -2
- package/dist/admin/databases/__next.!KGRlZmF1bHQp.databases.__PAGE__.txt +1 -1
- package/dist/admin/databases/__next.!KGRlZmF1bHQp.databases.txt +1 -1
- package/dist/admin/databases/__next.!KGRlZmF1bHQp.txt +1 -1
- package/dist/admin/databases/__next._full.txt +2 -2
- package/dist/admin/databases/__next._head.txt +1 -1
- package/dist/admin/databases/__next._index.txt +2 -2
- package/dist/admin/databases/__next._tree.txt +2 -2
- package/dist/admin/databases/index.html +1 -1
- package/dist/admin/databases/index.txt +2 -2
- package/dist/admin/fullscreen/__next._full.txt +2 -2
- package/dist/admin/fullscreen/__next._head.txt +1 -1
- package/dist/admin/fullscreen/__next._index.txt +2 -2
- package/dist/admin/fullscreen/__next._tree.txt +2 -2
- package/dist/admin/fullscreen/__next.fullscreen.__PAGE__.txt +1 -1
- package/dist/admin/fullscreen/__next.fullscreen.txt +1 -1
- package/dist/admin/fullscreen/databases/__next._full.txt +2 -2
- package/dist/admin/fullscreen/databases/__next._head.txt +1 -1
- package/dist/admin/fullscreen/databases/__next._index.txt +2 -2
- package/dist/admin/fullscreen/databases/__next._tree.txt +2 -2
- package/dist/admin/fullscreen/databases/__next.fullscreen.databases.__PAGE__.txt +1 -1
- package/dist/admin/fullscreen/databases/__next.fullscreen.databases.txt +1 -1
- package/dist/admin/fullscreen/databases/__next.fullscreen.txt +1 -1
- package/dist/admin/fullscreen/databases/index.html +1 -1
- package/dist/admin/fullscreen/databases/index.txt +2 -2
- package/dist/admin/fullscreen/index.html +1 -1
- package/dist/admin/fullscreen/index.txt +2 -2
- package/dist/admin/index.html +1 -1
- package/dist/admin/index.txt +2 -2
- package/dist/admin/mail/__next.!KGRlZmF1bHQp.mail.__PAGE__.txt +1 -1
- package/dist/admin/mail/__next.!KGRlZmF1bHQp.mail.txt +1 -1
- package/dist/admin/mail/__next.!KGRlZmF1bHQp.txt +1 -1
- package/dist/admin/mail/__next._full.txt +2 -2
- package/dist/admin/mail/__next._head.txt +1 -1
- package/dist/admin/mail/__next._index.txt +2 -2
- package/dist/admin/mail/__next._tree.txt +2 -2
- package/dist/admin/mail/index.html +1 -1
- package/dist/admin/mail/index.txt +2 -2
- package/dist/admin/services/__next.!KGRlZmF1bHQp.services.__PAGE__.txt +1 -1
- package/dist/admin/services/__next.!KGRlZmF1bHQp.services.txt +1 -1
- package/dist/admin/services/__next.!KGRlZmF1bHQp.txt +1 -1
- package/dist/admin/services/__next._full.txt +2 -2
- package/dist/admin/services/__next._head.txt +1 -1
- package/dist/admin/services/__next._index.txt +2 -2
- package/dist/admin/services/__next._tree.txt +2 -2
- package/dist/admin/services/index.html +1 -1
- package/dist/admin/services/index.txt +2 -2
- package/dist/admin/storage/__next.!KGRlZmF1bHQp.storage.__PAGE__.txt +1 -1
- package/dist/admin/storage/__next.!KGRlZmF1bHQp.storage.txt +1 -1
- package/dist/admin/storage/__next.!KGRlZmF1bHQp.txt +1 -1
- package/dist/admin/storage/__next._full.txt +2 -2
- package/dist/admin/storage/__next._head.txt +1 -1
- package/dist/admin/storage/__next._index.txt +2 -2
- package/dist/admin/storage/__next._tree.txt +2 -2
- package/dist/admin/storage/index.html +1 -1
- package/dist/admin/storage/index.txt +2 -2
- package/dist/admin/workflows/__next.!KGRlZmF1bHQp.txt +1 -1
- package/dist/admin/workflows/__next.!KGRlZmF1bHQp.workflows.__PAGE__.txt +1 -1
- package/dist/admin/workflows/__next.!KGRlZmF1bHQp.workflows.txt +1 -1
- package/dist/admin/workflows/__next._full.txt +2 -2
- package/dist/admin/workflows/__next._head.txt +1 -1
- package/dist/admin/workflows/__next._index.txt +2 -2
- package/dist/admin/workflows/__next._tree.txt +2 -2
- package/dist/admin/workflows/index.html +1 -1
- package/dist/admin/workflows/index.txt +2 -2
- package/dist/cli.js +220 -167
- package/dist/docs/postgres/reshape/index.md +1 -1
- package/package.json +1 -2
- /package/dist/admin/_next/static/{MmCvvejntYmAQXZTK00Mr → qZML8zQZ-3IhVYlWFyLkg}/_buildManifest.js +0 -0
- /package/dist/admin/_next/static/{MmCvvejntYmAQXZTK00Mr → qZML8zQZ-3IhVYlWFyLkg}/_clientMiddlewareManifest.json +0 -0
- /package/dist/admin/_next/static/{MmCvvejntYmAQXZTK00Mr → qZML8zQZ-3IhVYlWFyLkg}/_ssgManifest.js +0 -0
package/dist/cli.js
CHANGED
|
@@ -369438,6 +369438,23 @@ function parseHclErrors(rawError) {
|
|
|
369438
369438
|
}
|
|
369439
369439
|
return errors;
|
|
369440
369440
|
}
|
|
369441
|
+
function compareReshapeMigrationNames(a, b) {
|
|
369442
|
+
const left = a.match(/[0-9]+|[^0-9]/gu) ?? [];
|
|
369443
|
+
const right = b.match(/[0-9]+|[^0-9]/gu) ?? [];
|
|
369444
|
+
for (let i = 0; i < Math.min(left.length, right.length); i++) {
|
|
369445
|
+
const lhs = left[i];
|
|
369446
|
+
const rhs = right[i];
|
|
369447
|
+
if (/^[0-9]/.test(lhs) && /^[0-9]/.test(rhs)) {
|
|
369448
|
+
if (lhs.length !== rhs.length)
|
|
369449
|
+
return lhs.length - rhs.length;
|
|
369450
|
+
if (lhs !== rhs)
|
|
369451
|
+
return lhs < rhs ? -1 : 1;
|
|
369452
|
+
} else if (lhs !== rhs) {
|
|
369453
|
+
return lhs.codePointAt(0) - rhs.codePointAt(0);
|
|
369454
|
+
}
|
|
369455
|
+
}
|
|
369456
|
+
return left.length - right.length;
|
|
369457
|
+
}
|
|
369441
369458
|
function formatConfigError(err, fileContents, filePath) {
|
|
369442
369459
|
const raw = err instanceof Error ? err.message : String(err);
|
|
369443
369460
|
const errors = parseHclErrors(raw);
|
|
@@ -371173,7 +371190,7 @@ function getClient(info) {
|
|
|
371173
371190
|
const cacheKey = `${info.host}:${info.port}:${info.accessKey}`;
|
|
371174
371191
|
const cached2 = clientCache.get(cacheKey);
|
|
371175
371192
|
if (cached2) return cached2;
|
|
371176
|
-
const
|
|
371193
|
+
const client = new S3Client({
|
|
371177
371194
|
endpoint: `http://${info.host}:${info.port}`,
|
|
371178
371195
|
region: "us-east-1",
|
|
371179
371196
|
credentials: {
|
|
@@ -371182,8 +371199,8 @@ function getClient(info) {
|
|
|
371182
371199
|
},
|
|
371183
371200
|
forcePathStyle: true
|
|
371184
371201
|
});
|
|
371185
|
-
clientCache.set(cacheKey,
|
|
371186
|
-
return
|
|
371202
|
+
clientCache.set(cacheKey, client);
|
|
371203
|
+
return client;
|
|
371187
371204
|
}
|
|
371188
371205
|
function sendJson(res, status, body) {
|
|
371189
371206
|
res.setHeader("Content-Type", "application/json");
|
|
@@ -371201,14 +371218,14 @@ async function readJsonBody(req) {
|
|
|
371201
371218
|
const text = Buffer.concat(chunks).toString("utf8");
|
|
371202
371219
|
return text.length > 0 ? JSON.parse(text) : {};
|
|
371203
371220
|
}
|
|
371204
|
-
async function handleListObjects(
|
|
371221
|
+
async function handleListObjects(client, bucket, url, res) {
|
|
371205
371222
|
const prefix = url.searchParams.get("prefix") ?? "";
|
|
371206
371223
|
const cursor = url.searchParams.get("cursor") ?? void 0;
|
|
371207
371224
|
const maxKeys = Math.min(
|
|
371208
371225
|
Math.max(parseInt(url.searchParams.get("maxKeys") ?? "100", 10) || 100, 1),
|
|
371209
371226
|
1e3
|
|
371210
371227
|
);
|
|
371211
|
-
const response = await
|
|
371228
|
+
const response = await client.send(
|
|
371212
371229
|
new ListObjectsV2Command({
|
|
371213
371230
|
Bucket: bucket,
|
|
371214
371231
|
Prefix: prefix,
|
|
@@ -371229,14 +371246,14 @@ async function handleListObjects(client2, bucket, url, res) {
|
|
|
371229
371246
|
prefix
|
|
371230
371247
|
});
|
|
371231
371248
|
}
|
|
371232
|
-
async function handleMetrics(
|
|
371249
|
+
async function handleMetrics(client, bucket, res) {
|
|
371233
371250
|
let totalObjects = 0;
|
|
371234
371251
|
let totalSize = 0;
|
|
371235
371252
|
let continuationToken;
|
|
371236
371253
|
let pages = 0;
|
|
371237
371254
|
const MAX_PAGES = 100;
|
|
371238
371255
|
do {
|
|
371239
|
-
const response = await
|
|
371256
|
+
const response = await client.send(
|
|
371240
371257
|
new ListObjectsV2Command({
|
|
371241
371258
|
Bucket: bucket,
|
|
371242
371259
|
ContinuationToken: continuationToken
|
|
@@ -371256,9 +371273,9 @@ async function handleMetrics(client2, bucket, res) {
|
|
|
371256
371273
|
...pages >= MAX_PAGES ? { truncated: true } : {}
|
|
371257
371274
|
});
|
|
371258
371275
|
}
|
|
371259
|
-
async function handleGetObject(
|
|
371276
|
+
async function handleGetObject(client, bucket, key, res) {
|
|
371260
371277
|
try {
|
|
371261
|
-
const response = await
|
|
371278
|
+
const response = await client.send(
|
|
371262
371279
|
new HeadObjectCommand({ Bucket: bucket, Key: key })
|
|
371263
371280
|
);
|
|
371264
371281
|
sendJson(res, 200, {
|
|
@@ -371278,12 +371295,12 @@ async function handleGetObject(client2, bucket, key, res) {
|
|
|
371278
371295
|
throw error;
|
|
371279
371296
|
}
|
|
371280
371297
|
}
|
|
371281
|
-
async function handleDeleteObject(
|
|
371298
|
+
async function handleDeleteObject(client, bucket, key, res) {
|
|
371282
371299
|
if (key.endsWith("/")) {
|
|
371283
371300
|
const allKeys = [];
|
|
371284
371301
|
let continuationToken;
|
|
371285
371302
|
do {
|
|
371286
|
-
const listResponse = await
|
|
371303
|
+
const listResponse = await client.send(
|
|
371287
371304
|
new ListObjectsV2Command({
|
|
371288
371305
|
Bucket: bucket,
|
|
371289
371306
|
Prefix: key,
|
|
@@ -371298,7 +371315,7 @@ async function handleDeleteObject(client2, bucket, key, res) {
|
|
|
371298
371315
|
const batches = [];
|
|
371299
371316
|
for (let i = 0; i < allKeys.length; i += 1e3) {
|
|
371300
371317
|
batches.push(
|
|
371301
|
-
|
|
371318
|
+
client.send(
|
|
371302
371319
|
new DeleteObjectsCommand({
|
|
371303
371320
|
Bucket: bucket,
|
|
371304
371321
|
Delete: {
|
|
@@ -371311,11 +371328,11 @@ async function handleDeleteObject(client2, bucket, key, res) {
|
|
|
371311
371328
|
}
|
|
371312
371329
|
await Promise.all(batches);
|
|
371313
371330
|
} else {
|
|
371314
|
-
await
|
|
371331
|
+
await client.send(new DeleteObjectCommand({ Bucket: bucket, Key: key }));
|
|
371315
371332
|
}
|
|
371316
371333
|
sendJson(res, 200, { success: true });
|
|
371317
371334
|
}
|
|
371318
|
-
async function handleCreateFolder(
|
|
371335
|
+
async function handleCreateFolder(client, bucket, body, res) {
|
|
371319
371336
|
const path172 = body.path;
|
|
371320
371337
|
if (typeof path172 !== "string") {
|
|
371321
371338
|
sendError(res, 400, "Missing path");
|
|
@@ -371327,12 +371344,12 @@ async function handleCreateFolder(client2, bucket, body, res) {
|
|
|
371327
371344
|
sendError(res, 400, keyError);
|
|
371328
371345
|
return;
|
|
371329
371346
|
}
|
|
371330
|
-
await
|
|
371347
|
+
await client.send(
|
|
371331
371348
|
new PutObjectCommand({ Bucket: bucket, Key: folderKey, Body: "" })
|
|
371332
371349
|
);
|
|
371333
371350
|
sendJson(res, 200, { key: folderKey });
|
|
371334
371351
|
}
|
|
371335
|
-
async function handleRename(
|
|
371352
|
+
async function handleRename(client, bucket, body, res) {
|
|
371336
371353
|
const { sourceKey, destinationKey } = body;
|
|
371337
371354
|
if (typeof sourceKey !== "string" || typeof destinationKey !== "string") {
|
|
371338
371355
|
sendError(res, 400, "Missing sourceKey or destinationKey");
|
|
@@ -371349,7 +371366,7 @@ async function handleRename(client2, bucket, body, res) {
|
|
|
371349
371366
|
const allKeys = [];
|
|
371350
371367
|
let continuationToken;
|
|
371351
371368
|
do {
|
|
371352
|
-
const listResponse = await
|
|
371369
|
+
const listResponse = await client.send(
|
|
371353
371370
|
new ListObjectsV2Command({
|
|
371354
371371
|
Bucket: bucket,
|
|
371355
371372
|
Prefix: sourceKey,
|
|
@@ -371367,7 +371384,7 @@ async function handleRename(client2, bucket, body, res) {
|
|
|
371367
371384
|
}
|
|
371368
371385
|
await Promise.all(
|
|
371369
371386
|
allKeys.map(
|
|
371370
|
-
(k) =>
|
|
371387
|
+
(k) => client.send(
|
|
371371
371388
|
new CopyObjectCommand({
|
|
371372
371389
|
Bucket: bucket,
|
|
371373
371390
|
CopySource: `${bucket}/${encodeURI(k)}`,
|
|
@@ -371379,7 +371396,7 @@ async function handleRename(client2, bucket, body, res) {
|
|
|
371379
371396
|
const deleteBatches = [];
|
|
371380
371397
|
for (let i = 0; i < allKeys.length; i += 1e3) {
|
|
371381
371398
|
deleteBatches.push(
|
|
371382
|
-
|
|
371399
|
+
client.send(
|
|
371383
371400
|
new DeleteObjectsCommand({
|
|
371384
371401
|
Bucket: bucket,
|
|
371385
371402
|
Delete: {
|
|
@@ -371392,27 +371409,27 @@ async function handleRename(client2, bucket, body, res) {
|
|
|
371392
371409
|
}
|
|
371393
371410
|
await Promise.all(deleteBatches);
|
|
371394
371411
|
} else {
|
|
371395
|
-
await
|
|
371412
|
+
await client.send(
|
|
371396
371413
|
new CopyObjectCommand({
|
|
371397
371414
|
Bucket: bucket,
|
|
371398
371415
|
CopySource: `${bucket}/${encodeURI(sourceKey)}`,
|
|
371399
371416
|
Key: destinationKey
|
|
371400
371417
|
})
|
|
371401
371418
|
);
|
|
371402
|
-
await
|
|
371419
|
+
await client.send(
|
|
371403
371420
|
new DeleteObjectCommand({ Bucket: bucket, Key: sourceKey })
|
|
371404
371421
|
);
|
|
371405
371422
|
}
|
|
371406
371423
|
sendJson(res, 200, { key: destinationKey });
|
|
371407
371424
|
}
|
|
371408
|
-
async function handleUploadData(
|
|
371425
|
+
async function handleUploadData(client, bucket, key, req, res) {
|
|
371409
371426
|
const chunks = [];
|
|
371410
371427
|
for await (const chunk of req) {
|
|
371411
371428
|
chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
|
|
371412
371429
|
}
|
|
371413
371430
|
const body = Buffer.concat(chunks);
|
|
371414
371431
|
const contentType = req.headers["content-type"];
|
|
371415
|
-
await
|
|
371432
|
+
await client.send(
|
|
371416
371433
|
new PutObjectCommand({
|
|
371417
371434
|
Bucket: bucket,
|
|
371418
371435
|
Key: key,
|
|
@@ -371423,9 +371440,9 @@ async function handleUploadData(client2, bucket, key, req, res) {
|
|
|
371423
371440
|
res.writeHead(200);
|
|
371424
371441
|
res.end();
|
|
371425
371442
|
}
|
|
371426
|
-
async function handleDownloadData(
|
|
371443
|
+
async function handleDownloadData(client, bucket, key, res) {
|
|
371427
371444
|
try {
|
|
371428
|
-
const response = await
|
|
371445
|
+
const response = await client.send(
|
|
371429
371446
|
new GetObjectCommand({ Bucket: bucket, Key: key })
|
|
371430
371447
|
);
|
|
371431
371448
|
if (response.ContentType) {
|
|
@@ -371492,15 +371509,15 @@ async function handleStorageRequest(req, res, pathname, url, getStorageInstance)
|
|
|
371492
371509
|
sendError(res, 404, `Storage '${storageName}' not found`);
|
|
371493
371510
|
return true;
|
|
371494
371511
|
}
|
|
371495
|
-
const
|
|
371512
|
+
const client = getClient(info);
|
|
371496
371513
|
const bucket = info.bucket;
|
|
371497
371514
|
try {
|
|
371498
371515
|
if (sub === "/objects" && req.method === "GET") {
|
|
371499
|
-
await handleListObjects(
|
|
371516
|
+
await handleListObjects(client, bucket, url, res);
|
|
371500
371517
|
return true;
|
|
371501
371518
|
}
|
|
371502
371519
|
if (sub === "/metrics" && req.method === "GET") {
|
|
371503
|
-
await handleMetrics(
|
|
371520
|
+
await handleMetrics(client, bucket, res);
|
|
371504
371521
|
return true;
|
|
371505
371522
|
}
|
|
371506
371523
|
if (sub === "/object") {
|
|
@@ -371515,11 +371532,11 @@ async function handleStorageRequest(req, res, pathname, url, getStorageInstance)
|
|
|
371515
371532
|
return true;
|
|
371516
371533
|
}
|
|
371517
371534
|
if (req.method === "GET") {
|
|
371518
|
-
await handleGetObject(
|
|
371535
|
+
await handleGetObject(client, bucket, key, res);
|
|
371519
371536
|
return true;
|
|
371520
371537
|
}
|
|
371521
371538
|
if (req.method === "DELETE") {
|
|
371522
|
-
await handleDeleteObject(
|
|
371539
|
+
await handleDeleteObject(client, bucket, key, res);
|
|
371523
371540
|
return true;
|
|
371524
371541
|
}
|
|
371525
371542
|
}
|
|
@@ -371535,22 +371552,22 @@ async function handleStorageRequest(req, res, pathname, url, getStorageInstance)
|
|
|
371535
371552
|
return true;
|
|
371536
371553
|
}
|
|
371537
371554
|
if (req.method === "PUT") {
|
|
371538
|
-
await handleUploadData(
|
|
371555
|
+
await handleUploadData(client, bucket, key, req, res);
|
|
371539
371556
|
return true;
|
|
371540
371557
|
}
|
|
371541
371558
|
if (req.method === "GET") {
|
|
371542
|
-
await handleDownloadData(
|
|
371559
|
+
await handleDownloadData(client, bucket, key, res);
|
|
371543
371560
|
return true;
|
|
371544
371561
|
}
|
|
371545
371562
|
}
|
|
371546
371563
|
if (sub === "/folder" && req.method === "POST") {
|
|
371547
371564
|
const body = await readJsonBody(req);
|
|
371548
|
-
await handleCreateFolder(
|
|
371565
|
+
await handleCreateFolder(client, bucket, body, res);
|
|
371549
371566
|
return true;
|
|
371550
371567
|
}
|
|
371551
371568
|
if (sub === "/rename" && req.method === "POST") {
|
|
371552
371569
|
const body = await readJsonBody(req);
|
|
371553
|
-
await handleRename(
|
|
371570
|
+
await handleRename(client, bucket, body, res);
|
|
371554
371571
|
return true;
|
|
371555
371572
|
}
|
|
371556
371573
|
if (sub === "/presigned" && req.method === "POST") {
|
|
@@ -372308,7 +372325,7 @@ function getMigrationFiles(dir, log) {
|
|
|
372308
372325
|
}
|
|
372309
372326
|
const files = fs10.readdirSync(dir);
|
|
372310
372327
|
log(`Found ${files.length} files in directory`);
|
|
372311
|
-
const tomlFiles = files.filter((f) => f.endsWith(".toml")).sort((a, b) => a
|
|
372328
|
+
const tomlFiles = files.filter((f) => f.endsWith(".toml")).sort((a, b) => compareReshapeMigrationNames(getMigrationName(a), getMigrationName(b)));
|
|
372312
372329
|
log(`Found ${tomlFiles.length} .toml migration files: ${tomlFiles.join(", ") || "(none)"}`);
|
|
372313
372330
|
return tomlFiles;
|
|
372314
372331
|
}
|
|
@@ -372577,7 +372594,7 @@ function createReshapeWatcher(options2) {
|
|
|
372577
372594
|
const isNewest = newMigrationFiles[newMigrationFiles.length - 1] === filename;
|
|
372578
372595
|
log(`Is this the newest migration? ${isNewest}`);
|
|
372579
372596
|
if (!isNewest) {
|
|
372580
|
-
log(`Warning: Added migration "${filename}" is not the latest in
|
|
372597
|
+
log(`Warning: Added migration "${filename}" is not the latest in Reshape's natural order`);
|
|
372581
372598
|
log(` Latest migration: ${newMigrationFiles[newMigrationFiles.length - 1]}`);
|
|
372582
372599
|
log(` Manual intervention may be needed to ensure correct migration order`);
|
|
372583
372600
|
return;
|
|
@@ -374612,7 +374629,6 @@ function getDefaultKey() {
|
|
|
374612
374629
|
}
|
|
374613
374630
|
|
|
374614
374631
|
// src/lib/analytics/index.ts
|
|
374615
|
-
import { PostHog } from "posthog-node";
|
|
374616
374632
|
import * as os6 from "os";
|
|
374617
374633
|
import * as crypto4 from "crypto";
|
|
374618
374634
|
|
|
@@ -375330,11 +375346,11 @@ async function getAgentAccessToken(credentials) {
|
|
|
375330
375346
|
}
|
|
375331
375347
|
async function saveCredentialsFromToken(token, deviceCode) {
|
|
375332
375348
|
const freebuffConversionToken = (deviceCode ? readDeviceAttribution(deviceCode) : void 0) ?? process.env.SPECIFIC_FREEBUFF_BFCID;
|
|
375333
|
-
const
|
|
375349
|
+
const client = new ApiClient({
|
|
375334
375350
|
token: token.access_token,
|
|
375335
375351
|
...freebuffConversionToken ? { freebuffConversionToken } : {}
|
|
375336
375352
|
});
|
|
375337
|
-
const user = await
|
|
375353
|
+
const user = await client.getMe();
|
|
375338
375354
|
const expiresAt = getTokenExpiresAt(token.access_token) ?? Date.now() + 3600 * 1e3;
|
|
375339
375355
|
writeUserCredentials({
|
|
375340
375356
|
accessToken: token.access_token,
|
|
@@ -375407,7 +375423,8 @@ async function getValidAccessToken() {
|
|
|
375407
375423
|
|
|
375408
375424
|
// src/lib/analytics/index.ts
|
|
375409
375425
|
var POSTHOG_HOST = "https://eu.i.posthog.com";
|
|
375410
|
-
var
|
|
375426
|
+
var pendingRequests = /* @__PURE__ */ new Set();
|
|
375427
|
+
var shuttingDown = false;
|
|
375411
375428
|
var anonymousId = null;
|
|
375412
375429
|
var identified = false;
|
|
375413
375430
|
function isEnabled() {
|
|
@@ -375428,52 +375445,88 @@ function getProjectId() {
|
|
|
375428
375445
|
}
|
|
375429
375446
|
return void 0;
|
|
375430
375447
|
}
|
|
375431
|
-
function
|
|
375432
|
-
|
|
375433
|
-
|
|
375434
|
-
|
|
375435
|
-
|
|
375436
|
-
|
|
375437
|
-
|
|
375438
|
-
|
|
375448
|
+
async function sendEvents(events) {
|
|
375449
|
+
let timer;
|
|
375450
|
+
const controller = new AbortController();
|
|
375451
|
+
try {
|
|
375452
|
+
const body = JSON.stringify({
|
|
375453
|
+
api_key: "phc_qNQCEUXh6ErdciQRRmeG2xlVvwFjkcW6A5bnOFJ8vXZ",
|
|
375454
|
+
batch: events.map((event) => ({
|
|
375455
|
+
...event,
|
|
375456
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
375457
|
+
uuid: crypto4.randomUUID(),
|
|
375458
|
+
properties: {
|
|
375459
|
+
...event.properties,
|
|
375460
|
+
$geoip_disable: true,
|
|
375461
|
+
$lib: "specific-cli",
|
|
375462
|
+
$lib_version: "0.1.225"
|
|
375463
|
+
}
|
|
375464
|
+
}))
|
|
375439
375465
|
});
|
|
375466
|
+
await Promise.race([
|
|
375467
|
+
fetch(`${POSTHOG_HOST}/batch/`, {
|
|
375468
|
+
method: "POST",
|
|
375469
|
+
headers: { "Content-Type": "application/json" },
|
|
375470
|
+
body,
|
|
375471
|
+
signal: controller.signal
|
|
375472
|
+
}).then(async (response) => {
|
|
375473
|
+
await response.body?.cancel();
|
|
375474
|
+
}),
|
|
375475
|
+
new Promise((resolve10) => {
|
|
375476
|
+
timer = setTimeout(() => {
|
|
375477
|
+
controller.abort();
|
|
375478
|
+
resolve10();
|
|
375479
|
+
}, 1e3);
|
|
375480
|
+
timer.unref();
|
|
375481
|
+
})
|
|
375482
|
+
]);
|
|
375483
|
+
} catch {
|
|
375484
|
+
} finally {
|
|
375485
|
+
clearTimeout(timer);
|
|
375486
|
+
controller.abort();
|
|
375440
375487
|
}
|
|
375441
|
-
return client;
|
|
375442
375488
|
}
|
|
375443
375489
|
function trackEvent(event, properties) {
|
|
375444
|
-
|
|
375445
|
-
|
|
375446
|
-
|
|
375447
|
-
|
|
375448
|
-
|
|
375449
|
-
|
|
375450
|
-
|
|
375490
|
+
try {
|
|
375491
|
+
if (!isEnabled() || shuttingDown) return;
|
|
375492
|
+
const userId = getUserId();
|
|
375493
|
+
const distinctId = userId ?? getAnonymousId();
|
|
375494
|
+
const events = [];
|
|
375495
|
+
if (userId && !identified) {
|
|
375496
|
+
events.push({
|
|
375497
|
+
event: "$identify",
|
|
375498
|
+
distinct_id: userId,
|
|
375499
|
+
properties: { $set: { anonymous_id: getAnonymousId() } }
|
|
375500
|
+
}, {
|
|
375501
|
+
event: "$create_alias",
|
|
375502
|
+
distinct_id: userId,
|
|
375503
|
+
properties: { distinct_id: userId, alias: getAnonymousId() }
|
|
375504
|
+
});
|
|
375505
|
+
identified = true;
|
|
375506
|
+
}
|
|
375507
|
+
events.push({
|
|
375508
|
+
event,
|
|
375509
|
+
distinct_id: distinctId,
|
|
375451
375510
|
properties: {
|
|
375452
|
-
|
|
375511
|
+
...properties,
|
|
375512
|
+
cli_version: "0.1.225",
|
|
375513
|
+
platform: process.platform,
|
|
375514
|
+
node_version: process.version,
|
|
375515
|
+
project_id: getProjectId()
|
|
375453
375516
|
}
|
|
375454
375517
|
});
|
|
375455
|
-
|
|
375456
|
-
|
|
375457
|
-
|
|
375458
|
-
|
|
375518
|
+
const request2 = sendEvents(events);
|
|
375519
|
+
pendingRequests.add(request2);
|
|
375520
|
+
void request2.then(
|
|
375521
|
+
() => pendingRequests.delete(request2),
|
|
375522
|
+
() => pendingRequests.delete(request2)
|
|
375523
|
+
);
|
|
375524
|
+
} catch {
|
|
375459
375525
|
}
|
|
375460
|
-
ph.capture({
|
|
375461
|
-
distinctId: userId ?? getAnonymousId(),
|
|
375462
|
-
event,
|
|
375463
|
-
properties: {
|
|
375464
|
-
...properties,
|
|
375465
|
-
cli_version: "0.1.223",
|
|
375466
|
-
platform: process.platform,
|
|
375467
|
-
node_version: process.version,
|
|
375468
|
-
project_id: getProjectId()
|
|
375469
|
-
}
|
|
375470
|
-
});
|
|
375471
375526
|
}
|
|
375472
375527
|
async function shutdown() {
|
|
375473
|
-
|
|
375474
|
-
|
|
375475
|
-
client = null;
|
|
375476
|
-
}
|
|
375528
|
+
shuttingDown = true;
|
|
375529
|
+
await Promise.allSettled([...pendingRequests]);
|
|
375477
375530
|
}
|
|
375478
375531
|
|
|
375479
375532
|
// src/commands/init.tsx
|
|
@@ -377670,9 +377723,9 @@ async function performAgentLogin() {
|
|
|
377670
377723
|
userId: ""
|
|
377671
377724
|
};
|
|
377672
377725
|
const accessToken = await getAgentAccessToken(base);
|
|
377673
|
-
const
|
|
377674
|
-
const me = await
|
|
377675
|
-
const info = await
|
|
377726
|
+
const client = new SpecificClient({ accessToken, ...freebuffAttributionOptions() });
|
|
377727
|
+
const me = await client.getMe();
|
|
377728
|
+
const info = await client.getAgentRegistration();
|
|
377676
377729
|
writeUserCredentials({ ...readAgentCredentials() ?? base, userId: me.id });
|
|
377677
377730
|
writeLog("auth", `Agent credentials written for user ${me.id}`);
|
|
377678
377731
|
return { registrationId: registration.id, claimDeadlineAt: new Date(info.claimDeadlineAt) };
|
|
@@ -377697,14 +377750,14 @@ function isExpiredRegistrationError(err) {
|
|
|
377697
377750
|
return err instanceof AgentRegistrationExpiredError || err instanceof ApiError && err.code === "AGENT_REGISTRATION_EXPIRED";
|
|
377698
377751
|
}
|
|
377699
377752
|
async function describeAgentAccount(credentials) {
|
|
377700
|
-
const
|
|
377753
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken, ...freebuffAttributionOptions() });
|
|
377701
377754
|
try {
|
|
377702
|
-
const info = await
|
|
377755
|
+
const info = await client.getAgentRegistration();
|
|
377703
377756
|
if (info.status === "expired") return { status: "expired" };
|
|
377704
377757
|
if (info.status === "unclaimed") {
|
|
377705
377758
|
return { status: "unclaimed", claimDeadlineAt: new Date(info.claimDeadlineAt) };
|
|
377706
377759
|
}
|
|
377707
|
-
const me = await
|
|
377760
|
+
const me = await client.getMe();
|
|
377708
377761
|
const current = readAgentCredentials() ?? credentials;
|
|
377709
377762
|
if (!current.claimed) {
|
|
377710
377763
|
writeUserCredentials({ ...current, claimVerified: void 0, claimed: true, userId: me.id });
|
|
@@ -377745,8 +377798,8 @@ function requireAgentCredentials() {
|
|
|
377745
377798
|
async function startClaim(email) {
|
|
377746
377799
|
const credentials = requireAgentCredentials();
|
|
377747
377800
|
if (credentials.claimed) {
|
|
377748
|
-
const
|
|
377749
|
-
const me = await
|
|
377801
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken, ...freebuffAttributionOptions() });
|
|
377802
|
+
const me = await client.getMe();
|
|
377750
377803
|
return { phase: "completed", email: me.email, alreadyClaimed: true };
|
|
377751
377804
|
}
|
|
377752
377805
|
if (credentials.claimVerified) {
|
|
@@ -377763,8 +377816,8 @@ async function startClaim(email) {
|
|
|
377763
377816
|
async function completeClaim(userCode) {
|
|
377764
377817
|
let credentials = requireAgentCredentials();
|
|
377765
377818
|
if (credentials.claimed) {
|
|
377766
|
-
const
|
|
377767
|
-
const me = await
|
|
377819
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken, ...freebuffAttributionOptions() });
|
|
377820
|
+
const me = await client.getMe();
|
|
377768
377821
|
return { phase: "completed", email: me.email, alreadyClaimed: true };
|
|
377769
377822
|
}
|
|
377770
377823
|
if (credentials.claimVerified) {
|
|
@@ -377779,8 +377832,8 @@ async function completeClaim(userCode) {
|
|
|
377779
377832
|
return await handOverToPlatform(credentials);
|
|
377780
377833
|
}
|
|
377781
377834
|
async function handOverToPlatform(credentials) {
|
|
377782
|
-
const
|
|
377783
|
-
const result = await
|
|
377835
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken, ...freebuffAttributionOptions() });
|
|
377836
|
+
const result = await client.claimAgentRegistration();
|
|
377784
377837
|
writeUserCredentials({ ...credentials, claimVerified: void 0, claimed: true, userId: result.user.id });
|
|
377785
377838
|
writeLog("auth", `Agent registration claimed by ${result.user.email}`);
|
|
377786
377839
|
return { phase: "completed", email: result.user.email, alreadyClaimed: false };
|
|
@@ -377807,9 +377860,9 @@ function describeClaimError(err) {
|
|
|
377807
377860
|
}
|
|
377808
377861
|
|
|
377809
377862
|
// src/lib/deployments/inputs.ts
|
|
377810
|
-
async function submitProvidedDeploymentSecrets(
|
|
377863
|
+
async function submitProvidedDeploymentSecrets(client, deploymentId, secrets) {
|
|
377811
377864
|
if (Object.keys(secrets).length === 0) return;
|
|
377812
|
-
await
|
|
377865
|
+
await client.submitSecrets(deploymentId, secrets);
|
|
377813
377866
|
}
|
|
377814
377867
|
|
|
377815
377868
|
// src/lib/deployments/target.ts
|
|
@@ -377818,8 +377871,8 @@ function validateDeployTargetOptions(options2) {
|
|
|
377818
377871
|
throw new Error("--preview cannot be combined with --environment");
|
|
377819
377872
|
}
|
|
377820
377873
|
}
|
|
377821
|
-
async function resolveExplicitDeployEnvironment(
|
|
377822
|
-
const status = await
|
|
377874
|
+
async function resolveExplicitDeployEnvironment(client, projectId, target) {
|
|
377875
|
+
const status = await client.getProjectStatus(projectId);
|
|
377823
377876
|
const environments = [
|
|
377824
377877
|
...status.environments,
|
|
377825
377878
|
...status.previewEnvironments ?? []
|
|
@@ -378172,10 +378225,10 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378172
378225
|
let cancelled = false;
|
|
378173
378226
|
async function loadProjects() {
|
|
378174
378227
|
try {
|
|
378175
|
-
const
|
|
378228
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
378176
378229
|
const [projects2, organizations] = await Promise.all([
|
|
378177
|
-
|
|
378178
|
-
|
|
378230
|
+
client.listProjects(),
|
|
378231
|
+
client.listOrganizations()
|
|
378179
378232
|
]);
|
|
378180
378233
|
if (cancelled) return;
|
|
378181
378234
|
const items = buildSelectorItems(projects2, organizations);
|
|
@@ -378231,8 +378284,8 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378231
378284
|
let cancelled = false;
|
|
378232
378285
|
async function createProject() {
|
|
378233
378286
|
try {
|
|
378234
|
-
const
|
|
378235
|
-
const project = await
|
|
378287
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
378288
|
+
const project = await client.createProject(state.newProjectName, state.selectedOrganizationId);
|
|
378236
378289
|
if (cancelled) return;
|
|
378237
378290
|
writeProjectId(project.id);
|
|
378238
378291
|
setState({
|
|
@@ -378258,10 +378311,10 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378258
378311
|
let cancelled = false;
|
|
378259
378312
|
async function loadEnvironments() {
|
|
378260
378313
|
try {
|
|
378261
|
-
const
|
|
378314
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
378262
378315
|
let environments = state.environments;
|
|
378263
378316
|
if (!environments) {
|
|
378264
|
-
const projects2 = await
|
|
378317
|
+
const projects2 = await client.listProjects();
|
|
378265
378318
|
const project = projects2.find((p) => p.id === state.projectId);
|
|
378266
378319
|
if (!project) {
|
|
378267
378320
|
if (cancelled) return;
|
|
@@ -378288,7 +378341,7 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378288
378341
|
if (envFlag) {
|
|
378289
378342
|
try {
|
|
378290
378343
|
const match = await resolveExplicitDeployEnvironment(
|
|
378291
|
-
|
|
378344
|
+
client,
|
|
378292
378345
|
state.projectId,
|
|
378293
378346
|
envFlag
|
|
378294
378347
|
);
|
|
@@ -378374,19 +378427,19 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378374
378427
|
let cancelled = false;
|
|
378375
378428
|
async function createPreview() {
|
|
378376
378429
|
try {
|
|
378377
|
-
const
|
|
378430
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
378378
378431
|
const projectDir = process.cwd();
|
|
378379
378432
|
const previousPreviewId = readPreviewEnvironmentId(projectDir);
|
|
378380
378433
|
if (previousPreviewId) {
|
|
378381
378434
|
setState((s) => ({ ...s, previewStatus: "Tearing down previous preview environment" }));
|
|
378382
378435
|
try {
|
|
378383
|
-
await
|
|
378436
|
+
await client.deletePreviewEnvironment(previousPreviewId);
|
|
378384
378437
|
} catch {
|
|
378385
378438
|
}
|
|
378386
378439
|
}
|
|
378387
378440
|
if (cancelled) return;
|
|
378388
378441
|
setState((s) => ({ ...s, previewStatus: "Creating preview environment" }));
|
|
378389
|
-
const previewEnv = await
|
|
378442
|
+
const previewEnv = await client.createPreviewEnvironment(state.projectId);
|
|
378390
378443
|
writePreviewEnvironmentId(previewEnv.id, projectDir);
|
|
378391
378444
|
if (cancelled) return;
|
|
378392
378445
|
setState((s) => ({
|
|
@@ -378496,15 +378549,15 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378496
378549
|
(secret) => secretValues[secret]
|
|
378497
378550
|
);
|
|
378498
378551
|
if (!allSecretsCollected) return;
|
|
378499
|
-
const
|
|
378500
|
-
if (!
|
|
378552
|
+
const client = clientRef.current;
|
|
378553
|
+
if (!client) return;
|
|
378501
378554
|
(async () => {
|
|
378502
378555
|
try {
|
|
378503
378556
|
writeLog(
|
|
378504
378557
|
"deploy",
|
|
378505
378558
|
`Submitting secrets: ${Object.keys(secretValues).join(", ")}`
|
|
378506
378559
|
);
|
|
378507
|
-
await
|
|
378560
|
+
await client.submitSecrets(deployment2.id, secretValues);
|
|
378508
378561
|
writeLog("deploy", "Secrets submitted successfully");
|
|
378509
378562
|
setState((s) => ({
|
|
378510
378563
|
...s,
|
|
@@ -378538,15 +378591,15 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378538
378591
|
(config2) => configValues[config2]
|
|
378539
378592
|
);
|
|
378540
378593
|
if (!allConfigsCollected) return;
|
|
378541
|
-
const
|
|
378542
|
-
if (!
|
|
378594
|
+
const client = clientRef.current;
|
|
378595
|
+
if (!client) return;
|
|
378543
378596
|
(async () => {
|
|
378544
378597
|
try {
|
|
378545
378598
|
writeLog(
|
|
378546
378599
|
"deploy",
|
|
378547
378600
|
`Submitting configs: ${Object.keys(configValues).join(", ")}`
|
|
378548
378601
|
);
|
|
378549
|
-
await
|
|
378602
|
+
await client.submitConfigs(deployment2.id, configValues);
|
|
378550
378603
|
writeLog("deploy", "Configs submitted successfully");
|
|
378551
378604
|
setState((s) => ({
|
|
378552
378605
|
...s,
|
|
@@ -378573,8 +378626,8 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378573
378626
|
const projectDir = process.cwd();
|
|
378574
378627
|
writeLog("deploy", `Starting deployment to "${state.environmentName}"`);
|
|
378575
378628
|
writeLog("deploy", `Project directory: ${projectDir}`);
|
|
378576
|
-
const
|
|
378577
|
-
clientRef.current =
|
|
378629
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
378630
|
+
clientRef.current = client;
|
|
378578
378631
|
if (cancelled) return;
|
|
378579
378632
|
let tarball;
|
|
378580
378633
|
let appPath;
|
|
@@ -378603,7 +378656,7 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378603
378656
|
try {
|
|
378604
378657
|
writeLog("deploy", `Creating deployment for project ${state.projectId}`);
|
|
378605
378658
|
const gitInfo = getGitInfo(projectDir);
|
|
378606
|
-
deployment2 = await
|
|
378659
|
+
deployment2 = await client.createDeployment(state.projectId, state.environmentId, {
|
|
378607
378660
|
triggeredBy: "cli",
|
|
378608
378661
|
...gitInfo && {
|
|
378609
378662
|
gitCommitSha: gitInfo.commitSha,
|
|
@@ -378669,7 +378722,7 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378669
378722
|
setState((s) => ({ ...s, phase: "uploading", deployment: deployment2 }));
|
|
378670
378723
|
try {
|
|
378671
378724
|
writeLog("deploy", `Uploading tarball (${tarball.length} bytes, appPath: ${appPath})`);
|
|
378672
|
-
deployment2 = await
|
|
378725
|
+
deployment2 = await client.uploadTarball(deployment2.id, tarball, appPath, {
|
|
378673
378726
|
uploadUrl: deployment2.uploadUrl,
|
|
378674
378727
|
maxTarballBytes: deployment2.maxTarballBytes,
|
|
378675
378728
|
onProgress: makeUploadProgressHandler(setState)
|
|
@@ -378699,12 +378752,12 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378699
378752
|
if (state.phase !== "pending" || !state.deployment) return;
|
|
378700
378753
|
let pollInterval;
|
|
378701
378754
|
let cancelled = false;
|
|
378702
|
-
const
|
|
378703
|
-
if (!
|
|
378755
|
+
const client = clientRef.current;
|
|
378756
|
+
if (!client) return;
|
|
378704
378757
|
const pollForPendingActions = async () => {
|
|
378705
378758
|
if (cancelled) return;
|
|
378706
378759
|
try {
|
|
378707
|
-
const status = await
|
|
378760
|
+
const status = await client.getDeployment(state.deployment.id);
|
|
378708
378761
|
if (cancelled) return;
|
|
378709
378762
|
writeLog(
|
|
378710
378763
|
"deploy",
|
|
@@ -378843,12 +378896,12 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378843
378896
|
useEffect6(() => {
|
|
378844
378897
|
if (state.phase !== "starting" || !state.deployment) return;
|
|
378845
378898
|
let cancelled = false;
|
|
378846
|
-
const
|
|
378847
|
-
if (!
|
|
378899
|
+
const client = clientRef.current;
|
|
378900
|
+
if (!client) return;
|
|
378848
378901
|
(async () => {
|
|
378849
378902
|
try {
|
|
378850
378903
|
writeLog("deploy", "Calling /start endpoint");
|
|
378851
|
-
await
|
|
378904
|
+
await client.startDeployment(state.deployment.id);
|
|
378852
378905
|
writeLog("deploy", "Deployment started successfully");
|
|
378853
378906
|
if (cancelled) return;
|
|
378854
378907
|
setState((s) => ({
|
|
@@ -378878,12 +378931,12 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378878
378931
|
if (state.phase !== "queued" && state.phase !== "deploying" || !state.deployment) return;
|
|
378879
378932
|
let pollInterval;
|
|
378880
378933
|
let cancelled = false;
|
|
378881
|
-
const
|
|
378882
|
-
if (!
|
|
378934
|
+
const client = clientRef.current;
|
|
378935
|
+
if (!client) return;
|
|
378883
378936
|
const pollForCompletion = async () => {
|
|
378884
378937
|
if (cancelled) return;
|
|
378885
378938
|
try {
|
|
378886
|
-
const status = await
|
|
378939
|
+
const status = await client.getDeployment(state.deployment.id);
|
|
378887
378940
|
if (cancelled) return;
|
|
378888
378941
|
writeLog(
|
|
378889
378942
|
"deploy",
|
|
@@ -379130,7 +379183,7 @@ async function runDeployPipeline(options2) {
|
|
|
379130
379183
|
console.error(`Error: ${message}`);
|
|
379131
379184
|
process.exit(1);
|
|
379132
379185
|
}
|
|
379133
|
-
const
|
|
379186
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
379134
379187
|
let projectId = options2.projectId;
|
|
379135
379188
|
let projectIdFromLinkedFile = false;
|
|
379136
379189
|
if (!projectId) {
|
|
@@ -379152,17 +379205,17 @@ async function runDeployPipeline(options2) {
|
|
|
379152
379205
|
if (previousPreviewId) {
|
|
379153
379206
|
console.log("Cleaning up previous preview environment...");
|
|
379154
379207
|
try {
|
|
379155
|
-
await
|
|
379208
|
+
await client.deletePreviewEnvironment(previousPreviewId);
|
|
379156
379209
|
} catch {
|
|
379157
379210
|
}
|
|
379158
379211
|
}
|
|
379159
379212
|
console.log("Creating preview environment...");
|
|
379160
|
-
const preview = await
|
|
379213
|
+
const preview = await client.createPreviewEnvironment(projectId);
|
|
379161
379214
|
writePreviewEnvironmentId(preview.id, projectDir);
|
|
379162
379215
|
console.log(`Preview environment "${preview.name}" created (expires: ${new Date(preview.expiresAt).toLocaleString()})`);
|
|
379163
379216
|
previewEnvironmentId = preview.id;
|
|
379164
379217
|
}
|
|
379165
|
-
const projects = await
|
|
379218
|
+
const projects = await client.listProjects();
|
|
379166
379219
|
const project = projects.find((p) => p.id === projectId);
|
|
379167
379220
|
if (!project) {
|
|
379168
379221
|
if (projectIdFromLinkedFile) {
|
|
@@ -379185,7 +379238,7 @@ async function runDeployPipeline(options2) {
|
|
|
379185
379238
|
} else if (options2.environment) {
|
|
379186
379239
|
try {
|
|
379187
379240
|
const match = await resolveExplicitDeployEnvironment(
|
|
379188
|
-
|
|
379241
|
+
client,
|
|
379189
379242
|
projectId,
|
|
379190
379243
|
options2.environment
|
|
379191
379244
|
);
|
|
@@ -379267,7 +379320,7 @@ async function runDeployPipeline(options2) {
|
|
|
379267
379320
|
let deployment;
|
|
379268
379321
|
try {
|
|
379269
379322
|
const gitInfo = getGitInfo(projectDir);
|
|
379270
|
-
deployment = await
|
|
379323
|
+
deployment = await client.createDeployment(projectId, environmentId, {
|
|
379271
379324
|
triggeredBy: "cli",
|
|
379272
379325
|
...gitInfo && {
|
|
379273
379326
|
gitCommitSha: gitInfo.commitSha,
|
|
@@ -379312,7 +379365,7 @@ async function runDeployPipeline(options2) {
|
|
|
379312
379365
|
console.log("Uploading...");
|
|
379313
379366
|
try {
|
|
379314
379367
|
let lastPct = -1;
|
|
379315
|
-
deployment = await
|
|
379368
|
+
deployment = await client.uploadTarball(deployment.id, tarball, appPath, {
|
|
379316
379369
|
uploadUrl: deployment.uploadUrl,
|
|
379317
379370
|
maxTarballBytes: deployment.maxTarballBytes,
|
|
379318
379371
|
onProgress: (bytesSent, totalBytes) => {
|
|
@@ -379329,7 +379382,7 @@ async function runDeployPipeline(options2) {
|
|
|
379329
379382
|
process.exit(1);
|
|
379330
379383
|
}
|
|
379331
379384
|
try {
|
|
379332
|
-
await submitProvidedDeploymentSecrets(
|
|
379385
|
+
await submitProvidedDeploymentSecrets(client, deployment.id, parsedSecrets);
|
|
379333
379386
|
} catch (err) {
|
|
379334
379387
|
console.error(`Error: Failed to submit secrets: ${err instanceof Error ? err.message : String(err)}`);
|
|
379335
379388
|
process.exit(1);
|
|
@@ -379337,7 +379390,7 @@ async function runDeployPipeline(options2) {
|
|
|
379337
379390
|
console.log("Waiting for build...");
|
|
379338
379391
|
while (true) {
|
|
379339
379392
|
await new Promise((resolve10) => setTimeout(resolve10, 2e3));
|
|
379340
|
-
const status = await
|
|
379393
|
+
const status = await client.getDeployment(deployment.id);
|
|
379341
379394
|
deployment = status;
|
|
379342
379395
|
if (status.state === "failed") {
|
|
379343
379396
|
console.error(`Error: Deployment failed: ${status.stateMessage || "Unknown error"}`);
|
|
@@ -379378,7 +379431,7 @@ ${failedBuild.output}`);
|
|
|
379378
379431
|
);
|
|
379379
379432
|
process.exit(1);
|
|
379380
379433
|
}
|
|
379381
|
-
await
|
|
379434
|
+
await client.submitSecrets(deployment.id, secretsToSubmit);
|
|
379382
379435
|
continue;
|
|
379383
379436
|
}
|
|
379384
379437
|
const missingConfigs = getMissingConfigs(status.pendingActions);
|
|
@@ -379399,7 +379452,7 @@ ${failedBuild.output}`);
|
|
|
379399
379452
|
);
|
|
379400
379453
|
process.exit(1);
|
|
379401
379454
|
}
|
|
379402
|
-
await
|
|
379455
|
+
await client.submitConfigs(deployment.id, configsToSubmit);
|
|
379403
379456
|
continue;
|
|
379404
379457
|
}
|
|
379405
379458
|
if (hasBuildsInProgress(status.pendingActions)) {
|
|
@@ -379418,7 +379471,7 @@ ${failedBuild.output}`);
|
|
|
379418
379471
|
}
|
|
379419
379472
|
console.log("Starting deployment...");
|
|
379420
379473
|
try {
|
|
379421
|
-
await
|
|
379474
|
+
await client.startDeployment(deployment.id);
|
|
379422
379475
|
} catch (err) {
|
|
379423
379476
|
if (err instanceof ApiError && err.code === CLI_DEPLOYMENTS_DISABLED_CODE) {
|
|
379424
379477
|
console.error(
|
|
@@ -379440,7 +379493,7 @@ ${failedBuild.output}`);
|
|
|
379440
379493
|
);
|
|
379441
379494
|
console.log("Cleaning up preview environment...");
|
|
379442
379495
|
try {
|
|
379443
|
-
await
|
|
379496
|
+
await client.deletePreviewEnvironment(previewEnvironmentId);
|
|
379444
379497
|
} catch {
|
|
379445
379498
|
}
|
|
379446
379499
|
clearPreviewEnvironmentId(projectDir);
|
|
@@ -379452,7 +379505,7 @@ ${failedBuild.output}`);
|
|
|
379452
379505
|
console.log("Deploying...");
|
|
379453
379506
|
while (true) {
|
|
379454
379507
|
await new Promise((resolve10) => setTimeout(resolve10, 2e3));
|
|
379455
|
-
const status = await
|
|
379508
|
+
const status = await client.getDeployment(deployment.id);
|
|
379456
379509
|
deployment = status;
|
|
379457
379510
|
if (status.state === "failed") {
|
|
379458
379511
|
if (status.error) {
|
|
@@ -380518,7 +380571,7 @@ function compareVersions(a, b) {
|
|
|
380518
380571
|
return 0;
|
|
380519
380572
|
}
|
|
380520
380573
|
async function checkForUpdate() {
|
|
380521
|
-
const currentVersion = "0.1.
|
|
380574
|
+
const currentVersion = "0.1.225";
|
|
380522
380575
|
const response = await fetch(`${BINARIES_BASE_URL}/latest?t=${Date.now()}`);
|
|
380523
380576
|
if (!response.ok) {
|
|
380524
380577
|
throw new Error(`Failed to check for updates: HTTP ${response.status}`);
|
|
@@ -380716,10 +380769,10 @@ function updateCommand() {
|
|
|
380716
380769
|
// src/commands/project.tsx
|
|
380717
380770
|
async function projectNewCommand(name, options2) {
|
|
380718
380771
|
try {
|
|
380719
|
-
const
|
|
380772
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
380720
380773
|
let orgId = options2.org;
|
|
380721
380774
|
if (!orgId) {
|
|
380722
|
-
const organizations = await
|
|
380775
|
+
const organizations = await client.listOrganizations();
|
|
380723
380776
|
if (organizations.length === 0) {
|
|
380724
380777
|
console.error(
|
|
380725
380778
|
"You don't belong to any organizations. Please create one first."
|
|
@@ -380739,7 +380792,7 @@ async function projectNewCommand(name, options2) {
|
|
|
380739
380792
|
process.exit(1);
|
|
380740
380793
|
}
|
|
380741
380794
|
}
|
|
380742
|
-
const project = await
|
|
380795
|
+
const project = await client.createProject(name, orgId);
|
|
380743
380796
|
console.log(`Project created: ${project.id}`);
|
|
380744
380797
|
} catch (error) {
|
|
380745
380798
|
const quotaMessage = formatProjectQuotaError(error);
|
|
@@ -380754,10 +380807,10 @@ async function projectNewCommand(name, options2) {
|
|
|
380754
380807
|
}
|
|
380755
380808
|
async function projectListCommand() {
|
|
380756
380809
|
try {
|
|
380757
|
-
const
|
|
380810
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
380758
380811
|
const [projects, organizations] = await Promise.all([
|
|
380759
|
-
|
|
380760
|
-
|
|
380812
|
+
client.listProjects(),
|
|
380813
|
+
client.listOrganizations()
|
|
380761
380814
|
]);
|
|
380762
380815
|
if (projects.length === 0) {
|
|
380763
380816
|
console.log("No projects found.");
|
|
@@ -380853,8 +380906,8 @@ function StatusUI({ previews = false }) {
|
|
|
380853
380906
|
(async () => {
|
|
380854
380907
|
try {
|
|
380855
380908
|
const projectId = readProjectId();
|
|
380856
|
-
const
|
|
380857
|
-
const status2 = await
|
|
380909
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
380910
|
+
const status2 = await client.getProjectStatus(projectId);
|
|
380858
380911
|
setState({ phase: "success", status: status2 });
|
|
380859
380912
|
} catch (err) {
|
|
380860
380913
|
setState({
|
|
@@ -380901,8 +380954,8 @@ async function statusCommand(options2 = {}) {
|
|
|
380901
380954
|
return;
|
|
380902
380955
|
}
|
|
380903
380956
|
const projectId = readProjectId();
|
|
380904
|
-
const
|
|
380905
|
-
const status = await
|
|
380957
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
380958
|
+
const status = await client.getProjectStatus(projectId);
|
|
380906
380959
|
process.stdout.write(JSON.stringify(status, null, 2) + "\n");
|
|
380907
380960
|
} catch (err) {
|
|
380908
380961
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -380912,8 +380965,8 @@ async function statusCommand(options2 = {}) {
|
|
|
380912
380965
|
}
|
|
380913
380966
|
|
|
380914
380967
|
// src/lib/project/resolve-env.ts
|
|
380915
|
-
async function resolveEnvironmentStatus(
|
|
380916
|
-
const status = await
|
|
380968
|
+
async function resolveEnvironmentStatus(client, projectId, envFlag) {
|
|
380969
|
+
const status = await client.getProjectStatus(projectId);
|
|
380917
380970
|
const environments = status.environments;
|
|
380918
380971
|
const previewEnvironments = status.previewEnvironments ?? [];
|
|
380919
380972
|
if (envFlag) {
|
|
@@ -380949,8 +381002,8 @@ async function resolveEnvironmentStatus(client2, projectId, envFlag) {
|
|
|
380949
381002
|
`Project has multiple environments (${names}). Pass --environment <name|id>.`
|
|
380950
381003
|
);
|
|
380951
381004
|
}
|
|
380952
|
-
async function resolveEnvironmentId(
|
|
380953
|
-
const match = await resolveEnvironmentStatus(
|
|
381005
|
+
async function resolveEnvironmentId(client, projectId, envFlag) {
|
|
381006
|
+
const match = await resolveEnvironmentStatus(client, projectId, envFlag);
|
|
380954
381007
|
return match.id;
|
|
380955
381008
|
}
|
|
380956
381009
|
|
|
@@ -381144,9 +381197,9 @@ async function queryCommand(sqlArg, options2) {
|
|
|
381144
381197
|
const format = resolveOutputFormat2(options2.format);
|
|
381145
381198
|
const sql = await resolveSql(sqlArg);
|
|
381146
381199
|
const projectId = readProjectId();
|
|
381147
|
-
const
|
|
381148
|
-
const environmentId = await resolveEnvironmentId(
|
|
381149
|
-
const result = options2.db ? await
|
|
381200
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
381201
|
+
const environmentId = await resolveEnvironmentId(client, projectId, options2.environment);
|
|
381202
|
+
const result = options2.db ? await client.runDatabaseQuery(environmentId, options2.db, sql) : await client.runObservabilityQuery(environmentId, sql);
|
|
381150
381203
|
if (result.lookback) {
|
|
381151
381204
|
process.stderr.write(
|
|
381152
381205
|
`\x1B[2mResults exclude data older than ${result.lookback.cutoff} (${result.lookback.days}-day lookback on your plan).\x1B[0m
|
|
@@ -381207,12 +381260,12 @@ async function deploymentShowCommand(idArg, options2) {
|
|
|
381207
381260
|
try {
|
|
381208
381261
|
const format = resolveOutputFormat3(options2.format);
|
|
381209
381262
|
const includeOutput = options2.output ?? false;
|
|
381210
|
-
const
|
|
381263
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
381211
381264
|
let deploymentId = idArg;
|
|
381212
381265
|
if (!deploymentId) {
|
|
381213
381266
|
const projectId2 = readProjectId();
|
|
381214
381267
|
const env2 = await resolveEnvironmentStatus(
|
|
381215
|
-
|
|
381268
|
+
client,
|
|
381216
381269
|
projectId2,
|
|
381217
381270
|
options2.environment
|
|
381218
381271
|
);
|
|
@@ -381224,7 +381277,7 @@ async function deploymentShowCommand(idArg, options2) {
|
|
|
381224
381277
|
}
|
|
381225
381278
|
deploymentId = latest.id;
|
|
381226
381279
|
}
|
|
381227
|
-
const deployment = await
|
|
381280
|
+
const deployment = await client.getDeployment(deploymentId);
|
|
381228
381281
|
if (format === "json") {
|
|
381229
381282
|
const payload = includeOutput ? deployment : stripOutput(deployment);
|
|
381230
381283
|
process.stdout.write(JSON.stringify(payload, null, 2) + "\n");
|
|
@@ -381245,12 +381298,12 @@ async function deploymentShowCommand(idArg, options2) {
|
|
|
381245
381298
|
async function deploymentRetryCommand(idArg, options2) {
|
|
381246
381299
|
try {
|
|
381247
381300
|
const format = resolveOutputFormat3(options2.format);
|
|
381248
|
-
const
|
|
381301
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
381249
381302
|
let deploymentId = idArg;
|
|
381250
381303
|
if (!deploymentId) {
|
|
381251
381304
|
const projectId = readProjectId();
|
|
381252
381305
|
const env2 = await resolveEnvironmentStatus(
|
|
381253
|
-
|
|
381306
|
+
client,
|
|
381254
381307
|
projectId,
|
|
381255
381308
|
options2.environment
|
|
381256
381309
|
);
|
|
@@ -381260,7 +381313,7 @@ async function deploymentRetryCommand(idArg, options2) {
|
|
|
381260
381313
|
}
|
|
381261
381314
|
deploymentId = latest.id;
|
|
381262
381315
|
}
|
|
381263
|
-
const result = await
|
|
381316
|
+
const result = await client.retryDeployment(deploymentId);
|
|
381264
381317
|
if (format === "json") {
|
|
381265
381318
|
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
381266
381319
|
return;
|
|
@@ -381526,13 +381579,13 @@ async function domainAddCommand(service, domain, options2) {
|
|
|
381526
381579
|
try {
|
|
381527
381580
|
const projectId = readProjectId();
|
|
381528
381581
|
const token = await getValidAccessToken();
|
|
381529
|
-
const
|
|
381582
|
+
const client = new SpecificClient({ accessToken: token });
|
|
381530
381583
|
const environmentId = await resolveEnvironmentId(
|
|
381531
|
-
|
|
381584
|
+
client,
|
|
381532
381585
|
projectId,
|
|
381533
381586
|
options2.environment
|
|
381534
381587
|
);
|
|
381535
|
-
const result = await
|
|
381588
|
+
const result = await client.createCustomDomain(environmentId, {
|
|
381536
381589
|
domain,
|
|
381537
381590
|
serviceName: service
|
|
381538
381591
|
});
|
|
@@ -381571,11 +381624,11 @@ async function feedbackCommand(message) {
|
|
|
381571
381624
|
} catch {
|
|
381572
381625
|
}
|
|
381573
381626
|
try {
|
|
381574
|
-
const
|
|
381575
|
-
await
|
|
381627
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
381628
|
+
await client.submitFeedback({
|
|
381576
381629
|
message: trimmed,
|
|
381577
381630
|
projectId,
|
|
381578
|
-
cliVersion: "0.1.
|
|
381631
|
+
cliVersion: "0.1.225"
|
|
381579
381632
|
});
|
|
381580
381633
|
trackEvent("feedback_submitted", { hasProject: !!projectId });
|
|
381581
381634
|
console.log("Thanks! We will take a look at your feedback shortly.");
|
|
@@ -381594,7 +381647,7 @@ async function feedbackCommand(message) {
|
|
|
381594
381647
|
var program = new Command();
|
|
381595
381648
|
var env = "production";
|
|
381596
381649
|
var envLabel = env !== "production" ? `[${env.toUpperCase()}] ` : "";
|
|
381597
|
-
program.name("specific").description(`${envLabel}Infrastructure-as-code for coding agents`).version("0.1.
|
|
381650
|
+
program.name("specific").description(`${envLabel}Infrastructure-as-code for coding agents`).version("0.1.225").enablePositionalOptions();
|
|
381598
381651
|
program.command("init").description("Initialize project for use with a coding agent").option("--agent <name...>", "Agents to configure (cursor, claude, codex, other)").addHelpText("after", `
|
|
381599
381652
|
Examples:
|
|
381600
381653
|
$ specific init
|