@specific.dev/cli 0.1.223 → 0.1.224
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 +201 -165
- package/package.json +1 -2
- /package/dist/admin/_next/static/{MmCvvejntYmAQXZTK00Mr → iE-b86kGlgLliZY5m6XDj}/_buildManifest.js +0 -0
- /package/dist/admin/_next/static/{MmCvvejntYmAQXZTK00Mr → iE-b86kGlgLliZY5m6XDj}/_clientMiddlewareManifest.json +0 -0
- /package/dist/admin/_next/static/{MmCvvejntYmAQXZTK00Mr → iE-b86kGlgLliZY5m6XDj}/_ssgManifest.js +0 -0
package/dist/cli.js
CHANGED
|
@@ -371173,7 +371173,7 @@ function getClient(info) {
|
|
|
371173
371173
|
const cacheKey = `${info.host}:${info.port}:${info.accessKey}`;
|
|
371174
371174
|
const cached2 = clientCache.get(cacheKey);
|
|
371175
371175
|
if (cached2) return cached2;
|
|
371176
|
-
const
|
|
371176
|
+
const client = new S3Client({
|
|
371177
371177
|
endpoint: `http://${info.host}:${info.port}`,
|
|
371178
371178
|
region: "us-east-1",
|
|
371179
371179
|
credentials: {
|
|
@@ -371182,8 +371182,8 @@ function getClient(info) {
|
|
|
371182
371182
|
},
|
|
371183
371183
|
forcePathStyle: true
|
|
371184
371184
|
});
|
|
371185
|
-
clientCache.set(cacheKey,
|
|
371186
|
-
return
|
|
371185
|
+
clientCache.set(cacheKey, client);
|
|
371186
|
+
return client;
|
|
371187
371187
|
}
|
|
371188
371188
|
function sendJson(res, status, body) {
|
|
371189
371189
|
res.setHeader("Content-Type", "application/json");
|
|
@@ -371201,14 +371201,14 @@ async function readJsonBody(req) {
|
|
|
371201
371201
|
const text = Buffer.concat(chunks).toString("utf8");
|
|
371202
371202
|
return text.length > 0 ? JSON.parse(text) : {};
|
|
371203
371203
|
}
|
|
371204
|
-
async function handleListObjects(
|
|
371204
|
+
async function handleListObjects(client, bucket, url, res) {
|
|
371205
371205
|
const prefix = url.searchParams.get("prefix") ?? "";
|
|
371206
371206
|
const cursor = url.searchParams.get("cursor") ?? void 0;
|
|
371207
371207
|
const maxKeys = Math.min(
|
|
371208
371208
|
Math.max(parseInt(url.searchParams.get("maxKeys") ?? "100", 10) || 100, 1),
|
|
371209
371209
|
1e3
|
|
371210
371210
|
);
|
|
371211
|
-
const response = await
|
|
371211
|
+
const response = await client.send(
|
|
371212
371212
|
new ListObjectsV2Command({
|
|
371213
371213
|
Bucket: bucket,
|
|
371214
371214
|
Prefix: prefix,
|
|
@@ -371229,14 +371229,14 @@ async function handleListObjects(client2, bucket, url, res) {
|
|
|
371229
371229
|
prefix
|
|
371230
371230
|
});
|
|
371231
371231
|
}
|
|
371232
|
-
async function handleMetrics(
|
|
371232
|
+
async function handleMetrics(client, bucket, res) {
|
|
371233
371233
|
let totalObjects = 0;
|
|
371234
371234
|
let totalSize = 0;
|
|
371235
371235
|
let continuationToken;
|
|
371236
371236
|
let pages = 0;
|
|
371237
371237
|
const MAX_PAGES = 100;
|
|
371238
371238
|
do {
|
|
371239
|
-
const response = await
|
|
371239
|
+
const response = await client.send(
|
|
371240
371240
|
new ListObjectsV2Command({
|
|
371241
371241
|
Bucket: bucket,
|
|
371242
371242
|
ContinuationToken: continuationToken
|
|
@@ -371256,9 +371256,9 @@ async function handleMetrics(client2, bucket, res) {
|
|
|
371256
371256
|
...pages >= MAX_PAGES ? { truncated: true } : {}
|
|
371257
371257
|
});
|
|
371258
371258
|
}
|
|
371259
|
-
async function handleGetObject(
|
|
371259
|
+
async function handleGetObject(client, bucket, key, res) {
|
|
371260
371260
|
try {
|
|
371261
|
-
const response = await
|
|
371261
|
+
const response = await client.send(
|
|
371262
371262
|
new HeadObjectCommand({ Bucket: bucket, Key: key })
|
|
371263
371263
|
);
|
|
371264
371264
|
sendJson(res, 200, {
|
|
@@ -371278,12 +371278,12 @@ async function handleGetObject(client2, bucket, key, res) {
|
|
|
371278
371278
|
throw error;
|
|
371279
371279
|
}
|
|
371280
371280
|
}
|
|
371281
|
-
async function handleDeleteObject(
|
|
371281
|
+
async function handleDeleteObject(client, bucket, key, res) {
|
|
371282
371282
|
if (key.endsWith("/")) {
|
|
371283
371283
|
const allKeys = [];
|
|
371284
371284
|
let continuationToken;
|
|
371285
371285
|
do {
|
|
371286
|
-
const listResponse = await
|
|
371286
|
+
const listResponse = await client.send(
|
|
371287
371287
|
new ListObjectsV2Command({
|
|
371288
371288
|
Bucket: bucket,
|
|
371289
371289
|
Prefix: key,
|
|
@@ -371298,7 +371298,7 @@ async function handleDeleteObject(client2, bucket, key, res) {
|
|
|
371298
371298
|
const batches = [];
|
|
371299
371299
|
for (let i = 0; i < allKeys.length; i += 1e3) {
|
|
371300
371300
|
batches.push(
|
|
371301
|
-
|
|
371301
|
+
client.send(
|
|
371302
371302
|
new DeleteObjectsCommand({
|
|
371303
371303
|
Bucket: bucket,
|
|
371304
371304
|
Delete: {
|
|
@@ -371311,11 +371311,11 @@ async function handleDeleteObject(client2, bucket, key, res) {
|
|
|
371311
371311
|
}
|
|
371312
371312
|
await Promise.all(batches);
|
|
371313
371313
|
} else {
|
|
371314
|
-
await
|
|
371314
|
+
await client.send(new DeleteObjectCommand({ Bucket: bucket, Key: key }));
|
|
371315
371315
|
}
|
|
371316
371316
|
sendJson(res, 200, { success: true });
|
|
371317
371317
|
}
|
|
371318
|
-
async function handleCreateFolder(
|
|
371318
|
+
async function handleCreateFolder(client, bucket, body, res) {
|
|
371319
371319
|
const path172 = body.path;
|
|
371320
371320
|
if (typeof path172 !== "string") {
|
|
371321
371321
|
sendError(res, 400, "Missing path");
|
|
@@ -371327,12 +371327,12 @@ async function handleCreateFolder(client2, bucket, body, res) {
|
|
|
371327
371327
|
sendError(res, 400, keyError);
|
|
371328
371328
|
return;
|
|
371329
371329
|
}
|
|
371330
|
-
await
|
|
371330
|
+
await client.send(
|
|
371331
371331
|
new PutObjectCommand({ Bucket: bucket, Key: folderKey, Body: "" })
|
|
371332
371332
|
);
|
|
371333
371333
|
sendJson(res, 200, { key: folderKey });
|
|
371334
371334
|
}
|
|
371335
|
-
async function handleRename(
|
|
371335
|
+
async function handleRename(client, bucket, body, res) {
|
|
371336
371336
|
const { sourceKey, destinationKey } = body;
|
|
371337
371337
|
if (typeof sourceKey !== "string" || typeof destinationKey !== "string") {
|
|
371338
371338
|
sendError(res, 400, "Missing sourceKey or destinationKey");
|
|
@@ -371349,7 +371349,7 @@ async function handleRename(client2, bucket, body, res) {
|
|
|
371349
371349
|
const allKeys = [];
|
|
371350
371350
|
let continuationToken;
|
|
371351
371351
|
do {
|
|
371352
|
-
const listResponse = await
|
|
371352
|
+
const listResponse = await client.send(
|
|
371353
371353
|
new ListObjectsV2Command({
|
|
371354
371354
|
Bucket: bucket,
|
|
371355
371355
|
Prefix: sourceKey,
|
|
@@ -371367,7 +371367,7 @@ async function handleRename(client2, bucket, body, res) {
|
|
|
371367
371367
|
}
|
|
371368
371368
|
await Promise.all(
|
|
371369
371369
|
allKeys.map(
|
|
371370
|
-
(k) =>
|
|
371370
|
+
(k) => client.send(
|
|
371371
371371
|
new CopyObjectCommand({
|
|
371372
371372
|
Bucket: bucket,
|
|
371373
371373
|
CopySource: `${bucket}/${encodeURI(k)}`,
|
|
@@ -371379,7 +371379,7 @@ async function handleRename(client2, bucket, body, res) {
|
|
|
371379
371379
|
const deleteBatches = [];
|
|
371380
371380
|
for (let i = 0; i < allKeys.length; i += 1e3) {
|
|
371381
371381
|
deleteBatches.push(
|
|
371382
|
-
|
|
371382
|
+
client.send(
|
|
371383
371383
|
new DeleteObjectsCommand({
|
|
371384
371384
|
Bucket: bucket,
|
|
371385
371385
|
Delete: {
|
|
@@ -371392,27 +371392,27 @@ async function handleRename(client2, bucket, body, res) {
|
|
|
371392
371392
|
}
|
|
371393
371393
|
await Promise.all(deleteBatches);
|
|
371394
371394
|
} else {
|
|
371395
|
-
await
|
|
371395
|
+
await client.send(
|
|
371396
371396
|
new CopyObjectCommand({
|
|
371397
371397
|
Bucket: bucket,
|
|
371398
371398
|
CopySource: `${bucket}/${encodeURI(sourceKey)}`,
|
|
371399
371399
|
Key: destinationKey
|
|
371400
371400
|
})
|
|
371401
371401
|
);
|
|
371402
|
-
await
|
|
371402
|
+
await client.send(
|
|
371403
371403
|
new DeleteObjectCommand({ Bucket: bucket, Key: sourceKey })
|
|
371404
371404
|
);
|
|
371405
371405
|
}
|
|
371406
371406
|
sendJson(res, 200, { key: destinationKey });
|
|
371407
371407
|
}
|
|
371408
|
-
async function handleUploadData(
|
|
371408
|
+
async function handleUploadData(client, bucket, key, req, res) {
|
|
371409
371409
|
const chunks = [];
|
|
371410
371410
|
for await (const chunk of req) {
|
|
371411
371411
|
chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
|
|
371412
371412
|
}
|
|
371413
371413
|
const body = Buffer.concat(chunks);
|
|
371414
371414
|
const contentType = req.headers["content-type"];
|
|
371415
|
-
await
|
|
371415
|
+
await client.send(
|
|
371416
371416
|
new PutObjectCommand({
|
|
371417
371417
|
Bucket: bucket,
|
|
371418
371418
|
Key: key,
|
|
@@ -371423,9 +371423,9 @@ async function handleUploadData(client2, bucket, key, req, res) {
|
|
|
371423
371423
|
res.writeHead(200);
|
|
371424
371424
|
res.end();
|
|
371425
371425
|
}
|
|
371426
|
-
async function handleDownloadData(
|
|
371426
|
+
async function handleDownloadData(client, bucket, key, res) {
|
|
371427
371427
|
try {
|
|
371428
|
-
const response = await
|
|
371428
|
+
const response = await client.send(
|
|
371429
371429
|
new GetObjectCommand({ Bucket: bucket, Key: key })
|
|
371430
371430
|
);
|
|
371431
371431
|
if (response.ContentType) {
|
|
@@ -371492,15 +371492,15 @@ async function handleStorageRequest(req, res, pathname, url, getStorageInstance)
|
|
|
371492
371492
|
sendError(res, 404, `Storage '${storageName}' not found`);
|
|
371493
371493
|
return true;
|
|
371494
371494
|
}
|
|
371495
|
-
const
|
|
371495
|
+
const client = getClient(info);
|
|
371496
371496
|
const bucket = info.bucket;
|
|
371497
371497
|
try {
|
|
371498
371498
|
if (sub === "/objects" && req.method === "GET") {
|
|
371499
|
-
await handleListObjects(
|
|
371499
|
+
await handleListObjects(client, bucket, url, res);
|
|
371500
371500
|
return true;
|
|
371501
371501
|
}
|
|
371502
371502
|
if (sub === "/metrics" && req.method === "GET") {
|
|
371503
|
-
await handleMetrics(
|
|
371503
|
+
await handleMetrics(client, bucket, res);
|
|
371504
371504
|
return true;
|
|
371505
371505
|
}
|
|
371506
371506
|
if (sub === "/object") {
|
|
@@ -371515,11 +371515,11 @@ async function handleStorageRequest(req, res, pathname, url, getStorageInstance)
|
|
|
371515
371515
|
return true;
|
|
371516
371516
|
}
|
|
371517
371517
|
if (req.method === "GET") {
|
|
371518
|
-
await handleGetObject(
|
|
371518
|
+
await handleGetObject(client, bucket, key, res);
|
|
371519
371519
|
return true;
|
|
371520
371520
|
}
|
|
371521
371521
|
if (req.method === "DELETE") {
|
|
371522
|
-
await handleDeleteObject(
|
|
371522
|
+
await handleDeleteObject(client, bucket, key, res);
|
|
371523
371523
|
return true;
|
|
371524
371524
|
}
|
|
371525
371525
|
}
|
|
@@ -371535,22 +371535,22 @@ async function handleStorageRequest(req, res, pathname, url, getStorageInstance)
|
|
|
371535
371535
|
return true;
|
|
371536
371536
|
}
|
|
371537
371537
|
if (req.method === "PUT") {
|
|
371538
|
-
await handleUploadData(
|
|
371538
|
+
await handleUploadData(client, bucket, key, req, res);
|
|
371539
371539
|
return true;
|
|
371540
371540
|
}
|
|
371541
371541
|
if (req.method === "GET") {
|
|
371542
|
-
await handleDownloadData(
|
|
371542
|
+
await handleDownloadData(client, bucket, key, res);
|
|
371543
371543
|
return true;
|
|
371544
371544
|
}
|
|
371545
371545
|
}
|
|
371546
371546
|
if (sub === "/folder" && req.method === "POST") {
|
|
371547
371547
|
const body = await readJsonBody(req);
|
|
371548
|
-
await handleCreateFolder(
|
|
371548
|
+
await handleCreateFolder(client, bucket, body, res);
|
|
371549
371549
|
return true;
|
|
371550
371550
|
}
|
|
371551
371551
|
if (sub === "/rename" && req.method === "POST") {
|
|
371552
371552
|
const body = await readJsonBody(req);
|
|
371553
|
-
await handleRename(
|
|
371553
|
+
await handleRename(client, bucket, body, res);
|
|
371554
371554
|
return true;
|
|
371555
371555
|
}
|
|
371556
371556
|
if (sub === "/presigned" && req.method === "POST") {
|
|
@@ -374612,7 +374612,6 @@ function getDefaultKey() {
|
|
|
374612
374612
|
}
|
|
374613
374613
|
|
|
374614
374614
|
// src/lib/analytics/index.ts
|
|
374615
|
-
import { PostHog } from "posthog-node";
|
|
374616
374615
|
import * as os6 from "os";
|
|
374617
374616
|
import * as crypto4 from "crypto";
|
|
374618
374617
|
|
|
@@ -375330,11 +375329,11 @@ async function getAgentAccessToken(credentials) {
|
|
|
375330
375329
|
}
|
|
375331
375330
|
async function saveCredentialsFromToken(token, deviceCode) {
|
|
375332
375331
|
const freebuffConversionToken = (deviceCode ? readDeviceAttribution(deviceCode) : void 0) ?? process.env.SPECIFIC_FREEBUFF_BFCID;
|
|
375333
|
-
const
|
|
375332
|
+
const client = new ApiClient({
|
|
375334
375333
|
token: token.access_token,
|
|
375335
375334
|
...freebuffConversionToken ? { freebuffConversionToken } : {}
|
|
375336
375335
|
});
|
|
375337
|
-
const user = await
|
|
375336
|
+
const user = await client.getMe();
|
|
375338
375337
|
const expiresAt = getTokenExpiresAt(token.access_token) ?? Date.now() + 3600 * 1e3;
|
|
375339
375338
|
writeUserCredentials({
|
|
375340
375339
|
accessToken: token.access_token,
|
|
@@ -375407,7 +375406,8 @@ async function getValidAccessToken() {
|
|
|
375407
375406
|
|
|
375408
375407
|
// src/lib/analytics/index.ts
|
|
375409
375408
|
var POSTHOG_HOST = "https://eu.i.posthog.com";
|
|
375410
|
-
var
|
|
375409
|
+
var pendingRequests = /* @__PURE__ */ new Set();
|
|
375410
|
+
var shuttingDown = false;
|
|
375411
375411
|
var anonymousId = null;
|
|
375412
375412
|
var identified = false;
|
|
375413
375413
|
function isEnabled() {
|
|
@@ -375428,52 +375428,88 @@ function getProjectId() {
|
|
|
375428
375428
|
}
|
|
375429
375429
|
return void 0;
|
|
375430
375430
|
}
|
|
375431
|
-
function
|
|
375432
|
-
|
|
375433
|
-
|
|
375434
|
-
|
|
375435
|
-
|
|
375436
|
-
|
|
375437
|
-
|
|
375438
|
-
|
|
375431
|
+
async function sendEvents(events) {
|
|
375432
|
+
let timer;
|
|
375433
|
+
const controller = new AbortController();
|
|
375434
|
+
try {
|
|
375435
|
+
const body = JSON.stringify({
|
|
375436
|
+
api_key: "phc_qNQCEUXh6ErdciQRRmeG2xlVvwFjkcW6A5bnOFJ8vXZ",
|
|
375437
|
+
batch: events.map((event) => ({
|
|
375438
|
+
...event,
|
|
375439
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
375440
|
+
uuid: crypto4.randomUUID(),
|
|
375441
|
+
properties: {
|
|
375442
|
+
...event.properties,
|
|
375443
|
+
$geoip_disable: true,
|
|
375444
|
+
$lib: "specific-cli",
|
|
375445
|
+
$lib_version: "0.1.224"
|
|
375446
|
+
}
|
|
375447
|
+
}))
|
|
375439
375448
|
});
|
|
375449
|
+
await Promise.race([
|
|
375450
|
+
fetch(`${POSTHOG_HOST}/batch/`, {
|
|
375451
|
+
method: "POST",
|
|
375452
|
+
headers: { "Content-Type": "application/json" },
|
|
375453
|
+
body,
|
|
375454
|
+
signal: controller.signal
|
|
375455
|
+
}).then(async (response) => {
|
|
375456
|
+
await response.body?.cancel();
|
|
375457
|
+
}),
|
|
375458
|
+
new Promise((resolve10) => {
|
|
375459
|
+
timer = setTimeout(() => {
|
|
375460
|
+
controller.abort();
|
|
375461
|
+
resolve10();
|
|
375462
|
+
}, 1e3);
|
|
375463
|
+
timer.unref();
|
|
375464
|
+
})
|
|
375465
|
+
]);
|
|
375466
|
+
} catch {
|
|
375467
|
+
} finally {
|
|
375468
|
+
clearTimeout(timer);
|
|
375469
|
+
controller.abort();
|
|
375440
375470
|
}
|
|
375441
|
-
return client;
|
|
375442
375471
|
}
|
|
375443
375472
|
function trackEvent(event, properties) {
|
|
375444
|
-
|
|
375445
|
-
|
|
375446
|
-
|
|
375447
|
-
|
|
375448
|
-
|
|
375449
|
-
|
|
375450
|
-
|
|
375473
|
+
try {
|
|
375474
|
+
if (!isEnabled() || shuttingDown) return;
|
|
375475
|
+
const userId = getUserId();
|
|
375476
|
+
const distinctId = userId ?? getAnonymousId();
|
|
375477
|
+
const events = [];
|
|
375478
|
+
if (userId && !identified) {
|
|
375479
|
+
events.push({
|
|
375480
|
+
event: "$identify",
|
|
375481
|
+
distinct_id: userId,
|
|
375482
|
+
properties: { $set: { anonymous_id: getAnonymousId() } }
|
|
375483
|
+
}, {
|
|
375484
|
+
event: "$create_alias",
|
|
375485
|
+
distinct_id: userId,
|
|
375486
|
+
properties: { distinct_id: userId, alias: getAnonymousId() }
|
|
375487
|
+
});
|
|
375488
|
+
identified = true;
|
|
375489
|
+
}
|
|
375490
|
+
events.push({
|
|
375491
|
+
event,
|
|
375492
|
+
distinct_id: distinctId,
|
|
375451
375493
|
properties: {
|
|
375452
|
-
|
|
375494
|
+
...properties,
|
|
375495
|
+
cli_version: "0.1.224",
|
|
375496
|
+
platform: process.platform,
|
|
375497
|
+
node_version: process.version,
|
|
375498
|
+
project_id: getProjectId()
|
|
375453
375499
|
}
|
|
375454
375500
|
});
|
|
375455
|
-
|
|
375456
|
-
|
|
375457
|
-
|
|
375458
|
-
|
|
375501
|
+
const request2 = sendEvents(events);
|
|
375502
|
+
pendingRequests.add(request2);
|
|
375503
|
+
void request2.then(
|
|
375504
|
+
() => pendingRequests.delete(request2),
|
|
375505
|
+
() => pendingRequests.delete(request2)
|
|
375506
|
+
);
|
|
375507
|
+
} catch {
|
|
375459
375508
|
}
|
|
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
375509
|
}
|
|
375472
375510
|
async function shutdown() {
|
|
375473
|
-
|
|
375474
|
-
|
|
375475
|
-
client = null;
|
|
375476
|
-
}
|
|
375511
|
+
shuttingDown = true;
|
|
375512
|
+
await Promise.allSettled([...pendingRequests]);
|
|
375477
375513
|
}
|
|
375478
375514
|
|
|
375479
375515
|
// src/commands/init.tsx
|
|
@@ -377670,9 +377706,9 @@ async function performAgentLogin() {
|
|
|
377670
377706
|
userId: ""
|
|
377671
377707
|
};
|
|
377672
377708
|
const accessToken = await getAgentAccessToken(base);
|
|
377673
|
-
const
|
|
377674
|
-
const me = await
|
|
377675
|
-
const info = await
|
|
377709
|
+
const client = new SpecificClient({ accessToken, ...freebuffAttributionOptions() });
|
|
377710
|
+
const me = await client.getMe();
|
|
377711
|
+
const info = await client.getAgentRegistration();
|
|
377676
377712
|
writeUserCredentials({ ...readAgentCredentials() ?? base, userId: me.id });
|
|
377677
377713
|
writeLog("auth", `Agent credentials written for user ${me.id}`);
|
|
377678
377714
|
return { registrationId: registration.id, claimDeadlineAt: new Date(info.claimDeadlineAt) };
|
|
@@ -377697,14 +377733,14 @@ function isExpiredRegistrationError(err) {
|
|
|
377697
377733
|
return err instanceof AgentRegistrationExpiredError || err instanceof ApiError && err.code === "AGENT_REGISTRATION_EXPIRED";
|
|
377698
377734
|
}
|
|
377699
377735
|
async function describeAgentAccount(credentials) {
|
|
377700
|
-
const
|
|
377736
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken, ...freebuffAttributionOptions() });
|
|
377701
377737
|
try {
|
|
377702
|
-
const info = await
|
|
377738
|
+
const info = await client.getAgentRegistration();
|
|
377703
377739
|
if (info.status === "expired") return { status: "expired" };
|
|
377704
377740
|
if (info.status === "unclaimed") {
|
|
377705
377741
|
return { status: "unclaimed", claimDeadlineAt: new Date(info.claimDeadlineAt) };
|
|
377706
377742
|
}
|
|
377707
|
-
const me = await
|
|
377743
|
+
const me = await client.getMe();
|
|
377708
377744
|
const current = readAgentCredentials() ?? credentials;
|
|
377709
377745
|
if (!current.claimed) {
|
|
377710
377746
|
writeUserCredentials({ ...current, claimVerified: void 0, claimed: true, userId: me.id });
|
|
@@ -377745,8 +377781,8 @@ function requireAgentCredentials() {
|
|
|
377745
377781
|
async function startClaim(email) {
|
|
377746
377782
|
const credentials = requireAgentCredentials();
|
|
377747
377783
|
if (credentials.claimed) {
|
|
377748
|
-
const
|
|
377749
|
-
const me = await
|
|
377784
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken, ...freebuffAttributionOptions() });
|
|
377785
|
+
const me = await client.getMe();
|
|
377750
377786
|
return { phase: "completed", email: me.email, alreadyClaimed: true };
|
|
377751
377787
|
}
|
|
377752
377788
|
if (credentials.claimVerified) {
|
|
@@ -377763,8 +377799,8 @@ async function startClaim(email) {
|
|
|
377763
377799
|
async function completeClaim(userCode) {
|
|
377764
377800
|
let credentials = requireAgentCredentials();
|
|
377765
377801
|
if (credentials.claimed) {
|
|
377766
|
-
const
|
|
377767
|
-
const me = await
|
|
377802
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken, ...freebuffAttributionOptions() });
|
|
377803
|
+
const me = await client.getMe();
|
|
377768
377804
|
return { phase: "completed", email: me.email, alreadyClaimed: true };
|
|
377769
377805
|
}
|
|
377770
377806
|
if (credentials.claimVerified) {
|
|
@@ -377779,8 +377815,8 @@ async function completeClaim(userCode) {
|
|
|
377779
377815
|
return await handOverToPlatform(credentials);
|
|
377780
377816
|
}
|
|
377781
377817
|
async function handOverToPlatform(credentials) {
|
|
377782
|
-
const
|
|
377783
|
-
const result = await
|
|
377818
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken, ...freebuffAttributionOptions() });
|
|
377819
|
+
const result = await client.claimAgentRegistration();
|
|
377784
377820
|
writeUserCredentials({ ...credentials, claimVerified: void 0, claimed: true, userId: result.user.id });
|
|
377785
377821
|
writeLog("auth", `Agent registration claimed by ${result.user.email}`);
|
|
377786
377822
|
return { phase: "completed", email: result.user.email, alreadyClaimed: false };
|
|
@@ -377807,9 +377843,9 @@ function describeClaimError(err) {
|
|
|
377807
377843
|
}
|
|
377808
377844
|
|
|
377809
377845
|
// src/lib/deployments/inputs.ts
|
|
377810
|
-
async function submitProvidedDeploymentSecrets(
|
|
377846
|
+
async function submitProvidedDeploymentSecrets(client, deploymentId, secrets) {
|
|
377811
377847
|
if (Object.keys(secrets).length === 0) return;
|
|
377812
|
-
await
|
|
377848
|
+
await client.submitSecrets(deploymentId, secrets);
|
|
377813
377849
|
}
|
|
377814
377850
|
|
|
377815
377851
|
// src/lib/deployments/target.ts
|
|
@@ -377818,8 +377854,8 @@ function validateDeployTargetOptions(options2) {
|
|
|
377818
377854
|
throw new Error("--preview cannot be combined with --environment");
|
|
377819
377855
|
}
|
|
377820
377856
|
}
|
|
377821
|
-
async function resolveExplicitDeployEnvironment(
|
|
377822
|
-
const status = await
|
|
377857
|
+
async function resolveExplicitDeployEnvironment(client, projectId, target) {
|
|
377858
|
+
const status = await client.getProjectStatus(projectId);
|
|
377823
377859
|
const environments = [
|
|
377824
377860
|
...status.environments,
|
|
377825
377861
|
...status.previewEnvironments ?? []
|
|
@@ -378172,10 +378208,10 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378172
378208
|
let cancelled = false;
|
|
378173
378209
|
async function loadProjects() {
|
|
378174
378210
|
try {
|
|
378175
|
-
const
|
|
378211
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
378176
378212
|
const [projects2, organizations] = await Promise.all([
|
|
378177
|
-
|
|
378178
|
-
|
|
378213
|
+
client.listProjects(),
|
|
378214
|
+
client.listOrganizations()
|
|
378179
378215
|
]);
|
|
378180
378216
|
if (cancelled) return;
|
|
378181
378217
|
const items = buildSelectorItems(projects2, organizations);
|
|
@@ -378231,8 +378267,8 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378231
378267
|
let cancelled = false;
|
|
378232
378268
|
async function createProject() {
|
|
378233
378269
|
try {
|
|
378234
|
-
const
|
|
378235
|
-
const project = await
|
|
378270
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
378271
|
+
const project = await client.createProject(state.newProjectName, state.selectedOrganizationId);
|
|
378236
378272
|
if (cancelled) return;
|
|
378237
378273
|
writeProjectId(project.id);
|
|
378238
378274
|
setState({
|
|
@@ -378258,10 +378294,10 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378258
378294
|
let cancelled = false;
|
|
378259
378295
|
async function loadEnvironments() {
|
|
378260
378296
|
try {
|
|
378261
|
-
const
|
|
378297
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
378262
378298
|
let environments = state.environments;
|
|
378263
378299
|
if (!environments) {
|
|
378264
|
-
const projects2 = await
|
|
378300
|
+
const projects2 = await client.listProjects();
|
|
378265
378301
|
const project = projects2.find((p) => p.id === state.projectId);
|
|
378266
378302
|
if (!project) {
|
|
378267
378303
|
if (cancelled) return;
|
|
@@ -378288,7 +378324,7 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378288
378324
|
if (envFlag) {
|
|
378289
378325
|
try {
|
|
378290
378326
|
const match = await resolveExplicitDeployEnvironment(
|
|
378291
|
-
|
|
378327
|
+
client,
|
|
378292
378328
|
state.projectId,
|
|
378293
378329
|
envFlag
|
|
378294
378330
|
);
|
|
@@ -378374,19 +378410,19 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378374
378410
|
let cancelled = false;
|
|
378375
378411
|
async function createPreview() {
|
|
378376
378412
|
try {
|
|
378377
|
-
const
|
|
378413
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
378378
378414
|
const projectDir = process.cwd();
|
|
378379
378415
|
const previousPreviewId = readPreviewEnvironmentId(projectDir);
|
|
378380
378416
|
if (previousPreviewId) {
|
|
378381
378417
|
setState((s) => ({ ...s, previewStatus: "Tearing down previous preview environment" }));
|
|
378382
378418
|
try {
|
|
378383
|
-
await
|
|
378419
|
+
await client.deletePreviewEnvironment(previousPreviewId);
|
|
378384
378420
|
} catch {
|
|
378385
378421
|
}
|
|
378386
378422
|
}
|
|
378387
378423
|
if (cancelled) return;
|
|
378388
378424
|
setState((s) => ({ ...s, previewStatus: "Creating preview environment" }));
|
|
378389
|
-
const previewEnv = await
|
|
378425
|
+
const previewEnv = await client.createPreviewEnvironment(state.projectId);
|
|
378390
378426
|
writePreviewEnvironmentId(previewEnv.id, projectDir);
|
|
378391
378427
|
if (cancelled) return;
|
|
378392
378428
|
setState((s) => ({
|
|
@@ -378496,15 +378532,15 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378496
378532
|
(secret) => secretValues[secret]
|
|
378497
378533
|
);
|
|
378498
378534
|
if (!allSecretsCollected) return;
|
|
378499
|
-
const
|
|
378500
|
-
if (!
|
|
378535
|
+
const client = clientRef.current;
|
|
378536
|
+
if (!client) return;
|
|
378501
378537
|
(async () => {
|
|
378502
378538
|
try {
|
|
378503
378539
|
writeLog(
|
|
378504
378540
|
"deploy",
|
|
378505
378541
|
`Submitting secrets: ${Object.keys(secretValues).join(", ")}`
|
|
378506
378542
|
);
|
|
378507
|
-
await
|
|
378543
|
+
await client.submitSecrets(deployment2.id, secretValues);
|
|
378508
378544
|
writeLog("deploy", "Secrets submitted successfully");
|
|
378509
378545
|
setState((s) => ({
|
|
378510
378546
|
...s,
|
|
@@ -378538,15 +378574,15 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378538
378574
|
(config2) => configValues[config2]
|
|
378539
378575
|
);
|
|
378540
378576
|
if (!allConfigsCollected) return;
|
|
378541
|
-
const
|
|
378542
|
-
if (!
|
|
378577
|
+
const client = clientRef.current;
|
|
378578
|
+
if (!client) return;
|
|
378543
378579
|
(async () => {
|
|
378544
378580
|
try {
|
|
378545
378581
|
writeLog(
|
|
378546
378582
|
"deploy",
|
|
378547
378583
|
`Submitting configs: ${Object.keys(configValues).join(", ")}`
|
|
378548
378584
|
);
|
|
378549
|
-
await
|
|
378585
|
+
await client.submitConfigs(deployment2.id, configValues);
|
|
378550
378586
|
writeLog("deploy", "Configs submitted successfully");
|
|
378551
378587
|
setState((s) => ({
|
|
378552
378588
|
...s,
|
|
@@ -378573,8 +378609,8 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378573
378609
|
const projectDir = process.cwd();
|
|
378574
378610
|
writeLog("deploy", `Starting deployment to "${state.environmentName}"`);
|
|
378575
378611
|
writeLog("deploy", `Project directory: ${projectDir}`);
|
|
378576
|
-
const
|
|
378577
|
-
clientRef.current =
|
|
378612
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
378613
|
+
clientRef.current = client;
|
|
378578
378614
|
if (cancelled) return;
|
|
378579
378615
|
let tarball;
|
|
378580
378616
|
let appPath;
|
|
@@ -378603,7 +378639,7 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378603
378639
|
try {
|
|
378604
378640
|
writeLog("deploy", `Creating deployment for project ${state.projectId}`);
|
|
378605
378641
|
const gitInfo = getGitInfo(projectDir);
|
|
378606
|
-
deployment2 = await
|
|
378642
|
+
deployment2 = await client.createDeployment(state.projectId, state.environmentId, {
|
|
378607
378643
|
triggeredBy: "cli",
|
|
378608
378644
|
...gitInfo && {
|
|
378609
378645
|
gitCommitSha: gitInfo.commitSha,
|
|
@@ -378669,7 +378705,7 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378669
378705
|
setState((s) => ({ ...s, phase: "uploading", deployment: deployment2 }));
|
|
378670
378706
|
try {
|
|
378671
378707
|
writeLog("deploy", `Uploading tarball (${tarball.length} bytes, appPath: ${appPath})`);
|
|
378672
|
-
deployment2 = await
|
|
378708
|
+
deployment2 = await client.uploadTarball(deployment2.id, tarball, appPath, {
|
|
378673
378709
|
uploadUrl: deployment2.uploadUrl,
|
|
378674
378710
|
maxTarballBytes: deployment2.maxTarballBytes,
|
|
378675
378711
|
onProgress: makeUploadProgressHandler(setState)
|
|
@@ -378699,12 +378735,12 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378699
378735
|
if (state.phase !== "pending" || !state.deployment) return;
|
|
378700
378736
|
let pollInterval;
|
|
378701
378737
|
let cancelled = false;
|
|
378702
|
-
const
|
|
378703
|
-
if (!
|
|
378738
|
+
const client = clientRef.current;
|
|
378739
|
+
if (!client) return;
|
|
378704
378740
|
const pollForPendingActions = async () => {
|
|
378705
378741
|
if (cancelled) return;
|
|
378706
378742
|
try {
|
|
378707
|
-
const status = await
|
|
378743
|
+
const status = await client.getDeployment(state.deployment.id);
|
|
378708
378744
|
if (cancelled) return;
|
|
378709
378745
|
writeLog(
|
|
378710
378746
|
"deploy",
|
|
@@ -378843,12 +378879,12 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378843
378879
|
useEffect6(() => {
|
|
378844
378880
|
if (state.phase !== "starting" || !state.deployment) return;
|
|
378845
378881
|
let cancelled = false;
|
|
378846
|
-
const
|
|
378847
|
-
if (!
|
|
378882
|
+
const client = clientRef.current;
|
|
378883
|
+
if (!client) return;
|
|
378848
378884
|
(async () => {
|
|
378849
378885
|
try {
|
|
378850
378886
|
writeLog("deploy", "Calling /start endpoint");
|
|
378851
|
-
await
|
|
378887
|
+
await client.startDeployment(state.deployment.id);
|
|
378852
378888
|
writeLog("deploy", "Deployment started successfully");
|
|
378853
378889
|
if (cancelled) return;
|
|
378854
378890
|
setState((s) => ({
|
|
@@ -378878,12 +378914,12 @@ function DeployUI({ envFlag, preview, config }) {
|
|
|
378878
378914
|
if (state.phase !== "queued" && state.phase !== "deploying" || !state.deployment) return;
|
|
378879
378915
|
let pollInterval;
|
|
378880
378916
|
let cancelled = false;
|
|
378881
|
-
const
|
|
378882
|
-
if (!
|
|
378917
|
+
const client = clientRef.current;
|
|
378918
|
+
if (!client) return;
|
|
378883
378919
|
const pollForCompletion = async () => {
|
|
378884
378920
|
if (cancelled) return;
|
|
378885
378921
|
try {
|
|
378886
|
-
const status = await
|
|
378922
|
+
const status = await client.getDeployment(state.deployment.id);
|
|
378887
378923
|
if (cancelled) return;
|
|
378888
378924
|
writeLog(
|
|
378889
378925
|
"deploy",
|
|
@@ -379130,7 +379166,7 @@ async function runDeployPipeline(options2) {
|
|
|
379130
379166
|
console.error(`Error: ${message}`);
|
|
379131
379167
|
process.exit(1);
|
|
379132
379168
|
}
|
|
379133
|
-
const
|
|
379169
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
379134
379170
|
let projectId = options2.projectId;
|
|
379135
379171
|
let projectIdFromLinkedFile = false;
|
|
379136
379172
|
if (!projectId) {
|
|
@@ -379152,17 +379188,17 @@ async function runDeployPipeline(options2) {
|
|
|
379152
379188
|
if (previousPreviewId) {
|
|
379153
379189
|
console.log("Cleaning up previous preview environment...");
|
|
379154
379190
|
try {
|
|
379155
|
-
await
|
|
379191
|
+
await client.deletePreviewEnvironment(previousPreviewId);
|
|
379156
379192
|
} catch {
|
|
379157
379193
|
}
|
|
379158
379194
|
}
|
|
379159
379195
|
console.log("Creating preview environment...");
|
|
379160
|
-
const preview = await
|
|
379196
|
+
const preview = await client.createPreviewEnvironment(projectId);
|
|
379161
379197
|
writePreviewEnvironmentId(preview.id, projectDir);
|
|
379162
379198
|
console.log(`Preview environment "${preview.name}" created (expires: ${new Date(preview.expiresAt).toLocaleString()})`);
|
|
379163
379199
|
previewEnvironmentId = preview.id;
|
|
379164
379200
|
}
|
|
379165
|
-
const projects = await
|
|
379201
|
+
const projects = await client.listProjects();
|
|
379166
379202
|
const project = projects.find((p) => p.id === projectId);
|
|
379167
379203
|
if (!project) {
|
|
379168
379204
|
if (projectIdFromLinkedFile) {
|
|
@@ -379185,7 +379221,7 @@ async function runDeployPipeline(options2) {
|
|
|
379185
379221
|
} else if (options2.environment) {
|
|
379186
379222
|
try {
|
|
379187
379223
|
const match = await resolveExplicitDeployEnvironment(
|
|
379188
|
-
|
|
379224
|
+
client,
|
|
379189
379225
|
projectId,
|
|
379190
379226
|
options2.environment
|
|
379191
379227
|
);
|
|
@@ -379267,7 +379303,7 @@ async function runDeployPipeline(options2) {
|
|
|
379267
379303
|
let deployment;
|
|
379268
379304
|
try {
|
|
379269
379305
|
const gitInfo = getGitInfo(projectDir);
|
|
379270
|
-
deployment = await
|
|
379306
|
+
deployment = await client.createDeployment(projectId, environmentId, {
|
|
379271
379307
|
triggeredBy: "cli",
|
|
379272
379308
|
...gitInfo && {
|
|
379273
379309
|
gitCommitSha: gitInfo.commitSha,
|
|
@@ -379312,7 +379348,7 @@ async function runDeployPipeline(options2) {
|
|
|
379312
379348
|
console.log("Uploading...");
|
|
379313
379349
|
try {
|
|
379314
379350
|
let lastPct = -1;
|
|
379315
|
-
deployment = await
|
|
379351
|
+
deployment = await client.uploadTarball(deployment.id, tarball, appPath, {
|
|
379316
379352
|
uploadUrl: deployment.uploadUrl,
|
|
379317
379353
|
maxTarballBytes: deployment.maxTarballBytes,
|
|
379318
379354
|
onProgress: (bytesSent, totalBytes) => {
|
|
@@ -379329,7 +379365,7 @@ async function runDeployPipeline(options2) {
|
|
|
379329
379365
|
process.exit(1);
|
|
379330
379366
|
}
|
|
379331
379367
|
try {
|
|
379332
|
-
await submitProvidedDeploymentSecrets(
|
|
379368
|
+
await submitProvidedDeploymentSecrets(client, deployment.id, parsedSecrets);
|
|
379333
379369
|
} catch (err) {
|
|
379334
379370
|
console.error(`Error: Failed to submit secrets: ${err instanceof Error ? err.message : String(err)}`);
|
|
379335
379371
|
process.exit(1);
|
|
@@ -379337,7 +379373,7 @@ async function runDeployPipeline(options2) {
|
|
|
379337
379373
|
console.log("Waiting for build...");
|
|
379338
379374
|
while (true) {
|
|
379339
379375
|
await new Promise((resolve10) => setTimeout(resolve10, 2e3));
|
|
379340
|
-
const status = await
|
|
379376
|
+
const status = await client.getDeployment(deployment.id);
|
|
379341
379377
|
deployment = status;
|
|
379342
379378
|
if (status.state === "failed") {
|
|
379343
379379
|
console.error(`Error: Deployment failed: ${status.stateMessage || "Unknown error"}`);
|
|
@@ -379378,7 +379414,7 @@ ${failedBuild.output}`);
|
|
|
379378
379414
|
);
|
|
379379
379415
|
process.exit(1);
|
|
379380
379416
|
}
|
|
379381
|
-
await
|
|
379417
|
+
await client.submitSecrets(deployment.id, secretsToSubmit);
|
|
379382
379418
|
continue;
|
|
379383
379419
|
}
|
|
379384
379420
|
const missingConfigs = getMissingConfigs(status.pendingActions);
|
|
@@ -379399,7 +379435,7 @@ ${failedBuild.output}`);
|
|
|
379399
379435
|
);
|
|
379400
379436
|
process.exit(1);
|
|
379401
379437
|
}
|
|
379402
|
-
await
|
|
379438
|
+
await client.submitConfigs(deployment.id, configsToSubmit);
|
|
379403
379439
|
continue;
|
|
379404
379440
|
}
|
|
379405
379441
|
if (hasBuildsInProgress(status.pendingActions)) {
|
|
@@ -379418,7 +379454,7 @@ ${failedBuild.output}`);
|
|
|
379418
379454
|
}
|
|
379419
379455
|
console.log("Starting deployment...");
|
|
379420
379456
|
try {
|
|
379421
|
-
await
|
|
379457
|
+
await client.startDeployment(deployment.id);
|
|
379422
379458
|
} catch (err) {
|
|
379423
379459
|
if (err instanceof ApiError && err.code === CLI_DEPLOYMENTS_DISABLED_CODE) {
|
|
379424
379460
|
console.error(
|
|
@@ -379440,7 +379476,7 @@ ${failedBuild.output}`);
|
|
|
379440
379476
|
);
|
|
379441
379477
|
console.log("Cleaning up preview environment...");
|
|
379442
379478
|
try {
|
|
379443
|
-
await
|
|
379479
|
+
await client.deletePreviewEnvironment(previewEnvironmentId);
|
|
379444
379480
|
} catch {
|
|
379445
379481
|
}
|
|
379446
379482
|
clearPreviewEnvironmentId(projectDir);
|
|
@@ -379452,7 +379488,7 @@ ${failedBuild.output}`);
|
|
|
379452
379488
|
console.log("Deploying...");
|
|
379453
379489
|
while (true) {
|
|
379454
379490
|
await new Promise((resolve10) => setTimeout(resolve10, 2e3));
|
|
379455
|
-
const status = await
|
|
379491
|
+
const status = await client.getDeployment(deployment.id);
|
|
379456
379492
|
deployment = status;
|
|
379457
379493
|
if (status.state === "failed") {
|
|
379458
379494
|
if (status.error) {
|
|
@@ -380518,7 +380554,7 @@ function compareVersions(a, b) {
|
|
|
380518
380554
|
return 0;
|
|
380519
380555
|
}
|
|
380520
380556
|
async function checkForUpdate() {
|
|
380521
|
-
const currentVersion = "0.1.
|
|
380557
|
+
const currentVersion = "0.1.224";
|
|
380522
380558
|
const response = await fetch(`${BINARIES_BASE_URL}/latest?t=${Date.now()}`);
|
|
380523
380559
|
if (!response.ok) {
|
|
380524
380560
|
throw new Error(`Failed to check for updates: HTTP ${response.status}`);
|
|
@@ -380716,10 +380752,10 @@ function updateCommand() {
|
|
|
380716
380752
|
// src/commands/project.tsx
|
|
380717
380753
|
async function projectNewCommand(name, options2) {
|
|
380718
380754
|
try {
|
|
380719
|
-
const
|
|
380755
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
380720
380756
|
let orgId = options2.org;
|
|
380721
380757
|
if (!orgId) {
|
|
380722
|
-
const organizations = await
|
|
380758
|
+
const organizations = await client.listOrganizations();
|
|
380723
380759
|
if (organizations.length === 0) {
|
|
380724
380760
|
console.error(
|
|
380725
380761
|
"You don't belong to any organizations. Please create one first."
|
|
@@ -380739,7 +380775,7 @@ async function projectNewCommand(name, options2) {
|
|
|
380739
380775
|
process.exit(1);
|
|
380740
380776
|
}
|
|
380741
380777
|
}
|
|
380742
|
-
const project = await
|
|
380778
|
+
const project = await client.createProject(name, orgId);
|
|
380743
380779
|
console.log(`Project created: ${project.id}`);
|
|
380744
380780
|
} catch (error) {
|
|
380745
380781
|
const quotaMessage = formatProjectQuotaError(error);
|
|
@@ -380754,10 +380790,10 @@ async function projectNewCommand(name, options2) {
|
|
|
380754
380790
|
}
|
|
380755
380791
|
async function projectListCommand() {
|
|
380756
380792
|
try {
|
|
380757
|
-
const
|
|
380793
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
380758
380794
|
const [projects, organizations] = await Promise.all([
|
|
380759
|
-
|
|
380760
|
-
|
|
380795
|
+
client.listProjects(),
|
|
380796
|
+
client.listOrganizations()
|
|
380761
380797
|
]);
|
|
380762
380798
|
if (projects.length === 0) {
|
|
380763
380799
|
console.log("No projects found.");
|
|
@@ -380853,8 +380889,8 @@ function StatusUI({ previews = false }) {
|
|
|
380853
380889
|
(async () => {
|
|
380854
380890
|
try {
|
|
380855
380891
|
const projectId = readProjectId();
|
|
380856
|
-
const
|
|
380857
|
-
const status2 = await
|
|
380892
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
380893
|
+
const status2 = await client.getProjectStatus(projectId);
|
|
380858
380894
|
setState({ phase: "success", status: status2 });
|
|
380859
380895
|
} catch (err) {
|
|
380860
380896
|
setState({
|
|
@@ -380901,8 +380937,8 @@ async function statusCommand(options2 = {}) {
|
|
|
380901
380937
|
return;
|
|
380902
380938
|
}
|
|
380903
380939
|
const projectId = readProjectId();
|
|
380904
|
-
const
|
|
380905
|
-
const status = await
|
|
380940
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
380941
|
+
const status = await client.getProjectStatus(projectId);
|
|
380906
380942
|
process.stdout.write(JSON.stringify(status, null, 2) + "\n");
|
|
380907
380943
|
} catch (err) {
|
|
380908
380944
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -380912,8 +380948,8 @@ async function statusCommand(options2 = {}) {
|
|
|
380912
380948
|
}
|
|
380913
380949
|
|
|
380914
380950
|
// src/lib/project/resolve-env.ts
|
|
380915
|
-
async function resolveEnvironmentStatus(
|
|
380916
|
-
const status = await
|
|
380951
|
+
async function resolveEnvironmentStatus(client, projectId, envFlag) {
|
|
380952
|
+
const status = await client.getProjectStatus(projectId);
|
|
380917
380953
|
const environments = status.environments;
|
|
380918
380954
|
const previewEnvironments = status.previewEnvironments ?? [];
|
|
380919
380955
|
if (envFlag) {
|
|
@@ -380949,8 +380985,8 @@ async function resolveEnvironmentStatus(client2, projectId, envFlag) {
|
|
|
380949
380985
|
`Project has multiple environments (${names}). Pass --environment <name|id>.`
|
|
380950
380986
|
);
|
|
380951
380987
|
}
|
|
380952
|
-
async function resolveEnvironmentId(
|
|
380953
|
-
const match = await resolveEnvironmentStatus(
|
|
380988
|
+
async function resolveEnvironmentId(client, projectId, envFlag) {
|
|
380989
|
+
const match = await resolveEnvironmentStatus(client, projectId, envFlag);
|
|
380954
380990
|
return match.id;
|
|
380955
380991
|
}
|
|
380956
380992
|
|
|
@@ -381144,9 +381180,9 @@ async function queryCommand(sqlArg, options2) {
|
|
|
381144
381180
|
const format = resolveOutputFormat2(options2.format);
|
|
381145
381181
|
const sql = await resolveSql(sqlArg);
|
|
381146
381182
|
const projectId = readProjectId();
|
|
381147
|
-
const
|
|
381148
|
-
const environmentId = await resolveEnvironmentId(
|
|
381149
|
-
const result = options2.db ? await
|
|
381183
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
381184
|
+
const environmentId = await resolveEnvironmentId(client, projectId, options2.environment);
|
|
381185
|
+
const result = options2.db ? await client.runDatabaseQuery(environmentId, options2.db, sql) : await client.runObservabilityQuery(environmentId, sql);
|
|
381150
381186
|
if (result.lookback) {
|
|
381151
381187
|
process.stderr.write(
|
|
381152
381188
|
`\x1B[2mResults exclude data older than ${result.lookback.cutoff} (${result.lookback.days}-day lookback on your plan).\x1B[0m
|
|
@@ -381207,12 +381243,12 @@ async function deploymentShowCommand(idArg, options2) {
|
|
|
381207
381243
|
try {
|
|
381208
381244
|
const format = resolveOutputFormat3(options2.format);
|
|
381209
381245
|
const includeOutput = options2.output ?? false;
|
|
381210
|
-
const
|
|
381246
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
381211
381247
|
let deploymentId = idArg;
|
|
381212
381248
|
if (!deploymentId) {
|
|
381213
381249
|
const projectId2 = readProjectId();
|
|
381214
381250
|
const env2 = await resolveEnvironmentStatus(
|
|
381215
|
-
|
|
381251
|
+
client,
|
|
381216
381252
|
projectId2,
|
|
381217
381253
|
options2.environment
|
|
381218
381254
|
);
|
|
@@ -381224,7 +381260,7 @@ async function deploymentShowCommand(idArg, options2) {
|
|
|
381224
381260
|
}
|
|
381225
381261
|
deploymentId = latest.id;
|
|
381226
381262
|
}
|
|
381227
|
-
const deployment = await
|
|
381263
|
+
const deployment = await client.getDeployment(deploymentId);
|
|
381228
381264
|
if (format === "json") {
|
|
381229
381265
|
const payload = includeOutput ? deployment : stripOutput(deployment);
|
|
381230
381266
|
process.stdout.write(JSON.stringify(payload, null, 2) + "\n");
|
|
@@ -381245,12 +381281,12 @@ async function deploymentShowCommand(idArg, options2) {
|
|
|
381245
381281
|
async function deploymentRetryCommand(idArg, options2) {
|
|
381246
381282
|
try {
|
|
381247
381283
|
const format = resolveOutputFormat3(options2.format);
|
|
381248
|
-
const
|
|
381284
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
381249
381285
|
let deploymentId = idArg;
|
|
381250
381286
|
if (!deploymentId) {
|
|
381251
381287
|
const projectId = readProjectId();
|
|
381252
381288
|
const env2 = await resolveEnvironmentStatus(
|
|
381253
|
-
|
|
381289
|
+
client,
|
|
381254
381290
|
projectId,
|
|
381255
381291
|
options2.environment
|
|
381256
381292
|
);
|
|
@@ -381260,7 +381296,7 @@ async function deploymentRetryCommand(idArg, options2) {
|
|
|
381260
381296
|
}
|
|
381261
381297
|
deploymentId = latest.id;
|
|
381262
381298
|
}
|
|
381263
|
-
const result = await
|
|
381299
|
+
const result = await client.retryDeployment(deploymentId);
|
|
381264
381300
|
if (format === "json") {
|
|
381265
381301
|
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
381266
381302
|
return;
|
|
@@ -381526,13 +381562,13 @@ async function domainAddCommand(service, domain, options2) {
|
|
|
381526
381562
|
try {
|
|
381527
381563
|
const projectId = readProjectId();
|
|
381528
381564
|
const token = await getValidAccessToken();
|
|
381529
|
-
const
|
|
381565
|
+
const client = new SpecificClient({ accessToken: token });
|
|
381530
381566
|
const environmentId = await resolveEnvironmentId(
|
|
381531
|
-
|
|
381567
|
+
client,
|
|
381532
381568
|
projectId,
|
|
381533
381569
|
options2.environment
|
|
381534
381570
|
);
|
|
381535
|
-
const result = await
|
|
381571
|
+
const result = await client.createCustomDomain(environmentId, {
|
|
381536
381572
|
domain,
|
|
381537
381573
|
serviceName: service
|
|
381538
381574
|
});
|
|
@@ -381571,11 +381607,11 @@ async function feedbackCommand(message) {
|
|
|
381571
381607
|
} catch {
|
|
381572
381608
|
}
|
|
381573
381609
|
try {
|
|
381574
|
-
const
|
|
381575
|
-
await
|
|
381610
|
+
const client = new SpecificClient({ tokenProvider: getValidAccessToken });
|
|
381611
|
+
await client.submitFeedback({
|
|
381576
381612
|
message: trimmed,
|
|
381577
381613
|
projectId,
|
|
381578
|
-
cliVersion: "0.1.
|
|
381614
|
+
cliVersion: "0.1.224"
|
|
381579
381615
|
});
|
|
381580
381616
|
trackEvent("feedback_submitted", { hasProject: !!projectId });
|
|
381581
381617
|
console.log("Thanks! We will take a look at your feedback shortly.");
|
|
@@ -381594,7 +381630,7 @@ async function feedbackCommand(message) {
|
|
|
381594
381630
|
var program = new Command();
|
|
381595
381631
|
var env = "production";
|
|
381596
381632
|
var envLabel = env !== "production" ? `[${env.toUpperCase()}] ` : "";
|
|
381597
|
-
program.name("specific").description(`${envLabel}Infrastructure-as-code for coding agents`).version("0.1.
|
|
381633
|
+
program.name("specific").description(`${envLabel}Infrastructure-as-code for coding agents`).version("0.1.224").enablePositionalOptions();
|
|
381598
381634
|
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
381635
|
Examples:
|
|
381600
381636
|
$ specific init
|