@agentrix/agentrix-run 0.7.0 → 0.9.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.
- package/dist/index.cjs +51 -12
- package/dist/index.mjs +51 -12
- package/package.json +4 -5
package/dist/index.cjs
CHANGED
|
@@ -12,6 +12,7 @@ function usage() {
|
|
|
12
12
|
"",
|
|
13
13
|
"Options:",
|
|
14
14
|
" --title <text>",
|
|
15
|
+
" --client-task-id <id>",
|
|
15
16
|
" --allow-filesystem-agent",
|
|
16
17
|
" --resume <task-id>",
|
|
17
18
|
" --repo <json>",
|
|
@@ -20,6 +21,9 @@ function usage() {
|
|
|
20
21
|
" --sha <sha>",
|
|
21
22
|
" --base-ref <ref>",
|
|
22
23
|
" --head-ref <ref>",
|
|
24
|
+
" --head-sha <sha>",
|
|
25
|
+
" --checkout-ref <ref>",
|
|
26
|
+
" --checkout-sha <sha>",
|
|
23
27
|
" --branch-name <name>",
|
|
24
28
|
" --pr-number <number>",
|
|
25
29
|
" --issue-number <number>",
|
|
@@ -190,6 +194,10 @@ function parseArgs(argv) {
|
|
|
190
194
|
options.title = requireValue(argv, index, arg);
|
|
191
195
|
index += 1;
|
|
192
196
|
break;
|
|
197
|
+
case "--client-task-id":
|
|
198
|
+
options.clientTaskId = requireValue(argv, index, arg);
|
|
199
|
+
index += 1;
|
|
200
|
+
break;
|
|
193
201
|
case "--prompt":
|
|
194
202
|
options.prompt = requireValue(argv, index, arg);
|
|
195
203
|
index += 1;
|
|
@@ -218,6 +226,18 @@ function parseArgs(argv) {
|
|
|
218
226
|
options.headRef = requireValue(argv, index, arg);
|
|
219
227
|
index += 1;
|
|
220
228
|
break;
|
|
229
|
+
case "--head-sha":
|
|
230
|
+
options.headSha = requireValue(argv, index, arg);
|
|
231
|
+
index += 1;
|
|
232
|
+
break;
|
|
233
|
+
case "--checkout-ref":
|
|
234
|
+
options.checkoutRef = requireValue(argv, index, arg);
|
|
235
|
+
index += 1;
|
|
236
|
+
break;
|
|
237
|
+
case "--checkout-sha":
|
|
238
|
+
options.checkoutSha = requireValue(argv, index, arg);
|
|
239
|
+
index += 1;
|
|
240
|
+
break;
|
|
221
241
|
case "--branch-name":
|
|
222
242
|
options.branchName = requireValue(argv, index, arg);
|
|
223
243
|
index += 1;
|
|
@@ -325,6 +345,15 @@ function optionalPositiveInt(value) {
|
|
|
325
345
|
const parsed = Number.parseInt(value, 10);
|
|
326
346
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : void 0;
|
|
327
347
|
}
|
|
348
|
+
function firstEnv(...names) {
|
|
349
|
+
for (const name of names) {
|
|
350
|
+
const value = process.env[name];
|
|
351
|
+
if (value) {
|
|
352
|
+
return value;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return void 0;
|
|
356
|
+
}
|
|
328
357
|
function readBooleanEnv(name) {
|
|
329
358
|
const value = process.env[name]?.trim().toLowerCase();
|
|
330
359
|
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
@@ -367,6 +396,7 @@ function detectGithub() {
|
|
|
367
396
|
sha: process.env.GITHUB_SHA,
|
|
368
397
|
baseRef: process.env.GITHUB_BASE_REF || getNestedString(payload, "pull_request", "base", "ref"),
|
|
369
398
|
headRef: process.env.GITHUB_HEAD_REF || getNestedString(payload, "pull_request", "head", "ref"),
|
|
399
|
+
headSha: getNestedString(payload, "pull_request", "head", "sha"),
|
|
370
400
|
prNumber: getNestedNumber(payload, "pull_request", "number"),
|
|
371
401
|
issueNumber: getNestedNumber(payload, "issue", "number")
|
|
372
402
|
},
|
|
@@ -391,19 +421,24 @@ function detectGitlab() {
|
|
|
391
421
|
name: repository.name
|
|
392
422
|
},
|
|
393
423
|
git: {
|
|
394
|
-
ref:
|
|
395
|
-
sha:
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
424
|
+
ref: firstEnv("GITLAB_BRIDGE_REF_NAME", "CI_COMMIT_REF_NAME"),
|
|
425
|
+
sha: firstEnv(
|
|
426
|
+
"GITLAB_BRIDGE_HEAD_SHA",
|
|
427
|
+
"GITLAB_BRIDGE_WORKFLOW_RUN_SHA",
|
|
428
|
+
"CI_COMMIT_SHA"
|
|
429
|
+
),
|
|
430
|
+
baseRef: firstEnv("GITLAB_BRIDGE_BASE_REF", "CI_MERGE_REQUEST_TARGET_BRANCH_NAME"),
|
|
431
|
+
headRef: firstEnv("GITLAB_BRIDGE_HEAD_REF", "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"),
|
|
432
|
+
headSha: firstEnv("GITLAB_BRIDGE_HEAD_SHA", "CI_MERGE_REQUEST_SOURCE_BRANCH_SHA"),
|
|
433
|
+
prNumber: optionalPositiveInt(firstEnv("GITLAB_BRIDGE_PR_NUMBER", "CI_MERGE_REQUEST_IID")),
|
|
434
|
+
issueNumber: optionalPositiveInt(firstEnv("GITLAB_BRIDGE_ISSUE_NUMBER", "AGENTRIX_ISSUE_NUMBER"))
|
|
400
435
|
},
|
|
401
436
|
context: {
|
|
402
437
|
ciProvider: "gitlab_ci",
|
|
403
|
-
eventName:
|
|
404
|
-
eventAction: process.env.
|
|
438
|
+
eventName: firstEnv("GITLAB_BRIDGE_EVENT_NAME", "CI_PIPELINE_SOURCE"),
|
|
439
|
+
eventAction: process.env.GITLAB_BRIDGE_EVENT_ACTION,
|
|
405
440
|
jobUrl: process.env.CI_JOB_URL,
|
|
406
|
-
runUrl:
|
|
441
|
+
runUrl: firstEnv("GITLAB_BRIDGE_WORKFLOW_RUN_URL", "CI_PIPELINE_URL")
|
|
407
442
|
}
|
|
408
443
|
};
|
|
409
444
|
}
|
|
@@ -422,6 +457,7 @@ function mergeRepo(explicitRepo, detectedRepo) {
|
|
|
422
457
|
function buildRequest(options, detected) {
|
|
423
458
|
const repo = mergeRepo(options.repo, detected.repo);
|
|
424
459
|
const request = {
|
|
460
|
+
clientTaskId: options.clientTaskId,
|
|
425
461
|
agent: options.agent,
|
|
426
462
|
allowFilesystemAgent: options.allowFilesystemAgent || readBooleanEnv("AGENTRIX_ALLOW_FILESYSTEM_AGENT") || void 0,
|
|
427
463
|
responseMode: options.responseMode,
|
|
@@ -439,6 +475,9 @@ function buildRequest(options, detected) {
|
|
|
439
475
|
sha: options.sha ?? detected.git?.sha,
|
|
440
476
|
baseRef: options.baseRef ?? detected.git?.baseRef,
|
|
441
477
|
headRef: options.headRef ?? detected.git?.headRef,
|
|
478
|
+
headSha: options.headSha ?? detected.git?.headSha,
|
|
479
|
+
checkoutRef: options.checkoutRef ?? detected.git?.checkoutRef,
|
|
480
|
+
checkoutSha: options.checkoutSha ?? detected.git?.checkoutSha,
|
|
442
481
|
branchName: options.branchName || process.env.AGENTRIX_BRANCH_NAME,
|
|
443
482
|
prNumber: options.prNumber ?? detected.git?.prNumber,
|
|
444
483
|
issueNumber: options.issueNumber ?? detected.git?.issueNumber
|
|
@@ -449,10 +488,10 @@ function buildRequest(options, detected) {
|
|
|
449
488
|
},
|
|
450
489
|
context: detected.context?.ciProvider ? {
|
|
451
490
|
ciProvider: detected.context.ciProvider,
|
|
452
|
-
eventName:
|
|
453
|
-
eventAction:
|
|
491
|
+
eventName: detected.context.eventName,
|
|
492
|
+
eventAction: detected.context.eventAction,
|
|
454
493
|
jobUrl: process.env.AGENTRIX_JOB_URL || detected.context.jobUrl,
|
|
455
|
-
runUrl:
|
|
494
|
+
runUrl: detected.context.runUrl,
|
|
456
495
|
payload: detected.context.payload
|
|
457
496
|
} : void 0,
|
|
458
497
|
metadata: Object.keys(options.metadata).length > 0 ? options.metadata : void 0
|
package/dist/index.mjs
CHANGED
|
@@ -10,6 +10,7 @@ function usage() {
|
|
|
10
10
|
"",
|
|
11
11
|
"Options:",
|
|
12
12
|
" --title <text>",
|
|
13
|
+
" --client-task-id <id>",
|
|
13
14
|
" --allow-filesystem-agent",
|
|
14
15
|
" --resume <task-id>",
|
|
15
16
|
" --repo <json>",
|
|
@@ -18,6 +19,9 @@ function usage() {
|
|
|
18
19
|
" --sha <sha>",
|
|
19
20
|
" --base-ref <ref>",
|
|
20
21
|
" --head-ref <ref>",
|
|
22
|
+
" --head-sha <sha>",
|
|
23
|
+
" --checkout-ref <ref>",
|
|
24
|
+
" --checkout-sha <sha>",
|
|
21
25
|
" --branch-name <name>",
|
|
22
26
|
" --pr-number <number>",
|
|
23
27
|
" --issue-number <number>",
|
|
@@ -188,6 +192,10 @@ function parseArgs(argv) {
|
|
|
188
192
|
options.title = requireValue(argv, index, arg);
|
|
189
193
|
index += 1;
|
|
190
194
|
break;
|
|
195
|
+
case "--client-task-id":
|
|
196
|
+
options.clientTaskId = requireValue(argv, index, arg);
|
|
197
|
+
index += 1;
|
|
198
|
+
break;
|
|
191
199
|
case "--prompt":
|
|
192
200
|
options.prompt = requireValue(argv, index, arg);
|
|
193
201
|
index += 1;
|
|
@@ -216,6 +224,18 @@ function parseArgs(argv) {
|
|
|
216
224
|
options.headRef = requireValue(argv, index, arg);
|
|
217
225
|
index += 1;
|
|
218
226
|
break;
|
|
227
|
+
case "--head-sha":
|
|
228
|
+
options.headSha = requireValue(argv, index, arg);
|
|
229
|
+
index += 1;
|
|
230
|
+
break;
|
|
231
|
+
case "--checkout-ref":
|
|
232
|
+
options.checkoutRef = requireValue(argv, index, arg);
|
|
233
|
+
index += 1;
|
|
234
|
+
break;
|
|
235
|
+
case "--checkout-sha":
|
|
236
|
+
options.checkoutSha = requireValue(argv, index, arg);
|
|
237
|
+
index += 1;
|
|
238
|
+
break;
|
|
219
239
|
case "--branch-name":
|
|
220
240
|
options.branchName = requireValue(argv, index, arg);
|
|
221
241
|
index += 1;
|
|
@@ -323,6 +343,15 @@ function optionalPositiveInt(value) {
|
|
|
323
343
|
const parsed = Number.parseInt(value, 10);
|
|
324
344
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : void 0;
|
|
325
345
|
}
|
|
346
|
+
function firstEnv(...names) {
|
|
347
|
+
for (const name of names) {
|
|
348
|
+
const value = process.env[name];
|
|
349
|
+
if (value) {
|
|
350
|
+
return value;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return void 0;
|
|
354
|
+
}
|
|
326
355
|
function readBooleanEnv(name) {
|
|
327
356
|
const value = process.env[name]?.trim().toLowerCase();
|
|
328
357
|
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
@@ -365,6 +394,7 @@ function detectGithub() {
|
|
|
365
394
|
sha: process.env.GITHUB_SHA,
|
|
366
395
|
baseRef: process.env.GITHUB_BASE_REF || getNestedString(payload, "pull_request", "base", "ref"),
|
|
367
396
|
headRef: process.env.GITHUB_HEAD_REF || getNestedString(payload, "pull_request", "head", "ref"),
|
|
397
|
+
headSha: getNestedString(payload, "pull_request", "head", "sha"),
|
|
368
398
|
prNumber: getNestedNumber(payload, "pull_request", "number"),
|
|
369
399
|
issueNumber: getNestedNumber(payload, "issue", "number")
|
|
370
400
|
},
|
|
@@ -389,19 +419,24 @@ function detectGitlab() {
|
|
|
389
419
|
name: repository.name
|
|
390
420
|
},
|
|
391
421
|
git: {
|
|
392
|
-
ref:
|
|
393
|
-
sha:
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
422
|
+
ref: firstEnv("GITLAB_BRIDGE_REF_NAME", "CI_COMMIT_REF_NAME"),
|
|
423
|
+
sha: firstEnv(
|
|
424
|
+
"GITLAB_BRIDGE_HEAD_SHA",
|
|
425
|
+
"GITLAB_BRIDGE_WORKFLOW_RUN_SHA",
|
|
426
|
+
"CI_COMMIT_SHA"
|
|
427
|
+
),
|
|
428
|
+
baseRef: firstEnv("GITLAB_BRIDGE_BASE_REF", "CI_MERGE_REQUEST_TARGET_BRANCH_NAME"),
|
|
429
|
+
headRef: firstEnv("GITLAB_BRIDGE_HEAD_REF", "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"),
|
|
430
|
+
headSha: firstEnv("GITLAB_BRIDGE_HEAD_SHA", "CI_MERGE_REQUEST_SOURCE_BRANCH_SHA"),
|
|
431
|
+
prNumber: optionalPositiveInt(firstEnv("GITLAB_BRIDGE_PR_NUMBER", "CI_MERGE_REQUEST_IID")),
|
|
432
|
+
issueNumber: optionalPositiveInt(firstEnv("GITLAB_BRIDGE_ISSUE_NUMBER", "AGENTRIX_ISSUE_NUMBER"))
|
|
398
433
|
},
|
|
399
434
|
context: {
|
|
400
435
|
ciProvider: "gitlab_ci",
|
|
401
|
-
eventName:
|
|
402
|
-
eventAction: process.env.
|
|
436
|
+
eventName: firstEnv("GITLAB_BRIDGE_EVENT_NAME", "CI_PIPELINE_SOURCE"),
|
|
437
|
+
eventAction: process.env.GITLAB_BRIDGE_EVENT_ACTION,
|
|
403
438
|
jobUrl: process.env.CI_JOB_URL,
|
|
404
|
-
runUrl:
|
|
439
|
+
runUrl: firstEnv("GITLAB_BRIDGE_WORKFLOW_RUN_URL", "CI_PIPELINE_URL")
|
|
405
440
|
}
|
|
406
441
|
};
|
|
407
442
|
}
|
|
@@ -420,6 +455,7 @@ function mergeRepo(explicitRepo, detectedRepo) {
|
|
|
420
455
|
function buildRequest(options, detected) {
|
|
421
456
|
const repo = mergeRepo(options.repo, detected.repo);
|
|
422
457
|
const request = {
|
|
458
|
+
clientTaskId: options.clientTaskId,
|
|
423
459
|
agent: options.agent,
|
|
424
460
|
allowFilesystemAgent: options.allowFilesystemAgent || readBooleanEnv("AGENTRIX_ALLOW_FILESYSTEM_AGENT") || void 0,
|
|
425
461
|
responseMode: options.responseMode,
|
|
@@ -437,6 +473,9 @@ function buildRequest(options, detected) {
|
|
|
437
473
|
sha: options.sha ?? detected.git?.sha,
|
|
438
474
|
baseRef: options.baseRef ?? detected.git?.baseRef,
|
|
439
475
|
headRef: options.headRef ?? detected.git?.headRef,
|
|
476
|
+
headSha: options.headSha ?? detected.git?.headSha,
|
|
477
|
+
checkoutRef: options.checkoutRef ?? detected.git?.checkoutRef,
|
|
478
|
+
checkoutSha: options.checkoutSha ?? detected.git?.checkoutSha,
|
|
440
479
|
branchName: options.branchName || process.env.AGENTRIX_BRANCH_NAME,
|
|
441
480
|
prNumber: options.prNumber ?? detected.git?.prNumber,
|
|
442
481
|
issueNumber: options.issueNumber ?? detected.git?.issueNumber
|
|
@@ -447,10 +486,10 @@ function buildRequest(options, detected) {
|
|
|
447
486
|
},
|
|
448
487
|
context: detected.context?.ciProvider ? {
|
|
449
488
|
ciProvider: detected.context.ciProvider,
|
|
450
|
-
eventName:
|
|
451
|
-
eventAction:
|
|
489
|
+
eventName: detected.context.eventName,
|
|
490
|
+
eventAction: detected.context.eventAction,
|
|
452
491
|
jobUrl: process.env.AGENTRIX_JOB_URL || detected.context.jobUrl,
|
|
453
|
-
runUrl:
|
|
492
|
+
runUrl: detected.context.runUrl,
|
|
454
493
|
payload: detected.context.payload
|
|
455
494
|
} : void 0,
|
|
456
495
|
metadata: Object.keys(options.metadata).length > 0 ? options.metadata : void 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentrix/agentrix-run",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Native CI submit-and-observe wrapper for Agentrix",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"scripts": {
|
|
30
30
|
"typecheck": "tsc --noEmit",
|
|
31
31
|
"build": "shx rm -rf dist && tsc --noEmit && pkgroll",
|
|
32
|
-
"prepublishOnly": "
|
|
32
|
+
"prepublishOnly": "bun run build"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@agentrix/shared": "^2.
|
|
35
|
+
"@agentrix/shared": "^2.46.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": ">=20",
|
|
@@ -43,6 +43,5 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public",
|
|
45
45
|
"registry": "https://registry.npmjs.org"
|
|
46
|
-
}
|
|
47
|
-
"packageManager": "yarn@1.22.22"
|
|
46
|
+
}
|
|
48
47
|
}
|