@biffo/cli 0.316.0 → 0.316.2

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/index.js +44 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9169,10 +9169,10 @@ var RegistryPluginEntrySchema = z8.object({
9169
9169
  ui_components: z8.array(UiComponentEntrySchema).optional(),
9170
9170
  status: z8.enum(["active", "disabled"])
9171
9171
  });
9172
- var PluginRegistrySchema = z8.object({
9172
+ var PluginRegistryEnvelopeSchema = z8.object({
9173
9173
  schema_version: z8.string(),
9174
9174
  last_updated: z8.string(),
9175
- plugins: z8.array(RegistryPluginEntrySchema)
9175
+ plugins: z8.array(z8.unknown())
9176
9176
  });
9177
9177
  var DEFAULT_REGISTRY_URL = "https://raw.githubusercontent.com/keiranholloway/biffo-plugins-registry/main/plugins.json";
9178
9178
  var RegistryAdapter = class {
@@ -9203,14 +9203,31 @@ var RegistryAdapter = class {
9203
9203
  `Plugin registry at ${this.registryUrl} did not return valid JSON: ${err.message}`
9204
9204
  );
9205
9205
  }
9206
- const result = PluginRegistrySchema.safeParse(raw);
9207
- if (!result.success) {
9208
- const messages = result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`);
9206
+ const envelope = PluginRegistryEnvelopeSchema.safeParse(raw);
9207
+ if (!envelope.success) {
9208
+ const messages = envelope.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`);
9209
9209
  throw new Error(
9210
9210
  `Plugin registry at ${this.registryUrl} has an invalid shape: ${messages.join("; ")}`
9211
9211
  );
9212
9212
  }
9213
- return result.data;
9213
+ const plugins = [];
9214
+ for (const [index, entry] of envelope.data.plugins.entries()) {
9215
+ const entryResult = RegistryPluginEntrySchema.safeParse(entry);
9216
+ if (entryResult.success) {
9217
+ plugins.push(entryResult.data);
9218
+ continue;
9219
+ }
9220
+ const label = entry !== null && typeof entry === "object" && "name" in entry && typeof entry.name === "string" ? `'${entry.name}'` : `at index ${index}`;
9221
+ const messages = entryResult.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`);
9222
+ log.warn(
9223
+ `Plugin registry at ${this.registryUrl} has a malformed entry ${label} \u2014 skipped: ${messages.join("; ")}`
9224
+ );
9225
+ }
9226
+ return {
9227
+ schema_version: envelope.data.schema_version,
9228
+ last_updated: envelope.data.last_updated,
9229
+ plugins
9230
+ };
9214
9231
  }
9215
9232
  /**
9216
9233
  * Resolves `name@minorVersion` (e.g. "rbac", "1.0") against the registry.
@@ -10232,16 +10249,21 @@ async function checkPluginStaleness(cwd, deps) {
10232
10249
  const servicesDir = join36(cwd, "services");
10233
10250
  const names = discoverVendoredPlugins(servicesDir);
10234
10251
  let registryRepoByName = null;
10252
+ let registryFetchFailure = null;
10235
10253
  const resolveRegistryRepo = async (name) => {
10236
- if (registryRepoByName === null) {
10237
- registryRepoByName = /* @__PURE__ */ new Map();
10254
+ if (registryRepoByName === null && registryFetchFailure === null) {
10238
10255
  try {
10239
10256
  const reg = await deps.registry.fetchRegistry();
10257
+ registryRepoByName = /* @__PURE__ */ new Map();
10240
10258
  for (const entry of reg.plugins) registryRepoByName.set(entry.name, entry.repo);
10241
- } catch {
10259
+ } catch (err) {
10260
+ registryFetchFailure = err.message;
10242
10261
  }
10243
10262
  }
10244
- return registryRepoByName.get(name) ?? null;
10263
+ if (registryFetchFailure !== null) {
10264
+ return { repo: null, fetchFailure: registryFetchFailure };
10265
+ }
10266
+ return { repo: registryRepoByName?.get(name) ?? null, fetchFailure: null };
10245
10267
  };
10246
10268
  const results = [];
10247
10269
  for (const name of names) {
@@ -10275,15 +10297,24 @@ async function checkOnePlugin(pluginDir2, name, resolveRegistryRepo, git) {
10275
10297
  if (localOrigin) {
10276
10298
  return checkViaContentDiff(name, pluginDir2, localOrigin, { isLocalDir: true }, git);
10277
10299
  }
10278
- const registryRepo = await resolveRegistryRepo(name);
10279
- if (!registryRepo) {
10300
+ const lookup = await resolveRegistryRepo(name);
10301
+ if (!lookup.repo) {
10302
+ if (lookup.fetchFailure) {
10303
+ return {
10304
+ name,
10305
+ status: "cannot-tell",
10306
+ method: "unresolvable",
10307
+ detail: record ? `provenance records origin '${record.origin}', which is neither a reachable git URL nor a local directory that still exists, and the plugin registry could not be fetched to resolve '${name}' by name either: ${lookup.fetchFailure}` : `no provenance recorded (vendored before #1547) and the plugin registry could not be fetched to resolve '${name}' by name: ${lookup.fetchFailure}`
10308
+ };
10309
+ }
10280
10310
  return {
10281
10311
  name,
10282
10312
  status: "cannot-tell",
10283
10313
  method: "unresolvable",
10284
- detail: record ? `provenance records origin '${record.origin}', which is neither a reachable git URL nor a local directory that still exists, and '${name}' was not found in the plugin registry either` : `no provenance recorded (vendored before #1547, or an unreachable registry) and '${name}' was not found in the plugin registry \u2014 nothing to compare against`
10314
+ detail: record ? `provenance records origin '${record.origin}', which is neither a reachable git URL nor a local directory that still exists, and '${name}' was not found in the plugin registry either` : `no provenance recorded (vendored before #1547) and '${name}' was not found in the plugin registry \u2014 nothing to compare against`
10285
10315
  };
10286
10316
  }
10317
+ const registryRepo = lookup.repo;
10287
10318
  if (record?.sha) {
10288
10319
  return checkViaProvenance(name, record, registryRepo, git);
10289
10320
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.316.0",
3
+ "version": "0.316.2",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",