@aipm-registry/cli 0.3.2 → 0.3.4

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/bin.cjs CHANGED
@@ -8106,6 +8106,22 @@ function privateInstallHint(name, status, token) {
8106
8106
  }
8107
8107
  return `Package not found: ${name} (${status}). If @org/pkg is private, run aipm login, or set AIPM_TOKEN for CI.`;
8108
8108
  }
8109
+ function publishTokenHint(name, error) {
8110
+ if (error === "Publish token required") {
8111
+ return [
8112
+ `Publish token required for ${name}.`,
8113
+ `Generate a fresh 5-minute publish token for ${name} from the package dashboard, then retry with AIPM_TOKEN=<token> aipm publish push --yes.`
8114
+ ].join(" ");
8115
+ }
8116
+ if (error === "Invalid publish token") {
8117
+ return [
8118
+ `Publish token was rejected for ${name}.`,
8119
+ `Generate a fresh 5-minute token for this exact package name, make sure aipm.manifest.json still says "${name}", and confirm your account can publish to that reserved package.`,
8120
+ "If you recently renamed the package or generated the token from another package page, create a new token from the matching package dashboard."
8121
+ ].join(" ");
8122
+ }
8123
+ return error;
8124
+ }
8109
8125
  async function assertRegistryReachable(registry) {
8110
8126
  const base = registry.replace(/\/$/, "");
8111
8127
  const res = await registryFetch(`${base}/health`, base);
@@ -8122,7 +8138,7 @@ async function publishPackage(registry, name, tarball, token) {
8122
8138
  const res = await registryFetch(url, base, { method: "POST", body: form, headers });
8123
8139
  if (!res.ok) {
8124
8140
  const err = await res.json().catch(() => ({}));
8125
- throw new Error(err.error ?? `Publish failed: ${res.status}`);
8141
+ throw new Error(err.error ? publishTokenHint(name, err.error) : `Publish failed: ${res.status}`);
8126
8142
  }
8127
8143
  return res.json();
8128
8144
  }
@@ -9648,17 +9664,21 @@ publish.command("validate").description("Validate staged files before publish").
9648
9664
  );
9649
9665
  });
9650
9666
  publish.command("preview").description("Preview exactly what will be uploaded").option("--json", "Print machine-readable JSON").action((opts) => printPublishPreview((0, import_node_process5.cwd)(), opts.json));
9651
- publish.command("push").description("Publish staged files").option("--registry <url>", "Registry base URL").option("--token <token>", "Publish token").option("--yes", "Confirm upload without an extra reminder").action(async (opts) => {
9667
+ publish.command("push").description("Publish staged files").option("--registry <url>", "Registry base URL").option("--token <token>", "Publish token").option("--yes", "Confirm upload without an extra reminder").option("--verbose", "Print extra diagnostic output").action(async (opts) => {
9652
9668
  const root = (0, import_node_process5.cwd)();
9653
9669
  const { manifest } = await validatePublishState(root);
9654
9670
  const registry = registryFromEnvOrDefault(opts.registry);
9655
9671
  const tarball = await packStagedFiles(root);
9656
9672
  const staged = await statusPublishState(root);
9673
+ const verbose = Boolean(opts.verbose || program2.opts().verbose);
9657
9674
  if (!opts.yes) {
9658
9675
  console.log("Reminder: this publishes an immutable public package version.");
9659
9676
  console.log("Use --yes to skip this reminder in automation.");
9660
9677
  }
9661
9678
  console.log(`Uploading ${staged.length} file${staged.length === 1 ? "" : "s"} to ${registry}.`);
9679
+ if (verbose) {
9680
+ console.log(`Verbose: package ${manifest.name}@${manifest.version}; tarball ${tarball.length} bytes.`);
9681
+ }
9662
9682
  for (const entry of staged) console.log(` ${entry.path}`);
9663
9683
  const result = await publishPackage(registry, manifest.name, tarball, opts.token ?? import_node_process5.env.AIPM_TOKEN);
9664
9684
  console.log(`Published ${manifest.name}@${result.version}`);