@theholocron/cli 2.0.0-alpha.67 → 2.0.0-alpha.68

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.mjs +56 -45
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -5,7 +5,7 @@ import yargs from "yargs";
5
5
  import { hideBin } from "yargs/helpers";
6
6
  import { createInterface } from "node:readline";
7
7
  import { stdin, stdout } from "node:process";
8
- import { ProviderApiError, ProviderApiError as ProviderApiError$1 } from "@theholocron/http-client";
8
+ import { AuthError, ProviderApiError, ProviderApiError as ProviderApiError$1 } from "@theholocron/http-client";
9
9
  import { Entry, findCredentials } from "@napi-rs/keyring";
10
10
  import ora from "ora";
11
11
  import chalk from "chalk";
@@ -3477,14 +3477,20 @@ const SYNC_STEPS = [
3477
3477
  "keywords",
3478
3478
  "description"
3479
3479
  ];
3480
+ const LOCAL_STEPS = /* @__PURE__ */ new Set(["keywords", "description"]);
3480
3481
  async function runSync(input) {
3481
3482
  const print = input.print ?? ((line) => console.log(line));
3482
3483
  const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
3483
- await loader.load();
3484
3484
  const config = input.loaded.resolved;
3485
3485
  const dryRun = input.context.dryRun ?? false;
3486
3486
  const requestedSteps = input.steps;
3487
3487
  const steps = [];
3488
+ if (!requestedSteps || requestedSteps.some((s) => !LOCAL_STEPS.has(s))) await loader.load();
3489
+ else try {
3490
+ await loader.load();
3491
+ } catch (err) {
3492
+ if (!(err instanceof AuthError)) throw err;
3493
+ }
3488
3494
  print(`Holocron sync — ${config.name}${dryRun ? " (dry-run)" : ""}`);
3489
3495
  print(` config: ${input.loaded.filepath}`);
3490
3496
  print("");
@@ -3493,6 +3499,7 @@ async function runSync(input) {
3493
3499
  print(" → source");
3494
3500
  for (const stepName of SYNC_STEPS) {
3495
3501
  if (requestedSteps !== void 0 && !requestedSteps.includes(stepName)) continue;
3502
+ if (LOCAL_STEPS.has(stepName)) continue;
3496
3503
  if (stepName === "labels") if (source.syncLabels) {
3497
3504
  steps.push(await runSyncStep("source", "sync labels", dryRun, () => source.syncLabels(CANONICAL_LABELS, STALE_LABELS)));
3498
3505
  print(formatSyncStep(steps[steps.length - 1]));
@@ -3551,47 +3558,6 @@ async function runSync(input) {
3551
3558
  print(formatSyncStep(steps[steps.length - 1]));
3552
3559
  }
3553
3560
  }
3554
- if (stepName === "keywords") {
3555
- const topics = config.repo?.topics ?? [];
3556
- if (topics.length === 0) {
3557
- steps.push({
3558
- capability: "source",
3559
- step: "sync keywords",
3560
- status: "skip",
3561
- message: "no topics configured"
3562
- });
3563
- print(formatSyncStep(steps[steps.length - 1]));
3564
- } else {
3565
- steps.push(await runSyncStep("source", "sync keywords", dryRun, async () => {
3566
- return await writePackageJsonField(input.context.repoRoot, "keywords", topics) ? `${topics.length} keywords written` : `${topics.length} topics (no package.json)`;
3567
- }));
3568
- print(formatSyncStep(steps[steps.length - 1]));
3569
- }
3570
- }
3571
- if (stepName === "description") {
3572
- const description = config.description;
3573
- if (!description) {
3574
- steps.push({
3575
- capability: "source",
3576
- step: "sync description",
3577
- status: "skip",
3578
- message: "no description configured"
3579
- });
3580
- print(formatSyncStep(steps[steps.length - 1]));
3581
- } else {
3582
- steps.push(await runSyncStep("source", "sync description", dryRun, async () => {
3583
- const pkgWrote = await writePackageJsonField(input.context.repoRoot, "description", description);
3584
- const readmeWrote = await updateReadmeDescription(input.context.repoRoot, description);
3585
- if (source.syncDescription) await source.syncDescription(description);
3586
- const parts = [];
3587
- if (pkgWrote) parts.push("package.json");
3588
- if (readmeWrote) parts.push("README.md");
3589
- if (source.syncDescription) parts.push("GitHub");
3590
- return parts.length > 0 ? parts.join(", ") + " updated" : "description synced";
3591
- }));
3592
- print(formatSyncStep(steps[steps.length - 1]));
3593
- }
3594
- }
3595
3561
  }
3596
3562
  if (requestedSteps) {
3597
3563
  for (const name of requestedSteps) if (!SYNC_STEPS.includes(name)) {
@@ -3605,6 +3571,51 @@ async function runSync(input) {
3605
3571
  }
3606
3572
  }
3607
3573
  }
3574
+ for (const stepName of ["keywords", "description"]) {
3575
+ if (requestedSteps !== void 0 && !requestedSteps.includes(stepName)) continue;
3576
+ if (stepName === "keywords") {
3577
+ const topics = config.repo?.topics ?? [];
3578
+ if (topics.length === 0) {
3579
+ steps.push({
3580
+ capability: "local",
3581
+ step: "sync keywords",
3582
+ status: "skip",
3583
+ message: "no topics configured"
3584
+ });
3585
+ print(formatSyncStep(steps[steps.length - 1]));
3586
+ } else {
3587
+ steps.push(await runSyncStep("local", "sync keywords", dryRun, async () => {
3588
+ return await writePackageJsonField(input.context.repoRoot, "keywords", topics) ? `${topics.length} keywords written` : `${topics.length} topics (no package.json)`;
3589
+ }));
3590
+ print(formatSyncStep(steps[steps.length - 1]));
3591
+ }
3592
+ }
3593
+ if (stepName === "description") {
3594
+ const description = config.description;
3595
+ if (!description) {
3596
+ steps.push({
3597
+ capability: "local",
3598
+ step: "sync description",
3599
+ status: "skip",
3600
+ message: "no description configured"
3601
+ });
3602
+ print(formatSyncStep(steps[steps.length - 1]));
3603
+ } else {
3604
+ const source = loader.has("source") ? loader.get("source") : null;
3605
+ steps.push(await runSyncStep("local", "sync description", dryRun, async () => {
3606
+ const pkgWrote = await writePackageJsonField(input.context.repoRoot, "description", description);
3607
+ const readmeWrote = await updateReadmeDescription(input.context.repoRoot, description);
3608
+ if (source?.syncDescription) await source.syncDescription(description);
3609
+ const parts = [];
3610
+ if (pkgWrote) parts.push("package.json");
3611
+ if (readmeWrote) parts.push("README.md");
3612
+ if (source?.syncDescription) parts.push("GitHub");
3613
+ return parts.length > 0 ? parts.join(", ") + " updated" : "description synced";
3614
+ }));
3615
+ print(formatSyncStep(steps[steps.length - 1]));
3616
+ }
3617
+ }
3618
+ }
3608
3619
  const summary = steps.reduce((acc, s) => {
3609
3620
  if (s.status === "ok") acc.ok += 1;
3610
3621
  else if (s.status === "fail") acc.fail += 1;
@@ -3956,10 +3967,10 @@ await yargs(hideBin(process.argv)).scriptName("holocron").usage("$0 <command> [o
3956
3967
  dryRun: argv.dryRun,
3957
3968
  ...argv.otp ? { otp: argv.otp } : {}
3958
3969
  })).status === "fail") process.exitCode = 1;
3959
- }).demandCommand(1, "Run `holocron npm --help` to see available npm subcommands."), () => {}).command("sync [steps..]", "Sync source-level state (labels, properties, topics) from config to the provider", (y) => y.positional("steps", {
3970
+ }).demandCommand(1, "Run `holocron npm --help` to see available npm subcommands."), () => {}).command("sync [steps..]", "Sync state from config to the provider and local files (labels, properties, topics, keywords, description)", (y) => y.positional("steps", {
3960
3971
  type: "string",
3961
3972
  array: true,
3962
- describe: "Steps to run: labels, properties, topics (default: all)"
3973
+ describe: "Steps to run: labels, properties, topics, keywords, description (default: all)"
3963
3974
  }).option("repo", {
3964
3975
  type: "string",
3965
3976
  describe: "Repo coords (\"owner/name\"). Defaults to plugin-specific resolution."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/cli",
3
- "version": "2.0.0-alpha.67",
3
+ "version": "2.0.0-alpha.68",
4
4
  "description": "The Holocron CLI — a pluggable, capability-based orchestrator for spinning up and operating software projects.",
5
5
  "homepage": "https://github.com/theholocron/holocron/tree/main/packages/cli#readme",
6
6
  "bugs": "https://github.com/theholocron/holocron/issues",