@magnusekdahl/parallix 1.2.1 → 1.3.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.
Files changed (81) hide show
  1. package/index.js +190 -185
  2. package/lib/agents/agents.js +34 -4
  3. package/lib/agents/agents.ts +40 -5
  4. package/lib/commands/active.js +502 -579
  5. package/lib/commands/active.ts +665 -0
  6. package/lib/commands/checkpoint.js +98 -74
  7. package/lib/commands/checkpoint.ts +79 -0
  8. package/lib/commands/config.js +61 -31
  9. package/lib/commands/config.ts +47 -0
  10. package/lib/commands/coverage-gate.js +271 -246
  11. package/lib/commands/coverage-gate.ts +362 -0
  12. package/lib/commands/diff.js +140 -119
  13. package/lib/commands/diff.ts +125 -0
  14. package/lib/commands/draft.js +770 -923
  15. package/lib/commands/draft.ts +1021 -0
  16. package/lib/commands/handoff.js +588 -608
  17. package/lib/commands/handoff.ts +694 -0
  18. package/lib/commands/integrate.js +1331 -1468
  19. package/lib/commands/integrate.ts +1688 -0
  20. package/lib/commands/mission-start.js +279 -237
  21. package/lib/commands/mission-start.ts +263 -0
  22. package/lib/commands/rebase.js +606 -582
  23. package/lib/commands/rebase.ts +635 -0
  24. package/lib/commands/repair-handoff.js +181 -179
  25. package/lib/commands/repair-handoff.ts +228 -0
  26. package/lib/commands/resolve-conflict.js +121 -102
  27. package/lib/commands/resolve-conflict.ts +112 -0
  28. package/lib/commands/review.js +3 -4
  29. package/lib/commands/review.ts +14 -0
  30. package/lib/commands/setup-review.js +4 -5
  31. package/lib/commands/setup-review.ts +14 -0
  32. package/lib/commands/setup.js +3 -3
  33. package/lib/commands/setup.ts +2 -0
  34. package/lib/commands/stats-backfill.js +394 -359
  35. package/lib/commands/stats-backfill.ts +418 -0
  36. package/lib/commands/stats.js +1424 -1665
  37. package/lib/commands/stats.ts +2186 -0
  38. package/lib/commands/status.js +219 -200
  39. package/lib/commands/status.ts +219 -0
  40. package/lib/commands/verify.js +3 -1
  41. package/lib/commands/verify.ts +2 -0
  42. package/lib/core/nels.js +112 -127
  43. package/lib/core/nels.ts +189 -0
  44. package/lib/core/subagent-limit.js +15 -16
  45. package/lib/core/subagent-limit.ts +25 -0
  46. package/lib/index.js +142 -59
  47. package/lib/index.ts +134 -0
  48. package/lib/review/rebase.js +142 -145
  49. package/lib/review/rebase.ts +188 -0
  50. package/lib/review/review-adapter.js +99 -87
  51. package/lib/review/review-adapter.ts +198 -0
  52. package/lib/review/review-artifacts.js +486 -629
  53. package/lib/review/review-artifacts.ts +622 -0
  54. package/lib/review/review-commands.js +1220 -1373
  55. package/lib/review/review-commands.ts +1579 -0
  56. package/lib/review/review-events.js +544 -886
  57. package/lib/review/review-events.ts +954 -0
  58. package/lib/review/review-loop.js +945 -1020
  59. package/lib/review/review-loop.ts +1174 -0
  60. package/lib/review/review-polling.js +86 -115
  61. package/lib/review/review-polling.ts +194 -0
  62. package/lib/review/review-prompts.js +154 -189
  63. package/lib/review/review-prompts.ts +182 -0
  64. package/lib/review/review-state.js +246 -225
  65. package/lib/review/review-state.ts +353 -0
  66. package/lib/review/review.js +63 -84
  67. package/lib/review/review.ts +138 -0
  68. package/lib/tools/backlog.js +694 -680
  69. package/lib/tools/backlog.ts +835 -0
  70. package/lib/tools/forgejo.js +1270 -1405
  71. package/lib/tools/forgejo.ts +1793 -0
  72. package/lib/tools/gatekeeper.js +106 -96
  73. package/lib/tools/gatekeeper.ts +124 -0
  74. package/lib/tools/redgreen.js +200 -181
  75. package/lib/tools/redgreen.ts +221 -0
  76. package/lib/tools/sessions.js +58 -52
  77. package/lib/tools/sessions.ts +81 -0
  78. package/lib/tools/setup-review.js +902 -975
  79. package/lib/tools/setup-review.ts +1152 -0
  80. package/package.json +4 -4
  81. package/px.js +226 -208
