@growthagent/ci 0.9.0 → 0.10.0

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.js +43 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,4 +1,20 @@
1
1
  #!/usr/bin/env node
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __esm = (fn, res, err) => function __init() {
4
+ if (err) throw err[0];
5
+ try {
6
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
7
+ } catch (e) {
8
+ throw err = [e], e;
9
+ }
10
+ };
11
+
12
+ // ../github/src/types.ts
13
+ var init_types = __esm({
14
+ "../github/src/types.ts"() {
15
+ "use strict";
16
+ }
17
+ });
2
18
 
3
19
  // src/cli.ts
4
20
  import { execFileSync, spawnSync as spawnSync2 } from "node:child_process";
@@ -6,6 +22,9 @@ import { cpSync, existsSync as existsSync3, mkdirSync, readFileSync, writeFileSy
6
22
  import path6 from "node:path";
7
23
  import { fileURLToPath } from "node:url";
8
24
 
25
+ // ../github/src/index.ts
26
+ init_types();
27
+
9
28
  // ../github/src/app.ts
10
29
  import { createSign } from "node:crypto";
11
30
 
@@ -33,6 +52,7 @@ var DEFAULT_LIMITS = {
33
52
  import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
34
53
 
35
54
  // ../github/src/change-request.ts
55
+ init_types();
36
56
  function parseChangeRequest(body) {
37
57
  const match = body.match(/^---\n([\s\S]*?)\n---/);
38
58
  if (!match) throw new Error("change request has no front matter");
@@ -45,6 +65,9 @@ function parseChangeRequest(body) {
45
65
  return out;
46
66
  }
47
67
 
68
+ // ../github/src/cleanup-request.ts
69
+ init_types();
70
+
48
71
  // ../github/src/repos.ts
49
72
  import { execFile } from "node:child_process";
50
73
  import { mkdtempSync, existsSync, rmSync } from "node:fs";
@@ -53,6 +76,12 @@ import path3 from "node:path";
53
76
  import { promisify } from "node:util";
54
77
  var run = promisify(execFile);
55
78
 
79
+ // ../github/src/repair-request.ts
80
+ init_types();
81
+
82
+ // ../github/src/instrumentation-request.ts
83
+ init_types();
84
+
56
85
  // src/lockfiles.ts
57
86
  import { spawnSync } from "node:child_process";
58
87
  import { existsSync as existsSync2, rmSync as rmSync2 } from "node:fs";
@@ -451,11 +480,20 @@ function assetsDir() {
451
480
  return existsSync3(packaged) ? packaged : path6.join(HERE, "..", "assets", "skills");
452
481
  }
453
482
  function sh(cmd, args, opts = {}) {
454
- const r = spawnSync2(cmd, args, { encoding: "utf8", stdio: ["inherit", "pipe", "inherit"] });
483
+ return shRaw(cmd, args, opts).trim();
484
+ }
485
+ function shRaw(cmd, args, opts = {}) {
486
+ const r = spawnSync2(cmd, args, {
487
+ encoding: "utf8",
488
+ stdio: ["inherit", "pipe", "inherit"],
489
+ // A diff of a large change can exceed Node's 1MB default and be silently
490
+ // truncated, which produces the same corruption from a different cause.
491
+ maxBuffer: 64 * 1024 * 1024
492
+ });
455
493
  if (r.status !== 0 && !opts.allowFail) {
456
494
  throw new Error(`${cmd} ${args.join(" ")} exited ${r.status}`);
457
495
  }
458
- return (r.stdout ?? "").trim();
496
+ return r.stdout ?? "";
459
497
  }
460
498
  function required(name) {
461
499
  const v = process.env[name];
@@ -627,12 +665,13 @@ async function implement() {
627
665
  console.log(`\u25B8 discarded the model's ${discarded.join(", ")}; the trusted job derives it`);
628
666
  }
629
667
  sh("git", ["add", "-A"]);
630
- const patch = sh("git", ["diff", "--staged"]);
668
+ const patch = shRaw("git", ["diff", "--staged"]);
631
669
  if (!patch.trim()) {
632
670
  console.error("pi made no changes \u2014 nothing to open a PR for");
633
671
  return 2;
634
672
  }
635
- writeFileSync2(PATCH_FILE, patch + "\n", "utf8");
673
+ writeFileSync2(PATCH_FILE, patch.endsWith("\n") ? patch : `${patch}
674
+ `, "utf8");
636
675
  const verdict = validatePatch(patch);
637
676
  if (!verdict.ok) {
638
677
  console.error(`The produced patch was refused: ${verdict.reason}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growthagent/ci",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {