@theholocron/cli 5.4.0 → 5.5.1

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/README.md CHANGED
@@ -866,6 +866,17 @@ See the [command pages](https://theholocron.dev/holocron/commands/setup-notifica
866
866
  `readThread` (Discord); the release workflow's `announce` job runs it. See the
867
867
  [command page](../../docs/src/content/docs/commands/sync-releases.mdx).
868
868
 
869
+ ## Publishing templates
870
+
871
+ - **`holocron sync templates [--dry-run] [--yes]`** — publishes each `templates/<type>/` folder to
872
+ `<org>/<type>-template` (spec `tech-template-repos`, #2926): compares the folder with the repo's default branch,
873
+ writes only the difference through the `source` provider (files made, replaced, and removed when the folder no longer
874
+ has them), then tags the repo `templates-v<version>` with the version in `templates/package.json`. A rerun writes
875
+ nothing; a tag already at the same content is a success and one at other content is a failing row. It never creates
876
+ or deletes a repository (a missing one fails its row), and one failing template does not stop the others. Needs a
877
+ `source` provider with the optional `listFiles`, `deleteFile` and `ensureTag` beside `readFile` and `writeFile`
878
+ (GitHub). See the [command page](../../docs/src/content/docs/commands/sync-templates.mdx).
879
+
869
880
  ## Syncing issues
870
881
 
871
882
  - **`holocron sync issues --from <a> --to <b> [--since <time>] [--yes]`** — one direction of an issue sync between two
package/dist/cli.mjs CHANGED
@@ -148,6 +148,7 @@ const COMMAND_CONTEXTS = {
148
148
  "sync incidents": "workspace",
149
149
  "sync prs": "workspace",
150
150
  "sync releases": "workspace",
151
+ "sync templates": "workspace",
151
152
  "sync ideas": "workspace",
152
153
  "sync tooling": "workspace",
153
154
  "sync requests": "workspace",
@@ -2303,6 +2304,15 @@ const syncRequestsEntry = {
2303
2304
  ],
2304
2305
  supportsDryRun: true
2305
2306
  };
2307
+ // src/commands/sync-templates/sync-templates.entry.ts
2308
+ const syncTemplatesEntry = {
2309
+ name: "sync templates",
2310
+ description: "Publish each templates/<type>/ folder to its template repo and tag it with the templates version",
2311
+ positionals: [],
2312
+ options: [],
2313
+ skipOptions: ["yes"],
2314
+ supportsDryRun: true
2315
+ };
2306
2316
  // src/commands/sync-tooling/sync-tooling.entry.ts
2307
2317
  const syncToolingEntry = {
2308
2318
  name: "sync tooling",
@@ -2525,6 +2535,7 @@ const registry = createCommandRegistry([
2525
2535
  syncIncidentsEntry,
2526
2536
  syncPrsEntry,
2527
2537
  syncReleasesEntry,
2538
+ syncTemplatesEntry,
2528
2539
  ideasSyncEntry,
2529
2540
  syncToolingEntry,
2530
2541
  syncRequestsEntry,
@@ -34441,6 +34452,36 @@ const secretSetCommand = {
34441
34452
  })).status === "fail") process.exitCode = 1;
34442
34453
  }
34443
34454
  };
