@altertable/cli 1.11.0 → 1.12.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.js +142 -25
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7035,7 +7035,7 @@ var require_public_api = __commonJS(function(exports) {
|
|
|
7035
7035
|
});
|
|
7036
7036
|
|
|
7037
7037
|
// src/version.ts
|
|
7038
|
-
var VERSION = "1.
|
|
7038
|
+
var VERSION = "1.12.0";
|
|
7039
7039
|
var USER_AGENT = `altertable-cli/${VERSION}`;
|
|
7040
7040
|
|
|
7041
7041
|
// src/lib/transport-defaults.ts
|
|
@@ -7356,6 +7356,7 @@ function invalidValue(name, value, expectation) {
|
|
|
7356
7356
|
return new ConfigurationError(`Invalid ${name} value ${JSON.stringify(value)}; expected ${expectation}.`);
|
|
7357
7357
|
}
|
|
7358
7358
|
var ENV_SCHEMA = {
|
|
7359
|
+
ALTERTABLE_AGENT_MODE: { parse: booleanValue },
|
|
7359
7360
|
ALTERTABLE_ALLOW_INSECURE_HTTP: { parse: booleanValue },
|
|
7360
7361
|
ALTERTABLE_API_BASE: { parse: optional },
|
|
7361
7362
|
ALTERTABLE_API_KEY: { parse: optional, secret: true },
|
|
@@ -8330,13 +8331,42 @@ function parseTimeoutSeconds(value, flagName) {
|
|
|
8330
8331
|
}
|
|
8331
8332
|
|
|
8332
8333
|
// src/lib/global-flags.ts
|
|
8333
|
-
|
|
8334
|
+
var AGENT_ENV_VARIABLES = [
|
|
8335
|
+
"AI_AGENT",
|
|
8336
|
+
"AGENT",
|
|
8337
|
+
"CLAUDECODE",
|
|
8338
|
+
"CODEX_CI",
|
|
8339
|
+
"CODEX_SANDBOX",
|
|
8340
|
+
"CODEX_THREAD_ID",
|
|
8341
|
+
"CURSOR_AGENT",
|
|
8342
|
+
"GEMINI_CLI",
|
|
8343
|
+
"COPILOT_AGENT",
|
|
8344
|
+
"COPILOT_CLI",
|
|
8345
|
+
"COPILOT_AGENT_SESSION_ID"
|
|
8346
|
+
];
|
|
8347
|
+
function resolveAgentMode(argv, { env, stdoutIsTTY }) {
|
|
8348
|
+
if (argv.includes("--no-agent"))
|
|
8349
|
+
return false;
|
|
8350
|
+
if (argv.includes("--agent"))
|
|
8351
|
+
return true;
|
|
8352
|
+
const override = env.ALTERTABLE_AGENT_MODE?.toLowerCase();
|
|
8353
|
+
if (override === "1" || override === "true")
|
|
8354
|
+
return true;
|
|
8355
|
+
if (override === "0" || override === "false")
|
|
8356
|
+
return false;
|
|
8357
|
+
const explicitFormat = argv.some((arg) => arg === "--json" || arg === "--format" || arg.startsWith("--format="));
|
|
8358
|
+
return !stdoutIsTTY && !explicitFormat && AGENT_ENV_VARIABLES.some((name) => Boolean(env[name]));
|
|
8359
|
+
}
|
|
8360
|
+
function parseGlobalOutputFlags(argv, environment = {
|
|
8361
|
+
env: copyProcessEnv(),
|
|
8362
|
+
stdoutIsTTY: Boolean(process.stdout.isTTY)
|
|
8363
|
+
}) {
|
|
8334
8364
|
const separatorIndex = argv.indexOf("--");
|
|
8335
8365
|
const globalArgs = separatorIndex === -1 ? argv : argv.slice(0, separatorIndex);
|
|
8336
8366
|
return {
|
|
8337
8367
|
debug: globalArgs.includes("--debug") || globalArgs.includes("-d"),
|
|
8338
8368
|
json: globalArgs.includes("--json"),
|
|
8339
|
-
agent: globalArgs
|
|
8369
|
+
agent: resolveAgentMode(globalArgs, environment),
|
|
8340
8370
|
noColor: globalArgs.includes("--no-color")
|
|
8341
8371
|
};
|
|
8342
8372
|
}
|
|
@@ -8348,6 +8378,8 @@ function mergeGlobalFlagsFromArgs(context, args) {
|
|
|
8348
8378
|
merged.json = Boolean(args.json);
|
|
8349
8379
|
if (args.agent !== undefined)
|
|
8350
8380
|
merged.agent = Boolean(args.agent);
|
|
8381
|
+
if (args["no-agent"])
|
|
8382
|
+
merged.agent = false;
|
|
8351
8383
|
if (args["no-color"] !== undefined)
|
|
8352
8384
|
merged.noColor = Boolean(args["no-color"]);
|
|
8353
8385
|
const profile = asCliArgString(args.profile);
|
|
@@ -20582,6 +20614,12 @@ function createCompletionCommand(getRootCommand) {
|
|
|
20582
20614
|
return command;
|
|
20583
20615
|
}
|
|
20584
20616
|
|
|
20617
|
+
// src/package-metadata.ts
|
|
20618
|
+
var CLI_PACKAGE_METADATA = {
|
|
20619
|
+
name: "@altertable/cli",
|
|
20620
|
+
repositorySlug: "altertable-ai/altertable-cli"
|
|
20621
|
+
};
|
|
20622
|
+
|
|
20585
20623
|
// src/lib/updater.ts
|
|
20586
20624
|
import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync5, renameSync as renameSync3, rmSync as rmSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
20587
20625
|
import { chmodSync as chmodSync2 } from "fs";
|
|
@@ -20643,12 +20681,6 @@ function resolveProcessExecutablePath(options = {}) {
|
|
|
20643
20681
|
return canonicalPath(resolvedExecPath);
|
|
20644
20682
|
}
|
|
20645
20683
|
|
|
20646
|
-
// src/package-metadata.ts
|
|
20647
|
-
var CLI_PACKAGE_METADATA = {
|
|
20648
|
-
name: "@altertable/cli",
|
|
20649
|
-
repositorySlug: "altertable-ai/altertable-cli"
|
|
20650
|
-
};
|
|
20651
|
-
|
|
20652
20684
|
// src/release-manifest.ts
|
|
20653
20685
|
var RELEASE_TARGETS = [
|
|
20654
20686
|
{
|
|
@@ -21260,7 +21292,7 @@ function spawnOutputText(value) {
|
|
|
21260
21292
|
}
|
|
21261
21293
|
return "";
|
|
21262
21294
|
}
|
|
21263
|
-
function verifyInstalledCliVersion(expectedVersion, command = "altertable", spawnImpl = spawnSync4, description = "Installed
|
|
21295
|
+
function verifyInstalledCliVersion(expectedVersion, command = "altertable", spawnImpl = spawnSync4, description = "Installed Altertable CLI") {
|
|
21264
21296
|
const result = spawnImpl(command, ["--version"], { encoding: "utf8" });
|
|
21265
21297
|
if (result.error) {
|
|
21266
21298
|
throw new CliError(`Unable to verify ${description.toLowerCase()} version.`, {
|
|
@@ -21294,7 +21326,7 @@ function replaceFileAtomically(targetPath, replacementPath) {
|
|
|
21294
21326
|
} catch {}
|
|
21295
21327
|
}
|
|
21296
21328
|
rmSync4(replacementPath, { force: true });
|
|
21297
|
-
throw new CliError("Unable to replace the
|
|
21329
|
+
throw new CliError("Unable to replace the Altertable CLI binary.", {
|
|
21298
21330
|
cause: error,
|
|
21299
21331
|
details: `Backup path: ${backupPath}`
|
|
21300
21332
|
});
|
|
@@ -21350,7 +21382,7 @@ async function installGitHubBinaryRelease(version, options = {}) {
|
|
|
21350
21382
|
fetchImpl
|
|
21351
21383
|
});
|
|
21352
21384
|
try {
|
|
21353
|
-
const verifiedVersion = options.verify === false ? release.version : verifyInstalledCliVersion(release.version, tempPath, options.spawnImpl, "Downloaded
|
|
21385
|
+
const verifiedVersion = options.verify === false ? release.version : verifyInstalledCliVersion(release.version, tempPath, options.spawnImpl, "Downloaded Altertable CLI");
|
|
21354
21386
|
replaceFileAtomically(targetPath, tempPath);
|
|
21355
21387
|
return {
|
|
21356
21388
|
installed_version: release.version,
|
|
@@ -21507,7 +21539,7 @@ function writeAutomaticUpdateNotice(sink, latestVersion) {
|
|
|
21507
21539
|
sink.writeMetadata([
|
|
21508
21540
|
"",
|
|
21509
21541
|
renderDisplayText([
|
|
21510
|
-
span(`Update available:
|
|
21542
|
+
span(`Update available: Altertable CLI ${latestVersion} (current ${VERSION}).`, "subtle")
|
|
21511
21543
|
]),
|
|
21512
21544
|
renderDisplayText([
|
|
21513
21545
|
span(`Run ${recommendedInstallCommand(latestVersion)} to install it.`, "subtle")
|
|
@@ -21552,7 +21584,7 @@ function formatUpdateResult(result, targetVersion) {
|
|
|
21552
21584
|
if (comparison < 0) {
|
|
21553
21585
|
return [
|
|
21554
21586
|
renderDisplayText([
|
|
21555
|
-
span(`Target version v${target} is older than installed
|
|
21587
|
+
span(`Target version v${target} is older than installed Altertable CLI v${current}.`)
|
|
21556
21588
|
]),
|
|
21557
21589
|
renderDisplayText([
|
|
21558
21590
|
span("Run "),
|
|
@@ -21569,13 +21601,13 @@ function formatUpdateResult(result, targetVersion) {
|
|
|
21569
21601
|
if (!result.update_available) {
|
|
21570
21602
|
return renderDisplayText([
|
|
21571
21603
|
span("Congrats!", "success"),
|
|
21572
|
-
span(" You're already on the latest version of
|
|
21604
|
+
span(" You're already on the latest version of Altertable CLI "),
|
|
21573
21605
|
span(`(which is v${normalizeVersion(result.current_version)})`, "subtle")
|
|
21574
21606
|
]);
|
|
21575
21607
|
}
|
|
21576
21608
|
return [
|
|
21577
21609
|
renderDisplayText([
|
|
21578
|
-
span(`A new version of
|
|
21610
|
+
span(`A new version of Altertable CLI is available: v${normalizeVersion(result.latest_version)} `),
|
|
21579
21611
|
span(`(current v${normalizeVersion(result.current_version)})`, "subtle")
|
|
21580
21612
|
]),
|
|
21581
21613
|
renderDisplayText([
|
|
@@ -21655,16 +21687,69 @@ async function executeUpdateCommand(args, sink, dependencies = DEFAULT_DEPENDENC
|
|
|
21655
21687
|
await writeUpdateCheck(result, targetVersion, sink);
|
|
21656
21688
|
return;
|
|
21657
21689
|
}
|
|
21658
|
-
sink.
|
|
21690
|
+
if (!sink.json) {
|
|
21691
|
+
sink.writeMetadata([formatUpdateAnnouncement(result)]);
|
|
21692
|
+
}
|
|
21659
21693
|
const installed = await dependencies.installCliUpdate(result.latest_version, {
|
|
21660
21694
|
stdio: sink.json ? "pipe" : "inherit"
|
|
21661
21695
|
});
|
|
21662
21696
|
await writeCommandOutput({
|
|
21663
|
-
kind: "
|
|
21697
|
+
kind: "normalized",
|
|
21664
21698
|
data: installed,
|
|
21665
|
-
|
|
21699
|
+
humanText: formatInstalledUpdate(result, installed.verified_version)
|
|
21666
21700
|
}, sink);
|
|
21667
21701
|
}
|
|
21702
|
+
function formatUpdateAnnouncement(result) {
|
|
21703
|
+
if (result.update_available) {
|
|
21704
|
+
return renderDisplayText([
|
|
21705
|
+
span("Altertable CLI ", "strong"),
|
|
21706
|
+
span(`v${result.latest_version}`, "accent"),
|
|
21707
|
+
span(" is out! You're on "),
|
|
21708
|
+
span(`v${result.current_version}`, "string")
|
|
21709
|
+
]);
|
|
21710
|
+
}
|
|
21711
|
+
if (compareVersions(result.latest_version, result.current_version) === 0) {
|
|
21712
|
+
return renderDisplayText([
|
|
21713
|
+
span("Reinstalling Altertable CLI ", "strong"),
|
|
21714
|
+
span(`v${result.current_version}`, "accent"),
|
|
21715
|
+
span(".")
|
|
21716
|
+
]);
|
|
21717
|
+
}
|
|
21718
|
+
return renderDisplayText([
|
|
21719
|
+
span("Downgrading Altertable CLI to ", "strong"),
|
|
21720
|
+
span(`v${result.latest_version}`, "accent"),
|
|
21721
|
+
span(". You're on "),
|
|
21722
|
+
span(`v${result.current_version}`, "string")
|
|
21723
|
+
]);
|
|
21724
|
+
}
|
|
21725
|
+
function formatInstalledUpdate(result, installedVersion) {
|
|
21726
|
+
const repositoryUrl = `https://github.com/${CLI_PACKAGE_METADATA.repositorySlug}`;
|
|
21727
|
+
const version = `v${normalizeVersion(installedVersion)}`;
|
|
21728
|
+
const currentVersion = `v${normalizeVersion(result.current_version)}`;
|
|
21729
|
+
const comparison = compareVersions(installedVersion, result.current_version);
|
|
21730
|
+
let outcome = "Reinstalled.";
|
|
21731
|
+
if (comparison > 0) {
|
|
21732
|
+
outcome = "Upgraded.";
|
|
21733
|
+
} else if (comparison < 0) {
|
|
21734
|
+
outcome = "Downgraded.";
|
|
21735
|
+
}
|
|
21736
|
+
const lines = [
|
|
21737
|
+
outcome,
|
|
21738
|
+
"",
|
|
21739
|
+
`Release notes for Altertable CLI ${version}:`,
|
|
21740
|
+
"",
|
|
21741
|
+
renderDisplayText([span(` ${repositoryUrl}/releases/tag/${version}`, "accent")]),
|
|
21742
|
+
"",
|
|
21743
|
+
"Report any bugs:",
|
|
21744
|
+
"",
|
|
21745
|
+
` ${repositoryUrl}/issues`
|
|
21746
|
+
];
|
|
21747
|
+
if (comparison !== 0) {
|
|
21748
|
+
lines.push("", "Commit log:", "", ` ${repositoryUrl}/compare/${currentVersion}...${version}`);
|
|
21749
|
+
}
|
|
21750
|
+
return lines.join(`
|
|
21751
|
+
`);
|
|
21752
|
+
}
|
|
21668
21753
|
|
|
21669
21754
|
// src/lib/management/model.ts
|
|
21670
21755
|
function hasRequiredString(record, key) {
|
|
@@ -22209,7 +22294,7 @@ Start with the [authoring router](AGENTS.md) for data and view changes, or the [
|
|
|
22209
22294
|
|
|
22210
22295
|
Run \`altertable app lint\` to check the app locally. Use \`altertable app lint --lakehouse\` to execute each operation's declared \`checks\` against the selected profile.
|
|
22211
22296
|
|
|
22212
|
-
\`altertable app upgrade\` pins the package version tested with your CLI and updates the lockfile. It preserves app code and does not downgrade a newer installed package. Restart a running preview after upgrading.
|
|
22297
|
+
\`altertable app upgrade\` pins the package version tested with your CLI and updates the lockfile. It preserves app code and does not downgrade a newer installed package. Version 0.70.0 requires typed query parameters and projections, with decoded record rows; migrate existing query declarations after upgrading. Restart a running preview after upgrading.
|
|
22213
22298
|
|
|
22214
22299
|
## Version control
|
|
22215
22300
|
|
|
@@ -22235,7 +22320,7 @@ Commit app source, \`package.json\`, and \`bun.lock\`. A fresh clone installs \`
|
|
|
22235
22320
|
"": {
|
|
22236
22321
|
"name": "data-app-starter",
|
|
22237
22322
|
"dependencies": {
|
|
22238
|
-
"@altertable/data-app": "0.
|
|
22323
|
+
"@altertable/data-app": "0.70.0",
|
|
22239
22324
|
"react": "19.3.0",
|
|
22240
22325
|
"react-dom": "19.3.0",
|
|
22241
22326
|
},
|
|
@@ -22251,7 +22336,9 @@ Commit app source, \`package.json\`, and \`bun.lock\`. A fresh clone installs \`
|
|
|
22251
22336
|
},
|
|
22252
22337
|
},
|
|
22253
22338
|
"packages": {
|
|
22254
|
-
"@altertable/data-app": ["@altertable/data-app@0.
|
|
22339
|
+
"@altertable/data-app": ["@altertable/data-app@0.70.0", "", { "dependencies": { "@altertable/lakehouse": "0.4.1", "@floating-ui/react": "0.27.20", "@internationalized/date": "3.12.4", "@tanstack/react-query": "5.104.0", "fflate": "0.8.3", "fuzzysort": "4.0.2", "html-to-image": "1.11.13", "lucide-react": "1.48.0", "react-aria-components": "1.21.1", "recharts": "3.10.1" }, "peerDependencies": { "react": ">=19.2.0", "react-dom": ">=19.2.0" } }, "sha512-tfrzwRP4rGnnMM1Ddu0BYwl1q0c3KegIeBEHf4e/iK/EkTfFIHGw+5Mp7SqS+kmsPR7TpNFbWhCVeAYGH1f0xw=="],
|
|
22340
|
+
|
|
22341
|
+
"@altertable/lakehouse": ["@altertable/lakehouse@0.4.1", "", {}, "sha512-m7d15cWt+WUGW7lVw2KYGD+Se8MzO25G7SWSuFd+OasBxWmOJNa2IrgvOHGVEbnZ+kexTUy9NjAGQ69sG4V91w=="],
|
|
22255
22342
|
|
|
22256
22343
|
"@floating-ui/core": ["@floating-ui/core@1.8.0", "", { "dependencies": { "@floating-ui/utils": "^0.2.12" } }, "sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ=="],
|
|
22257
22344
|
|
|
@@ -22555,7 +22642,7 @@ exact = true
|
|
|
22555
22642
|
"build": "bun build src/index.html --outdir=dist --production"
|
|
22556
22643
|
},
|
|
22557
22644
|
"dependencies": {
|
|
22558
|
-
"@altertable/data-app": "0.
|
|
22645
|
+
"@altertable/data-app": "0.70.0",
|
|
22559
22646
|
"react": "19.3.0",
|
|
22560
22647
|
"react-dom": "19.3.0"
|
|
22561
22648
|
},
|
|
@@ -22591,6 +22678,7 @@ export default defineDataApp({
|
|
|
22591
22678
|
connection: {
|
|
22592
22679
|
statement: "SELECT 1 AS connection_check",
|
|
22593
22680
|
params: {},
|
|
22681
|
+
projections: { connection_check: { type: "number" } },
|
|
22594
22682
|
},
|
|
22595
22683
|
},
|
|
22596
22684
|
});
|
|
@@ -22654,6 +22742,31 @@ import app from "#app/config.ts";
|
|
|
22654
22742
|
/** Connectivity probe only: its successful query supplies no analytical result. Replace it with
|
|
22655
22743
|
* bounded, validated operations that cover the questions the finished app will answer. */
|
|
22656
22744
|
export const operations = { connection: connectionCheck(app.queries) };
|
|
22745
|
+
`, "src/preview.ts": `import { resolve } from "node:path";
|
|
22746
|
+
import { localLakehouse } from "@altertable/data-app/server/bun";
|
|
22747
|
+
import { serveAppFile } from "@altertable/data-app/server/bun/preview";
|
|
22748
|
+
|
|
22749
|
+
const preview = await serveAppFile({
|
|
22750
|
+
file: resolve(import.meta.dir, "../index.tsx"),
|
|
22751
|
+
port: Number(process.env.PORT ?? 25837),
|
|
22752
|
+
lakehouse: localLakehouse(),
|
|
22753
|
+
});
|
|
22754
|
+
|
|
22755
|
+
let stopping = false;
|
|
22756
|
+
async function shutdown() {
|
|
22757
|
+
if (stopping) return;
|
|
22758
|
+
stopping = true;
|
|
22759
|
+
try {
|
|
22760
|
+
await preview.stop();
|
|
22761
|
+
process.exit(0);
|
|
22762
|
+
} catch (error) {
|
|
22763
|
+
console.error(error);
|
|
22764
|
+
process.exit(1);
|
|
22765
|
+
}
|
|
22766
|
+
}
|
|
22767
|
+
process.on("SIGINT", shutdown);
|
|
22768
|
+
process.on("SIGTERM", shutdown);
|
|
22769
|
+
console.log(\`Data app running at \${preview.url}\`);
|
|
22657
22770
|
`, "src/server.ts": `import page from "#app/index.html";
|
|
22658
22771
|
import { serveLocalApp } from "@altertable/data-app/server/bun";
|
|
22659
22772
|
import { operations } from "#app/operations.ts";
|
|
@@ -23063,7 +23176,6 @@ async function check() {
|
|
|
23063
23176
|
!/^[a-z][a-z0-9-]*$/.test(name) ||
|
|
23064
23177
|
!operation ||
|
|
23065
23178
|
typeof operation.input !== "function" ||
|
|
23066
|
-
typeof operation.output !== "function" ||
|
|
23067
23179
|
typeof operation.run !== "function" ||
|
|
23068
23180
|
!Array.isArray(operation.checks) ||
|
|
23069
23181
|
!operation.checks.length ||
|
|
@@ -23075,7 +23187,7 @@ async function check() {
|
|
|
23075
23187
|
(!Number.isInteger(operation.policy.maxResponseBytes) ||
|
|
23076
23188
|
operation.policy.maxResponseBytes < 1))
|
|
23077
23189
|
) {
|
|
23078
|
-
throw new Error(\`Operation "\${name}" needs input
|
|
23190
|
+
throw new Error(\`Operation "\${name}" needs an input parser, a run function, check inputs, and limits.\`);
|
|
23079
23191
|
}
|
|
23080
23192
|
for (const input of operation.checks) {
|
|
23081
23193
|
try {
|
|
@@ -24318,6 +24430,11 @@ var ROOT_ARGS = defineArguments({
|
|
|
24318
24430
|
description: "Agent-friendly preset: structured JSON output, no pager or terminal styling",
|
|
24319
24431
|
flagScope: "global"
|
|
24320
24432
|
},
|
|
24433
|
+
"no-agent": {
|
|
24434
|
+
type: "boolean",
|
|
24435
|
+
description: "Disable agent mode, including automatic detection",
|
|
24436
|
+
flagScope: "global"
|
|
24437
|
+
},
|
|
24321
24438
|
"no-color": {
|
|
24322
24439
|
type: "boolean",
|
|
24323
24440
|
description: "Disable terminal colors and styling",
|