@eide/foir-cli 0.49.0 → 0.50.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.
Files changed (2) hide show
  1. package/dist/cli.js +65 -29
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -470,6 +470,8 @@ import { file_google_protobuf_struct, file_google_protobuf_timestamp as file_goo
470
470
  import { enumDesc, fileDesc, messageDesc, tsEnum } from "@bufbuild/protobuf/codegenv2";
471
471
  import { file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";
472
472
  var file_publish_v1_publish = /* @__PURE__ */ fileDesc("ChhwdWJsaXNoL3YxL3B1Ymxpc2gucHJvdG8SCnB1Ymxpc2gudjEikgEKDkJyZWFraW5nQ2hhbmdlEjQKCHNldmVyaXR5GAEgASgOMiIucHVibGlzaC52MS5CcmVha2luZ0NoYW5nZVNldmVyaXR5EhMKC2VudGl0eV9raW5kGAIgASgJEhIKCmVudGl0eV9rZXkYAyABKAkSDAoEcGF0aBgEIAEoCRITCgtkZXNjcmlwdGlvbhgFIAEoCSLKAgoNUHVibGlzaFN0YXR1cxIhChRwdWJsaXNoZWRfdmVyc2lvbl9pZBgBIAEoCUgAiAEBEh8KEmN1cnJlbnRfdmVyc2lvbl9pZBgCIAEoCUgBiAEBEjUKDHB1Ymxpc2hlZF9hdBgDIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBIAogBARIZCgxwdWJsaXNoZWRfYnkYBCABKAlIA4gBARIbChNoYXNfcGVuZGluZ19jaGFuZ2VzGAUgASgIEjQKEGJyZWFraW5nX2NoYW5nZXMYBiADKAsyGi5wdWJsaXNoLnYxLkJyZWFraW5nQ2hhbmdlQhcKFV9wdWJsaXNoZWRfdmVyc2lvbl9pZEIVChNfY3VycmVudF92ZXJzaW9uX2lkQg8KDV9wdWJsaXNoZWRfYXRCDwoNX3B1Ymxpc2hlZF9ieSKuAQoNUGVuZGluZ0VudGl0eRITCgtlbnRpdHlfa2luZBgBIAEoCRIRCgllbnRpdHlfaWQYAiABKAkSEgoKZW50aXR5X2tleRgDIAEoCRITCgtlbnRpdHlfbmFtZRgEIAEoCRIWCg5jaGFuZ2Vfc3VtbWFyeRgFIAEoCRI0ChBicmVha2luZ19jaGFuZ2VzGAYgAygLMhoucHVibGlzaC52MS5CcmVha2luZ0NoYW5nZSpnCg1TY2hlbWFDaGFubmVsEh4KGlNDSEVNQV9DSEFOTkVMX1VOU1BFQ0lGSUVEEAASHAoYU0NIRU1BX0NIQU5ORUxfUFVCTElTSEVEEAESGAoUU0NIRU1BX0NIQU5ORUxfRFJBRlQQAiq2AQoWQnJlYWtpbmdDaGFuZ2VTZXZlcml0eRIoCiRCUkVBS0lOR19DSEFOR0VfU0VWRVJJVFlfVU5TUEVDSUZJRUQQABIlCiFCUkVBS0lOR19DSEFOR0VfU0VWRVJJVFlfQURESVRJVkUQARIkCiBCUkVBS0lOR19DSEFOR0VfU0VWRVJJVFlfV0FSTklORxACEiUKIUJSRUFLSU5HX0NIQU5HRV9TRVZFUklUWV9CUkVBS0lORxADQjtaOWdpdGh1Yi5jb20vZWlkZXN0dWRpby9mb2lyL2dlbi9wcm90by9wdWJsaXNoL3YxO3B1Ymxpc2h2MWIGcHJvdG8z", [file_google_protobuf_timestamp]);
473
+ var BreakingChangeSeveritySchema = /* @__PURE__ */ enumDesc(file_publish_v1_publish, 1);
474
+ var BreakingChangeSeverity = /* @__PURE__ */ tsEnum(BreakingChangeSeveritySchema);
473
475
 
474
476
  // ../../packages/proto-ts/src/common/v1/pagination_pb.js
475
477
  import { fileDesc as fileDesc2, messageDesc as messageDesc2 } from "@bufbuild/protobuf/codegenv2";
@@ -582,6 +584,7 @@ var DuplicateModelRequestSchema = /* @__PURE__ */ messageDesc5(file_models_v1_mo
582
584
  var ListModelVersionsRequestSchema = /* @__PURE__ */ messageDesc5(file_models_v1_models, 22);
583
585
  var RestoreModelVersionRequestSchema = /* @__PURE__ */ messageDesc5(file_models_v1_models, 26);
584
586
  var PublishModelRequestSchema = /* @__PURE__ */ messageDesc5(file_models_v1_models, 36);
587
+ var GetModelPublishStatusRequestSchema = /* @__PURE__ */ messageDesc5(file_models_v1_models, 40);
585
588
  var CacheControlScopeSchema = /* @__PURE__ */ enumDesc3(file_models_v1_models, 1);
586
589
  var CacheControlScope = /* @__PURE__ */ tsEnum3(CacheControlScopeSchema);
587
590
  var ModelsService = /* @__PURE__ */ serviceDesc2(file_models_v1_models, 0);
@@ -1798,6 +1801,15 @@ function createModelsMethods(client) {
1798
1801
  create3(PublishModelRequestSchema, { id })
1799
1802
  );
1800
1803
  return resp.model ?? null;
1804
+ },
1805
+ // Pending-publish state for one model: whether the draft diverges from
1806
+ // the published snapshot, and the severity-tagged change list. CLI push
1807
+ // reads this to decide whether an update is safe to auto-publish.
1808
+ async getModelPublishStatus(id) {
1809
+ const resp = await client.getModelPublishStatus(
1810
+ create3(GetModelPublishStatusRequestSchema, { id })
1811
+ );
1812
+ return resp.status ?? null;
1801
1813
  }
1802
1814
  };
1803
1815
  }
