@theholocron/cli 2.0.0-alpha.58 → 2.0.0-alpha.59

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 +72 -1
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -8,7 +8,7 @@ import { Entry, findCredentials } from "@napi-rs/keyring";
8
8
  import { createHash } from "node:crypto";
9
9
  import { createGitHubClient } from "@theholocron/github-client";
10
10
  import { execFile, spawnSync } from "node:child_process";
11
- import { access, readFile, stat, writeFile } from "node:fs/promises";
11
+ import { access, readFile, readdir, stat, writeFile } from "node:fs/promises";
12
12
  import { pathToFileURL } from "node:url";
13
13
  import { promisify } from "node:util";
14
14
  //#region src/capabilities/index.ts
@@ -3697,6 +3697,71 @@ function editorconfigContent() {
3697
3697
  ``
3698
3698
  ].join("\n");
3699
3699
  }
3700
+ function codecovContent(packages) {
3701
+ const header = [
3702
+ `# AUTO-GENERATED by holocron setup — do not edit directly.`,
3703
+ `# Source: theholocron/holocron · packages/cli/src/commands/setup.ts`,
3704
+ `# Synced: ${(/* @__PURE__ */ new Date()).toISOString()}`,
3705
+ `# Tool: holocron setup`,
3706
+ `# Changes: run \`holocron setup\` to regenerate.`
3707
+ ].join("\n");
3708
+ const componentLines = packages.flatMap(({ slug, name }) => [
3709
+ ` - component_id: ${slug}`,
3710
+ ` name: "${name}"`,
3711
+ ` paths:`,
3712
+ ` - packages/${slug}/**`
3713
+ ]);
3714
+ return [
3715
+ header,
3716
+ ``,
3717
+ `codecov:`,
3718
+ ` require_ci_to_pass: true`,
3719
+ ``,
3720
+ `coverage:`,
3721
+ ` precision: 2`,
3722
+ ` round: down`,
3723
+ ` status:`,
3724
+ ` project:`,
3725
+ ` default:`,
3726
+ ` target: auto`,
3727
+ ` threshold: 2%`,
3728
+ ` patch:`,
3729
+ ` default:`,
3730
+ ` target: 80%`,
3731
+ ``,
3732
+ `comment:`,
3733
+ ` layout: "reach,diff,flags,components"`,
3734
+ ` behavior: default`,
3735
+ ` require_changes: true`,
3736
+ ``,
3737
+ `component_management:`,
3738
+ ` default_rules:`,
3739
+ ` statuses:`,
3740
+ ` - type: patch`,
3741
+ ` target: 80%`,
3742
+ ` individual_components:`,
3743
+ ...componentLines.length > 0 ? componentLines : [` []`],
3744
+ ``
3745
+ ].join("\n");
3746
+ }
3747
+ async function readWorkspacePackages(repoRoot) {
3748
+ const packagesDir = join(repoRoot, "packages");
3749
+ const entries = await readdir(packagesDir, { withFileTypes: true }).catch(() => null);
3750
+ if (!entries) return [];
3751
+ const packages = [];
3752
+ for (const entry of entries) {
3753
+ if (!entry.isDirectory()) continue;
3754
+ try {
3755
+ const raw = await readFile(join(packagesDir, entry.name, "package.json"), "utf8");
3756
+ const pkg = JSON.parse(raw);
3757
+ if (typeof pkg.name === "string") packages.push({
3758
+ slug: entry.name,
3759
+ name: pkg.name
3760
+ });
3761
+ } catch {}
3762
+ }
3763
+ return packages.sort((a, b) => a.slug.localeCompare(b.slug));
3764
+ }
3700
3765
  const EDITORCONFIG_CHECKER_CONFIG = JSON.stringify({
3701
3766
  Version: "v3.7.0",
3702
3767
  Verbose: false,
@@ -4111,6 +4176,12 @@ async function runSetup(input) {
4111
4176
  await source.writeRepoFile(".editorconfig-checker.json", EDITORCONFIG_CHECKER_CONFIG);
4112
4177
  }));
4113
4178
  print(formatStep(steps[steps.length - 1]));
4179
+ steps.push(await runStep("source", "write codecov.yml", dryRun, async () => {
4180
+ const packages = await readWorkspacePackages(input.context.repoRoot);
4181
+ await source.writeRepoFile("codecov.yml", codecovContent(packages));
4182
+ return packages.length > 0 ? `${packages.length} components` : "no components";
4183
+ }));
4184
+ print(formatStep(steps[steps.length - 1]));
4114
4185
  if (source.syncLabels) {
4115
4186
  steps.push(await runStep("source", "sync labels", dryRun, async () => {
4116
4187
  return source.syncLabels(CANONICAL_LABELS, STALE_LABELS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/cli",
3
- "version": "2.0.0-alpha.58",
3
+ "version": "2.0.0-alpha.59",
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",