@topogram/cli 0.3.61 → 0.3.62

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topogram/cli",
3
- "version": "0.3.61",
3
+ "version": "0.3.62",
4
4
  "description": "Topogram CLI for checking Topogram workspaces and generating app bundles.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/src/cli.js CHANGED
@@ -210,7 +210,7 @@ function printUsage(options = {}) {
210
210
  console.log(" or: topogram widget check [path] [--projection <id>] [--widget <id>] [--json]");
211
211
  console.log(" or: topogram widget behavior [path] [--projection <id>] [--widget <id>] [--json]");
212
212
  console.log(" or: topogram generate [path] [--out <path>]");
213
- console.log(" or: topogram generate [path] --generate <target> [--json|--write --out-dir <path>]");
213
+ console.log(" or: topogram emit <target> [path] [--json|--write --out-dir <path>]");
214
214
  console.log(" or: topogram query list [--json]");
215
215
  console.log(" or: topogram query show <name> [--json]");
216
216
  console.log(" or: topogram trust template [path]");
@@ -270,6 +270,8 @@ function printUsage(options = {}) {
270
270
  console.log(" topogram query list");
271
271
  console.log(" topogram query show widget-behavior");
272
272
  console.log(" topogram query widget-behavior ./topogram --projection proj_web_surface --json");
273
+ console.log(" topogram emit ui-widget-contract --widget widget_data_grid --json");
274
+ console.log(" topogram emit widget-conformance-report ./topogram --projection proj_web_surface --json");
273
275
  console.log(" topogram generator list");
274
276
  console.log(" topogram generator show @topogram/generator-react-web");
275
277
  console.log(" topogram generator check ./generator-package");
@@ -338,7 +340,8 @@ function printUsage(options = {}) {
338
340
  console.log(" or: topogram template show <id> [--json] [--catalog <path-or-source>]");
339
341
  console.log(" or: topogram import app <path> [--from <track[,track]>] [--write]");
340
342
  console.log(" or: topogram validate <path>");
341
- console.log(" or: node ./src/cli.js <path> [--json] [--validate] [--resolve] [--generate <target>] [--workflow <name>] [--mode <id>] [--from <track[,track]>] [--adopt <selector>] [--refresh-adopted] [--shape <id>] [--capability <id>] [--widget <id>] [--projection <id>] [--entity <id>] [--journey <id>] [--surface <id>] [--task <id>] [--profile <id>] [--from-snapshot <path>] [--from-topogram <path>] [--write] [--out-dir <path>]");
343
+ console.log(" or: node ./src/cli.js <path> [--json] [--validate] [--resolve] [--workflow <name>] [--mode <id>] [--from <track[,track]>] [--adopt <selector>] [--refresh-adopted] [--shape <id>] [--capability <id>] [--widget <id>] [--projection <id>] [--entity <id>] [--journey <id>] [--surface <id>] [--task <id>] [--profile <id>] [--from-snapshot <path>] [--from-topogram <path>] [--write] [--out-dir <path>]");
344
+ console.log(" or: node ./src/cli.js emit <target> [path] [--json] [--write] [--out-dir <path>]");
342
345
  console.log(" or: node ./src/cli.js import app <path> [--from <track[,track]>] [--write]");
343
346
  console.log(" or: node ./src/cli.js import docs <path> [--write]");
344
347
  console.log(" or: node ./src/cli.js generate journeys <path> [--write]");
@@ -411,11 +414,23 @@ function printNewHelp() {
411
414
  function printGenerateHelp() {
412
415
  console.log("Usage: topogram generate [path] [--out <path>]");
413
416
  console.log(" or: topogram generate app [path] [--out <path>]");
414
- console.log(" or: topogram generate [path] --generate <target> [--json]");
415
- console.log(" or: topogram generate [path] --generate <target> --write [--out-dir <path>]");
416
417
  console.log("");
417
418
  console.log("Defaults: path is ./topogram and app generation writes ./app.");
418
- console.log("Explicit --generate targets print JSON by default and write files only with --write.");
419
+ console.log("Use `topogram emit <target>` for contracts, reports, snapshots, migration plans, and other artifacts.");
420
+ console.log("");
421
+ console.log("Examples:");
422
+ console.log(" topogram generate");
423
+ console.log(" topogram generate ./topogram --out ./app");
424
+ console.log(" topogram generate app ./topogram --out ./app");
425
+ }
426
+
427
+ function printEmitHelp() {
428
+ console.log("Usage: topogram emit <target> [path] [--json]");
429
+ console.log(" or: topogram emit <target> [path] --write [--out-dir <path>]");
430
+ console.log("");
431
+ console.log("Emits named contracts, reports, snapshots, migration plans, and other artifacts.");
432
+ console.log("");
433
+ console.log("Defaults: path is ./topogram. Emit prints to stdout unless --write is passed. --write writes ./artifacts unless --out-dir is supplied.");
419
434
  console.log("");
420
435
  console.log("Common artifact targets:");
421
436
  console.log(" ui-widget-contract");
@@ -433,13 +448,12 @@ function printGenerateHelp() {
433
448
  console.log(" --journey <id>");
434
449
  console.log("");
435
450
  console.log("Examples:");
436
- console.log(" topogram generate");
437
- console.log(" topogram generate ./topogram --out ./app");
438
- console.log(" topogram generate app ./topogram --out ./app");
439
- console.log(" topogram generate ./topogram --generate ui-widget-contract --widget widget_data_grid --json");
440
- console.log(" topogram generate ./topogram --generate widget-conformance-report --projection proj_web_surface --json");
441
- console.log(" topogram generate ./topogram --generate widget-behavior-report --projection proj_web_surface --json");
442
- console.log(" topogram generate ./topogram --generate ui-widget-contract --write --out-dir ./contracts");
451
+ console.log(" topogram emit ui-widget-contract --widget widget_data_grid --json");
452
+ console.log(" topogram emit widget-conformance-report ./topogram --projection proj_web_surface --json");
453
+ console.log(" topogram emit widget-behavior-report ./topogram --projection proj_web_surface --json");
454
+ console.log(" topogram emit db-schema-snapshot ./topogram --projection proj_db_postgres --json");
455
+ console.log(" topogram emit sql-migration ./topogram --projection proj_db_postgres --from-snapshot ./state/current.json");
456
+ console.log(" topogram emit ui-widget-contract --write --out-dir ./contracts");
443
457
  }
444
458
 
445
459
  function printWidgetHelp() {
@@ -869,6 +883,10 @@ function printCommandHelp(command) {
869
883
  printGenerateHelp();
870
884
  return true;
871
885
  }
886
+ if (command === "emit") {
887
+ printEmitHelp();
888
+ return true;
889
+ }
872
890
  if (command === "widget") {
873
891
  printWidgetHelp();
874
892
  return true;
@@ -8594,12 +8612,18 @@ if (args[0] === "version" || args[0] === "--version") {
8594
8612
  } else if (args[0] === "generator") {
8595
8613
  printGeneratorHelp();
8596
8614
  process.exit(args[1] ? 1 : 0);
8615
+ } else if (args[0] === "emit") {
8616
+ if (!args[1] || args[1].startsWith("-")) {
8617
+ printEmitHelp();
8618
+ process.exit(1);
8619
+ }
8620
+ commandArgs = { generateTarget: args[1], inputPath: commandPath(2), emitArtifact: true };
8597
8621
  } else if (args[0] === "validate") {
8598
8622
  commandArgs = { validate: true, inputPath: args[1] };
8599
8623
  } else if (args[0] === "generate" && args[1] === "app") {
8600
8624
  commandArgs = { generateTarget: "app-bundle", write: true, inputPath: commandPath(2), defaultOutDir: "./app" };
8601
8625
  } else if (args[0] === "generate" && args.indexOf("--generate") >= 0) {
8602
- commandArgs = { inputPath: commandPath(1) };
8626
+ commandArgs = { inputPath: commandPath(1), deprecatedGenerateArtifact: true };
8603
8627
  } else if (args[0] === "generate" && args[1] !== "journeys") {
8604
8628
  commandArgs = { generateTarget: "app-bundle", write: true, inputPath: commandPath(1), defaultOutDir: "./app" };
8605
8629
  } else if (args[0] === "trust" && args[1] === "template") {
@@ -8839,8 +8863,13 @@ const shouldValidate = Boolean(commandArgs?.validate) || args.includes("--valida
8839
8863
  const shouldResolve = args.includes("--resolve");
8840
8864
  const generateIndex = args.indexOf("--generate");
8841
8865
  const generateTarget = commandArgs?.generateTarget || (generateIndex >= 0 ? args[generateIndex + 1] : null);
8866
+ if (commandArgs?.deprecatedGenerateArtifact && (!generateTarget || generateTarget.startsWith("-"))) {
8867
+ console.error("Missing required --generate <target>.");
8868
+ printUsage();
8869
+ process.exit(1);
8870
+ }
8842
8871
  if (RENAMED_GENERATE_TARGETS.has(generateTarget)) {
8843
- console.error(`Generator target '${generateTarget}' was renamed to '${RENAMED_GENERATE_TARGETS.get(generateTarget)}'.`);
8872
+ console.error(`Artifact target '${generateTarget}' was renamed to '${RENAMED_GENERATE_TARGETS.get(generateTarget)}'.`);
8844
8873
  process.exit(1);
8845
8874
  }
8846
8875
  const workflowIndex = args.indexOf("--workflow");
@@ -11573,6 +11602,9 @@ try {
11573
11602
  const ast = parsePath(inputPath);
11574
11603
 
11575
11604
  if (generateTarget) {
11605
+ if (commandArgs?.deprecatedGenerateArtifact) {
11606
+ console.error(`Deprecated: use \`topogram emit ${generateTarget} ${inputPath || "./topogram"}\` instead of \`topogram generate ${inputPath || "./topogram"} --generate ${generateTarget}\`.`);
11607
+ }
11576
11608
  const projectRoot = normalizeProjectRoot(inputPath);
11577
11609
  const explicitProjectConfig = loadProjectConfig(projectRoot) || loadProjectConfig(inputPath);
11578
11610
  const implementationOptionalTargets = new Set(["app-bundle-plan", "app-bundle", "environment-plan", "environment-bundle", "compile-check-plan", "compile-check-bundle"]);
@@ -352,17 +352,17 @@ infer_current_snapshot_from_live_tables() {
352
352
  }
353
353
 
354
354
  generate_desired_snapshot() {
355
- "$TOPOGRAM_BIN" "$INPUT_PATH" --generate db-schema-snapshot --projection "$PROJECTION_ID" > "$DESIRED_SNAPSHOT"
355
+ "$TOPOGRAM_BIN" emit db-schema-snapshot "$INPUT_PATH" --projection "$PROJECTION_ID" > "$DESIRED_SNAPSHOT"
356
356
  }
357
357
 
358
358
  generate_migration_plan() {
359
359
  local from_snapshot="$1"
360
- "$TOPOGRAM_BIN" "$INPUT_PATH" --generate db-migration-plan --projection "$PROJECTION_ID" --from-snapshot "$from_snapshot" > "$PLAN_JSON"
360
+ "$TOPOGRAM_BIN" emit db-migration-plan "$INPUT_PATH" --projection "$PROJECTION_ID" --from-snapshot "$from_snapshot" > "$PLAN_JSON"
361
361
  }
362
362
 
363
363
  generate_sql_migration() {
364
364
  local from_snapshot="$1"
365
- "$TOPOGRAM_BIN" "$INPUT_PATH" --generate sql-migration --projection "$PROJECTION_ID" --from-snapshot "$from_snapshot" > "$MIGRATION_SQL"
365
+ "$TOPOGRAM_BIN" emit sql-migration "$INPUT_PATH" --projection "$PROJECTION_ID" --from-snapshot "$from_snapshot" > "$MIGRATION_SQL"
366
366
  }
367
367
 
368
368
  ensure_supported_plan() {
@@ -22,5 +22,5 @@ Configure the API base URL and optional auth token via scheme environment variab
22
22
  From `engine/`:
23
23
 
24
24
  ```bash
25
- topogram ./topogram --generate swiftui-app --projection proj_ios_surface__swiftui --write --out-dir ./app/ios-swiftui
25
+ topogram emit swiftui-app ./topogram --projection proj_ios_surface__swiftui --write --out-dir ./app/ios-swiftui
26
26
  ```
@@ -2046,6 +2046,8 @@ Or run self-contained local runtime verification:
2046
2046
 
2047
2047
  Useful inspection:
2048
2048
  npm run check:json
2049
+ topogram emit ui-widget-contract ./topogram --json
2050
+ topogram emit widget-conformance-report ./topogram --json
2049
2051
  npm run doctor
2050
2052
  npm run source:status
2051
2053
  npm run source:status:remote
@@ -2123,6 +2125,7 @@ ${workflowCommands.join("\n")}
2123
2125
 
2124
2126
  Edit \`topogram/\` and \`topogram.project.json\`, then regenerate with \`npm run generate\`.
2125
2127
  Generated app code is written to \`app/\`.
2128
+ Use \`topogram emit <target>\` to inspect contracts, reports, snapshots, and other artifacts without regenerating the app.
2126
2129
  ${template.includesExecutableImplementation ? "\nThis template copied `implementation/` code. `topogram new` did not execute it; review `implementation/`, `topogram.template-policy.json`, and `.topogram-template-trust.json` before regenerating after edits.\n" : ""}
2127
2130
  `;
2128
2131
  fs.writeFileSync(path.join(projectRoot, "README.md"), readme, "utf8");