@abloatai/cli 0.53.0 → 0.54.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/dist/cli.cjs +1015 -701
- package/package.json +3 -3
package/dist/cli.cjs
CHANGED
|
@@ -787,8 +787,8 @@ ${import_picocolors2.default.gray(d2)} ${t}
|
|
|
787
787
|
if (i) process.stdout.write(`${I2} ${l2}...`);
|
|
788
788
|
else if (t === "timer") process.stdout.write(`${I2} ${l2} ${O2(g2)}`);
|
|
789
789
|
else {
|
|
790
|
-
const
|
|
791
|
-
process.stdout.write(`${I2} ${l2}${
|
|
790
|
+
const z8 = ".".repeat(Math.floor(w2)).slice(0, 3);
|
|
791
|
+
process.stdout.write(`${I2} ${l2}${z8}`);
|
|
792
792
|
}
|
|
793
793
|
h2 = h2 + 1 < n.length ? h2 + 1 : 0, w2 = w2 < n.length ? w2 + 0.125 : 0;
|
|
794
794
|
}, r2);
|
|
@@ -3970,7 +3970,7 @@ var init_observeCliError = __esm({
|
|
|
3970
3970
|
import_errorObservation = require("@abloatai/transaction/errorObservation");
|
|
3971
3971
|
import_errors5 = require("@abloatai/transaction/errors");
|
|
3972
3972
|
dsn = process.env.ABLO_CLI_SENTRY_DSN ?? "https://1ac154bff10b06836e1ea9de9e0d92f0@o4510928209772544.ingest.de.sentry.io/4511660691423312" ?? "";
|
|
3973
|
-
release = process.env.ABLO_CLI_RELEASE ?? "@abloatai/cli@0.
|
|
3973
|
+
release = process.env.ABLO_CLI_RELEASE ?? "@abloatai/cli@0.54.0";
|
|
3974
3974
|
initialized = false;
|
|
3975
3975
|
nativeProcessExit = process.exit.bind(process);
|
|
3976
3976
|
exitBoundaryInstalled = false;
|
|
@@ -4295,6 +4295,30 @@ var init_src2 = __esm({
|
|
|
4295
4295
|
}
|
|
4296
4296
|
});
|
|
4297
4297
|
|
|
4298
|
+
// src/cliEnvironment.ts
|
|
4299
|
+
function cliVersion() {
|
|
4300
|
+
return "0.54.0";
|
|
4301
|
+
}
|
|
4302
|
+
function cliOs() {
|
|
4303
|
+
const value = (0, import_node_os.platform)();
|
|
4304
|
+
return value === "darwin" || value === "linux" || value === "win32" ? value : "other";
|
|
4305
|
+
}
|
|
4306
|
+
function cliArchitecture() {
|
|
4307
|
+
const value = (0, import_node_os.arch)();
|
|
4308
|
+
return value === "arm64" || value === "x64" || value === "ia32" ? value : "other";
|
|
4309
|
+
}
|
|
4310
|
+
function nodeMajorVersion() {
|
|
4311
|
+
return Number(process.versions.node.split(".")[0]);
|
|
4312
|
+
}
|
|
4313
|
+
var import_node_os;
|
|
4314
|
+
var init_cliEnvironment = __esm({
|
|
4315
|
+
"src/cliEnvironment.ts"() {
|
|
4316
|
+
"use strict";
|
|
4317
|
+
init_cjs_shims();
|
|
4318
|
+
import_node_os = require("os");
|
|
4319
|
+
}
|
|
4320
|
+
});
|
|
4321
|
+
|
|
4298
4322
|
// src/telemetry.ts
|
|
4299
4323
|
function telemetryPath() {
|
|
4300
4324
|
return (0, import_node_path.join)(configDir(), "telemetry.json");
|
|
@@ -4455,17 +4479,6 @@ function environmentBlocker() {
|
|
|
4455
4479
|
function truthyEnvironmentValue(value) {
|
|
4456
4480
|
return value !== void 0 && value !== "" && value !== "0" && value.toLowerCase() !== "false";
|
|
4457
4481
|
}
|
|
4458
|
-
function cliVersion() {
|
|
4459
|
-
return "0.53.0";
|
|
4460
|
-
}
|
|
4461
|
-
function cliOs() {
|
|
4462
|
-
const value = (0, import_node_os.platform)();
|
|
4463
|
-
return value === "darwin" || value === "linux" || value === "win32" ? value : "other";
|
|
4464
|
-
}
|
|
4465
|
-
function cliArchitecture() {
|
|
4466
|
-
const value = (0, import_node_os.arch)();
|
|
4467
|
-
return value === "arm64" || value === "x64" || value === "ia32" ? value : "other";
|
|
4468
|
-
}
|
|
4469
4482
|
function durationBucket(durationMs) {
|
|
4470
4483
|
if (durationMs < 1e3) return "under_1s";
|
|
4471
4484
|
if (durationMs < 5e3) return "1s_to_5s";
|
|
@@ -4489,16 +4502,16 @@ function runTelemetryCommand(argv) {
|
|
|
4489
4502
|
if (status2.blockedBy) console.log(`Environment override: ${status2.blockedBy}`);
|
|
4490
4503
|
console.log(`Queued events: ${status2.queuedEvents}`);
|
|
4491
4504
|
}
|
|
4492
|
-
var import_node_crypto2, import_node_fs,
|
|
4505
|
+
var import_node_crypto2, import_node_fs, import_node_path, TELEMETRY_FILE_VERSION, MAX_QUEUED_EVENTS, MAX_FLUSH_EVENTS, DEFAULT_FLUSH_TIMEOUT_MS, flushInFlight;
|
|
4493
4506
|
var init_telemetry = __esm({
|
|
4494
4507
|
"src/telemetry.ts"() {
|
|
4495
4508
|
"use strict";
|
|
4496
4509
|
init_cjs_shims();
|
|
4497
4510
|
import_node_crypto2 = require("crypto");
|
|
4498
4511
|
import_node_fs = require("fs");
|
|
4499
|
-
import_node_os = require("os");
|
|
4500
4512
|
import_node_path = require("path");
|
|
4501
4513
|
init_src2();
|
|
4514
|
+
init_cliEnvironment();
|
|
4502
4515
|
init_controlPlane();
|
|
4503
4516
|
init_config();
|
|
4504
4517
|
TELEMETRY_FILE_VERSION = 1;
|
|
@@ -219754,11 +219767,11 @@ var require_commonjs2 = __commonJS({
|
|
|
219754
219767
|
if (pad2) {
|
|
219755
219768
|
const need = width - c.length;
|
|
219756
219769
|
if (need > 0) {
|
|
219757
|
-
const
|
|
219770
|
+
const z8 = new Array(need + 1).join("0");
|
|
219758
219771
|
if (i < 0) {
|
|
219759
|
-
c = "-" +
|
|
219772
|
+
c = "-" + z8 + c.slice(1);
|
|
219760
219773
|
} else {
|
|
219761
|
-
c =
|
|
219774
|
+
c = z8 + c;
|
|
219762
219775
|
}
|
|
219763
219776
|
}
|
|
219764
219777
|
}
|
|
@@ -283732,7 +283745,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
283732
283745
|
|
|
283733
283746
|
// src/index.ts
|
|
283734
283747
|
init_cjs_shims();
|
|
283735
|
-
var
|
|
283748
|
+
var import_picocolors31 = __toESM(require_picocolors(), 1);
|
|
283736
283749
|
|
|
283737
283750
|
// src/migrate.ts
|
|
283738
283751
|
init_cjs_shims();
|
|
@@ -284085,9 +284098,287 @@ function truncate(text, max) {
|
|
|
284085
284098
|
return collapsed.length <= max ? collapsed : `${collapsed.slice(0, max - 1).trimEnd()}\u2026`;
|
|
284086
284099
|
}
|
|
284087
284100
|
|
|
284088
|
-
// src/
|
|
284101
|
+
// ../product-analytics/src/feedback.ts
|
|
284089
284102
|
init_cjs_shims();
|
|
284103
|
+
var import_node_crypto3 = require("crypto");
|
|
284104
|
+
var import_zod5 = require("zod");
|
|
284105
|
+
init_events();
|
|
284106
|
+
var AGENT_FEEDBACK_VERSION = 1;
|
|
284107
|
+
var MAX_FEEDBACK_SUMMARY_LENGTH = 200;
|
|
284108
|
+
var MAX_FEEDBACK_DETAIL_LENGTH = 4e3;
|
|
284109
|
+
var FEEDBACK_KINDS = ["bug", "docs", "feature", "friction"];
|
|
284110
|
+
var feedbackKindSchema = import_zod5.z.enum(FEEDBACK_KINDS);
|
|
284111
|
+
var FEEDBACK_KIND_DESCRIPTIONS = {
|
|
284112
|
+
bug: "It broke, or did something other than what it said it would.",
|
|
284113
|
+
docs: "The answer was missing from the docs, or the docs were wrong.",
|
|
284114
|
+
feature: "The thing you needed does not exist yet.",
|
|
284115
|
+
friction: "It worked, and it was harder than it should have been."
|
|
284116
|
+
};
|
|
284117
|
+
var shortToken2 = import_zod5.z.string().trim().min(1).max(100);
|
|
284118
|
+
var feedbackContextSchema = import_zod5.z.strictObject({
|
|
284119
|
+
/** The command in play, e.g. `push` — the registry name, not the full argv. */
|
|
284120
|
+
command: shortToken2.optional(),
|
|
284121
|
+
/** A code from the `ERROR_CODES` registry. The strongest clustering signal
|
|
284122
|
+
* there is: it groups reports by the failure, not by how it was worded. */
|
|
284123
|
+
errorCode: shortToken2.optional(),
|
|
284124
|
+
/** Which agent is reporting, e.g. `claude-code`. The world owns this set and
|
|
284125
|
+
* adds to it faster than we could ship an enum, so it stays an open token. */
|
|
284126
|
+
reportedBy: shortToken2.optional(),
|
|
284127
|
+
cliVersion: shortToken2.optional(),
|
|
284128
|
+
os: cliOsSchema.optional(),
|
|
284129
|
+
architecture: cliArchitectureSchema.optional(),
|
|
284130
|
+
nodeMajorVersion: import_zod5.z.number().int().min(18).max(100).optional()
|
|
284131
|
+
});
|
|
284132
|
+
var agentFeedbackSchema = import_zod5.z.strictObject({
|
|
284133
|
+
feedbackVersion: import_zod5.z.literal(AGENT_FEEDBACK_VERSION),
|
|
284134
|
+
/** Idempotency: a retried submission is the same report, not a second one. */
|
|
284135
|
+
submissionId: import_zod5.z.uuid(),
|
|
284136
|
+
occurredAt: import_zod5.z.iso.datetime({ offset: true }),
|
|
284137
|
+
kind: feedbackKindSchema,
|
|
284138
|
+
/** One line. This is the ticket title a human reads in a list. */
|
|
284139
|
+
summary: import_zod5.z.string().trim().min(1).max(MAX_FEEDBACK_SUMMARY_LENGTH),
|
|
284140
|
+
/** What happened, in the reporter's own words. */
|
|
284141
|
+
detail: import_zod5.z.string().trim().min(1).max(MAX_FEEDBACK_DETAIL_LENGTH).optional(),
|
|
284142
|
+
context: feedbackContextSchema.default({})
|
|
284143
|
+
});
|
|
284144
|
+
var agentFeedbackSubmissionSchema = import_zod5.z.strictObject({
|
|
284145
|
+
feedback: agentFeedbackSchema
|
|
284146
|
+
});
|
|
284147
|
+
var agentFeedbackReceiptSchema = import_zod5.z.strictObject({
|
|
284148
|
+
submissionId: import_zod5.z.uuid(),
|
|
284149
|
+
accepted: import_zod5.z.boolean(),
|
|
284150
|
+
duplicate: import_zod5.z.boolean(),
|
|
284151
|
+
clusterKey: import_zod5.z.string(),
|
|
284152
|
+
clusterCount: import_zod5.z.number().int().positive()
|
|
284153
|
+
});
|
|
284154
|
+
|
|
284155
|
+
// src/feedback.ts
|
|
284156
|
+
init_cjs_shims();
|
|
284157
|
+
var import_node_crypto4 = require("crypto");
|
|
284158
|
+
var import_node_fs2 = require("fs");
|
|
284090
284159
|
var import_picocolors14 = __toESM(require_picocolors(), 1);
|
|
284160
|
+
init_dist2();
|
|
284161
|
+
var import_errors12 = require("@abloatai/transaction/errors");
|
|
284162
|
+
var import_errorObservation2 = require("@abloatai/transaction/errorObservation");
|
|
284163
|
+
init_cliEnvironment();
|
|
284164
|
+
init_controlPlane();
|
|
284165
|
+
init_config();
|
|
284166
|
+
init_theme();
|
|
284167
|
+
var KIND_WIDTH = Math.max(...FEEDBACK_KINDS.map((kind) => kind.length));
|
|
284168
|
+
var USAGE_LINES = FEEDBACK_KINDS.map(
|
|
284169
|
+
(kind) => ` npx ablo feedback ${kind.padEnd(KIND_WIDTH)} "<one line>" [--detail <text>]`
|
|
284170
|
+
).join("\n");
|
|
284171
|
+
var KIND_LINES = FEEDBACK_KINDS.map(
|
|
284172
|
+
(kind) => ` ${kind.padEnd(KIND_WIDTH + 2)}${FEEDBACK_KIND_DESCRIPTIONS[kind]}`
|
|
284173
|
+
).join("\n");
|
|
284174
|
+
var FEEDBACK_USAGE = ` ablo feedback \u2014 tell us what got in your way
|
|
284175
|
+
|
|
284176
|
+
Usage
|
|
284177
|
+
${USAGE_LINES}
|
|
284178
|
+
|
|
284179
|
+
Kinds
|
|
284180
|
+
${KIND_LINES}
|
|
284181
|
+
|
|
284182
|
+
Options
|
|
284183
|
+
--detail <text> What happened, at length. Use \`-\` to read stdin.
|
|
284184
|
+
--command <name> The command in play, e.g. \`push\`.
|
|
284185
|
+
--error-code <code> The code the failure printed, e.g. \`schema_unknown_model\`.
|
|
284186
|
+
--from <agent> Who is reporting, e.g. \`claude-code\`. Detected when omitted.
|
|
284187
|
+
--yes Send without the confirmation step (agents/CI).
|
|
284188
|
+
--json Print the receipt as JSON.
|
|
284189
|
+
|
|
284190
|
+
Connection strings, API keys, and addresses are removed from what you write
|
|
284191
|
+
before it is sent, and on a terminal you see the redacted text first. Nothing
|
|
284192
|
+
is read from your repository. Reports are grouped by what they describe, so
|
|
284193
|
+
the receipt tells you how many others have hit the same thing.`;
|
|
284194
|
+
function parseFeedbackArgs(argv) {
|
|
284195
|
+
const kindRaw = argv[0];
|
|
284196
|
+
const kind = feedbackKindSchema.safeParse(kindRaw);
|
|
284197
|
+
if (!kind.success) {
|
|
284198
|
+
throw new import_errors12.AbloValidationError(
|
|
284199
|
+
`\`ablo feedback\` needs a kind first: ${FEEDBACK_KINDS.join(", ")}.`,
|
|
284200
|
+
{ code: "cli_invalid_arguments" }
|
|
284201
|
+
);
|
|
284202
|
+
}
|
|
284203
|
+
const positional2 = [];
|
|
284204
|
+
let detail;
|
|
284205
|
+
let command;
|
|
284206
|
+
let errorCode;
|
|
284207
|
+
let from;
|
|
284208
|
+
let yes = false;
|
|
284209
|
+
let json = false;
|
|
284210
|
+
const flagValue = (flag2, value) => {
|
|
284211
|
+
if (value === void 0 || value.startsWith("--")) {
|
|
284212
|
+
throw new import_errors12.AbloValidationError(`\`${flag2}\` needs a value.`, {
|
|
284213
|
+
code: "cli_invalid_arguments"
|
|
284214
|
+
});
|
|
284215
|
+
}
|
|
284216
|
+
return value;
|
|
284217
|
+
};
|
|
284218
|
+
for (let i = 1; i < argv.length; i++) {
|
|
284219
|
+
const arg = argv[i];
|
|
284220
|
+
switch (arg) {
|
|
284221
|
+
case "--detail":
|
|
284222
|
+
detail = flagValue("--detail", argv[++i]);
|
|
284223
|
+
break;
|
|
284224
|
+
case "--command":
|
|
284225
|
+
command = flagValue("--command", argv[++i]);
|
|
284226
|
+
break;
|
|
284227
|
+
case "--error-code":
|
|
284228
|
+
errorCode = flagValue("--error-code", argv[++i]);
|
|
284229
|
+
break;
|
|
284230
|
+
case "--from":
|
|
284231
|
+
from = flagValue("--from", argv[++i]);
|
|
284232
|
+
break;
|
|
284233
|
+
case "--yes":
|
|
284234
|
+
yes = true;
|
|
284235
|
+
break;
|
|
284236
|
+
case "--json":
|
|
284237
|
+
json = true;
|
|
284238
|
+
break;
|
|
284239
|
+
default:
|
|
284240
|
+
if (arg !== void 0 && arg.startsWith("--")) {
|
|
284241
|
+
throw new import_errors12.AbloValidationError(`\`${arg}\` is not an option of this command.`, {
|
|
284242
|
+
code: "cli_invalid_arguments"
|
|
284243
|
+
});
|
|
284244
|
+
}
|
|
284245
|
+
if (arg !== void 0) positional2.push(arg);
|
|
284246
|
+
}
|
|
284247
|
+
}
|
|
284248
|
+
const summary = positional2.join(" ").trim();
|
|
284249
|
+
if (!summary) {
|
|
284250
|
+
throw new import_errors12.AbloValidationError(
|
|
284251
|
+
"Say in one line what got in your way, in quotes after the kind.",
|
|
284252
|
+
{ code: "cli_invalid_arguments" }
|
|
284253
|
+
);
|
|
284254
|
+
}
|
|
284255
|
+
if (summary.length > MAX_FEEDBACK_SUMMARY_LENGTH) {
|
|
284256
|
+
throw new import_errors12.AbloValidationError(
|
|
284257
|
+
`Keep the first line under ${MAX_FEEDBACK_SUMMARY_LENGTH} characters and put the rest in \`--detail\`.`,
|
|
284258
|
+
{ code: "cli_invalid_arguments" }
|
|
284259
|
+
);
|
|
284260
|
+
}
|
|
284261
|
+
return {
|
|
284262
|
+
kind: kind.data,
|
|
284263
|
+
summary,
|
|
284264
|
+
...detail !== void 0 ? { detail } : {},
|
|
284265
|
+
...command !== void 0 ? { command } : {},
|
|
284266
|
+
...errorCode !== void 0 ? { errorCode } : {},
|
|
284267
|
+
...from !== void 0 ? { from } : {},
|
|
284268
|
+
yes,
|
|
284269
|
+
json
|
|
284270
|
+
};
|
|
284271
|
+
}
|
|
284272
|
+
async function feedback(argv) {
|
|
284273
|
+
if (argv.includes("--help") || argv.includes("-h") || argv.length === 0) {
|
|
284274
|
+
console.log(FEEDBACK_USAGE);
|
|
284275
|
+
return;
|
|
284276
|
+
}
|
|
284277
|
+
const args = parseFeedbackArgs(argv);
|
|
284278
|
+
const detail = args.detail === "-" ? readStdin() : args.detail;
|
|
284279
|
+
if (detail !== void 0 && detail.length > MAX_FEEDBACK_DETAIL_LENGTH) {
|
|
284280
|
+
throw new import_errors12.AbloValidationError(
|
|
284281
|
+
`\`--detail\` holds up to ${MAX_FEEDBACK_DETAIL_LENGTH} characters.`,
|
|
284282
|
+
{ code: "cli_invalid_arguments" }
|
|
284283
|
+
);
|
|
284284
|
+
}
|
|
284285
|
+
const reporter = reportedBy(args.from);
|
|
284286
|
+
const report = agentFeedbackSchema.parse({
|
|
284287
|
+
feedbackVersion: AGENT_FEEDBACK_VERSION,
|
|
284288
|
+
submissionId: (0, import_node_crypto4.randomUUID)(),
|
|
284289
|
+
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
284290
|
+
kind: args.kind,
|
|
284291
|
+
summary: (0, import_errorObservation2.redactObservationString)(args.summary),
|
|
284292
|
+
...detail ? { detail: (0, import_errorObservation2.redactObservationString)(detail) } : {},
|
|
284293
|
+
context: {
|
|
284294
|
+
...args.command !== void 0 ? { command: args.command } : {},
|
|
284295
|
+
...args.errorCode !== void 0 ? { errorCode: args.errorCode } : {},
|
|
284296
|
+
...reporter !== void 0 ? { reportedBy: reporter } : {},
|
|
284297
|
+
cliVersion: cliVersion(),
|
|
284298
|
+
os: cliOs(),
|
|
284299
|
+
architecture: cliArchitecture(),
|
|
284300
|
+
nodeMajorVersion: nodeMajorVersion()
|
|
284301
|
+
}
|
|
284302
|
+
});
|
|
284303
|
+
const interactive = Boolean(process.stdout.isTTY && process.stdin.isTTY) && !args.yes;
|
|
284304
|
+
if (interactive) {
|
|
284305
|
+
printPreview(report);
|
|
284306
|
+
const proceed = await ye({ message: "Send this?" });
|
|
284307
|
+
if (pD(proceed) || !proceed) {
|
|
284308
|
+
console.log(` ${import_picocolors14.default.dim("Nothing sent.")}`);
|
|
284309
|
+
return;
|
|
284310
|
+
}
|
|
284311
|
+
}
|
|
284312
|
+
const managementKey = resolveManagementKey();
|
|
284313
|
+
const receipt = await requestControlPlane({
|
|
284314
|
+
path: "/v1/feedback",
|
|
284315
|
+
method: "POST",
|
|
284316
|
+
body: { feedback: report },
|
|
284317
|
+
...managementKey !== void 0 ? { apiKey: managementKey } : {},
|
|
284318
|
+
responseSchema: agentFeedbackReceiptSchema,
|
|
284319
|
+
timeoutMs: 1e4
|
|
284320
|
+
});
|
|
284321
|
+
if (args.json || process.env.ABLO_JSON === "1") {
|
|
284322
|
+
console.log(JSON.stringify(receipt, null, 2));
|
|
284323
|
+
return;
|
|
284324
|
+
}
|
|
284325
|
+
if (receipt.duplicate) {
|
|
284326
|
+
console.log(` ${import_picocolors14.default.dim("Already recorded \u2014 this report was sent before.")}`);
|
|
284327
|
+
return;
|
|
284328
|
+
}
|
|
284329
|
+
console.log(` ${import_picocolors14.default.green("\u2713")} Thank you. Recorded as ${import_picocolors14.default.dim(receipt.submissionId)}`);
|
|
284330
|
+
if (receipt.clusterCount > 1) {
|
|
284331
|
+
console.log(
|
|
284332
|
+
` ${import_picocolors14.default.dim(`${receipt.clusterCount} reports describe this same thing.`)}`
|
|
284333
|
+
);
|
|
284334
|
+
}
|
|
284335
|
+
}
|
|
284336
|
+
function printPreview(report) {
|
|
284337
|
+
console.log(`
|
|
284338
|
+
${brand("ablo")} ${import_picocolors14.default.dim("feedback")} ${import_picocolors14.default.dim(report.kind)}
|
|
284339
|
+
`);
|
|
284340
|
+
console.log(` ${report.summary}`);
|
|
284341
|
+
if (report.detail) {
|
|
284342
|
+
console.log();
|
|
284343
|
+
for (const line of report.detail.split("\n")) console.log(` ${import_picocolors14.default.dim(line)}`);
|
|
284344
|
+
}
|
|
284345
|
+
const context = [
|
|
284346
|
+
report.context.command ? `command ${report.context.command}` : null,
|
|
284347
|
+
report.context.errorCode ? `code ${report.context.errorCode}` : null,
|
|
284348
|
+
report.context.reportedBy ? `from ${report.context.reportedBy}` : null,
|
|
284349
|
+
report.context.cliVersion ? `cli ${report.context.cliVersion}` : null,
|
|
284350
|
+
report.context.os ?? null
|
|
284351
|
+
].filter((entry) => entry !== null);
|
|
284352
|
+
console.log(`
|
|
284353
|
+
${import_picocolors14.default.dim(context.join(" \xB7 "))}
|
|
284354
|
+
`);
|
|
284355
|
+
}
|
|
284356
|
+
function reportedBy(explicit) {
|
|
284357
|
+
if (explicit) return explicit;
|
|
284358
|
+
const configured = process.env.ABLO_AGENT?.trim();
|
|
284359
|
+
if (configured) return configured;
|
|
284360
|
+
if (process.env.CLAUDECODE || process.env.CLAUDE_CODE_ENTRYPOINT) return "claude-code";
|
|
284361
|
+
return void 0;
|
|
284362
|
+
}
|
|
284363
|
+
function readStdin() {
|
|
284364
|
+
if (process.stdin.isTTY) {
|
|
284365
|
+
throw new import_errors12.AbloValidationError(
|
|
284366
|
+
"`--detail -` reads piped input. Pass the text directly instead.",
|
|
284367
|
+
{ code: "cli_invalid_arguments" }
|
|
284368
|
+
);
|
|
284369
|
+
}
|
|
284370
|
+
try {
|
|
284371
|
+
return (0, import_node_fs2.readFileSync)(0, "utf8").trim();
|
|
284372
|
+
} catch {
|
|
284373
|
+
throw new import_errors12.AbloValidationError("Could not read `--detail` from stdin.", {
|
|
284374
|
+
code: "cli_invalid_arguments"
|
|
284375
|
+
});
|
|
284376
|
+
}
|
|
284377
|
+
}
|
|
284378
|
+
|
|
284379
|
+
// src/branches.ts
|
|
284380
|
+
init_cjs_shims();
|
|
284381
|
+
var import_picocolors15 = __toESM(require_picocolors(), 1);
|
|
284091
284382
|
var import_branches = require("@abloatai/transaction/branches");
|
|
284092
284383
|
init_controlPlane();
|
|
284093
284384
|
init_config();
|
|
@@ -284150,12 +284441,12 @@ function valueAfter(argv, flag2) {
|
|
|
284150
284441
|
function print(branches2) {
|
|
284151
284442
|
const slugWidth = Math.max(...branches2.map((branch) => branch.slug.length), 6);
|
|
284152
284443
|
for (const branch of branches2) {
|
|
284153
|
-
const marker = branch.root ?
|
|
284154
|
-
const kind = branch.root ?
|
|
284155
|
-
const state = branch.state === "ready" ?
|
|
284156
|
-
const expiry = branch.expires_at ?
|
|
284444
|
+
const marker = branch.root ? import_picocolors15.default.green("\u25CF") : import_picocolors15.default.dim("\u25CB");
|
|
284445
|
+
const kind = branch.root ? import_picocolors15.default.green("root") : import_picocolors15.default.dim(branch.kind);
|
|
284446
|
+
const state = branch.state === "ready" ? import_picocolors15.default.green(branch.state) : import_picocolors15.default.yellow(branch.state);
|
|
284447
|
+
const expiry = branch.expires_at ? import_picocolors15.default.dim(` expires ${new Date(branch.expires_at).toLocaleDateString()}`) : "";
|
|
284157
284448
|
console.log(
|
|
284158
|
-
` ${marker} ${branch.slug.padEnd(slugWidth)} ${kind.padEnd(12)} ${state.padEnd(14)} ${
|
|
284449
|
+
` ${marker} ${branch.slug.padEnd(slugWidth)} ${kind.padEnd(12)} ${state.padEnd(14)} ${import_picocolors15.default.dim(branch.id)}${expiry}`
|
|
284159
284450
|
);
|
|
284160
284451
|
}
|
|
284161
284452
|
}
|
|
@@ -284203,32 +284494,32 @@ async function readStatus(ref, context = {}) {
|
|
|
284203
284494
|
}
|
|
284204
284495
|
function printStatus(status2) {
|
|
284205
284496
|
const { branch, schema, storage, data_source: source } = status2;
|
|
284206
|
-
console.log(` ${
|
|
284497
|
+
console.log(` ${import_picocolors15.default.bold(branch.slug)} ${import_picocolors15.default.dim(branch.id)}`);
|
|
284207
284498
|
console.log(
|
|
284208
|
-
` ${
|
|
284499
|
+
` ${import_picocolors15.default.dim("state")} ${branch.state === "ready" ? import_picocolors15.default.green(branch.state) : import_picocolors15.default.yellow(branch.state)}`
|
|
284209
284500
|
);
|
|
284210
284501
|
console.log(
|
|
284211
|
-
` ${
|
|
284502
|
+
` ${import_picocolors15.default.dim("schema")} ${schema.active ? `${import_picocolors15.default.green("active")} ${import_picocolors15.default.dim(`v${schema.version ?? "?"} \xB7 ${schema.hash ?? "no hash"}`)}` : import_picocolors15.default.red("missing")}`
|
|
284212
284503
|
);
|
|
284213
284504
|
if (!branch.root) {
|
|
284214
|
-
const counts = schema.changes > 0 ?
|
|
284505
|
+
const counts = schema.changes > 0 ? import_picocolors15.default.dim(
|
|
284215
284506
|
` \xB7 ${schema.changes} changes, ${schema.warnings} warnings, ${schema.blockers} blockers`
|
|
284216
284507
|
) : "";
|
|
284217
284508
|
console.log(
|
|
284218
|
-
` ${
|
|
284509
|
+
` ${import_picocolors15.default.dim("parent")} ${import_picocolors15.default.bold(schema.parent_compatibility)}${counts}`
|
|
284219
284510
|
);
|
|
284220
284511
|
}
|
|
284221
284512
|
const sourceLabel = source ? `${source.connection} \xB7 ${source.host ?? "unknown host"}${source.database ? `/${source.database}` : ""} \xB7 ${source.status}` : storage.kind === "unbound" ? "not connected to a database" : storage.kind === "internal" ? `Ablo internal product storage \xB7 ${storage.implementation}` : storage.kind === "blocked" ? "storage configuration needs attention" : "customer database connection unavailable";
|
|
284222
|
-
console.log(` ${
|
|
284513
|
+
console.log(` ${import_picocolors15.default.dim("data")} ${sourceLabel}`);
|
|
284223
284514
|
if (status2.ready) {
|
|
284224
284515
|
console.log(`
|
|
284225
|
-
${
|
|
284516
|
+
${import_picocolors15.default.green("\u2713 ready")}`);
|
|
284226
284517
|
} else {
|
|
284227
284518
|
console.log(`
|
|
284228
|
-
${
|
|
284519
|
+
${import_picocolors15.default.red("\u2717 not ready")}`);
|
|
284229
284520
|
for (const blocker2 of status2.blockers) {
|
|
284230
|
-
console.log(` ${
|
|
284231
|
-
console.log(` ${
|
|
284521
|
+
console.log(` ${import_picocolors15.default.red("\u2022")} ${blocker2.problem}`);
|
|
284522
|
+
console.log(` ${import_picocolors15.default.dim(`Fix: ${blocker2.fix}`)}`);
|
|
284232
284523
|
}
|
|
284233
284524
|
}
|
|
284234
284525
|
}
|
|
@@ -284294,12 +284585,12 @@ async function branches(argv) {
|
|
|
284294
284585
|
)
|
|
284295
284586
|
);
|
|
284296
284587
|
} else {
|
|
284297
|
-
console.log(` ${
|
|
284298
|
-
console.log(
|
|
284588
|
+
console.log(` ${import_picocolors15.default.green("\u2713")} ${row.slug} ${import_picocolors15.default.dim(row.id)}`);
|
|
284589
|
+
console.log(import_picocolors15.default.dim(` parent ${row.parent_branch_id ?? "none"} \xB7 ${row.state}`));
|
|
284299
284590
|
if (credential) {
|
|
284300
284591
|
console.log(credential.api_key);
|
|
284301
284592
|
console.error(
|
|
284302
|
-
|
|
284593
|
+
import_picocolors15.default.dim(` expires ${credential.expires_at} \xB7 branch ${credential.branch_id}`)
|
|
284303
284594
|
);
|
|
284304
284595
|
}
|
|
284305
284596
|
}
|
|
@@ -284324,7 +284615,7 @@ async function branches(argv) {
|
|
|
284324
284615
|
throw new Error(message(response.body, `Could not delete branch (HTTP ${response.status}).`));
|
|
284325
284616
|
}
|
|
284326
284617
|
const row = import_branches.branchResponseSchema.parse(response.body);
|
|
284327
|
-
console.log(` ${
|
|
284618
|
+
console.log(` ${import_picocolors15.default.green("\u2713")} deleted ${row.slug} ${import_picocolors15.default.dim(row.id)}`);
|
|
284328
284619
|
return;
|
|
284329
284620
|
}
|
|
284330
284621
|
if (command === "credential") {
|
|
@@ -284336,7 +284627,7 @@ async function branches(argv) {
|
|
|
284336
284627
|
if (argv.includes("--json")) console.log(JSON.stringify(credential, null, 2));
|
|
284337
284628
|
else {
|
|
284338
284629
|
console.log(credential.api_key);
|
|
284339
|
-
console.error(
|
|
284630
|
+
console.error(import_picocolors15.default.dim(` expires ${credential.expires_at} \xB7 branch ${credential.branch_id}`));
|
|
284340
284631
|
}
|
|
284341
284632
|
return;
|
|
284342
284633
|
}
|
|
@@ -284345,18 +284636,18 @@ async function branches(argv) {
|
|
|
284345
284636
|
|
|
284346
284637
|
// src/branchDev.ts
|
|
284347
284638
|
init_cjs_shims();
|
|
284348
|
-
var
|
|
284639
|
+
var import_node_crypto5 = require("crypto");
|
|
284349
284640
|
var import_node_child_process = require("child_process");
|
|
284350
284641
|
var import_branches2 = require("@abloatai/transaction/branches");
|
|
284351
|
-
var
|
|
284642
|
+
var import_errors14 = require("@abloatai/transaction/errors");
|
|
284352
284643
|
init_config();
|
|
284353
284644
|
init_telemetry();
|
|
284354
284645
|
|
|
284355
284646
|
// src/dev.ts
|
|
284356
284647
|
init_cjs_shims();
|
|
284357
|
-
var
|
|
284648
|
+
var import_errors13 = require("@abloatai/transaction/errors");
|
|
284358
284649
|
var import_credentialPolicy2 = require("@abloatai/transaction/auth/credentialPolicy");
|
|
284359
|
-
var
|
|
284650
|
+
var import_picocolors16 = __toESM(require_picocolors(), 1);
|
|
284360
284651
|
init_dist2();
|
|
284361
284652
|
var import_fs7 = require("fs");
|
|
284362
284653
|
var import_path5 = require("path");
|
|
@@ -284400,7 +284691,7 @@ function parseDevArgs(argv) {
|
|
|
284400
284691
|
sourcePath = argv[++i] ?? sourcePath;
|
|
284401
284692
|
break;
|
|
284402
284693
|
default:
|
|
284403
|
-
throw new
|
|
284694
|
+
throw new import_errors13.AbloValidationError(`unknown flag: ${arg}`, { code: "cli_invalid_arguments" });
|
|
284404
284695
|
}
|
|
284405
284696
|
}
|
|
284406
284697
|
url = apiBaseUrl(url);
|
|
@@ -284418,8 +284709,8 @@ function parseDevArgs(argv) {
|
|
|
284418
284709
|
async function loadLocalSourceHandler(sourcePath) {
|
|
284419
284710
|
const abs = (0, import_path5.resolve)(process.cwd(), sourcePath);
|
|
284420
284711
|
if (!(0, import_fs7.existsSync)(abs)) {
|
|
284421
|
-
throw new
|
|
284422
|
-
`local Data Source not found at ${
|
|
284712
|
+
throw new import_errors13.AbloValidationError(
|
|
284713
|
+
`local Data Source not found at ${import_picocolors16.default.bold(sourcePath)}. Add the signed Data Source handler described by ${import_picocolors16.default.bold("npx ablo docs data-sources")}, or pass ${import_picocolors16.default.bold("--source <path>")}.`,
|
|
284423
284714
|
{ code: "cli_invalid_arguments" }
|
|
284424
284715
|
);
|
|
284425
284716
|
}
|
|
@@ -284429,8 +284720,8 @@ async function loadLocalSourceHandler(sourcePath) {
|
|
|
284429
284720
|
const nested = mod.default && typeof mod.default === "object" ? mod.default : void 0;
|
|
284430
284721
|
const handler = mod.POST ?? nested?.POST;
|
|
284431
284722
|
if (typeof handler !== "function") {
|
|
284432
|
-
throw new
|
|
284433
|
-
`${
|
|
284723
|
+
throw new import_errors13.AbloValidationError(
|
|
284724
|
+
`${import_picocolors16.default.bold(sourcePath)} must export a ${import_picocolors16.default.bold("POST(request)")} Data Source handler.`,
|
|
284434
284725
|
{ code: "cli_invalid_arguments" }
|
|
284435
284726
|
);
|
|
284436
284727
|
}
|
|
@@ -284453,7 +284744,7 @@ async function registerLocalSource(args) {
|
|
|
284453
284744
|
});
|
|
284454
284745
|
if (!response.ok) {
|
|
284455
284746
|
const body = await response.text();
|
|
284456
|
-
throw new
|
|
284747
|
+
throw new import_errors13.AbloValidationError(
|
|
284457
284748
|
`Could not register the local Data Source (${response.status}): ${body}`,
|
|
284458
284749
|
{ code: "cli_invalid_arguments" }
|
|
284459
284750
|
);
|
|
@@ -284463,19 +284754,19 @@ function classifyKey(apiKey) {
|
|
|
284463
284754
|
if (!apiKey) {
|
|
284464
284755
|
return {
|
|
284465
284756
|
ok: false,
|
|
284466
|
-
reason: `No API key. Run ${
|
|
284757
|
+
reason: `No API key. Run ${import_picocolors16.default.bold("npx ablo login")}, or set a branch-bound ${import_picocolors16.default.bold("ABLO_API_KEY")}. ${import_picocolors16.default.bold("npx ablo dev")} prepares a development branch.`
|
|
284467
284758
|
};
|
|
284468
284759
|
}
|
|
284469
284760
|
if ((0, import_credentialPolicy2.classifyCredentialKind)(apiKey) === "secret") return { ok: true };
|
|
284470
284761
|
if ((0, import_credentialPolicy2.classifyCredentialKind)(apiKey) === "restricted") {
|
|
284471
284762
|
return {
|
|
284472
284763
|
ok: false,
|
|
284473
|
-
reason: `Authoring schema needs a branch-bound secret ${
|
|
284764
|
+
reason: `Authoring schema needs a branch-bound secret ${import_picocolors16.default.bold("sk_")} key. ${import_picocolors16.default.bold("npx ablo dev")} prepares a development branch. A restricted ${import_picocolors16.default.bold("rk_")} key carries only the scopes it was minted with.`
|
|
284474
284765
|
};
|
|
284475
284766
|
}
|
|
284476
284767
|
return {
|
|
284477
284768
|
ok: false,
|
|
284478
|
-
reason: `${
|
|
284769
|
+
reason: `${import_picocolors16.default.bold("ABLO_API_KEY")} is not a secret Ablo key. Expected a branch-bound ${import_picocolors16.default.bold("sk_\u2026")} credential. Run ${import_picocolors16.default.bold("npx ablo dev")} to prepare a development branch.`
|
|
284479
284770
|
};
|
|
284480
284771
|
}
|
|
284481
284772
|
function wireEnvLocal(apiKey, cwd = process.cwd(), projectId, branchId) {
|
|
@@ -284493,7 +284784,7 @@ ${projectLine ? `${projectLine}
|
|
|
284493
284784
|
` : ""}`,
|
|
284494
284785
|
{ mode: 384 }
|
|
284495
284786
|
);
|
|
284496
|
-
action = `Created ${
|
|
284787
|
+
action = `Created ${import_picocolors16.default.bold(".env.local")} with ${import_picocolors16.default.bold("ABLO_API_KEY")}`;
|
|
284497
284788
|
} else {
|
|
284498
284789
|
const content = (0, import_fs7.readFileSync)(envPath, "utf8");
|
|
284499
284790
|
const match = /^ABLO_API_KEY=(.*)$/m.exec(content);
|
|
@@ -284501,12 +284792,12 @@ ${projectLine ? `${projectLine}
|
|
|
284501
284792
|
if (!match) {
|
|
284502
284793
|
(0, import_fs7.appendFileSync)(envPath, `${content.endsWith("\n") || content.length === 0 ? "" : "\n"}${line}
|
|
284503
284794
|
`);
|
|
284504
|
-
action = `Added ${
|
|
284795
|
+
action = `Added ${import_picocolors16.default.bold("ABLO_API_KEY")} to ${import_picocolors16.default.bold(".env.local")}`;
|
|
284505
284796
|
} else if (existing === apiKey) {
|
|
284506
|
-
action = `${
|
|
284797
|
+
action = `${import_picocolors16.default.bold(".env.local")} already has this key`;
|
|
284507
284798
|
} else {
|
|
284508
284799
|
(0, import_fs7.writeFileSync)(envPath, content.replace(/^ABLO_API_KEY=.*$/m, line));
|
|
284509
|
-
action = `Updated ${
|
|
284800
|
+
action = `Updated ${import_picocolors16.default.bold("ABLO_API_KEY")} in ${import_picocolors16.default.bold(".env.local")} ${import_picocolors16.default.dim(`(was ${existing.slice(0, 12)}\u2026)`)}`;
|
|
284510
284801
|
}
|
|
284511
284802
|
if (projectLine) {
|
|
284512
284803
|
const next = (0, import_fs7.readFileSync)(envPath, "utf8");
|
|
@@ -284538,7 +284829,7 @@ ${projectLine ? `${projectLine}
|
|
|
284538
284829
|
`}.env.local
|
|
284539
284830
|
`
|
|
284540
284831
|
);
|
|
284541
|
-
gitignoreNote = ` Added ${
|
|
284832
|
+
gitignoreNote = ` Added ${import_picocolors16.default.bold(".env.local")} to ${import_picocolors16.default.bold(".gitignore")} so the key can't be committed.`;
|
|
284542
284833
|
}
|
|
284543
284834
|
return `${action}.${gitignoreNote}`;
|
|
284544
284835
|
}
|
|
@@ -284553,7 +284844,7 @@ async function runPush(schema, args) {
|
|
|
284553
284844
|
if (ok) {
|
|
284554
284845
|
return {
|
|
284555
284846
|
ok: true,
|
|
284556
|
-
message: body.unchanged ? `schema unchanged ${
|
|
284847
|
+
message: body.unchanged ? `schema unchanged ${import_picocolors16.default.dim(`(v${body.version})`)}` : `schema pushed (${args.planeLabel}) ${import_picocolors16.default.dim(`(v${body.version}, hash ${body.hash})`)}`
|
|
284557
284848
|
};
|
|
284558
284849
|
}
|
|
284559
284850
|
if (status2 === 409) {
|
|
@@ -284562,9 +284853,9 @@ async function runPush(schema, args) {
|
|
|
284562
284853
|
return {
|
|
284563
284854
|
ok: false,
|
|
284564
284855
|
message: [
|
|
284565
|
-
|
|
284566
|
-
...models.map((model) =>
|
|
284567
|
-
|
|
284856
|
+
import_picocolors16.default.bold("Replication reset required \u2014 a removed model still has live rows in this log plane."),
|
|
284857
|
+
...models.map((model) => import_picocolors16.default.yellow(` Live vanished model: ${String(model)}`)),
|
|
284858
|
+
import_picocolors16.default.dim(` Use ${import_picocolors16.default.bold("--rename old:new")} to carry it forward, or ${import_picocolors16.default.bold("--force")} to accept the drop/reset.`)
|
|
284568
284859
|
].join("\n")
|
|
284569
284860
|
};
|
|
284570
284861
|
}
|
|
@@ -284574,46 +284865,46 @@ async function runPush(schema, args) {
|
|
|
284574
284865
|
(s) => s.shadowed != null
|
|
284575
284866
|
);
|
|
284576
284867
|
const lines = [
|
|
284577
|
-
|
|
284868
|
+
import_picocolors16.default.bold("Incompatible schema change \u2014 not safe to apply as-is."),
|
|
284578
284869
|
"",
|
|
284579
|
-
...unexecutable.map((u2) =>
|
|
284580
|
-
...warnings.map((w2) =>
|
|
284870
|
+
...unexecutable.map((u2) => import_picocolors16.default.red(fmtSignal(u2))),
|
|
284871
|
+
...warnings.map((w2) => import_picocolors16.default.yellow(fmtSignal(w2))),
|
|
284581
284872
|
"",
|
|
284582
284873
|
...hasShadowed ? [
|
|
284583
|
-
|
|
284874
|
+
import_picocolors16.default.dim(
|
|
284584
284875
|
" These models exist in the baseline above but not in your push. Sandbox readers"
|
|
284585
284876
|
),
|
|
284586
|
-
|
|
284877
|
+
import_picocolors16.default.dim(
|
|
284587
284878
|
" fall back to the production schema until you push your own, so applying this drops them."
|
|
284588
284879
|
),
|
|
284589
284880
|
""
|
|
284590
284881
|
] : [],
|
|
284591
|
-
|
|
284592
|
-
` Fix: ${
|
|
284882
|
+
import_picocolors16.default.dim(
|
|
284883
|
+
` Fix: ${import_picocolors16.default.bold("ablo push --force")} to apply anyway, or ${import_picocolors16.default.bold("--rename old:new")} if you renamed a model.`
|
|
284593
284884
|
)
|
|
284594
284885
|
];
|
|
284595
284886
|
return { ok: false, message: lines.join("\n") };
|
|
284596
284887
|
}
|
|
284597
284888
|
if (status2 === 403) {
|
|
284598
284889
|
const serverSays = body.message ?? body.reason;
|
|
284599
|
-
const hint = schemaPushStorageHint(body.code) ?? (body.code === "database_role_cannot_enforce_rls" ? `Run ${
|
|
284890
|
+
const hint = schemaPushStorageHint(body.code) ?? (body.code === "database_role_cannot_enforce_rls" ? `Run ${import_picocolors16.default.bold("npx ablo migrate")} \u2014 it creates the scoped role for you (your DB credential never leaves this machine).` : `Schema authoring needs a branch-bound ${import_picocolors16.default.bold("sk_")} key with ${import_picocolors16.default.bold("schema:push")} \u2014 manage keys at ${import_picocolors16.default.cyan("https://abloatai.com")}.`);
|
|
284600
284891
|
return {
|
|
284601
284892
|
ok: false,
|
|
284602
284893
|
message: `${serverSays ?? "This key can't author schema (missing schema:push scope)."}
|
|
284603
|
-
` +
|
|
284894
|
+
` + import_picocolors16.default.dim(hint)
|
|
284604
284895
|
};
|
|
284605
284896
|
}
|
|
284606
284897
|
const serverMessage = String(body.message ?? body.reason ?? bodyText);
|
|
284607
284898
|
const storageHint = schemaPushStorageHint(body.code);
|
|
284608
284899
|
if (storageHint) {
|
|
284609
284900
|
return { ok: false, message: `${serverMessage}
|
|
284610
|
-
${
|
|
284901
|
+
${import_picocolors16.default.dim(storageHint)}` };
|
|
284611
284902
|
}
|
|
284612
284903
|
if (looksLikeCredentialRefusal(serverMessage)) {
|
|
284613
284904
|
const pooled = await poolerExplanation(apiBaseUrl(), args.apiKey);
|
|
284614
284905
|
if (pooled) {
|
|
284615
284906
|
return { ok: false, message: `${serverMessage}
|
|
284616
|
-
${
|
|
284907
|
+
${import_picocolors16.default.dim(pooled)}` };
|
|
284617
284908
|
}
|
|
284618
284909
|
}
|
|
284619
284910
|
return { ok: false, message: `Push failed (${status2}): ${serverMessage}` };
|
|
@@ -284623,32 +284914,32 @@ async function dev(argv, runtime = {}) {
|
|
|
284623
284914
|
try {
|
|
284624
284915
|
args = parseDevArgs(argv);
|
|
284625
284916
|
} catch (err) {
|
|
284626
|
-
console.error(
|
|
284917
|
+
console.error(import_picocolors16.default.red(` ${err instanceof Error ? err.message : String(err)}`));
|
|
284627
284918
|
process.exit(1);
|
|
284628
284919
|
}
|
|
284629
284920
|
if (runtime.apiKey) args.apiKey = runtime.apiKey;
|
|
284630
284921
|
else if (!args.apiKey) args.apiKey = resolveRuntimeApiKey("sandbox").key;
|
|
284631
284922
|
if (runtime.branch) args.planeLabel = runtime.branch.slug;
|
|
284632
284923
|
if (args.local && !args.watch) {
|
|
284633
|
-
throw new
|
|
284634
|
-
`${
|
|
284924
|
+
throw new import_errors13.AbloValidationError(
|
|
284925
|
+
`${import_picocolors16.default.bold("--local")} opens a long-lived secure connector and cannot be combined with ${import_picocolors16.default.bold("--no-watch")}.`,
|
|
284635
284926
|
{ code: "cli_invalid_arguments" }
|
|
284636
284927
|
);
|
|
284637
284928
|
}
|
|
284638
284929
|
const key = classifyKey(args.apiKey);
|
|
284639
284930
|
if (!key.ok) {
|
|
284640
|
-
console.error(
|
|
284931
|
+
console.error(import_picocolors16.default.red(` ${key.reason}`));
|
|
284641
284932
|
process.exit(1);
|
|
284642
284933
|
}
|
|
284643
284934
|
console.log(`
|
|
284644
|
-
${brand("ablo")} ${
|
|
284935
|
+
${brand("ablo")} ${import_picocolors16.default.dim("push")} ${import_picocolors16.default.dim(`(${args.planeLabel})`)}
|
|
284645
284936
|
`);
|
|
284646
284937
|
if (runtime.branch) {
|
|
284647
284938
|
console.log(
|
|
284648
|
-
` ${
|
|
284939
|
+
` ${import_picocolors16.default.dim("branch")} ${import_picocolors16.default.bold(runtime.branch.slug)} ${import_picocolors16.default.dim(runtime.branch.id)}`
|
|
284649
284940
|
);
|
|
284650
284941
|
console.log(
|
|
284651
|
-
` ${
|
|
284942
|
+
` ${import_picocolors16.default.dim("key")} temporary \xB7 expires ${runtime.branch.expiresAt}`
|
|
284652
284943
|
);
|
|
284653
284944
|
}
|
|
284654
284945
|
let localAbort = null;
|
|
@@ -284668,27 +284959,27 @@ async function dev(argv, runtime = {}) {
|
|
|
284668
284959
|
client: "ablo-dev",
|
|
284669
284960
|
onStatus(status2) {
|
|
284670
284961
|
if (status2 === "ready") {
|
|
284671
|
-
console.log(` ${
|
|
284962
|
+
console.log(` ${import_picocolors16.default.green("\u2713")} local Postgres connected through the secure reverse channel`);
|
|
284672
284963
|
}
|
|
284673
284964
|
},
|
|
284674
284965
|
onError(error) {
|
|
284675
|
-
console.error(
|
|
284966
|
+
console.error(import_picocolors16.default.yellow(` local connector: ${error instanceof Error ? error.message : String(error)}`));
|
|
284676
284967
|
}
|
|
284677
284968
|
});
|
|
284678
284969
|
void connector.run(localAbort.signal).catch((error) => {
|
|
284679
|
-
console.error(
|
|
284970
|
+
console.error(import_picocolors16.default.red(` local connector stopped: ${error instanceof Error ? error.message : String(error)}`));
|
|
284680
284971
|
});
|
|
284681
|
-
console.log(` ${
|
|
284972
|
+
console.log(` ${import_picocolors16.default.dim("source")} ${args.sourcePath} ${import_picocolors16.default.dim("(outbound connector; no public URL)")}`);
|
|
284682
284973
|
}
|
|
284683
284974
|
const schema = await loadSchema(args.schemaPath, args.exportName);
|
|
284684
284975
|
const modelCount = Object.keys(schema.models).length;
|
|
284685
284976
|
console.log(
|
|
284686
|
-
` ${
|
|
284977
|
+
` ${import_picocolors16.default.dim("schema")} ${import_picocolors16.default.bold(args.schemaPath)} ${import_picocolors16.default.dim(`(${modelCount} models, hash ${(0, import_schema6.schemaHash)(schema)})`)}`
|
|
284687
284978
|
);
|
|
284688
284979
|
if (!runtime.branch) {
|
|
284689
|
-
console.log(` ${
|
|
284980
|
+
console.log(` ${import_picocolors16.default.dim("key")} ${args.apiKey.slice(0, 12)}\u2026`);
|
|
284690
284981
|
}
|
|
284691
|
-
console.log(` ${
|
|
284982
|
+
console.log(` ${import_picocolors16.default.dim("api")} ${args.url}
|
|
284692
284983
|
`);
|
|
284693
284984
|
const s = Y2();
|
|
284694
284985
|
s.start("Pushing schema definition (development branch)");
|
|
@@ -284701,30 +284992,30 @@ async function dev(argv, runtime = {}) {
|
|
|
284701
284992
|
if (runtime.branch) {
|
|
284702
284993
|
console.log(
|
|
284703
284994
|
`
|
|
284704
|
-
${
|
|
284995
|
+
${import_picocolors16.default.green("\u2713")} ${wireEnvLocal(args.apiKey, process.cwd(), runtime.branch.projectId, runtime.branch.id)}`
|
|
284705
284996
|
);
|
|
284706
284997
|
console.log(
|
|
284707
|
-
` ${
|
|
284998
|
+
` ${import_picocolors16.default.dim(`Temporary branch credential expires ${runtime.branch.expiresAt}; rerun ablo dev to rotate it.`)}`
|
|
284708
284999
|
);
|
|
284709
285000
|
if (process.env.ABLO_API_KEY && process.env.ABLO_API_KEY !== args.apiKey) {
|
|
284710
285001
|
console.log(
|
|
284711
|
-
|
|
285002
|
+
import_picocolors16.default.yellow(
|
|
284712
285003
|
` An exported ABLO_API_KEY overrides .env.local for child processes; unset it before starting your app.`
|
|
284713
285004
|
)
|
|
284714
285005
|
);
|
|
284715
285006
|
}
|
|
284716
285007
|
} else if (process.env.ABLO_API_KEY) {
|
|
284717
285008
|
console.log(`
|
|
284718
|
-
${
|
|
285009
|
+
${import_picocolors16.default.green("\u2713")} ${import_picocolors16.default.bold("ABLO_API_KEY")} is set in this shell \u2014 the SDK reads it directly.`);
|
|
284719
285010
|
} else {
|
|
284720
285011
|
console.log(`
|
|
284721
|
-
${
|
|
284722
|
-
console.log(` ${
|
|
285012
|
+
${import_picocolors16.default.green("\u2713")} ${wireEnvLocal(args.apiKey)}`);
|
|
285013
|
+
console.log(` ${import_picocolors16.default.dim("Frameworks load it automatically; plain Node: node --env-file=.env.local app.ts")}`);
|
|
284723
285014
|
}
|
|
284724
285015
|
console.log(` Your app is wired for ${runtime.branch ? `branch ${runtime.branch.slug}` : "this branch"}.`);
|
|
284725
285016
|
if (!args.watch) return;
|
|
284726
285017
|
const abs = (0, import_path5.resolve)(process.cwd(), args.schemaPath);
|
|
284727
|
-
console.log(` ${
|
|
285018
|
+
console.log(` ${import_picocolors16.default.dim(`watching ${args.schemaPath} \u2026 (Ctrl-C to stop)`)}
|
|
284728
285019
|
`);
|
|
284729
285020
|
let timer2 = null;
|
|
284730
285021
|
let pushing = false;
|
|
@@ -284744,7 +285035,7 @@ async function dev(argv, runtime = {}) {
|
|
|
284744
285035
|
const r2 = await runPush(next, args);
|
|
284745
285036
|
s2.stop(r2.message, r2.ok ? 0 : 1);
|
|
284746
285037
|
} catch (err) {
|
|
284747
|
-
s2.stop(
|
|
285038
|
+
s2.stop(import_picocolors16.default.red(`schema reload failed: ${err instanceof Error ? err.message : String(err)}`), 1);
|
|
284748
285039
|
} finally {
|
|
284749
285040
|
pushing = false;
|
|
284750
285041
|
}
|
|
@@ -284753,7 +285044,7 @@ async function dev(argv, runtime = {}) {
|
|
|
284753
285044
|
watcher.close();
|
|
284754
285045
|
localAbort?.abort();
|
|
284755
285046
|
console.log(`
|
|
284756
|
-
${
|
|
285047
|
+
${import_picocolors16.default.dim("stopped.")}`);
|
|
284757
285048
|
process.exit(0);
|
|
284758
285049
|
};
|
|
284759
285050
|
process.on("SIGINT", stop);
|
|
@@ -284781,7 +285072,7 @@ function parseBranchDevArgs(argv) {
|
|
|
284781
285072
|
const arg = argv[index];
|
|
284782
285073
|
if (!arg) continue;
|
|
284783
285074
|
if (arg === "--no-branch") {
|
|
284784
|
-
throw new
|
|
285075
|
+
throw new import_errors14.AbloValidationError(
|
|
284785
285076
|
"--no-branch was removed: development is branch-isolated. Use --branch <slug> to select explicitly.",
|
|
284786
285077
|
{ code: "cli_invalid_arguments" }
|
|
284787
285078
|
);
|
|
@@ -284789,7 +285080,7 @@ function parseBranchDevArgs(argv) {
|
|
|
284789
285080
|
if (arg === "--branch") {
|
|
284790
285081
|
branchSlug = argv[++index];
|
|
284791
285082
|
if (!branchSlug) {
|
|
284792
|
-
throw new
|
|
285083
|
+
throw new import_errors14.AbloValidationError("--branch requires a slug", {
|
|
284793
285084
|
code: "cli_invalid_arguments"
|
|
284794
285085
|
});
|
|
284795
285086
|
}
|
|
@@ -284798,7 +285089,7 @@ function parseBranchDevArgs(argv) {
|
|
|
284798
285089
|
if (arg === "--branch-ttl-hours") {
|
|
284799
285090
|
const value = Number(argv[++index]);
|
|
284800
285091
|
if (!Number.isInteger(value) || value < 1 || value > 168) {
|
|
284801
|
-
throw new
|
|
285092
|
+
throw new import_errors14.AbloValidationError("--branch-ttl-hours must be between 1 and 168", {
|
|
284802
285093
|
code: "cli_invalid_arguments"
|
|
284803
285094
|
});
|
|
284804
285095
|
}
|
|
@@ -284816,12 +285107,12 @@ function parseBranchDevArgs(argv) {
|
|
|
284816
285107
|
function branchSlugFromRef(ref) {
|
|
284817
285108
|
const base = ref.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
284818
285109
|
if (!base) {
|
|
284819
|
-
throw new
|
|
285110
|
+
throw new import_errors14.AbloValidationError(`cannot derive an Ablo branch slug from "${ref}"`, {
|
|
284820
285111
|
code: "cli_invalid_arguments"
|
|
284821
285112
|
});
|
|
284822
285113
|
}
|
|
284823
285114
|
const nonRoot = base === "production" ? "production-dev" : base;
|
|
284824
|
-
const shortened = nonRoot.length <= 40 ? nonRoot : `${nonRoot.slice(0, 31).replace(/-+$/g, "")}-${(0,
|
|
285115
|
+
const shortened = nonRoot.length <= 40 ? nonRoot : `${nonRoot.slice(0, 31).replace(/-+$/g, "")}-${(0, import_node_crypto5.createHash)("sha256").update(nonRoot).digest("hex").slice(0, 8)}`;
|
|
284825
285116
|
return import_branches2.branchSlugSchema.parse(shortened);
|
|
284826
285117
|
}
|
|
284827
285118
|
function gitBranch() {
|
|
@@ -284838,7 +285129,7 @@ function gitBranch() {
|
|
|
284838
285129
|
function discoverBranchRef(explicit, env = process.env, readGitBranch = gitBranch) {
|
|
284839
285130
|
const value = explicit ?? env.ABLO_BRANCH ?? env.GITHUB_HEAD_REF ?? env.GITHUB_REF_NAME ?? env.VERCEL_GIT_COMMIT_REF ?? env.CI_COMMIT_REF_NAME ?? readGitBranch();
|
|
284840
285131
|
if (!value) {
|
|
284841
|
-
throw new
|
|
285132
|
+
throw new import_errors14.AbloValidationError(
|
|
284842
285133
|
"Could not determine the Git branch. Pass --branch <slug> or set ABLO_BRANCH.",
|
|
284843
285134
|
{ code: "cli_invalid_arguments" }
|
|
284844
285135
|
);
|
|
@@ -284856,13 +285147,13 @@ async function runBranchDev(argv, dependencies = {}) {
|
|
|
284856
285147
|
const slug = branchSlugFromRef(ref);
|
|
284857
285148
|
const managementKey = dependencies.resolveManagementKey?.() ?? resolveManagementKey();
|
|
284858
285149
|
if (!managementKey) {
|
|
284859
|
-
throw new
|
|
285150
|
+
throw new import_errors14.AbloValidationError(
|
|
284860
285151
|
"Creating a development branch needs a project management credential. Run `npx ablo login` or set ABLO_MANAGEMENT_KEY.",
|
|
284861
285152
|
{ code: "cli_invalid_arguments" }
|
|
284862
285153
|
);
|
|
284863
285154
|
}
|
|
284864
285155
|
if (!managementKey.startsWith("mk_")) {
|
|
284865
|
-
throw new
|
|
285156
|
+
throw new import_errors14.AbloValidationError(
|
|
284866
285157
|
"Branch creation needs the active project management credential (mk_\u2026). Run `npx ablo login` to refresh it.",
|
|
284867
285158
|
{ code: "cli_invalid_arguments" }
|
|
284868
285159
|
);
|
|
@@ -284890,8 +285181,8 @@ async function runBranchDev(argv, dependencies = {}) {
|
|
|
284890
285181
|
|
|
284891
285182
|
// src/whoami.ts
|
|
284892
285183
|
init_cjs_shims();
|
|
284893
|
-
var
|
|
284894
|
-
var
|
|
285184
|
+
var import_picocolors17 = __toESM(require_picocolors(), 1);
|
|
285185
|
+
var import_errors15 = require("@abloatai/transaction/errors");
|
|
284895
285186
|
init_config();
|
|
284896
285187
|
init_controlPlane();
|
|
284897
285188
|
|
|
@@ -284966,7 +285257,7 @@ function parseWhoamiArgs(argv) {
|
|
|
284966
285257
|
case "--key": {
|
|
284967
285258
|
const value = argv[++i];
|
|
284968
285259
|
if (!value || value.startsWith("--")) {
|
|
284969
|
-
throw new
|
|
285260
|
+
throw new import_errors15.AbloValidationError("`--key` needs a credential value.", {
|
|
284970
285261
|
code: "cli_invalid_arguments"
|
|
284971
285262
|
});
|
|
284972
285263
|
}
|
|
@@ -284976,12 +285267,12 @@ function parseWhoamiArgs(argv) {
|
|
|
284976
285267
|
case "--key-env": {
|
|
284977
285268
|
const value = argv[++i];
|
|
284978
285269
|
if (!value || value.startsWith("--")) {
|
|
284979
|
-
throw new
|
|
285270
|
+
throw new import_errors15.AbloValidationError("`--key-env` needs an environment variable name.", {
|
|
284980
285271
|
code: "cli_invalid_arguments"
|
|
284981
285272
|
});
|
|
284982
285273
|
}
|
|
284983
285274
|
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(value)) {
|
|
284984
|
-
throw new
|
|
285275
|
+
throw new import_errors15.AbloValidationError(
|
|
284985
285276
|
`\`${value}\` is not a valid environment variable name.`,
|
|
284986
285277
|
{ code: "cli_invalid_arguments" }
|
|
284987
285278
|
);
|
|
@@ -284990,13 +285281,13 @@ function parseWhoamiArgs(argv) {
|
|
|
284990
285281
|
break;
|
|
284991
285282
|
}
|
|
284992
285283
|
default:
|
|
284993
|
-
throw new
|
|
285284
|
+
throw new import_errors15.AbloValidationError(`unknown whoami flag: ${arg}`, {
|
|
284994
285285
|
code: "cli_invalid_arguments"
|
|
284995
285286
|
});
|
|
284996
285287
|
}
|
|
284997
285288
|
}
|
|
284998
285289
|
if (key && keyEnv) {
|
|
284999
|
-
throw new
|
|
285290
|
+
throw new import_errors15.AbloValidationError("Choose one credential source: `--key` or `--key-env`.", {
|
|
285000
285291
|
code: "cli_invalid_arguments"
|
|
285001
285292
|
});
|
|
285002
285293
|
}
|
|
@@ -285007,7 +285298,7 @@ function selectWhoamiCredential(args, cwd = process.cwd()) {
|
|
|
285007
285298
|
if (args.keyEnv) {
|
|
285008
285299
|
const found = readProjectEnvVariable(args.keyEnv, cwd);
|
|
285009
285300
|
if (!found) {
|
|
285010
|
-
throw new
|
|
285301
|
+
throw new import_errors15.AbloAuthenticationError(
|
|
285011
285302
|
`${args.keyEnv} is not set in the process environment, .env.local, or .env.`,
|
|
285012
285303
|
{ code: "cli_api_key_missing" }
|
|
285013
285304
|
);
|
|
@@ -285036,7 +285327,7 @@ function selectWhoamiCredential(args, cwd = process.cwd()) {
|
|
|
285036
285327
|
};
|
|
285037
285328
|
}
|
|
285038
285329
|
const ambient = ambientEnvKeyNote();
|
|
285039
|
-
throw new
|
|
285330
|
+
throw new import_errors15.AbloAuthenticationError(
|
|
285040
285331
|
`No credential found. Run \`ablo login\`, set ABLO_API_KEY, or pass \`--key-env <NAME>\`.${ambient ? `
|
|
285041
285332
|
|
|
285042
285333
|
${ambient}` : ""}`,
|
|
@@ -285054,7 +285345,7 @@ async function whoami(argv) {
|
|
|
285054
285345
|
});
|
|
285055
285346
|
const confirmed = target.confirmed;
|
|
285056
285347
|
if (!confirmed) {
|
|
285057
|
-
throw new
|
|
285348
|
+
throw new import_errors15.AbloAuthenticationError(
|
|
285058
285349
|
"The server did not confirm an identity for this credential.",
|
|
285059
285350
|
{ code: "identity_resolve_failed" }
|
|
285060
285351
|
);
|
|
@@ -285091,18 +285382,18 @@ async function whoami(argv) {
|
|
|
285091
285382
|
return;
|
|
285092
285383
|
}
|
|
285093
285384
|
console.log(`
|
|
285094
|
-
${brand("ablo")} ${
|
|
285385
|
+
${brand("ablo")} ${import_picocolors17.default.dim("whoami")}
|
|
285095
285386
|
`);
|
|
285096
285387
|
console.log(
|
|
285097
|
-
` ${
|
|
285388
|
+
` ${import_picocolors17.default.dim("key")} ${selected.key.slice(0, 12)}\u2026 ${import_picocolors17.default.dim(`(${selected.source} \xB7 ${capability.label})`)}`
|
|
285098
285389
|
);
|
|
285099
|
-
console.log(` ${
|
|
285390
|
+
console.log(` ${import_picocolors17.default.dim("org")} ${import_picocolors17.default.dim(confirmed.organizationId)}`);
|
|
285100
285391
|
console.log(
|
|
285101
|
-
` ${
|
|
285392
|
+
` ${import_picocolors17.default.dim("project")} ${import_picocolors17.default.bold(projectLabel)}${project ? ` ${import_picocolors17.default.dim(`(${project.id})`)}` : ""}`
|
|
285102
285393
|
);
|
|
285103
|
-
console.log(` ${
|
|
285394
|
+
console.log(` ${import_picocolors17.default.dim("acts on")} ${import_picocolors17.default.bold(actsOn)}`);
|
|
285104
285395
|
console.log(`
|
|
285105
|
-
${
|
|
285396
|
+
${import_picocolors17.default.green("\u2713")} ${import_picocolors17.default.dim("credential accepted; target confirmed by the server")}
|
|
285106
285397
|
`);
|
|
285107
285398
|
}
|
|
285108
285399
|
|
|
@@ -285111,14 +285402,14 @@ init_push();
|
|
|
285111
285402
|
|
|
285112
285403
|
// src/setup/run.ts
|
|
285113
285404
|
init_cjs_shims();
|
|
285114
|
-
var
|
|
285115
|
-
var
|
|
285405
|
+
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
285406
|
+
var import_errors16 = require("@abloatai/transaction/errors");
|
|
285116
285407
|
init_theme();
|
|
285117
285408
|
|
|
285118
285409
|
// src/setup/discover.ts
|
|
285119
285410
|
init_cjs_shims();
|
|
285120
|
-
var
|
|
285121
|
-
var
|
|
285411
|
+
var import_node_fs3 = require("fs");
|
|
285412
|
+
var import_node_crypto6 = require("crypto");
|
|
285122
285413
|
var import_node_child_process2 = require("child_process");
|
|
285123
285414
|
var import_node_path2 = require("path");
|
|
285124
285415
|
init_controlPlane();
|
|
@@ -285126,18 +285417,18 @@ init_config();
|
|
|
285126
285417
|
|
|
285127
285418
|
// src/doctor.ts
|
|
285128
285419
|
init_cjs_shims();
|
|
285129
|
-
var
|
|
285420
|
+
var import_picocolors18 = __toESM(require_picocolors(), 1);
|
|
285130
285421
|
init_theme();
|
|
285131
285422
|
init_controlPlane();
|
|
285132
285423
|
init_config();
|
|
285133
285424
|
init_target();
|
|
285134
285425
|
init_readiness();
|
|
285135
285426
|
function render(check2) {
|
|
285136
|
-
const mark = check2.state === "ok" ?
|
|
285427
|
+
const mark = check2.state === "ok" ? import_picocolors18.default.green("\u2713") : check2.state === "fail" ? import_picocolors18.default.red("\u2717") : import_picocolors18.default.dim("\u2013");
|
|
285137
285428
|
console.log(
|
|
285138
|
-
` ${mark} ${check2.label.padEnd(10)} ${check2.state === "fail" ? check2.detail :
|
|
285429
|
+
` ${mark} ${check2.label.padEnd(10)} ${check2.state === "fail" ? check2.detail : import_picocolors18.default.dim(check2.detail)}`
|
|
285139
285430
|
);
|
|
285140
|
-
if (check2.fix) console.log(` ${" ".repeat(11)}${
|
|
285431
|
+
if (check2.fix) console.log(` ${" ".repeat(11)}${import_picocolors18.default.dim(`\u2192 ${check2.fix}`)}`);
|
|
285141
285432
|
}
|
|
285142
285433
|
async function ping(apiUrl3) {
|
|
285143
285434
|
const ctrl = new AbortController();
|
|
@@ -285306,24 +285597,24 @@ async function inspectDoctor(options = {}) {
|
|
|
285306
285597
|
}
|
|
285307
285598
|
function renderDoctorReport(report) {
|
|
285308
285599
|
console.log(`
|
|
285309
|
-
${brand("ablo")} ${
|
|
285600
|
+
${brand("ablo")} ${import_picocolors18.default.dim("doctor")}
|
|
285310
285601
|
`);
|
|
285311
285602
|
for (const check2 of report.checks) render(check2);
|
|
285312
285603
|
console.log();
|
|
285313
285604
|
if (report.failed > 0) {
|
|
285314
285605
|
console.log(
|
|
285315
|
-
` ${
|
|
285606
|
+
` ${import_picocolors18.default.red("\u2717")} ${import_picocolors18.default.bold(`${report.failed} problem${report.failed === 1 ? "" : "s"}`)}` + import_picocolors18.default.dim(report.skipped > 0 ? `, ${report.skipped} check${report.skipped === 1 ? "" : "s"} skipped` : "")
|
|
285316
285607
|
);
|
|
285317
285608
|
console.log(
|
|
285318
|
-
|
|
285609
|
+
import_picocolors18.default.dim(" Fix them in the order above \u2014 an earlier one often explains a later one.")
|
|
285319
285610
|
);
|
|
285320
285611
|
} else if (report.skipped > 0) {
|
|
285321
285612
|
console.log(
|
|
285322
|
-
` ${
|
|
285613
|
+
` ${import_picocolors18.default.yellow("?")} ${import_picocolors18.default.dim(`nothing is blocking a write, but ${report.skipped} check${report.skipped === 1 ? "" : "s"} could not be run`)}`
|
|
285323
285614
|
);
|
|
285324
285615
|
} else {
|
|
285325
285616
|
console.log(
|
|
285326
|
-
` ${
|
|
285617
|
+
` ${import_picocolors18.default.green("\u2713")} ${import_picocolors18.default.dim("write infrastructure is ready \u2014 your database constraints and row-level policies still apply")}`
|
|
285327
285618
|
);
|
|
285328
285619
|
}
|
|
285329
285620
|
console.log();
|
|
@@ -285336,10 +285627,10 @@ async function doctor() {
|
|
|
285336
285627
|
|
|
285337
285628
|
// src/setup/contracts.ts
|
|
285338
285629
|
init_cjs_shims();
|
|
285339
|
-
var
|
|
285630
|
+
var import_zod6 = require("zod");
|
|
285340
285631
|
var SETUP_CONTRACT_VERSION = 1;
|
|
285341
|
-
var setupEvidenceSchema =
|
|
285342
|
-
source:
|
|
285632
|
+
var setupEvidenceSchema = import_zod6.z.object({
|
|
285633
|
+
source: import_zod6.z.enum([
|
|
285343
285634
|
"filesystem",
|
|
285344
285635
|
"package_manifest",
|
|
285345
285636
|
"git",
|
|
@@ -285349,32 +285640,32 @@ var setupEvidenceSchema = import_zod5.z.object({
|
|
|
285349
285640
|
"inference",
|
|
285350
285641
|
"user"
|
|
285351
285642
|
]),
|
|
285352
|
-
locator:
|
|
285353
|
-
detail:
|
|
285354
|
-
observedAt:
|
|
285643
|
+
locator: import_zod6.z.string().min(1).optional(),
|
|
285644
|
+
detail: import_zod6.z.string().min(1),
|
|
285645
|
+
observedAt: import_zod6.z.iso.datetime()
|
|
285355
285646
|
}).strict();
|
|
285356
|
-
var setupFactSchema =
|
|
285357
|
-
key:
|
|
285358
|
-
value:
|
|
285359
|
-
confidence:
|
|
285360
|
-
evidence:
|
|
285647
|
+
var setupFactSchema = import_zod6.z.object({
|
|
285648
|
+
key: import_zod6.z.string().min(1),
|
|
285649
|
+
value: import_zod6.z.json(),
|
|
285650
|
+
confidence: import_zod6.z.enum(["high", "medium", "low"]),
|
|
285651
|
+
evidence: import_zod6.z.array(setupEvidenceSchema).min(1)
|
|
285361
285652
|
}).strict();
|
|
285362
|
-
var setupCoordinationAdoptionDispositionSchema =
|
|
285653
|
+
var setupCoordinationAdoptionDispositionSchema = import_zod6.z.enum([
|
|
285363
285654
|
"existing_state_reuse_candidate",
|
|
285364
285655
|
"model_migration_required",
|
|
285365
285656
|
"coordination_path_undetermined"
|
|
285366
285657
|
]);
|
|
285367
|
-
var setupDecisionSchema =
|
|
285368
|
-
id:
|
|
285369
|
-
question:
|
|
285370
|
-
status:
|
|
285371
|
-
choices:
|
|
285372
|
-
value:
|
|
285373
|
-
label:
|
|
285374
|
-
consequence:
|
|
285658
|
+
var setupDecisionSchema = import_zod6.z.object({
|
|
285659
|
+
id: import_zod6.z.string().min(1),
|
|
285660
|
+
question: import_zod6.z.string().min(1),
|
|
285661
|
+
status: import_zod6.z.enum(["unresolved", "resolved", "not_applicable"]),
|
|
285662
|
+
choices: import_zod6.z.array(import_zod6.z.object({
|
|
285663
|
+
value: import_zod6.z.string().min(1),
|
|
285664
|
+
label: import_zod6.z.string().min(1),
|
|
285665
|
+
consequence: import_zod6.z.string().min(1)
|
|
285375
285666
|
}).strict()),
|
|
285376
|
-
selected:
|
|
285377
|
-
reason:
|
|
285667
|
+
selected: import_zod6.z.string().min(1).optional(),
|
|
285668
|
+
reason: import_zod6.z.string().min(1)
|
|
285378
285669
|
}).strict().superRefine((decision, ctx) => {
|
|
285379
285670
|
if (decision.status === "resolved" && decision.selected === void 0) {
|
|
285380
285671
|
ctx.addIssue({ code: "custom", message: "A resolved decision needs a selected value." });
|
|
@@ -285383,17 +285674,17 @@ var setupDecisionSchema = import_zod5.z.object({
|
|
|
285383
285674
|
ctx.addIssue({ code: "custom", message: "The selected value must be one of the choices." });
|
|
285384
285675
|
}
|
|
285385
285676
|
});
|
|
285386
|
-
var setupMutationClassSchema =
|
|
285677
|
+
var setupMutationClassSchema = import_zod6.z.enum([
|
|
285387
285678
|
"read_only",
|
|
285388
285679
|
"local_write",
|
|
285389
285680
|
"remote_write",
|
|
285390
285681
|
"database_write"
|
|
285391
285682
|
]);
|
|
285392
|
-
var setupApprovalClassSchema =
|
|
285393
|
-
var setupActionSchema =
|
|
285394
|
-
id:
|
|
285395
|
-
stepId:
|
|
285396
|
-
kind:
|
|
285683
|
+
var setupApprovalClassSchema = import_zod6.z.enum(["none", "review", "explicit"]);
|
|
285684
|
+
var setupActionSchema = import_zod6.z.object({
|
|
285685
|
+
id: import_zod6.z.string().min(1),
|
|
285686
|
+
stepId: import_zod6.z.string().min(1),
|
|
285687
|
+
kind: import_zod6.z.enum([
|
|
285397
285688
|
"inspect_repository",
|
|
285398
285689
|
"analyze_compatibility",
|
|
285399
285690
|
"select_application",
|
|
@@ -285408,20 +285699,20 @@ var setupActionSchema = import_zod5.z.object({
|
|
|
285408
285699
|
"verify",
|
|
285409
285700
|
"run_canary"
|
|
285410
285701
|
]),
|
|
285411
|
-
summary:
|
|
285702
|
+
summary: import_zod6.z.string().min(1),
|
|
285412
285703
|
mutation: setupMutationClassSchema,
|
|
285413
285704
|
approval: setupApprovalClassSchema,
|
|
285414
|
-
executor:
|
|
285415
|
-
status:
|
|
285416
|
-
blockedBy:
|
|
285417
|
-
paths:
|
|
285418
|
-
preconditions:
|
|
285705
|
+
executor: import_zod6.z.enum(["deterministic", "agent", "user"]).default("deterministic"),
|
|
285706
|
+
status: import_zod6.z.enum(["planned", "blocked", "not_needed"]),
|
|
285707
|
+
blockedBy: import_zod6.z.array(import_zod6.z.string().min(1)).default([]),
|
|
285708
|
+
paths: import_zod6.z.array(import_zod6.z.string().min(1)).default([]),
|
|
285709
|
+
preconditions: import_zod6.z.array(import_zod6.z.string().min(1)).default([])
|
|
285419
285710
|
}).strict();
|
|
285420
|
-
var setupMutationSiteSchema =
|
|
285421
|
-
path:
|
|
285422
|
-
line:
|
|
285423
|
-
kind:
|
|
285424
|
-
operation:
|
|
285711
|
+
var setupMutationSiteSchema = import_zod6.z.object({
|
|
285712
|
+
path: import_zod6.z.string().min(1),
|
|
285713
|
+
line: import_zod6.z.number().int().positive(),
|
|
285714
|
+
kind: import_zod6.z.enum(["prisma", "drizzle", "sql", "http", "ablo"]),
|
|
285715
|
+
operation: import_zod6.z.enum([
|
|
285425
285716
|
"create",
|
|
285426
285717
|
"update",
|
|
285427
285718
|
"delete",
|
|
@@ -285432,35 +285723,35 @@ var setupMutationSiteSchema = import_zod5.z.object({
|
|
|
285432
285723
|
"sql_write",
|
|
285433
285724
|
"http_write"
|
|
285434
285725
|
]),
|
|
285435
|
-
modelHint:
|
|
285436
|
-
confidence:
|
|
285726
|
+
modelHint: import_zod6.z.string().min(1).nullable(),
|
|
285727
|
+
confidence: import_zod6.z.enum(["high", "medium", "low"])
|
|
285437
285728
|
}).strict();
|
|
285438
|
-
var setupDatabaseColumnSchema =
|
|
285439
|
-
table:
|
|
285440
|
-
column:
|
|
285441
|
-
dataType:
|
|
285442
|
-
nullable:
|
|
285443
|
-
defaultExpression:
|
|
285444
|
-
generatedBy:
|
|
285729
|
+
var setupDatabaseColumnSchema = import_zod6.z.object({
|
|
285730
|
+
table: import_zod6.z.string().min(1),
|
|
285731
|
+
column: import_zod6.z.string().min(1),
|
|
285732
|
+
dataType: import_zod6.z.string().min(1),
|
|
285733
|
+
nullable: import_zod6.z.boolean(),
|
|
285734
|
+
defaultExpression: import_zod6.z.string().min(1).nullable(),
|
|
285735
|
+
generatedBy: import_zod6.z.enum(["application", "database"]).default("application")
|
|
285445
285736
|
}).strict();
|
|
285446
|
-
var setupCompatibilityBlockerCodeSchema =
|
|
285737
|
+
var setupCompatibilityBlockerCodeSchema = import_zod6.z.enum([
|
|
285447
285738
|
"database_schema_unavailable",
|
|
285448
285739
|
"identity_type_unsupported",
|
|
285449
285740
|
"stable_identity_missing"
|
|
285450
285741
|
]);
|
|
285451
|
-
var setupDatabaseMappingSchema =
|
|
285452
|
-
table:
|
|
285453
|
-
field:
|
|
285454
|
-
column:
|
|
285455
|
-
databaseType:
|
|
285742
|
+
var setupDatabaseMappingSchema = import_zod6.z.object({
|
|
285743
|
+
table: import_zod6.z.string().min(1),
|
|
285744
|
+
field: import_zod6.z.enum(["id", "organizationId", "createdBy"]),
|
|
285745
|
+
column: import_zod6.z.string().min(1).nullable(),
|
|
285746
|
+
databaseType: import_zod6.z.enum([
|
|
285456
285747
|
"text",
|
|
285457
285748
|
"uuid",
|
|
285458
285749
|
"bigint"
|
|
285459
285750
|
]).nullable(),
|
|
285460
|
-
generatedBy:
|
|
285461
|
-
status:
|
|
285462
|
-
reason:
|
|
285463
|
-
evidence:
|
|
285751
|
+
generatedBy: import_zod6.z.enum(["application", "ablo", "database"]).nullable(),
|
|
285752
|
+
status: import_zod6.z.enum(["ready", "review_required"]),
|
|
285753
|
+
reason: import_zod6.z.string().min(1),
|
|
285754
|
+
evidence: import_zod6.z.array(setupEvidenceSchema).min(1)
|
|
285464
285755
|
}).strict().superRefine((mapping, ctx) => {
|
|
285465
285756
|
if (mapping.column === null && (mapping.databaseType !== null || mapping.generatedBy !== null)) {
|
|
285466
285757
|
ctx.addIssue({
|
|
@@ -285475,53 +285766,53 @@ var setupDatabaseMappingSchema = import_zod5.z.object({
|
|
|
285475
285766
|
});
|
|
285476
285767
|
}
|
|
285477
285768
|
});
|
|
285478
|
-
var setupCompatibilityRemediationSchema =
|
|
285479
|
-
kind:
|
|
285480
|
-
summary:
|
|
285769
|
+
var setupCompatibilityRemediationSchema = import_zod6.z.object({
|
|
285770
|
+
kind: import_zod6.z.enum(["migration", "translation", "retain_direct_path", "unsupported"]),
|
|
285771
|
+
summary: import_zod6.z.string().min(1)
|
|
285481
285772
|
}).strict();
|
|
285482
|
-
var setupCompatibilityBlockerSchema =
|
|
285773
|
+
var setupCompatibilityBlockerSchema = import_zod6.z.object({
|
|
285483
285774
|
code: setupCompatibilityBlockerCodeSchema,
|
|
285484
|
-
table:
|
|
285485
|
-
field:
|
|
285486
|
-
observed:
|
|
285487
|
-
expected:
|
|
285488
|
-
remediations:
|
|
285489
|
-
evidence:
|
|
285775
|
+
table: import_zod6.z.string().min(1).nullable(),
|
|
285776
|
+
field: import_zod6.z.string().min(1).nullable(),
|
|
285777
|
+
observed: import_zod6.z.string().min(1),
|
|
285778
|
+
expected: import_zod6.z.string().min(1),
|
|
285779
|
+
remediations: import_zod6.z.array(setupCompatibilityRemediationSchema).min(1),
|
|
285780
|
+
evidence: import_zod6.z.array(setupEvidenceSchema).min(1)
|
|
285490
285781
|
}).strict();
|
|
285491
|
-
var incompatibleDispositionSchema =
|
|
285492
|
-
blockers:
|
|
285493
|
-
mappings:
|
|
285782
|
+
var incompatibleDispositionSchema = import_zod6.z.object({
|
|
285783
|
+
blockers: import_zod6.z.array(setupCompatibilityBlockerSchema).min(1),
|
|
285784
|
+
mappings: import_zod6.z.array(setupDatabaseMappingSchema)
|
|
285494
285785
|
}).strict();
|
|
285495
|
-
var setupCompatibilityDispositionSchema =
|
|
285496
|
-
|
|
285497
|
-
status:
|
|
285498
|
-
blockers:
|
|
285499
|
-
mappings:
|
|
285786
|
+
var setupCompatibilityDispositionSchema = import_zod6.z.discriminatedUnion("status", [
|
|
285787
|
+
import_zod6.z.object({
|
|
285788
|
+
status: import_zod6.z.literal("compatible"),
|
|
285789
|
+
blockers: import_zod6.z.array(import_zod6.z.never()).length(0),
|
|
285790
|
+
mappings: import_zod6.z.array(setupDatabaseMappingSchema)
|
|
285500
285791
|
}).strict(),
|
|
285501
|
-
incompatibleDispositionSchema.extend({ status:
|
|
285502
|
-
incompatibleDispositionSchema.extend({ status:
|
|
285503
|
-
incompatibleDispositionSchema.extend({ status:
|
|
285504
|
-
incompatibleDispositionSchema.extend({ status:
|
|
285792
|
+
incompatibleDispositionSchema.extend({ status: import_zod6.z.literal("migration_required") }),
|
|
285793
|
+
incompatibleDispositionSchema.extend({ status: import_zod6.z.literal("translation_required") }),
|
|
285794
|
+
incompatibleDispositionSchema.extend({ status: import_zod6.z.literal("migration_or_translation_required") }),
|
|
285795
|
+
incompatibleDispositionSchema.extend({ status: import_zod6.z.literal("unsupported") })
|
|
285505
285796
|
]);
|
|
285506
|
-
var setupAdaptationTaskSchema =
|
|
285507
|
-
schemaVersion:
|
|
285508
|
-
kind:
|
|
285509
|
-
recordId:
|
|
285510
|
-
actionId:
|
|
285511
|
-
repositoryRoot:
|
|
285512
|
-
applicationRoot:
|
|
285513
|
-
selectedModels:
|
|
285514
|
-
databaseMappings:
|
|
285515
|
-
discoveryHints:
|
|
285516
|
-
scope:
|
|
285517
|
-
allowedRoot:
|
|
285518
|
-
mustExploreBeyondHints:
|
|
285519
|
-
mayReadEnvironmentValues:
|
|
285520
|
-
maximumMutation:
|
|
285797
|
+
var setupAdaptationTaskSchema = import_zod6.z.object({
|
|
285798
|
+
schemaVersion: import_zod6.z.literal(SETUP_CONTRACT_VERSION),
|
|
285799
|
+
kind: import_zod6.z.literal("ablo_setup_adaptation_task"),
|
|
285800
|
+
recordId: import_zod6.z.string().min(1),
|
|
285801
|
+
actionId: import_zod6.z.string().min(1),
|
|
285802
|
+
repositoryRoot: import_zod6.z.string().min(1),
|
|
285803
|
+
applicationRoot: import_zod6.z.string().min(1),
|
|
285804
|
+
selectedModels: import_zod6.z.array(import_zod6.z.string().min(1)).min(1),
|
|
285805
|
+
databaseMappings: import_zod6.z.array(setupDatabaseMappingSchema).default([]),
|
|
285806
|
+
discoveryHints: import_zod6.z.array(setupMutationSiteSchema),
|
|
285807
|
+
scope: import_zod6.z.object({
|
|
285808
|
+
allowedRoot: import_zod6.z.string().min(1),
|
|
285809
|
+
mustExploreBeyondHints: import_zod6.z.literal(true),
|
|
285810
|
+
mayReadEnvironmentValues: import_zod6.z.literal(false),
|
|
285811
|
+
maximumMutation: import_zod6.z.literal("local_write")
|
|
285521
285812
|
}).strict(),
|
|
285522
|
-
objective:
|
|
285523
|
-
constraints:
|
|
285524
|
-
acceptanceCriteria:
|
|
285813
|
+
objective: import_zod6.z.string().min(1),
|
|
285814
|
+
constraints: import_zod6.z.array(import_zod6.z.string().min(1)).min(1),
|
|
285815
|
+
acceptanceCriteria: import_zod6.z.array(import_zod6.z.string().min(1)).min(1)
|
|
285525
285816
|
}).strict().superRefine((record, ctx) => {
|
|
285526
285817
|
if (record.applicationRoot !== record.scope.allowedRoot) {
|
|
285527
285818
|
ctx.addIssue({
|
|
@@ -285531,233 +285822,233 @@ var setupAdaptationTaskSchema = import_zod5.z.object({
|
|
|
285531
285822
|
});
|
|
285532
285823
|
}
|
|
285533
285824
|
});
|
|
285534
|
-
var setupSkillFileSchema =
|
|
285535
|
-
path:
|
|
285536
|
-
sha256:
|
|
285537
|
-
content:
|
|
285825
|
+
var setupSkillFileSchema = import_zod6.z.object({
|
|
285826
|
+
path: import_zod6.z.string().min(1),
|
|
285827
|
+
sha256: import_zod6.z.string().regex(/^[a-f0-9]{64}$/),
|
|
285828
|
+
content: import_zod6.z.string().min(1)
|
|
285538
285829
|
}).strict();
|
|
285539
|
-
var setupSkillBundleSchema =
|
|
285540
|
-
schemaVersion:
|
|
285541
|
-
kind:
|
|
285542
|
-
id:
|
|
285543
|
-
version:
|
|
285544
|
-
entrypoint:
|
|
285545
|
-
files:
|
|
285830
|
+
var setupSkillBundleSchema = import_zod6.z.object({
|
|
285831
|
+
schemaVersion: import_zod6.z.literal(SETUP_CONTRACT_VERSION),
|
|
285832
|
+
kind: import_zod6.z.literal("ablo_setup_skill"),
|
|
285833
|
+
id: import_zod6.z.literal("integrate-ablo"),
|
|
285834
|
+
version: import_zod6.z.string().min(1),
|
|
285835
|
+
entrypoint: import_zod6.z.literal("SKILL.md"),
|
|
285836
|
+
files: import_zod6.z.array(setupSkillFileSchema).min(1)
|
|
285546
285837
|
}).strict();
|
|
285547
|
-
var setupAgentBundleSchema =
|
|
285548
|
-
schemaVersion:
|
|
285549
|
-
kind:
|
|
285550
|
-
createdAt:
|
|
285838
|
+
var setupAgentBundleSchema = import_zod6.z.object({
|
|
285839
|
+
schemaVersion: import_zod6.z.literal(SETUP_CONTRACT_VERSION),
|
|
285840
|
+
kind: import_zod6.z.literal("ablo_setup_agent_bundle"),
|
|
285841
|
+
createdAt: import_zod6.z.iso.datetime(),
|
|
285551
285842
|
record: setupAdaptationTaskSchema,
|
|
285552
285843
|
skill: setupSkillBundleSchema
|
|
285553
285844
|
}).strict();
|
|
285554
|
-
var setupWorkspaceSnapshotSchema =
|
|
285555
|
-
schemaVersion:
|
|
285556
|
-
kind:
|
|
285557
|
-
repositoryRoot:
|
|
285558
|
-
capturedAt:
|
|
285559
|
-
truncated:
|
|
285560
|
-
files:
|
|
285561
|
-
path:
|
|
285562
|
-
fingerprint:
|
|
285563
|
-
size:
|
|
285564
|
-
protectedEnvironment:
|
|
285845
|
+
var setupWorkspaceSnapshotSchema = import_zod6.z.object({
|
|
285846
|
+
schemaVersion: import_zod6.z.literal(SETUP_CONTRACT_VERSION),
|
|
285847
|
+
kind: import_zod6.z.literal("ablo_setup_workspace_snapshot"),
|
|
285848
|
+
repositoryRoot: import_zod6.z.string().min(1),
|
|
285849
|
+
capturedAt: import_zod6.z.iso.datetime(),
|
|
285850
|
+
truncated: import_zod6.z.boolean(),
|
|
285851
|
+
files: import_zod6.z.array(import_zod6.z.object({
|
|
285852
|
+
path: import_zod6.z.string().min(1),
|
|
285853
|
+
fingerprint: import_zod6.z.string().regex(/^[a-f0-9]{64}$/),
|
|
285854
|
+
size: import_zod6.z.number().int().nonnegative(),
|
|
285855
|
+
protectedEnvironment: import_zod6.z.boolean()
|
|
285565
285856
|
}).strict())
|
|
285566
285857
|
}).strict();
|
|
285567
|
-
var setupDiffEvaluationSchema =
|
|
285568
|
-
schemaVersion:
|
|
285569
|
-
kind:
|
|
285570
|
-
createdAt:
|
|
285571
|
-
selectedModels:
|
|
285572
|
-
changes:
|
|
285573
|
-
path:
|
|
285574
|
-
kind:
|
|
285858
|
+
var setupDiffEvaluationSchema = import_zod6.z.object({
|
|
285859
|
+
schemaVersion: import_zod6.z.literal(SETUP_CONTRACT_VERSION),
|
|
285860
|
+
kind: import_zod6.z.literal("ablo_setup_diff_evaluation"),
|
|
285861
|
+
createdAt: import_zod6.z.iso.datetime(),
|
|
285862
|
+
selectedModels: import_zod6.z.array(import_zod6.z.string().min(1)).min(1),
|
|
285863
|
+
changes: import_zod6.z.array(import_zod6.z.object({
|
|
285864
|
+
path: import_zod6.z.string().min(1),
|
|
285865
|
+
kind: import_zod6.z.enum(["created", "modified", "deleted"])
|
|
285575
285866
|
}).strict()),
|
|
285576
|
-
checks:
|
|
285577
|
-
id:
|
|
285578
|
-
status:
|
|
285579
|
-
detail:
|
|
285580
|
-
evidencePaths:
|
|
285867
|
+
checks: import_zod6.z.array(import_zod6.z.object({
|
|
285868
|
+
id: import_zod6.z.string().min(1),
|
|
285869
|
+
status: import_zod6.z.enum(["pass", "fail", "review"]),
|
|
285870
|
+
detail: import_zod6.z.string().min(1),
|
|
285871
|
+
evidencePaths: import_zod6.z.array(import_zod6.z.string().min(1))
|
|
285581
285872
|
}).strict()),
|
|
285582
|
-
outcome:
|
|
285583
|
-
summary:
|
|
285873
|
+
outcome: import_zod6.z.enum(["candidate", "incomplete", "unsafe"]),
|
|
285874
|
+
summary: import_zod6.z.string().min(1)
|
|
285584
285875
|
}).strict();
|
|
285585
|
-
var setupEvalVerificationSchema =
|
|
285586
|
-
id:
|
|
285587
|
-
status:
|
|
285588
|
-
detail:
|
|
285589
|
-
durationMs:
|
|
285876
|
+
var setupEvalVerificationSchema = import_zod6.z.object({
|
|
285877
|
+
id: import_zod6.z.string().min(1),
|
|
285878
|
+
status: import_zod6.z.enum(["pass", "fail", "error"]),
|
|
285879
|
+
detail: import_zod6.z.string().min(1),
|
|
285880
|
+
durationMs: import_zod6.z.number().int().nonnegative()
|
|
285590
285881
|
}).strict();
|
|
285591
|
-
var setupAgentHandoffSchema =
|
|
285592
|
-
outcome:
|
|
285593
|
-
changedFiles:
|
|
285594
|
-
exploredWritePaths:
|
|
285595
|
-
model:
|
|
285596
|
-
path:
|
|
285597
|
-
role:
|
|
285882
|
+
var setupAgentHandoffSchema = import_zod6.z.object({
|
|
285883
|
+
outcome: import_zod6.z.enum(["candidate", "blocked", "failed"]),
|
|
285884
|
+
changedFiles: import_zod6.z.array(import_zod6.z.string().min(1)),
|
|
285885
|
+
exploredWritePaths: import_zod6.z.array(import_zod6.z.object({
|
|
285886
|
+
model: import_zod6.z.string().min(1),
|
|
285887
|
+
path: import_zod6.z.string().min(1),
|
|
285888
|
+
role: import_zod6.z.string().min(1)
|
|
285598
285889
|
}).strict()),
|
|
285599
|
-
directWriteExceptions:
|
|
285600
|
-
path:
|
|
285601
|
-
reason:
|
|
285890
|
+
directWriteExceptions: import_zod6.z.array(import_zod6.z.object({
|
|
285891
|
+
path: import_zod6.z.string().min(1),
|
|
285892
|
+
reason: import_zod6.z.string().min(1)
|
|
285602
285893
|
}).strict()),
|
|
285603
|
-
verification:
|
|
285604
|
-
command:
|
|
285605
|
-
exitCode:
|
|
285606
|
-
result:
|
|
285894
|
+
verification: import_zod6.z.array(import_zod6.z.object({
|
|
285895
|
+
command: import_zod6.z.string().min(1),
|
|
285896
|
+
exitCode: import_zod6.z.number().int().nullable(),
|
|
285897
|
+
result: import_zod6.z.string().min(1)
|
|
285607
285898
|
}).strict()),
|
|
285608
|
-
blockers:
|
|
285899
|
+
blockers: import_zod6.z.array(import_zod6.z.string().min(1))
|
|
285609
285900
|
}).strict();
|
|
285610
|
-
var setupEvalResultSchema =
|
|
285611
|
-
schemaVersion:
|
|
285612
|
-
kind:
|
|
285613
|
-
caseId:
|
|
285614
|
-
runner:
|
|
285615
|
-
model:
|
|
285616
|
-
startedAt:
|
|
285617
|
-
finishedAt:
|
|
285618
|
-
durationMs:
|
|
285619
|
-
agent:
|
|
285620
|
-
status:
|
|
285621
|
-
exitCode:
|
|
285901
|
+
var setupEvalResultSchema = import_zod6.z.object({
|
|
285902
|
+
schemaVersion: import_zod6.z.literal(SETUP_CONTRACT_VERSION),
|
|
285903
|
+
kind: import_zod6.z.literal("ablo_setup_eval_result"),
|
|
285904
|
+
caseId: import_zod6.z.string().min(1),
|
|
285905
|
+
runner: import_zod6.z.string().min(1),
|
|
285906
|
+
model: import_zod6.z.string().min(1).nullable(),
|
|
285907
|
+
startedAt: import_zod6.z.iso.datetime(),
|
|
285908
|
+
finishedAt: import_zod6.z.iso.datetime(),
|
|
285909
|
+
durationMs: import_zod6.z.number().int().nonnegative(),
|
|
285910
|
+
agent: import_zod6.z.object({
|
|
285911
|
+
status: import_zod6.z.enum(["completed", "failed", "timed_out"]),
|
|
285912
|
+
exitCode: import_zod6.z.number().int().nullable(),
|
|
285622
285913
|
handoff: setupAgentHandoffSchema.nullable()
|
|
285623
285914
|
}).strict(),
|
|
285624
285915
|
diff: setupDiffEvaluationSchema,
|
|
285625
|
-
verification:
|
|
285626
|
-
outcome:
|
|
285627
|
-
summary:
|
|
285916
|
+
verification: import_zod6.z.array(setupEvalVerificationSchema),
|
|
285917
|
+
outcome: import_zod6.z.enum(["passed", "blocked", "failed", "incomplete", "unsafe"]),
|
|
285918
|
+
summary: import_zod6.z.string().min(1)
|
|
285628
285919
|
}).strict();
|
|
285629
|
-
var setupRepositoryBenchmarkCaseSchema =
|
|
285630
|
-
schemaVersion:
|
|
285631
|
-
kind:
|
|
285632
|
-
caseId:
|
|
285633
|
-
repository:
|
|
285634
|
-
url:
|
|
285635
|
-
commit:
|
|
285920
|
+
var setupRepositoryBenchmarkCaseSchema = import_zod6.z.object({
|
|
285921
|
+
schemaVersion: import_zod6.z.literal(SETUP_CONTRACT_VERSION),
|
|
285922
|
+
kind: import_zod6.z.literal("ablo_setup_repository_benchmark_case"),
|
|
285923
|
+
caseId: import_zod6.z.string().min(1),
|
|
285924
|
+
repository: import_zod6.z.object({
|
|
285925
|
+
url: import_zod6.z.url(),
|
|
285926
|
+
commit: import_zod6.z.string().regex(/^[a-f0-9]{40}$/)
|
|
285636
285927
|
}).strict(),
|
|
285637
|
-
expectations:
|
|
285638
|
-
applicationRoot:
|
|
285639
|
-
persistenceIncludes:
|
|
285640
|
-
requiredMutationPaths:
|
|
285641
|
-
forbiddenMutationPathPrefixes:
|
|
285928
|
+
expectations: import_zod6.z.object({
|
|
285929
|
+
applicationRoot: import_zod6.z.string().min(1),
|
|
285930
|
+
persistenceIncludes: import_zod6.z.array(import_zod6.z.string().min(1)),
|
|
285931
|
+
requiredMutationPaths: import_zod6.z.array(import_zod6.z.string().min(1)),
|
|
285932
|
+
forbiddenMutationPathPrefixes: import_zod6.z.array(import_zod6.z.string().min(1)),
|
|
285642
285933
|
coordinationAdoption: setupCoordinationAdoptionDispositionSchema
|
|
285643
285934
|
}).strict()
|
|
285644
285935
|
}).strict();
|
|
285645
|
-
var setupRepositoryBenchmarkResultSchema =
|
|
285646
|
-
schemaVersion:
|
|
285647
|
-
kind:
|
|
285648
|
-
caseId:
|
|
285649
|
-
repositoryUrl:
|
|
285650
|
-
commit:
|
|
285651
|
-
checks:
|
|
285652
|
-
id:
|
|
285653
|
-
status:
|
|
285654
|
-
detail:
|
|
285936
|
+
var setupRepositoryBenchmarkResultSchema = import_zod6.z.object({
|
|
285937
|
+
schemaVersion: import_zod6.z.literal(SETUP_CONTRACT_VERSION),
|
|
285938
|
+
kind: import_zod6.z.literal("ablo_setup_repository_benchmark_result"),
|
|
285939
|
+
caseId: import_zod6.z.string().min(1),
|
|
285940
|
+
repositoryUrl: import_zod6.z.url(),
|
|
285941
|
+
commit: import_zod6.z.string().regex(/^[a-f0-9]{40}$/),
|
|
285942
|
+
checks: import_zod6.z.array(import_zod6.z.object({
|
|
285943
|
+
id: import_zod6.z.string().min(1),
|
|
285944
|
+
status: import_zod6.z.enum(["pass", "fail"]),
|
|
285945
|
+
detail: import_zod6.z.string().min(1)
|
|
285655
285946
|
}).strict()),
|
|
285656
|
-
outcome:
|
|
285947
|
+
outcome: import_zod6.z.enum(["passed", "failed"])
|
|
285657
285948
|
}).strict();
|
|
285658
|
-
var setupStepResultBaseSchema =
|
|
285659
|
-
stepId:
|
|
285660
|
-
summary:
|
|
285661
|
-
facts:
|
|
285662
|
-
decisions:
|
|
285663
|
-
actions:
|
|
285664
|
-
startedAt:
|
|
285665
|
-
finishedAt:
|
|
285949
|
+
var setupStepResultBaseSchema = import_zod6.z.object({
|
|
285950
|
+
stepId: import_zod6.z.string().min(1),
|
|
285951
|
+
summary: import_zod6.z.string().min(1),
|
|
285952
|
+
facts: import_zod6.z.array(setupFactSchema).default([]),
|
|
285953
|
+
decisions: import_zod6.z.array(setupDecisionSchema).default([]),
|
|
285954
|
+
actions: import_zod6.z.array(setupActionSchema).default([]),
|
|
285955
|
+
startedAt: import_zod6.z.iso.datetime(),
|
|
285956
|
+
finishedAt: import_zod6.z.iso.datetime()
|
|
285666
285957
|
}).strict();
|
|
285667
|
-
var setupStepResultSchema =
|
|
285668
|
-
setupStepResultBaseSchema.extend({ status:
|
|
285958
|
+
var setupStepResultSchema = import_zod6.z.discriminatedUnion("status", [
|
|
285959
|
+
setupStepResultBaseSchema.extend({ status: import_zod6.z.literal("complete") }),
|
|
285669
285960
|
setupStepResultBaseSchema.extend({
|
|
285670
|
-
status:
|
|
285671
|
-
next:
|
|
285961
|
+
status: import_zod6.z.literal("incomplete"),
|
|
285962
|
+
next: import_zod6.z.string().min(1)
|
|
285672
285963
|
}),
|
|
285673
285964
|
setupStepResultBaseSchema.extend({
|
|
285674
|
-
status:
|
|
285675
|
-
blockers:
|
|
285676
|
-
next:
|
|
285965
|
+
status: import_zod6.z.literal("blocked"),
|
|
285966
|
+
blockers: import_zod6.z.array(import_zod6.z.string().min(1)).min(1),
|
|
285967
|
+
next: import_zod6.z.string().min(1)
|
|
285677
285968
|
}),
|
|
285678
285969
|
setupStepResultBaseSchema.extend({
|
|
285679
|
-
status:
|
|
285680
|
-
error:
|
|
285681
|
-
code:
|
|
285682
|
-
message:
|
|
285970
|
+
status: import_zod6.z.literal("failed"),
|
|
285971
|
+
error: import_zod6.z.object({
|
|
285972
|
+
code: import_zod6.z.string().min(1),
|
|
285973
|
+
message: import_zod6.z.string().min(1)
|
|
285683
285974
|
}).strict()
|
|
285684
285975
|
})
|
|
285685
285976
|
]);
|
|
285686
|
-
var setupTargetSchema =
|
|
285687
|
-
repositoryRoot:
|
|
285688
|
-
applicationRoot:
|
|
285689
|
-
packageName:
|
|
285690
|
-
abloProjectId:
|
|
285691
|
-
abloBranchId:
|
|
285692
|
-
databaseFingerprint:
|
|
285693
|
-
localSchemaDigest:
|
|
285694
|
-
pushedSchemaDigest:
|
|
285977
|
+
var setupTargetSchema = import_zod6.z.object({
|
|
285978
|
+
repositoryRoot: import_zod6.z.string().min(1),
|
|
285979
|
+
applicationRoot: import_zod6.z.string().min(1).nullable(),
|
|
285980
|
+
packageName: import_zod6.z.string().min(1).nullable(),
|
|
285981
|
+
abloProjectId: import_zod6.z.string().min(1).nullable(),
|
|
285982
|
+
abloBranchId: import_zod6.z.string().min(1).nullable(),
|
|
285983
|
+
databaseFingerprint: import_zod6.z.string().min(1).nullable(),
|
|
285984
|
+
localSchemaDigest: import_zod6.z.string().min(1).nullable(),
|
|
285985
|
+
pushedSchemaDigest: import_zod6.z.string().min(1).nullable()
|
|
285695
285986
|
}).strict();
|
|
285696
|
-
var setupPostconditionSchema =
|
|
285697
|
-
id:
|
|
285698
|
-
description:
|
|
285699
|
-
status:
|
|
285700
|
-
evidence:
|
|
285987
|
+
var setupPostconditionSchema = import_zod6.z.object({
|
|
285988
|
+
id: import_zod6.z.string().min(1),
|
|
285989
|
+
description: import_zod6.z.string().min(1),
|
|
285990
|
+
status: import_zod6.z.enum(["unverified", "satisfied", "unsatisfied", "blocked"]),
|
|
285991
|
+
evidence: import_zod6.z.array(setupEvidenceSchema).default([])
|
|
285701
285992
|
}).strict();
|
|
285702
|
-
var setupInitPlanProjectionSchema =
|
|
285703
|
-
root:
|
|
285704
|
-
actions:
|
|
285705
|
-
kind:
|
|
285706
|
-
path:
|
|
285707
|
-
note:
|
|
285708
|
-
precondition:
|
|
285709
|
-
|
|
285710
|
-
|
|
285711
|
-
kind:
|
|
285712
|
-
sha256:
|
|
285993
|
+
var setupInitPlanProjectionSchema = import_zod6.z.object({
|
|
285994
|
+
root: import_zod6.z.string().min(1),
|
|
285995
|
+
actions: import_zod6.z.array(import_zod6.z.object({
|
|
285996
|
+
kind: import_zod6.z.enum(["create", "update", "unchanged"]),
|
|
285997
|
+
path: import_zod6.z.string().min(1),
|
|
285998
|
+
note: import_zod6.z.string().optional(),
|
|
285999
|
+
precondition: import_zod6.z.discriminatedUnion("kind", [
|
|
286000
|
+
import_zod6.z.object({ kind: import_zod6.z.literal("absent") }).strict(),
|
|
286001
|
+
import_zod6.z.object({
|
|
286002
|
+
kind: import_zod6.z.literal("content"),
|
|
286003
|
+
sha256: import_zod6.z.string().regex(/^[a-f0-9]{64}$/)
|
|
285713
286004
|
}).strict()
|
|
285714
286005
|
]).optional()
|
|
285715
286006
|
}).strict()),
|
|
285716
|
-
conflicts:
|
|
285717
|
-
path:
|
|
285718
|
-
reason:
|
|
286007
|
+
conflicts: import_zod6.z.array(import_zod6.z.object({
|
|
286008
|
+
path: import_zod6.z.string().min(1),
|
|
286009
|
+
reason: import_zod6.z.literal("occupied")
|
|
285719
286010
|
}).strict())
|
|
285720
286011
|
}).strict();
|
|
285721
|
-
var setupInitResultSchema =
|
|
285722
|
-
status:
|
|
286012
|
+
var setupInitResultSchema = import_zod6.z.object({
|
|
286013
|
+
status: import_zod6.z.enum(["planned", "applied"]),
|
|
285723
286014
|
plan: setupInitPlanProjectionSchema
|
|
285724
286015
|
}).strict();
|
|
285725
|
-
var setupPlanSchema =
|
|
285726
|
-
schemaVersion:
|
|
285727
|
-
kind:
|
|
285728
|
-
mode:
|
|
285729
|
-
createdAt:
|
|
286016
|
+
var setupPlanSchema = import_zod6.z.object({
|
|
286017
|
+
schemaVersion: import_zod6.z.literal(SETUP_CONTRACT_VERSION),
|
|
286018
|
+
kind: import_zod6.z.literal("ablo_setup_plan"),
|
|
286019
|
+
mode: import_zod6.z.literal("plan"),
|
|
286020
|
+
createdAt: import_zod6.z.iso.datetime(),
|
|
285730
286021
|
target: setupTargetSchema,
|
|
285731
286022
|
compatibility: setupCompatibilityDispositionSchema,
|
|
285732
|
-
steps:
|
|
285733
|
-
facts:
|
|
285734
|
-
decisions:
|
|
285735
|
-
actions:
|
|
285736
|
-
postconditions:
|
|
285737
|
-
outcome:
|
|
285738
|
-
summary:
|
|
286023
|
+
steps: import_zod6.z.array(setupStepResultSchema),
|
|
286024
|
+
facts: import_zod6.z.array(setupFactSchema),
|
|
286025
|
+
decisions: import_zod6.z.array(setupDecisionSchema),
|
|
286026
|
+
actions: import_zod6.z.array(setupActionSchema),
|
|
286027
|
+
postconditions: import_zod6.z.array(setupPostconditionSchema),
|
|
286028
|
+
outcome: import_zod6.z.enum(["ready_to_apply", "needs_decisions", "blocked"]),
|
|
286029
|
+
summary: import_zod6.z.string().min(1)
|
|
285739
286030
|
}).strict();
|
|
285740
|
-
var setupCheckpointSchema =
|
|
285741
|
-
schemaVersion:
|
|
285742
|
-
kind:
|
|
285743
|
-
programId:
|
|
285744
|
-
repositoryRoot:
|
|
285745
|
-
createdAt:
|
|
285746
|
-
updatedAt:
|
|
285747
|
-
completedStepIds:
|
|
285748
|
-
results:
|
|
286031
|
+
var setupCheckpointSchema = import_zod6.z.object({
|
|
286032
|
+
schemaVersion: import_zod6.z.literal(SETUP_CONTRACT_VERSION),
|
|
286033
|
+
kind: import_zod6.z.literal("ablo_setup_checkpoint"),
|
|
286034
|
+
programId: import_zod6.z.string().min(1),
|
|
286035
|
+
repositoryRoot: import_zod6.z.string().min(1),
|
|
286036
|
+
createdAt: import_zod6.z.iso.datetime(),
|
|
286037
|
+
updatedAt: import_zod6.z.iso.datetime(),
|
|
286038
|
+
completedStepIds: import_zod6.z.array(import_zod6.z.string().min(1)),
|
|
286039
|
+
results: import_zod6.z.array(setupStepResultSchema)
|
|
285749
286040
|
}).strict();
|
|
285750
|
-
var setupReportSchema =
|
|
285751
|
-
schemaVersion:
|
|
285752
|
-
kind:
|
|
285753
|
-
createdAt:
|
|
286041
|
+
var setupReportSchema = import_zod6.z.object({
|
|
286042
|
+
schemaVersion: import_zod6.z.literal(SETUP_CONTRACT_VERSION),
|
|
286043
|
+
kind: import_zod6.z.literal("ablo_setup_report"),
|
|
286044
|
+
createdAt: import_zod6.z.iso.datetime(),
|
|
285754
286045
|
target: setupTargetSchema,
|
|
285755
|
-
outcome:
|
|
285756
|
-
facts:
|
|
285757
|
-
decisions:
|
|
285758
|
-
actions:
|
|
285759
|
-
postconditions:
|
|
285760
|
-
next:
|
|
286046
|
+
outcome: import_zod6.z.enum(["complete", "incomplete", "blocked", "failed"]),
|
|
286047
|
+
facts: import_zod6.z.array(setupFactSchema),
|
|
286048
|
+
decisions: import_zod6.z.array(setupDecisionSchema),
|
|
286049
|
+
actions: import_zod6.z.array(setupActionSchema),
|
|
286050
|
+
postconditions: import_zod6.z.array(setupPostconditionSchema),
|
|
286051
|
+
next: import_zod6.z.array(import_zod6.z.string().min(1))
|
|
285761
286052
|
}).strict();
|
|
285762
286053
|
|
|
285763
286054
|
// src/setup/program.ts
|
|
@@ -286132,7 +286423,7 @@ function walkFiles(root, maxDepth = 5) {
|
|
|
286132
286423
|
const current = stack.pop();
|
|
286133
286424
|
let entries;
|
|
286134
286425
|
try {
|
|
286135
|
-
entries = (0,
|
|
286426
|
+
entries = (0, import_node_fs3.readdirSync)(current.path, { withFileTypes: true });
|
|
286136
286427
|
} catch {
|
|
286137
286428
|
continue;
|
|
286138
286429
|
}
|
|
@@ -286152,7 +286443,7 @@ function walkFiles(root, maxDepth = 5) {
|
|
|
286152
286443
|
}
|
|
286153
286444
|
function readManifest(path) {
|
|
286154
286445
|
try {
|
|
286155
|
-
const parsed = JSON.parse((0,
|
|
286446
|
+
const parsed = JSON.parse((0, import_node_fs3.readFileSync)(path, "utf8"));
|
|
286156
286447
|
return {
|
|
286157
286448
|
root: (0, import_node_path2.resolve)(path, ".."),
|
|
286158
286449
|
name: typeof parsed.name === "string" ? parsed.name : null,
|
|
@@ -286229,8 +286520,8 @@ function detectedPersistence(manifest, files) {
|
|
|
286229
286520
|
if (!SOURCE_EXTENSIONS.has(sourceExtension(path))) continue;
|
|
286230
286521
|
let source;
|
|
286231
286522
|
try {
|
|
286232
|
-
if ((0,
|
|
286233
|
-
source = (0,
|
|
286523
|
+
if ((0, import_node_fs3.lstatSync)(path).size > MAX_SOURCE_BYTES) continue;
|
|
286524
|
+
source = (0, import_node_fs3.readFileSync)(path, "utf8");
|
|
286234
286525
|
} catch {
|
|
286235
286526
|
continue;
|
|
286236
286527
|
}
|
|
@@ -286258,17 +286549,17 @@ function coordinationAdoptionReason(disposition, persistence) {
|
|
|
286258
286549
|
}
|
|
286259
286550
|
}
|
|
286260
286551
|
function packageManager(root) {
|
|
286261
|
-
if ((0,
|
|
286262
|
-
if ((0,
|
|
286263
|
-
if ((0,
|
|
286552
|
+
if ((0, import_node_fs3.existsSync)((0, import_node_path2.join)(root, "pnpm-lock.yaml"))) return "pnpm";
|
|
286553
|
+
if ((0, import_node_fs3.existsSync)((0, import_node_path2.join)(root, "yarn.lock"))) return "yarn";
|
|
286554
|
+
if ((0, import_node_fs3.existsSync)((0, import_node_path2.join)(root, "bun.lockb")) || (0, import_node_fs3.existsSync)((0, import_node_path2.join)(root, "bun.lock"))) return "bun";
|
|
286264
286555
|
return "npm";
|
|
286265
286556
|
}
|
|
286266
286557
|
function environmentKeyNames(root) {
|
|
286267
286558
|
const names = [".env.local", ".env.development.local", ".env.development", ".env"];
|
|
286268
286559
|
return names.flatMap((name) => {
|
|
286269
286560
|
const path = (0, import_node_path2.join)(root, name);
|
|
286270
|
-
if (!(0,
|
|
286271
|
-
const keys = (0,
|
|
286561
|
+
if (!(0, import_node_fs3.existsSync)(path)) return [];
|
|
286562
|
+
const keys = (0, import_node_fs3.readFileSync)(path, "utf8").split(/\r?\n/).flatMap((line) => {
|
|
286272
286563
|
const match = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=/.exec(line);
|
|
286273
286564
|
return match ? [match[1]] : [];
|
|
286274
286565
|
});
|
|
@@ -286283,8 +286574,8 @@ function abloSourceFiles(root, files) {
|
|
|
286283
286574
|
return files.flatMap((path) => {
|
|
286284
286575
|
if (!SOURCE_EXTENSIONS.has(sourceExtension(path))) return [];
|
|
286285
286576
|
try {
|
|
286286
|
-
if ((0,
|
|
286287
|
-
return (0,
|
|
286577
|
+
if ((0, import_node_fs3.lstatSync)(path).size > MAX_SOURCE_BYTES) return [];
|
|
286578
|
+
return (0, import_node_fs3.readFileSync)(path, "utf8").includes("@abloatai/") ? [(0, import_node_path2.relative)(root, path) || "."] : [];
|
|
286288
286579
|
} catch {
|
|
286289
286580
|
return [];
|
|
286290
286581
|
}
|
|
@@ -286311,8 +286602,8 @@ function discoverMutationSites(root, files) {
|
|
|
286311
286602
|
if (!SOURCE_EXTENSIONS.has(sourceExtension(path))) continue;
|
|
286312
286603
|
let source;
|
|
286313
286604
|
try {
|
|
286314
|
-
if ((0,
|
|
286315
|
-
source = (0,
|
|
286605
|
+
if ((0, import_node_fs3.lstatSync)(path).size > MAX_SOURCE_BYTES) continue;
|
|
286606
|
+
source = (0, import_node_fs3.readFileSync)(path, "utf8");
|
|
286316
286607
|
} catch {
|
|
286317
286608
|
continue;
|
|
286318
286609
|
}
|
|
@@ -286352,9 +286643,9 @@ function isProductionMutationFile(root, path) {
|
|
|
286352
286643
|
return !/(?:^|\/)(?:test|tests|__tests__|scripts)(?:\/|$)/.test(locator) && !/\.(?:test|spec)\.[cm]?[jt]sx?$/.test(locator);
|
|
286353
286644
|
}
|
|
286354
286645
|
function digestFile(path) {
|
|
286355
|
-
if (!(0,
|
|
286646
|
+
if (!(0, import_node_fs3.existsSync)(path)) return null;
|
|
286356
286647
|
try {
|
|
286357
|
-
return (0,
|
|
286648
|
+
return (0, import_node_crypto6.createHash)("sha256").update((0, import_node_fs3.readFileSync)(path)).digest("hex");
|
|
286358
286649
|
} catch {
|
|
286359
286650
|
return null;
|
|
286360
286651
|
}
|
|
@@ -286398,8 +286689,8 @@ function localDiscoveryStep(state) {
|
|
|
286398
286689
|
if (!SOURCE_EXTENSIONS.has(sourceExtension(path))) continue;
|
|
286399
286690
|
let source;
|
|
286400
286691
|
try {
|
|
286401
|
-
if ((0,
|
|
286402
|
-
source = (0,
|
|
286692
|
+
if ((0, import_node_fs3.lstatSync)(path).size > MAX_SOURCE_BYTES) continue;
|
|
286693
|
+
source = (0, import_node_fs3.readFileSync)(path, "utf8");
|
|
286403
286694
|
} catch {
|
|
286404
286695
|
continue;
|
|
286405
286696
|
}
|
|
@@ -286440,8 +286731,8 @@ function localDiscoveryStep(state) {
|
|
|
286440
286731
|
"src/app/providers.tsx",
|
|
286441
286732
|
"app/api/ablo-session/route.ts",
|
|
286442
286733
|
"src/app/api/ablo-session/route.ts"
|
|
286443
|
-
].filter((path) => (0,
|
|
286444
|
-
const localSchemaPath = [(0, import_node_path2.join)(envRoot, "ablo", "schema.ts"), (0, import_node_path2.join)(envRoot, "src", "ablo", "schema.ts")].find((path) => (0,
|
|
286734
|
+
].filter((path) => (0, import_node_fs3.existsSync)((0, import_node_path2.join)(envRoot, path)));
|
|
286735
|
+
const localSchemaPath = [(0, import_node_path2.join)(envRoot, "ablo", "schema.ts"), (0, import_node_path2.join)(envRoot, "src", "ablo", "schema.ts")].find((path) => (0, import_node_fs3.existsSync)(path)) ?? (0, import_node_path2.join)(envRoot, "ablo", "schema.ts");
|
|
286445
286736
|
state.localSchemaDigest = digestFile(localSchemaPath);
|
|
286446
286737
|
const facts = [
|
|
286447
286738
|
fact("repository.root", root, "git", tryGit(root, ["rev-parse", "--show-toplevel"]) ? "Resolved from Git." : "No Git root was available; using the requested directory.", root),
|
|
@@ -286843,7 +287134,7 @@ function parseSetupArgs(args) {
|
|
|
286843
287134
|
if (arg === "--root") {
|
|
286844
287135
|
const next = args[index + 1];
|
|
286845
287136
|
if (!next || next.startsWith("-")) {
|
|
286846
|
-
throw new
|
|
287137
|
+
throw new import_errors16.AbloValidationError("`--root` requires a directory.", {
|
|
286847
287138
|
code: "cli_invalid_arguments"
|
|
286848
287139
|
});
|
|
286849
287140
|
}
|
|
@@ -286852,7 +287143,7 @@ function parseSetupArgs(args) {
|
|
|
286852
287143
|
continue;
|
|
286853
287144
|
}
|
|
286854
287145
|
if (!allowedFlags.has(arg)) {
|
|
286855
|
-
throw new
|
|
287146
|
+
throw new import_errors16.AbloValidationError(`Unknown setup option: ${arg}`, {
|
|
286856
287147
|
code: "cli_invalid_arguments"
|
|
286857
287148
|
});
|
|
286858
287149
|
}
|
|
@@ -286864,7 +287155,7 @@ function parseSetupArgs(args) {
|
|
|
286864
287155
|
};
|
|
286865
287156
|
}
|
|
286866
287157
|
function renderValue(value) {
|
|
286867
|
-
if (value === null) return
|
|
287158
|
+
if (value === null) return import_picocolors19.default.dim("unknown");
|
|
286868
287159
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
286869
287160
|
return String(value);
|
|
286870
287161
|
}
|
|
@@ -286876,69 +287167,69 @@ function renderStatus(value) {
|
|
|
286876
287167
|
}
|
|
286877
287168
|
function renderHumanPlan(plan) {
|
|
286878
287169
|
console.log(`
|
|
286879
|
-
${brand("ablo")} ${
|
|
287170
|
+
${brand("ablo")} ${import_picocolors19.default.dim("setup plan")} ${import_picocolors19.default.dim("(read-only)")}
|
|
286880
287171
|
`);
|
|
286881
|
-
console.log(` ${
|
|
287172
|
+
console.log(` ${import_picocolors19.default.bold("Target")}`);
|
|
286882
287173
|
console.log(` repository ${plan.target.repositoryRoot}`);
|
|
286883
|
-
console.log(` application ${plan.target.applicationRoot ??
|
|
286884
|
-
console.log(` package ${plan.target.packageName ??
|
|
286885
|
-
console.log(` project ${plan.target.abloProjectId ??
|
|
286886
|
-
console.log(` branch ${plan.target.abloBranchId ??
|
|
286887
|
-
console.log(` compatibility ${plan.compatibility.status === "compatible" ?
|
|
287174
|
+
console.log(` application ${plan.target.applicationRoot ?? import_picocolors19.default.yellow("unresolved")}`);
|
|
287175
|
+
console.log(` package ${plan.target.packageName ?? import_picocolors19.default.dim("unknown")}`);
|
|
287176
|
+
console.log(` project ${plan.target.abloProjectId ?? import_picocolors19.default.dim("unconfirmed")}`);
|
|
287177
|
+
console.log(` branch ${plan.target.abloBranchId ?? import_picocolors19.default.dim("unconfirmed")}`);
|
|
287178
|
+
console.log(` compatibility ${plan.compatibility.status === "compatible" ? import_picocolors19.default.green("compatible") : import_picocolors19.default.yellow(renderStatus(plan.compatibility.status))}`);
|
|
286888
287179
|
if (plan.compatibility.blockers.length > 0) {
|
|
286889
287180
|
console.log(`
|
|
286890
|
-
${
|
|
287181
|
+
${import_picocolors19.default.bold("Compatibility blockers")}`);
|
|
286891
287182
|
for (const blocker2 of plan.compatibility.blockers) {
|
|
286892
287183
|
const location = blocker2.table ? `${blocker2.table}${blocker2.field ? ` (${blocker2.field})` : ""}` : "Repository";
|
|
286893
|
-
console.log(` ${
|
|
287184
|
+
console.log(` ${import_picocolors19.default.bold(location)} ${import_picocolors19.default.yellow(renderStatus(blocker2.code))}`);
|
|
286894
287185
|
console.log(` ${blocker2.observed}`);
|
|
286895
|
-
console.log(` ${
|
|
287186
|
+
console.log(` ${import_picocolors19.default.dim(`Required: ${blocker2.expected}`)}`);
|
|
286896
287187
|
for (const remediation of blocker2.remediations) {
|
|
286897
|
-
console.log(` ${
|
|
287188
|
+
console.log(` ${import_picocolors19.default.dim(`${renderStatus(remediation.kind)} \u2014 ${remediation.summary}`)}`);
|
|
286898
287189
|
}
|
|
286899
287190
|
}
|
|
286900
287191
|
}
|
|
286901
287192
|
if (plan.compatibility.mappings.length > 0) {
|
|
286902
287193
|
console.log(`
|
|
286903
|
-
${
|
|
287194
|
+
${import_picocolors19.default.bold("Database mappings")}`);
|
|
286904
287195
|
for (const mapping of plan.compatibility.mappings) {
|
|
286905
287196
|
const target = mapping.column === null ? "disabled" : `${mapping.column} \xB7 ${mapping.databaseType ?? "unmapped"}`;
|
|
286906
|
-
const status2 = mapping.status === "ready" ?
|
|
287197
|
+
const status2 = mapping.status === "ready" ? import_picocolors19.default.green("ready") : import_picocolors19.default.yellow("review");
|
|
286907
287198
|
console.log(` ${`${mapping.table}.${mapping.field}`.padEnd(34)} ${target} \xB7 ${status2}`);
|
|
286908
|
-
if (mapping.status === "review_required") console.log(` ${
|
|
287199
|
+
if (mapping.status === "review_required") console.log(` ${import_picocolors19.default.dim(mapping.reason)}`);
|
|
286909
287200
|
}
|
|
286910
287201
|
}
|
|
286911
287202
|
console.log(`
|
|
286912
|
-
${
|
|
287203
|
+
${import_picocolors19.default.bold("Evidence")}`);
|
|
286913
287204
|
for (const item of plan.facts) {
|
|
286914
287205
|
console.log(` ${item.key.padEnd(34)} ${renderValue(item.value)}`);
|
|
286915
287206
|
}
|
|
286916
287207
|
console.log(`
|
|
286917
|
-
${
|
|
287208
|
+
${import_picocolors19.default.bold("Decisions")}`);
|
|
286918
287209
|
for (const decision of plan.decisions) {
|
|
286919
|
-
const marker = decision.status === "resolved" ?
|
|
287210
|
+
const marker = decision.status === "resolved" ? import_picocolors19.default.green("\u2713") : import_picocolors19.default.yellow("?");
|
|
286920
287211
|
console.log(` ${marker} ${decision.question}`);
|
|
286921
|
-
console.log(` ${
|
|
287212
|
+
console.log(` ${import_picocolors19.default.dim(decision.reason)}`);
|
|
286922
287213
|
}
|
|
286923
287214
|
console.log(`
|
|
286924
|
-
${
|
|
287215
|
+
${import_picocolors19.default.bold("Actions")}`);
|
|
286925
287216
|
for (const action of plan.actions) {
|
|
286926
|
-
const marker = action.status === "blocked" ?
|
|
286927
|
-
console.log(` ${marker.padEnd(18)} ${action.summary} ${
|
|
287217
|
+
const marker = action.status === "blocked" ? import_picocolors19.default.yellow("blocked") : import_picocolors19.default.green(action.status);
|
|
287218
|
+
console.log(` ${marker.padEnd(18)} ${action.summary} ${import_picocolors19.default.dim(`[${action.executor}]`)}`);
|
|
286928
287219
|
if (action.blockedBy.length > 0) {
|
|
286929
|
-
console.log(` ${
|
|
287220
|
+
console.log(` ${import_picocolors19.default.dim(`needs ${action.blockedBy.join(", ")}`)}`);
|
|
286930
287221
|
}
|
|
286931
287222
|
}
|
|
286932
287223
|
console.log(`
|
|
286933
|
-
${
|
|
287224
|
+
${import_picocolors19.default.bold("Result")} ${import_picocolors19.default.yellow(plan.outcome)}`);
|
|
286934
287225
|
console.log(` ${plan.summary}`);
|
|
286935
|
-
console.log(
|
|
287226
|
+
console.log(import_picocolors19.default.dim(" Machine-readable: npx ablo setup --plan --json"));
|
|
286936
287227
|
console.log();
|
|
286937
287228
|
}
|
|
286938
287229
|
async function runSetup(args) {
|
|
286939
287230
|
const options = parseSetupArgs(args);
|
|
286940
287231
|
if (options.json && !options.plan) {
|
|
286941
|
-
throw new
|
|
287232
|
+
throw new import_errors16.AbloValidationError(
|
|
286942
287233
|
"`--json` is a plan renderer. Use `ablo setup --plan --json`.",
|
|
286943
287234
|
{ code: "cli_invalid_arguments" }
|
|
286944
287235
|
);
|
|
@@ -287117,6 +287408,28 @@ var COMMANDS = [
|
|
|
287117
287408
|
]
|
|
287118
287409
|
}
|
|
287119
287410
|
},
|
|
287411
|
+
{
|
|
287412
|
+
// Sits beside `docs` on purpose. An agent that just failed to find an
|
|
287413
|
+
// answer is already reading this block, and the command that reports the
|
|
287414
|
+
// gap is the next line down rather than somewhere it would have to know to
|
|
287415
|
+
// look. Discoverability IS the feature: a channel an agent never finds
|
|
287416
|
+
// collects nothing.
|
|
287417
|
+
name: "feedback",
|
|
287418
|
+
usage: FEEDBACK_USAGE,
|
|
287419
|
+
core: { group: "More", does: "Tell us what got in your way, so the next agent does not hit it" },
|
|
287420
|
+
full: {
|
|
287421
|
+
group: "Read the docs",
|
|
287422
|
+
rows: [
|
|
287423
|
+
// The kinds come from the taxonomy rather than being spelled out here:
|
|
287424
|
+
// a help screen listing four when the schema knows five is the drift
|
|
287425
|
+
// this registry exists to stop.
|
|
287426
|
+
{ run: `feedback <${FEEDBACK_KINDS.join("|")}> "<one line>"`, does: "Report one wall you hit" },
|
|
287427
|
+
{ run: 'feedback bug "..." --detail <text>', does: "Add what happened, at length (`-` reads stdin)" },
|
|
287428
|
+
{ run: " [--command <name>] [--error-code <code>] [--from <agent>]" },
|
|
287429
|
+
{ run: " [--yes] [--json]" }
|
|
287430
|
+
]
|
|
287431
|
+
}
|
|
287432
|
+
},
|
|
287120
287433
|
{
|
|
287121
287434
|
name: "whoami",
|
|
287122
287435
|
usage: WHOAMI_USAGE,
|
|
@@ -287257,15 +287570,15 @@ function fullRows(group) {
|
|
|
287257
287570
|
}
|
|
287258
287571
|
|
|
287259
287572
|
// src/index.ts
|
|
287260
|
-
var
|
|
287573
|
+
var import_errors25 = require("@abloatai/transaction/errors");
|
|
287261
287574
|
init_push();
|
|
287262
287575
|
|
|
287263
287576
|
// src/generate.ts
|
|
287264
287577
|
init_cjs_shims();
|
|
287265
|
-
var
|
|
287578
|
+
var import_errors17 = require("@abloatai/transaction/errors");
|
|
287266
287579
|
var import_fs8 = require("fs");
|
|
287267
287580
|
var import_path6 = require("path");
|
|
287268
|
-
var
|
|
287581
|
+
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
287269
287582
|
var import_schema7 = require("@abloatai/transaction/schema");
|
|
287270
287583
|
init_push();
|
|
287271
287584
|
var DEFAULT_SCHEMA_PATH4 = "ablo/schema.ts";
|
|
@@ -287288,7 +287601,7 @@ function parseGenerateArgs(argv) {
|
|
|
287288
287601
|
out = argv[++i] ?? out;
|
|
287289
287602
|
break;
|
|
287290
287603
|
default:
|
|
287291
|
-
throw new
|
|
287604
|
+
throw new import_errors17.AbloValidationError(`unknown flag: ${arg}`, { code: "cli_invalid_arguments" });
|
|
287292
287605
|
}
|
|
287293
287606
|
}
|
|
287294
287607
|
return { schemaPath, exportName, out };
|
|
@@ -287298,7 +287611,7 @@ async function generate(argv) {
|
|
|
287298
287611
|
try {
|
|
287299
287612
|
args = parseGenerateArgs(argv);
|
|
287300
287613
|
} catch (err) {
|
|
287301
|
-
console.error(
|
|
287614
|
+
console.error(import_picocolors20.default.red(` ${err instanceof Error ? err.message : String(err)}`));
|
|
287302
287615
|
process.exit(1);
|
|
287303
287616
|
}
|
|
287304
287617
|
let source;
|
|
@@ -287307,21 +287620,21 @@ async function generate(argv) {
|
|
|
287307
287620
|
const schemaJson = JSON.parse((0, import_schema7.serializeSchema)(schema));
|
|
287308
287621
|
source = (0, import_schema7.generateTypes)(schemaJson);
|
|
287309
287622
|
} catch (err) {
|
|
287310
|
-
console.error(
|
|
287623
|
+
console.error(import_picocolors20.default.red(` ${err instanceof Error ? err.message : String(err)}`));
|
|
287311
287624
|
process.exit(1);
|
|
287312
287625
|
}
|
|
287313
287626
|
const abs = (0, import_path6.resolve)(process.cwd(), args.out);
|
|
287314
287627
|
(0, import_fs8.mkdirSync)((0, import_path6.dirname)(abs), { recursive: true });
|
|
287315
287628
|
(0, import_fs8.writeFileSync)(abs, source);
|
|
287316
|
-
console.log(` ${
|
|
287629
|
+
console.log(` ${import_picocolors20.default.green("\u2713")} Generated types \u2192 ${import_picocolors20.default.bold(args.out)}`);
|
|
287317
287630
|
}
|
|
287318
287631
|
|
|
287319
287632
|
// src/login.ts
|
|
287320
287633
|
init_cjs_shims();
|
|
287321
287634
|
var import_child_process2 = require("child_process");
|
|
287322
|
-
var
|
|
287635
|
+
var import_picocolors21 = __toESM(require_picocolors(), 1);
|
|
287323
287636
|
init_dist2();
|
|
287324
|
-
var
|
|
287637
|
+
var import_errors18 = require("@abloatai/transaction/errors");
|
|
287325
287638
|
var import_wire8 = require("@abloatai/transaction/wire");
|
|
287326
287639
|
init_config();
|
|
287327
287640
|
init_theme();
|
|
@@ -287383,9 +287696,9 @@ async function deviceLogin(argv, deps = {}) {
|
|
|
287383
287696
|
const code = await codeRes.json();
|
|
287384
287697
|
const approvePath = `/cli?user_code=${code.user_code}${targetOrg ? `&org=${encodeURIComponent(targetOrg)}` : ""}`;
|
|
287385
287698
|
const url = account === "signup" ? `${DASHBOARD_URL}/signup?next=${encodeURIComponent(approvePath)}` : `${DASHBOARD_URL}${approvePath}`;
|
|
287386
|
-
Me(`${
|
|
287699
|
+
Me(`${import_picocolors21.default.bold(code.user_code)}
|
|
287387
287700
|
|
|
287388
|
-
${
|
|
287701
|
+
${import_picocolors21.default.dim(url)}`, "Approve in your browser");
|
|
287389
287702
|
openUrl(url);
|
|
287390
287703
|
const s = Y2();
|
|
287391
287704
|
s.start("Waiting for approval\u2026");
|
|
@@ -287455,7 +287768,7 @@ ${import_picocolors20.default.dim(url)}`, "Approve in your browser");
|
|
|
287455
287768
|
}
|
|
287456
287769
|
if (!provRes.ok) {
|
|
287457
287770
|
s.stop("Could not provision a key.");
|
|
287458
|
-
const err = (0,
|
|
287771
|
+
const err = (0, import_errors18.translateHttpError)(
|
|
287459
287772
|
provRes.status,
|
|
287460
287773
|
await provRes.json().catch(() => null),
|
|
287461
287774
|
provRes.headers.get("x-request-id") ?? void 0
|
|
@@ -287463,11 +287776,11 @@ ${import_picocolors20.default.dim(url)}`, "Approve in your browser");
|
|
|
287463
287776
|
M2.error(err.message);
|
|
287464
287777
|
if (err.code === "entity_not_found" && targetProject) {
|
|
287465
287778
|
M2.error(
|
|
287466
|
-
`If that isn't the account you meant, run ${
|
|
287779
|
+
`If that isn't the account you meant, run ${import_picocolors21.default.bold("npx ablo logout")} and sign in again. Otherwise create it with ${import_picocolors21.default.bold(`npx ablo projects create ${targetProject}`)}.`
|
|
287467
287780
|
);
|
|
287468
287781
|
} else {
|
|
287469
287782
|
M2.error(
|
|
287470
|
-
`The browser approval succeeded but the credential handoff failed. Try ${
|
|
287783
|
+
`The browser approval succeeded but the credential handoff failed. Try ${import_picocolors21.default.bold("npx ablo login")} again.`
|
|
287471
287784
|
);
|
|
287472
287785
|
}
|
|
287473
287786
|
process.exit(1);
|
|
@@ -287478,7 +287791,7 @@ ${import_picocolors20.default.dim(url)}`, "Approve in your browser");
|
|
|
287478
287791
|
if (!parsedProv.success) {
|
|
287479
287792
|
s.stop("Could not provision a key.");
|
|
287480
287793
|
M2.error("The key handoff returned something this version does not recognize.");
|
|
287481
|
-
M2.error(`Try again, or upgrade with ${
|
|
287794
|
+
M2.error(`Try again, or upgrade with ${import_picocolors21.default.bold("npm i -g @abloatai/ablo")}.`);
|
|
287482
287795
|
process.exit(1);
|
|
287483
287796
|
}
|
|
287484
287797
|
const prov = parsedProv.data;
|
|
@@ -287490,7 +287803,7 @@ ${import_picocolors20.default.dim(url)}`, "Approve in your browser");
|
|
|
287490
287803
|
});
|
|
287491
287804
|
if (targetOrg && prov.organizationSlug && prov.organizationSlug !== targetOrg) {
|
|
287492
287805
|
M2.warn(
|
|
287493
|
-
`The approval chose ${
|
|
287806
|
+
`The approval chose ${import_picocolors21.default.bold(prov.organizationSlug)}, not ${import_picocolors21.default.bold(targetOrg)}. The credential is scoped to ${import_picocolors21.default.bold(prov.organizationSlug)}.`
|
|
287494
287807
|
);
|
|
287495
287808
|
}
|
|
287496
287809
|
const profileName = prov.project?.slug ?? DEFAULT_PROFILE;
|
|
@@ -287502,10 +287815,10 @@ ${import_picocolors20.default.dim(url)}`, "Approve in your browser");
|
|
|
287502
287815
|
{ mode: "sandbox", activeProject: prov.project ?? void 0 }
|
|
287503
287816
|
);
|
|
287504
287817
|
s.stop(`Saved project credential to ${path}`);
|
|
287505
|
-
const orgLabel = prov.organizationSlug ? ` to ${
|
|
287506
|
-
const where = prov.project ? ` ${
|
|
287818
|
+
const orgLabel = prov.organizationSlug ? ` to ${import_picocolors21.default.bold(prov.organizationSlug)}` : "";
|
|
287819
|
+
const where = prov.project ? ` ${import_picocolors21.default.dim(`(project ${prov.project.slug})`)}` : "";
|
|
287507
287820
|
Se(
|
|
287508
|
-
`${
|
|
287821
|
+
`${import_picocolors21.default.green("\u2713")} Logged in${orgLabel}${where}. Run ${import_picocolors21.default.bold("npx ablo dev")} to create or resume your Git branch and start with an expiring runtime key.`
|
|
287509
287822
|
);
|
|
287510
287823
|
}
|
|
287511
287824
|
async function login(argv = [], deps = {}) {
|
|
@@ -287514,14 +287827,14 @@ async function login(argv = [], deps = {}) {
|
|
|
287514
287827
|
function logout() {
|
|
287515
287828
|
const removed = clearCredential();
|
|
287516
287829
|
if (removed) {
|
|
287517
|
-
console.log(` ${
|
|
287830
|
+
console.log(` ${import_picocolors21.default.green("\u2713")} Logged out ${import_picocolors21.default.dim(`(credentials removed from ${configDir()})`)}`);
|
|
287518
287831
|
} else {
|
|
287519
|
-
console.log(` ${
|
|
287832
|
+
console.log(` ${import_picocolors21.default.dim("\u25CB")} Not logged in \u2014 nothing to remove.`);
|
|
287520
287833
|
}
|
|
287521
287834
|
if (process.env.ABLO_MANAGEMENT_KEY) {
|
|
287522
287835
|
console.log(
|
|
287523
|
-
|
|
287524
|
-
` Note: ${
|
|
287836
|
+
import_picocolors21.default.dim(
|
|
287837
|
+
` Note: ${import_picocolors21.default.bold("ABLO_MANAGEMENT_KEY")} is still set in this shell and takes precedence.`
|
|
287525
287838
|
)
|
|
287526
287839
|
);
|
|
287527
287840
|
}
|
|
@@ -287532,7 +287845,7 @@ init_projects();
|
|
|
287532
287845
|
|
|
287533
287846
|
// src/status.ts
|
|
287534
287847
|
init_cjs_shims();
|
|
287535
|
-
var
|
|
287848
|
+
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
287536
287849
|
init_config();
|
|
287537
287850
|
init_target();
|
|
287538
287851
|
init_theme();
|
|
@@ -287542,9 +287855,9 @@ init_readiness();
|
|
|
287542
287855
|
function expiryLabel(iso) {
|
|
287543
287856
|
const ms = Date.parse(iso) - Date.now();
|
|
287544
287857
|
if (Number.isNaN(ms)) return "";
|
|
287545
|
-
if (ms <= 0) return
|
|
287858
|
+
if (ms <= 0) return import_picocolors22.default.red("expired");
|
|
287546
287859
|
const days = Math.floor(ms / (24 * 60 * 60 * 1e3));
|
|
287547
|
-
return
|
|
287860
|
+
return import_picocolors22.default.dim(days > 0 ? `expires in ${days}d` : "expires <1d");
|
|
287548
287861
|
}
|
|
287549
287862
|
async function ping2(apiUrl3) {
|
|
287550
287863
|
const ctrl = new AbortController();
|
|
@@ -287571,38 +287884,38 @@ function printTargetLines(target, localProject, storedOrganizationId, storedOrga
|
|
|
287571
287884
|
const confirmed = target?.confirmed ?? null;
|
|
287572
287885
|
const org = confirmed?.organizationId ?? storedOrganizationId;
|
|
287573
287886
|
if (org) {
|
|
287574
|
-
const suffix = confirmed?.organizationId ? "" : ` ${
|
|
287887
|
+
const suffix = confirmed?.organizationId ? "" : ` ${import_picocolors22.default.yellow("(unconfirmed)")}`;
|
|
287575
287888
|
const slug = org === storedOrganizationId ? storedOrganizationSlug : void 0;
|
|
287576
|
-
const label = slug ? `${
|
|
287577
|
-
console.log(` ${
|
|
287889
|
+
const label = slug ? `${import_picocolors22.default.bold(slug)} ${import_picocolors22.default.dim(`(${org})`)}` : import_picocolors22.default.dim(org);
|
|
287890
|
+
console.log(` ${import_picocolors22.default.dim("org")} ${label}${suffix}`);
|
|
287578
287891
|
} else {
|
|
287579
287892
|
console.log(
|
|
287580
|
-
` ${
|
|
287893
|
+
` ${import_picocolors22.default.dim("org")} ${import_picocolors22.default.yellow("unknown")} ${import_picocolors22.default.dim("(the server did not confirm one for this key)")}`
|
|
287581
287894
|
);
|
|
287582
287895
|
}
|
|
287583
287896
|
let projectLine;
|
|
287584
287897
|
if (confirmed?.project) {
|
|
287585
287898
|
const p2 = confirmed.project;
|
|
287586
|
-
projectLine = p2.isDefault ? `${
|
|
287899
|
+
projectLine = p2.isDefault ? `${import_picocolors22.default.bold("default")} ${import_picocolors22.default.dim("(org-default)")}` : `${import_picocolors22.default.bold(p2.slug)} ${import_picocolors22.default.dim(`(${p2.id})`)}`;
|
|
287587
287900
|
} else if (confirmed) {
|
|
287588
|
-
projectLine = `${
|
|
287901
|
+
projectLine = `${import_picocolors22.default.bold("default")} ${import_picocolors22.default.dim("(org-default)")}`;
|
|
287589
287902
|
} else if (localProject) {
|
|
287590
|
-
projectLine = `${
|
|
287903
|
+
projectLine = `${import_picocolors22.default.bold(localProject.slug)} ${import_picocolors22.default.dim(`(${localProject.id})`)} ${import_picocolors22.default.yellow("(unconfirmed)")}`;
|
|
287591
287904
|
} else {
|
|
287592
|
-
projectLine = `${
|
|
287905
|
+
projectLine = `${import_picocolors22.default.bold("default")} ${target ? import_picocolors22.default.yellow("(unconfirmed)") : import_picocolors22.default.dim("(org-default)")}`;
|
|
287593
287906
|
}
|
|
287594
|
-
console.log(` ${
|
|
287907
|
+
console.log(` ${import_picocolors22.default.dim("project")} ${projectLine}`);
|
|
287595
287908
|
const branch = confirmed?.branchId ?? null;
|
|
287596
287909
|
const env = confirmed?.environment ?? target?.keyEnv ?? null;
|
|
287597
287910
|
if (branch) {
|
|
287598
287911
|
const label = confirmed?.branchRoot ? "production root" : `branch ${branch}`;
|
|
287599
|
-
console.log(` ${
|
|
287912
|
+
console.log(` ${import_picocolors22.default.dim("acts on")} ${import_picocolors22.default.bold(label)}`);
|
|
287600
287913
|
} else if (env) {
|
|
287601
|
-
const suffix = confirmed ? "" : ` ${
|
|
287602
|
-
console.log(` ${
|
|
287914
|
+
const suffix = confirmed ? "" : ` ${import_picocolors22.default.yellow("(unconfirmed)")}`;
|
|
287915
|
+
console.log(` ${import_picocolors22.default.dim("acts on")} ${import_picocolors22.default.bold(env)}${suffix}`);
|
|
287603
287916
|
}
|
|
287604
287917
|
const divergence = describeMismatches(target?.mismatches ?? []);
|
|
287605
|
-
if (divergence) console.log(` ${
|
|
287918
|
+
if (divergence) console.log(` ${import_picocolors22.default.yellow(`\u26A0 ${divergence}`)}`);
|
|
287606
287919
|
}
|
|
287607
287920
|
async function status(args = []) {
|
|
287608
287921
|
const apiUrl3 = apiBaseUrl();
|
|
@@ -287686,15 +287999,15 @@ async function status(args = []) {
|
|
|
287686
287999
|
return;
|
|
287687
288000
|
}
|
|
287688
288001
|
console.log(`
|
|
287689
|
-
${brand("ablo")} ${
|
|
288002
|
+
${brand("ablo")} ${import_picocolors22.default.dim("status")}
|
|
287690
288003
|
`);
|
|
287691
288004
|
if (runtimeKey.key && runtimeKey.source && runtimeKey.source !== "stored") {
|
|
287692
288005
|
const label = runtimeKey.source === "env" ? "ABLO_API_KEY env" : runtimeKey.source;
|
|
287693
288006
|
console.log(
|
|
287694
|
-
` ${
|
|
288007
|
+
` ${import_picocolors22.default.dim("key")} ${runtimeKey.key.slice(0, 12)}\u2026 ${import_picocolors22.default.dim(`(${label} \u2014 overrides stored)`)}`
|
|
287695
288008
|
);
|
|
287696
288009
|
} else if (!cfg) {
|
|
287697
|
-
console.log(` ${
|
|
288010
|
+
console.log(` ${import_picocolors22.default.yellow("!")} Not logged in \u2014 run ${import_picocolors22.default.bold("ablo login")}.`);
|
|
287698
288011
|
}
|
|
287699
288012
|
const activeEntry = getKeyEntry(mode);
|
|
287700
288013
|
const activeProject = getActiveProject();
|
|
@@ -287706,9 +288019,9 @@ async function status(args = []) {
|
|
|
287706
288019
|
);
|
|
287707
288020
|
const management = getManagementKeyEntry();
|
|
287708
288021
|
console.log(
|
|
287709
|
-
` ${
|
|
288022
|
+
` ${import_picocolors22.default.dim("\u25CB")} ${"management".padEnd(12)} ${management ? import_picocolors22.default.dim(
|
|
287710
288023
|
`${management.apiKey.slice(0, 12)}\u2026${management.expiresAt ? ` \xB7 ${expiryLabel(management.expiresAt)}` : ""}`
|
|
287711
|
-
) :
|
|
288024
|
+
) : import_picocolors22.default.dim("\u2014 no key")}`
|
|
287712
288025
|
);
|
|
287713
288026
|
for (const { key: m2, label } of [
|
|
287714
288027
|
{ key: "sandbox", label: "legacy child" },
|
|
@@ -287720,21 +288033,21 @@ async function status(args = []) {
|
|
|
287720
288033
|
credentialCapability(entry.apiKey).label,
|
|
287721
288034
|
entry.expiresAt ? expiryLabel(entry.expiresAt) : ""
|
|
287722
288035
|
].filter(Boolean);
|
|
287723
|
-
const trail = facts.length ? ` ${
|
|
288036
|
+
const trail = facts.length ? ` ${import_picocolors22.default.dim("\xB7")} ${facts.join(import_picocolors22.default.dim(" \xB7 "))}` : "";
|
|
287724
288037
|
console.log(
|
|
287725
|
-
` ${
|
|
288038
|
+
` ${import_picocolors22.default.dim("\u25CB")} ${label.padEnd(12)} ${import_picocolors22.default.dim(`${entry.apiKey.slice(0, 12)}\u2026`)}${trail}`
|
|
287726
288039
|
);
|
|
287727
288040
|
}
|
|
287728
288041
|
}
|
|
287729
288042
|
const pushBranch = target?.confirmed?.branchRoot === true ? "production root" : target?.confirmed?.branchId ? `branch ${target.confirmed.branchId}` : runtimeKey.key ? "unknown branch" : "no branch";
|
|
287730
288043
|
console.log(
|
|
287731
|
-
` ${
|
|
288044
|
+
` ${import_picocolors22.default.dim("push")} ${runtimeKey.key ? `${import_picocolors22.default.bold(pushBranch)} ${import_picocolors22.default.dim(`with ${runtimeKey.key.slice(0, 12)}\u2026 (${runtimeKey.source})`)}` : `${import_picocolors22.default.bold(pushBranch)} ${import_picocolors22.default.yellow("\u2014 no runtime key")} ${import_picocolors22.default.dim(`(set ${import_picocolors22.default.bold("ABLO_API_KEY")} or run ${import_picocolors22.default.bold("ablo dev")})`)}`}`
|
|
287732
288045
|
);
|
|
287733
288046
|
const capability = credentialCapability(runtimeKey.key);
|
|
287734
|
-
if (capability.note) console.log(` ${
|
|
287735
|
-
process.stdout.write(` ${
|
|
288047
|
+
if (capability.note) console.log(` ${import_picocolors22.default.dim(capability.note)}`);
|
|
288048
|
+
process.stdout.write(` ${import_picocolors22.default.dim("api")} ${apiUrl3} `);
|
|
287736
288049
|
const reachable = await ping2(apiUrl3);
|
|
287737
|
-
console.log(reachable ?
|
|
288050
|
+
console.log(reachable ? import_picocolors22.default.green("reachable") : import_picocolors22.default.red("unreachable"));
|
|
287738
288051
|
const introspectKey = runtimeKey.key;
|
|
287739
288052
|
const { source: dataSource, validation } = reachable ? await fetchRoutingState(apiUrl3, introspectKey) : { source: { kind: "unknown", detail: "unreachable" }, validation: null };
|
|
287740
288053
|
if (dataSource.kind === "connected") {
|
|
@@ -287742,65 +288055,65 @@ async function status(args = []) {
|
|
|
287742
288055
|
const pooled = detectPoolerIn(dataSource.hosts);
|
|
287743
288056
|
const unreachable = validation && !validation.ok ? validation.message : void 0;
|
|
287744
288057
|
console.log(
|
|
287745
|
-
` ${
|
|
288058
|
+
` ${import_picocolors22.default.dim("data")} ${import_picocolors22.default.green("\u2713")} ${import_picocolors22.default.dim(`database connected to this plane (${how})`)}`
|
|
287746
288059
|
);
|
|
287747
288060
|
if (pooled) {
|
|
287748
288061
|
console.log(
|
|
287749
|
-
` ${
|
|
288062
|
+
` ${import_picocolors22.default.yellow("\u26A0")} ${import_picocolors22.default.dim(
|
|
287750
288063
|
`${pooled.host} is a connection pooler` + (pooled.direct ? `; register the direct host instead: ${pooled.direct}` : "; register the direct host instead")
|
|
287751
288064
|
)}`
|
|
287752
288065
|
);
|
|
287753
288066
|
}
|
|
287754
288067
|
if (unreachable) {
|
|
287755
|
-
console.log(` ${
|
|
288068
|
+
console.log(` ${import_picocolors22.default.red("\u2717")} ${import_picocolors22.default.dim(`Ablo could not reach it \u2014 ${unreachable}`)}`);
|
|
287756
288069
|
}
|
|
287757
288070
|
if (validation?.ok && validation.initialSnapshot?.status === "loading") {
|
|
287758
288071
|
console.log(
|
|
287759
|
-
` ${
|
|
287760
|
-
`loading rows that predate the connection \u2014 automatic; check with ${
|
|
288072
|
+
` ${import_picocolors22.default.yellow("\u25CC")} ${import_picocolors22.default.dim(
|
|
288073
|
+
`loading rows that predate the connection \u2014 automatic; check with ${import_picocolors22.default.bold("ablo connect check")}`
|
|
287761
288074
|
)}`
|
|
287762
288075
|
);
|
|
287763
288076
|
} else if (validation?.ok && validation.initialSnapshot?.status === "retrying") {
|
|
287764
288077
|
console.log(
|
|
287765
|
-
` ${
|
|
288078
|
+
` ${import_picocolors22.default.red("\u2717")} ${import_picocolors22.default.dim(
|
|
287766
288079
|
`loading existing rows is retrying${validation.initialSnapshot.detail ? ` \u2014 ${validation.initialSnapshot.detail}` : ""}`
|
|
287767
288080
|
)}`
|
|
287768
288081
|
);
|
|
287769
288082
|
}
|
|
287770
288083
|
} else if (dataSource.kind === "none") {
|
|
287771
288084
|
console.log(
|
|
287772
|
-
` ${
|
|
288085
|
+
` ${import_picocolors22.default.dim("data")} ${import_picocolors22.default.red("\u2717 this branch is not connected to a database")} ${import_picocolors22.default.dim("\u2014 writes are held")}`
|
|
287773
288086
|
);
|
|
287774
288087
|
} else if (reachable) {
|
|
287775
288088
|
console.log(
|
|
287776
|
-
` ${
|
|
288089
|
+
` ${import_picocolors22.default.dim("data")} ${import_picocolors22.default.yellow("?")} ${import_picocolors22.default.dim(`could not read this branch's database connection (${dataSource.detail})`)}`
|
|
287777
288090
|
);
|
|
287778
288091
|
}
|
|
287779
288092
|
const pushed = reachable ? await fetchPushedSchema(apiUrl3, introspectKey) : null;
|
|
287780
288093
|
if (reachable) {
|
|
287781
288094
|
if (pushed?.active) {
|
|
287782
|
-
const when = pushed.pushedAt ? ` ${
|
|
287783
|
-
const ver = pushed.version != null ? ` ${
|
|
287784
|
-
const hashLabel = pushed.hash ? ` ${
|
|
288095
|
+
const when = pushed.pushedAt ? ` ${import_picocolors22.default.dim(`@ ${pushed.pushedAt.slice(0, 10)}`)}` : "";
|
|
288096
|
+
const ver = pushed.version != null ? ` ${import_picocolors22.default.dim(`(rev ${pushed.version})`)}` : "";
|
|
288097
|
+
const hashLabel = pushed.hash ? ` ${import_picocolors22.default.dim(`hash ${pushed.hash}`)}` : "";
|
|
287785
288098
|
console.log(
|
|
287786
|
-
` ${
|
|
288099
|
+
` ${import_picocolors22.default.dim("schema")} ${import_picocolors22.default.bold(`${pushed.models.length} models pushed`)}${ver}${hashLabel}${when}`
|
|
287787
288100
|
);
|
|
287788
288101
|
for (const m2 of pushed.models) {
|
|
287789
|
-
const tn = m2.typename === m2.key ?
|
|
288102
|
+
const tn = m2.typename === m2.key ? import_picocolors22.default.dim(`typename=${m2.typename}`) : import_picocolors22.default.yellow(`typename=${m2.typename}`);
|
|
287790
288103
|
const conflict = formatConflict(m2.conflict);
|
|
287791
|
-
const conflictStr2 = conflict ? ` ${
|
|
287792
|
-
console.log(` ${
|
|
288104
|
+
const conflictStr2 = conflict ? ` ${import_picocolors22.default.dim(`conflict=${conflict}`)}` : "";
|
|
288105
|
+
console.log(` ${import_picocolors22.default.dim("\u2022")} ${m2.key.padEnd(14)} ${tn}${conflictStr2}`);
|
|
287793
288106
|
}
|
|
287794
288107
|
} else if (pushed && !pushed.active) {
|
|
287795
288108
|
console.log(
|
|
287796
|
-
` ${
|
|
288109
|
+
` ${import_picocolors22.default.dim("schema")} ${import_picocolors22.default.yellow("none pushed")} ${import_picocolors22.default.dim(`(run ${import_picocolors22.default.bold("ablo push")} or ${import_picocolors22.default.bold("ablo dev")})`)}`
|
|
287797
288110
|
);
|
|
287798
288111
|
}
|
|
287799
288112
|
}
|
|
287800
288113
|
const drift = schemaDrift(await readLocalSchemaHash(), pushed?.hash);
|
|
287801
288114
|
if (drift) {
|
|
287802
288115
|
console.log(
|
|
287803
|
-
` ${
|
|
288116
|
+
` ${import_picocolors22.default.dim("drift")} ${import_picocolors22.default.red("\u2717 local schema differs from the server")} ` + import_picocolors22.default.dim(`(local ${drift.local}, server ${drift.server})`)
|
|
287804
288117
|
);
|
|
287805
288118
|
}
|
|
287806
288119
|
const found = blockers({
|
|
@@ -287812,18 +288125,18 @@ async function status(args = []) {
|
|
|
287812
288125
|
});
|
|
287813
288126
|
console.log();
|
|
287814
288127
|
if (found.length > 0) {
|
|
287815
|
-
console.log(` ${
|
|
288128
|
+
console.log(` ${import_picocolors22.default.red("\u2717")} ${import_picocolors22.default.bold("writes would fail right now")}`);
|
|
287816
288129
|
for (const b4 of found) {
|
|
287817
|
-
console.log(` ${
|
|
287818
|
-
console.log(` ${
|
|
288130
|
+
console.log(` ${import_picocolors22.default.dim("\xB7")} ${b4.problem}`);
|
|
288131
|
+
console.log(` ${import_picocolors22.default.dim(b4.fix)}`);
|
|
287819
288132
|
}
|
|
287820
288133
|
} else if (dataSource.kind === "unknown") {
|
|
287821
288134
|
console.log(
|
|
287822
|
-
` ${
|
|
288135
|
+
` ${import_picocolors22.default.yellow("?")} ${import_picocolors22.default.dim("nothing is blocking a write, but this key could not read the branch's database connection \u2014 some checks were skipped")}`
|
|
287823
288136
|
);
|
|
287824
288137
|
} else {
|
|
287825
288138
|
console.log(
|
|
287826
|
-
` ${
|
|
288139
|
+
` ${import_picocolors22.default.green("\u2713")} ${import_picocolors22.default.dim("write infrastructure is ready \u2014 database constraints and row-level policies still apply")}`
|
|
287827
288140
|
);
|
|
287828
288141
|
}
|
|
287829
288142
|
console.log();
|
|
@@ -287831,9 +288144,9 @@ async function status(args = []) {
|
|
|
287831
288144
|
|
|
287832
288145
|
// src/logs.ts
|
|
287833
288146
|
init_cjs_shims();
|
|
287834
|
-
var
|
|
288147
|
+
var import_errors19 = require("@abloatai/transaction/errors");
|
|
287835
288148
|
var import_wire9 = require("@abloatai/transaction/wire");
|
|
287836
|
-
var
|
|
288149
|
+
var import_picocolors23 = __toESM(require_picocolors(), 1);
|
|
287837
288150
|
init_config();
|
|
287838
288151
|
init_theme();
|
|
287839
288152
|
init_controlPlane();
|
|
@@ -287873,12 +288186,12 @@ function parseLogsArgs(argv) {
|
|
|
287873
288186
|
args.json = true;
|
|
287874
288187
|
break;
|
|
287875
288188
|
case "--mode":
|
|
287876
|
-
throw new
|
|
288189
|
+
throw new import_errors19.AbloValidationError(
|
|
287877
288190
|
"--mode was removed. Logs follow the branch bound to ABLO_API_KEY; select a different branch by supplying its key.",
|
|
287878
288191
|
{ code: "cli_invalid_arguments" }
|
|
287879
288192
|
);
|
|
287880
288193
|
default:
|
|
287881
|
-
throw new
|
|
288194
|
+
throw new import_errors19.AbloValidationError(`unknown flag: ${arg}`, { code: "cli_invalid_arguments" });
|
|
287882
288195
|
}
|
|
287883
288196
|
}
|
|
287884
288197
|
return args;
|
|
@@ -287897,10 +288210,10 @@ function resolveSince(since) {
|
|
|
287897
288210
|
var sleep2 = (ms) => new Promise((r2) => setTimeout(r2, ms));
|
|
287898
288211
|
function colorOp(op) {
|
|
287899
288212
|
const label = op.padEnd(6);
|
|
287900
|
-
if (op === "create") return
|
|
287901
|
-
if (op === "update") return
|
|
287902
|
-
if (op === "delete") return
|
|
287903
|
-
return
|
|
288213
|
+
if (op === "create") return import_picocolors23.default.green(label);
|
|
288214
|
+
if (op === "update") return import_picocolors23.default.yellow(label);
|
|
288215
|
+
if (op === "delete") return import_picocolors23.default.red(label);
|
|
288216
|
+
return import_picocolors23.default.dim(label);
|
|
287904
288217
|
}
|
|
287905
288218
|
function render2(e2, json) {
|
|
287906
288219
|
if (json) {
|
|
@@ -287909,21 +288222,21 @@ function render2(e2, json) {
|
|
|
287909
288222
|
return;
|
|
287910
288223
|
}
|
|
287911
288224
|
const t = new Date(e2.at).toLocaleTimeString();
|
|
287912
|
-
const actor = e2.actor ?
|
|
287913
|
-
console.log(` ${
|
|
288225
|
+
const actor = e2.actor ? import_picocolors23.default.dim(` ${e2.actor}`) : "";
|
|
288226
|
+
console.log(` ${import_picocolors23.default.dim(t)} ${colorOp(e2.op)} ${import_picocolors23.default.bold(e2.model)} ${import_picocolors23.default.dim(e2.recordId)}${actor}`);
|
|
287914
288227
|
}
|
|
287915
288228
|
async function logs(argv) {
|
|
287916
288229
|
let args;
|
|
287917
288230
|
try {
|
|
287918
288231
|
args = parseLogsArgs(argv);
|
|
287919
288232
|
} catch (err) {
|
|
287920
|
-
console.error(
|
|
288233
|
+
console.error(import_picocolors23.default.red(` ${err instanceof Error ? err.message : String(err)}`));
|
|
287921
288234
|
process.exit(1);
|
|
287922
288235
|
}
|
|
287923
288236
|
const apiKey = resolveRuntimeApiKey().key;
|
|
287924
288237
|
if (!apiKey) {
|
|
287925
288238
|
console.error(
|
|
287926
|
-
|
|
288239
|
+
import_picocolors23.default.red(` No API key.`) + import_picocolors23.default.dim(` Run ${import_picocolors23.default.bold("ablo login")} or set ${import_picocolors23.default.bold("ABLO_API_KEY")}.`)
|
|
287927
288240
|
);
|
|
287928
288241
|
process.exit(1);
|
|
287929
288242
|
}
|
|
@@ -287937,7 +288250,7 @@ async function logs(argv) {
|
|
|
287937
288250
|
if (!res) return null;
|
|
287938
288251
|
if (!res.ok) {
|
|
287939
288252
|
const body = await res.json().catch(() => ({}));
|
|
287940
|
-
console.error(
|
|
288253
|
+
console.error(import_picocolors23.default.red(` logs failed (${res.status}): ${body.reason ?? body.message ?? ""}`));
|
|
287941
288254
|
process.exit(1);
|
|
287942
288255
|
}
|
|
287943
288256
|
const json = await res.json();
|
|
@@ -287948,7 +288261,7 @@ async function logs(argv) {
|
|
|
287948
288261
|
}
|
|
287949
288262
|
if (!args.json) {
|
|
287950
288263
|
console.log(`
|
|
287951
|
-
${brand("ablo")} ${
|
|
288264
|
+
${brand("ablo")} ${import_picocolors23.default.dim("logs")}
|
|
287952
288265
|
`);
|
|
287953
288266
|
}
|
|
287954
288267
|
const initial = await fetchPage({
|
|
@@ -287958,13 +288271,13 @@ async function logs(argv) {
|
|
|
287958
288271
|
...args.op ? { op: args.op } : {}
|
|
287959
288272
|
});
|
|
287960
288273
|
if (!initial) {
|
|
287961
|
-
console.error(
|
|
288274
|
+
console.error(import_picocolors23.default.red(` Couldn't reach ${baseUrl2}.`));
|
|
287962
288275
|
process.exit(1);
|
|
287963
288276
|
}
|
|
287964
288277
|
for (const e2 of initial.events) render2(e2, args.json);
|
|
287965
288278
|
let cursor = initial.cursor;
|
|
287966
288279
|
if (!args.follow) return;
|
|
287967
|
-
if (!args.json) console.log(` ${
|
|
288280
|
+
if (!args.json) console.log(` ${import_picocolors23.default.dim("watching for new activity \u2026 (Ctrl-C to stop)")}
|
|
287968
288281
|
`);
|
|
287969
288282
|
for (; ; ) {
|
|
287970
288283
|
await sleep2(1500);
|
|
@@ -287984,7 +288297,7 @@ async function logs(argv) {
|
|
|
287984
288297
|
// src/webhooks.ts
|
|
287985
288298
|
init_cjs_shims();
|
|
287986
288299
|
var import_fs9 = require("fs");
|
|
287987
|
-
var
|
|
288300
|
+
var import_picocolors24 = __toESM(require_picocolors(), 1);
|
|
287988
288301
|
var import_credentialPolicy4 = require("@abloatai/transaction/auth/credentialPolicy");
|
|
287989
288302
|
init_config();
|
|
287990
288303
|
init_theme();
|
|
@@ -288017,12 +288330,12 @@ function requireKey3(mode) {
|
|
|
288017
288330
|
const apiKey = resolveMutationApiKey(mode);
|
|
288018
288331
|
if (!apiKey) {
|
|
288019
288332
|
console.error(
|
|
288020
|
-
|
|
288333
|
+
import_picocolors24.default.red(" No API key.") + import_picocolors24.default.dim(` Run ${import_picocolors24.default.bold("ablo login")} or set ${import_picocolors24.default.bold("ABLO_API_KEY")}.`)
|
|
288021
288334
|
);
|
|
288022
288335
|
process.exit(1);
|
|
288023
288336
|
}
|
|
288024
288337
|
if ((0, import_credentialPolicy4.classifyCredentialKind)(apiKey) !== "secret") {
|
|
288025
|
-
console.error(
|
|
288338
|
+
console.error(import_picocolors24.default.red(" Managing webhooks requires a branch-bound secret key ") + import_picocolors24.default.dim("(sk_)."));
|
|
288026
288339
|
process.exit(1);
|
|
288027
288340
|
}
|
|
288028
288341
|
return apiKey;
|
|
@@ -288038,12 +288351,12 @@ async function api(apiKey, method, path, body) {
|
|
|
288038
288351
|
...body ? { body: JSON.stringify(body) } : {}
|
|
288039
288352
|
}).catch(() => null);
|
|
288040
288353
|
if (!res) {
|
|
288041
|
-
console.error(
|
|
288354
|
+
console.error(import_picocolors24.default.red(` Couldn't reach ${baseUrl()}.`));
|
|
288042
288355
|
process.exit(1);
|
|
288043
288356
|
}
|
|
288044
288357
|
if (!res.ok) {
|
|
288045
288358
|
const err = await res.json().catch(() => ({}));
|
|
288046
|
-
console.error(
|
|
288359
|
+
console.error(import_picocolors24.default.red(` Request failed (${res.status}): ${err.message ?? err.reason ?? ""}`));
|
|
288047
288360
|
process.exit(1);
|
|
288048
288361
|
}
|
|
288049
288362
|
return await res.json();
|
|
@@ -288065,11 +288378,11 @@ ${line}
|
|
|
288065
288378
|
return file;
|
|
288066
288379
|
}
|
|
288067
288380
|
function printEndpoint(e2) {
|
|
288068
|
-
const dot = e2.status === "enabled" ?
|
|
288069
|
-
const health = e2.last_error ?
|
|
288070
|
-
console.log(` ${dot} ${
|
|
288381
|
+
const dot = e2.status === "enabled" ? import_picocolors24.default.green("\u25CF") : import_picocolors24.default.red("\u25CF");
|
|
288382
|
+
const health = e2.last_error ? import_picocolors24.default.red(` last error: ${e2.last_error}`) : "";
|
|
288383
|
+
console.log(` ${dot} ${import_picocolors24.default.bold(e2.id)} ${e2.url}`);
|
|
288071
288384
|
console.log(
|
|
288072
|
-
|
|
288385
|
+
import_picocolors24.default.dim(
|
|
288073
288386
|
` ${e2.status} \xB7 ${e2.environment} \xB7 events ${e2.enabled_events.join(",")} \xB7 cursor ${e2.cursor ?? "\u2014"}${health}`
|
|
288074
288387
|
)
|
|
288075
288388
|
);
|
|
@@ -288081,7 +288394,7 @@ async function webhooks(argv) {
|
|
|
288081
288394
|
if (sub === "create") {
|
|
288082
288395
|
const url = positional(rest);
|
|
288083
288396
|
if (!url) {
|
|
288084
|
-
console.error(
|
|
288397
|
+
console.error(import_picocolors24.default.red(" Usage: ") + brand("ablo webhooks create <url>"));
|
|
288085
288398
|
process.exit(1);
|
|
288086
288399
|
}
|
|
288087
288400
|
const apiKey = requireKey3(mode);
|
|
@@ -288093,8 +288406,8 @@ async function webhooks(argv) {
|
|
|
288093
288406
|
});
|
|
288094
288407
|
const file = writeSecretToEnv(created.secret);
|
|
288095
288408
|
console.log(`
|
|
288096
|
-
${
|
|
288097
|
-
console.log(` ${
|
|
288409
|
+
${import_picocolors24.default.green("\u2713")} Registered ${import_picocolors24.default.bold(created.id)} \u2192 ${created.url}`);
|
|
288410
|
+
console.log(` ${import_picocolors24.default.green("\u2713")} Wrote ${import_picocolors24.default.bold(ENV_KEY)} to ${import_picocolors24.default.bold(file)} ${import_picocolors24.default.dim("(shown once)")}
|
|
288098
288411
|
`);
|
|
288099
288412
|
return;
|
|
288100
288413
|
}
|
|
@@ -288102,7 +288415,7 @@ async function webhooks(argv) {
|
|
|
288102
288415
|
const apiKey = requireKey3(mode);
|
|
288103
288416
|
const { data } = await api(apiKey, "GET", "");
|
|
288104
288417
|
if (data.length === 0) {
|
|
288105
|
-
console.log(
|
|
288418
|
+
console.log(import_picocolors24.default.dim(" No webhook endpoints. ") + brand("ablo webhooks create <url>"));
|
|
288106
288419
|
return;
|
|
288107
288420
|
}
|
|
288108
288421
|
console.log();
|
|
@@ -288113,40 +288426,40 @@ async function webhooks(argv) {
|
|
|
288113
288426
|
if (sub === "roll") {
|
|
288114
288427
|
const id = positional(rest);
|
|
288115
288428
|
if (!id) {
|
|
288116
|
-
console.error(
|
|
288429
|
+
console.error(import_picocolors24.default.red(" Usage: ") + brand("ablo webhooks roll <id>"));
|
|
288117
288430
|
process.exit(1);
|
|
288118
288431
|
}
|
|
288119
288432
|
const apiKey = requireKey3(mode);
|
|
288120
288433
|
const rolled = await api(apiKey, "POST", `/${id}/roll_secret`);
|
|
288121
288434
|
const file = writeSecretToEnv(rolled.secret);
|
|
288122
288435
|
console.log(`
|
|
288123
|
-
${
|
|
288436
|
+
${import_picocolors24.default.green("\u2713")} Rolled secret for ${import_picocolors24.default.bold(id)} \u2192 ${import_picocolors24.default.bold(file)} ${import_picocolors24.default.dim("(old secret now invalid)")}
|
|
288124
288437
|
`);
|
|
288125
288438
|
return;
|
|
288126
288439
|
}
|
|
288127
288440
|
if (sub === "enable") {
|
|
288128
288441
|
const id = positional(rest);
|
|
288129
288442
|
if (!id) {
|
|
288130
|
-
console.error(
|
|
288443
|
+
console.error(import_picocolors24.default.red(" Usage: ") + brand("ablo webhooks enable <id>"));
|
|
288131
288444
|
process.exit(1);
|
|
288132
288445
|
}
|
|
288133
288446
|
const apiKey = requireKey3(mode);
|
|
288134
288447
|
const e2 = await api(apiKey, "POST", `/${id}/enable`);
|
|
288135
|
-
console.log(` ${
|
|
288448
|
+
console.log(` ${import_picocolors24.default.green("\u2713")} Re-enabled ${import_picocolors24.default.bold(e2.id)}`);
|
|
288136
288449
|
return;
|
|
288137
288450
|
}
|
|
288138
288451
|
if (sub === "rm" || sub === "delete") {
|
|
288139
288452
|
const id = positional(rest);
|
|
288140
288453
|
if (!id) {
|
|
288141
|
-
console.error(
|
|
288454
|
+
console.error(import_picocolors24.default.red(" Usage: ") + brand("ablo webhooks rm <id>"));
|
|
288142
288455
|
process.exit(1);
|
|
288143
288456
|
}
|
|
288144
288457
|
const apiKey = requireKey3(mode);
|
|
288145
288458
|
await api(apiKey, "DELETE", `/${id}`);
|
|
288146
|
-
console.log(` ${
|
|
288459
|
+
console.log(` ${import_picocolors24.default.green("\u2713")} Removed ${import_picocolors24.default.bold(id)}`);
|
|
288147
288460
|
return;
|
|
288148
288461
|
}
|
|
288149
|
-
console.log(` ${
|
|
288462
|
+
console.log(` ${import_picocolors24.default.bold("Usage:")}`);
|
|
288150
288463
|
console.log(` ${brand("ablo webhooks create <url>")} Register an endpoint; writes ${ENV_KEY}`);
|
|
288151
288464
|
console.log(` ${brand("ablo webhooks list")} List endpoints + delivery health`);
|
|
288152
288465
|
console.log(` ${brand("ablo webhooks roll <id>")} Mint a fresh signing secret`);
|
|
@@ -288157,8 +288470,8 @@ async function webhooks(argv) {
|
|
|
288157
288470
|
|
|
288158
288471
|
// src/check.ts
|
|
288159
288472
|
init_cjs_shims();
|
|
288160
|
-
var
|
|
288161
|
-
var
|
|
288473
|
+
var import_errors20 = require("@abloatai/transaction/errors");
|
|
288474
|
+
var import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
288162
288475
|
init_src();
|
|
288163
288476
|
var import_schema9 = require("@abloatai/transaction/schema");
|
|
288164
288477
|
init_push();
|
|
@@ -288305,7 +288618,7 @@ function parseCheckArgs(argv) {
|
|
|
288305
288618
|
appSchema = argv[++i] ?? appSchema;
|
|
288306
288619
|
break;
|
|
288307
288620
|
default:
|
|
288308
|
-
throw new
|
|
288621
|
+
throw new import_errors20.AbloValidationError(`unknown flag: ${arg}`, { code: "cli_invalid_arguments" });
|
|
288309
288622
|
}
|
|
288310
288623
|
}
|
|
288311
288624
|
return { schemaPath, exportName, appSchema };
|
|
@@ -288319,22 +288632,22 @@ function hostOf(connectionString) {
|
|
|
288319
288632
|
}
|
|
288320
288633
|
async function reportReadSubject(dbUrl) {
|
|
288321
288634
|
const host = hostOf(dbUrl);
|
|
288322
|
-
console.log(` ${
|
|
288635
|
+
console.log(` ${import_picocolors25.default.dim("reading")} ${import_picocolors25.default.bold(host ?? "your database")}`);
|
|
288323
288636
|
const runtimeKey = resolveRuntimeApiKey();
|
|
288324
288637
|
const state = await fetchDataSourceState(apiBaseUrl(), runtimeKey.key);
|
|
288325
288638
|
if (state.kind === "unknown") {
|
|
288326
288639
|
console.log(
|
|
288327
|
-
` ${
|
|
288640
|
+
` ${import_picocolors25.default.dim("ablo")} ${import_picocolors25.default.yellow("?")} ${import_picocolors25.default.dim(`couldn't ask which database Ablo reads (${state.detail})`)}
|
|
288328
288641
|
`
|
|
288329
288642
|
);
|
|
288330
288643
|
return;
|
|
288331
288644
|
}
|
|
288332
288645
|
if (state.kind === "none") {
|
|
288333
288646
|
console.log(
|
|
288334
|
-
` ${
|
|
288647
|
+
` ${import_picocolors25.default.dim("ablo")} ${import_picocolors25.default.yellow("!")} this branch is not connected to a database, so Ablo does not read this one`
|
|
288335
288648
|
);
|
|
288336
288649
|
console.log(
|
|
288337
|
-
` ${
|
|
288650
|
+
` ${import_picocolors25.default.dim(`Connect it with ${import_picocolors25.default.bold("ablo connect apply")}. Until then a table here is invisible to the engine.`)}
|
|
288338
288651
|
`
|
|
288339
288652
|
);
|
|
288340
288653
|
return;
|
|
@@ -288342,15 +288655,15 @@ async function reportReadSubject(dbUrl) {
|
|
|
288342
288655
|
const registered = [...new Set(state.hosts)];
|
|
288343
288656
|
if (host && registered.length > 0 && !registered.includes(host)) {
|
|
288344
288657
|
console.log(
|
|
288345
|
-
` ${
|
|
288658
|
+
` ${import_picocolors25.default.dim("ablo")} ${import_picocolors25.default.yellow("!")} Ablo reads ${import_picocolors25.default.bold(registered.join(", "))}`
|
|
288346
288659
|
);
|
|
288347
288660
|
console.log(
|
|
288348
|
-
` ${
|
|
288661
|
+
` ${import_picocolors25.default.dim("If that is this database under a pooled hostname, this is fine \u2014 otherwise the report below describes a database Ablo never reads.")}
|
|
288349
288662
|
`
|
|
288350
288663
|
);
|
|
288351
288664
|
return;
|
|
288352
288665
|
}
|
|
288353
|
-
console.log(` ${
|
|
288666
|
+
console.log(` ${import_picocolors25.default.dim("ablo")} ${import_picocolors25.default.green("\u2713")} ${import_picocolors25.default.dim("reads this database")}
|
|
288354
288667
|
`);
|
|
288355
288668
|
}
|
|
288356
288669
|
async function check(argv) {
|
|
@@ -288358,20 +288671,20 @@ async function check(argv) {
|
|
|
288358
288671
|
try {
|
|
288359
288672
|
args = parseCheckArgs(argv);
|
|
288360
288673
|
} catch (err) {
|
|
288361
|
-
console.error(
|
|
288674
|
+
console.error(import_picocolors25.default.red(` ${err instanceof Error ? err.message : String(err)}`));
|
|
288362
288675
|
process.exit(1);
|
|
288363
288676
|
}
|
|
288364
288677
|
const dbUrl = readProjectAdminDatabaseUrl();
|
|
288365
288678
|
if (!dbUrl) {
|
|
288366
288679
|
console.error(
|
|
288367
|
-
|
|
288680
|
+
import_picocolors25.default.red(` No database.`) + import_picocolors25.default.dim(` Set ${import_picocolors25.default.bold(ADMIN_URL_VAR)} to the Postgres you want Ablo to adopt.`)
|
|
288368
288681
|
);
|
|
288369
288682
|
process.exit(1);
|
|
288370
288683
|
}
|
|
288371
288684
|
const schema = await loadSchema(args.schemaPath, args.exportName);
|
|
288372
288685
|
const schemaJson = JSON.parse((0, import_schema9.serializeSchema)(schema));
|
|
288373
288686
|
console.log(`
|
|
288374
|
-
${brand("ablo")} ${
|
|
288687
|
+
${brand("ablo")} ${import_picocolors25.default.dim("check")} ${import_picocolors25.default.dim(`schema "${args.appSchema}"`)}
|
|
288375
288688
|
`);
|
|
288376
288689
|
await reportReadSubject(dbUrl);
|
|
288377
288690
|
const sql = src_default(dbUrl, { max: 1, prepare: false, onnotice: () => {
|
|
@@ -288383,7 +288696,7 @@ async function check(argv) {
|
|
|
288383
288696
|
[args.appSchema]
|
|
288384
288697
|
);
|
|
288385
288698
|
} catch (err) {
|
|
288386
|
-
console.error(
|
|
288699
|
+
console.error(import_picocolors25.default.red(` Couldn't read the database: ${err instanceof Error ? err.message : String(err)}`));
|
|
288387
288700
|
await sql.end({ timeout: 2 });
|
|
288388
288701
|
process.exit(1);
|
|
288389
288702
|
}
|
|
@@ -288405,7 +288718,7 @@ async function check(argv) {
|
|
|
288405
288718
|
declaredTables.add(table);
|
|
288406
288719
|
const present = colsByTable.get(table);
|
|
288407
288720
|
if (!present) {
|
|
288408
|
-
console.log(` ${
|
|
288721
|
+
console.log(` ${import_picocolors25.default.red("\u2717")} ${import_picocolors25.default.bold(key)} ${import_picocolors25.default.dim("\u2192")} table ${import_picocolors25.default.bold(table)} ${import_picocolors25.default.red("not found")}`);
|
|
288409
288722
|
errors++;
|
|
288410
288723
|
continue;
|
|
288411
288724
|
}
|
|
@@ -288427,26 +288740,26 @@ async function check(argv) {
|
|
|
288427
288740
|
if (!present.has(col)) problems.push(`missing column "${col}" (field ${fieldName})`);
|
|
288428
288741
|
}
|
|
288429
288742
|
if (problems.length > 0) {
|
|
288430
|
-
console.log(` ${
|
|
288431
|
-
for (const p2 of problems) console.log(` ${
|
|
288432
|
-
for (const w2 of warns) console.log(` ${
|
|
288743
|
+
console.log(` ${import_picocolors25.default.red("\u2717")} ${import_picocolors25.default.bold(key)} ${import_picocolors25.default.dim("\u2192")} ${table}`);
|
|
288744
|
+
for (const p2 of problems) console.log(` ${import_picocolors25.default.red("\u2022")} ${p2}`);
|
|
288745
|
+
for (const w2 of warns) console.log(` ${import_picocolors25.default.yellow("\u2022")} ${w2}`);
|
|
288433
288746
|
errors++;
|
|
288434
288747
|
} else if (warns.length > 0) {
|
|
288435
|
-
console.log(` ${
|
|
288436
|
-
for (const w2 of warns) console.log(` ${
|
|
288748
|
+
console.log(` ${import_picocolors25.default.yellow("!")} ${import_picocolors25.default.bold(key)} ${import_picocolors25.default.dim("\u2192")} ${table}`);
|
|
288749
|
+
for (const w2 of warns) console.log(` ${import_picocolors25.default.yellow("\u2022")} ${w2}`);
|
|
288437
288750
|
warnings++;
|
|
288438
288751
|
} else {
|
|
288439
|
-
console.log(` ${
|
|
288752
|
+
console.log(` ${import_picocolors25.default.green("\u2713")} ${import_picocolors25.default.bold(key)} ${import_picocolors25.default.dim(`\u2192 ${table} (id, ${orgCol ?? "no org"} ok)`)}`);
|
|
288440
288753
|
}
|
|
288441
288754
|
}
|
|
288442
288755
|
const modelCount = Object.keys(schemaJson.models).length;
|
|
288443
288756
|
const ignored = [...colsByTable.keys()].filter((t) => !declaredTables.has(t)).length;
|
|
288444
288757
|
console.log(
|
|
288445
288758
|
`
|
|
288446
|
-
${modelCount} model${modelCount === 1 ? "" : "s"} \xB7 ${
|
|
288759
|
+
${modelCount} model${modelCount === 1 ? "" : "s"} \xB7 ${import_picocolors25.default.green(`${modelCount - errors - warnings} ok`)}` + (warnings ? ` \xB7 ${import_picocolors25.default.yellow(`${warnings} warning${warnings === 1 ? "" : "s"}`)}` : "") + (errors ? ` \xB7 ${import_picocolors25.default.red(`${errors} error${errors === 1 ? "" : "s"}`)}` : "")
|
|
288447
288760
|
);
|
|
288448
288761
|
if (ignored > 0) {
|
|
288449
|
-
console.log(` ${
|
|
288762
|
+
console.log(` ${import_picocolors25.default.dim(`${ignored} other table${ignored === 1 ? "" : "s"} in your database \u2014 ignored by Ablo`)}`);
|
|
288450
288763
|
}
|
|
288451
288764
|
console.log();
|
|
288452
288765
|
process.exit(errors > 0 ? 1 : 0);
|
|
@@ -288454,7 +288767,7 @@ async function check(argv) {
|
|
|
288454
288767
|
|
|
288455
288768
|
// src/upgrade.ts
|
|
288456
288769
|
init_cjs_shims();
|
|
288457
|
-
var
|
|
288770
|
+
var import_picocolors26 = __toESM(require_picocolors(), 1);
|
|
288458
288771
|
var import_ts_morph = __toESM(require_ts_morph(), 1);
|
|
288459
288772
|
var DEFAULT_GLOBS = ["app/**/*.{ts,tsx}", "src/**/*.{ts,tsx}", "ablo/**/*.{ts,tsx}", "lib/**/*.{ts,tsx}"];
|
|
288460
288773
|
var VERB_ARGS = {
|
|
@@ -288532,7 +288845,7 @@ async function upgrade(argv) {
|
|
|
288532
288845
|
project.addSourceFilesAtPaths(globs.length > 0 ? globs : DEFAULT_GLOBS);
|
|
288533
288846
|
const files = project.getSourceFiles();
|
|
288534
288847
|
if (files.length === 0) {
|
|
288535
|
-
console.log(
|
|
288848
|
+
console.log(import_picocolors26.default.yellow(' No .ts/.tsx files found. Pass a glob, e.g. `ablo upgrade "src/**/*.tsx"`.'));
|
|
288536
288849
|
return;
|
|
288537
288850
|
}
|
|
288538
288851
|
const edits = [];
|
|
@@ -288606,39 +288919,39 @@ async function upgrade(argv) {
|
|
|
288606
288919
|
const rel = (f) => f.replace(cwd + "/", "");
|
|
288607
288920
|
console.log();
|
|
288608
288921
|
if (edits.length === 0 && manual.length === 0) {
|
|
288609
|
-
console.log(
|
|
288922
|
+
console.log(import_picocolors26.default.green(" \u2713 Nothing to migrate \u2014 your code is already on the current API."));
|
|
288610
288923
|
return;
|
|
288611
288924
|
}
|
|
288612
288925
|
if (edits.length > 0) {
|
|
288613
|
-
console.log(
|
|
288926
|
+
console.log(import_picocolors26.default.bold(` ${write ? "Applied" : "Would apply"} ${edits.length} change${edits.length === 1 ? "" : "s"}:`));
|
|
288614
288927
|
for (const e2 of edits) {
|
|
288615
|
-
console.log(` ${
|
|
288616
|
-
console.log(` ${
|
|
288617
|
-
console.log(` ${
|
|
288928
|
+
console.log(` ${import_picocolors26.default.dim(`${rel(e2.file)}:${e2.line}`)} ${import_picocolors26.default.cyan(e2.rule)}`);
|
|
288929
|
+
console.log(` ${import_picocolors26.default.red("-")} ${e2.before}`);
|
|
288930
|
+
console.log(` ${import_picocolors26.default.green("+")} ${e2.after}`);
|
|
288618
288931
|
}
|
|
288619
288932
|
}
|
|
288620
288933
|
if (manual.length > 0) {
|
|
288621
288934
|
console.log();
|
|
288622
|
-
console.log(
|
|
288935
|
+
console.log(import_picocolors26.default.bold(import_picocolors26.default.yellow(` ${manual.length} spot${manual.length === 1 ? "" : "s"} need manual review (structural):`)));
|
|
288623
288936
|
for (const m2 of manual) {
|
|
288624
|
-
console.log(` ${
|
|
288625
|
-
console.log(` ${
|
|
288937
|
+
console.log(` ${import_picocolors26.default.dim(`${rel(m2.file)}:${m2.line}`)} ${import_picocolors26.default.yellow(m2.rule)}`);
|
|
288938
|
+
console.log(` ${import_picocolors26.default.dim(m2.snippet)}`);
|
|
288626
288939
|
console.log(` \u2192 ${m2.hint}`);
|
|
288627
288940
|
}
|
|
288628
288941
|
}
|
|
288629
288942
|
console.log();
|
|
288630
288943
|
if (write) {
|
|
288631
288944
|
await project.save();
|
|
288632
|
-
console.log(
|
|
288945
|
+
console.log(import_picocolors26.default.green(` \u2713 Wrote ${edits.length} change${edits.length === 1 ? "" : "s"}. Review the diff, run your typecheck.`));
|
|
288633
288946
|
} else {
|
|
288634
|
-
console.log(
|
|
288947
|
+
console.log(import_picocolors26.default.dim(" Dry run. Re-run with `--write` to apply the auto-fixes above (manual items are never auto-written)."));
|
|
288635
288948
|
}
|
|
288636
288949
|
}
|
|
288637
288950
|
|
|
288638
288951
|
// src/pull.ts
|
|
288639
288952
|
init_cjs_shims();
|
|
288640
|
-
var
|
|
288641
|
-
var
|
|
288953
|
+
var import_errors21 = require("@abloatai/transaction/errors");
|
|
288954
|
+
var import_picocolors27 = __toESM(require_picocolors(), 1);
|
|
288642
288955
|
init_src();
|
|
288643
288956
|
var import_fs10 = require("fs");
|
|
288644
288957
|
init_theme();
|
|
@@ -288666,7 +288979,7 @@ function parsePullArgs(argv) {
|
|
|
288666
288979
|
force = true;
|
|
288667
288980
|
break;
|
|
288668
288981
|
default:
|
|
288669
|
-
throw new
|
|
288982
|
+
throw new import_errors21.AbloValidationError(`unknown flag: ${arg}`, { code: "cli_invalid_arguments" });
|
|
288670
288983
|
}
|
|
288671
288984
|
}
|
|
288672
288985
|
return { out, appSchema, importPath, force };
|
|
@@ -288736,56 +289049,56 @@ async function pull(argv) {
|
|
|
288736
289049
|
try {
|
|
288737
289050
|
args = parsePullArgs(argv);
|
|
288738
289051
|
} catch (err) {
|
|
288739
|
-
console.error(
|
|
289052
|
+
console.error(import_picocolors27.default.red(` ${err instanceof Error ? err.message : String(err)}`));
|
|
288740
289053
|
process.exit(1);
|
|
288741
289054
|
}
|
|
288742
289055
|
const dbUrl = readProjectAdminDatabaseUrl();
|
|
288743
289056
|
if (!dbUrl) {
|
|
288744
289057
|
console.error(
|
|
288745
|
-
|
|
289058
|
+
import_picocolors27.default.red(` No database.`) + import_picocolors27.default.dim(` Set ${import_picocolors27.default.bold(ADMIN_URL_VAR)} to the Postgres to pull from.`)
|
|
288746
289059
|
);
|
|
288747
289060
|
process.exit(1);
|
|
288748
289061
|
}
|
|
288749
289062
|
if ((0, import_fs10.existsSync)(args.out) && !args.force) {
|
|
288750
289063
|
console.error(
|
|
288751
|
-
|
|
289064
|
+
import_picocolors27.default.red(` ${args.out} already exists.`) + import_picocolors27.default.dim(` Re-run with ${import_picocolors27.default.bold("--force")} to overwrite.`)
|
|
288752
289065
|
);
|
|
288753
289066
|
process.exit(1);
|
|
288754
289067
|
}
|
|
288755
289068
|
console.log(`
|
|
288756
|
-
${brand("ablo")} ${
|
|
289069
|
+
${brand("ablo")} ${import_picocolors27.default.dim("pull")} ${import_picocolors27.default.dim(`schema "${args.appSchema}"`)}
|
|
288757
289070
|
`);
|
|
288758
289071
|
let result;
|
|
288759
289072
|
try {
|
|
288760
289073
|
result = await buildSchemaSourceFromDb({ dbUrl, appSchema: args.appSchema, importPath: args.importPath });
|
|
288761
289074
|
} catch (err) {
|
|
288762
|
-
console.error(
|
|
289075
|
+
console.error(import_picocolors27.default.red(` Couldn't read the database: ${err instanceof Error ? err.message : String(err)}`));
|
|
288763
289076
|
process.exit(1);
|
|
288764
289077
|
}
|
|
288765
289078
|
if (result.models.length === 0) {
|
|
288766
289079
|
console.error(
|
|
288767
|
-
|
|
289080
|
+
import_picocolors27.default.yellow(` No adoptable tables found`) + import_picocolors27.default.dim(` (a model needs an ${import_picocolors27.default.bold("id")} + ${import_picocolors27.default.bold("organization_id")} column).`)
|
|
288768
289081
|
);
|
|
288769
289082
|
process.exit(1);
|
|
288770
289083
|
}
|
|
288771
289084
|
(0, import_fs10.writeFileSync)(args.out, result.source);
|
|
288772
|
-
console.log(` ${
|
|
288773
|
-
console.log(` ${
|
|
289085
|
+
console.log(` ${import_picocolors27.default.green("\u2713")} wrote ${import_picocolors27.default.bold(args.out)} ${import_picocolors27.default.dim(`(${result.models.length} models)`)}`);
|
|
289086
|
+
console.log(` ${import_picocolors27.default.dim(`models: ${result.models.join(", ")}`)}`);
|
|
288774
289087
|
if (result.skipped.length > 0) {
|
|
288775
|
-
console.log(` ${
|
|
288776
|
-
for (const s of result.skipped) console.log(` ${
|
|
289088
|
+
console.log(` ${import_picocolors27.default.dim(`${result.skipped.length} table(s) skipped:`)}`);
|
|
289089
|
+
for (const s of result.skipped) console.log(` ${import_picocolors27.default.dim(`- ${s.name}: ${s.reason}`)}`);
|
|
288777
289090
|
}
|
|
288778
289091
|
console.log(
|
|
288779
289092
|
`
|
|
288780
|
-
${
|
|
289093
|
+
${import_picocolors27.default.dim("Introspection is lossy (enums, JSON shape, relations). Review the file, then")} ${import_picocolors27.default.bold("ablo check")}.
|
|
288781
289094
|
`
|
|
288782
289095
|
);
|
|
288783
289096
|
}
|
|
288784
289097
|
|
|
288785
289098
|
// src/prismaPull.ts
|
|
288786
289099
|
init_cjs_shims();
|
|
288787
|
-
var
|
|
288788
|
-
var
|
|
289100
|
+
var import_errors22 = require("@abloatai/transaction/errors");
|
|
289101
|
+
var import_picocolors28 = __toESM(require_picocolors(), 1);
|
|
288789
289102
|
var import_fs11 = require("fs");
|
|
288790
289103
|
init_theme();
|
|
288791
289104
|
var DEFAULT_SCHEMA = "prisma/schema.prisma";
|
|
@@ -288982,7 +289295,7 @@ function parsePrismaPullArgs(argv) {
|
|
|
288982
289295
|
force = true;
|
|
288983
289296
|
break;
|
|
288984
289297
|
default:
|
|
288985
|
-
if (arg.startsWith("--")) throw new
|
|
289298
|
+
if (arg.startsWith("--")) throw new import_errors22.AbloValidationError(`unknown flag: ${arg}`, { code: "cli_invalid_arguments" });
|
|
288986
289299
|
schema = arg;
|
|
288987
289300
|
}
|
|
288988
289301
|
}
|
|
@@ -288993,56 +289306,56 @@ async function prismaPull(argv) {
|
|
|
288993
289306
|
try {
|
|
288994
289307
|
args = parsePrismaPullArgs(argv);
|
|
288995
289308
|
} catch (err) {
|
|
288996
|
-
console.error(
|
|
289309
|
+
console.error(import_picocolors28.default.red(` ${err instanceof Error ? err.message : String(err)}`));
|
|
288997
289310
|
process.exit(1);
|
|
288998
289311
|
}
|
|
288999
289312
|
if (!(0, import_fs11.existsSync)(args.schema)) {
|
|
289000
289313
|
console.error(
|
|
289001
|
-
|
|
289314
|
+
import_picocolors28.default.red(` No Prisma schema at ${import_picocolors28.default.bold(args.schema)}.`) + import_picocolors28.default.dim(` Pass a path: ${import_picocolors28.default.bold("ablo pull prisma <path>")}.`)
|
|
289002
289315
|
);
|
|
289003
289316
|
process.exit(1);
|
|
289004
289317
|
}
|
|
289005
289318
|
if ((0, import_fs11.existsSync)(args.out) && !args.force) {
|
|
289006
289319
|
console.error(
|
|
289007
|
-
|
|
289320
|
+
import_picocolors28.default.red(` ${args.out} already exists.`) + import_picocolors28.default.dim(` Re-run with ${import_picocolors28.default.bold("--force")} to overwrite.`)
|
|
289008
289321
|
);
|
|
289009
289322
|
process.exit(1);
|
|
289010
289323
|
}
|
|
289011
289324
|
console.log(`
|
|
289012
|
-
${brand("ablo")} ${
|
|
289325
|
+
${brand("ablo")} ${import_picocolors28.default.dim("pull prisma")} ${import_picocolors28.default.dim(args.schema)}
|
|
289013
289326
|
`);
|
|
289014
289327
|
let result;
|
|
289015
289328
|
try {
|
|
289016
289329
|
const src = (0, import_fs11.readFileSync)(args.schema, "utf8");
|
|
289017
289330
|
result = buildSchemaSourceFromPrisma({ src, importPath: args.importPath });
|
|
289018
289331
|
} catch (err) {
|
|
289019
|
-
console.error(
|
|
289332
|
+
console.error(import_picocolors28.default.red(` Couldn't parse the schema: ${err instanceof Error ? err.message : String(err)}`));
|
|
289020
289333
|
process.exit(1);
|
|
289021
289334
|
}
|
|
289022
289335
|
if (result.models.length === 0) {
|
|
289023
289336
|
console.error(
|
|
289024
|
-
|
|
289337
|
+
import_picocolors28.default.yellow(` No adoptable models found`) + import_picocolors28.default.dim(` (a model needs an ${import_picocolors28.default.bold("id")} + ${import_picocolors28.default.bold("organizationId")} / ${import_picocolors28.default.bold("organization_id")}).`)
|
|
289025
289338
|
);
|
|
289026
289339
|
process.exit(1);
|
|
289027
289340
|
}
|
|
289028
289341
|
(0, import_fs11.writeFileSync)(args.out, result.source);
|
|
289029
|
-
console.log(` ${
|
|
289030
|
-
console.log(` ${
|
|
289342
|
+
console.log(` ${import_picocolors28.default.green("\u2713")} wrote ${import_picocolors28.default.bold(args.out)} ${import_picocolors28.default.dim(`(${result.models.length} models)`)}`);
|
|
289343
|
+
console.log(` ${import_picocolors28.default.dim(`models: ${result.models.join(", ")}`)}`);
|
|
289031
289344
|
if (result.skipped.length > 0) {
|
|
289032
|
-
console.log(` ${
|
|
289033
|
-
for (const s of result.skipped) console.log(` ${
|
|
289345
|
+
console.log(` ${import_picocolors28.default.dim(`${result.skipped.length} model(s) skipped:`)}`);
|
|
289346
|
+
for (const s of result.skipped) console.log(` ${import_picocolors28.default.dim(`- ${s.name}: ${s.reason}`)}`);
|
|
289034
289347
|
}
|
|
289035
289348
|
console.log(
|
|
289036
289349
|
`
|
|
289037
|
-
${
|
|
289350
|
+
${import_picocolors28.default.dim("Enums and relations were preserved. Review the file, then")} ${import_picocolors28.default.bold("ablo check")}.
|
|
289038
289351
|
`
|
|
289039
289352
|
);
|
|
289040
289353
|
}
|
|
289041
289354
|
|
|
289042
289355
|
// src/drizzlePull.ts
|
|
289043
289356
|
init_cjs_shims();
|
|
289044
|
-
var
|
|
289045
|
-
var
|
|
289357
|
+
var import_picocolors29 = __toESM(require_picocolors(), 1);
|
|
289358
|
+
var import_errors23 = require("@abloatai/transaction/errors");
|
|
289046
289359
|
var import_fs12 = require("fs");
|
|
289047
289360
|
var import_path7 = require("path");
|
|
289048
289361
|
init_theme();
|
|
@@ -289149,7 +289462,7 @@ function parseDrizzlePullArgs(argv) {
|
|
|
289149
289462
|
force = true;
|
|
289150
289463
|
break;
|
|
289151
289464
|
default:
|
|
289152
|
-
if (arg.startsWith("--")) throw new
|
|
289465
|
+
if (arg.startsWith("--")) throw new import_errors23.AbloValidationError(`unknown flag: ${arg}`, { code: "cli_invalid_arguments" });
|
|
289153
289466
|
schema = arg;
|
|
289154
289467
|
}
|
|
289155
289468
|
}
|
|
@@ -289166,27 +289479,27 @@ async function drizzlePull(argv) {
|
|
|
289166
289479
|
try {
|
|
289167
289480
|
args = parseDrizzlePullArgs(argv);
|
|
289168
289481
|
} catch (err) {
|
|
289169
|
-
console.error(
|
|
289482
|
+
console.error(import_picocolors29.default.red(` ${err instanceof Error ? err.message : String(err)}`));
|
|
289170
289483
|
process.exit(1);
|
|
289171
289484
|
}
|
|
289172
289485
|
if (!args.schema) {
|
|
289173
289486
|
console.error(
|
|
289174
|
-
|
|
289487
|
+
import_picocolors29.default.red(` No Drizzle schema given.`) + import_picocolors29.default.dim(` Pass the module: ${import_picocolors29.default.bold("ablo pull drizzle src/db/schema.ts")}.`)
|
|
289175
289488
|
);
|
|
289176
289489
|
process.exit(1);
|
|
289177
289490
|
}
|
|
289178
289491
|
if (!(0, import_fs12.existsSync)(args.schema)) {
|
|
289179
|
-
console.error(
|
|
289492
|
+
console.error(import_picocolors29.default.red(` No file at ${import_picocolors29.default.bold(args.schema)}.`));
|
|
289180
289493
|
process.exit(1);
|
|
289181
289494
|
}
|
|
289182
289495
|
if ((0, import_fs12.existsSync)(args.out) && !args.force) {
|
|
289183
289496
|
console.error(
|
|
289184
|
-
|
|
289497
|
+
import_picocolors29.default.red(` ${args.out} already exists.`) + import_picocolors29.default.dim(` Re-run with ${import_picocolors29.default.bold("--force")} to overwrite.`)
|
|
289185
289498
|
);
|
|
289186
289499
|
process.exit(1);
|
|
289187
289500
|
}
|
|
289188
289501
|
console.log(`
|
|
289189
|
-
${brand("ablo")} ${
|
|
289502
|
+
${brand("ablo")} ${import_picocolors29.default.dim("pull drizzle")} ${import_picocolors29.default.dim(args.schema)}
|
|
289190
289503
|
`);
|
|
289191
289504
|
let result;
|
|
289192
289505
|
try {
|
|
@@ -289194,26 +289507,26 @@ async function drizzlePull(argv) {
|
|
|
289194
289507
|
result = await buildSchemaSourceFromDrizzle({ mod, importPath: args.importPath });
|
|
289195
289508
|
} catch (err) {
|
|
289196
289509
|
const msg = err instanceof Error ? err.message : String(err);
|
|
289197
|
-
const hint = msg.includes("Cannot find package 'drizzle-orm'") ?
|
|
289198
|
-
console.error(
|
|
289510
|
+
const hint = msg.includes("Cannot find package 'drizzle-orm'") ? import_picocolors29.default.dim(` (install ${import_picocolors29.default.bold("drizzle-orm")} in this project)`) : "";
|
|
289511
|
+
console.error(import_picocolors29.default.red(` Couldn't load the schema: ${msg}`) + hint);
|
|
289199
289512
|
process.exit(1);
|
|
289200
289513
|
}
|
|
289201
289514
|
if (result.models.length === 0) {
|
|
289202
289515
|
console.error(
|
|
289203
|
-
|
|
289516
|
+
import_picocolors29.default.yellow(` No adoptable tables found`) + import_picocolors29.default.dim(` (a table needs an ${import_picocolors29.default.bold("id")} + ${import_picocolors29.default.bold("organization_id")} column).`)
|
|
289204
289517
|
);
|
|
289205
289518
|
process.exit(1);
|
|
289206
289519
|
}
|
|
289207
289520
|
(0, import_fs12.writeFileSync)(args.out, result.source);
|
|
289208
|
-
console.log(` ${
|
|
289209
|
-
console.log(` ${
|
|
289521
|
+
console.log(` ${import_picocolors29.default.green("\u2713")} wrote ${import_picocolors29.default.bold(args.out)} ${import_picocolors29.default.dim(`(${result.models.length} models)`)}`);
|
|
289522
|
+
console.log(` ${import_picocolors29.default.dim(`models: ${result.models.join(", ")}`)}`);
|
|
289210
289523
|
if (result.skipped.length > 0) {
|
|
289211
|
-
console.log(` ${
|
|
289212
|
-
for (const s of result.skipped) console.log(` ${
|
|
289524
|
+
console.log(` ${import_picocolors29.default.dim(`${result.skipped.length} table(s) skipped:`)}`);
|
|
289525
|
+
for (const s of result.skipped) console.log(` ${import_picocolors29.default.dim(`- ${s.name}: ${s.reason}`)}`);
|
|
289213
289526
|
}
|
|
289214
289527
|
console.log(
|
|
289215
289528
|
`
|
|
289216
|
-
${
|
|
289529
|
+
${import_picocolors29.default.dim("Enums and relations were preserved. Review the file, then")} ${import_picocolors29.default.bold("ablo check")}.
|
|
289217
289530
|
`
|
|
289218
289531
|
);
|
|
289219
289532
|
}
|
|
@@ -289226,7 +289539,7 @@ init_telemetry();
|
|
|
289226
289539
|
|
|
289227
289540
|
// src/init/options.ts
|
|
289228
289541
|
init_cjs_shims();
|
|
289229
|
-
var
|
|
289542
|
+
var import_node_fs4 = require("fs");
|
|
289230
289543
|
var import_node_path3 = require("path");
|
|
289231
289544
|
var INIT_FRAMEWORKS = ["nextjs", "vite", "remix", "vanilla"];
|
|
289232
289545
|
var INIT_AUTHS = [
|
|
@@ -289266,7 +289579,7 @@ function parseInitArgs(args) {
|
|
|
289266
289579
|
function detectOrm(override, root = process.cwd()) {
|
|
289267
289580
|
if (override === "prisma" || override === "drizzle" || override === "none") return override;
|
|
289268
289581
|
try {
|
|
289269
|
-
const pkg = JSON.parse((0,
|
|
289582
|
+
const pkg = JSON.parse((0, import_node_fs4.readFileSync)((0, import_node_path3.resolve)(root, "package.json"), "utf8"));
|
|
289270
289583
|
const dependencies = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
289271
289584
|
if (dependencies["@prisma/client"] || dependencies.prisma) return "prisma";
|
|
289272
289585
|
if (dependencies["drizzle-orm"]) return "drizzle";
|
|
@@ -289275,24 +289588,24 @@ function detectOrm(override, root = process.cwd()) {
|
|
|
289275
289588
|
return "none";
|
|
289276
289589
|
}
|
|
289277
289590
|
function detectNextLayout(root = process.cwd()) {
|
|
289278
|
-
const useSrc = (0,
|
|
289591
|
+
const useSrc = (0, import_node_fs4.existsSync)((0, import_node_path3.resolve)(root, "src", "app")) || !(0, import_node_fs4.existsSync)((0, import_node_path3.resolve)(root, "app")) && (0, import_node_fs4.existsSync)((0, import_node_path3.resolve)(root, "src"));
|
|
289279
289592
|
return useSrc ? { appBase: (0, import_node_path3.join)("src", "app"), aliasBase: "src" } : { appBase: "app", aliasBase: "." };
|
|
289280
289593
|
}
|
|
289281
289594
|
function detectPackageManager(root = process.cwd()) {
|
|
289282
|
-
if ((0,
|
|
289283
|
-
if ((0,
|
|
289284
|
-
if ((0,
|
|
289595
|
+
if ((0, import_node_fs4.existsSync)((0, import_node_path3.resolve)(root, "pnpm-lock.yaml"))) return "pnpm";
|
|
289596
|
+
if ((0, import_node_fs4.existsSync)((0, import_node_path3.resolve)(root, "yarn.lock"))) return "yarn";
|
|
289597
|
+
if ((0, import_node_fs4.existsSync)((0, import_node_path3.resolve)(root, "bun.lockb"))) return "bun";
|
|
289285
289598
|
return "npm";
|
|
289286
289599
|
}
|
|
289287
289600
|
|
|
289288
289601
|
// src/init/run.ts
|
|
289289
289602
|
init_cjs_shims();
|
|
289290
289603
|
var import_node_child_process3 = require("child_process");
|
|
289291
|
-
var
|
|
289604
|
+
var import_node_fs6 = require("fs");
|
|
289292
289605
|
var import_node_path5 = require("path");
|
|
289293
289606
|
init_dist2();
|
|
289294
|
-
var
|
|
289295
|
-
var
|
|
289607
|
+
var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
289608
|
+
var import_errors24 = require("@abloatai/transaction/errors");
|
|
289296
289609
|
init_dbRole();
|
|
289297
289610
|
init_config();
|
|
289298
289611
|
init_projects();
|
|
@@ -289717,9 +290030,9 @@ export function RecordList() {
|
|
|
289717
290030
|
|
|
289718
290031
|
// src/init/writer.ts
|
|
289719
290032
|
init_cjs_shims();
|
|
289720
|
-
var
|
|
290033
|
+
var import_node_fs5 = require("fs");
|
|
289721
290034
|
var import_node_path4 = require("path");
|
|
289722
|
-
var
|
|
290035
|
+
var import_node_crypto7 = require("crypto");
|
|
289723
290036
|
function projectInitWritePlan(plan) {
|
|
289724
290037
|
return setupInitPlanProjectionSchema.parse({
|
|
289725
290038
|
root: plan.root,
|
|
@@ -289741,10 +290054,10 @@ function absolute(root, path) {
|
|
|
289741
290054
|
return target;
|
|
289742
290055
|
}
|
|
289743
290056
|
function sha2562(content) {
|
|
289744
|
-
return (0,
|
|
290057
|
+
return (0, import_node_crypto7.createHash)("sha256").update(content).digest("hex");
|
|
289745
290058
|
}
|
|
289746
290059
|
function readIfPresent(path) {
|
|
289747
|
-
return (0,
|
|
290060
|
+
return (0, import_node_fs5.existsSync)(path) ? (0, import_node_fs5.readFileSync)(path, "utf8") : void 0;
|
|
289748
290061
|
}
|
|
289749
290062
|
function mergeEnvironmentTemplate(existing, template) {
|
|
289750
290063
|
const assignments = template.split(/\r?\n/).map((line) => {
|
|
@@ -289813,18 +290126,18 @@ function planInitWrites(input) {
|
|
|
289813
290126
|
return { root, actions, conflicts };
|
|
289814
290127
|
}
|
|
289815
290128
|
function writeAtomic(path, content, kind) {
|
|
289816
|
-
(0,
|
|
289817
|
-
const temporary = (0, import_node_path4.join)((0, import_node_path4.dirname)(path), `.${(0,
|
|
289818
|
-
(0,
|
|
290129
|
+
(0, import_node_fs5.mkdirSync)((0, import_node_path4.dirname)(path), { recursive: true });
|
|
290130
|
+
const temporary = (0, import_node_path4.join)((0, import_node_path4.dirname)(path), `.${(0, import_node_crypto7.randomUUID)()}.ablo-init.tmp`);
|
|
290131
|
+
(0, import_node_fs5.writeFileSync)(temporary, content, { flag: "wx" });
|
|
289819
290132
|
try {
|
|
289820
290133
|
if (kind === "create") {
|
|
289821
|
-
(0,
|
|
289822
|
-
(0,
|
|
290134
|
+
(0, import_node_fs5.linkSync)(temporary, path);
|
|
290135
|
+
(0, import_node_fs5.unlinkSync)(temporary);
|
|
289823
290136
|
} else {
|
|
289824
|
-
(0,
|
|
290137
|
+
(0, import_node_fs5.renameSync)(temporary, path);
|
|
289825
290138
|
}
|
|
289826
290139
|
} catch (error) {
|
|
289827
|
-
if ((0,
|
|
290140
|
+
if ((0, import_node_fs5.existsSync)(temporary)) (0, import_node_fs5.unlinkSync)(temporary);
|
|
289828
290141
|
throw error;
|
|
289829
290142
|
}
|
|
289830
290143
|
}
|
|
@@ -289858,7 +290171,7 @@ function bailIfCancelled(value) {
|
|
|
289858
290171
|
async function chooseOption(name, flagValue, fallback, allowed, interactive, prompt) {
|
|
289859
290172
|
if (flagValue !== void 0) {
|
|
289860
290173
|
if (!allowed.includes(flagValue)) {
|
|
289861
|
-
throw new
|
|
290174
|
+
throw new import_errors24.AbloValidationError(
|
|
289862
290175
|
`Invalid --${name} "${flagValue}". Allowed: ${allowed.join(", ")}`,
|
|
289863
290176
|
{ code: "cli_invalid_arguments" }
|
|
289864
290177
|
);
|
|
@@ -289882,7 +290195,7 @@ async function ensureInitProject(opts) {
|
|
|
289882
290195
|
const slug = opts.project ?? projectSlugFromPackageName(
|
|
289883
290196
|
(() => {
|
|
289884
290197
|
try {
|
|
289885
|
-
return JSON.parse((0,
|
|
290198
|
+
return JSON.parse((0, import_node_fs6.readFileSync)("package.json", "utf8")).name;
|
|
289886
290199
|
} catch {
|
|
289887
290200
|
return void 0;
|
|
289888
290201
|
}
|
|
@@ -289892,7 +290205,7 @@ async function ensureInitProject(opts) {
|
|
|
289892
290205
|
const ensured = await ensureProject(slug);
|
|
289893
290206
|
if (ensured) {
|
|
289894
290207
|
console.log(
|
|
289895
|
-
` ${
|
|
290208
|
+
` ${import_picocolors30.default.green("\u2713")} ${ensured.created ? "Created" : "Using"} project ${import_picocolors30.default.bold(ensured.slug)} ${import_picocolors30.default.dim(`(${ensured.id})`)} \u2014 keys you mint for it are isolated from the org's other apps.`
|
|
289896
290209
|
);
|
|
289897
290210
|
}
|
|
289898
290211
|
}
|
|
@@ -289904,16 +290217,16 @@ function renderWritePlan(actions) {
|
|
|
289904
290217
|
}
|
|
289905
290218
|
function renderAppliedWrites(actions) {
|
|
289906
290219
|
return actions.map((action) => {
|
|
289907
|
-
const status2 = action.kind === "create" ?
|
|
289908
|
-
return `${
|
|
290220
|
+
const status2 = action.kind === "create" ? import_picocolors30.default.green("created") : action.kind === "update" ? import_picocolors30.default.yellow("updated") : import_picocolors30.default.dim("unchanged");
|
|
290221
|
+
return `${import_picocolors30.default.green("\u2713")} ${action.path}${action.note ?? ""} ${import_picocolors30.default.dim(`(${status2})`)}`;
|
|
289909
290222
|
}).join("\n");
|
|
289910
290223
|
}
|
|
289911
290224
|
async function runInit(args = []) {
|
|
289912
290225
|
const opts = parseInitArgs(args);
|
|
289913
290226
|
const interactive = Boolean(process.stdin.isTTY) && !opts.yes && !process.env.CI;
|
|
289914
|
-
Ie(`${brand("ablo")} ${
|
|
289915
|
-
if (!(0,
|
|
289916
|
-
throw new
|
|
290227
|
+
Ie(`${brand("ablo")} ${import_picocolors30.default.dim("sync engine")}`);
|
|
290228
|
+
if (!(0, import_node_fs6.existsSync)("package.json")) {
|
|
290229
|
+
throw new import_errors24.AbloValidationError("No package.json found. Run this from your project root.", {
|
|
289917
290230
|
code: "cli_invalid_arguments"
|
|
289918
290231
|
});
|
|
289919
290232
|
}
|
|
@@ -289989,7 +290302,7 @@ async function runInit(args = []) {
|
|
|
289989
290302
|
if (pullExisting) {
|
|
289990
290303
|
const dbUrl = readProjectAdminDatabaseUrl();
|
|
289991
290304
|
if (!dbUrl) {
|
|
289992
|
-
schemaNote =
|
|
290305
|
+
schemaNote = import_picocolors30.default.dim(` (no ${ADMIN_URL_VAR} \u2014 wrote starter; run \`ablo pull\` later)`);
|
|
289993
290306
|
} else {
|
|
289994
290307
|
try {
|
|
289995
290308
|
const pulled = await buildSchemaSourceFromDb({
|
|
@@ -289999,12 +290312,12 @@ async function runInit(args = []) {
|
|
|
289999
290312
|
});
|
|
290000
290313
|
if (pulled.models.length > 0) {
|
|
290001
290314
|
schemaSource = pulled.source;
|
|
290002
|
-
schemaNote =
|
|
290315
|
+
schemaNote = import_picocolors30.default.dim(` (pulled ${pulled.models.length} models)`);
|
|
290003
290316
|
} else {
|
|
290004
|
-
schemaNote =
|
|
290317
|
+
schemaNote = import_picocolors30.default.dim(" (no adoptable tables \u2014 wrote starter)");
|
|
290005
290318
|
}
|
|
290006
290319
|
} catch {
|
|
290007
|
-
schemaNote =
|
|
290320
|
+
schemaNote = import_picocolors30.default.dim(" (pull failed \u2014 wrote starter)");
|
|
290008
290321
|
}
|
|
290009
290322
|
}
|
|
290010
290323
|
}
|
|
@@ -290048,7 +290361,7 @@ async function runInit(args = []) {
|
|
|
290048
290361
|
const writePlan = planInitWrites({ files, environment: { path: envFile, template: envBody } });
|
|
290049
290362
|
if (writePlan.conflicts.length > 0) {
|
|
290050
290363
|
const occupied = writePlan.conflicts.map(({ path }) => ` - ${path}`).join("\n");
|
|
290051
|
-
throw new
|
|
290364
|
+
throw new import_errors24.AbloValidationError(
|
|
290052
290365
|
`Ablo init did not change any files because these application-owned paths already contain different contents:
|
|
290053
290366
|
${occupied}
|
|
290054
290367
|
|
|
@@ -290058,7 +290371,7 @@ Move them, reconcile Ablo manually, or rerun after they match the generated scaf
|
|
|
290058
290371
|
}
|
|
290059
290372
|
if (opts.plan) {
|
|
290060
290373
|
Me(renderWritePlan(writePlan.actions), "Plan (no files changed)");
|
|
290061
|
-
Se(`Dry run complete. Re-run without ${
|
|
290374
|
+
Se(`Dry run complete. Re-run without ${import_picocolors30.default.bold("--plan")} to apply it.`);
|
|
290062
290375
|
return setupInitResultSchema.parse({
|
|
290063
290376
|
status: "planned",
|
|
290064
290377
|
plan: projectInitWritePlan(writePlan)
|
|
@@ -290079,28 +290392,28 @@ Move them, reconcile Ablo manually, or rerun after they match the generated scaf
|
|
|
290079
290392
|
progress.stop("Installed @abloatai/ablo");
|
|
290080
290393
|
} catch {
|
|
290081
290394
|
progress.stop(
|
|
290082
|
-
`${
|
|
290395
|
+
`${import_picocolors30.default.yellow("!")} Couldn't auto-install \u2014 run ${import_picocolors30.default.bold(`${packageManager2} install @abloatai/ablo`)}`
|
|
290083
290396
|
);
|
|
290084
290397
|
}
|
|
290085
290398
|
}
|
|
290086
290399
|
const steps = [
|
|
290087
|
-
`Run ${
|
|
290088
|
-
`Set ${
|
|
290089
|
-
`Run ${
|
|
290400
|
+
`Run ${import_picocolors30.default.bold("npx ablo login")} to authorize branch management`,
|
|
290401
|
+
`Set ${import_picocolors30.default.bold("DATABASE_URL")} in ${import_picocolors30.default.bold(envFile)} \u2014 your Postgres is the system of record; rows live there, never with Ablo`,
|
|
290402
|
+
`Run ${import_picocolors30.default.bold("npx ablo dev")} \u2014 pushes your schema definition and watches for changes`,
|
|
290090
290403
|
...storage === "replication" ? [
|
|
290091
|
-
`Connect your database \u2014 ${
|
|
290092
|
-
`Verify it \u2014 ${
|
|
290093
|
-
`Register it \u2014 ${
|
|
290404
|
+
`Connect your database \u2014 ${import_picocolors30.default.bold("npx ablo connect")} prints the one-time logical-replication setup SQL to run on your Postgres`,
|
|
290405
|
+
`Verify it \u2014 ${import_picocolors30.default.bold("npx ablo connect check")} walks wal_level, the publication, the role, and replica identity, with the exact fix for anything missing`,
|
|
290406
|
+
`Register it \u2014 ${import_picocolors30.default.bold("npx ablo connect register")} tells Ablo to start replicating; your app keeps writing through your own backend while Ablo tails the WAL`
|
|
290094
290407
|
] : [
|
|
290095
|
-
`Provision your DB: ${
|
|
290408
|
+
`Provision your DB: ${import_picocolors30.default.bold("npx ablo migrate")} (creates your Ablo-model tables + the adapter tables; keep your own migrations for everything else), then mount ${import_picocolors30.default.bold(`${abloDir}/data-source.ts`)} at ${import_picocolors30.default.bold("/api/ablo/source")}`
|
|
290096
290409
|
],
|
|
290097
290410
|
...framework === "nextjs" ? [
|
|
290098
|
-
`Wrap ${
|
|
290411
|
+
`Wrap ${import_picocolors30.default.bold((0, import_node_path5.join)(layout.appBase, "layout.tsx"))} in ${import_picocolors30.default.bold("<Providers>")} (${(0, import_node_path5.join)(layout.appBase, "providers.tsx")}) and add your auth to ${import_picocolors30.default.bold((0, import_node_path5.join)(layout.appBase, "api", "ablo-session", "route.ts"))}`
|
|
290099
290412
|
] : [],
|
|
290100
|
-
`Run ${
|
|
290413
|
+
`Run ${import_picocolors30.default.bold(`${packageManager2} run dev`)} and open two browser tabs \u2014 changes sync in real-time`,
|
|
290101
290414
|
...agent ? [
|
|
290102
|
-
`Run ${
|
|
290103
|
-
`Run ${
|
|
290415
|
+
`Run ${import_picocolors30.default.bold(`npx tsx ${abloDir}/agent.ts`)} \u2014 an AI teammate edits the same records`,
|
|
290416
|
+
`Run ${import_picocolors30.default.bold("npx ablo logs")} to watch human + agent commits stream by`
|
|
290104
290417
|
] : []
|
|
290105
290418
|
];
|
|
290106
290419
|
Me(steps.map((step, index) => `${index + 1}. ${step}`).join("\n"), "Next steps");
|
|
@@ -290108,26 +290421,26 @@ Move them, reconcile Ablo manually, or rerun after they match the generated scaf
|
|
|
290108
290421
|
if (existingKey) {
|
|
290109
290422
|
await ensureInitProject(opts);
|
|
290110
290423
|
Se(
|
|
290111
|
-
`Already authorized ${
|
|
290424
|
+
`Already authorized ${import_picocolors30.default.dim(`(${existingKey.slice(0, 11)}\u2026)`)}. Run ${import_picocolors30.default.bold("npx ablo dev")} next. ${import_picocolors30.default.dim("Docs:")} https://abloatai.com/docs`
|
|
290112
290425
|
);
|
|
290113
290426
|
return initResult;
|
|
290114
290427
|
}
|
|
290115
290428
|
if (interactive && opts.login) {
|
|
290116
290429
|
const loginNow = await ye({ message: "Log in now? (opens your browser)", initialValue: true });
|
|
290117
290430
|
if (!pD(loginNow) && loginNow) {
|
|
290118
|
-
Se(`${
|
|
290431
|
+
Se(`${import_picocolors30.default.dim("Docs:")} https://abloatai.com/docs`);
|
|
290119
290432
|
await login();
|
|
290120
290433
|
await ensureInitProject(opts);
|
|
290121
290434
|
return initResult;
|
|
290122
290435
|
}
|
|
290123
290436
|
}
|
|
290124
|
-
Se(`Run ${
|
|
290437
|
+
Se(`Run ${import_picocolors30.default.bold("npx ablo login")} when ready. ${import_picocolors30.default.dim("Docs:")} https://abloatai.com/docs`);
|
|
290125
290438
|
return initResult;
|
|
290126
290439
|
}
|
|
290127
290440
|
|
|
290128
290441
|
// src/index.ts
|
|
290129
290442
|
var LOGO = `
|
|
290130
|
-
${brand("ablo")} ${
|
|
290443
|
+
${brand("ablo")} ${import_picocolors31.default.dim("sync engine")}
|
|
290131
290444
|
`;
|
|
290132
290445
|
var HANDLERS = {
|
|
290133
290446
|
setup: (argv) => runSetup(argv),
|
|
@@ -290146,6 +290459,7 @@ var HANDLERS = {
|
|
|
290146
290459
|
webhooks: (argv) => webhooks([...argv]),
|
|
290147
290460
|
check: (argv) => check([...argv]),
|
|
290148
290461
|
docs: (argv) => docs([...argv]),
|
|
290462
|
+
feedback: (argv) => feedback([...argv]),
|
|
290149
290463
|
connect: (argv) => connect([...argv]),
|
|
290150
290464
|
migrate: (argv) => migrate([...argv]),
|
|
290151
290465
|
upgrade: (argv) => upgrade([...argv]),
|
|
@@ -290159,7 +290473,7 @@ async function runDev(argv) {
|
|
|
290159
290473
|
const devArgs = [...argv];
|
|
290160
290474
|
const oneShot = devArgs.includes("--no-watch");
|
|
290161
290475
|
console.log(
|
|
290162
|
-
|
|
290476
|
+
import_picocolors31.default.dim(
|
|
290163
290477
|
oneShot ? " `ablo dev --no-watch` prepares this Git branch and pushes once." : " `ablo dev` prepares this Git branch and watches the schema."
|
|
290164
290478
|
)
|
|
290165
290479
|
);
|
|
@@ -290177,7 +290491,7 @@ async function runPush2(argv) {
|
|
|
290177
290491
|
}
|
|
290178
290492
|
function runRenamedSchema(argv) {
|
|
290179
290493
|
const forwarded = argv.slice(1).join(" ");
|
|
290180
|
-
console.error(` ${
|
|
290494
|
+
console.error(` ${import_picocolors31.default.red("\u2717")} \`ablo schema push\` was renamed to \`${brand("ablo push")}\`.`);
|
|
290181
290495
|
console.error(` Run \`ablo push${forwarded ? " " + forwarded : ""}\` instead.`);
|
|
290182
290496
|
process.exitCode = 1;
|
|
290183
290497
|
}
|
|
@@ -290187,7 +290501,7 @@ async function main() {
|
|
|
290187
290501
|
const argv = process.argv.slice(3);
|
|
290188
290502
|
if (!command && raw !== void 0 && raw !== "help" && !raw.startsWith("-")) {
|
|
290189
290503
|
const suggestion = suggestCommand(raw);
|
|
290190
|
-
throw new
|
|
290504
|
+
throw new import_errors25.AbloValidationError(
|
|
290191
290505
|
`\`${raw}\` isn't an ablo command.` + (suggestion ? ` Did you mean \`ablo ${suggestion}\`?` : " Run `ablo help --all` to see every command."),
|
|
290192
290506
|
{ code: "cli_invalid_arguments" }
|
|
290193
290507
|
);
|
|
@@ -290228,7 +290542,7 @@ function printCoreHelp() {
|
|
|
290228
290542
|
const width = Math.max(...rows.map((r2) => r2.run.length)) + 4;
|
|
290229
290543
|
console.log(LOGO);
|
|
290230
290544
|
for (const group of CORE_GROUPS) {
|
|
290231
|
-
console.log(` ${
|
|
290545
|
+
console.log(` ${import_picocolors31.default.bold(group)}`);
|
|
290232
290546
|
const printed = group === "More" ? [...coreRows(group), ...extra] : coreRows(group);
|
|
290233
290547
|
for (const row of printed) console.log(` npx ablo ${row.run.padEnd(width)}${row.does}`);
|
|
290234
290548
|
console.log();
|
|
@@ -290237,7 +290551,7 @@ function printCoreHelp() {
|
|
|
290237
290551
|
}
|
|
290238
290552
|
function printSchemaReminder() {
|
|
290239
290553
|
console.log(
|
|
290240
|
-
|
|
290554
|
+
import_picocolors31.default.dim(` Edit ${import_picocolors31.default.bold("ablo/schema.ts")}, then push \u2014 writes to models you haven't pushed fail with `) + import_picocolors31.default.yellow("server_execute_unknown_model") + import_picocolors31.default.dim(".")
|
|
290241
290555
|
);
|
|
290242
290556
|
console.log();
|
|
290243
290557
|
}
|
|
@@ -290247,7 +290561,7 @@ function printFullHelp() {
|
|
|
290247
290561
|
) + 2;
|
|
290248
290562
|
console.log(LOGO);
|
|
290249
290563
|
for (const group of FULL_GROUPS) {
|
|
290250
|
-
console.log(` ${
|
|
290564
|
+
console.log(` ${import_picocolors31.default.bold(group)}`);
|
|
290251
290565
|
for (const row of fullRows(group)) {
|
|
290252
290566
|
console.log(row.does === void 0 ? ` ${" ".repeat(9)}${row.run}` : ` npx ablo ${row.run.padEnd(width)}${row.does}`);
|
|
290253
290567
|
}
|