@h-rig/core 0.0.6-alpha.4 → 0.0.6-alpha.41

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/src/index.js CHANGED
@@ -263,7 +263,7 @@ function buildRigInitConfigSource(input) {
263
263
  lines.push(` issueUpdates: "lifecycle",`);
264
264
  lines.push(` projects: { enabled: false },`);
265
265
  lines.push(` },`);
266
- lines.push(` automation: { maxValidationAttempts: 30, maxPrFixIterations: 30 },`);
266
+ lines.push(` automation: { maxValidationAttempts: 30, maxPrFixIterations: 100500 },`);
267
267
  lines.push(` pr: { mode: "auto", watchChecks: true, autoFixChecks: true, autoFixReview: true },`);
268
268
  lines.push(` merge: { mode: "auto", method: "repo-default", deleteBranch: "repo-default", bypass: false },`);
269
269
  lines.push(` issueAnalysis: { enabled: true, harness: "pi", mode: "continuous" },`);
@@ -1,17 +1,63 @@
1
1
  // @bun
2
2
  // packages/core/src/load-config.ts
3
- import { existsSync, readFileSync } from "fs";
3
+ import { existsSync, mkdtempSync, readFileSync, rmSync } from "fs";
4
+ import { tmpdir } from "os";
4
5
  import { join } from "path";
5
6
  import { pathToFileURL } from "url";
6
7
  import { Schema } from "effect";
7
8
  import { RigConfig } from "@rig/contracts";
8
9
  var TS_NAMES = ["rig.config.ts", "rig.config.mts"];
9
10
  var JSON_NAMES = ["rig.config.json"];
11
+ function isModuleResolutionError(error) {
12
+ const message = error instanceof Error ? error.message : String(error);
13
+ return message.includes("Cannot find module") || message.includes("Could not resolve");
14
+ }
15
+ function runningFromCompiledBinary() {
16
+ return import.meta.url.includes("$bunfs");
17
+ }
18
+ async function importConfigViaRuntimeBundle(configPath) {
19
+ const bun = globalThis.Bun;
20
+ if (!bun?.build) {
21
+ throw new Error(`Failed to import ${configPath}: bare imports could not be resolved and no Bun.build runtime bundler is available.`);
22
+ }
23
+ const result = await bun.build({
24
+ entrypoints: [configPath],
25
+ target: "bun",
26
+ format: "esm",
27
+ throw: false
28
+ });
29
+ if (!result.success || !result.outputs[0]) {
30
+ const detail = result.logs.map((log) => String(log)).join(`
31
+ `);
32
+ throw new Error(`Failed to bundle ${configPath}: ${detail || "unknown bundler error"}`);
33
+ }
34
+ const dir = mkdtempSync(join(tmpdir(), "rig-config-bundle-"));
35
+ try {
36
+ const bundledPath = join(dir, "rig.config.bundled.js");
37
+ await bun.write(bundledPath, await result.outputs[0].text());
38
+ return await import(pathToFileURL(bundledPath).href);
39
+ } finally {
40
+ try {
41
+ rmSync(dir, { recursive: true, force: true });
42
+ } catch {}
43
+ }
44
+ }
10
45
  async function loadConfig(cwd) {
11
46
  for (const name of TS_NAMES) {
12
47
  const p = join(cwd, name);
13
48
  if (existsSync(p)) {
14
- const mod = await import(pathToFileURL(p).href);
49
+ let mod;
50
+ if (runningFromCompiledBinary()) {
51
+ mod = await importConfigViaRuntimeBundle(p);
52
+ } else {
53
+ try {
54
+ mod = await import(pathToFileURL(p).href);
55
+ } catch (error) {
56
+ if (!isModuleResolutionError(error))
57
+ throw error;
58
+ mod = await importConfigViaRuntimeBundle(p);
59
+ }
60
+ }
15
61
  const raw = mod.default ?? mod.config;
16
62
  return decodePreservingRuntime(raw);
17
63
  }
@@ -43,7 +43,7 @@ function buildRigInitConfigSource(input) {
43
43
  lines.push(` issueUpdates: "lifecycle",`);
44
44
  lines.push(` projects: { enabled: false },`);
45
45
  lines.push(` },`);
46
- lines.push(` automation: { maxValidationAttempts: 30, maxPrFixIterations: 30 },`);
46
+ lines.push(` automation: { maxValidationAttempts: 30, maxPrFixIterations: 100500 },`);
47
47
  lines.push(` pr: { mode: "auto", watchChecks: true, autoFixChecks: true, autoFixReview: true },`);
48
48
  lines.push(` merge: { mode: "auto", method: "repo-default", deleteBranch: "repo-default", bypass: false },`);
49
49
  lines.push(` issueAnalysis: { enabled: true, harness: "pi", mode: "continuous" },`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/core",
3
- "version": "0.0.6-alpha.4",
3
+ "version": "0.0.6-alpha.41",
4
4
  "type": "module",
5
5
  "description": "Rig package",
6
6
  "license": "UNLICENSED",
@@ -31,7 +31,7 @@
31
31
  "main": "./dist/src/index.js",
32
32
  "module": "./dist/src/index.js",
33
33
  "dependencies": {
34
- "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.4",
34
+ "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.41",
35
35
  "effect": "4.0.0-beta.78"
36
36
  }
37
37
  }