automata-cli 0.11.0-develop.440 → 0.11.0-develop.457
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.
|
@@ -17,8 +17,8 @@ var DEFAULT_DO_WORK = {
|
|
|
17
17
|
postRunLog: true
|
|
18
18
|
};
|
|
19
19
|
var DEFAULT_DO_WORK_ISSUE_DISCUSS_PROMPT = "You are the agent named in the context below, working on a GitHub issue together with the people allowed to instruct you. Answer the messages marked NEW; the earlier messages are context only.\n\nDo not modify, create or delete any file, and do not create a branch or a pull request, UNLESS a message marked NEW explicitly asks you to implement the work. If it does: create a branch off the base branch named below, implement the change following the project's existing conventions, run the tests and the linter, and open a pull request whose body contains `Closes #<issue number>`.\n\nOtherwise do not touch the code at all: reply on the issue with the specification, the plan, or the open questions you need answered. Keep the reply short and concrete.\n\nEither way, always post a reply on the issue before you finish \u2014 including when you implemented and opened a pull request. Silence is indistinguishable from a crash, and the run will be reported as having produced no answer.";
|
|
20
|
-
var DEFAULT_DO_WORK_PR_WORK_PROMPT = "You are the agent named in the context below, working on the pull request for a GitHub issue together with the people allowed to instruct you. Work on the branch named below, which is already checked out and up to date.\n\nAddress every message marked NEW and every unresolved review thread listed. Follow the project's existing conventions, run the tests and the linter, then commit and push to that branch. Do not merge the pull request and do not push to the base branch.\n\
|
|
21
|
-
var DEFAULT_DO_WORK_PR_ORPHAN_PROMPT = "You are the agent named in the context below, working on a pull request that is not linked to any issue \u2014 a dependency bump, or another change opened without one \u2014 together with the people allowed to instruct you. Work on the branch named below, which is already checked out and up to date.\n\nAddress every message marked NEW and every unresolved review thread listed. Typical work here is finding out why the checks are failing, bringing the branch up to date with the base branch, and fixing whatever the change needs in order to be mergeable. Follow the project's existing conventions, run the tests and the linter, then commit and push to that branch.\n\nDo not merge the pull request, do not close it, and do not push to the base branch. If you conclude that it should be merged or closed, say so in your reply and leave the decision to the humans.\n\
|
|
20
|
+
var DEFAULT_DO_WORK_PR_WORK_PROMPT = "You are the agent named in the context below, working on the pull request for a GitHub issue together with the people allowed to instruct you. Work on the branch named below, which is already checked out and up to date.\n\nAddress every message marked NEW and every unresolved review thread listed. Follow the project's existing conventions, run the tests and the linter, then commit and push to that branch. Do not merge the pull request and do not push to the base branch.\n\nOnce a review thread is fixed and pushed, resolve it (GraphQL `resolveReviewThread`) after replying; leave open any thread you did not fix. Reply on the pull request with a short summary of what you changed, or reply in the review thread when your answer belongs to a specific comment. Always post a reply \u2014 silence looks like a crash.";
|
|
21
|
+
var DEFAULT_DO_WORK_PR_ORPHAN_PROMPT = "You are the agent named in the context below, working on a pull request that is not linked to any issue \u2014 a dependency bump, or another change opened without one \u2014 together with the people allowed to instruct you. Work on the branch named below, which is already checked out and up to date.\n\nAddress every message marked NEW and every unresolved review thread listed. Typical work here is finding out why the checks are failing, bringing the branch up to date with the base branch, and fixing whatever the change needs in order to be mergeable. Follow the project's existing conventions, run the tests and the linter, then commit and push to that branch.\n\nDo not merge the pull request, do not close it, and do not push to the base branch. If you conclude that it should be merged or closed, say so in your reply and leave the decision to the humans.\n\nOnce a review thread is fixed and pushed, resolve it (GraphQL `resolveReviewThread`) after replying; leave open any thread you did not fix. Reply on the pull request with a short summary of what you did and what you recommend, or reply in the review thread when your answer belongs to a specific comment. Always post a reply \u2014 silence looks like a crash.";
|
|
22
22
|
var CONFIG_DIR = ".automata";
|
|
23
23
|
var CONFIG_FILE = "config.json";
|
|
24
24
|
function configPath() {
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
readConfig,
|
|
12
12
|
readRawConfig,
|
|
13
13
|
writeConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-OUJQLQP3.js";
|
|
15
15
|
|
|
16
16
|
// src/index.ts
|
|
17
17
|
import { Command as Command7 } from "commander";
|
|
@@ -321,7 +321,7 @@ var configCommand = new Command("config").description("Configure automata settin
|
|
|
321
321
|
const [{ render }, React, { ConfigWizard }] = await Promise.all([
|
|
322
322
|
import("ink"),
|
|
323
323
|
import("react"),
|
|
324
|
-
import("./ConfigWizard-
|
|
324
|
+
import("./ConfigWizard-QZ2CJJS3.js")
|
|
325
325
|
]);
|
|
326
326
|
const { waitUntilExit } = render(React.createElement(ConfigWizard));
|
|
327
327
|
await waitUntilExit();
|
|
@@ -485,24 +485,85 @@ function mapStatus(azdoStatus) {
|
|
|
485
485
|
return azdoStatus.toUpperCase();
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
|
-
function
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
488
|
+
function mapCheckState(state) {
|
|
489
|
+
switch (state) {
|
|
490
|
+
case "succeeded":
|
|
491
|
+
return { status: "COMPLETED", conclusion: "SUCCESS" };
|
|
492
|
+
case "failed":
|
|
493
|
+
case "rejected":
|
|
494
|
+
case "error":
|
|
495
|
+
return { status: "COMPLETED", conclusion: "FAILURE" };
|
|
496
|
+
case "notApplicable":
|
|
497
|
+
case "notSet":
|
|
498
|
+
return { status: "COMPLETED", conclusion: "SKIPPED" };
|
|
499
|
+
case "queued":
|
|
500
|
+
return { status: "QUEUED", conclusion: null };
|
|
501
|
+
case "running":
|
|
502
|
+
return { status: "IN_PROGRESS", conclusion: null };
|
|
503
|
+
default:
|
|
504
|
+
return { status: "PENDING", conclusion: null };
|
|
492
505
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
506
|
+
}
|
|
507
|
+
function mapRunState(run5) {
|
|
508
|
+
if (run5.state !== "completed") return "pending";
|
|
509
|
+
switch (run5.result) {
|
|
510
|
+
case "succeeded":
|
|
511
|
+
return "succeeded";
|
|
512
|
+
case "failed":
|
|
513
|
+
return "failed";
|
|
514
|
+
case "canceled":
|
|
515
|
+
return "error";
|
|
516
|
+
default:
|
|
517
|
+
return "pending";
|
|
496
518
|
}
|
|
497
|
-
|
|
519
|
+
}
|
|
520
|
+
function toPrCheck(check) {
|
|
498
521
|
return {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
checks: []
|
|
522
|
+
name: check.name,
|
|
523
|
+
...mapCheckState(check.state),
|
|
524
|
+
description: check.description ?? "",
|
|
525
|
+
detailsUrl: check.targetUrl ?? ""
|
|
504
526
|
};
|
|
505
527
|
}
|
|
528
|
+
function runJson(args, failure) {
|
|
529
|
+
const { stdout, stderr, status } = run("azdo", [...args, "--json", "--no-update-check"]);
|
|
530
|
+
if (status !== 0) {
|
|
531
|
+
throw new Error(stderr.trim() || failure);
|
|
532
|
+
}
|
|
533
|
+
return JSON.parse(stdout);
|
|
534
|
+
}
|
|
535
|
+
function toPrInfo(pr, checks) {
|
|
536
|
+
return { number: pr.id, title: pr.title, state: mapStatus(pr.status), url: pr.url, checks };
|
|
537
|
+
}
|
|
538
|
+
function getBranchPrInfo(branch) {
|
|
539
|
+
const listed = runJson(
|
|
540
|
+
["pr", "list", "--branch", branch, "--status", "all"],
|
|
541
|
+
"Failed to list Azure DevOps pull requests. Is `azdo` installed and authenticated?"
|
|
542
|
+
);
|
|
543
|
+
const pr = listed.pullRequests[0];
|
|
544
|
+
if (pr === void 0) return null;
|
|
545
|
+
const runs = runJson(
|
|
546
|
+
["pipeline", "get-runs", "--pr", String(pr.id)],
|
|
547
|
+
"Failed to list Azure DevOps pipeline runs for the pull request."
|
|
548
|
+
);
|
|
549
|
+
const checks = runs.map(
|
|
550
|
+
(r) => toPrCheck({ state: mapRunState(r), name: `Build ${r.name ?? String(r.id)}` })
|
|
551
|
+
);
|
|
552
|
+
return toPrInfo(pr, checks);
|
|
553
|
+
}
|
|
554
|
+
function getPrInfo(branch) {
|
|
555
|
+
if (branch !== void 0) return getBranchPrInfo(branch);
|
|
556
|
+
const parsed = runJson(
|
|
557
|
+
["pr", "status"],
|
|
558
|
+
"Failed to query Azure DevOps PR status. Is `azdo` installed and authenticated?"
|
|
559
|
+
);
|
|
560
|
+
const pr = parsed.pullRequests[0];
|
|
561
|
+
if (pr === void 0) return null;
|
|
562
|
+
if (pr.checksError) {
|
|
563
|
+
throw new Error(`Azure DevOps could not retrieve the checks of PR #${pr.id}: ${pr.checksError}`);
|
|
564
|
+
}
|
|
565
|
+
return toPrInfo(pr, (pr.checks ?? []).map(toPrCheck));
|
|
566
|
+
}
|
|
506
567
|
|
|
507
568
|
// src/remote/backend.ts
|
|
508
569
|
var AZDO_GAP_DOC = "docs/azdo-gap.md";
|
|
@@ -1030,27 +1091,26 @@ async function getPrInfoGh(branch) {
|
|
|
1030
1091
|
detailsUrl: enriched?.detailsUrl || c.detailsUrl || ""
|
|
1031
1092
|
};
|
|
1032
1093
|
});
|
|
1033
|
-
|
|
1034
|
-
|
|
1094
|
+
return withSonar({ number: raw.number, title: raw.title, state: raw.state, url: raw.url, checks });
|
|
1095
|
+
}
|
|
1096
|
+
async function withSonar(pr) {
|
|
1097
|
+
const sonarCheck = pr.checks.find((c) => isSonarUrl(c.detailsUrl));
|
|
1098
|
+
if (sonarCheck === void 0) return pr;
|
|
1099
|
+
const sonar = await describeSonarCheck(sonarCheck, pr.number);
|
|
1035
1100
|
return {
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
...sonar === void 0 ? {} : {
|
|
1042
|
-
sonarcloudUrl: sonar.sonarcloudUrl,
|
|
1043
|
-
sonarNewIssues: sonar.sonarNewIssues,
|
|
1044
|
-
sonarNewIssuesNote: sonar.sonarNewIssuesNote
|
|
1045
|
-
},
|
|
1046
|
-
...sonar?.sonarFailures === void 0 ? {} : { sonarFailures: sonar.sonarFailures }
|
|
1101
|
+
...pr,
|
|
1102
|
+
sonarcloudUrl: sonar.sonarcloudUrl,
|
|
1103
|
+
sonarNewIssues: sonar.sonarNewIssues,
|
|
1104
|
+
sonarNewIssuesNote: sonar.sonarNewIssuesNote,
|
|
1105
|
+
...sonar.sonarFailures === void 0 ? {} : { sonarFailures: sonar.sonarFailures }
|
|
1047
1106
|
};
|
|
1048
1107
|
}
|
|
1049
1108
|
async function getPrInfo2(branch) {
|
|
1050
1109
|
const config = readConfig();
|
|
1051
1110
|
if (selectBackend(config) === "azdo") {
|
|
1052
1111
|
assertAzdoRemote();
|
|
1053
|
-
|
|
1112
|
+
const pr = getPrInfo(branch === getCurrentBranch() ? void 0 : branch);
|
|
1113
|
+
return pr === null ? null : withSonar(pr);
|
|
1054
1114
|
}
|
|
1055
1115
|
return getPrInfoGh(branch);
|
|
1056
1116
|
}
|