@@ -1,54 +1,99 @@
1
+ "use strict";
1
2
  /**
2
3
  * Review Adapter
3
4
  *
4
5
  * This module is the only review-facing provider boundary. Review code calls
5
6
  * this adapter instead of importing Forgejo or product-config directly.
6
7
  */
7
-
8
- const os = require('os');
9
- const path = require('path');
10
- const { resolveReviewAdapter, isForgejoReviewEnabled } = require('../core/product-config');
11
- const { loadAdapterConfig } = require('../core/product-config');
12
- const forgejo = require('../tools/forgejo');
13
-
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.getReviewProvider = getReviewProvider;
43
+ exports.isEnabled = isEnabled;
44
+ exports.isProviderEnabled = isProviderEnabled;
45
+ exports.isNoop = isNoop;
46
+ exports.isForgejoProvider = isForgejoProvider;
47
+ exports.resolveArtifactDir = resolveArtifactDir;
48
+ exports.getPrStatus = getPrStatus;
49
+ exports.readToken = readToken;
50
+ exports.getLatestReviewForPr = getLatestReviewForPr;
51
+ exports.getLatestDispositionForPr = getLatestDispositionForPr;
52
+ exports.postComment = postComment;
53
+ exports.postReview = postReview;
54
+ exports.createPr = createPr;
55
+ exports.forgejoAvailable = forgejoAvailable;
56
+ exports.providerAvailable = providerAvailable;
57
+ exports.getComments = getComments;
58
+ exports.closePr = closePr;
59
+ exports.resolveForgejoUser = resolveForgejoUser;
60
+ exports.resolveReviewUser = resolveReviewUser;
61
+ exports.getPrAuthor = getPrAuthor;
62
+ const os = __importStar(require("os"));
63
+ const path = __importStar(require("path"));
64
+ const product_config_js_1 = require("../core/product-config.js");
65
+ const forgejo = __importStar(require("../tools/forgejo.js"));
14
66
  const NOOP_PR_STATUS = Object.freeze({
15
- exists: false,
16
- raw: 'Forgejo PR: skipped (review provider is not forgejo).',
67
+ exists: false,
68
+ raw: 'Forgejo PR: skipped (review provider is not forgejo).',
17
69
  });
18
-
19
70
  function getReviewProvider(rootDir = process.cwd()) {
20
- return resolveReviewAdapter(rootDir).provider || null;
71
+ return (0, product_config_js_1.resolveReviewAdapter)(rootDir).provider || null;
21
72
  }
22
-
23
73
  function isEnabled(rootDir = process.cwd()) {
24
- return isForgejoReviewEnabled(rootDir);
74
+ return (0, product_config_js_1.isForgejoReviewEnabled)(rootDir);
25
75
  }
26
-
27
76
  function isProviderEnabled(rootDir = process.cwd()) {
28
- return isEnabled(rootDir);
77
+ return isEnabled(rootDir);
29
78
  }
30
-
31
79
  function isNoop(rootDir = process.cwd()) {
32
- const provider = getReviewProvider(rootDir);
33
- return provider === null || provider === 'none';
80
+ const provider = getReviewProvider(rootDir);
81
+ return provider === null || provider === 'none';
34
82
  }