34455
+ // src/commands/new/without-tokens/without-tokens.ts
34456
+ /** The names of variables that hold a credential for GitHub, this CLI or 1Password. */
34457
+ const CREDENTIAL_NAME = /^(HOLOCRON|GITHUB|GH|OP)_.*(TOKEN|SECRET|KEY)$/;
34458
+ /**
34459
+ * A copy of `env` without the variables that hold a credential for GitHub (`GITHUB_TOKEN`, `GH_TOKEN`), this CLI
34460
+ * (`HOLOCRON_*_TOKEN`) or 1Password (`OP_SERVICE_ACCOUNT_TOKEN`): names that start with one of those prefixes and end in
34461
+ * `TOKEN`, `SECRET` or `KEY`. Everything else (`PATH`, `HOME`, proxy and registry settings) stays, so a program started
34462
+ * with it still finds its tools.
34463
+ */
34464
+ function withoutTokens(env) {
34465
+ return Object.fromEntries(Object.entries(env).filter(([name]) => !CREDENTIAL_NAME.test(name)));
34466
+ }
34467
+ // src/commands/new/default-exec/default-exec.ts
34468
+ /**
34469
+ * Runs `cmd` with `args` in `opts.cwd`, printing to this terminal. `opts.env` is added to this process's environment;
34470
+ * with `opts.cleanEnv` the credential variables are removed from it first (`withoutTokens()`), for a step that runs code
34471
+ * the person did not write, such as the lifecycle scripts of a package install.
34472
+ */
34473
+ function defaultExec$1(cmd, args, opts) {
34474
+ const extra = opts.env ?? {};
34475
+ const needsEnv = opts.cleanEnv === true || Object.keys(extra).length > 0;
34476
+ execFileSync(cmd, args, {
34477
+ cwd: opts.cwd,
34478
+ stdio: opts.stdio,
34479
+ ...needsEnv ? { env: {
34480
+ ...opts.cleanEnv ? withoutTokens(process.env) : process.env,
34481
+ ...extra
34482
+ } } : {}
34483
+ });
34484
+ }
34444
34485
  // src/commands/new/new.ts
