@vibecloudtr/cli 0.0.1 → 0.1.0
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/ENVIRONMENT.md +1 -2
- package/README.md +22 -16
- package/commands.json +21 -1
- package/dist/main.js +869 -223
- package/dist/main.js.map +4 -4
- package/package.json +4 -4
package/dist/main.js
CHANGED
|
@@ -24,7 +24,7 @@ var ERRCODES = {
|
|
|
24
24
|
BUILD_SOURCE_UNAUTHORIZED: { httpStatus: 0, async: true, messageTR: "Derleme kayna\u011F\u0131 okunamad\u0131: repo \xF6zel ve platformun GitHub uygulamas\u0131 bu repoya eri\u015Femiyor.", retryable: false, fix: "connect GitHub from the console (GitHub'\u0131 ba\u011Fla) and grant the repository to the app, then redeploy" },
|
|
25
25
|
BUILD_TIMEOUT: { httpStatus: 0, async: true, messageTR: "Derleme zaman a\u015F\u0131m\u0131na u\u011Frad\u0131.", retryable: true, fix: "vibe deploy start --project <slug>" },
|
|
26
26
|
CELL_APPS_VIP_UNDECLARED: { httpStatus: 503, async: false, messageTR: "Bu alan ad\u0131 i\xE7in y\xF6nlendirme kayd\u0131 hen\xFCz verilemiyor.", retryable: false, fix: "none \u2014 a platform-side declaration; vibe domain add a subdomain (CNAME) in the meantime" },
|
|
27
|
-
CELL_AT_CAPACITY: { httpStatus: 503, async: false, messageTR: "\
|
|
27
|
+
CELL_AT_CAPACITY: { httpStatus: 503, async: false, messageTR: "Kapasitemiz \u015Fu an dolu ve art\u0131r\u0131yoruz. Talebinizi kaydettik; yer a\xE7\u0131l\u0131nca e-posta ile haber verece\u011Fiz.", retryable: true, fix: "wait for the availability e-mail" },
|
|
28
28
|
CELL_UNREACHABLE: { httpStatus: 503, async: false, messageTR: "\u0130\u015Fleminiz \u015Fu anda iletilemedi.", retryable: true, fix: "retry" },
|
|
29
29
|
CERT_ISSUANCE_FAILED: { httpStatus: 0, async: true, messageTR: "Sertifika al\u0131namad\u0131.", retryable: true, fix: "retry in 10 min" },
|
|
30
30
|
CERT_RENEWAL_FAILED: { httpStatus: 0, async: false, messageTR: "", retryable: true, fix: "" },
|
|
@@ -85,9 +85,11 @@ var ERRCODES = {
|
|
|
85
85
|
NOT_FOUND: { httpStatus: 404, async: false, messageTR: "Kay\u0131t bulunamad\u0131.", retryable: false, fix: "vibe project list" },
|
|
86
86
|
OPERATION_IN_PROGRESS: { httpStatus: 409, async: false, messageTR: "Bu proje \xFCzerinde ba\u015Fka bir i\u015Flem s\xFCr\xFCyor.", retryable: true, fix: "vibe project status --project <slug>, then retry when idle" },
|
|
87
87
|
PACKAGE_FLOOR: { httpStatus: 403, async: false, messageTR: "Bu \xF6zellik daha \xFCst bir paket gerektirir.", retryable: false, fix: "vibe project resize --project <slug> --package <details.requiredPackage>" },
|
|
88
|
+
PACKAGE_NOT_SERVED: { httpStatus: 409, async: false, messageTR: "Bu paket \u015Fu an bu b\xF6lgede sunulmuyor; l\xFCtfen destek ekibiyle ileti\u015Fime ge\xE7in.", retryable: false, fix: "pick another package, or contact support" },
|
|
88
89
|
PACKAGE_RETIRED: { httpStatus: 400, async: false, messageTR: "Bu paket art\u0131k sunulmuyor.", retryable: false, fix: "pick a listed package from packages" },
|
|
89
90
|
PARAMETER_NOT_ALLOWED: { httpStatus: 400, async: false, messageTR: "Bu ayar de\u011Fi\u015Ftirilemiyor.", retryable: false, fix: "remove the parameter and retry" },
|
|
90
91
|
PAST_DUE: { httpStatus: 402, async: false, messageTR: "\xD6demesi gecikmi\u015F faturan\u0131z var.", retryable: false, fix: "settle the invoice at https://vibecloud.tr/billing" },
|
|
92
|
+
PAYMENT_DETAILS_REJECTED: { httpStatus: 422, async: false, messageTR: "\xD6deme sa\u011Flay\u0131c\u0131s\u0131 girilen bilgileri kabul etmedi.", retryable: false, fix: "correct the field the message names and submit again" },
|
|
91
93
|
PAYMENT_NOT_RECEIVED: { httpStatus: 0, async: true, messageTR: "\xD6deme al\u0131nmad\u0131\u011F\u0131 i\xE7in proje serbest b\u0131rak\u0131ld\u0131.", retryable: false, fix: "vibe project create again when ready to pay" },
|
|
92
94
|
PAYMENT_PROVIDER_ERROR: { httpStatus: 502, async: false, messageTR: "\xD6deme sa\u011Flay\u0131c\u0131s\u0131na ula\u015F\u0131lamad\u0131.", retryable: true, fix: "retry in 60 s" },
|
|
93
95
|
PAYMENT_REQUIRED: { httpStatus: 402, async: false, messageTR: "Bu projenin \xF6demesi hen\xFCz al\u0131nmad\u0131.", retryable: false, fix: "open details.checkoutUrl and complete the checkout, then retry" },
|
|
@@ -115,6 +117,8 @@ var ERRCODES = {
|
|
|
115
117
|
ROLLBACK_TARGET_REAPED: { httpStatus: 409, async: false, messageTR: "Bu s\xFCr\xFCme geri d\xF6n\xFClemiyor; art\u0131k saklanm\u0131yor (saklama s\xFCresi ge\xE7ti ya da uygulama statik siteye ge\xE7ti).", retryable: false, fix: "vibe deploy start --project <slug>" },
|
|
116
118
|
SECRET_IN_PLAINTEXT_ENV: { httpStatus: 400, async: false, messageTR: "Bu de\u011Fer gizli g\xF6r\xFCn\xFCyor; `env` yerine gizli anahtar olarak ekleyin.", retryable: false, fix: "vibe config secret <KEY>" },
|
|
117
119
|
SECRET_WOULD_BE_PUBLIC: { httpStatus: 400, async: false, messageTR: "`NEXT_PUBLIC_` ile ba\u015Flayan bir de\u011Fer gizli tutulamaz; taray\u0131c\u0131ya g\xF6nderilir.", retryable: false, fix: "rename the key without the NEXT_PUBLIC_ prefix, then vibe config secret <KEY>" },
|
|
120
|
+
SERVICE_INIT_FAILED: { httpStatus: 0, async: true, messageTR: "Hizmet ba\u015Flat\u0131lamad\u0131.", retryable: false, fix: "run the same init again: vibe db init --project <slug> (or auth init / storage init)" },
|
|
121
|
+
SERVICE_NOT_INITIALIZED: { httpStatus: 409, async: false, messageTR: "Bu hizmet bu projede hen\xFCz ba\u015Flat\u0131lmad\u0131.", retryable: false, fix: "initialize it first: vibe db init (or auth init / storage init)" },
|
|
118
122
|
SLUG_INVALID: { httpStatus: 400, async: false, messageTR: "Ad yaln\u0131zca k\xFC\xE7\xFCk harf, rakam ve tire i\xE7erebilir.", retryable: false, fix: "vibe project create --name <slug: a-z0-9-, 3\u201340 chars>" },
|
|
119
123
|
SLUG_RESERVED: { httpStatus: 400, async: false, messageTR: "Bu ad ayr\u0131lm\u0131\u015F.", retryable: false, fix: "pick a slug that is not reserved: vibe project create --name <another-slug>, or rename the project to another slug" },
|
|
120
124
|
SLUG_TAKEN: { httpStatus: 409, async: false, messageTR: "Bu ad zaten kullan\u0131l\u0131yor.", retryable: false, fix: "vibe project create --name <another-slug>" },
|
|
@@ -204,7 +208,7 @@ function describeCause(err) {
|
|
|
204
208
|
// src/cli/editor-env.ts
|
|
205
209
|
function userAgent(env) {
|
|
206
210
|
const agent = detectEditor(env);
|
|
207
|
-
return `vibecloud-cli/${"0.0
|
|
211
|
+
return `vibecloud-cli/${"0.1.0"} (${agent === "" ? "none" : agent})`;
|
|
208
212
|
}
|
|
209
213
|
var processUserAgent;
|
|
210
214
|
function processAgent() {
|
|
@@ -420,14 +424,14 @@ function backoffMs(policy, attempt) {
|
|
|
420
424
|
}
|
|
421
425
|
async function delay(signal, ms2) {
|
|
422
426
|
if (signal.aborted) return new Error("bekleme iptal edildi");
|
|
423
|
-
return new Promise((
|
|
427
|
+
return new Promise((resolve5) => {
|
|
424
428
|
const timer = setTimeout(() => {
|
|
425
429
|
signal.removeEventListener("abort", onAbort);
|
|
426
|
-
|
|
430
|
+
resolve5(void 0);
|
|
427
431
|
}, ms2);
|
|
428
432
|
function onAbort() {
|
|
429
433
|
clearTimeout(timer);
|
|
430
|
-
|
|
434
|
+
resolve5(new Error("bekleme iptal edildi"));
|
|
431
435
|
}
|
|
432
436
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
433
437
|
});
|
|
@@ -1070,8 +1074,8 @@ function parseIcacls(output, path) {
|
|
|
1070
1074
|
const principal = line.slice(0, sep3).trim();
|
|
1071
1075
|
if (principal === "") continue;
|
|
1072
1076
|
const rights = [];
|
|
1073
|
-
for (const
|
|
1074
|
-
const value =
|
|
1077
|
+
for (const group2 of line.slice(sep3 + 1).matchAll(/\(([^)]*)\)/g)) {
|
|
1078
|
+
const value = group2[1];
|
|
1075
1079
|
if (value === void 0) continue;
|
|
1076
1080
|
rights.push(value.trim());
|
|
1077
1081
|
}
|
|
@@ -3461,7 +3465,7 @@ var DB_COMMANDS = [
|
|
|
3461
3465
|
// a word that is not a subcommand is named rather than ignored — without this
|
|
3462
3466
|
// `vibe db conect --project x` would resolve to the group and do nothing.
|
|
3463
3467
|
path: ["db"],
|
|
3464
|
-
summary: "veritabani (connect, migrate, introspect, security)",
|
|
3468
|
+
summary: "veritabani (init, connect, migrate, introspect, security)",
|
|
3465
3469
|
kind: "runs",
|
|
3466
3470
|
listed: false,
|
|
3467
3471
|
flags: [],
|
|
@@ -3469,7 +3473,7 @@ var DB_COMMANDS = [
|
|
|
3469
3473
|
const first = rest[0];
|
|
3470
3474
|
if (first === void 0) {
|
|
3471
3475
|
return Promise.reject(
|
|
3472
|
-
new Error("db alt komutu gerekli: connect, migrate, introspect, security")
|
|
3476
|
+
new Error("db alt komutu gerekli: init, connect, migrate, introspect, security")
|
|
3473
3477
|
);
|
|
3474
3478
|
}
|
|
3475
3479
|
return Promise.reject(new Error(`bilinmeyen db alt komutu: ${first}`));
|
|
@@ -3873,6 +3877,291 @@ var LOGS_COMMANDS = [
|
|
|
3873
3877
|
})
|
|
3874
3878
|
];
|
|
3875
3879
|
|
|
3880
|
+
// src/cli/commands/deploy.ts
|
|
3881
|
+
import { resolve } from "node:path";
|
|
3882
|
+
|
|
3883
|
+
// src/cli/upload/pack.ts
|
|
3884
|
+
import { createHash } from "node:crypto";
|
|
3885
|
+
import { lstat, readFile, readdir, readlink } from "node:fs/promises";
|
|
3886
|
+
import { join as join2, posix } from "node:path";
|
|
3887
|
+
import { gzipSync } from "node:zlib";
|
|
3888
|
+
var MAX_ARCHIVE_BYTES = 100 * 1024 * 1024;
|
|
3889
|
+
var ALWAYS_EXCLUDED = /* @__PURE__ */ new Set([
|
|
3890
|
+
".git",
|
|
3891
|
+
"node_modules",
|
|
3892
|
+
".vc",
|
|
3893
|
+
".next",
|
|
3894
|
+
".vercel",
|
|
3895
|
+
".turbo",
|
|
3896
|
+
".cache",
|
|
3897
|
+
".DS_Store"
|
|
3898
|
+
]);
|
|
3899
|
+
function isEnvFile(name) {
|
|
3900
|
+
if (name !== ".env" && !name.startsWith(".env.")) return false;
|
|
3901
|
+
return ![".env.example", ".env.sample", ".env.template"].includes(name);
|
|
3902
|
+
}
|
|
3903
|
+
function globToRegExp(glob) {
|
|
3904
|
+
let out = "";
|
|
3905
|
+
for (let i = 0; i < glob.length; i++) {
|
|
3906
|
+
const ch = glob.charAt(i);
|
|
3907
|
+
if (ch === "*") {
|
|
3908
|
+
if (glob.charAt(i + 1) === "*") {
|
|
3909
|
+
i++;
|
|
3910
|
+
if (glob.charAt(i + 1) === "/") {
|
|
3911
|
+
out += "(?:.*/)?";
|
|
3912
|
+
i++;
|
|
3913
|
+
} else {
|
|
3914
|
+
out += ".*";
|
|
3915
|
+
}
|
|
3916
|
+
} else {
|
|
3917
|
+
out += "[^/]*";
|
|
3918
|
+
}
|
|
3919
|
+
} else if (ch === "?") {
|
|
3920
|
+
out += "[^/]";
|
|
3921
|
+
} else {
|
|
3922
|
+
out += ch.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
3923
|
+
}
|
|
3924
|
+
}
|
|
3925
|
+
return out;
|
|
3926
|
+
}
|
|
3927
|
+
function parseIgnore(text) {
|
|
3928
|
+
const rules = [];
|
|
3929
|
+
for (const raw of text.split(/\r?\n/)) {
|
|
3930
|
+
let line = raw.trim();
|
|
3931
|
+
if (line === "" || line.startsWith("#")) continue;
|
|
3932
|
+
const negate = line.startsWith("!");
|
|
3933
|
+
if (negate) line = line.slice(1);
|
|
3934
|
+
const dirOnly = line.endsWith("/");
|
|
3935
|
+
if (dirOnly) line = line.slice(0, -1);
|
|
3936
|
+
const anchored = line.includes("/");
|
|
3937
|
+
if (line.startsWith("/")) line = line.slice(1);
|
|
3938
|
+
if (line === "") continue;
|
|
3939
|
+
const body = globToRegExp(line);
|
|
3940
|
+
const re = new RegExp(anchored ? `^${body}$` : `(^|/)${body}$`);
|
|
3941
|
+
rules.push({ re, negate, dirOnly });
|
|
3942
|
+
}
|
|
3943
|
+
return rules;
|
|
3944
|
+
}
|
|
3945
|
+
function ignored(rules, rel, isDir) {
|
|
3946
|
+
let out = false;
|
|
3947
|
+
for (const r of rules) {
|
|
3948
|
+
if (r.dirOnly && !isDir) continue;
|
|
3949
|
+
if (r.re.test(rel)) out = !r.negate;
|
|
3950
|
+
}
|
|
3951
|
+
return out;
|
|
3952
|
+
}
|
|
3953
|
+
async function collect(root, rules) {
|
|
3954
|
+
const out = [];
|
|
3955
|
+
async function walk2(rel) {
|
|
3956
|
+
const names = (await readdir(join2(root, rel))).sort();
|
|
3957
|
+
for (const name of names) {
|
|
3958
|
+
if (ALWAYS_EXCLUDED.has(name) || isEnvFile(name)) continue;
|
|
3959
|
+
const childRel = rel === "" ? name : `${rel}/${name}`;
|
|
3960
|
+
const st = await lstat(join2(root, childRel));
|
|
3961
|
+
if (ignored(rules, childRel, st.isDirectory())) continue;
|
|
3962
|
+
if (st.isSymbolicLink()) {
|
|
3963
|
+
const link = await readlink(join2(root, childRel));
|
|
3964
|
+
const resolved = posix.normalize(posix.join(posix.dirname(childRel), link));
|
|
3965
|
+
if (posix.isAbsolute(link) || resolved === ".." || resolved.startsWith("../")) {
|
|
3966
|
+
throw new Error(
|
|
3967
|
+
`kaynak arsivi: ${childRel} proje disini gosteren bir baglanti (${link}) \u2014 derleme bunu reddeder; baglantiyi kaldirin`
|
|
3968
|
+
);
|
|
3969
|
+
}
|
|
3970
|
+
out.push({ name: childRel, type: "symlink", mode: 511, link });
|
|
3971
|
+
} else if (st.isDirectory()) {
|
|
3972
|
+
out.push({ name: `${childRel}/`, type: "dir", mode: 493 });
|
|
3973
|
+
await walk2(childRel);
|
|
3974
|
+
} else if (st.isFile()) {
|
|
3975
|
+
const mode2 = (st.mode & 73) !== 0 ? 493 : 420;
|
|
3976
|
+
out.push({
|
|
3977
|
+
name: childRel,
|
|
3978
|
+
type: "file",
|
|
3979
|
+
mode: mode2,
|
|
3980
|
+
body: await readFile(join2(root, childRel))
|
|
3981
|
+
});
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
}
|
|
3985
|
+
await walk2("");
|
|
3986
|
+
return out;
|
|
3987
|
+
}
|
|
3988
|
+
function octal(n, width) {
|
|
3989
|
+
return n.toString(8).padStart(width - 1, "0") + "\0";
|
|
3990
|
+
}
|
|
3991
|
+
function header(name, type, mode2, size, link) {
|
|
3992
|
+
const h = Buffer.alloc(512, 0);
|
|
3993
|
+
h.write(name, 0, 100, "utf8");
|
|
3994
|
+
h.write(octal(mode2, 8), 100, 8, "ascii");
|
|
3995
|
+
h.write(octal(0, 8), 108, 8, "ascii");
|
|
3996
|
+
h.write(octal(0, 8), 116, 8, "ascii");
|
|
3997
|
+
h.write(octal(size, 12), 124, 12, "ascii");
|
|
3998
|
+
h.write(octal(0, 12), 136, 12, "ascii");
|
|
3999
|
+
h.write(" ", 148, 8, "ascii");
|
|
4000
|
+
h.write(type, 156, 1, "ascii");
|
|
4001
|
+
h.write(link, 157, 100, "utf8");
|
|
4002
|
+
h.write("ustar\0", 257, 6, "ascii");
|
|
4003
|
+
h.write("00", 263, 2, "ascii");
|
|
4004
|
+
let sum = 0;
|
|
4005
|
+
for (const b of h) sum += b;
|
|
4006
|
+
h.write(octal(sum, 7) + " ", 148, 8, "ascii");
|
|
4007
|
+
return h;
|
|
4008
|
+
}
|
|
4009
|
+
function pad(n) {
|
|
4010
|
+
const r = n % 512;
|
|
4011
|
+
return Buffer.alloc(r === 0 ? 0 : 512 - r, 0);
|
|
4012
|
+
}
|
|
4013
|
+
function paxRecord(key, value) {
|
|
4014
|
+
const body = ` ${key}=${value}
|
|
4015
|
+
`;
|
|
4016
|
+
let len = Buffer.byteLength(body) + 1;
|
|
4017
|
+
while (String(len).length + Buffer.byteLength(body) !== len)
|
|
4018
|
+
len = String(len).length + Buffer.byteLength(body);
|
|
4019
|
+
return `${len}${body}`;
|
|
4020
|
+
}
|
|
4021
|
+
function tarEntry(e) {
|
|
4022
|
+
const parts = [];
|
|
4023
|
+
const link = e.link === void 0 ? "" : e.link;
|
|
4024
|
+
const long = Buffer.byteLength(e.name) > 100 || Buffer.byteLength(link) > 100;
|
|
4025
|
+
if (long) {
|
|
4026
|
+
const pax = Buffer.from(
|
|
4027
|
+
paxRecord("path", e.name) + (link !== "" ? paxRecord("linkpath", link) : ""),
|
|
4028
|
+
"utf8"
|
|
4029
|
+
);
|
|
4030
|
+
parts.push(header("PaxHeader", "x", 420, pax.length, ""), pax, pad(pax.length));
|
|
4031
|
+
}
|
|
4032
|
+
const name = long ? e.name.slice(0, 99) : e.name;
|
|
4033
|
+
const size = e.type === "file" && e.body !== void 0 ? e.body.length : 0;
|
|
4034
|
+
const type = e.type === "file" ? "0" : e.type === "dir" ? "5" : "2";
|
|
4035
|
+
parts.push(header(name, type, e.mode, size, long ? "" : link));
|
|
4036
|
+
if (e.type === "file" && e.body !== void 0) parts.push(e.body, pad(e.body.length));
|
|
4037
|
+
return parts;
|
|
4038
|
+
}
|
|
4039
|
+
async function packDirectory(root) {
|
|
4040
|
+
let rules = [];
|
|
4041
|
+
try {
|
|
4042
|
+
rules = parseIgnore(await readFile(join2(root, ".gitignore"), "utf8"));
|
|
4043
|
+
} catch (cause) {
|
|
4044
|
+
if (!(cause instanceof Error) || cause.code !== "ENOENT")
|
|
4045
|
+
throw cause;
|
|
4046
|
+
}
|
|
4047
|
+
const entries3 = await collect(root, rules);
|
|
4048
|
+
const files = entries3.filter((e) => e.type === "file").length;
|
|
4049
|
+
if (files === 0) throw new Error("kaynak arsivi: dizinde yuklenecek dosya yok");
|
|
4050
|
+
const tar = Buffer.concat([...entries3.flatMap(tarEntry), Buffer.alloc(1024, 0)]);
|
|
4051
|
+
const archive = gzipSync(tar, { level: 9 });
|
|
4052
|
+
if (archive.length > MAX_ARCHIVE_BYTES) {
|
|
4053
|
+
throw new Error(
|
|
4054
|
+
`kaynak arsivi ${archive.length} bayt; sinir ${MAX_ARCHIVE_BYTES} \u2014 derleme ciktilarini ve buyuk dosyalari .gitignore ile disarida birakin`
|
|
4055
|
+
);
|
|
4056
|
+
}
|
|
4057
|
+
return { archive, sha256: createHash("sha256").update(archive).digest("hex"), files };
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
// src/cli/upload/upload.ts
|
|
4061
|
+
var UPLOAD_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
4062
|
+
var CREATE_UPLOAD_APP = `mutation($in: CreateAppInput!) {
|
|
4063
|
+
createApp(input: $in) {
|
|
4064
|
+
clientMutationId
|
|
4065
|
+
operation { id state kind errorCode message }
|
|
4066
|
+
}
|
|
4067
|
+
}`;
|
|
4068
|
+
var CREATE_SOURCE_UPLOAD = `mutation($in: CreateSourceUploadInput!) {
|
|
4069
|
+
createSourceUpload(input: $in) { clientMutationId uploadId url expiresAt }
|
|
4070
|
+
}`;
|
|
4071
|
+
var DEPLOY_UPLOAD = `mutation($in: DeployUploadInput!) {
|
|
4072
|
+
deployUpload(input: $in) {
|
|
4073
|
+
clientMutationId
|
|
4074
|
+
operation { id state kind errorCode message }
|
|
4075
|
+
}
|
|
4076
|
+
}`;
|
|
4077
|
+
async function createUploadApp(signal, c, org, projectSlug, out) {
|
|
4078
|
+
let projectID;
|
|
4079
|
+
try {
|
|
4080
|
+
projectID = await lookupProjectID(signal, c, org, projectSlug);
|
|
4081
|
+
} catch (cause) {
|
|
4082
|
+
printAPIError(cause, out);
|
|
4083
|
+
throw cause;
|
|
4084
|
+
}
|
|
4085
|
+
const mutationID = newMutationID("app.create");
|
|
4086
|
+
let res;
|
|
4087
|
+
try {
|
|
4088
|
+
res = await c.mutate(signal, mutationID, CREATE_UPLOAD_APP, {
|
|
4089
|
+
in: { clientMutationId: mutationID, projectId: projectID, sourceType: "UPLOAD" }
|
|
4090
|
+
});
|
|
4091
|
+
} catch (cause) {
|
|
4092
|
+
printAPIError(cause, out);
|
|
4093
|
+
throw cause;
|
|
4094
|
+
}
|
|
4095
|
+
const op = res.createApp.operation;
|
|
4096
|
+
if (op === null || op === void 0)
|
|
4097
|
+
throw new Error("INTERNAL: API bir islem kimligi dondurmedi");
|
|
4098
|
+
out.print(`uygulama olusturuluyor: ${projectSlug} \u2014 kaynak: bu dizin (yukleme)`);
|
|
4099
|
+
await waitOperation(signal, c, op, out);
|
|
4100
|
+
}
|
|
4101
|
+
async function deployDirectory(signal, c, org, projectSlug, root, out, putTimeoutMs) {
|
|
4102
|
+
const packed = await packDirectory(root);
|
|
4103
|
+
out.print(`kaynak paketlendi: ${packed.files} dosya, ${packed.archive.length} bayt`);
|
|
4104
|
+
let projectID;
|
|
4105
|
+
try {
|
|
4106
|
+
projectID = await lookupProjectID(signal, c, org, projectSlug);
|
|
4107
|
+
} catch (cause) {
|
|
4108
|
+
printAPIError(cause, out);
|
|
4109
|
+
throw cause;
|
|
4110
|
+
}
|
|
4111
|
+
const uploadMutation = newMutationID("source.upload");
|
|
4112
|
+
let minted;
|
|
4113
|
+
try {
|
|
4114
|
+
minted = await c.mutate(signal, uploadMutation, CREATE_SOURCE_UPLOAD, {
|
|
4115
|
+
in: { clientMutationId: uploadMutation, projectId: projectID }
|
|
4116
|
+
});
|
|
4117
|
+
} catch (cause) {
|
|
4118
|
+
printAPIError(cause, out);
|
|
4119
|
+
throw cause;
|
|
4120
|
+
}
|
|
4121
|
+
const { uploadId, url } = minted.createSourceUpload;
|
|
4122
|
+
if (requireSecureURL("kaynak yukleme", url) !== void 0) {
|
|
4123
|
+
throw new Error("kaynak yukleme adresi guvenli degil; yuklenmedi");
|
|
4124
|
+
}
|
|
4125
|
+
const bounded = withTimeout(signal, putTimeoutMs);
|
|
4126
|
+
let res;
|
|
4127
|
+
try {
|
|
4128
|
+
res = await fetch(url, {
|
|
4129
|
+
method: "PUT",
|
|
4130
|
+
body: packed.archive,
|
|
4131
|
+
headers: { "Content-Type": "application/gzip" },
|
|
4132
|
+
signal: bounded,
|
|
4133
|
+
redirect: "error"
|
|
4134
|
+
});
|
|
4135
|
+
} catch {
|
|
4136
|
+
throw new Error(
|
|
4137
|
+
`kaynak yuklenemedi: ${signal.aborted ? "istek iptal edildi" : bounded.aborted ? "zaman asimi" : "baglanti hatasi"}`
|
|
4138
|
+
);
|
|
4139
|
+
}
|
|
4140
|
+
if (res.status !== 201) {
|
|
4141
|
+
throw new Error(`kaynak yuklenemedi: hucre ${res.status} dondu`);
|
|
4142
|
+
}
|
|
4143
|
+
out.print("kaynak yuklendi");
|
|
4144
|
+
const deployMutation = newMutationID("app.deploy");
|
|
4145
|
+
let dep;
|
|
4146
|
+
try {
|
|
4147
|
+
dep = await c.mutate(signal, deployMutation, DEPLOY_UPLOAD, {
|
|
4148
|
+
in: {
|
|
4149
|
+
clientMutationId: deployMutation,
|
|
4150
|
+
projectId: projectID,
|
|
4151
|
+
uploadId,
|
|
4152
|
+
uploadSha256: packed.sha256
|
|
4153
|
+
}
|
|
4154
|
+
});
|
|
4155
|
+
} catch (cause) {
|
|
4156
|
+
printAPIError(cause, out);
|
|
4157
|
+
throw cause;
|
|
4158
|
+
}
|
|
4159
|
+
const op = dep.deployUpload.operation;
|
|
4160
|
+
if (op === null || op === void 0)
|
|
4161
|
+
throw new Error("INTERNAL: API bir islem kimligi dondurmedi");
|
|
4162
|
+
await waitOperation(signal, c, op, out);
|
|
4163
|
+
}
|
|
4164
|
+
|
|
3876
4165
|
// src/cli/commands/deploy.ts
|
|
3877
4166
|
var DEPLOY_APP_MUTATION = `mutation($in: DeployAppInput!) {
|
|
3878
4167
|
deployApp(input: $in) {
|
|
@@ -4241,6 +4530,31 @@ var DEPLOY_COMMANDS = [
|
|
|
4241
4530
|
},
|
|
4242
4531
|
coverage: [{ argv: ["deploy", "start"], ok: false }]
|
|
4243
4532
|
}),
|
|
4533
|
+
defineCommand({
|
|
4534
|
+
path: ["deploy", "upload"],
|
|
4535
|
+
summary: "bu dizini yukleyip derle ve yayinla (git reposu olmayan, yuklemeyle baglanan uygulama)",
|
|
4536
|
+
kind: "runs",
|
|
4537
|
+
listed: true,
|
|
4538
|
+
flags: [
|
|
4539
|
+
ORG_FLAG4,
|
|
4540
|
+
PROJECT_FLAG4,
|
|
4541
|
+
{ name: "dir", type: "string", summary: "yuklenecek dizin", literalDefault: "." }
|
|
4542
|
+
],
|
|
4543
|
+
run: async ({ signal, out, flags, config, now }) => {
|
|
4544
|
+
const c = await apiClient(signal, config, now, out);
|
|
4545
|
+
const projectSlug = str(flags, "project");
|
|
4546
|
+
if (projectSlug === "") {
|
|
4547
|
+
out.printError("SLUG_INVALID", "proje kimligi gerekli (--project)");
|
|
4548
|
+
throw new Error("SLUG_INVALID: deploy upload: proje gerekli");
|
|
4549
|
+
}
|
|
4550
|
+
const dir = str(flags, "dir");
|
|
4551
|
+
if (dir === "") throw new Error("deploy upload: --dir gerekli");
|
|
4552
|
+
const org = await orgFor(signal, c, str(flags, "org"), out);
|
|
4553
|
+
await deployDirectory(signal, c, org, projectSlug, resolve(dir), out, UPLOAD_TIMEOUT_MS);
|
|
4554
|
+
return 0;
|
|
4555
|
+
},
|
|
4556
|
+
coverage: [{ argv: ["deploy", "upload"], ok: false }]
|
|
4557
|
+
}),
|
|
4244
4558
|
defineCommand({
|
|
4245
4559
|
path: ["deploy", "cancel"],
|
|
4246
4560
|
summary: "suren derlemeyi iptal et",
|
|
@@ -4790,27 +5104,27 @@ var DOMAIN_COMMANDS = [
|
|
|
4790
5104
|
|
|
4791
5105
|
// src/cli/commands/init.ts
|
|
4792
5106
|
import { execFile } from "node:child_process";
|
|
4793
|
-
import { readFileSync as
|
|
5107
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
4794
5108
|
import { homedir as homedir2 } from "node:os";
|
|
4795
|
-
import { basename, join as
|
|
5109
|
+
import { basename, join as join5 } from "node:path";
|
|
4796
5110
|
|
|
4797
5111
|
// src/cli/mcp/editors.ts
|
|
4798
|
-
import { join as
|
|
5112
|
+
import { join as join3 } from "node:path";
|
|
4799
5113
|
var SERVER_KEY = "vibecloud";
|
|
4800
5114
|
var VSCODE_USER_DIR = "Code";
|
|
4801
5115
|
var CLINE_EXTENSION = "saoudrizwan.claude-dev";
|
|
4802
5116
|
function vscodeUserDir(env) {
|
|
4803
5117
|
if (env.platform === "darwin") {
|
|
4804
|
-
return
|
|
5118
|
+
return join3(env.home, "Library", "Application Support", VSCODE_USER_DIR, "User");
|
|
4805
5119
|
}
|
|
4806
5120
|
if (env.platform === "win32") {
|
|
4807
5121
|
const appData = env.env.APPDATA;
|
|
4808
5122
|
if (appData === void 0 || appData === "") {
|
|
4809
5123
|
return new Error("APPDATA tanimli degil \u2014 VS Code kullanici dizini bulunamadi");
|
|
4810
5124
|
}
|
|
4811
|
-
return
|
|
5125
|
+
return join3(appData, VSCODE_USER_DIR, "User");
|
|
4812
5126
|
}
|
|
4813
|
-
return
|
|
5127
|
+
return join3(env.home, ".config", VSCODE_USER_DIR, "User");
|
|
4814
5128
|
}
|
|
4815
5129
|
var EDITORS = [
|
|
4816
5130
|
{
|
|
@@ -4818,7 +5132,7 @@ var EDITORS = [
|
|
|
4818
5132
|
display: "Cursor",
|
|
4819
5133
|
scope: "user",
|
|
4820
5134
|
rootKey: "mcpServers",
|
|
4821
|
-
resolvePath: (env) =>
|
|
5135
|
+
resolvePath: (env) => join3(env.home, ".cursor", "mcp.json"),
|
|
4822
5136
|
entry: (url) => ({ url }),
|
|
4823
5137
|
verifiedAgainst: "https://docs.cursor.com/context/model-context-protocol"
|
|
4824
5138
|
},
|
|
@@ -4843,7 +5157,7 @@ var EDITORS = [
|
|
|
4843
5157
|
// tool just wrote.
|
|
4844
5158
|
scope: "project",
|
|
4845
5159
|
rootKey: "mcpServers",
|
|
4846
|
-
resolvePath: (env) =>
|
|
5160
|
+
resolvePath: (env) => join3(env.cwd, ".mcp.json"),
|
|
4847
5161
|
entry: (url) => ({ type: "http", url }),
|
|
4848
5162
|
verifiedAgainst: "https://code.claude.com/docs/en/mcp"
|
|
4849
5163
|
},
|
|
@@ -4858,7 +5172,7 @@ var EDITORS = [
|
|
|
4858
5172
|
// the difference is visible rather than surprising.
|
|
4859
5173
|
scope: "project",
|
|
4860
5174
|
rootKey: "servers",
|
|
4861
|
-
resolvePath: (env) =>
|
|
5175
|
+
resolvePath: (env) => join3(env.cwd, ".vscode", "mcp.json"),
|
|
4862
5176
|
entry: (url) => ({ type: "http", url }),
|
|
4863
5177
|
verifiedAgainst: "https://code.visualstudio.com/docs/agent-customization/mcp-servers"
|
|
4864
5178
|
},
|
|
@@ -4867,7 +5181,7 @@ var EDITORS = [
|
|
|
4867
5181
|
display: "Windsurf",
|
|
4868
5182
|
scope: "user",
|
|
4869
5183
|
rootKey: "mcpServers",
|
|
4870
|
-
resolvePath: (env) =>
|
|
5184
|
+
resolvePath: (env) => join3(env.home, ".codeium", "windsurf", "mcp_config.json"),
|
|
4871
5185
|
// 🔴 `serverUrl`, not `url`. The only editor here that spells it that way.
|
|
4872
5186
|
entry: (url) => ({ serverUrl: url }),
|
|
4873
5187
|
verifiedAgainst: "https://docs.windsurf.com/windsurf/cascade/mcp"
|
|
@@ -4878,7 +5192,7 @@ var EDITORS = [
|
|
|
4878
5192
|
scope: "user",
|
|
4879
5193
|
// 🔴 `mcp`, not `mcpServers`.
|
|
4880
5194
|
rootKey: "mcp",
|
|
4881
|
-
resolvePath: (env) =>
|
|
5195
|
+
resolvePath: (env) => join3(env.home, ".config", "opencode", "opencode.json"),
|
|
4882
5196
|
// `enabled` is written explicitly: opencode treats a server supplied by an
|
|
4883
5197
|
// organisation default as opt-in, and an entry that is present but off looks
|
|
4884
5198
|
// identical to one that failed to load.
|
|
@@ -4893,7 +5207,7 @@ var EDITORS = [
|
|
|
4893
5207
|
resolvePath: (env) => {
|
|
4894
5208
|
const dir = vscodeUserDir(env);
|
|
4895
5209
|
if (dir instanceof Error) return dir;
|
|
4896
|
-
return
|
|
5210
|
+
return join3(dir, "globalStorage", CLINE_EXTENSION, "settings", "cline_mcp_settings.json");
|
|
4897
5211
|
},
|
|
4898
5212
|
entry: (url) => ({ type: "streamableHttp", url, disabled: false }),
|
|
4899
5213
|
verifiedAgainst: "https://docs.cline.bot/mcp/mcp-overview"
|
|
@@ -4903,7 +5217,7 @@ var EDITORS = [
|
|
|
4903
5217
|
display: "Kimi Code CLI",
|
|
4904
5218
|
scope: "user",
|
|
4905
5219
|
rootKey: "mcpServers",
|
|
4906
|
-
resolvePath: (env) =>
|
|
5220
|
+
resolvePath: (env) => join3(env.home, ".kimi", "mcp.json"),
|
|
4907
5221
|
entry: (url) => ({ url }),
|
|
4908
5222
|
verifiedAgainst: "https://moonshotai.github.io/kimi-cli/en/customization/mcp.html"
|
|
4909
5223
|
}
|
|
@@ -5151,6 +5465,12 @@ function nextAction(code) {
|
|
|
5151
5465
|
case "CELL_UNREACHABLE":
|
|
5152
5466
|
case "OPERATION_IN_PROGRESS":
|
|
5153
5467
|
return "biraz bekleyip tekrar deneyin";
|
|
5468
|
+
case "CELL_AT_CAPACITY":
|
|
5469
|
+
return "talebiniz kaydedildi; yer acilinca e-posta ile haber verecegiz";
|
|
5470
|
+
case "PACKAGE_NOT_SERVED":
|
|
5471
|
+
return "baska bir paket secin; bu paket bu bolgede sunulmuyor";
|
|
5472
|
+
case "BUILD_IN_PROGRESS":
|
|
5473
|
+
return "surmekte olan derleme bitince tekrar deneyin";
|
|
5154
5474
|
case "":
|
|
5155
5475
|
return "";
|
|
5156
5476
|
default:
|
|
@@ -5594,6 +5914,186 @@ var MCP_COMMANDS = [
|
|
|
5594
5914
|
})
|
|
5595
5915
|
];
|
|
5596
5916
|
|
|
5917
|
+
// src/cli/services/services.ts
|
|
5918
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
5919
|
+
import { join as join4 } from "node:path";
|
|
5920
|
+
var SERVICE_WAIT_SECONDS = 20 * 60;
|
|
5921
|
+
var INITIALIZE_SERVICE = `mutation($in: InitializeServiceInput!) {
|
|
5922
|
+
initializeService(input: $in) {
|
|
5923
|
+
clientMutationId
|
|
5924
|
+
operation { id state kind errorCode message }
|
|
5925
|
+
}
|
|
5926
|
+
}`;
|
|
5927
|
+
var servicesFields = `services {
|
|
5928
|
+
database { state since message }
|
|
5929
|
+
auth { state since message }
|
|
5930
|
+
rest { state since message }
|
|
5931
|
+
storage { state since message }
|
|
5932
|
+
}`;
|
|
5933
|
+
function impliedServices(service) {
|
|
5934
|
+
switch (service) {
|
|
5935
|
+
case "DATABASE":
|
|
5936
|
+
return ["DATABASE"];
|
|
5937
|
+
case "REST":
|
|
5938
|
+
return ["DATABASE", "REST"];
|
|
5939
|
+
case "AUTH":
|
|
5940
|
+
return ["DATABASE", "REST", "AUTH"];
|
|
5941
|
+
case "STORAGE":
|
|
5942
|
+
return ["DATABASE", "REST", "STORAGE"];
|
|
5943
|
+
}
|
|
5944
|
+
}
|
|
5945
|
+
var LABEL = {
|
|
5946
|
+
DATABASE: "veritabani",
|
|
5947
|
+
REST: "REST API",
|
|
5948
|
+
AUTH: "kimlik",
|
|
5949
|
+
STORAGE: "depolama"
|
|
5950
|
+
};
|
|
5951
|
+
function statusOf(node, service) {
|
|
5952
|
+
switch (service) {
|
|
5953
|
+
case "DATABASE":
|
|
5954
|
+
return node.database;
|
|
5955
|
+
case "REST":
|
|
5956
|
+
return node.rest;
|
|
5957
|
+
case "AUTH":
|
|
5958
|
+
return node.auth;
|
|
5959
|
+
case "STORAGE":
|
|
5960
|
+
return node.storage;
|
|
5961
|
+
}
|
|
5962
|
+
}
|
|
5963
|
+
async function readServices(signal, c, org, projectSlug) {
|
|
5964
|
+
const res = await c.query(
|
|
5965
|
+
signal,
|
|
5966
|
+
projectQuery(servicesFields),
|
|
5967
|
+
projectVars(org, projectSlug)
|
|
5968
|
+
);
|
|
5969
|
+
if (res.projectBySlug === null || res.projectBySlug === void 0) {
|
|
5970
|
+
throw new Error(`NOT_FOUND: proje bulunamadi: ${projectSlug}`);
|
|
5971
|
+
}
|
|
5972
|
+
return res.projectBySlug.services;
|
|
5973
|
+
}
|
|
5974
|
+
async function initializeService(signal, c, org, projectSlug, service, out, clock) {
|
|
5975
|
+
const wanted = impliedServices(service);
|
|
5976
|
+
const before = await readServices(signal, c, org, projectSlug);
|
|
5977
|
+
if (wanted.every((s) => statusOf(before, s).state === "READY")) {
|
|
5978
|
+
out.print(`${LABEL[service]}: zaten hazir`);
|
|
5979
|
+
return { result: "ready", services: before };
|
|
5980
|
+
}
|
|
5981
|
+
let projectID;
|
|
5982
|
+
try {
|
|
5983
|
+
projectID = await lookupProjectID(signal, c, org, projectSlug);
|
|
5984
|
+
} catch (cause) {
|
|
5985
|
+
printAPIError(cause, out);
|
|
5986
|
+
throw cause;
|
|
5987
|
+
}
|
|
5988
|
+
const mutationID = newMutationID("service.init");
|
|
5989
|
+
let res;
|
|
5990
|
+
try {
|
|
5991
|
+
res = await c.mutate(signal, mutationID, INITIALIZE_SERVICE, {
|
|
5992
|
+
in: { clientMutationId: mutationID, projectId: projectID, service }
|
|
5993
|
+
});
|
|
5994
|
+
} catch (cause) {
|
|
5995
|
+
printAPIError(cause, out);
|
|
5996
|
+
throw cause;
|
|
5997
|
+
}
|
|
5998
|
+
const op = res.initializeService.operation;
|
|
5999
|
+
if (op === null || op === void 0)
|
|
6000
|
+
throw new Error("INTERNAL: API bir islem kimligi dondurmedi");
|
|
6001
|
+
out.print(`${LABEL[service]} baslatiliyor: ${projectSlug}`);
|
|
6002
|
+
const done = await waitOperation(signal, c, op, out);
|
|
6003
|
+
if (failed(done)) {
|
|
6004
|
+
throw new Error(`${done.errorCode}: ${done.message}`);
|
|
6005
|
+
}
|
|
6006
|
+
const stale = /* @__PURE__ */ new Map();
|
|
6007
|
+
for (const s of wanted) {
|
|
6008
|
+
const st = statusOf(before, s);
|
|
6009
|
+
if (st.state === "FAILED") stale.set(s, st.since);
|
|
6010
|
+
}
|
|
6011
|
+
const deadline = clock.now().getTime() + clock.waitSeconds * 1e3;
|
|
6012
|
+
const shown = /* @__PURE__ */ new Map();
|
|
6013
|
+
for (; ; ) {
|
|
6014
|
+
const node = await readServices(signal, c, org, projectSlug);
|
|
6015
|
+
for (const s of wanted) {
|
|
6016
|
+
const st = statusOf(node, s);
|
|
6017
|
+
if (shown.get(s) !== st.state) {
|
|
6018
|
+
shown.set(s, st.state);
|
|
6019
|
+
out.print(` ${LABEL[s]}: ${st.state}`);
|
|
6020
|
+
}
|
|
6021
|
+
}
|
|
6022
|
+
if (wanted.every((s) => statusOf(node, s).state === "READY")) {
|
|
6023
|
+
return { result: "ready", services: node };
|
|
6024
|
+
}
|
|
6025
|
+
for (const s of wanted) {
|
|
6026
|
+
const st = statusOf(node, s);
|
|
6027
|
+
if (st.state === "FAILED" && (!stale.has(s) || stale.get(s) !== st.since)) {
|
|
6028
|
+
return {
|
|
6029
|
+
result: "failed",
|
|
6030
|
+
services: node,
|
|
6031
|
+
message: `${LABEL[s]}: ${st.message === null ? "neden bildirilmedi" : st.message}`
|
|
6032
|
+
};
|
|
6033
|
+
}
|
|
6034
|
+
}
|
|
6035
|
+
if (clock.now().getTime() >= deadline || signal.aborted) {
|
|
6036
|
+
return { result: "waiting", services: node };
|
|
6037
|
+
}
|
|
6038
|
+
await clock.sleep(5e3, signal);
|
|
6039
|
+
}
|
|
6040
|
+
}
|
|
6041
|
+
var SUPABASE_PACKAGES = [
|
|
6042
|
+
"@supabase/supabase-js",
|
|
6043
|
+
"@supabase/ssr",
|
|
6044
|
+
"@supabase/auth-helpers-nextjs"
|
|
6045
|
+
];
|
|
6046
|
+
var POSTGRES_PACKAGES = [
|
|
6047
|
+
"pg",
|
|
6048
|
+
"postgres",
|
|
6049
|
+
"@prisma/client",
|
|
6050
|
+
"prisma",
|
|
6051
|
+
"drizzle-orm",
|
|
6052
|
+
"kysely",
|
|
6053
|
+
"knex",
|
|
6054
|
+
"sequelize",
|
|
6055
|
+
"typeorm",
|
|
6056
|
+
"@neondatabase/serverless"
|
|
6057
|
+
];
|
|
6058
|
+
var ENV_FILES = [".env", ".env.local", ".env.example", ".env.development"];
|
|
6059
|
+
function detectServiceNeed(cwd) {
|
|
6060
|
+
const deps = /* @__PURE__ */ new Set();
|
|
6061
|
+
let manifest;
|
|
6062
|
+
try {
|
|
6063
|
+
manifest = JSON.parse(readFileSync5(join4(cwd, "package.json"), "utf8"));
|
|
6064
|
+
} catch {
|
|
6065
|
+
manifest = void 0;
|
|
6066
|
+
}
|
|
6067
|
+
if (typeof manifest === "object" && manifest !== null) {
|
|
6068
|
+
for (const key of ["dependencies", "devDependencies"]) {
|
|
6069
|
+
const section = manifest[key];
|
|
6070
|
+
if (typeof section === "object" && section !== null) {
|
|
6071
|
+
for (const name of Object.keys(section)) deps.add(name);
|
|
6072
|
+
}
|
|
6073
|
+
}
|
|
6074
|
+
}
|
|
6075
|
+
const supabase = SUPABASE_PACKAGES.find((p) => deps.has(p));
|
|
6076
|
+
if (supabase !== void 0) {
|
|
6077
|
+
return { service: "AUTH", reason: `package.json ${supabase} kullaniyor` };
|
|
6078
|
+
}
|
|
6079
|
+
const driver = POSTGRES_PACKAGES.find((p) => deps.has(p));
|
|
6080
|
+
if (driver !== void 0) {
|
|
6081
|
+
return { service: "DATABASE", reason: `package.json ${driver} kullaniyor` };
|
|
6082
|
+
}
|
|
6083
|
+
for (const file of ENV_FILES) {
|
|
6084
|
+
let text;
|
|
6085
|
+
try {
|
|
6086
|
+
text = readFileSync5(join4(cwd, file), "utf8");
|
|
6087
|
+
} catch {
|
|
6088
|
+
continue;
|
|
6089
|
+
}
|
|
6090
|
+
if (/^\s*(export\s+)?DATABASE_URL\s*=/m.test(text)) {
|
|
6091
|
+
return { service: "DATABASE", reason: `${file} DATABASE_URL tanimliyor` };
|
|
6092
|
+
}
|
|
6093
|
+
}
|
|
6094
|
+
return { service: null, reason: "kod veritabani ya da Supabase istemcisi kullanmiyor" };
|
|
6095
|
+
}
|
|
6096
|
+
|
|
5597
6097
|
// src/cli/commands/project.ts
|
|
5598
6098
|
var CREATE_PROJECT_MUTATION = `mutation($in: CreateProjectInput!) {
|
|
5599
6099
|
createProject(input: $in) {
|
|
@@ -5959,10 +6459,10 @@ function compat2(flag) {
|
|
|
5959
6459
|
return { ...flag, compat: "go-shared-flagset" };
|
|
5960
6460
|
}
|
|
5961
6461
|
var confirmFlag = { name: "confirm", type: "string", summary: "onay", accepted: true };
|
|
5962
|
-
function rejectSubcommand(
|
|
6462
|
+
function rejectSubcommand(group2, rest) {
|
|
5963
6463
|
const first = rest[0];
|
|
5964
6464
|
if (first === void 0) return void 0;
|
|
5965
|
-
return new Error(`bilinmeyen ${
|
|
6465
|
+
return new Error(`bilinmeyen ${group2} alt komutu: ${first}`);
|
|
5966
6466
|
}
|
|
5967
6467
|
var PROJECT_COMMANDS = [
|
|
5968
6468
|
defineCommand({
|
|
@@ -6139,7 +6639,7 @@ function start(argv) {
|
|
|
6139
6639
|
if (program === void 0 || argv.length === 0) {
|
|
6140
6640
|
return Promise.resolve(new Error("auth: tarayici komutu bos"));
|
|
6141
6641
|
}
|
|
6142
|
-
return new Promise((
|
|
6642
|
+
return new Promise((resolve5) => {
|
|
6143
6643
|
const child = spawn(program, argv.slice(1), {
|
|
6144
6644
|
// The opener's own chatter must not land in the CLI's output, where it
|
|
6145
6645
|
// would read as part of the login.
|
|
@@ -6150,13 +6650,13 @@ function start(argv) {
|
|
|
6150
6650
|
child.on("error", (err) => {
|
|
6151
6651
|
if (settled2) return;
|
|
6152
6652
|
settled2 = true;
|
|
6153
|
-
|
|
6653
|
+
resolve5(new Error(`auth: tarayici acilamadi (${program}): ${err.message}`, { cause: err }));
|
|
6154
6654
|
});
|
|
6155
6655
|
child.on("spawn", () => {
|
|
6156
6656
|
if (settled2) return;
|
|
6157
6657
|
settled2 = true;
|
|
6158
6658
|
child.unref();
|
|
6159
|
-
|
|
6659
|
+
resolve5(void 0);
|
|
6160
6660
|
});
|
|
6161
6661
|
});
|
|
6162
6662
|
}
|
|
@@ -6296,7 +6796,7 @@ function readStringArray(doc, key) {
|
|
|
6296
6796
|
}
|
|
6297
6797
|
|
|
6298
6798
|
// src/cli/auth/flow.ts
|
|
6299
|
-
import { createHash, randomBytes as randomBytes3, timingSafeEqual } from "node:crypto";
|
|
6799
|
+
import { createHash as createHash2, randomBytes as randomBytes3, timingSafeEqual } from "node:crypto";
|
|
6300
6800
|
import { createServer } from "node:http";
|
|
6301
6801
|
var CALLBACK_PATH = "/callback";
|
|
6302
6802
|
var LOGIN_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
@@ -6313,7 +6813,7 @@ async function login(signal, config) {
|
|
|
6313
6813
|
}
|
|
6314
6814
|
const verifier = randomString(32);
|
|
6315
6815
|
const state = randomString(32);
|
|
6316
|
-
const challenge =
|
|
6816
|
+
const challenge = createHash2("sha256").update(verifier, "utf8").digest("base64url");
|
|
6317
6817
|
const slot = new OneSlot();
|
|
6318
6818
|
const server = createServer();
|
|
6319
6819
|
server.headersTimeout = 5e3;
|
|
@@ -6434,15 +6934,15 @@ var OneSlot = class {
|
|
|
6434
6934
|
return value;
|
|
6435
6935
|
}
|
|
6436
6936
|
if (signal.aborted) return void 0;
|
|
6437
|
-
return new Promise((
|
|
6937
|
+
return new Promise((resolve5) => {
|
|
6438
6938
|
const onAbort = () => {
|
|
6439
6939
|
this.#waiter = void 0;
|
|
6440
|
-
|
|
6940
|
+
resolve5(void 0);
|
|
6441
6941
|
};
|
|
6442
6942
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
6443
6943
|
this.#waiter = (value) => {
|
|
6444
6944
|
signal.removeEventListener("abort", onAbort);
|
|
6445
|
-
|
|
6945
|
+
resolve5(value);
|
|
6446
6946
|
};
|
|
6447
6947
|
});
|
|
6448
6948
|
}
|
|
@@ -6569,7 +7069,7 @@ function parseAuthorizeError(body) {
|
|
|
6569
7069
|
return { code, description: typeof description === "string" ? description : "" };
|
|
6570
7070
|
}
|
|
6571
7071
|
async function listenOnLoopback(server) {
|
|
6572
|
-
return new Promise((
|
|
7072
|
+
return new Promise((resolve5, reject) => {
|
|
6573
7073
|
server.once("error", (err) => {
|
|
6574
7074
|
reject(
|
|
6575
7075
|
new Error(`auth: geri donus icin yerel port acilamadi: ${err.message}`, { cause: err })
|
|
@@ -6581,7 +7081,7 @@ async function listenOnLoopback(server) {
|
|
|
6581
7081
|
reject(new Error("auth: geri donus icin yerel port acilamadi: adres okunamadi"));
|
|
6582
7082
|
return;
|
|
6583
7083
|
}
|
|
6584
|
-
|
|
7084
|
+
resolve5(address.port);
|
|
6585
7085
|
});
|
|
6586
7086
|
});
|
|
6587
7087
|
}
|
|
@@ -6731,16 +7231,16 @@ function parseDeviceAuthorization(body) {
|
|
|
6731
7231
|
return out;
|
|
6732
7232
|
}
|
|
6733
7233
|
function sleepFor(ms2, signal) {
|
|
6734
|
-
return new Promise((
|
|
7234
|
+
return new Promise((resolve5) => {
|
|
6735
7235
|
if (signal.aborted) {
|
|
6736
|
-
|
|
7236
|
+
resolve5();
|
|
6737
7237
|
return;
|
|
6738
7238
|
}
|
|
6739
7239
|
const t = setTimeout(done, ms2);
|
|
6740
7240
|
function done() {
|
|
6741
7241
|
signal.removeEventListener("abort", done);
|
|
6742
7242
|
clearTimeout(t);
|
|
6743
|
-
|
|
7243
|
+
resolve5();
|
|
6744
7244
|
}
|
|
6745
7245
|
signal.addEventListener("abort", done, { once: true });
|
|
6746
7246
|
});
|
|
@@ -6860,7 +7360,7 @@ function formatLocal(d) {
|
|
|
6860
7360
|
const p = (n) => String(n).padStart(2, "0");
|
|
6861
7361
|
return `${d.getFullYear().toString()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
|
|
6862
7362
|
}
|
|
6863
|
-
function
|
|
7363
|
+
function pad2(s, width) {
|
|
6864
7364
|
return s.length >= width ? s : s + " ".repeat(width - s.length);
|
|
6865
7365
|
}
|
|
6866
7366
|
function loginForInit(ctx, link) {
|
|
@@ -7218,7 +7718,7 @@ async function runOrg(ctx) {
|
|
|
7218
7718
|
out.print(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500 \u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
7219
7719
|
for (const o of orgs) {
|
|
7220
7720
|
const mark = boundId !== "" && o.id === boundId ? "bu organizasyona bagli" : "";
|
|
7221
|
-
out.print(` ${
|
|
7721
|
+
out.print(` ${pad2(o.slug, 20)} ${pad2(o.displayName, 30)} ${pad2(o.standing, 9)} ${mark}`);
|
|
7222
7722
|
}
|
|
7223
7723
|
if (boundId === "") {
|
|
7224
7724
|
out.print("");
|
|
@@ -7302,7 +7802,7 @@ var SESSION_COMMANDS = [
|
|
|
7302
7802
|
function deriveSlug(cwd) {
|
|
7303
7803
|
let raw = "";
|
|
7304
7804
|
try {
|
|
7305
|
-
const pkg = JSON.parse(
|
|
7805
|
+
const pkg = JSON.parse(readFileSync6(join5(cwd, "package.json"), "utf8"));
|
|
7306
7806
|
if (typeof pkg.name === "string") raw = pkg.name;
|
|
7307
7807
|
} catch {
|
|
7308
7808
|
}
|
|
@@ -7334,17 +7834,17 @@ function processEnv() {
|
|
|
7334
7834
|
cwd: process.cwd(),
|
|
7335
7835
|
platform: process.platform,
|
|
7336
7836
|
env: process.env,
|
|
7337
|
-
gitRemote: () => new Promise((
|
|
7837
|
+
gitRemote: () => new Promise((resolve5) => {
|
|
7338
7838
|
execFile("git", ["remote", "get-url", "origin"], { cwd: process.cwd() }, (err, stdout) => {
|
|
7339
|
-
|
|
7839
|
+
resolve5(err === null ? stdout.trim() : "");
|
|
7340
7840
|
});
|
|
7341
7841
|
}),
|
|
7342
|
-
sleep: (ms2, signal) => new Promise((
|
|
7842
|
+
sleep: (ms2, signal) => new Promise((resolve5) => {
|
|
7343
7843
|
const t = setTimeout(done, ms2);
|
|
7344
7844
|
function done() {
|
|
7345
7845
|
clearTimeout(t);
|
|
7346
7846
|
signal.removeEventListener("abort", done);
|
|
7347
|
-
|
|
7847
|
+
resolve5();
|
|
7348
7848
|
}
|
|
7349
7849
|
signal.addEventListener("abort", done, { once: true });
|
|
7350
7850
|
}),
|
|
@@ -7458,11 +7958,11 @@ async function awaitPayment(ctx, env, client, org, slug, checkoutUrl, openChecko
|
|
|
7458
7958
|
}
|
|
7459
7959
|
async function runInit(ctx, env) {
|
|
7460
7960
|
const { signal, out, flags, config, now } = ctx;
|
|
7461
|
-
const
|
|
7462
|
-
const waitSeconds = Number.parseInt(
|
|
7463
|
-
if (!Number.isFinite(waitSeconds) || waitSeconds < 0 || String(waitSeconds) !==
|
|
7961
|
+
const waitFlag2 = str(flags, "wait");
|
|
7962
|
+
const waitSeconds = Number.parseInt(waitFlag2, 10);
|
|
7963
|
+
if (!Number.isFinite(waitSeconds) || waitSeconds < 0 || String(waitSeconds) !== waitFlag2) {
|
|
7464
7964
|
throw new Error(
|
|
7465
|
-
`init: --wait saniye cinsinden bir tam sayi olmali, ${JSON.stringify(
|
|
7965
|
+
`init: --wait saniye cinsinden bir tam sayi olmali, ${JSON.stringify(waitFlag2)} degil`
|
|
7466
7966
|
);
|
|
7467
7967
|
}
|
|
7468
7968
|
const requested = str(flags, "project");
|
|
@@ -7543,6 +8043,36 @@ async function runInit(ctx, env) {
|
|
|
7543
8043
|
await awaitPayment(ctx, env, fresh, org, slug, checkout, !login2.performed);
|
|
7544
8044
|
c = await fresh();
|
|
7545
8045
|
}
|
|
8046
|
+
let services;
|
|
8047
|
+
const need = detectServiceNeed(env.cwd);
|
|
8048
|
+
if (bool(flags, "no-services")) {
|
|
8049
|
+
services = { initialized: false, reason: "--no-services" };
|
|
8050
|
+
} else if (need.service === null) {
|
|
8051
|
+
services = { initialized: false, reason: need.reason };
|
|
8052
|
+
out.print(`hizmet baslatilmadi: ${need.reason}`);
|
|
8053
|
+
} else {
|
|
8054
|
+
out.print(`hizmet gerekli (${need.reason})`);
|
|
8055
|
+
const command = need.service === "AUTH" ? "auth init" : "db init";
|
|
8056
|
+
const step = stepOutput(out, command);
|
|
8057
|
+
const outcome = await initializeService(signal, c, org, slug, need.service, step.sub, {
|
|
8058
|
+
now,
|
|
8059
|
+
sleep: env.sleep,
|
|
8060
|
+
waitSeconds: SERVICE_WAIT_SECONDS
|
|
8061
|
+
});
|
|
8062
|
+
step.data();
|
|
8063
|
+
if (outcome.result === "failed") {
|
|
8064
|
+
out.printError(
|
|
8065
|
+
"SERVICE_INIT_FAILED",
|
|
8066
|
+
`init: baslatilamadi \u2014 ${outcome.message}. Yeniden denemek icin: vibe ${command} --project ${slug}`
|
|
8067
|
+
);
|
|
8068
|
+
throw new Error("init: hizmet baslatilamadi");
|
|
8069
|
+
}
|
|
8070
|
+
if (outcome.result === "waiting") {
|
|
8071
|
+
out.print("hizmet hala baslatiliyor \u2014 uygulama veritabani hazir olunca baglanir");
|
|
8072
|
+
}
|
|
8073
|
+
services = { initialized: true, service: need.service, result: outcome.result };
|
|
8074
|
+
c = await fresh();
|
|
8075
|
+
}
|
|
7546
8076
|
let appCreated = false;
|
|
7547
8077
|
let before;
|
|
7548
8078
|
try {
|
|
@@ -7562,32 +8092,41 @@ async function runInit(ctx, env) {
|
|
|
7562
8092
|
);
|
|
7563
8093
|
const node = src.projectBySlug === null ? void 0 : src.projectBySlug.apps.edges[0];
|
|
7564
8094
|
let repo = node === void 0 || node.node.sourceRepo === null ? "" : node.node.sourceRepo;
|
|
8095
|
+
let upload = false;
|
|
7565
8096
|
if (repo !== "") {
|
|
7566
8097
|
out.print(`repo bagli: ${repo}`);
|
|
7567
8098
|
} else {
|
|
7568
8099
|
const flag = str(flags, "repo");
|
|
7569
8100
|
const derived = flag === "" ? httpsRemote(await env.gitRemote()) : "";
|
|
7570
8101
|
if (flag === "" && derived === "") {
|
|
7571
|
-
|
|
7572
|
-
"",
|
|
7573
|
-
"init: git reposu bulunamadi (origin uzak adresi yok) \u2014 --repo ile repo adresini verin"
|
|
7574
|
-
);
|
|
7575
|
-
throw new Error("init: --repo gerekli");
|
|
8102
|
+
upload = true;
|
|
7576
8103
|
}
|
|
7577
|
-
if (flag === "" && !derived.startsWith("https://")) {
|
|
8104
|
+
if (!upload && flag === "" && !derived.startsWith("https://")) {
|
|
7578
8105
|
out.printError(
|
|
7579
8106
|
"",
|
|
7580
8107
|
`init: origin uzak adresi HTTPS'e cevrilemedi (${derived}) \u2014 --repo ile HTTPS repo adresini verin`
|
|
7581
8108
|
);
|
|
7582
8109
|
throw new Error("init: --repo gerekli");
|
|
7583
8110
|
}
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
8111
|
+
if (upload) {
|
|
8112
|
+
if (ctx.provided.has("ref")) {
|
|
8113
|
+
out.printError("", "init: --ref bir git reposu ister; bu dizinin origin uzak adresi yok");
|
|
8114
|
+
throw new Error("init: --ref git reposu ister");
|
|
8115
|
+
}
|
|
8116
|
+
out.print("git reposu yok: bu dizin yuklenerek yayinlanacak");
|
|
8117
|
+
const step = stepOutput(out, "app create");
|
|
8118
|
+
await createUploadApp(signal, c, org, slug, step.sub);
|
|
8119
|
+
step.data();
|
|
8120
|
+
appCreated = true;
|
|
8121
|
+
} else {
|
|
8122
|
+
repo = flag === "" ? derived : flag;
|
|
8123
|
+
out.print(`repo baglaniyor: ${repo}`);
|
|
8124
|
+
const step = stepOutput(out, "app create");
|
|
8125
|
+
const branch = ctx.provided.has("ref") ? str(flags, "ref") : "";
|
|
8126
|
+
await createApp(signal, c, org, slug, repo, branch, SERVER_DEFAULT_BUILD, step.sub);
|
|
8127
|
+
step.data();
|
|
8128
|
+
appCreated = true;
|
|
8129
|
+
}
|
|
7591
8130
|
}
|
|
7592
8131
|
let mcp = { installed: false, reason: "--no-mcp" };
|
|
7593
8132
|
if (!bool(flags, "no-mcp")) {
|
|
@@ -7619,7 +8158,11 @@ async function runInit(ctx, env) {
|
|
|
7619
8158
|
out.print("yayinlaniyor...");
|
|
7620
8159
|
const step = stepOutput(out, "deploy start");
|
|
7621
8160
|
c = await fresh();
|
|
7622
|
-
|
|
8161
|
+
if (upload) {
|
|
8162
|
+
await deployDirectory(signal, c, org, slug, env.cwd, step.sub, UPLOAD_TIMEOUT_MS);
|
|
8163
|
+
} else {
|
|
8164
|
+
await deployStart(signal, c, org, slug, str(flags, "ref"), "", step.sub);
|
|
8165
|
+
}
|
|
7623
8166
|
step.data();
|
|
7624
8167
|
const app = await followDeploy(ctx, env, fresh, org, slug, before, waitSeconds);
|
|
7625
8168
|
deploy = { started: true, phase: app.phase, url: app.url, live: app.phase === "LIVE" };
|
|
@@ -7637,8 +8180,9 @@ async function runInit(ctx, env) {
|
|
|
7637
8180
|
const report = {
|
|
7638
8181
|
login: login2,
|
|
7639
8182
|
project: { slug, created, package: created ? pkg : "" },
|
|
7640
|
-
app: { repo, created: appCreated },
|
|
8183
|
+
app: { repo, created: appCreated, source: upload ? "upload" : "git" },
|
|
7641
8184
|
mcp,
|
|
8185
|
+
services,
|
|
7642
8186
|
deploy
|
|
7643
8187
|
};
|
|
7644
8188
|
emitDoc(out, report);
|
|
@@ -7685,12 +8229,18 @@ var flagsOf = [
|
|
|
7685
8229
|
literalDefault: false
|
|
7686
8230
|
},
|
|
7687
8231
|
{ name: "no-mcp", type: "boolean", summary: "MCP kurulumunu atla", literalDefault: false },
|
|
7688
|
-
{ name: "no-deploy", type: "boolean", summary: "ilk yayinlamayi atla", literalDefault: false }
|
|
8232
|
+
{ name: "no-deploy", type: "boolean", summary: "ilk yayinlamayi atla", literalDefault: false },
|
|
8233
|
+
{
|
|
8234
|
+
name: "no-services",
|
|
8235
|
+
type: "boolean",
|
|
8236
|
+
summary: "kodun kullandigi veritabani/kimlik hizmetini baslatma",
|
|
8237
|
+
literalDefault: false
|
|
8238
|
+
}
|
|
7689
8239
|
];
|
|
7690
8240
|
var INIT_COMMANDS = [
|
|
7691
8241
|
defineCommand({
|
|
7692
8242
|
path: ["init"],
|
|
7693
|
-
summary: "giris, proje, repo, MCP ve ilk yayin \u2014 tek komutta",
|
|
8243
|
+
summary: "giris, proje, hizmetler, repo, MCP ve ilk yayin \u2014 tek komutta",
|
|
7694
8244
|
note: "yeni bir proje icin --package gerekir; aboneligi baslamamis bir projede aboneligin baslatilacagi adresi yazar ve bekler; --yes ile hicbir soru sorulmaz",
|
|
7695
8245
|
kind: "runs",
|
|
7696
8246
|
listed: true,
|
|
@@ -7746,15 +8296,15 @@ var KEY_COMMANDS = [
|
|
|
7746
8296
|
];
|
|
7747
8297
|
|
|
7748
8298
|
// src/cli/commands/migrate.ts
|
|
7749
|
-
import { existsSync, readFileSync as
|
|
8299
|
+
import { existsSync, readFileSync as readFileSync17, realpathSync as realpathSync3, statSync as statSync7 } from "node:fs";
|
|
7750
8300
|
|
|
7751
8301
|
// src/cli/migrate/host/apply.ts
|
|
7752
|
-
import { readFileSync as
|
|
7753
|
-
import { basename as basename2, join as
|
|
8302
|
+
import { readFileSync as readFileSync13 } from "node:fs";
|
|
8303
|
+
import { basename as basename2, join as join13 } from "node:path";
|
|
7754
8304
|
|
|
7755
8305
|
// src/cli/migrate/host/manifest.ts
|
|
7756
|
-
import { readFileSync as
|
|
7757
|
-
import { join as
|
|
8306
|
+
import { readFileSync as readFileSync12 } from "node:fs";
|
|
8307
|
+
import { join as join12 } from "node:path";
|
|
7758
8308
|
|
|
7759
8309
|
// src/contract/apiversion.ts
|
|
7760
8310
|
var GROUP = "platform.vibecloud.tr";
|
|
@@ -7764,12 +8314,12 @@ function groupVersion() {
|
|
|
7764
8314
|
}
|
|
7765
8315
|
|
|
7766
8316
|
// src/cli/migrate/host/plan.ts
|
|
7767
|
-
import { readFileSync as
|
|
7768
|
-
import { isAbsolute, join as
|
|
8317
|
+
import { readFileSync as readFileSync11, readdirSync as readdirSync3, statSync as statSync6 } from "node:fs";
|
|
8318
|
+
import { isAbsolute, join as join11, resolve as resolve2 } from "node:path";
|
|
7769
8319
|
|
|
7770
8320
|
// src/cli/migrate/host/env.ts
|
|
7771
|
-
import { readFileSync as
|
|
7772
|
-
import { join as
|
|
8321
|
+
import { readFileSync as readFileSync8 } from "node:fs";
|
|
8322
|
+
import { join as join7 } from "node:path";
|
|
7773
8323
|
|
|
7774
8324
|
// src/cli/migrate/host/jwt.ts
|
|
7775
8325
|
var maxJWTBytes = 8192;
|
|
@@ -7780,9 +8330,9 @@ function supabaseJWTRole(raw) {
|
|
|
7780
8330
|
if (parts.length !== 3) return void 0;
|
|
7781
8331
|
const [rawHeader, rawPayload] = parts;
|
|
7782
8332
|
if (rawHeader === void 0 || rawPayload === void 0) return void 0;
|
|
7783
|
-
const
|
|
7784
|
-
if (
|
|
7785
|
-
const alg = stringClaim(
|
|
8333
|
+
const header2 = decodeJWTSegment(rawHeader);
|
|
8334
|
+
if (header2 === void 0) return void 0;
|
|
8335
|
+
const alg = stringClaim(header2, "alg");
|
|
7786
8336
|
if (alg === void 0 || alg === "") return void 0;
|
|
7787
8337
|
const payload = decodeJWTSegment(rawPayload);
|
|
7788
8338
|
if (payload === void 0) return void 0;
|
|
@@ -7809,8 +8359,8 @@ function decodeJWTSegment(seg) {
|
|
|
7809
8359
|
}
|
|
7810
8360
|
|
|
7811
8361
|
// src/cli/migrate/host/sourcescan.ts
|
|
7812
|
-
import { readFileSync as
|
|
7813
|
-
import { join as
|
|
8362
|
+
import { readFileSync as readFileSync7, readdirSync, statSync as statSync3 } from "node:fs";
|
|
8363
|
+
import { join as join6, posix as posix2 } from "node:path";
|
|
7814
8364
|
var skipDirs = /* @__PURE__ */ new Set([
|
|
7815
8365
|
"node_modules",
|
|
7816
8366
|
".next",
|
|
@@ -7923,7 +8473,7 @@ async function scanSources(dir, kind) {
|
|
|
7923
8473
|
const files = walkSources(dir);
|
|
7924
8474
|
const fileSet = new Set(files);
|
|
7925
8475
|
for (const rel of files) {
|
|
7926
|
-
const path =
|
|
8476
|
+
const path = join6(dir, rel);
|
|
7927
8477
|
let size;
|
|
7928
8478
|
try {
|
|
7929
8479
|
size = statSync3(path).size;
|
|
@@ -7933,7 +8483,7 @@ async function scanSources(dir, kind) {
|
|
|
7933
8483
|
if (size > maxScanFileBytes) continue;
|
|
7934
8484
|
let raw;
|
|
7935
8485
|
try {
|
|
7936
|
-
raw =
|
|
8486
|
+
raw = readFileSync7(path);
|
|
7937
8487
|
} catch (cause) {
|
|
7938
8488
|
throw new Error(`migrate: ${path} okunamadi: ${describeCause2(cause)}`);
|
|
7939
8489
|
}
|
|
@@ -8160,13 +8710,13 @@ function scanOneSource(rel, src, mask, code, scan2, add, kind) {
|
|
|
8160
8710
|
});
|
|
8161
8711
|
}
|
|
8162
8712
|
for (const m of vercelHeaderMatches(mask, code)) {
|
|
8163
|
-
const
|
|
8713
|
+
const header2 = m.group.toLowerCase();
|
|
8164
8714
|
add("vercel istek basligi", {
|
|
8165
8715
|
class: "manual",
|
|
8166
|
-
subject: `${
|
|
8716
|
+
subject: `${header2} istek basligi`,
|
|
8167
8717
|
path: rel,
|
|
8168
8718
|
line: lineOf(mask, m.start),
|
|
8169
|
-
detail: `${
|
|
8719
|
+
detail: `${header2} basligini yalnizca Vercel'in kenar agi ekler; Vercel disinda istekte bulunmaz ve okuma null (ya da undefined) doner \u2014 bu degere bagli davranis tasima sonrasi degisir`,
|
|
8170
8720
|
action: "degerin yoklugunu kodda ele alin; ulke/sehir gerekiyorsa baska bir kaynaktan (orn. IP tabanli cografi konum veritabani) alin, istemci IP icin standart bir basliga gecmeden once platformda o basligin geldigini dogrulayin",
|
|
8171
8721
|
code: "",
|
|
8172
8722
|
blocks: false
|
|
@@ -8219,7 +8769,7 @@ function packageDepFindings(pkg, seen) {
|
|
|
8219
8769
|
}
|
|
8220
8770
|
function middlewareFindings(ts, dir) {
|
|
8221
8771
|
for (const p of ["middleware.ts", "middleware.js", "src/middleware.ts", "src/middleware.js"]) {
|
|
8222
|
-
if (!fileExists(
|
|
8772
|
+
if (!fileExists(join6(dir, p))) continue;
|
|
8223
8773
|
const reads = vercelHeaderReads(ts, dir, p);
|
|
8224
8774
|
if (reads.length > 0) {
|
|
8225
8775
|
return [
|
|
@@ -8260,7 +8810,7 @@ function staticServerFindings(dir, files) {
|
|
|
8260
8810
|
);
|
|
8261
8811
|
}
|
|
8262
8812
|
for (const p of ["middleware.ts", "middleware.js"]) {
|
|
8263
|
-
if (!fileExists(
|
|
8813
|
+
if (!fileExists(join6(dir, p))) continue;
|
|
8264
8814
|
out.push(
|
|
8265
8815
|
finding({
|
|
8266
8816
|
class: "unsupported",
|
|
@@ -8275,10 +8825,10 @@ function staticServerFindings(dir, files) {
|
|
|
8275
8825
|
return out;
|
|
8276
8826
|
}
|
|
8277
8827
|
function vercelHeaderReads(ts, dir, rel) {
|
|
8278
|
-
const path =
|
|
8828
|
+
const path = join6(dir, rel);
|
|
8279
8829
|
let src;
|
|
8280
8830
|
try {
|
|
8281
|
-
src =
|
|
8831
|
+
src = readFileSync7(path, "utf8");
|
|
8282
8832
|
} catch (cause) {
|
|
8283
8833
|
throw new Error(`migrate: ${path} okunamadi: ${describeCause2(cause)}`);
|
|
8284
8834
|
}
|
|
@@ -8307,7 +8857,7 @@ function recordImports(rel, mask, code, files, graph) {
|
|
|
8307
8857
|
function resolveLocal(rel, spec, files) {
|
|
8308
8858
|
let bases;
|
|
8309
8859
|
if (spec.startsWith("./") || spec.startsWith("../")) {
|
|
8310
|
-
bases = [
|
|
8860
|
+
bases = [posix2.normalize(posix2.join(posix2.dirname(rel), spec))];
|
|
8311
8861
|
} else if (spec.startsWith("@/") || spec.startsWith("~/")) {
|
|
8312
8862
|
bases = [spec.slice(2), `src/${spec.slice(2)}`];
|
|
8313
8863
|
} else {
|
|
@@ -8442,7 +8992,7 @@ function isrBuildDatabaseFinding(r, via) {
|
|
|
8442
8992
|
});
|
|
8443
8993
|
}
|
|
8444
8994
|
function vercelIgnoreFinding(dir) {
|
|
8445
|
-
if (!fileExists(
|
|
8995
|
+
if (!fileExists(join6(dir, ".vercelignore"))) return void 0;
|
|
8446
8996
|
return finding({
|
|
8447
8997
|
class: "manual",
|
|
8448
8998
|
subject: ".vercelignore",
|
|
@@ -8454,7 +9004,7 @@ function vercelIgnoreFinding(dir) {
|
|
|
8454
9004
|
function walkSources(root) {
|
|
8455
9005
|
const out = [];
|
|
8456
9006
|
const descend = (relDir) => {
|
|
8457
|
-
const abs = relDir === "" ? root :
|
|
9007
|
+
const abs = relDir === "" ? root : join6(root, relDir);
|
|
8458
9008
|
let entries3;
|
|
8459
9009
|
try {
|
|
8460
9010
|
entries3 = readdirSync(abs, { withFileTypes: true }).map((e) => ({
|
|
@@ -8748,10 +9298,10 @@ function scanEnv(dir, fromVercelJSON, publicPrefix) {
|
|
|
8748
9298
|
return v;
|
|
8749
9299
|
};
|
|
8750
9300
|
for (const { file: f, environment: environment2, example } of envFiles) {
|
|
8751
|
-
const path =
|
|
9301
|
+
const path = join7(dir, f);
|
|
8752
9302
|
let raw;
|
|
8753
9303
|
try {
|
|
8754
|
-
raw =
|
|
9304
|
+
raw = readFileSync8(path, "utf8");
|
|
8755
9305
|
} catch (cause) {
|
|
8756
9306
|
if (isNotFound2(cause)) continue;
|
|
8757
9307
|
throw new Error(
|
|
@@ -9168,7 +9718,7 @@ function isNotFound2(err) {
|
|
|
9168
9718
|
|
|
9169
9719
|
// src/cli/migrate/host/kind.ts
|
|
9170
9720
|
import { readdirSync as readdirSync2, statSync as statSync4 } from "node:fs";
|
|
9171
|
-
import { join as
|
|
9721
|
+
import { join as join8 } from "node:path";
|
|
9172
9722
|
|
|
9173
9723
|
// src/contract/framework.ts
|
|
9174
9724
|
var SUPPORTED_NEXT_MAJORS = [15, 16];
|
|
@@ -9428,7 +9978,7 @@ function detectKind(dir, pkg) {
|
|
|
9428
9978
|
}
|
|
9429
9979
|
function hasRootIndex(dir) {
|
|
9430
9980
|
try {
|
|
9431
|
-
statSync4(
|
|
9981
|
+
statSync4(join8(dir, "index.html"));
|
|
9432
9982
|
return true;
|
|
9433
9983
|
} catch (cause) {
|
|
9434
9984
|
if (!isNotFound3(cause)) {
|
|
@@ -9444,8 +9994,8 @@ function isNotFound3(err) {
|
|
|
9444
9994
|
}
|
|
9445
9995
|
|
|
9446
9996
|
// src/cli/migrate/host/nextconfig.ts
|
|
9447
|
-
import { readFileSync as
|
|
9448
|
-
import { join as
|
|
9997
|
+
import { readFileSync as readFileSync9, statSync as statSync5 } from "node:fs";
|
|
9998
|
+
import { join as join9 } from "node:path";
|
|
9449
9999
|
var nextConfigNames = ["next.config.js", "next.config.mjs", "next.config.cjs", "next.config.ts"];
|
|
9450
10000
|
var generatedNextConfig = `// vibecloud: bu dosya tasima sirasinda olusturuldu.
|
|
9451
10001
|
// output: 'standalone' derleme sirasinda platform tarafindan da zorlanir; burada
|
|
@@ -9457,7 +10007,7 @@ export default {
|
|
|
9457
10007
|
var outputInsertion = "\n output: 'standalone', // vibecloud: dec. 36";
|
|
9458
10008
|
async function scanNextConfig(dir) {
|
|
9459
10009
|
const scan2 = { findings: [], rewrites: [] };
|
|
9460
|
-
const present = nextConfigNames.filter((name2) => fileExists2(
|
|
10010
|
+
const present = nextConfigNames.filter((name2) => fileExists2(join9(dir, name2)));
|
|
9461
10011
|
if (present.length === 0) {
|
|
9462
10012
|
scan2.findings.push(
|
|
9463
10013
|
finding({
|
|
@@ -9490,10 +10040,10 @@ async function scanNextConfig(dir) {
|
|
|
9490
10040
|
}
|
|
9491
10041
|
const name = present[0];
|
|
9492
10042
|
if (name === void 0) throw new Error("migrate: next.config adi cozumlenemedi");
|
|
9493
|
-
const path =
|
|
10043
|
+
const path = join9(dir, name);
|
|
9494
10044
|
let src;
|
|
9495
10045
|
try {
|
|
9496
|
-
src =
|
|
10046
|
+
src = readFileSync9(path, "utf8");
|
|
9497
10047
|
} catch (cause) {
|
|
9498
10048
|
throw new Error(
|
|
9499
10049
|
`migrate: ${name} okunamadi: ${cause instanceof Error ? cause.message : String(cause)}`
|
|
@@ -9840,8 +10390,8 @@ function fileExists2(path) {
|
|
|
9840
10390
|
}
|
|
9841
10391
|
|
|
9842
10392
|
// src/cli/migrate/host/verceljson.ts
|
|
9843
|
-
import { readFileSync as
|
|
9844
|
-
import { join as
|
|
10393
|
+
import { readFileSync as readFileSync10 } from "node:fs";
|
|
10394
|
+
import { join as join10 } from "node:path";
|
|
9845
10395
|
|
|
9846
10396
|
// src/cli/migrate/host/nextrouting.ts
|
|
9847
10397
|
function emptyRouting() {
|
|
@@ -10073,10 +10623,10 @@ function scanVercelJSON(dir, kind) {
|
|
|
10073
10623
|
env: /* @__PURE__ */ new Map(),
|
|
10074
10624
|
routingSnippet: ""
|
|
10075
10625
|
};
|
|
10076
|
-
const path =
|
|
10626
|
+
const path = join10(dir, "vercel.json");
|
|
10077
10627
|
let raw;
|
|
10078
10628
|
try {
|
|
10079
|
-
raw =
|
|
10629
|
+
raw = readFileSync10(path, "utf8");
|
|
10080
10630
|
} catch (cause) {
|
|
10081
10631
|
if (isNotFound4(cause)) return scan2;
|
|
10082
10632
|
throw new Error(
|
|
@@ -10292,17 +10842,17 @@ function staticRouting(scan2, cfg) {
|
|
|
10292
10842
|
})
|
|
10293
10843
|
);
|
|
10294
10844
|
}
|
|
10295
|
-
const
|
|
10296
|
-
if (cfg.trailingSlash !== void 0)
|
|
10297
|
-
if (cfg.cleanUrls !== void 0)
|
|
10298
|
-
if (cfg.hasImages)
|
|
10299
|
-
if (
|
|
10845
|
+
const ignored2 = [];
|
|
10846
|
+
if (cfg.trailingSlash !== void 0) ignored2.push(`trailingSlash: ${String(cfg.trailingSlash)}`);
|
|
10847
|
+
if (cfg.cleanUrls !== void 0) ignored2.push(`cleanUrls: ${String(cfg.cleanUrls)}`);
|
|
10848
|
+
if (cfg.hasImages) ignored2.push("images");
|
|
10849
|
+
if (ignored2.length > 0) {
|
|
10300
10850
|
scan2.findings.push(
|
|
10301
10851
|
finding({
|
|
10302
10852
|
class: "manual",
|
|
10303
10853
|
subject: "vercel.json: yayin ayarlari",
|
|
10304
10854
|
path: "vercel.json",
|
|
10305
|
-
detail: `${
|
|
10855
|
+
detail: `${ignored2.join(", ")} statik yayinda okunmaz \u2014 dosyalar derleme ciktisindaki adlariyla sunulur, goruntu optimizasyonu yoktur`,
|
|
10306
10856
|
action: "bu ayarlara dayanan baglanti ve goruntu adreslerini dogrulayin"
|
|
10307
10857
|
})
|
|
10308
10858
|
);
|
|
@@ -10528,7 +11078,7 @@ async function planMigration(projectDir) {
|
|
|
10528
11078
|
}
|
|
10529
11079
|
let abs;
|
|
10530
11080
|
try {
|
|
10531
|
-
abs = isAbsolute(projectDir) ? projectDir :
|
|
11081
|
+
abs = isAbsolute(projectDir) ? projectDir : resolve2(projectDir);
|
|
10532
11082
|
} catch (cause) {
|
|
10533
11083
|
throw new Error(`migrate: proje dizini cozumlenemedi: ${describe5(cause)}`);
|
|
10534
11084
|
}
|
|
@@ -10641,7 +11191,7 @@ function viteOutDirFindings(dir) {
|
|
|
10641
11191
|
for (const name of ["vite.config.ts", "vite.config.mts", "vite.config.js", "vite.config.mjs"]) {
|
|
10642
11192
|
let src;
|
|
10643
11193
|
try {
|
|
10644
|
-
src =
|
|
11194
|
+
src = readFileSync11(join11(dir, name), "utf8");
|
|
10645
11195
|
} catch (cause) {
|
|
10646
11196
|
if (cause instanceof Error && "code" in cause && cause.code === "ENOENT") continue;
|
|
10647
11197
|
throw new Error(`migrate: ${name} okunamadi: ${describe5(cause)}`);
|
|
@@ -10695,10 +11245,10 @@ function sortFindings(f) {
|
|
|
10695
11245
|
});
|
|
10696
11246
|
}
|
|
10697
11247
|
function readPackageJSON(dir) {
|
|
10698
|
-
const path =
|
|
11248
|
+
const path = join11(dir, "package.json");
|
|
10699
11249
|
let raw;
|
|
10700
11250
|
try {
|
|
10701
|
-
raw =
|
|
11251
|
+
raw = readFileSync11(path, "utf8");
|
|
10702
11252
|
} catch (cause) {
|
|
10703
11253
|
throw new Error(`migrate: package.json okunamadi: ${describe5(cause)}`);
|
|
10704
11254
|
}
|
|
@@ -10750,7 +11300,7 @@ function detectPackageManager(dir) {
|
|
|
10750
11300
|
["bun.lockb", "bun"],
|
|
10751
11301
|
["package-lock.json", "npm"]
|
|
10752
11302
|
]) {
|
|
10753
|
-
if (exists(
|
|
11303
|
+
if (exists(join11(dir, file))) return name;
|
|
10754
11304
|
}
|
|
10755
11305
|
return "";
|
|
10756
11306
|
}
|
|
@@ -10791,18 +11341,18 @@ function packageManagerFinding(pm) {
|
|
|
10791
11341
|
function detectMonorepo(dir, pkg) {
|
|
10792
11342
|
if (pkg.hasWorkspaces) return "package.json workspaces";
|
|
10793
11343
|
for (const f of ["pnpm-workspace.yaml", "pnpm-workspace.yml", "lerna.json"]) {
|
|
10794
|
-
if (exists(
|
|
11344
|
+
if (exists(join11(dir, f))) return f;
|
|
10795
11345
|
}
|
|
10796
11346
|
for (const d of ["apps", "packages"]) {
|
|
10797
11347
|
let nested;
|
|
10798
11348
|
try {
|
|
10799
|
-
nested = readdirSync3(
|
|
11349
|
+
nested = readdirSync3(join11(dir, d), { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
|
|
10800
11350
|
} catch {
|
|
10801
11351
|
continue;
|
|
10802
11352
|
}
|
|
10803
11353
|
nested.sort(compareGoStrings);
|
|
10804
11354
|
for (const name of nested) {
|
|
10805
|
-
if (exists(
|
|
11355
|
+
if (exists(join11(dir, d, name, "package.json"))) return `${d}/${name}/package.json`;
|
|
10806
11356
|
}
|
|
10807
11357
|
}
|
|
10808
11358
|
return "";
|
|
@@ -10951,7 +11501,7 @@ function buildManifest(pkg, vercelCfg, plan) {
|
|
|
10951
11501
|
}
|
|
10952
11502
|
function declaredNodeVersion(dir, pkg) {
|
|
10953
11503
|
try {
|
|
10954
|
-
const raw =
|
|
11504
|
+
const raw = readFileSync12(join12(dir, ".nvmrc"), "utf8");
|
|
10955
11505
|
let v = raw.trim();
|
|
10956
11506
|
if (v.startsWith("v")) v = v.slice(1);
|
|
10957
11507
|
v = v.trim();
|
|
@@ -11027,7 +11577,7 @@ function gitRemote(dir) {
|
|
|
11027
11577
|
let repo = "";
|
|
11028
11578
|
let branch = "";
|
|
11029
11579
|
try {
|
|
11030
|
-
const data =
|
|
11580
|
+
const data = readFileSync12(join12(dir, ".git", "config"), "utf8");
|
|
11031
11581
|
let inOrigin = false;
|
|
11032
11582
|
for (const line of data.split("\n")) {
|
|
11033
11583
|
const trimmed = line.trim();
|
|
@@ -11043,7 +11593,7 @@ function gitRemote(dir) {
|
|
|
11043
11593
|
} catch {
|
|
11044
11594
|
}
|
|
11045
11595
|
try {
|
|
11046
|
-
const head =
|
|
11596
|
+
const head = readFileSync12(join12(dir, ".git", "HEAD"), "utf8").trim();
|
|
11047
11597
|
const prefix = "ref: refs/heads/";
|
|
11048
11598
|
if (head.startsWith(prefix)) branch = head.slice(prefix.length);
|
|
11049
11599
|
} catch {
|
|
@@ -11401,9 +11951,9 @@ function applyMigration2(plan, appName, projectUID, at) {
|
|
|
11401
11951
|
const stale = verifyRewrite(plan.projectDir, r);
|
|
11402
11952
|
if (stale !== void 0) return { error: stale };
|
|
11403
11953
|
}
|
|
11404
|
-
const foreignReport = verifyOwnFile(
|
|
11954
|
+
const foreignReport = verifyOwnFile(join13(plan.projectDir, ReportFileName), ReportMarker);
|
|
11405
11955
|
if (foreignReport !== void 0) return { error: foreignReport };
|
|
11406
|
-
const foreignManifest = verifyOwnFile(
|
|
11956
|
+
const foreignManifest = verifyOwnFile(join13(plan.projectDir, ManifestFileName), manifestMarker);
|
|
11407
11957
|
if (foreignManifest !== void 0) return { error: foreignManifest };
|
|
11408
11958
|
const result = {
|
|
11409
11959
|
written: [],
|
|
@@ -11411,7 +11961,7 @@ function applyMigration2(plan, appName, projectUID, at) {
|
|
|
11411
11961
|
manifestPath: ManifestFileName
|
|
11412
11962
|
};
|
|
11413
11963
|
for (const r of plan.rewrites) {
|
|
11414
|
-
const target =
|
|
11964
|
+
const target = join13(plan.projectDir, r.path);
|
|
11415
11965
|
const failed2 = writeFileAtomic(target, r.after, existingMode(target));
|
|
11416
11966
|
if (failed2 !== void 0) {
|
|
11417
11967
|
return {
|
|
@@ -11424,9 +11974,9 @@ function applyMigration2(plan, appName, projectUID, at) {
|
|
|
11424
11974
|
result.written.push(r.path);
|
|
11425
11975
|
}
|
|
11426
11976
|
const manifestFailed = writeFileAtomic(
|
|
11427
|
-
|
|
11977
|
+
join13(plan.projectDir, ManifestFileName),
|
|
11428
11978
|
rendered.yaml,
|
|
11429
|
-
existingMode(
|
|
11979
|
+
existingMode(join13(plan.projectDir, ManifestFileName))
|
|
11430
11980
|
);
|
|
11431
11981
|
if (manifestFailed !== void 0) {
|
|
11432
11982
|
return {
|
|
@@ -11436,9 +11986,9 @@ function applyMigration2(plan, appName, projectUID, at) {
|
|
|
11436
11986
|
}
|
|
11437
11987
|
result.written.push(ManifestFileName);
|
|
11438
11988
|
const reportFailed = writeFileAtomic(
|
|
11439
|
-
|
|
11989
|
+
join13(plan.projectDir, ReportFileName),
|
|
11440
11990
|
report,
|
|
11441
|
-
existingMode(
|
|
11991
|
+
existingMode(join13(plan.projectDir, ReportFileName))
|
|
11442
11992
|
);
|
|
11443
11993
|
if (reportFailed !== void 0) {
|
|
11444
11994
|
return {
|
|
@@ -11461,11 +12011,11 @@ function writeReportFile(path, content) {
|
|
|
11461
12011
|
return void 0;
|
|
11462
12012
|
}
|
|
11463
12013
|
function verifyRewrite(dir, r) {
|
|
11464
|
-
const path =
|
|
12014
|
+
const path = join13(dir, r.path);
|
|
11465
12015
|
let current;
|
|
11466
12016
|
let readErr;
|
|
11467
12017
|
try {
|
|
11468
|
-
current =
|
|
12018
|
+
current = readFileSync13(path, "utf8");
|
|
11469
12019
|
} catch (cause) {
|
|
11470
12020
|
readErr = cause;
|
|
11471
12021
|
}
|
|
@@ -11488,7 +12038,7 @@ function verifyRewrite(dir, r) {
|
|
|
11488
12038
|
function verifyOwnFile(path, marker) {
|
|
11489
12039
|
let data;
|
|
11490
12040
|
try {
|
|
11491
|
-
data =
|
|
12041
|
+
data = readFileSync13(path, "utf8");
|
|
11492
12042
|
} catch (cause) {
|
|
11493
12043
|
if (isNotFound(cause)) return void 0;
|
|
11494
12044
|
return new Error(`migrate: ${basename2(path)} okunamadi: ${describe3(cause)}`);
|
|
@@ -11503,7 +12053,7 @@ function verifyOwnFile(path, marker) {
|
|
|
11503
12053
|
|
|
11504
12054
|
// src/cli/migrate/supabase/dumprestore.ts
|
|
11505
12055
|
import { spawn as spawn2 } from "node:child_process";
|
|
11506
|
-
var runCommand = (bin, args, env, signal) => new Promise((
|
|
12056
|
+
var runCommand = (bin, args, env, signal) => new Promise((resolve5, reject) => {
|
|
11507
12057
|
const child = spawn2(bin, [...args], {
|
|
11508
12058
|
shell: false,
|
|
11509
12059
|
stdio: ["ignore", "ignore", "pipe"],
|
|
@@ -11525,12 +12075,12 @@ var runCommand = (bin, args, env, signal) => new Promise((resolve4, reject) => {
|
|
|
11525
12075
|
}
|
|
11526
12076
|
reject(err);
|
|
11527
12077
|
});
|
|
11528
|
-
child.on("close", (code) =>
|
|
12078
|
+
child.on("close", (code) => resolve5({ code: code === null ? -1 : code, stderr }));
|
|
11529
12079
|
});
|
|
11530
|
-
var commandExists = (bin, signal) => new Promise((
|
|
12080
|
+
var commandExists = (bin, signal) => new Promise((resolve5) => {
|
|
11531
12081
|
const child = spawn2(bin, ["--version"], { shell: false, stdio: "ignore", signal });
|
|
11532
|
-
child.on("error", () =>
|
|
11533
|
-
child.on("close", () =>
|
|
12082
|
+
child.on("error", () => resolve5(false));
|
|
12083
|
+
child.on("close", () => resolve5(true));
|
|
11534
12084
|
});
|
|
11535
12085
|
function stripPassword(dsn) {
|
|
11536
12086
|
let u;
|
|
@@ -15885,7 +16435,7 @@ var netlifyHTTP = async (url, init) => {
|
|
|
15885
16435
|
};
|
|
15886
16436
|
|
|
15887
16437
|
// src/cli/migrate/netlify/config.ts
|
|
15888
|
-
import { posix as
|
|
16438
|
+
import { posix as posix3 } from "node:path";
|
|
15889
16439
|
function parseNetlifyTOML(text) {
|
|
15890
16440
|
const tables = [];
|
|
15891
16441
|
let current = { path: "", array: false, entries: /* @__PURE__ */ new Map() };
|
|
@@ -16139,7 +16689,7 @@ function netlifyFunctionDirectories(toml, uiFunctionsDir, base) {
|
|
|
16139
16689
|
edgeFunctions = toml.build.edgeFunctions;
|
|
16140
16690
|
}
|
|
16141
16691
|
const relative3 = (path) => path.replace(/^\/+/, "");
|
|
16142
|
-
const under = (path) =>
|
|
16692
|
+
const under = (path) => posix3.join(base === null ? "" : relative3(base), relative3(path)).replace(/\/+$/, "");
|
|
16143
16693
|
return { functions: under(functions), edgeFunctions: under(edgeFunctions) };
|
|
16144
16694
|
}
|
|
16145
16695
|
function parseRedirectsFile(text) {
|
|
@@ -17055,8 +17605,8 @@ function renderPlan4(plan) {
|
|
|
17055
17605
|
}
|
|
17056
17606
|
|
|
17057
17607
|
// src/cli/migrate/netlify/checkout.ts
|
|
17058
|
-
import { lstatSync, readFileSync as
|
|
17059
|
-
import { isAbsolute as isAbsolute2, join as
|
|
17608
|
+
import { lstatSync, readFileSync as readFileSync14, readdirSync as readdirSync4, realpathSync as realpathSync2 } from "node:fs";
|
|
17609
|
+
import { isAbsolute as isAbsolute2, join as join14, posix as posix4, relative, sep } from "node:path";
|
|
17060
17610
|
var functionExts = [".ts", ".mts", ".cts", ".js", ".mjs", ".cjs", ".tsx", ".jsx"];
|
|
17061
17611
|
var formExts = /* @__PURE__ */ new Set([".tsx", ".jsx", ".ts", ".js", ".mjs", ".html", ".htm"]);
|
|
17062
17612
|
var formRoots = ["app", "pages", "src", "public"];
|
|
@@ -17070,15 +17620,15 @@ async function scanNetlifyCheckout(dir, dirs) {
|
|
|
17070
17620
|
functions: functionFiles(ts, dir, functionsDir),
|
|
17071
17621
|
edgeFunctions: functionFiles(ts, dir, edgeFunctionsDir),
|
|
17072
17622
|
forms: netlifyForms(dir),
|
|
17073
|
-
packageJSON: readOptional(
|
|
17623
|
+
packageJSON: readOptional(join14(dir, "package.json"))
|
|
17074
17624
|
};
|
|
17075
17625
|
}
|
|
17076
17626
|
function insideCheckout(dir, configured, key) {
|
|
17077
|
-
const rel =
|
|
17627
|
+
const rel = posix4.normalize(configured).replace(/\/+$/, "");
|
|
17078
17628
|
const outside = (r) => r === ".." || r.startsWith(`..${sep}`) || isAbsolute2(r);
|
|
17079
17629
|
if (outside(rel))
|
|
17080
17630
|
throw new Error(`migrate netlify: ${key} dizini repo kopyasinin disinda: ${configured}`);
|
|
17081
|
-
const target = realpathOptional(
|
|
17631
|
+
const target = realpathOptional(join14(dir, rel));
|
|
17082
17632
|
if (target === null) return rel;
|
|
17083
17633
|
const real = relative(realpathSync2(dir), target);
|
|
17084
17634
|
if (outside(real))
|
|
@@ -17088,12 +17638,12 @@ function insideCheckout(dir, configured, key) {
|
|
|
17088
17638
|
return real === "" ? "." : real.split(sep).join("/");
|
|
17089
17639
|
}
|
|
17090
17640
|
function functionFiles(ts, dir, rel) {
|
|
17091
|
-
const entries3 = listDir(
|
|
17641
|
+
const entries3 = listDir(join14(dir, rel));
|
|
17092
17642
|
if (entries3 === null) return [];
|
|
17093
17643
|
const out = [];
|
|
17094
17644
|
for (const e of entries3) {
|
|
17095
17645
|
if (e.isDir) {
|
|
17096
|
-
const main2 = [e.name, "index"].flatMap((base) => functionExts.map((ext2) => `${base}${ext2}`)).find((f) => isRegularFile(
|
|
17646
|
+
const main2 = [e.name, "index"].flatMap((base) => functionExts.map((ext2) => `${base}${ext2}`)).find((f) => isRegularFile(join14(dir, rel, e.name, f)));
|
|
17097
17647
|
if (main2 === void 0) continue;
|
|
17098
17648
|
const path2 = `${rel}/${e.name}/${main2}`;
|
|
17099
17649
|
out.push({ name: e.name, path: path2, configPaths: configPaths(ts, dir, path2) });
|
|
@@ -17114,7 +17664,7 @@ var reConfigExport = /export\s+const\s+config\b[^=]*=\s*\{([\s\S]*?)\}\s*(?:sati
|
|
|
17114
17664
|
var reConfigPath = /\bpath\s*:\s*(\[[^\]]*\]|(['"`])[^'"`]*\2)/;
|
|
17115
17665
|
var reQuoted = /(['"`])([^'"`]*)\1/g;
|
|
17116
17666
|
function configPaths(ts, dir, rel) {
|
|
17117
|
-
const src = readSource(
|
|
17667
|
+
const src = readSource(join14(dir, rel));
|
|
17118
17668
|
if (src === null) return [];
|
|
17119
17669
|
const cfg = reConfigExport.exec(maskSource(ts, rel, src).mask);
|
|
17120
17670
|
if (cfg === null || cfg[1] === void 0) return [];
|
|
@@ -17130,7 +17680,7 @@ function netlifyForms(dir) {
|
|
|
17130
17680
|
const out = [];
|
|
17131
17681
|
for (const root of formRoots) {
|
|
17132
17682
|
for (const rel of walk(dir, root)) {
|
|
17133
|
-
const src = readSource(
|
|
17683
|
+
const src = readSource(join14(dir, rel));
|
|
17134
17684
|
if (src === null) continue;
|
|
17135
17685
|
reFormTag.lastIndex = 0;
|
|
17136
17686
|
for (const m of src.matchAll(reFormTag)) {
|
|
@@ -17144,7 +17694,7 @@ function netlifyForms(dir) {
|
|
|
17144
17694
|
return out;
|
|
17145
17695
|
}
|
|
17146
17696
|
function walk(dir, rel) {
|
|
17147
|
-
const entries3 = listDir(
|
|
17697
|
+
const entries3 = listDir(join14(dir, rel));
|
|
17148
17698
|
if (entries3 === null) return [];
|
|
17149
17699
|
const out = [];
|
|
17150
17700
|
for (const e of entries3) {
|
|
@@ -17195,7 +17745,7 @@ function lstatOptional(path) {
|
|
|
17195
17745
|
}
|
|
17196
17746
|
function readOptional(path) {
|
|
17197
17747
|
try {
|
|
17198
|
-
return
|
|
17748
|
+
return readFileSync14(path, "utf8");
|
|
17199
17749
|
} catch (cause) {
|
|
17200
17750
|
if (isMissing(cause)) return null;
|
|
17201
17751
|
throw new Error(`migrate netlify: ${path} okunamadi: ${describe7(cause)}`, { cause });
|
|
@@ -19371,7 +19921,7 @@ function parseServiceAccount(text) {
|
|
|
19371
19921
|
}
|
|
19372
19922
|
var b64url = (b) => (typeof b === "string" ? Buffer.from(b, "utf8") : b).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
19373
19923
|
function signAssertion(sa, nowSeconds) {
|
|
19374
|
-
const
|
|
19924
|
+
const header2 = b64url(JSON.stringify({ alg: "RS256", typ: "JWT" }));
|
|
19375
19925
|
const claims = b64url(
|
|
19376
19926
|
JSON.stringify({
|
|
19377
19927
|
iss: sa.clientEmail,
|
|
@@ -19382,9 +19932,9 @@ function signAssertion(sa, nowSeconds) {
|
|
|
19382
19932
|
})
|
|
19383
19933
|
);
|
|
19384
19934
|
const signer = createSign("RSA-SHA256");
|
|
19385
|
-
signer.update(`${
|
|
19935
|
+
signer.update(`${header2}.${claims}`);
|
|
19386
19936
|
const sig = b64url(signer.sign(sa.privateKey));
|
|
19387
|
-
return `${
|
|
19937
|
+
return `${header2}.${claims}.${sig}`;
|
|
19388
19938
|
}
|
|
19389
19939
|
var googleHTTP = async (url, init) => {
|
|
19390
19940
|
const req = { method: init.method, headers: init.headers, signal: init.signal };
|
|
@@ -19452,7 +20002,7 @@ async function googleJSON(c, method, url, what, signal, body) {
|
|
|
19452
20002
|
}
|
|
19453
20003
|
|
|
19454
20004
|
// src/cli/migrate/firebase/auth.ts
|
|
19455
|
-
import { createHash as
|
|
20005
|
+
import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypto";
|
|
19456
20006
|
var nz2 = (v) => v === void 0 || v === "" ? null : v;
|
|
19457
20007
|
var ms = (v) => {
|
|
19458
20008
|
if (v === void 0 || v === "") return null;
|
|
@@ -19573,7 +20123,7 @@ function fbscryptHash(cfg, passwordHash, salt) {
|
|
|
19573
20123
|
var FIREBASE_UID_NAMESPACE = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
|
|
19574
20124
|
function deriveUserID(uid) {
|
|
19575
20125
|
const ns = Buffer.from(FIREBASE_UID_NAMESPACE.replace(/-/g, ""), "hex");
|
|
19576
|
-
const h =
|
|
20126
|
+
const h = createHash3("sha1").update(ns).update(uid, "utf8").digest();
|
|
19577
20127
|
const b = Buffer.from(h.subarray(0, 16));
|
|
19578
20128
|
b[6] = b[6] & 15 | 80;
|
|
19579
20129
|
b[8] = b[8] & 63 | 128;
|
|
@@ -20560,8 +21110,8 @@ function planStorage(buckets, projectId) {
|
|
|
20560
21110
|
}
|
|
20561
21111
|
|
|
20562
21112
|
// src/cli/migrate/firebase/clientscan.ts
|
|
20563
|
-
import { readFileSync as
|
|
20564
|
-
import { join as
|
|
21113
|
+
import { readFileSync as readFileSync15 } from "node:fs";
|
|
21114
|
+
import { join as join15 } from "node:path";
|
|
20565
21115
|
var surfaces = [
|
|
20566
21116
|
{
|
|
20567
21117
|
re: /^firebase\/auth$|^@firebase\/auth/,
|
|
@@ -20621,7 +21171,7 @@ function scanClient(dir) {
|
|
|
20621
21171
|
for (const rel of walkSources(dir)) {
|
|
20622
21172
|
let src;
|
|
20623
21173
|
try {
|
|
20624
|
-
src =
|
|
21174
|
+
src = readFileSync15(join15(dir, rel), "utf8");
|
|
20625
21175
|
} catch {
|
|
20626
21176
|
continue;
|
|
20627
21177
|
}
|
|
@@ -20641,7 +21191,7 @@ function scanClient(dir) {
|
|
|
20641
21191
|
}
|
|
20642
21192
|
const exists2 = (p) => {
|
|
20643
21193
|
try {
|
|
20644
|
-
|
|
21194
|
+
readFileSync15(join15(dir, p));
|
|
20645
21195
|
return true;
|
|
20646
21196
|
} catch {
|
|
20647
21197
|
return false;
|
|
@@ -20651,7 +21201,7 @@ function scanClient(dir) {
|
|
|
20651
21201
|
let cloudFunctions = false;
|
|
20652
21202
|
if (firebaseJSON) {
|
|
20653
21203
|
try {
|
|
20654
|
-
const j = JSON.parse(
|
|
21204
|
+
const j = JSON.parse(readFileSync15(join15(dir, "firebase.json"), "utf8"));
|
|
20655
21205
|
cloudFunctions = j["functions"] !== void 0;
|
|
20656
21206
|
} catch {
|
|
20657
21207
|
cloudFunctions = false;
|
|
@@ -20916,9 +21466,9 @@ async function runFirebaseApply(deps, params, signal) {
|
|
|
20916
21466
|
|
|
20917
21467
|
// src/cli/migrate/supabase/pgclient.ts
|
|
20918
21468
|
import { spawn as spawn3 } from "node:child_process";
|
|
20919
|
-
import { createHash as
|
|
20920
|
-
import { chmodSync as chmodSync2, mkdirSync as mkdirSync4, readFileSync as
|
|
20921
|
-
import { join as
|
|
21469
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
21470
|
+
import { chmodSync as chmodSync2, mkdirSync as mkdirSync4, readFileSync as readFileSync16, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "node:fs";
|
|
21471
|
+
import { join as join16 } from "node:path";
|
|
20922
21472
|
var DEFAULT_PG_CLIENT_MIRROR = "https://dl.vibecloud.tr/pg-client";
|
|
20923
21473
|
var PATH_TOOLS = { pgDump: "pg_dump", pgRestore: "pg_restore" };
|
|
20924
21474
|
function platformKey(platform, arch) {
|
|
@@ -20950,13 +21500,13 @@ function planFetch(manifest, key) {
|
|
|
20950
21500
|
return new Error(`migrate: paket bildiriminde ${key} icin bir kayit yok`);
|
|
20951
21501
|
}
|
|
20952
21502
|
function sha256Hex(bytes) {
|
|
20953
|
-
return
|
|
21503
|
+
return createHash4("sha256").update(bytes).digest("hex");
|
|
20954
21504
|
}
|
|
20955
21505
|
function toolPaths(cacheDir, key) {
|
|
20956
21506
|
const ext = key.startsWith("windows") ? ".exe" : "";
|
|
20957
21507
|
return {
|
|
20958
|
-
pgDump:
|
|
20959
|
-
pgRestore:
|
|
21508
|
+
pgDump: join16(cacheDir, "bin", `pg_dump${ext}`),
|
|
21509
|
+
pgRestore: join16(cacheDir, "bin", `pg_restore${ext}`)
|
|
20960
21510
|
};
|
|
20961
21511
|
}
|
|
20962
21512
|
async function fetchPgClient(deps, opts) {
|
|
@@ -20976,7 +21526,7 @@ async function fetchPgClient(deps, opts) {
|
|
|
20976
21526
|
const plan = planFetch(manifest, opts.key);
|
|
20977
21527
|
if (plan instanceof Error) throw plan;
|
|
20978
21528
|
const tools = toolPaths(opts.cacheDir, opts.key);
|
|
20979
|
-
const stampPath =
|
|
21529
|
+
const stampPath = join16(opts.cacheDir, `${opts.key}.sha256`);
|
|
20980
21530
|
if (deps.readText(stampPath).trim() === plan.sha256) return tools;
|
|
20981
21531
|
const artifactRes = await deps.http(`${opts.mirror}/${plan.artifact}`, {
|
|
20982
21532
|
method: "GET",
|
|
@@ -20998,7 +21548,7 @@ async function fetchPgClient(deps, opts) {
|
|
|
20998
21548
|
);
|
|
20999
21549
|
}
|
|
21000
21550
|
deps.mkdirPrivate(opts.cacheDir);
|
|
21001
|
-
const archive =
|
|
21551
|
+
const archive = join16(opts.cacheDir, `${opts.key}.tar.gz`);
|
|
21002
21552
|
deps.writeFile(archive, bytes);
|
|
21003
21553
|
await deps.extract(archive, opts.cacheDir, opts.signal);
|
|
21004
21554
|
deps.chmodExec(tools.pgDump);
|
|
@@ -21019,12 +21569,12 @@ function realFetchDeps(http) {
|
|
|
21019
21569
|
},
|
|
21020
21570
|
readText: (path) => {
|
|
21021
21571
|
try {
|
|
21022
|
-
return
|
|
21572
|
+
return readFileSync16(path, "utf8");
|
|
21023
21573
|
} catch {
|
|
21024
21574
|
return "";
|
|
21025
21575
|
}
|
|
21026
21576
|
},
|
|
21027
|
-
extract: (archive, dir, signal) => new Promise((
|
|
21577
|
+
extract: (archive, dir, signal) => new Promise((resolve5, reject) => {
|
|
21028
21578
|
const child = spawn3("tar", ["-xzf", archive, "-C", dir], {
|
|
21029
21579
|
shell: false,
|
|
21030
21580
|
stdio: ["ignore", "ignore", "pipe"],
|
|
@@ -21044,7 +21594,7 @@ function realFetchDeps(http) {
|
|
|
21044
21594
|
reject(err);
|
|
21045
21595
|
});
|
|
21046
21596
|
child.on("close", (code) => {
|
|
21047
|
-
if (code === 0)
|
|
21597
|
+
if (code === 0) resolve5();
|
|
21048
21598
|
else
|
|
21049
21599
|
reject(
|
|
21050
21600
|
new Error(
|
|
@@ -21063,7 +21613,7 @@ function realFetchDeps(http) {
|
|
|
21063
21613
|
}
|
|
21064
21614
|
|
|
21065
21615
|
// src/cli/migrate/supabase/report.ts
|
|
21066
|
-
import { readFile, stat, writeFile } from "node:fs/promises";
|
|
21616
|
+
import { readFile as readFile2, stat, writeFile } from "node:fs/promises";
|
|
21067
21617
|
import { dirname as dirname4 } from "node:path";
|
|
21068
21618
|
|
|
21069
21619
|
// src/cli/migrate/supabase/restore.ts
|
|
@@ -21377,7 +21927,7 @@ async function writeReportFile2(signal, path, report) {
|
|
|
21377
21927
|
}
|
|
21378
21928
|
let existing;
|
|
21379
21929
|
try {
|
|
21380
|
-
existing = await
|
|
21930
|
+
existing = await readFile2(path, { encoding: "utf8", signal });
|
|
21381
21931
|
} catch (err) {
|
|
21382
21932
|
if (!isNotFound5(err)) {
|
|
21383
21933
|
throw new Error(`migrate: ${path} okunamadi: ${describe6(err)}`, { cause: err });
|
|
@@ -21412,7 +21962,7 @@ function isNotFound5(err) {
|
|
|
21412
21962
|
import { createInterface } from "node:readline/promises";
|
|
21413
21963
|
import { writeFileSync as writeFileSync4 } from "node:fs";
|
|
21414
21964
|
import { tmpdir } from "node:os";
|
|
21415
|
-
import { dirname as dirname5, isAbsolute as isAbsolute3, join as
|
|
21965
|
+
import { dirname as dirname5, isAbsolute as isAbsolute3, join as join17, relative as relative2, resolve as resolve3, sep as sep2 } from "node:path";
|
|
21416
21966
|
var ENDPOINTS_QUERY = `query($id: ID!) {
|
|
21417
21967
|
project(id: $id) {
|
|
21418
21968
|
endpoints {
|
|
@@ -21909,16 +22459,16 @@ async function migrateNetlify(ctx) {
|
|
|
21909
22459
|
);
|
|
21910
22460
|
const readOptional2 = (name) => {
|
|
21911
22461
|
if (dir === "") return null;
|
|
21912
|
-
const path =
|
|
21913
|
-
return existsSync(path) ?
|
|
22462
|
+
const path = join17(dir, name);
|
|
22463
|
+
return existsSync(path) ? readFileSync17(path, "utf8") : null;
|
|
21914
22464
|
};
|
|
21915
22465
|
const c = await apiClient(ctx.signal, ctx.config, ctx.now, out);
|
|
21916
22466
|
const org = await orgFor(ctx.signal, c, str(flags, "org"), out);
|
|
21917
22467
|
const { projectSlug } = await selectTargetProject(ctx, c, org);
|
|
21918
|
-
const publicDir = dir === "" ? "" :
|
|
22468
|
+
const publicDir = dir === "" ? "" : join17(dir, "public");
|
|
21919
22469
|
const fromPublic = (name) => {
|
|
21920
|
-
if (publicDir === "" || !existsSync(
|
|
21921
|
-
return
|
|
22470
|
+
if (publicDir === "" || !existsSync(join17(publicDir, name))) return readOptional2(name);
|
|
22471
|
+
return readFileSync17(join17(publicDir, name), "utf8");
|
|
21922
22472
|
};
|
|
21923
22473
|
const netlifyTOML = readOptional2("netlify.toml");
|
|
21924
22474
|
let toml = null;
|
|
@@ -22010,12 +22560,12 @@ async function migrateNetlifyOffline(ctx, dir) {
|
|
|
22010
22560
|
const { out } = ctx;
|
|
22011
22561
|
if (!isDirectory(dir)) throw new Error(`migrate netlify: --dir ${dir} bir dizin degil`);
|
|
22012
22562
|
const readOptional2 = (name) => {
|
|
22013
|
-
const path =
|
|
22014
|
-
return existsSync(path) ?
|
|
22563
|
+
const path = join17(dir, name);
|
|
22564
|
+
return existsSync(path) ? readFileSync17(path, "utf8") : null;
|
|
22015
22565
|
};
|
|
22016
22566
|
const fromPublic = (name) => {
|
|
22017
|
-
const path =
|
|
22018
|
-
return existsSync(path) ?
|
|
22567
|
+
const path = join17(dir, "public", name);
|
|
22568
|
+
return existsSync(path) ? readFileSync17(path, "utf8") : readOptional2(name);
|
|
22019
22569
|
};
|
|
22020
22570
|
const netlifyTOML = readOptional2("netlify.toml");
|
|
22021
22571
|
let toml = null;
|
|
@@ -22184,7 +22734,7 @@ async function migrateFirebase(ctx) {
|
|
|
22184
22734
|
);
|
|
22185
22735
|
let keyText;
|
|
22186
22736
|
try {
|
|
22187
|
-
keyText =
|
|
22737
|
+
keyText = readFileSync17(keyPath, "utf8");
|
|
22188
22738
|
} catch (e) {
|
|
22189
22739
|
throw new Error(
|
|
22190
22740
|
`migrate firebase: servis hesabi anahtari okunamadi (${keyPath}): ${e instanceof Error ? e.message : String(e)}`
|
|
@@ -22202,7 +22752,7 @@ async function migrateFirebase(ctx) {
|
|
|
22202
22752
|
if (hashPath !== "") {
|
|
22203
22753
|
let text;
|
|
22204
22754
|
try {
|
|
22205
|
-
text =
|
|
22755
|
+
text = readFileSync17(hashPath, "utf8");
|
|
22206
22756
|
} catch (e) {
|
|
22207
22757
|
throw new Error(
|
|
22208
22758
|
`migrate firebase: --hash-params okunamadi: ${e instanceof Error ? e.message : String(e)}`
|
|
@@ -22316,7 +22866,7 @@ async function migrateFirebase(ctx) {
|
|
|
22316
22866
|
},
|
|
22317
22867
|
connectTarget: async (cred, dsn, caPath, signal) => {
|
|
22318
22868
|
const pg = await loadPg();
|
|
22319
|
-
const ssl = caPath === "" ? void 0 : { ca:
|
|
22869
|
+
const ssl = caPath === "" ? void 0 : { ca: readFileSync17(caPath, "utf8"), rejectUnauthorized: true };
|
|
22320
22870
|
const client2 = ssl === void 0 ? new pg.Client({
|
|
22321
22871
|
connectionString: withPassword(dsn, cred.password),
|
|
22322
22872
|
connectionTimeoutMillis: 15e3
|
|
@@ -22461,7 +23011,7 @@ async function resolveImportTools(ctx) {
|
|
|
22461
23011
|
out.print(`pg_dump/pg_restore indiriliyor: ${mirror} (${key}) \u2014 sha256 dogrulanacak`);
|
|
22462
23012
|
return fetchPgClient(realFetchDeps(httpClient), {
|
|
22463
23013
|
mirror,
|
|
22464
|
-
cacheDir:
|
|
23014
|
+
cacheDir: join17(dirname5(ctx.config.tokenFile), "bin"),
|
|
22465
23015
|
key,
|
|
22466
23016
|
signal: ctx.signal
|
|
22467
23017
|
});
|
|
@@ -22488,7 +23038,7 @@ async function selectTargetProject(ctx, c, org) {
|
|
|
22488
23038
|
return { projectId: chosen.uid, projectSlug: chosen.slug };
|
|
22489
23039
|
}
|
|
22490
23040
|
function targetDeps(ctx, c, projectId, source) {
|
|
22491
|
-
const caPath =
|
|
23041
|
+
const caPath = join17(tmpdir(), `vibe-migrate-${projectId}-ca.pem`);
|
|
22492
23042
|
let mintOperationID = "";
|
|
22493
23043
|
return {
|
|
22494
23044
|
run: runCommand,
|
|
@@ -22572,8 +23122,8 @@ async function migrateHeroku(ctx) {
|
|
|
22572
23122
|
);
|
|
22573
23123
|
const readOptional2 = (name) => {
|
|
22574
23124
|
if (dir === "") return null;
|
|
22575
|
-
const path =
|
|
22576
|
-
return existsSync(path) ?
|
|
23125
|
+
const path = join17(dir, name);
|
|
23126
|
+
return existsSync(path) ? readFileSync17(path, "utf8") : null;
|
|
22577
23127
|
};
|
|
22578
23128
|
const c = await apiClient(ctx.signal, ctx.config, ctx.now, out);
|
|
22579
23129
|
const org = await orgFor(ctx.signal, c, str(flags, "org"), out);
|
|
@@ -22631,7 +23181,7 @@ async function migrateHeroku(ctx) {
|
|
|
22631
23181
|
{
|
|
22632
23182
|
sourceDSN: accepted.dsn,
|
|
22633
23183
|
excludeExtensions: exclude,
|
|
22634
|
-
dumpFile:
|
|
23184
|
+
dumpFile: join17(tmpdir(), `vibe-migrate-${projectId}.dump`),
|
|
22635
23185
|
tools
|
|
22636
23186
|
},
|
|
22637
23187
|
ctx.signal
|
|
@@ -22695,8 +23245,8 @@ async function migrateRailway(ctx) {
|
|
|
22695
23245
|
);
|
|
22696
23246
|
const readOptional2 = (name) => {
|
|
22697
23247
|
if (dir === "") return null;
|
|
22698
|
-
const path =
|
|
22699
|
-
return existsSync(path) ?
|
|
23248
|
+
const path = join17(dir, name);
|
|
23249
|
+
return existsSync(path) ? readFileSync17(path, "utf8") : null;
|
|
22700
23250
|
};
|
|
22701
23251
|
const c = await apiClient(ctx.signal, ctx.config, ctx.now, out);
|
|
22702
23252
|
const org = await orgFor(ctx.signal, c, str(flags, "org"), out);
|
|
@@ -22706,7 +23256,7 @@ async function migrateRailway(ctx) {
|
|
|
22706
23256
|
appService: str(flags, "service"),
|
|
22707
23257
|
railwayJSON: readOptional2("railway.json"),
|
|
22708
23258
|
railwayTOML: readOptional2("railway.toml"),
|
|
22709
|
-
hasDockerfile: dir === "" ? null : existsSync(
|
|
23259
|
+
hasDockerfile: dir === "" ? null : existsSync(join17(dir, "Dockerfile")),
|
|
22710
23260
|
targetSlug: projectSlug
|
|
22711
23261
|
});
|
|
22712
23262
|
if (plan instanceof Error) throw plan;
|
|
@@ -22759,7 +23309,7 @@ async function migrateRailway(ctx) {
|
|
|
22759
23309
|
{
|
|
22760
23310
|
sourceDSN: accepted.dsn,
|
|
22761
23311
|
excludeExtensions: exclude,
|
|
22762
|
-
dumpFile:
|
|
23312
|
+
dumpFile: join17(tmpdir(), `vibe-migrate-${projectId}.dump`),
|
|
22763
23313
|
tools
|
|
22764
23314
|
},
|
|
22765
23315
|
ctx.signal
|
|
@@ -22817,7 +23367,7 @@ async function migratePlain(ctx, source) {
|
|
|
22817
23367
|
let datasource;
|
|
22818
23368
|
const schemaPath = source === "prisma" ? str(flags, "schema") : "";
|
|
22819
23369
|
if (schemaPath !== "") {
|
|
22820
|
-
const parsed = parsePrismaDatasource(
|
|
23370
|
+
const parsed = parsePrismaDatasource(readFileSync17(schemaPath, "utf8"));
|
|
22821
23371
|
if (parsed instanceof Error)
|
|
22822
23372
|
throw new Error(`migrate prisma: --schema ${schemaPath}: ${parsed.message}`);
|
|
22823
23373
|
datasource = parsed;
|
|
@@ -22889,7 +23439,7 @@ async function migratePlain(ctx, source) {
|
|
|
22889
23439
|
const c = await apiClient(ctx.signal, ctx.config, ctx.now, out);
|
|
22890
23440
|
const org = await orgFor(ctx.signal, c, str(flags, "org"), out);
|
|
22891
23441
|
const { projectId, projectSlug } = await selectTargetProject(ctx, c, org);
|
|
22892
|
-
const dumpFile =
|
|
23442
|
+
const dumpFile = join17(tmpdir(), `vibe-migrate-${projectId}.dump`);
|
|
22893
23443
|
const deps = targetDeps(ctx, c, projectId, source === "neon" ? "NEON" : "PRISMA");
|
|
22894
23444
|
try {
|
|
22895
23445
|
const result = await runPostgresApply(
|
|
@@ -22963,8 +23513,8 @@ async function migrateSupabase(ctx) {
|
|
|
22963
23513
|
const c = await apiClient(ctx.signal, ctx.config, ctx.now, out);
|
|
22964
23514
|
const org = await orgFor(ctx.signal, c, str(flags, "org"), out);
|
|
22965
23515
|
const { projectId, projectSlug } = await selectTargetProject(ctx, c, org);
|
|
22966
|
-
const dumpFile =
|
|
22967
|
-
const listFile =
|
|
23516
|
+
const dumpFile = join17(tmpdir(), `vibe-migrate-${projectId}.dump`);
|
|
23517
|
+
const listFile = join17(tmpdir(), `vibe-migrate-${projectId}.list`);
|
|
22968
23518
|
const target = targetDeps(ctx, c, projectId, "SUPABASE");
|
|
22969
23519
|
const deps = {
|
|
22970
23520
|
...target,
|
|
@@ -22984,7 +23534,7 @@ async function migrateSupabase(ctx) {
|
|
|
22984
23534
|
await src.close(signal2);
|
|
22985
23535
|
}
|
|
22986
23536
|
},
|
|
22987
|
-
readText: (path) =>
|
|
23537
|
+
readText: (path) => readFileSync17(path, "utf8"),
|
|
22988
23538
|
writeText: (path, text) => {
|
|
22989
23539
|
writeFileSync4(path, text, { mode: 384 });
|
|
22990
23540
|
},
|
|
@@ -23011,7 +23561,7 @@ async function migrateSupabase(ctx) {
|
|
|
23011
23561
|
}) : new pg.Client({
|
|
23012
23562
|
connectionString: withPassword(dsn2, cred.password),
|
|
23013
23563
|
connectionTimeoutMillis: 15e3,
|
|
23014
|
-
ssl: { ca:
|
|
23564
|
+
ssl: { ca: readFileSync17(caPath, "utf8"), rejectUnauthorized: true }
|
|
23015
23565
|
});
|
|
23016
23566
|
const onAbort = () => {
|
|
23017
23567
|
void client.end().catch(() => void 0);
|
|
@@ -23096,7 +23646,7 @@ async function migrateSupabase(ctx) {
|
|
|
23096
23646
|
throw cause;
|
|
23097
23647
|
}
|
|
23098
23648
|
if (reportPath !== "") {
|
|
23099
|
-
if (existsSync(reportPath) &&
|
|
23649
|
+
if (existsSync(reportPath) && readFileSync17(reportPath, "utf8").startsWith(reportMarker)) {
|
|
23100
23650
|
throw new Error(
|
|
23101
23651
|
`migrate: ${reportPath} veritabani raporu \u2014 uygulama raporunu baska bir dosyaya yazin (orn. uygulama.md)`
|
|
23102
23652
|
);
|
|
@@ -23131,7 +23681,7 @@ async function migrateSupabase(ctx) {
|
|
|
23131
23681
|
throw cause;
|
|
23132
23682
|
}
|
|
23133
23683
|
if (reportPath !== "") {
|
|
23134
|
-
if (existsSync(reportPath) &&
|
|
23684
|
+
if (existsSync(reportPath) && readFileSync17(reportPath, "utf8").startsWith(ReportMarker)) {
|
|
23135
23685
|
throw new Error(
|
|
23136
23686
|
`migrate: ${reportPath} uygulama raporu \u2014 veritabani raporunu baska bir dosyaya yazin (orn. veritabani.md)`
|
|
23137
23687
|
);
|
|
@@ -23167,20 +23717,20 @@ function refuseOutsideCheckout(dir, path, label) {
|
|
|
23167
23717
|
}
|
|
23168
23718
|
function readCloudflareRoutingFile(dir, subs, name) {
|
|
23169
23719
|
for (const sub of subs) {
|
|
23170
|
-
const path = sub === "" ?
|
|
23720
|
+
const path = sub === "" ? join17(dir, name) : join17(dir, sub, name);
|
|
23171
23721
|
if (!existsSync(path)) continue;
|
|
23172
23722
|
refuseOutsideCheckout(dir, path, sub === "" ? name : `${sub}/${name}`);
|
|
23173
|
-
return
|
|
23723
|
+
return readFileSync17(path, "utf8");
|
|
23174
23724
|
}
|
|
23175
23725
|
return null;
|
|
23176
23726
|
}
|
|
23177
23727
|
function cloudflareCheckout(dir) {
|
|
23178
|
-
refuseOutsideCheckout(dir,
|
|
23728
|
+
refuseOutsideCheckout(dir, join17(dir, "package.json"), "package.json");
|
|
23179
23729
|
return {
|
|
23180
|
-
hasFunctionsDir: existsSync(
|
|
23181
|
-
hasWorkerFile: existsSync(
|
|
23182
|
-
hasWranglerConfig: WRANGLER_FILE_NAMES.some((n) => existsSync(
|
|
23183
|
-
packageJSON: existsSync(
|
|
23730
|
+
hasFunctionsDir: existsSync(join17(dir, "functions")),
|
|
23731
|
+
hasWorkerFile: existsSync(join17(dir, "_worker.js")),
|
|
23732
|
+
hasWranglerConfig: WRANGLER_FILE_NAMES.some((n) => existsSync(join17(dir, n))),
|
|
23733
|
+
packageJSON: existsSync(join17(dir, "package.json")) ? readFileSync17(join17(dir, "package.json"), "utf8") : null
|
|
23184
23734
|
};
|
|
23185
23735
|
}
|
|
23186
23736
|
async function migrateCloudflareOffline(ctx, dir) {
|
|
@@ -23195,7 +23745,7 @@ async function migrateCloudflareOffline(ctx, dir) {
|
|
|
23195
23745
|
"migrate cloudflare --scan --dir: --config-only yalnizca --pages-project ile anlamlidir \u2014 repo kopyasi taramasi Cloudflare'a ve hedef projeye bakmaz"
|
|
23196
23746
|
);
|
|
23197
23747
|
if (!isDirectory(dir)) throw new Error(`migrate cloudflare: --dir ${dir} bir dizin degil`);
|
|
23198
|
-
const present = WRANGLER_FILE_NAMES.filter((n) => existsSync(
|
|
23748
|
+
const present = WRANGLER_FILE_NAMES.filter((n) => existsSync(join17(dir, n)));
|
|
23199
23749
|
if (present.length > 1)
|
|
23200
23750
|
throw new Error(
|
|
23201
23751
|
`migrate cloudflare: repo kopyasinda birden fazla wrangler yapilandirmasi: ${present.join(", ")} \u2014 hangisinin gecerli oldugu tahmin edilmez; birini birakin`
|
|
@@ -23203,8 +23753,8 @@ async function migrateCloudflareOffline(ctx, dir) {
|
|
|
23203
23753
|
const wranglerFile = present[0];
|
|
23204
23754
|
let wrangler = null;
|
|
23205
23755
|
if (wranglerFile !== void 0) {
|
|
23206
|
-
refuseOutsideCheckout(dir,
|
|
23207
|
-
const text =
|
|
23756
|
+
refuseOutsideCheckout(dir, join17(dir, wranglerFile), wranglerFile);
|
|
23757
|
+
const text = readFileSync17(join17(dir, wranglerFile), "utf8");
|
|
23208
23758
|
const parsed = wranglerFile === "wrangler.jsonc" ? await readWranglerJSONC(text) : readWranglerConfig(wranglerFile, text);
|
|
23209
23759
|
if (parsed instanceof Error) throw parsed;
|
|
23210
23760
|
wrangler = parsed;
|
|
@@ -23212,8 +23762,8 @@ async function migrateCloudflareOffline(ctx, dir) {
|
|
|
23212
23762
|
const subs = [...cloudflareSourceDirs];
|
|
23213
23763
|
const outputDir = wrangler !== null && wrangler.forPages ? wrangler.pagesBuildOutputDir : null;
|
|
23214
23764
|
if (outputDir !== null) {
|
|
23215
|
-
const root =
|
|
23216
|
-
const abs =
|
|
23765
|
+
const root = resolve3(dir);
|
|
23766
|
+
const abs = resolve3(root, outputDir);
|
|
23217
23767
|
if (abs !== root && !abs.startsWith(root + sep2))
|
|
23218
23768
|
throw new Error(
|
|
23219
23769
|
`migrate cloudflare: ${wrangler === null ? "" : wrangler.file} pages_build_output_dir "${outputDir}" repo kopyasinin disina cikiyor`
|
|
@@ -23801,6 +24351,101 @@ var MIGRATE_COMMANDS = [
|
|
|
23801
24351
|
})
|
|
23802
24352
|
];
|
|
23803
24353
|
|
|
24354
|
+
// src/cli/commands/service.ts
|
|
24355
|
+
var orgFlag4 = {
|
|
24356
|
+
name: "org",
|
|
24357
|
+
type: "string",
|
|
24358
|
+
summary: "organizasyon adi",
|
|
24359
|
+
defaultFrom: "config.organization"
|
|
24360
|
+
};
|
|
24361
|
+
var projectFlag4 = { name: "project", type: "string", summary: "proje adi (slug)" };
|
|
24362
|
+
var waitFlag = {
|
|
24363
|
+
name: "wait",
|
|
24364
|
+
type: "string",
|
|
24365
|
+
summary: "baslatmayi izleme suresi, saniye",
|
|
24366
|
+
literalDefault: String(SERVICE_WAIT_SECONDS)
|
|
24367
|
+
};
|
|
24368
|
+
function waitSecondsOf(command, raw) {
|
|
24369
|
+
const n = Number.parseInt(raw, 10);
|
|
24370
|
+
if (!Number.isFinite(n) || n < 0 || String(n) !== raw) {
|
|
24371
|
+
throw new Error(
|
|
24372
|
+
`${command}: --wait saniye cinsinden bir tam sayi olmali, ${JSON.stringify(raw)} degil`
|
|
24373
|
+
);
|
|
24374
|
+
}
|
|
24375
|
+
return n;
|
|
24376
|
+
}
|
|
24377
|
+
function reportOutcome(out, command, projectSlug, outcome) {
|
|
24378
|
+
switch (outcome.result) {
|
|
24379
|
+
case "ready":
|
|
24380
|
+
out.print("hazir");
|
|
24381
|
+
emitDoc(out, { project: projectSlug, result: outcome.result, services: outcome.services });
|
|
24382
|
+
return 0;
|
|
24383
|
+
case "failed":
|
|
24384
|
+
out.printError(
|
|
24385
|
+
"SERVICE_INIT_FAILED",
|
|
24386
|
+
`baslatilamadi \u2014 ${outcome.message}. Yeniden denemek icin: vibe ${command} --project ${projectSlug}`
|
|
24387
|
+
);
|
|
24388
|
+
return 1;
|
|
24389
|
+
case "waiting":
|
|
24390
|
+
out.print("baslatma suruyor \u2014 bekleme suresi doldu, REDDEDILMEDI");
|
|
24391
|
+
out.print(` ilerleme icin: vibe project status --project ${projectSlug}`);
|
|
24392
|
+
emitDoc(out, { project: projectSlug, result: outcome.result, services: outcome.services });
|
|
24393
|
+
return 0;
|
|
24394
|
+
}
|
|
24395
|
+
}
|
|
24396
|
+
function initCommand(group2, service, summary) {
|
|
24397
|
+
const command = `${group2} init`;
|
|
24398
|
+
return defineCommand({
|
|
24399
|
+
path: [group2, "init"],
|
|
24400
|
+
summary,
|
|
24401
|
+
kind: "runs",
|
|
24402
|
+
listed: true,
|
|
24403
|
+
flags: [orgFlag4, projectFlag4, waitFlag],
|
|
24404
|
+
run: async (ctx) => {
|
|
24405
|
+
const { signal, out, flags, config, now } = ctx;
|
|
24406
|
+
const waitSeconds = waitSecondsOf(command, str(flags, "wait"));
|
|
24407
|
+
const projectSlug = str(flags, "project");
|
|
24408
|
+
if (projectSlug === "") throw new Error(`${command}: --project gerekli`);
|
|
24409
|
+
const c = await apiClient(signal, config, now, out);
|
|
24410
|
+
const org = await orgFor(signal, c, str(flags, "org"), out);
|
|
24411
|
+
const outcome = await initializeService(signal, c, org, projectSlug, service, out, {
|
|
24412
|
+
now,
|
|
24413
|
+
sleep: (ms2, s) => delay(s, ms2),
|
|
24414
|
+
waitSeconds
|
|
24415
|
+
});
|
|
24416
|
+
return reportOutcome(out, command, projectSlug, outcome);
|
|
24417
|
+
},
|
|
24418
|
+
coverage: [
|
|
24419
|
+
{ argv: [group2, "init"], ok: false },
|
|
24420
|
+
{ argv: [group2, "init", "--project", "crm", "--wait", "sonsuz"], ok: false }
|
|
24421
|
+
]
|
|
24422
|
+
});
|
|
24423
|
+
}
|
|
24424
|
+
function group(name, subcommands) {
|
|
24425
|
+
return defineCommand({
|
|
24426
|
+
path: [name],
|
|
24427
|
+
summary: `${name} (${subcommands})`,
|
|
24428
|
+
kind: "runs",
|
|
24429
|
+
listed: false,
|
|
24430
|
+
flags: [],
|
|
24431
|
+
run: ({ rest }) => {
|
|
24432
|
+
const first = rest[0];
|
|
24433
|
+
if (first === void 0) {
|
|
24434
|
+
return Promise.reject(new Error(`${name} alt komutu gerekli: ${subcommands}`));
|
|
24435
|
+
}
|
|
24436
|
+
return Promise.reject(new Error(`bilinmeyen ${name} alt komutu: ${first}`));
|
|
24437
|
+
},
|
|
24438
|
+
coverage: [{ argv: [name], ok: false }]
|
|
24439
|
+
});
|
|
24440
|
+
}
|
|
24441
|
+
var SERVICE_COMMANDS = [
|
|
24442
|
+
initCommand("db", "DATABASE", "veritabanini baslat (ilk kez; kapasite burada ayrilir)"),
|
|
24443
|
+
initCommand("auth", "AUTH", "kimlik hizmetini baslat (veritabani ve REST API ile)"),
|
|
24444
|
+
initCommand("storage", "STORAGE", "depolama hizmetini baslat (veritabani ve REST API ile)"),
|
|
24445
|
+
group("auth", "init"),
|
|
24446
|
+
group("storage", "init")
|
|
24447
|
+
];
|
|
24448
|
+
|
|
23804
24449
|
// src/cli/commands/token.ts
|
|
23805
24450
|
var tokensQuery = `query($first: Int!) {
|
|
23806
24451
|
tokens(first: $first) {
|
|
@@ -24241,7 +24886,7 @@ async function orgUsage(signal, c, org, out) {
|
|
|
24241
24886
|
}
|
|
24242
24887
|
}
|
|
24243
24888
|
}
|
|
24244
|
-
var
|
|
24889
|
+
var orgFlag5 = {
|
|
24245
24890
|
name: "org",
|
|
24246
24891
|
type: "string",
|
|
24247
24892
|
summary: "organizasyon adi",
|
|
@@ -24253,7 +24898,7 @@ var USAGE_COMMANDS = [
|
|
|
24253
24898
|
summary: "kullanim ve kotalar (organizasyon geneli ve proje bazinda)",
|
|
24254
24899
|
kind: "runs",
|
|
24255
24900
|
listed: true,
|
|
24256
|
-
flags: [
|
|
24901
|
+
flags: [orgFlag5],
|
|
24257
24902
|
run: async ({ signal, out, flags, rest, config, now }) => {
|
|
24258
24903
|
const stray = rest[0];
|
|
24259
24904
|
if (stray !== void 0) {
|
|
@@ -24274,7 +24919,7 @@ var USAGE_COMMANDS = [
|
|
|
24274
24919
|
function runVersion(ctx) {
|
|
24275
24920
|
const { out } = ctx;
|
|
24276
24921
|
emitDoc(out, {
|
|
24277
|
-
version: "0.0
|
|
24922
|
+
version: "0.1.0",
|
|
24278
24923
|
package: "@vibecloudtr/cli",
|
|
24279
24924
|
node: process.versions.node,
|
|
24280
24925
|
platform: process.platform,
|
|
@@ -24282,7 +24927,7 @@ function runVersion(ctx) {
|
|
|
24282
24927
|
apiGroup: GROUP,
|
|
24283
24928
|
apiVersion: VERSION
|
|
24284
24929
|
});
|
|
24285
|
-
out.print(`vibe ${"0.0
|
|
24930
|
+
out.print(`vibe ${"0.1.0"}`);
|
|
24286
24931
|
out.print(` node ${process.versions.node} \xB7 ${process.platform}/${process.arch}`);
|
|
24287
24932
|
out.print(` CRD apiVersion: ${GROUP}/${VERSION}`);
|
|
24288
24933
|
return Promise.resolve(0);
|
|
@@ -24306,6 +24951,7 @@ var COMMANDS = [
|
|
|
24306
24951
|
...PROJECT_COMMANDS,
|
|
24307
24952
|
...USAGE_COMMANDS,
|
|
24308
24953
|
...DB_COMMANDS,
|
|
24954
|
+
...SERVICE_COMMANDS,
|
|
24309
24955
|
...APP_COMMANDS,
|
|
24310
24956
|
...DEPLOY_COMMANDS,
|
|
24311
24957
|
...DOMAIN_COMMANDS,
|
|
@@ -24323,7 +24969,7 @@ var COMMANDS = [
|
|
|
24323
24969
|
|
|
24324
24970
|
// src/cli/config.ts
|
|
24325
24971
|
import { homedir as homedir3 } from "node:os";
|
|
24326
|
-
import { isAbsolute as isAbsolute4, join as
|
|
24972
|
+
import { isAbsolute as isAbsolute4, join as join18, dirname as dirname6 } from "node:path";
|
|
24327
24973
|
import { mkdirSync as mkdirSync5 } from "node:fs";
|
|
24328
24974
|
var DEFAULT_API_ENDPOINT = "https://api.vibecloud.tr/query";
|
|
24329
24975
|
var DEFAULT_MCP_ENDPOINT = "https://mcp.vibecloud.tr/mcp";
|
|
@@ -24365,8 +25011,8 @@ function loadConfig(env = process.env) {
|
|
|
24365
25011
|
"config: VIBECLOUD_TOKEN bir vibe_pat_ erisim anahtari olmali (`vibe token create` ile alinan bir API anahtari)"
|
|
24366
25012
|
);
|
|
24367
25013
|
}
|
|
24368
|
-
const tokenFile =
|
|
24369
|
-
const mcpStateFile =
|
|
25014
|
+
const tokenFile = join18(home, ".vibecloud", "token");
|
|
25015
|
+
const mcpStateFile = join18(home, ".vibecloud", "mcp.json");
|
|
24370
25016
|
try {
|
|
24371
25017
|
mkdirSync5(dirname6(tokenFile), { recursive: true, mode: 448 });
|
|
24372
25018
|
} catch (cause) {
|
|
@@ -24415,7 +25061,7 @@ function printUsage(out, commands) {
|
|
|
24415
25061
|
}
|
|
24416
25062
|
|
|
24417
25063
|
// src/cli/run.ts
|
|
24418
|
-
function
|
|
25064
|
+
function resolve4(argv, commands = COMMANDS) {
|
|
24419
25065
|
const [head, ...tail] = argv;
|
|
24420
25066
|
if (head === void 0) return void 0;
|
|
24421
25067
|
const second = tail[0];
|
|
@@ -24466,7 +25112,7 @@ async function run(rawArgv, opts = {}) {
|
|
|
24466
25112
|
} catch (cause) {
|
|
24467
25113
|
return finish(out, "INTERNAL", asError2(cause));
|
|
24468
25114
|
}
|
|
24469
|
-
const resolved =
|
|
25115
|
+
const resolved = resolve4(argv, commands);
|
|
24470
25116
|
if (resolved === void 0) {
|
|
24471
25117
|
const head = argv[0];
|
|
24472
25118
|
const named = head === void 0 ? "(bos)" : head;
|