35
-
36
83
  function isForgejoProvider(rootDir = process.cwd()) {
37
- return isEnabled(rootDir);
84
+ return isEnabled(rootDir);
38
85
  }
39
-
40
86
  /** @param {string} [rootDir] */
41
87
  function resolveArtifactDir(rootDir = process.cwd()) {
42
- const review = loadAdapterConfig(rootDir).review || {};
43
- const configured = typeof review.tmpDir === 'string' && review.tmpDir.trim()
44
- ? review.tmpDir.trim()
45
- : null;
46
- if (!configured) {
47
- return os.tmpdir();
48
- }
49
- return path.isAbsolute(configured) ? configured : path.resolve(rootDir, configured);
50
- }
51
-
88
+ const review = ((0, product_config_js_1.loadAdapterConfig)(rootDir).review || {});
89
+ const configured = typeof review.tmpDir === 'string' && review.tmpDir.trim()
90
+ ? review.tmpDir.trim()
91
+ : null;
92
+ if (!configured) {
93
+ return os.tmpdir();
94
+ }
95
+ return path.isAbsolute(configured) ? configured : path.resolve(rootDir, configured);
96
+ }
52
97
  /**
53
98
  * @param {string} rootDir
54
99
  * @param {Function} liveFn
@@ -56,9 +101,8 @@ function resolveArtifactDir(rootDir = process.cwd()) {
56
101
  * @returns {*}
57
102
  */
58
103
  function withForgejo(rootDir, liveFn, noopValue) {
59
- return isEnabled(rootDir) ? liveFn() : noopValue;
104
+ return isEnabled(rootDir) ? liveFn() : noopValue;
60
105
  }
61
-
62
106
  /**
63
107
  * @param {string} branch
64
108
  * @param {string} [rootDir]
@@ -66,19 +110,17 @@ function withForgejo(rootDir, liveFn, noopValue) {
66
110
  * @returns {*}
67
111
  */
68
112
  function getPrStatus(branch, rootDir = process.cwd(), options = {}) {
69
- return withForgejo(rootDir, () => forgejo.getPrStatus(branch, rootDir, options), NOOP_PR_STATUS);
113
+ return withForgejo(rootDir, () => forgejo.getPrStatus(branch, rootDir, options), NOOP_PR_STATUS);
70
114
  }
71
-
72
115
  /**
73
116
  * @param {string} user
74
117
  * @param {{rootDir?: string}} [options]
75
118
  * @returns {string|null}
76
119
  */
77
120
  function readToken(user, options = {}) {
78
- const rootDir = options.rootDir || process.cwd();
79
- return isEnabled(rootDir) ? forgejo.readToken(user) : null;
121
+ const rootDir = options.rootDir || process.cwd();
122
+ return isEnabled(rootDir) ? forgejo.readToken(user) : null;
80
123
  }
81
-
82
124
  /**
83
125
  * @param {number} prNumber
84
126
  * @param {string} reviewerUser
@@ -88,10 +130,11 @@ function readToken(user, options = {}) {
88
130
  * @returns {Promise<*|null>}
89
131
  */
90
132
  async function getLatestReviewForPr(prNumber, reviewerUser, sinceIso, token, options = {}) {
91
- if (!token) {return null;}
92
- return withForgejo(options.rootDir || process.cwd(), () => forgejo.getLatestReviewForPr(prNumber, reviewerUser, sinceIso, token, options), null);
133
+ if (!token) {
134
+ return null;
135
+ }
136
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.getLatestReviewForPr(prNumber, reviewerUser, sinceIso, token, options), null);
93
137
  }