34445
34486
  /**
34446
34487
  * `holocron new repo <type> <name>` — create a GitHub repo from a template and
@@ -34610,16 +34651,6 @@ function preflight() {
34610
34651
  const result = spawnSync("gh", ["--version"], { encoding: "utf8" });
34611
34652
  if (result.error != null || result.status !== 0) throw new NewError("`gh` CLI is not installed or not on PATH. Install it from https://cli.github.com");
34612
34653
  }
34613
- function defaultExec$1(cmd, args, opts) {
34614
- execFileSync(cmd, args, {
34615
- cwd: opts.cwd,
34616
- stdio: opts.stdio,
34617
- ...opts.env && Object.keys(opts.env).length > 0 ? { env: {
34618
- ...process.env,
34619
- ...opts.env
34620
- } } : {}
34621
- });
34622
- }
34623
34654
  function keychainLookup(key) {
34624
34655
  const result = spawnSync("security", [
34625
34656
  "find-generic-password",
@@ -34647,6 +34678,7 @@ async function runNew(input) {
34647
34678
  const readFn = input.readFile ?? defaultReadFile;
34648
34679
  const writeFn = input.writeFile ?? defaultWriteFile;
34649
34680
  const walkFn = input.walkFiles ?? defaultWalkFiles;
34681
+ const self = input.selfCommand ?? [process.execPath, process.argv[1]];
34650
34682
  preflight();
34651
34683
  const templateRepo = `${org}/${input.type}-template`;
34652
34684
  const newRepo = `${org}/${input.name}`;
@@ -34664,6 +34696,7 @@ async function runNew(input) {
34664
34696
  if (input.homepage) print(` Would replace <homepage> → "${input.homepage}"`);
34665
34697
  if (input.runtimeEnvironment) print(` Would replace <runtime_environment> → "${input.runtimeEnvironment}"`);
34666
34698
  print(` Would generate holocron.config.ts`);
34699
+ if (!input.noVerify) print(` Would run holocron sync in ${repoDir}`);
34667
34700
  logger.info({
34668
34701
  repo: newRepo,
34669
34702
  status: "dry-run"
@@ -34712,6 +34745,16 @@ async function runNew(input) {
34712
34745
  } catch {}
34713
34746
  let templateSlug = `${input.type}-template`;
34714
34747
  const pkgJsonPath = path.join(repoDir, "package.json");
34748
+ const canRead = (file) => {
34749
+ try {
34750
+ readFn(file);
34751
+ return true;
34752
+ } catch {
34753
+ return false;
34754
+ }
34755
+ };
34756
+ const hasPackageJson = canRead(pkgJsonPath);
34757
+ const hasJsonConfig = canRead(path.join(repoDir, "holocron.config.json"));
34715
34758
  if (existsSync(pkgJsonPath)) try {
34716
34759
  const pkg = JSON.parse(readFn(pkgJsonPath));
34717
34760
  if (typeof pkg.name === "string") templateSlug = pkg.name.split("/").at(-1) || templateSlug;
@@ -34741,26 +34784,29 @@ async function runNew(input) {
34741
34784
  print(` ✓ tsconfig.json (display)`);
34742
34785
  }
34743
34786
  } catch {}
34744
- const configContent = generateHolocronConfig({
34745
- name: input.name,
34746
- type: input.type,
34747
- org,
34748
- description: input.description,
34749
- homepage: input.homepage,
34750
- vaultProvider: input.vaultProvider,
34751
- vaultProject: input.vaultProject,
34752
- vaultConfig: input.vaultConfig,
34753
- deploymentProvider: input.deploymentProvider,
34754
- agent: input.agent,
34755
- runtimeEnvironment: input.runtimeEnvironment,
34756
- protection: input.protection,
34757
- openSource: input.openSource,
34758
- usesExternalPackages: input.usesExternalPackages,
34759
- topics: input.topics,
34760
- skills: input.skills
34761
- });
34762
- writeFn(path.join(repoDir, "holocron.config.ts"), configContent);
34763
- print(` Generated holocron.config.ts`);
34787
+ if (hasJsonConfig) print(` Kept holocron.config.json`);
34788
+ else {
34789
+ const configContent = generateHolocronConfig({
34790
+ name: input.name,
34791
+ type: input.type,
34792
+ org,
34793
+ description: input.description,
34794
+ homepage: input.homepage,
34795
+ vaultProvider: input.vaultProvider,
34796
+ vaultProject: input.vaultProject,
34797
+ vaultConfig: input.vaultConfig,
34798
+ deploymentProvider: input.deploymentProvider,
34799
+ agent: input.agent,
34800
+ runtimeEnvironment: input.runtimeEnvironment,
34801
+ protection: input.protection,
34802
+ openSource: input.openSource,
34803
+ usesExternalPackages: input.usesExternalPackages,
34804
+ topics: input.topics,
34805
+ skills: input.skills
34806
+ });
34807
+ writeFn(path.join(repoDir, "holocron.config.ts"), configContent);
34808
+ print(` Generated holocron.config.ts`);
34809
+ }
34764
34810
  execFn("git", ["add", "-A"], {
34765
34811
  cwd: repoDir,
34766
34812
  stdio: "inherit"
@@ -34777,10 +34823,12 @@ async function runNew(input) {
34777
34823
  if (!input.noVerify) {
34778
34824
  print("");
34779
34825
  print(" Installing dependencies…");
34780
- try {
34826
+ if (!hasPackageJson) print(" No package.json: skipping pnpm install");
34827
+ else try {
34781
34828
  execFn("pnpm", ["install"], {
34782
34829
  cwd: repoDir,
34783
- stdio: "inherit"
34830
+ stdio: "inherit",
34831
+ cleanEnv: true
34784
34832
  });
34785
34833
  } catch (err) {
34786
34834
  print(` ✗ pnpm install failed — ${errorMessage(err)}`);
@@ -34791,25 +34839,45 @@ async function runNew(input) {
34791
34839
  message: "pnpm install failed; inspect output above"
34792
34840
  };
34793
34841
  }
34842
+ const adminToken = input.token ?? keychainLookup("github.admin");
34843
+ const tokenEnv = {};
34844
+ if (!env$4.get("HOLOCRON_ORG_TOKEN")) {
34845
+ const orgToken = keychainLookup("github.org");
34846
+ if (orgToken) tokenEnv["HOLOCRON_ORG_TOKEN"] = orgToken;
34847
+ }
34848
+ if (!env$4.get("HOLOCRON_DEPLOY_TOKEN")) {
34849
+ const deployToken = keychainLookup("github.deploy");
34850
+ if (deployToken) tokenEnv["HOLOCRON_DEPLOY_TOKEN"] = deployToken;
34851
+ }
34852
+ const manualSync = `cd ${repoDir} && holocron sync`;
34853
+ print("");
34854
+ if (!adminToken) print(` ✗ holocron sync skipped — no GitHub admin token found. Run it by hand: ${manualSync}`);
34855
+ else {
34856
+ print(" Running holocron sync…");
34857
+ try {
34858
+ execFn(self[0], [
34859
+ ...self.slice(1),
34860
+ "sync",
34861
+ "--token",
34862
+ adminToken
34863
+ ], {
34864
+ cwd: repoDir,
34865
+ stdio: "inherit",
34866
+ env: tokenEnv
34867
+ });
34868
+ } catch (err) {
34869
+ print(` ✗ holocron sync failed (${errorMessage(err)}) — run it by hand: ${manualSync}`);
34870
+ }
34871
+ }
34794
34872
  print("");
34795
34873
  print(" Running holocron setup…");
34796
34874
  try {
34797
34875
  const setupArgs = ["setup"];
34798
- const setupEnv = {};
34799
- const adminToken = input.token ?? keychainLookup("github.admin");
34800
34876
  if (adminToken) setupArgs.push("--token", adminToken);
34801
- if (!env$4.get("HOLOCRON_ORG_TOKEN")) {
34802
- const orgToken = keychainLookup("github.org");
34803
- if (orgToken) setupEnv["HOLOCRON_ORG_TOKEN"] = orgToken;
34804
- }
34805
- if (!env$4.get("HOLOCRON_DEPLOY_TOKEN")) {
34806
- const deployToken = keychainLookup("github.deploy");
34807
- if (deployToken) setupEnv["HOLOCRON_DEPLOY_TOKEN"] = deployToken;
34808
- }
34809
34877
  execFn("holocron", setupArgs, {
34810
34878
  cwd: repoDir,
34811
34879
  stdio: "inherit",
34812
- env: setupEnv
34880
+ env: tokenEnv
34813
34881
  });
34814
34882
  } catch {
34815
34883
  print(" ✗ holocron setup failed — run it manually after checking your config");
@@ -34822,8 +34890,9 @@ async function runNew(input) {
34822
34890
  print(` 1. cd ${repoDir}`);
34823
34891
  if (input.noVerify) {
34824
34892
  print(` 2. pnpm install`);
34825
- print(` 3. holocron setup # wire up secrets, teams, labels, etc.`);
34826
- print(` 4. git push -u origin HEAD`);
34893
+ print(` 3. holocron sync # thin callers, org AGENTS.md block, generated files`);
34894
+ print(` 4. holocron setup # wire up secrets, teams, labels, etc.`);
34895
+ print(` 5. git push -u origin HEAD`);
34827
34896
  } else print(` 2. git push -u origin HEAD`);
34828
34897
  logger.info({
34829
34898
  repo: newRepo,
@@ -44283,6 +44352,274 @@ const syncRequestsCommand = {
44283
44352
  })).status === "fail") process.exitCode = 1;
44284
44353
  }
44285
44354
  };
44355
+ // src/commands/sync-templates/plan-template-sync/plan-template-sync.ts
44356
+ /** Compares a template folder with its repo and lists only what differs: files to create, to replace and to remove. */
44357
+ async function planTemplateSync(input) {
44358
+ const remote = new Set(input.remotePaths);
44359
+ const paths = Object.keys(input.files).sort();
44360
+ const plan = {
44361
+ create: [],
44362
+ update: [],
44363
+ remove: []
44364
+ };
44365
+ for (const path of paths) {
44366
+ if (!remote.has(path)) {
44367
+ plan.create.push(path);
44368
+ continue;
44369
+ }
44370
+ const file = await input.read(path);
44371
+ if (!file) plan.create.push(path);
44372
+ else if (file.content !== input.files[path]) plan.update.push({
44373
+ path,
44374
+ version: file.version
44375
+ });
44376
+ }
44377
+ plan.remove = [...remote].filter((p) => !(p in input.files)).sort();
44378
+ return plan;
44379
+ }
44380
+ // src/commands/sync-templates/template-files/template-files.ts
44381
+ /**
44382
+ * Every file of one template folder as `path from the folder -> text`, with `/` separators. `.git` and
44383
+ * `node_modules` are not entered. A file with a NUL byte is binary and throws: the `source` capability writes text, so
44384
+ * publishing it would corrupt it.
44385
+ */
44386
+ function templateFiles(dir) {
44387
+ const files = {};
44388
+ for (const full of walkFilesSync(dir)) {
44389
+ const path = relative(dir, full).split(sep).join("/");
44390
+ const bytes = readFileSync(full);
44391
+ if (bytes.includes(0)) throw new Error(`${path} is a binary file; templates publish text files only`);
44392
+ files[path] = bytes.toString("utf8");
44393
+ }
44394
+ return files;
44395
+ }
44396
+ // src/commands/sync-templates/template-folders/template-folders.ts
44397
+ /**
44398
+ * The template types under `templates/`: its subfolders, sorted. A file beside them (`package.json` and `README.md`
44399
+ * are the group's own) is not a template, and neither is a folder named `node_modules` or one that starts with a dot.
44400
+ * An absent `templates/` folder is no templates.
44401
+ */
44402
+ function templateFolders(templatesDir) {
44403
+ let entries;
44404
+ try {
44405
+ entries = readdirSync(templatesDir, { withFileTypes: true });
44406
+ } catch (err) {
44407
+ if (err.code === "ENOENT") return [];
44408
+ throw err;
44409
+ }
44410
+ return entries.filter((e) => e.isDirectory() && e.name !== "node_modules" && !e.name.startsWith(".")).map((e) => e.name).sort();
44411
+ }
44412
+ // src/commands/sync-templates/templates-version/templates-version.ts
44413
+ /** The `templates` group's version, from `package.json` in the templates folder. Throws when it is missing or has no version. */
44414
+ function templatesVersion(templatesDir) {
44415
+ const path = join(templatesDir, "package.json");
44416
+ let version;
44417
+ try {
44418
+ version = JSON.parse(readFileSync(path, "utf8")).version;
44419
+ } catch (err) {
44420
+ throw new Error(`cannot read the templates version from ${path}`, { cause: err });
44421
+ }
44422
+ if (typeof version !== "string" || version === "") throw new Error(`${path} has no version`);
44423
+ return version;
44424
+ }
44425
+ // src/commands/sync-templates/run-sync-templates/run-sync-templates.ts
44426
+ /**
44427
+ * `holocron sync templates` -- publish each `templates/<type>/` folder to `<org>/<type>-template` and tag that repo
44428
+ * `templates-v<version>` (spec `tech-template-repos`, rollout step 3, #2926).
44429
+ *
44430
+ * Each folder is compared with its repo's default branch; only the difference is written through the `source`
44431
+ * capability (files made, replaced, and removed when the repo has them and the folder no longer does), then the repo is
44432
+ * tagged with the `templates` group's version from `templates/package.json`. A rerun writes nothing and a tag already at
44433
+ * the same content is left alone. It never creates or deletes a repository: a missing template repo is a failing row.
44434
+ * One template failing does not stop the others. It writes, so it asks first; `--yes` skips the question and, without a
44435
+ * terminal, a run with neither `--yes` nor `--dry-run` refuses.
44436
+ */
44437
+ const counts = (p) => `${p.create.length} to create, ${p.update.length} to replace, ${p.remove.length} to remove`;
44438
+ async function runSyncTemplates(input) {
44439
+ const print = input.print ?? ((line) => console.log(line));
44440
+ const row = (status, ...parts) => print(statusRow$1(status, ["sync templates", ...parts]));
44441
+ const summary = (templates) => {
44442
+ const n = (s) => templates.filter((t) => t.status === s).length;
44443
+ print("");
44444
+ print(style.header(`${n("ok")} ok, ${n("fail")} fail, ${n("skip")} skipped`));
44445
+ };
44446
+ const stop = (status, reason) => {
44447
+ row(status, reason);
44448
+ return {
44449
+ status,
44450
+ reason,
44451
+ templates: []
44452
+ };
44453
+ };
44454
+ const dryRun = Boolean(input.context.dryRun);
44455
+ const dir = input.templatesDir ?? join(input.context.repoRoot, "templates");
44456
+ let names;
44457
+ let version;
44458
+ try {
44459
+ names = templateFolders(dir);
44460
+ if (names.length === 0) return stop("skip", `no template folders under ${dir}`);
44461
+ version = templatesVersion(dir);
44462
+ } catch (err) {
44463
+ return stop("fail", errorMessage(err));
44464
+ }
44465
+ const org = input.context.org;
44466
+ if (!org) return stop("fail", "no organization to publish to: set `org` in the config or pass --org");
44467
+ const tag = `templates-v${version}`;
44468
+ /* v8 ignore next -- the real loader is only built outside tests, which always inject one */
44469
+ const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
44470
+ await loader.load();
44471
+ assertPluginsResolvable(loader, "sync templates");
44472
+ const source = loader.has("source") ? loader.get("source") : void 0;
44473
+ if (!source?.readFile || !source.writeFile || !source.listFiles || !source.deleteFile || !source.ensureTag) return stop("fail", whyMissing(loader, "source", "no `source` provider that can read, write, list and delete files and tag is available"));
44474
+ const { readFile, writeFile, listFiles, deleteFile, ensureTag } = source;
44475
+ const results = [];
44476
+ const planned = [];
44477
+ for (const name of names) {
44478
+ const repo = `${org}/${name}-template`;
44479
+ try {
44480
+ const files = templateFiles(join(dir, name));
44481
+ const plan = await planTemplateSync({
44482
+ files,
44483
+ remotePaths: await listFiles.call(source, repo),
44484
+ read: (path) => readFile.call(source, path, repo)
44485
+ });
44486
+ planned.push({
44487
+ name,
44488
+ repo,
44489
+ files,
44490
+ plan
44491
+ });
44492
+ } catch (err) {
44493
+ row("fail", name, repo, describeError(err));
44494
+ results.push({
44495
+ name,
44496
+ repo,
44497
+ status: "fail",
44498
+ created: 0,
44499
+ updated: 0,
44500
+ removed: 0,
44501
+ reason: errorMessage(err)
44502
+ });
44503
+ }
44504
+ }
44505
+ if (dryRun) {
44506
+ for (const p of planned) {
44507
+ row("skip", p.name, p.repo, `dry run, nothing written: ${counts(p.plan)}; would tag ${tag}`);
44508
+ results.push({
44509
+ name: p.name,
44510
+ repo: p.repo,
44511
+ status: "skip",
44512
+ created: p.plan.create.length,
44513
+ updated: p.plan.update.length,
44514
+ removed: p.plan.remove.length
44515
+ });
44516
+ }
44517
+ summary(results);
44518
+ return {
44519
+ status: results.some((r) => r.status === "fail") ? "fail" : "ok",
44520
+ version,
44521
+ templates: results
44522
+ };
44523
+ }
44524
+ if (planned.length > 0 && !input.yes) {
44525
+ if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError("`sync templates` writes to the template repos; pass --yes to run it without asking, or --dry-run to look");
44526
+ if (!await (input.confirm ?? ((q) => confirm({
44527
+ message: q,
44528
+ default: false
44529
+ })))(`Publish ${planned.length} template(s) as ${tag}?`)) {
44530
+ for (const p of planned) {
44531
+ row("skip", p.name, p.repo, "cancelled; nothing was changed");
44532
+ results.push({
44533
+ name: p.name,
44534
+ repo: p.repo,
44535
+ status: "skip",
44536
+ created: 0,
44537
+ updated: 0,
44538
+ removed: 0
44539
+ });
44540
+ }
44541
+ summary(results);
44542
+ return {
44543
+ status: "cancelled",
44544
+ version,
44545
+ templates: results
44546
+ };
44547
+ }
44548
+ }
44549
+ const message = `chore: sync from ${HOLOCRON_REPO$1} ${tag}`;
44550
+ for (const { name, repo, files, plan } of planned) {
44551
+ const result = {
44552
+ name,
44553
+ repo,
44554
+ status: "ok",
44555
+ created: 0,
44556
+ updated: 0,
44557
+ removed: 0
44558
+ };
44559
+ try {
44560
+ for (const path of plan.create) {
44561
+ await writeFile.call(source, path, files[path], {
44562
+ message,
44563
+ repo
44564
+ });
44565
+ result.created++;
44566
+ }
44567
+ for (const { path, version: fileVersion } of plan.update) {
44568
+ await writeFile.call(source, path, files[path], {
44569
+ message,
44570
+ version: fileVersion,
44571
+ repo
44572
+ });
44573
+ result.updated++;
44574
+ }
44575
+ for (const path of plan.remove) {
44576
+ await deleteFile.call(source, path, {
44577
+ message,
44578
+ repo
44579
+ });
44580
+ result.removed++;
44581
+ }
44582
+ result.tagged = await ensureTag.call(source, tag, repo);
44583
+ row("ok", name, repo, `${result.created} created, ${result.updated} replaced, ${result.removed} removed; ${result.tagged ? `tagged ${tag}` : `${tag} already there`}`);
44584
+ } catch (err) {
44585
+ result.status = "fail";
44586
+ result.reason = errorMessage(err);
44587
+ row("fail", name, repo, describeError(err));
44588
+ }
44589
+ results.push(result);
44590
+ }
44591
+ summary(results);
44592
+ return {
44593
+ status: results.some((r) => r.status === "fail") ? "fail" : "ok",
44594
+ version,
44595
+ templates: results
44596
+ };
44597
+ }
44598
+ // src/commands/sync-templates/sync-templates.command.ts
44599
+ const syncTemplatesCommand = {
44600
+ command: "templates",
44601
+ describe: "Publish each templates/<type>/ folder to its <type>-template repo and tag that repo with the templates version",
44602
+ builder: (y) => y.option("yes", {
44603
+ type: "boolean",
44604
+ describe: "Write without asking (a workflow needs it)"
44605
+ }),
44606
+ handler: async (argv) => {
44607
+ const tokens = tokenContext(argv.token);
44608
+ if (!tokens) return;
44609
+ const loaded = await loadConfig(argv.cwd);
44610
+ applyResolvedConfig(argv, loaded.resolved);
44611
+ if ((await runSyncTemplates({
44612
+ loaded,
44613
+ context: {
44614
+ repoRoot: argv.cwd,
44615
+ dryRun: argv.dryRun,
44616
+ ...tokens,
44617
+ org: resolveOrg(argv, loaded.resolved)
44618
+ },
44619
+ ...argv.yes ? { yes: true } : {}
44620
+ })).status === "fail") process.exitCode = 1;
44621
+ }
44622
+ };
44286
44623
  // src/commands/sync-tooling/run-sync-tooling/run-sync-tooling.ts
44287
44624
  /**
44288
44625
  * `holocron sync tooling` — runs each `tooling` provider's `sync()` and nothing else.
@@ -45347,7 +45684,7 @@ async function syncApp(argv) {
45347
45684
  const syncCommand = {
45348
45685
  command: "sync [steps..]",
45349
45686
  describe: "Sync state from config to the provider and local files (labels, properties, teams, topics, keywords, description, homepage, readme, workflows, scripts, wiki)",
45350
- builder: (y) => syncArgs(y).command(syncGithubCommand).command(syncIssuesCommand).command(syncIncidentsCommand).command(syncPrsCommand).command(syncReleasesCommand).command(syncReadmeCommand).command(ideasSyncCommand).command(syncToolingCommand).command(syncRequestsCommand).command(specsSyncCommand).command(secretsSyncCommand).command(notificationsSyncRolesCommand),
45687
+ builder: (y) => syncArgs(y).command(syncGithubCommand).command(syncIssuesCommand).command(syncIncidentsCommand).command(syncPrsCommand).command(syncReleasesCommand).command(syncTemplatesCommand).command(syncReadmeCommand).command(ideasSyncCommand).command(syncToolingCommand).command(syncRequestsCommand).command(specsSyncCommand).command(secretsSyncCommand).command(notificationsSyncRolesCommand),
45351
45688
  handler: async (argv) => {
45352
45689
  if (argv.env !== void 0 || argv.steps?.[0] !== void 0) {
45353
45690
  if (await syncApp(argv)) return;