@abloatai/cli 0.40.0 → 0.41.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 +57 -6
- package/package.json +3 -3
package/dist/cli.cjs
CHANGED
|
@@ -5102,8 +5102,8 @@ var init_disconnect = __esm({
|
|
|
5102
5102
|
npx ablo connect deregister Remove the active project's data source (confirms first)
|
|
5103
5103
|
npx ablo connect deregister --yes Skip the confirmation
|
|
5104
5104
|
|
|
5105
|
-
Acts on one plane \u2014 the active project (${import_picocolors8.default.bold("ablo projects use")}) in the
|
|
5106
|
-
environment (${import_picocolors8.default.bold("
|
|
5105
|
+
Acts on one plane \u2014 the active project (${import_picocolors8.default.bold("ablo projects use")}) in the key's
|
|
5106
|
+
environment (its ${import_picocolors8.default.bold("sk_test_")}/${import_picocolors8.default.bold("sk_live_")} prefix), shown before it runs. Removes the registration and
|
|
5107
5107
|
Ablo's replication state for that plane, so Ablo stops reading and writing the
|
|
5108
5108
|
database. Reconnect with ${import_picocolors8.default.bold("ablo connect")}.`;
|
|
5109
5109
|
}
|
|
@@ -5696,9 +5696,11 @@ async function runConnectApply(args) {
|
|
|
5696
5696
|
if (!apiKey) {
|
|
5697
5697
|
const loggedIn = resolveManagementKey() !== void 0;
|
|
5698
5698
|
throw new import_errors9.AbloAuthenticationError(
|
|
5699
|
-
loggedIn ? `You are logged in, but this project has no
|
|
5700
|
-
|
|
5701
|
-
|
|
5699
|
+
loggedIn ? `You are logged in, but this project has no ${getMode()} data key.
|
|
5700
|
+
|
|
5701
|
+
The key is looked for in ABLO_API_KEY, then in the credential stored for the active project in the active mode (${getMode()}). Logging in stores a management credential, which administers the project but cannot register a database \u2014 and a key for another mode is never used implicitly, so registering against production takes an explicit production key.
|
|
5702
|
+
|
|
5703
|
+
Mint a sandbox key with \`npx ablo dev\`, or set ABLO_API_KEY to the key of the plane this database should join (its sk_live_ key for production).` : "Not logged in, and no ABLO_API_KEY is set. Run `ablo login` (or set ABLO_API_KEY) so Ablo knows which project to register this database for.",
|
|
5702
5704
|
{ code: "cli_api_key_missing" }
|
|
5703
5705
|
);
|
|
5704
5706
|
}
|
|
@@ -283947,6 +283949,46 @@ var BY_NAME = new Map(ALL.map((c) => [c.name, c]));
|
|
|
283947
283949
|
function parseCommandName(raw) {
|
|
283948
283950
|
return raw !== void 0 && BY_NAME.has(raw) ? raw : null;
|
|
283949
283951
|
}
|
|
283952
|
+
var REDIRECTS = /* @__PURE__ */ new Map([
|
|
283953
|
+
["disconnect", "connect deregister"],
|
|
283954
|
+
["deregister", "connect deregister"],
|
|
283955
|
+
["register", "connect register"],
|
|
283956
|
+
["rotate", "connect rotate"]
|
|
283957
|
+
]);
|
|
283958
|
+
function editDistance(a, b4) {
|
|
283959
|
+
const cols = b4.length + 1;
|
|
283960
|
+
let prevPrev = new Int32Array(cols);
|
|
283961
|
+
let prev = new Int32Array(cols);
|
|
283962
|
+
let curr = new Int32Array(cols);
|
|
283963
|
+
const at = (row, index) => row[index] ?? 0;
|
|
283964
|
+
for (let j2 = 0; j2 < cols; j2++) prev[j2] = j2;
|
|
283965
|
+
for (let i = 1; i <= a.length; i++) {
|
|
283966
|
+
curr[0] = i;
|
|
283967
|
+
for (let j2 = 1; j2 < cols; j2++) {
|
|
283968
|
+
const cost = a.charCodeAt(i - 1) === b4.charCodeAt(j2 - 1) ? 0 : 1;
|
|
283969
|
+
let best = Math.min(at(prev, j2) + 1, at(curr, j2 - 1) + 1, at(prev, j2 - 1) + cost);
|
|
283970
|
+
if (i > 1 && j2 > 1 && a.charCodeAt(i - 1) === b4.charCodeAt(j2 - 2) && a.charCodeAt(i - 2) === b4.charCodeAt(j2 - 1)) {
|
|
283971
|
+
best = Math.min(best, at(prevPrev, j2 - 2) + 1);
|
|
283972
|
+
}
|
|
283973
|
+
curr[j2] = best;
|
|
283974
|
+
}
|
|
283975
|
+
[prevPrev, prev, curr] = [prev, curr, prevPrev];
|
|
283976
|
+
}
|
|
283977
|
+
return at(prev, b4.length);
|
|
283978
|
+
}
|
|
283979
|
+
function suggestCommand(raw) {
|
|
283980
|
+
const exact = REDIRECTS.get(raw);
|
|
283981
|
+
if (exact) return exact;
|
|
283982
|
+
let best = null;
|
|
283983
|
+
for (const name of [...BY_NAME.keys(), ...REDIRECTS.keys()]) {
|
|
283984
|
+
const distance = editDistance(raw.toLowerCase(), name);
|
|
283985
|
+
if (distance <= 2 && (best === null || distance < best.distance)) {
|
|
283986
|
+
best = { name, distance };
|
|
283987
|
+
}
|
|
283988
|
+
}
|
|
283989
|
+
if (best === null) return null;
|
|
283990
|
+
return REDIRECTS.get(best.name) ?? best.name;
|
|
283991
|
+
}
|
|
283950
283992
|
function usageFor(name) {
|
|
283951
283993
|
return BY_NAME.get(name)?.usage;
|
|
283952
283994
|
}
|
|
@@ -283961,6 +284003,7 @@ function fullRows(group) {
|
|
|
283961
284003
|
}
|
|
283962
284004
|
|
|
283963
284005
|
// src/index.ts
|
|
284006
|
+
var import_errors20 = require("@abloatai/transaction/errors");
|
|
283964
284007
|
init_push();
|
|
283965
284008
|
|
|
283966
284009
|
// src/generate.ts
|
|
@@ -286239,8 +286282,16 @@ function runRenamedSchema(argv) {
|
|
|
286239
286282
|
process.exitCode = 1;
|
|
286240
286283
|
}
|
|
286241
286284
|
async function main() {
|
|
286242
|
-
const
|
|
286285
|
+
const raw = process.argv[2];
|
|
286286
|
+
const command = parseCommandName(raw);
|
|
286243
286287
|
const argv = process.argv.slice(3);
|
|
286288
|
+
if (!command && raw !== void 0 && raw !== "help" && !raw.startsWith("-")) {
|
|
286289
|
+
const suggestion = suggestCommand(raw);
|
|
286290
|
+
throw new import_errors20.AbloValidationError(
|
|
286291
|
+
`\`${raw}\` isn't an ablo command.` + (suggestion ? ` Did you mean \`ablo ${suggestion}\`?` : " Run `ablo help --all` to see every command."),
|
|
286292
|
+
{ code: "cli_invalid_arguments" }
|
|
286293
|
+
);
|
|
286294
|
+
}
|
|
286244
286295
|
if (command && argv.some((a) => a === "--help" || a === "-h")) {
|
|
286245
286296
|
const usage = usageFor(command);
|
|
286246
286297
|
if (usage) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abloatai/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "The ablo command line: set up Ablo, connect your database, and push your schema from the terminal.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"directory": "packages/cli"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@abloatai/transaction": "^0.
|
|
33
|
+
"@abloatai/transaction": "^0.41.0",
|
|
34
34
|
"jiti": "^2.7.0",
|
|
35
35
|
"zod": "^4.4.3",
|
|
36
|
-
"@abloatai/humans": "^0.
|
|
36
|
+
"@abloatai/humans": "^0.41.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@clack/prompts": "^0.11.0",
|