94
-
95
138
  /**
96
139
  * @param {number} prNumber
97
140
  * @param {string} implementerUser
@@ -101,10 +144,11 @@ async function getLatestReviewForPr(prNumber, reviewerUser, sinceIso, token, opt
101
144
  * @returns {Promise<*|null>}
102
145
  */
103
146
  async function getLatestDispositionForPr(prNumber, implementerUser, sinceIso, token, options = {}) {
104
- if (!token) {return null;}
105
- return withForgejo(options.rootDir || process.cwd(), () => forgejo.getLatestDispositionForPr(prNumber, implementerUser, sinceIso, token, options), null);
147
+ if (!token) {
148
+ return null;
149
+ }
150
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.getLatestDispositionForPr(prNumber, implementerUser, sinceIso, token, options), null);
106
151
  }
107
-
108
152
  /**
109
153
  * @param {string} branch
110
154
  * @param {string} token
@@ -113,9 +157,8 @@ async function getLatestDispositionForPr(prNumber, implementerUser, sinceIso, to
113
157
  * @returns {*}
114
158
  */
115
159
  function postComment(branch, token, body, options = {}) {
116
- return withForgejo(options.rootDir || process.cwd(), () => forgejo.postComment(branch, token, body, options), { ok: true, skipped: true, reason: 'review-provider-disabled' });
160
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.postComment(branch, token, body, options), { ok: true, skipped: true, reason: 'review-provider-disabled' });
117
161
  }
118
-
119
162
  /**
120
163
  * @param {string} branch
121
164
  * @param {string} token
@@ -125,9 +168,8 @@ function postComment(branch, token, body, options = {}) {
125
168
  * @returns {*}
126
169
  */
127
170
  function postReview(branch, token, outcome, summary, options = {}) {
128
- return withForgejo(options.rootDir || process.cwd(), () => forgejo.postReview(branch, token, outcome, summary, options), { ok: true, skipped: true, reason: 'review-provider-disabled' });
171
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.postReview(branch, token, outcome, summary, options), { ok: true, skipped: true, reason: 'review-provider-disabled' });
129
172
  }
130
-
131
173
  /**
132
174
  * @param {string} branch
133
175
  * @param {string} user
@@ -136,27 +178,24 @@ function postReview(branch, token, outcome, summary, options = {}) {
136
178
  * @returns {*}
137
179
  */
138
180
  function createPr(branch, user, token, options = {}) {
139
- return withForgejo(options.rootDir || process.cwd(), () => forgejo.createPr(branch, user, token, options), { ok: true, skipped: true, url: null });
181
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.createPr(branch, user, token, options), { ok: true, skipped: true, url: null });
140
182
  }
141
-
142
183
  /**
143
184
  * @param {string} [url]
144
185
  * @param {{rootDir?: string, [key: string]: any}} [options]
145
186
  * @returns {*}
146
187
  */
147
188
  function forgejoAvailable(url = process.env.FORGEJO_URL || 'http://localhost:3300', /** @type {{rootDir?: string, [key: string]: any}} */ options = {}) {
148
- return withForgejo(options.rootDir || process.cwd(), () => forgejo.forgejoAvailable(url, /** @type {{request?: Function, timeout?: number}} */ (options)), false);
189
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.forgejoAvailable(url, options), false);
149
190
  }
150
-
151
191
  /**
152
192
  * @param {string} [url]
153
193
  * @param {{rootDir?: string, [key: string]: any}} [options]
154
194
  * @returns {*}
155
195
  */
156
196
  function providerAvailable(url = process.env.FORGEJO_URL || 'http://localhost:3300', options = {}) {
157
- return forgejoAvailable(url, options);
197
+ return forgejoAvailable(url, options);
158
198
  }
159
-
160
199
  /**
161
200
  * @param {string} branch
162
201
  * @param {string} token
@@ -164,9 +203,8 @@ function providerAvailable(url = process.env.FORGEJO_URL || 'http://localhost:33
164
203
  * @returns {Promise<*>}
165
204
  */