@@ -5968,6 +5980,13 @@ function discoverConfigFile() {
5968
5980
  }
5969
5981
  return null;
5970
5982
  }
5983
+ function classifyAdditivePublish(changes) {
5984
+ if (changes.length === 0) return "skip";
5985
+ const hasBlocking = changes.some(
5986
+ (c) => c.severity === BreakingChangeSeverity.BREAKING || c.severity === BreakingChangeSeverity.WARNING
5987
+ );
5988
+ return hasBlocking ? "draft" : "publish";
5989
+ }
5971
5990
  function syncEnvVar(envPath, key, value) {
5972
5991
  const envContent = existsSync4(envPath) ? readFileSync(envPath, "utf-8") : "";
5973
5992
  const pattern = new RegExp(`^${key}=(.*)$`, "m");
@@ -6025,7 +6044,7 @@ function registerPushCommand(program2, globalOpts) {
6025
6044
  false
6026
6045
  ).option(
6027
6046
  "--publish",
6028
- "Promote updated models, operations, auth providers, profile schema, and design tokens to the published channel after the push. New resources auto-publish; this flag covers updates, which are otherwise left as drafts.",
6047
+ "Promote ALL updated resources \u2014 including breaking model changes \u2014 to the published channel after the push. By default, new resources and additive model updates auto-publish, while breaking model changes and updated operations / auth providers / profile schema are left as drafts; this flag releases them too.",
6029
6048
  false
6030
6049
  ).option(
6031
6050
  "--rebuild",
@@ -6124,17 +6143,30 @@ function registerPushCommand(program2, globalOpts) {
6124
6143
  console.log(` Config Key: ${chalk6.cyan(config2.key)}`);
6125
6144
  console.log();
6126
6145
  printSummary(summary);
6127
- if (opts.publish) {
6128
- const publishCounts = {
6129
- models: 0,
6130
- operations: 0,
6131
- authProviders: 0,
6132
- profileSchema: false
6133
- };
6134
- for (const id of summary.updatedModelIds) {
6146
+ const publishCounts = {
6147
+ models: 0,
6148
+ operations: 0,
6149
+ authProviders: 0,
6150
+ profileSchema: false
6151
+ };
6152
+ const draftedBreakingModelIds = [];
6153
+ for (const id of summary.updatedModelIds) {
6154
+ if (opts.publish) {
6155
+ await client.models.publishModel(id);
6156
+ publishCounts.models++;
6157
+ continue;
6158
+ }
6159
+ const status = await client.models.getModelPublishStatus(id);
6160
+ const decision = classifyAdditivePublish(status?.breakingChanges ?? []);
6161
+ if (decision === "skip") continue;
6162
+ if (decision === "draft") {
6163
+ draftedBreakingModelIds.push(id);
6164
+ } else {
6135
6165
  await client.models.publishModel(id);
6136
6166
  publishCounts.models++;
6137
6167
  }
6168
+ }
6169
+ if (opts.publish) {
6138
6170
  for (const id of summary.updatedOperationIds) {
6139
6171
  await client.operations.publishOperation(id);
6140
6172
  publishCounts.operations++;
@@ -6147,30 +6179,34 @@ function registerPushCommand(program2, globalOpts) {
6147
6179
  await client.settings.publishProfileSchema();
6148
6180
  publishCounts.profileSchema = true;
6149
6181
  }
6150
- const lines = [];
6151
- if (publishCounts.models)
6152
- lines.push(`${publishCounts.models} models`);
6153
- if (publishCounts.operations)
6154
- lines.push(`${publishCounts.operations} operations`);
6155
- if (publishCounts.authProviders)
6156
- lines.push(`${publishCounts.authProviders} auth providers`);
6157
- if (publishCounts.profileSchema) lines.push("profile schema");
6158
- if (summary.designTokensPublished) lines.push("design tokens");
6182
+ }
6183
+ const lines = [];
6184
+ if (publishCounts.models) lines.push(`${publishCounts.models} models`);
6185
+ if (publishCounts.operations)
6186
+ lines.push(`${publishCounts.operations} operations`);
6187
+ if (publishCounts.authProviders)
6188
+ lines.push(`${publishCounts.authProviders} auth providers`);
6189
+ if (publishCounts.profileSchema) lines.push("profile schema");
6190
+ if (summary.designTokensPublished) lines.push("design tokens");
6191
+ if (lines.length > 0) {
6159
6192
  console.log();
6160
- if (lines.length > 0) {
6161
- console.log(
6162
- chalk6.green("\u2713 Published: ") + chalk6.dim(lines.join(", "))
6163
- );
6164
- } else {
6165
- console.log(
6166
- chalk6.dim(" Nothing to publish (no resources were updated).")
6167
- );
6168
- }
6169
- } else if (summary.updatedModelIds.length + summary.updatedOperationIds.length + summary.updatedAuthProviderIds.length > 0 || summary.profileSchemaUpdated || summary.designTokensUpdated) {
6193
+ const how = opts.publish ? "Published" : "Published (additive)";
6194
+ console.log(chalk6.green(`\u2713 ${how}: `) + chalk6.dim(lines.join(", ")));
6195
+ }
6196
+ if (draftedBreakingModelIds.length > 0) {
6197
+ const n = draftedBreakingModelIds.length;
6198
+ console.log();
6199
+ console.log(
6200
+ chalk6.yellow(
6201
+ ` ${n} model${n === 1 ? "" : "s"} with breaking changes left as drafts. Re-run with --publish to release ${n === 1 ? "it" : "them"}, or publish from the admin app.`
6202
+ )
6203
+ );
6204
+ }
6205
+ if (!opts.publish && (summary.updatedOperationIds.length + summary.updatedAuthProviderIds.length > 0 || summary.profileSchemaUpdated || summary.designTokensUpdated)) {
6170
6206
  console.log();
6171
6207
  console.log(
6172
6208
  chalk6.dim(
6173
- " Updates left as drafts. Re-run with --publish to release them, or publish from the admin app."
6209
+ " Updated operations / auth providers / profile schema / design tokens left as drafts. Re-run with --publish to release them."
6174
6210
  )
6175
6211
  );
6176
6212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eide/foir-cli",
3
- "version": "0.49.0",
3
+ "version": "0.50.0",
4
4
  "description": "Universal platform CLI for Foir platform",
5
5
  "type": "module",
6
6
  "publishConfig": {