@theholocron/cli 2.0.0-alpha.57 → 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 +82 -8
  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
@@ -697,9 +697,11 @@ function patchPackageJson(content, from, to) {
697
697
  }
698
698
  let changed = false;
699
699
  const engines = pkg.engines;
700
- if (engines?.node === `>=${from}.0.0`) {
701
- engines.node = `>=${to}.0.0`;
702
- changed = true;
700
+ if (engines?.node && /^>=\d+(?:\.0\.0)?$/.test(engines.node)) {
701
+ if (parseInt(engines.node.match(/\d+/)[0], 10) === from) {
702
+ engines.node = `>=${to}.0.0`;
703
+ changed = true;
704
+ }
703
705
  }
704
706
  for (const field of ["devDependencies", "dependencies"]) {
705
707
  const deps = pkg[field];
@@ -1355,6 +1357,8 @@ jobs:
1355
1357
  steps:
1356
1358
  - name: Checkout repository
1357
1359
  uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
1360
+ with:
1361
+ fetch-depth: 0
1358
1362
 
1359
1363
  - name: Setup
1360
1364
  if: \${{ hashFiles('pnpm-lock.yaml') != '' }}
@@ -1396,15 +1400,14 @@ jobs:
1396
1400
  uses: reviewdog/action-gitleaks@2b7b5685e3e3eecddab5d30cfa04f18123031421 # v1
1397
1401
  with:
1398
1402
  reporter: github-pr-check
1403
+ gitleaks_flags: --log-opts=\${{ github.event.pull_request.base.sha }}..\${{ github.event.pull_request.head.sha }}
1399
1404
 
1400
1405
  - name: YamlLint
1406
+ if: \${{ hashFiles('yamllint.config.yml') != '' }}
1401
1407
  uses: reviewdog/action-yamllint@b5f7217d8c815ae374d1d55840d5e569d82f01f0 # v1
1402
1408
  with:
1403
1409
  reporter: github-pr-check
1404
- yamllint_flags: >-
1405
- \${{ hashFiles('yamllint.config.yml') != ''
1406
- && format('-c {0}/yamllint.config.yml {0}', github.workspace)
1407
- || github.workspace }}
1410
+ yamllint_flags: -c \${{ github.workspace }}/yamllint.config.yml \${{ github.workspace }}
1408
1411
 
1409
1412
  - name: ActionLint (GitHub Actions)
1410
1413
  if: \${{ hashFiles('.github/workflows/*.yml', '.github/workflows/*.yaml') != '' }}
@@ -3694,6 +3697,71 @@ function editorconfigContent() {
3694
3697
  ``
3695
3698
  ].join("\n");
3696
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
+ }
3697
3765
  const EDITORCONFIG_CHECKER_CONFIG = JSON.stringify({
3698
3766
  Version: "v3.7.0",
3699
3767
  Verbose: false,
@@ -4108,6 +4176,12 @@ async function runSetup(input) {
4108
4176
  await source.writeRepoFile(".editorconfig-checker.json", EDITORCONFIG_CHECKER_CONFIG);
4109
4177
  }));
4110
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]));
4111
4185
  if (source.syncLabels) {
4112
4186
  steps.push(await runStep("source", "sync labels", dryRun, async () => {
4113
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.57",
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",