166
205
  async function getComments(branch, token, options = {}) {
167
- return withForgejo(options.rootDir || process.cwd(), () => forgejo.getComments(branch, token, options), []);
206
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.getComments(branch, token, options), []);
168
207
  }
169
-
170
208
  /**
171
209
  * @param {string} branch
172
210
  * @param {string} token
@@ -175,19 +213,16 @@ async function getComments(branch, token, options = {}) {
175
213
  * @returns {*}
176
214
  */
177
215
  function closePr(branch, token, user, /** @type {{rootDir?: string, [key: string]: any}} */ options = {}) {
178
- return withForgejo(options.rootDir || process.cwd(), () => (/** @type {any} */ (forgejo).closePr)(branch, token, user, options), { ok: true, skipped: true, reason: 'review-provider-disabled' });
216
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.closePr(branch, token, user, options), { ok: true, skipped: true, reason: 'review-provider-disabled' });
179
217
  }
180
-
181
218
  /** @param {string} explicitUser */
182
219
  function resolveForgejoUser(explicitUser) {
183
- return explicitUser || process.env.FORGEJO_USER || null;
220
+ return explicitUser || process.env.FORGEJO_USER || null;
184
221
  }
185
-
186
222
  /** @param {string} explicitUser */
187
223
  function resolveReviewUser(explicitUser) {
188
- return resolveForgejoUser(explicitUser);
224
+ return resolveForgejoUser(explicitUser);
189
225
  }
190
-
191
226
  /**
192
227
  * @param {string} branch
193
228
  * @param {string} token
@@ -195,28 +230,5 @@ function resolveReviewUser(explicitUser) {
195
230
  * @returns {*|null}
196
231
  */
