@altertable/cli 1.9.1 → 1.10.1

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.
Files changed (2) hide show
  1. package/dist/cli.js +214 -49
  2. 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.9.1";
7038
+ var VERSION = "1.10.1";
7039
7039
  var USER_AGENT = `altertable-cli/${VERSION}`;
7040
7040
 
7041
7041
  // src/lib/transport-defaults.ts
@@ -22102,7 +22102,7 @@ async function runAppCommand(command, directory, appEnvironment, signal) {
22102
22102
  var appBuildCommand = defineCommand({
22103
22103
  metadata: {
22104
22104
  name: "build",
22105
- description: "Typecheck and build a data app without Altertable credentials.",
22105
+ description: "Typecheck and build a local data app without Altertable credentials.",
22106
22106
  examples: ["altertable app build", "altertable app build --dir ./my-app"]
22107
22107
  },
22108
22108
  args: {
@@ -22180,7 +22180,12 @@ dist/
22180
22180
  ]
22181
22181
  }
22182
22182
  }
22183
- `, "AGENTS.md": "# Build this data app\n\nInspect source data, time coverage and existing definitions before choosing an exploration. For broad questions, investigate complementary angles. Build conclusions from observed results; do not present association as cause. Keep copy concise and relevant to the reader.\n\nRead `node_modules/@altertable/data-app/AGENTS.md` and its [app authoring guide](node_modules/@altertable/data-app/docs/app-authoring.md) before changing the app. Run `bun install --frozen-lockfile` if the package is not installed.\n\n| Task | App-owned files | Read next |\n| --- | --- | --- |\n| Connect a source, define a query, or change inputs | `app.json`, `src/operations.ts`, optional `src/variables.ts` | [Data and operation authoring](docs/data.md) |\n| Build a view, filters, request states, or Present steps | `src/App.tsx`, `src/styles.css` | [View authoring](docs/views.md) |\n| Explain the exploration or define terms | `src/data-context.ts` or `.tsx` | [Data guidance](docs/data.md), [context APIs](node_modules/@altertable/data-app/docs/react.md#find-ui-by-task) |\n| Change title, scope, or brand | `app.json` | [Config and appearance APIs](node_modules/@altertable/data-app/docs/app-authoring.md) |\n| Find a component, hook, or parser | Read the installed package docs | [Package authoring guide](node_modules/@altertable/data-app/docs/app-authoring.md) |\n| Replace the local server with hosting | `src/server.ts` | [Server authorization boundary](node_modules/@altertable/data-app/docs/server.md) |\n\nEdit app-owned source and use public package APIs. Do not edit installed package files. The generated connectivity screen is scaffolding, not an example analysis.\n\nRun `altertable app check --lakehouse` with the matching profile, then inspect the exploration at phone and desktop widths. Verify that its findings and interactions answer the user's question.\n", "README.md": `# Getting started
22183
+ `, "AGENTS.md": `# Build this data app
22184
+
22185
+ Read and follow the [data app authoring instructions](https://github.com/altertable-ai/data-app/blob/main/examples/starter-local-data-app/AGENTS.md) before changing this app.
22186
+
22187
+ See [README.md](README.md) for CLI setup, checks, and upgrades.
22188
+ `, "README.md": `# Getting started
22184
22189
 
22185
22190
  This starter runs a lightweight SQL query to check the lakehouse connection. \u201CConnected\u201D appears only after that query succeeds; having a configured profile alone is not enough. The check does not establish access to specific datasets.
22186
22191
 
@@ -22202,7 +22207,7 @@ Start with the [authoring router](AGENTS.md) for data and view changes, or the [
22202
22207
 
22203
22208
  ## Check and upgrade
22204
22209
 
22205
- Run \`altertable app check\` to check the app locally. Use \`altertable app check --lakehouse\` to execute each operation's declared \`checks\` against the selected profile.
22210
+ 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.
22206
22211
 
22207
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.
22208
22213
 
@@ -22230,7 +22235,7 @@ Commit app source, \`package.json\`, and \`bun.lock\`. A fresh clone installs \`
22230
22235
  "": {
22231
22236
  "name": "data-app-starter",
22232
22237
  "dependencies": {
22233
- "@altertable/data-app": "0.65.0",
22238
+ "@altertable/data-app": "0.66.0",
22234
22239
  "react": "19.3.0",
22235
22240
  "react-dom": "19.3.0",
22236
22241
  },
@@ -22246,7 +22251,7 @@ Commit app source, \`package.json\`, and \`bun.lock\`. A fresh clone installs \`
22246
22251
  },
22247
22252
  },
22248
22253
  "packages": {
22249
- "@altertable/data-app": ["@altertable/data-app@0.65.0", "", { "dependencies": { "@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", "lucide-react": "1.48.0", "react-aria-components": "1.21.1" }, "peerDependencies": { "react": ">=19.2.0", "react-dom": ">=19.2.0" } }, "sha512-BvaUwOhjUx0PzQbc8DUf5NUPpXL4VBcZ5LGegFB8Y41rQnmJIQk81AmP+Dg5iz1j/NwlsuiB8ABBUE6nY6e1aQ=="],
22254
+ "@altertable/data-app": ["@altertable/data-app@0.66.0", "", { "dependencies": { "@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" }, "peerDependencies": { "react": ">=19.2.0", "react-dom": ">=19.2.0" } }, "sha512-558Acl33lVYDxpuTE8npNxeSzDYnve4s2A6kz9KxzdW+dDlJkdJT6jEzKaizZDYmIf4s86A0gY1uaEgij3kO/Q=="],
22250
22255
 
22251
22256
  "@floating-ui/core": ["@floating-ui/core@1.8.0", "", { "dependencies": { "@floating-ui/utils": "^0.2.12" } }, "sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ=="],
22252
22257
 
@@ -22422,6 +22427,8 @@ Commit app source, \`package.json\`, and \`bun.lock\`. A fresh clone installs \`
22422
22427
 
22423
22428
  "fuzzysort": ["fuzzysort@4.0.2", "", {}, "sha512-3c7yD6rK1EXIsqpcu1ZVzXJugODWNMzvUij6yTiziaAHrpNS8kzFOI9mJLE8pmG4K9JOaVgzQRgklfOEk8f4Tg=="],
22424
22429
 
22430
+ "html-to-image": ["html-to-image@1.11.13", "", {}, "sha512-cuOPoI7WApyhBElTTb9oqsawRvZ0rHhaHwghRLlTuffoD1B2aDemlCruLeZrUIIdvG7gs9xeELEPm6PhuASqrg=="],
22431
+
22425
22432
  "lucide-react": ["lucide-react@1.48.0", "", { "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-R0CIKY/fXiC6y9xRBADgsK+VW2p/pcTJOMhLZf1T+uG+vJUvyUR02nGOgmIIC7MPkiNK4Ox8QDnbqF8rJYWPZQ=="],
22426
22433
 
22427
22434
  "oxfmt": ["oxfmt@0.70.0", "", { "dependencies": { "tinypool": "2.1.2" }, "optionalDependencies": { "@oxfmt/binding-android-arm-eabi": "0.70.0", "@oxfmt/binding-android-arm64": "0.70.0", "@oxfmt/binding-darwin-arm64": "0.70.0", "@oxfmt/binding-darwin-x64": "0.70.0", "@oxfmt/binding-freebsd-x64": "0.70.0", "@oxfmt/binding-linux-arm-gnueabihf": "0.70.0", "@oxfmt/binding-linux-arm-musleabihf": "0.70.0", "@oxfmt/binding-linux-arm64-gnu": "0.70.0", "@oxfmt/binding-linux-arm64-musl": "0.70.0", "@oxfmt/binding-linux-ppc64-gnu": "0.70.0", "@oxfmt/binding-linux-riscv64-gnu": "0.70.0", "@oxfmt/binding-linux-riscv64-musl": "0.70.0", "@oxfmt/binding-linux-s390x-gnu": "0.70.0", "@oxfmt/binding-linux-x64-gnu": "0.70.0", "@oxfmt/binding-linux-x64-musl": "0.70.0", "@oxfmt/binding-openharmony-arm64": "0.70.0", "@oxfmt/binding-win32-arm64-msvc": "0.70.0", "@oxfmt/binding-win32-ia32-msvc": "0.70.0", "@oxfmt/binding-win32-x64-msvc": "0.70.0" }, "peerDependencies": { "svelte": "^5.0.0", "vite-plus": "*" }, "optionalPeers": ["svelte", "vite-plus"], "bin": { "oxfmt": "bin/oxfmt" } }, "sha512-IsHxZ4y0wQLLMhnrJblBJgZsLDzfULrJnAw5j/QqsTlMa/m3AqsbToi+W71uhBGaqlqq/PbbjvHc09TJwdv3Tw=="],
@@ -22457,26 +22464,6 @@ Commit app source, \`package.json\`, and \`bun.lock\`. A fresh clone installs \`
22457
22464
  }
22458
22465
  `, "bunfig.toml": `[install]
22459
22466
  exact = true
22460
- `, "docs/data.md": `# Data authoring
22461
-
22462
- Inspect catalogs, time coverage, and existing definitions before selecting the exploration. Explore several useful angles for broad requests. Use bounded queries and observed results.
22463
-
22464
- | File | Owns |
22465
- | --- | --- |
22466
- | \`app.json\` | Title, verified scope, and appearance. |
22467
- | \`src/operations.ts\` | Bounded server-side queries, validation, and fixed live-check inputs. Credentials stay on the server. |
22468
- | \`src/variables.ts\` | Optional reader-controlled defaults, URL state, and operation inputs. |
22469
- | \`src/data-context.ts\` or \`.tsx\` | Exploration description, glossary, named queries, and optional source identifiers. |
22470
- | \`src/App.tsx\` | Questions, filters, result states, cards, and optional story. |
22471
-
22472
- [Execute named queries](../node_modules/@altertable/data-app/docs/contract.md) and [bind evidence](../node_modules/@altertable/data-app/docs/react.md#bind-evidence) using the runtime contracts. Prefer a date variable for ongoing questions; choose a fixed period for deliberate historical explorations.
22473
-
22474
- \`app check --lakehouse\` verifies declared operations and known profile scope. Environment-only credentials may not identify an organization; verify source identity during discovery when that metadata is unavailable.
22475
- `, "docs/views.md": `# View authoring
22476
-
22477
- Lead with a supported finding and provide complementary ways to explore the question. Check actual content at phone and desktop widths in both themes.
22478
-
22479
- [Bind a view](../node_modules/@altertable/data-app/docs/react.md#bind-a-view) for variables, request states, shared skeletons, metrics and comparisons. [Bind evidence](../node_modules/@altertable/data-app/docs/react.md#bind-evidence) for glossary definitions and Present steps. The [UI map](../node_modules/@altertable/data-app/docs/react.md#find-ui-by-task) routes other components to their types.
22480
22467
  `, "package.json": `{
22481
22468
  "name": "data-app-starter",
22482
22469
  "private": true,
@@ -22494,7 +22481,7 @@ Lead with a supported finding and provide complementary ways to explore the ques
22494
22481
  "build": "bun build src/index.html --outdir=dist --production"
22495
22482
  },
22496
22483
  "dependencies": {
22497
- "@altertable/data-app": "0.65.0",
22484
+ "@altertable/data-app": "0.66.0",
22498
22485
  "react": "19.3.0",
22499
22486
  "react-dom": "19.3.0"
22500
22487
  },
@@ -22508,7 +22495,7 @@ Lead with a supported finding and provide complementary ways to explore the ques
22508
22495
  "typescript": "7.0.2"
22509
22496
  }
22510
22497
  }
22511
- `, "src/App.tsx": `import { GettingStarted } from "@altertable/data-app/react";
22498
+ `, "src/App.tsx": `import { GettingStarted } from "@altertable/data-app/react/ui";
22512
22499
  import { dataContext } from "#app/data-context.ts";
22513
22500
  import app from "#app/config.ts";
22514
22501
 
@@ -22608,7 +22595,7 @@ serveLocalApp({ page, operations, title: app.title });
22608
22595
  var appCreateCommand = defineCommand({
22609
22596
  metadata: {
22610
22597
  name: "create",
22611
- description: "Create a data app project with a live connection check.",
22598
+ description: "Create a local data app project with a live connection check.",
22612
22599
  examples: [
22613
22600
  "altertable app create product-pulse",
22614
22601
  "altertable app create product-pulse --dir ./apps/product-pulse",
@@ -22669,11 +22656,11 @@ var appCreateCommand = defineCommand({
22669
22656
  await rm(directory, { recursive: true, force: true });
22670
22657
  throw new CliError(`Could not create data app in ${directory}.`, { cause: error });
22671
22658
  }
22672
- const nextSteps = profileName ? ["app dev", "app check", "app build"].map((command) => `altertable --profile ${profileName} ${command}`) : [
22659
+ const nextSteps = profileName ? ["app dev", "app lint", "app build"].map((command) => `altertable --profile ${profileName} ${command}`) : [
22673
22660
  "Set organization and environment in app.json.",
22674
22661
  "Select a matching profile, or configure one with `altertable login --org <org> --env <env>`.",
22675
22662
  "altertable app dev",
22676
- "altertable app check --lakehouse",
22663
+ "altertable app lint --lakehouse",
22677
22664
  "altertable app build"
22678
22665
  ];
22679
22666
  const result = {
@@ -22819,7 +22806,7 @@ function appPort(value) {
22819
22806
  return value;
22820
22807
  }
22821
22808
 
22822
- // src/commands/app/check.ts
22809
+ // src/commands/app/lint.ts
22823
22810
  import { readFile as readFile4, readdir } from "fs/promises";
22824
22811
  import { join as join10 } from "path";
22825
22812
 
@@ -23069,12 +23056,12 @@ try {
23069
23056
  }
23070
23057
  `;
23071
23058
 
23072
- // src/commands/app/check.ts
23073
- var appCheckCommand = defineCommand({
23059
+ // src/commands/app/lint.ts
23060
+ var appLintCommand = defineCommand({
23074
23061
  metadata: {
23075
- name: "check",
23076
- description: "Validate a data app's format, lint, types, contracts, build, and client credential boundary.",
23077
- examples: ["altertable app check", "altertable app check --lakehouse"]
23062
+ name: "lint",
23063
+ description: "Lint a local data app project: format, lint rules, types, contracts, build, and client credential boundary.",
23064
+ examples: ["altertable app lint", "altertable app lint --lakehouse"]
23078
23065
  },
23079
23066
  args: {
23080
23067
  dir: { type: "string", description: "App directory (default: current directory)." },
@@ -23183,20 +23170,160 @@ async function checkClientBundle(directory, secrets = []) {
23183
23170
  }
23184
23171
  }
23185
23172
 
23173
+ // src/commands/app/lib/remote.ts
23174
+ import { readFile as readFile5 } from "fs/promises";
23175
+ async function readRequiredFile(path, label) {
23176
+ try {
23177
+ return await readFile5(path, "utf8");
23178
+ } catch (error) {
23179
+ throw new CliError(`Could not read ${label}: ${path}`, { cause: error });
23180
+ }
23181
+ }
23182
+ function buildDataAppHttpRequest(env, method, path, body) {
23183
+ return {
23184
+ plane: "management",
23185
+ method,
23186
+ endpoint: `/environments/${env}${path}`,
23187
+ body: JSON.stringify(body),
23188
+ contentType: "application/json"
23189
+ };
23190
+ }
23191
+ function validationHasErrors(response) {
23192
+ return Array.isArray(response.errors) && response.errors.length > 0;
23193
+ }
23194
+ function formatValidationSummary(response) {
23195
+ const errors = response.errors ?? [];
23196
+ const warnings = response.warnings ?? [];
23197
+ if (errors.length === 0 && warnings.length === 0) {
23198
+ return "Data app is valid.";
23199
+ }
23200
+ const lines = [];
23201
+ for (const error of errors) {
23202
+ lines.push(formatDiagnostic("error", error));
23203
+ }
23204
+ for (const warning of warnings) {
23205
+ lines.push(formatDiagnostic("warning", warning));
23206
+ }
23207
+ return lines.join(`
23208
+ `);
23209
+ }
23210
+ function validationExitCode(response) {
23211
+ return validationHasErrors(response) ? EXIT_VALIDATION : 0;
23212
+ }
23213
+ function formatDiagnostic(kind, diagnostic) {
23214
+ const location = diagnostic.line === undefined || diagnostic.line === null ? "" : diagnostic.column === undefined || diagnostic.column === null ? `:${diagnostic.line}` : `:${diagnostic.line}:${diagnostic.column}`;
23215
+ const source = diagnostic.source === undefined ? "" : ` [${diagnostic.source}]`;
23216
+ return `${kind}${source}${location}: ${diagnostic.message ?? "unknown"}`;
23217
+ }
23218
+
23219
+ // src/commands/app/publish.ts
23220
+ var appPublishCommand = defineCommand({
23221
+ metadata: {
23222
+ name: "publish",
23223
+ description: "Create a data app from source.",
23224
+ examples: ["altertable app publish --title 'Revenue explorer' --file index.tsx"]
23225
+ },
23226
+ args: {
23227
+ title: { type: "string", description: "Title of the data app.", required: true },
23228
+ file: {
23229
+ type: "string",
23230
+ description: "Path to the single-file React source (index.tsx). Queries are declared in the file via defineDataApp.",
23231
+ required: true,
23232
+ completion: "file"
23233
+ },
23234
+ description: { type: "string", description: "Optional description of the data app." }
23235
+ },
23236
+ async run({ args, execution, sink }) {
23237
+ const env = requireManagementPlane(execution.profile, {
23238
+ requirement: "Publishing a data app requires the management API"
23239
+ });
23240
+ const title = stringArg(args, "title");
23241
+ const response = parseApiJson(await sendHttp(buildDataAppHttpRequest(env, "POST", "/data_apps", {
23242
+ title,
23243
+ index_tsx: await readRequiredFile(stringArg(args, "file"), "source"),
23244
+ description: optionalStringArg(args, "description")
23245
+ }), execution));
23246
+ const dataApp = response.data_app ?? {};
23247
+ await writeCommandOutput({
23248
+ kind: "normalized",
23249
+ data: { slug: dataApp.slug, url: dataApp.url },
23250
+ humanText: `Published ${dataApp.title ?? title} (${dataApp.slug ?? ""}).
23251
+ ${dataApp.url ?? ""}`
23252
+ }, sink);
23253
+ }
23254
+ });
23255
+
23256
+ // src/commands/app/update.ts
23257
+ var appUpdateCommand = defineCommand({
23258
+ metadata: {
23259
+ name: "update",
23260
+ description: "Update a data app from source. Omitted fields are left unchanged.",
23261
+ examples: [
23262
+ "altertable app update APP-1 --file index.tsx",
23263
+ "altertable app update APP-1 --title 'Revenue explorer' --file index.tsx"
23264
+ ]
23265
+ },
23266
+ args: {
23267
+ slug: {
23268
+ type: "positional",
23269
+ description: "Data app slug to update (e.g. APP-1).",
23270
+ required: true
23271
+ },
23272
+ title: { type: "string", description: "New title of the data app." },
23273
+ file: {
23274
+ type: "string",
23275
+ description: "Path to replacement single-file React source (index.tsx). Replaces the queries with those the file declares.",
23276
+ completion: "file"
23277
+ },
23278
+ description: { type: "string", description: "New description of the data app." }
23279
+ },
23280
+ async run({ args, execution, sink }) {
23281
+ const env = requireManagementPlane(execution.profile, {
23282
+ requirement: "Updating a data app requires the management API"
23283
+ });
23284
+ const slug = stringArg(args, "slug");
23285
+ const body = await updatePayload(args);
23286
+ if (Object.keys(body).length === 0) {
23287
+ throw new CliError("Provide at least one of --title, --description, or --file.");
23288
+ }
23289
+ const response = parseApiJson(await sendHttp(buildDataAppHttpRequest(env, "PATCH", `/data_apps/${slug}`, body), execution));
23290
+ const dataApp = response.data_app ?? {};
23291
+ await writeCommandOutput({
23292
+ kind: "normalized",
23293
+ data: { slug: dataApp.slug ?? slug, url: dataApp.url },
23294
+ humanText: `Updated ${dataApp.title ?? dataApp.slug ?? slug}.
23295
+ ${dataApp.url ?? ""}`
23296
+ }, sink);
23297
+ }
23298
+ });
23299
+ async function updatePayload(args) {
23300
+ const body = {};
23301
+ const title = optionalStringArg(args, "title");
23302
+ const description = optionalStringArg(args, "description");
23303
+ const file = optionalStringArg(args, "file");
23304
+ if (title !== undefined)
23305
+ body.title = title;
23306
+ if (description !== undefined)
23307
+ body.description = description;
23308
+ if (file !== undefined)
23309
+ body.index_tsx = await readRequiredFile(file, "source");
23310
+ return body;
23311
+ }
23312
+
23186
23313
  // src/commands/app/upgrade.ts
23187
- import { readFile as readFile5, writeFile as writeFile3 } from "fs/promises";
23314
+ import { readFile as readFile6, writeFile as writeFile3 } from "fs/promises";
23188
23315
  import { join as join11 } from "path";
23189
23316
  var appUpgradeCommand = defineCommand({
23190
23317
  metadata: {
23191
23318
  name: "upgrade",
23192
- description: "Update the data app package to the CLI's tested version.",
23319
+ description: "Update a local data app's package to the CLI's tested version.",
23193
23320
  examples: ["altertable app upgrade", "altertable app upgrade --dir ./my-app"]
23194
23321
  },
23195
23322
  args: { dir: { type: "string", description: "App directory (default: current directory)." } },
23196
23323
  async run({ args, sink }) {
23197
23324
  const directory = appDirectory(args.dir);
23198
23325
  const upgraded = await upgradeApp(directory);
23199
- const { packages } = readAppLock(await readFile5(join11(directory, "bun.lock"), "utf8"), directory);
23326
+ const { packages } = readAppLock(await readFile6(join11(directory, "bun.lock"), "utf8"), directory);
23200
23327
  const version = lockedVersion(packages, dataAppPackage);
23201
23328
  if (sink.json) {
23202
23329
  sink.writeJson({
@@ -23204,12 +23331,12 @@ var appUpgradeCommand = defineCommand({
23204
23331
  upgraded,
23205
23332
  runtimeVersion: version,
23206
23333
  nextSteps: upgraded ? [
23207
- "Run `altertable app check` in the app directory.",
23334
+ "Run `altertable app lint` in the app directory.",
23208
23335
  "Restart any running `altertable app dev` server."
23209
23336
  ] : []
23210
23337
  });
23211
23338
  } else {
23212
- sink.writeHuman(upgraded ? `Updated data app package to ${version}. Run \`altertable app check\`, then restart any running \`altertable app dev\` server.` : `Data app package ${version} is already current.`);
23339
+ sink.writeHuman(upgraded ? `Updated data app package to ${version}. Run \`altertable app lint\`, then restart any running \`altertable app dev\` server.` : `Data app package ${version} is already current.`);
23213
23340
  }
23214
23341
  }
23215
23342
  });
@@ -23222,7 +23349,7 @@ async function upgradeApp(directory, options = {}) {
23222
23349
  }
23223
23350
  let lock;
23224
23351
  try {
23225
- lock = await readFile5(join11(directory, "bun.lock"), "utf8");
23352
+ lock = await readFile6(join11(directory, "bun.lock"), "utf8");
23226
23353
  } catch {
23227
23354
  throw new ConfigurationError(`Cannot read a valid bun.lock in ${directory}.`);
23228
23355
  }
@@ -23256,7 +23383,7 @@ async function upgradeApp(directory, options = {}) {
23256
23383
  try {
23257
23384
  await writeFile3(join11(directory, "package.json"), nextPackage);
23258
23385
  await (options.resolveLock ?? resolveLockfile)(directory);
23259
- const resolved = readAppLock(await readFile5(join11(directory, "bun.lock"), "utf8"), directory, version);
23386
+ const resolved = readAppLock(await readFile6(join11(directory, "bun.lock"), "utf8"), directory, version);
23260
23387
  if (lockedVersion(resolved.packages, dataAppPackage) !== version)
23261
23388
  throw new ConfigurationError("Dependency resolution did not lock the tested data app version.");
23262
23389
  for (const [name, range] of Object.entries(recommendedDataAppPeers())) {
@@ -23297,26 +23424,64 @@ async function resolveLockfile(directory) {
23297
23424
  ${stderr || stdout}`);
23298
23425
  }
23299
23426
 
23427
+ // src/commands/app/validate.ts
23428
+ var appValidateCommand = defineCommand({
23429
+ metadata: {
23430
+ name: "validate",
23431
+ description: "Type-check and bundle a data app from source without saving.",
23432
+ examples: ["altertable app validate --file index.tsx"]
23433
+ },
23434
+ args: {
23435
+ file: {
23436
+ type: "string",
23437
+ description: "Path to the single-file React source (index.tsx). Queries are declared in the file via defineDataApp.",
23438
+ required: true,
23439
+ completion: "file"
23440
+ }
23441
+ },
23442
+ async run({ args, execution, sink }) {
23443
+ const env = requireManagementPlane(execution.profile, {
23444
+ requirement: "Validating a data app requires the management API"
23445
+ });
23446
+ const indexTsx = await readRequiredFile(stringArg(args, "file"), "source");
23447
+ const response = parseApiJson(await sendHttp(buildDataAppHttpRequest(env, "POST", "/data_apps/validate", {
23448
+ index_tsx: indexTsx
23449
+ }), execution));
23450
+ await writeCommandOutput({
23451
+ kind: "normalized",
23452
+ data: response,
23453
+ humanText: formatValidationSummary(response)
23454
+ }, sink);
23455
+ return { exitCode: validationExitCode(response) };
23456
+ }
23457
+ });
23458
+
23300
23459
  // src/commands/app/index.ts
23301
23460
  var appCommand = defineCommand({
23302
23461
  metadata: {
23303
23462
  name: "app",
23304
23463
  commandGroup: "platform",
23305
- description: "Create, develop, check, build, and upgrade data apps.",
23464
+ description: "Create, develop, lint, build, and upgrade local data apps; validate, publish, and update data apps.",
23306
23465
  examples: [
23307
23466
  "altertable app create my-app",
23308
23467
  "altertable app dev",
23309
- "altertable app check",
23468
+ "altertable app lint",
23310
23469
  "altertable app build",
23311
- "altertable app upgrade"
23470
+ "altertable app upgrade",
23471
+ "altertable app validate --file index.tsx",
23472
+ "altertable app publish --title 'Revenue explorer' --file index.tsx",
23473
+ "altertable app update APP-1 --file index.tsx"
23312
23474
  ]
23313
23475
  },
23314
23476
  subcommands: {
23315
23477
  create: appCreateCommand,
23316
23478
  dev: appDevCommand,
23317
23479
  build: appBuildCommand,
23318
- check: appCheckCommand,
23319
- upgrade: appUpgradeCommand
23480
+ lint: appLintCommand,
23481
+ upgrade: appUpgradeCommand,
23482
+ validate: appValidateCommand,
23483
+ publish: appPublishCommand,
23484
+ update: appUpdateCommand
23320
23485
  }
23321
23486
  });
23322
23487
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altertable/cli",
3
- "version": "1.9.1",
3
+ "version": "1.10.1",
4
4
  "description": "Altertable CLI — query and manage your data platform",
5
5
  "homepage": "https://github.com/altertable-ai/altertable-cli#readme",
6
6
  "bugs": {