197
232
  function getPrAuthor(branch, token, options = {}) {
198
- return withForgejo(options.rootDir || process.cwd(), () => forgejo.getPrAuthor(branch, token, options), null);
199
- }
200
-
201
- module.exports = {
202
- getReviewProvider,
203
- isEnabled,
204
- isProviderEnabled,
205
- isNoop,
206
- isForgejoProvider,
207
- resolveArtifactDir,
208
- getPrStatus,
209
- readToken,
210
- getLatestReviewForPr,
211
- getLatestDispositionForPr,
212
- postComment,
213
- postReview,
214
- createPr,
215
- forgejoAvailable,
216
- providerAvailable,
217
- getComments,
218
- closePr,
219
- resolveForgejoUser,
220
- resolveReviewUser,
221
- getPrAuthor,
222
- };
233
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.getPrAuthor(branch, token, options), null);
234
+ }
@@ -0,0 +1,198 @@
1
+ /**
2
+ * Review Adapter
3
+ *
4
+ * This module is the only review-facing provider boundary. Review code calls
5
+ * this adapter instead of importing Forgejo or product-config directly.
6
+ */
7
+
8
+ import * as os from 'os';
9
+ import * as path from 'path';
10
+ import { resolveReviewAdapter, isForgejoReviewEnabled, loadAdapterConfig } from '../core/product-config.js';
11
+ import * as forgejo from '../tools/forgejo.js';
12
+
13
+ const NOOP_PR_STATUS = Object.freeze({
14
+ exists: false,
15
+ raw: 'Forgejo PR: skipped (review provider is not forgejo).',
16
+ });
17
+
18
+ export function getReviewProvider(rootDir = process.cwd()): string | null {
19
+ return resolveReviewAdapter(rootDir).provider || null;
20
+ }
21
+
22
+ export function isEnabled(rootDir = process.cwd()): boolean {
23
+ return isForgejoReviewEnabled(rootDir);
24
+ }
25
+
26
+ export function isProviderEnabled(rootDir = process.cwd()): boolean {
27
+ return isEnabled(rootDir);
28
+ }
29
+
30
+ export function isNoop(rootDir = process.cwd()): boolean {
31
+ const provider = getReviewProvider(rootDir);
32
+ return provider === null || provider === 'none';
33
+ }
34
+
35
+ export function isForgejoProvider(rootDir = process.cwd()): boolean {
36
+ return isEnabled(rootDir);
37
+ }
38
+
39
+ /** @param {string} [rootDir] */
40
+ export function resolveArtifactDir(rootDir = process.cwd()): string {
41
+ const review = (loadAdapterConfig(rootDir).review || {}) as { tmpDir?: string };
42
+ const configured = typeof review.tmpDir === 'string' && review.tmpDir.trim()
43
+ ? review.tmpDir.trim()
44
+ : null;
45
+ if (!configured) {
46
+ return os.tmpdir();
47
+ }
48
+ return path.isAbsolute(configured) ? configured : path.resolve(rootDir, configured);
49
+ }
50
+
51
+ /**
52
+ * @param {string} rootDir
53
+ * @param {Function} liveFn
54
+ * @param {*} noopValue
55
+ * @returns {*}
56
+ */
57
+ function withForgejo(rootDir: string, liveFn: () => any, noopValue: any): any {
58
+ return isEnabled(rootDir) ? liveFn() : noopValue;
59
+ }
60
+
61
+ /**
62
+ * @param {string} branch
63
+ * @param {string} [rootDir]
64
+ * @param {{[key: string]: any}} [options]
65
+ * @returns {*}
66
+ */
67
+ export function getPrStatus(branch: string, rootDir = process.cwd(), options: { [key: string]: any } = {}) {
68
+ return withForgejo(rootDir, () => forgejo.getPrStatus(branch, rootDir, options), NOOP_PR_STATUS);
69
+ }
70
+
71
+ /**
72
+ * @param {string} user
73
+ * @param {{rootDir?: string}} [options]
74
+ * @returns {string|null}
75
+ */
76
+ export function readToken(user: string, options: { rootDir?: string } = {}): string | null {
77
+ const rootDir = options.rootDir || process.cwd();
78
+ return isEnabled(rootDir) ? forgejo.readToken(user) : null;
79
+ }
80
+
81
+ /**
82
+ * @param {number} prNumber
83
+ * @param {string} reviewerUser
84
+ * @param {string} sinceIso
85
+ * @param {string} token
86
+ * @param {{rootDir?: string, [key: string]: any}} [options]
87
+ * @returns {Promise<*|null>}
88
+ */
89
+ export async function getLatestReviewForPr(prNumber: number, reviewerUser: string, sinceIso: string, token: string, options: { rootDir?: string; [key: string]: any } = {}) {
90
+ if (!token) {return null;}
91
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.getLatestReviewForPr(prNumber, reviewerUser, sinceIso, token, options), null);
92
+ }
93
+
94
+ /**
95
+ * @param {number} prNumber
96
+ * @param {string} implementerUser
97
+ * @param {string} sinceIso
98
+ * @param {string} token
99
+ * @param {{rootDir?: string, [key: string]: any}} [options]
100
+ * @returns {Promise<*|null>}
101
+ */
102
+ export async function getLatestDispositionForPr(prNumber: number, implementerUser: string, sinceIso: string, token: string, options: { rootDir?: string; [key: string]: any } = {}) {
103
+ if (!token) {return null;}
104
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.getLatestDispositionForPr(prNumber, implementerUser, sinceIso, token, options), null);
105
+ }
106
+
107
+ /**
108
+ * @param {string} branch
109
+ * @param {string} token
110
+ * @param {string} body
111
+ * @param {{rootDir?: string, [key: string]: any}} [options]
112
+ * @returns {*}
113
+ */
114
+ export function postComment(branch: string, token: string, body: string, options: { rootDir?: string; [key: string]: any } = {}) {
115
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.postComment(branch, token, body, options), { ok: true, skipped: true, reason: 'review-provider-disabled' });
116
+ }
117
+
118
+ /**
119
+ * @param {string} branch
120
+ * @param {string} token
121
+ * @param {string} outcome
122
+ * @param {string} summary
123
+ * @param {{rootDir?: string, [key: string]: any}} [options]
124
+ * @returns {*}
125
+ */
126
+ export function postReview(branch: string, token: string, outcome: string, summary: string, options: { rootDir?: string; [key: string]: any } = {}) {
127
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.postReview(branch, token, outcome, summary, options), { ok: true, skipped: true, reason: 'review-provider-disabled' });
128
+ }
129
+
130
+ /**
131
+ * @param {string} branch
132
+ * @param {string} user
133
+ * @param {string} token
134
+ * @param {{rootDir?: string, [key: string]: any}} [options]
135
+ * @returns {*}
136
+ */
137
+ export function createPr(branch: string, user: string, token: string, options: { rootDir?: string; [key: string]: any } = {}) {
138
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.createPr(branch, user, token, options), { ok: true, skipped: true, url: null });
139
+ }
140
+
141
+ /**
142
+ * @param {string} [url]
143
+ * @param {{rootDir?: string, [key: string]: any}} [options]
144
+ * @returns {*}
145
+ */
146
+ export function forgejoAvailable(url = process.env.FORGEJO_URL || 'http://localhost:3300', /** @type {{rootDir?: string, [key: string]: any}} */ options: { rootDir?: string; [key: string]: any } = {}) {
147
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.forgejoAvailable(url, options as { request?: Function; timeout?: number }), false);
148
+ }
149
+
150
+ /**
151
+ * @param {string} [url]
152
+ * @param {{rootDir?: string, [key: string]: any}} [options]
153
+ * @returns {*}
154
+ */
155
+ export function providerAvailable(url = process.env.FORGEJO_URL || 'http://localhost:3300', options: { rootDir?: string; [key: string]: any } = {}) {
156
+ return forgejoAvailable(url, options);
157
+ }
158
+
159
+ /**
160
+ * @param {string} branch
161
+ * @param {string} token
162
+ * @param {{rootDir?: string, [key: string]: any}} [options]
163
+ * @returns {Promise<*>}
164
+ */
165
+ export async function getComments(branch: string, token: string, options: { rootDir?: string; [key: string]: unknown } = {}) {
166
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.getComments(branch, token, options), []);
167
+ }
168
+
169
+ /**
170
+ * @param {string} branch
171
+ * @param {string} token
172
+ * @param {string} user
173
+ * @param {{rootDir?: string, [key: string]: any}} [options]
174
+ * @returns {*}
175
+ */
176
+ export function closePr(branch: string, token: string, user: string, /** @type {{rootDir?: string, [key: string]: any}} */ options: { rootDir?: string; [key: string]: any } = {}) {
177
+ return withForgejo(options.rootDir || process.cwd(), () => ((forgejo as any).closePr as Function)(branch, token, user, options), { ok: true, skipped: true, reason: 'review-provider-disabled' });
178
+ }
179
+
180
+ /** @param {string} explicitUser */
181
+ export function resolveForgejoUser(explicitUser: string): string | null {
182
+ return explicitUser || process.env.FORGEJO_USER || null;
183
+ }
184
+
185
+ /** @param {string} explicitUser */
186
+ export function resolveReviewUser(explicitUser: string): string | null {
187
+ return resolveForgejoUser(explicitUser);
188
+ }
189
+
190
+ /**
191
+ * @param {string} branch
192
+ * @param {string} token
193
+ * @param {{rootDir?: string, [key: string]: any}} [options]
194
+ * @returns {*|null}
195
+ */
196
+ export function getPrAuthor(branch: string, token: string, options: { rootDir?: string; [key: string]: any } = {}) {
197
+ return withForgejo(options.rootDir || process.cwd(), () => forgejo.getPrAuthor(branch, token, options), null);
198
+ }